import sys;
from java.util import Properties;
from java.io import File;
from java.io import FileOutputStream;

outPropsLocation = sys.argv[3];
props = Properties();


clusterName = sys.argv[0]
jdbcProviderName = sys.argv[1]
datasourceName = sys.argv[2]

containmentPath='/ServerCluster:' + clusterName + '/JDBCProvider:' + jdbcProviderName + '/DataSource:' + datasourceName + '/'
datasource = AdminConfig.getid(containmentPath);
connectionProps = AdminConfig.showAttribute(datasource, 'connectionPool')


statementCacheSize = AdminConfig.showAttribute(datasource, 'statementCacheSize')
connectionTimeout = AdminConfig.showAttribute(connectionProps, 'connectionTimeout')


props.setProperty("statementCacheSize", statementCacheSize);
props.setProperty("connectionTimeout", connectionTimeout);

outPropsFile = File(outPropsLocation);
stream = FileOutputStream(outPropsFile);
props.store(stream, "DataSource Settings");
