IBM ILOG Optimization Solutions Accelerator IBM ILOG Optimization Solutions Accelerator provides the components to allow the execution and customization of IBM Industry Optimization Solutions developed with IBM ILOG ODM Enterprise V3.7.0.1. IBM ILOG Optimization Solutions Accelerator consists of two editions: the "Client Edition" and the "Server Edition". ------------------------------------------------------------------------ IBM ILOG Optimization Solutions Accelerator Server Edition V3.7.0.1 The server edition consists of the following components: 1. Data Exchange This component provides the capability to define and orchestrate advanced data import/export jobs between ODM and external components. It requires IBM DB2 V9 or V10 (including IBM DB2 Express-C V9 or V10). 2. REST API for Web Applications This component provides a REST API that exposes the ODM Enterprise data services and processing services. The component is used mainly by web-based applications delivered in IBM Industry Optimization Solutions. 3. SPSS Modeler Connector for IBM ILOG Optimization Server This component provides the capability to execute custom tasks based on SPSS Modeler streams. The component requires IBM SPSS Modeler Client 14.2 or IBM SPSS Modeler Server 14.2 and IBM SPSS Modeler Batch 14.2, or later versions 4. Custom ODM/OPL Mapping for IBM ILOG Optimization Server This component provides the capability to connect pre-existing OPL models with ODM Enterprise Data Services. The component includes a custom plug-in for the ODM Enterprise Developer Edition IDE and a runtime to interpret the custom mapping. 5. ODM Enterprise Customization Utilities This component provides a set of utility classes that help with the customization of an ODM Enterprise application. The libraries for the Server Edition can be found here: |/ODME37/SolutionServer/lib| The Java Reference Manual for the Server Edition can be found here: |/ODME37/SolutionServer/doc/html/en-US/refjava/html/index.html| The REST API Reference Documentation for the Server Edition can be found here: |/ODME37/SolutionServer/doc/html/en-US/restapi/html/index.html| ------------------------------------------------------------------------ Getting Started Using the ODM-OPL Custom Mapping Editor ODM Enterprise applications generated from the Industry Optimization Solutions Asset Portal rely on a specific logic to manage the mapping between the Application Data Model and OPL models. The motivation for this specific logic is to deal with situations where the development of the input and output OPL element data structures is not driven by the Application Data Model format (as is the case with the standard ODM Enterprise workflow when creating a project). There are cases in which high quality OPL models already exist for solving a problem. The Application Data Model for this problem would be focused on a business-oriented representation, which may differ significantly from the OPL data models: * Additional information that is irrelevant for optimization may be added. * The definition of primary keys may be different in the Application Data Model and OPL models. The Application Data Model contains all the entities that are required to populate the input data structures of the OPL models and to retrieve data elements as output. The new mapping logic is used to connect pre-existing OPL models with Application Data Models. A new type of file, identified with the |.cpsodmopl| extension, has been added to ODM Enterprise projects in order to support this new mapping logic. The ODM-OPL Custom Mapping Editor is available to open and edit the content of these new mapping |.cpsodmopl| files. Once you have installed the IBM ILOG Optimization Solutions Accelerator, the user documentation for the ODM-OPL Custom Mapping Editor is accessible from the Help menu of the IBM ILOG ODM Enterprise IDE. Executing SPSS Modeler tasks in IBM ILOG Optimization Server The SPSS Modeler connector provided in the Solutions Accelerator Server Edition makes it possible to execute custom tasks running with IBM SPSS Modeler in the IBM ILOG Optimization Server. SPSS Modeler tasks are configured the same way whether they are executed in the Optimization Server or in ODM Enterprise Planner edition. An SPSS Modeler task covers these typical activities: * Export ODM scenario data to an SPSS Modeler stream. For example, map tables of an ODM scenario into a |.csv| file used as input by an SPSS Modeler stream and map values of ODM parameter tables into parameters of the stream. * Configure, run, and control SPSS Modeler Batch execution. * Import SPSS Modeler stream output files to ODM scenario tables. * Notify end users of task progress and log details in case of configuration or execution errors. The SPSS Modeler connector uses the SPSS Modeler Batch executable (|clemb.exe|) to execute the SPSS Modeler tasks. This executable is provided in SPSS Modeler Client and as a separate module SPSS Modeler Batch of SPSS Modeler Server. By using SPSS Modeler connector with IBM ILOG Optimization Server you can efficiently solve custom SPSS Modeler tasks in parallel. For documentation about SPSS Modeler task configuration and execution see the package |/ODME37/SolutionServer/doc/html/com/ibm/optx/shared/datax/spss/package-summary.html| For documentation about ODM to SPSS Modeler stream mapping see the package |/ODME37/SolutionServer/doc/html/com/ibm/optx/shared/datax/config/package-summary.html| Using the REST API for Web Applications IBM ILOG Optimization Solutions Accelerator REST (Representational State Transfer) API for Web Applications makes it possible to integrate IBM ILOG ODM Enterprise data services and processing services based on RESTful Web Services. The REST API is developed based on the JAX-RS (JSR-311: The Java API for RESTful Web Services). It can be used to develop custom web applications for ODM Enterprise applications or to integrate ODM Enterprise application services with custom enterprise systems. The supported application server for runtime is IBM WebSphere Application Server with WebSphere Application Server Feature Pack for Web 2.0 and Mobile. Installing the REST API for Web Applications on the Application Server Please follow these steps to setup the REST API for Web Applications. 1. Install the IBM WebSphere Application Server. The WebSphere Application Server installation manual is available here . 2. Install the IBM WebSphere Application Server Feature Pack for Web 2.0 and Mobile. The WebSphere Application Server Feature Pack for Web 2.0 and Mobile installation manual is available here . 3. Package the web application archive (WAR) for the REST API for Web Applications. The WAR has specific hierarchical structure, and to package the WAR to run RESTful Web Services, you need to prepare based on this structure: |/WEB-INF/web.xml| - the web application deployment descriptor |/WEB-INF/classes| - a directory that contains server-side Java classes |/WEB-INF/lib| - a directory that contains JAR archives of libraries. The web application deployment descriptor |web.xml| is here: |/ODME37/SolutionServer/rest/web.xml| . JAR files are required from IBM ILOG ODM Enterprise V3.7, IBM ILOG Optimization Solutions Accelerator V3.7, and IBM WebSphere Application Server Feature Pack for Web 2.0 and Mobile. * Copy the following list of JAR files to the directory |WEB-INF/lib/|: |/ODME37/SolutionServer/lib/| |com.ibm.optx.shared.utils-3.7.jar| |com.ibm.optx.server.web-core-3.7.jar| |com.ibm.optx.server.web-service-3.7.jar| |/ODME37/SolutionServer/lib/external/| |commons-codec-1.3.jar| |commons-dbcp-1.4.jar| |commons-fileupload-1.2.1.jar| |commons-io-1.3.2.jar| |/ODME37/Developer/lib/| |axis2-client.jar| |com.ibm.datatools.datanotation.jar| |commons-pool-1.5.4.jar| |cplexserver-client.jar| |db2jcc.jar| |db2jcc_license_cu.jar| |derby.jar| |derbyclient.jar| |dom4j.jar| |icu4j.jar| |jaxen.jar| |lpgruntime.jar| |odmeall.jar| |odmeserver-client.jar| |oplall.jar| |oplspss.jar| |org.eclipse.core.expressions.jar| |org.eclipse.core.runtime.jar| |org.eclipse.datatools.modelbase.sql.jar| |org.eclipse.emf.common.jar| |org.eclipse.emf.ecore.change.jar| |org.eclipse.emf.ecore.jar| |org.eclipse.emf.ecore.xmi.jar| |org.eclipse.emf.edit.jar| |org.eclipse.emf.transaction.jar| |org.eclipse.emf.validation.jar| |org.eclipse.equinox.common.jar| |org.eclipse.equinox.registry.jar| |org.eclipse.gmf.runtime.notation.jar| |org.eclipse.osgi.jar| |svgdom.jar| |/web2fep/optionalLibraries/jaxrs/| |commons-lang.jar| |httpclient.jar| |httpcore.jar| |ibm-wink-jaxrs.jar| |jcl-over-slf4j.jar| |jsr311-api.jar| |slf4j-api.jar| |slf4j-jdk14.jar| |/web2fep/optionalLibraries/JSON4J/| |JSON4J.jar| * Package the WAR using the command line: |jar cvf | Notes: * || is the directory where you put all of the files to package the WAR according the specific hierarchical structure * || is the name of the war file you define, for example, |optx-rest-services.war| * || is the directory where you installed ODM Enterprise V3.7 * || is the directory where you installed IBM WebSphere Application Server 4. Set up the working directory and system environment. RESTful Web Services require a working directory, you need to create an empty directory || on the server. The contents for this directory can be found in |/ODME37/SolutionServer/rest/optx-home.zip| . Extract this archive in the directory ||. The directory has this structure |/apps/| |/apps/commons/| - The application directory in which to put all of the ODME Applications. |/apps/setup.ini| - The |setup.ini| file to set application runtime variables. Set the system environment variable |OPTX_WS_HOME| or the JVM argument |optx.ws.home| to point to the working directory ||. *Note:* If you set both the system environment variable and the JVM argument, the system environment variable will take effect first. 5. Deploying the WAR to IBM WebSphere Application Server. Deploy the WAR packaged in previous steps to IBM WebSphere Application Server using *Integrated Solution Console > Applications > New Application*. 6. Deploying the ODME Application and setting up the working directory. The ODME Application deployment manual can be found here . Copy the |odmapp| and related resources deployed in the ODM Enterprise Developer IDE to the directory |/apps/common/|. Detect the ODM Enterprise application to the RESTful Web Services Web Application by visiting this link |http://://player/apps/detect| using a web browser 7. Adding the ODME Application Administrator. If you use single user deployment mode for ODME Application. Ignore this step. If you use enterprise deployment mode for ODME Application. You need to add the ODME Application Administrator. The user name and the password you added in the ODME Application should also be set in the database through REST API or through DBMS. Connecting REST APIs using AJAX AJAX, or Asynchronous JavaScript and XML, is used to create asynchronous web applications on the client (browser) side. You can use AJAX to create a HTTP request from a browser. Here is a sample using JavaScript with Dojo: | dojo.xhrGet({ url: "http://://player/apps", handleAs: "json", preventCache: true, timeout: 50000, load: function(data){ if (data.resultCode == 200) { var appItems = data.items; *//Handle the appItems here* } else { alert('Failed to load applications, caused by ' + data.message); } }, error: function(error){ alert('Failed to load applications, caused by internal error.'); } }); | *Note:* The AJAX runtime provided by IBM WebSphere Application Server Feature Pack for Web 2.0 and Mobile can be found in the directory |/web2fep/ajax-rt_1.X| Connecting REST APIs using HTTPClient You can use REST APIs in your Java code by creating the HTTP request and parsing the HTTP response. Here is a sample using Java HttpClient to access the REST API: | import java.io.IOException; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.impl.client.DefaultHttpClient; import com.ibm.json.java.JSONObject; public class MyClient { public void listApps() { HttpClient client = new DefaultHttpClient(); HttpUriRequest httpUri = new HttpGet("http://://player/apps"); try { HttpResponse response = client.execute(httpUri); HttpEntity entity = response.getEntity(); JSONObject appItems = JSONObject.parse(entity.getContent()); *//Handle the appItems here* } catch (ClientProtocolException e) { //Handle the ClientProtocolException here } catch (IOException e) { //Handle the IOException here } } } | For documentation of the REST API for Web Applications see /ODME37/SolutionServer/doc/html/en-US/restapi/html/index.html .