Configuring a ComponentIn either case (general or specific properties), the configuration of the component can be edited using the ComponentAPI from the com.engineous.sdk.component package. ComponentAPI compAPI = comp.getAPI(); The ComponentAPI interface provides generic set/get/add/call methods that take in a String for the item on which you are operating and different forms of arguments. All components at least provide access to the general component properties (e.g., description, timeout, number of retries, affinities, database lookup setting, etc.). Some components may provide a specialized implementation of the interface to edit the component-specific configuration settings for the component. The item keywords for the general properties that can be set are:
ExamplescompAPI.set("affinity", "station", "MyMachine"); compAPI.set("dblookupmode", DtComponent.DBLU_FILTER_ALL); compAPI.set("timeout", 500); compAPI.apply(); To permanently apply any changes you have made in the model using the ComponentAPI, you must call the apply() method on the API object. Component-specific configuration properties, if available, can be set or accessed this same way if the component provides the specific item keywords. For SIMULIA components, any available component-specific item keywords and how they can be used in conjunction with the ComponentAPI methods are documented in the corresponding section of the Isight Component Guide for that component. Example: Calculator ComponentComponentAPI calculatorAPI = calculatorComp.getAPI(); String calc1 = "a=b+c"; String calc2 = "e=f+g[3]"; calculatorAPI.set("expression", calc1); calculatorAPI.add("calculation", calc2); calculatorAPI.apply(); This will result in the calculator component being configured to execute the two calculations specified sequentially (because the second one was added to the expression using the "add" method). Saving a ModelIf desired, you can save the model you are building/editing to a file. OutputStream savedFile = new FileOutputStream("C:\\MyNewModel.zmf"); modelMgr.saveZippedModel(savedFile); saveZippedModel() closes the stream. |