1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- /***************************************************************************************
- * IBM Confidential
- *
- * OCO Source Materials
- *
- * IBM Cognos Products: Moser
- *
- * (C) Copyright IBM Corp. 2020
- *
- * The source code for this program is not published or otherwise
- * divested of its trade secrets, irrespective of what has been
- * deposited with the U.S. Copyright Office.
- *
- ***************************************************************************************/
- import java.io.IOException;
- import com.ibm.bi.platform.modeling.sdk.examples.SchemaImportHelper;
- import com.ibm.bi.platform.modeling.sdk.examples.internal.ModelingHelper;
- import com.ibm.bi.platform.modeling.sdk.examples.internal.UnexpectedHTTPResponseException;
- /**
- * example which will reload a datasource schema
- *
- */
- public class ReloadMetadataExample {
- /**
- * Execute example which will reload a datasource schema
- *
- * @param args
- * args[0] ca server url origin, e.g. http://localhost:9300/
- *
- * args[1] file location with login credentials, e.g. { "parameters": [ { "name":
- * "CAMNamespace", "value": "LDAP" }, { "name": "h_CAM_action",
- * "value": "logonAs" }, { "name": "CAMUsername", "value":
- * "hmiller" }, { "name": "CAMPassword", "value": "hillock" } ] }
- *
- * args[2] datasource store Id
- * args[3] connection store id
- * args[4] signon store id
- *
- * args[5] file location with schema import options
- * , e.g.
- * {"schema":"FOODMART","catalog":"null","type":"dataSourceSchema",
- * "schemaType":"user","defaultName":"FOODMART","status":"pending"}
- *
- * or
- *
- * { "schema": "Person", "catalog": "AdventureWorks2014",
- * "schemaType": "user", "specification": { "dataStatistics":
- * "none", "excludedTables": [], "dataSamplingSize": 1000,
- * "version": "1.0", "importPrimaryForeignKeys": true },
- * "defaultName": "AdventureWorks2014/Person", "status":
- * "pending", "type":"dataSourceSchema" }
- */
- public static void main(String[] args) {
- if (args.length < 6) {
- System.err.print(
- "Correct arguments: origin fileWithCredentials datasourceId connectionId signonId fileWithschemaImportDefintion");
- return;
- }
- String origin = args[0];
- SchemaImportHelper helper = new SchemaImportHelper(origin);
- try {
- String credentials = ModelingHelper.stringFromFile(args[1]), datasourceId = args[2],
- connectionId = args[3], signonId = args[4], importOptions = ModelingHelper.stringFromFile(args[5]);
- helper.authenticate(credentials);
- helper.runReLoadMetadataExample(datasourceId, connectionId, signonId, importOptions);
- } catch (UnexpectedHTTPResponseException e) {
- try {
- System.out.println("Response :" + ModelingHelper.httpEntityToString(e.getResponse().getEntity()));
- } catch (IOException io) {
- }
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
|