Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
COSMOS Axis2 Framework
This page will contain information about how to use the new framework that use Axis2.
Contents
Modules in CVS
Load the following from our CVS repository:
- org.eclipse.cosmos.common
- org.eclipse.cosmos.dc.broker.ws
- org.eclipse.cosmos.dc.cmdbf.services
- org.eclipse.cosmos.dc.cmdbf.ws
- org.eclipse.cosmos.dc.datamanager.ws
- org.eclipse.cosmos.dc.service.finder
- org.eclipse.cosmos.example.mdr.registration.ws
- org.eclipse.cosmos.example.mdr.ws
- org.eclipse.cosmos.samples.cmdbf.services
Instructions for compiling the projects in eclipse
The projects require Axis2 to compile. Due to legal reasons, jar files from the Axis2 distribution are not checked into CVS. We will need the following steps to set up the development environment after checking out the code.
- Define web server (JSP 2.0 compliant) runtime
- Windows > Preferences > Server > Installed Runtimes > Add > [web server name] > Browse to install directory > OK
- Set Axis2 location
- download and unzip axis2 version 1.3 to a directory
- Important: delete the jar files from the lib directory that are not required by COSMOS. The full list of required Axis2 libraries is found here.
- Windows > Preferences > Web Services > Axis2 Preferences > set axis2 directory (installation directory, not "bin" directory) > OK
- Add a Path variable: right click on org.eclipse.cosmos.example.mdr.ws > Properties > Java build path > Libraries tab > Add variable > Configure variables... > New... > (AXIS2, [Path to axis2]) > Cancel
- Add the Axis2 Facet to
org.eclipse.cosmos.dc.broker.ws
,org.eclipse.cosmos.example.mdr.ws
andorg.eclipse.cosmos.dc.service.finder
- right click on the project, Properties > Project Facets > Modify Project... > select Axis2 Web Services > Finish > OK
Downloading and Installing a Build
- Install web server technology (e.g. Tomcat, JBoss, etc.)
- Install Axis2 1.3 on Tomcat.
- Download http://apache.mirror.rafal.ca/ws/axis2/1_3/axis2-1.3-war.zip
- Unzip axis2.war in this zip file to the webapps directory of Tomcat.
- Start Tomcat
- Edit <tomcat_dir>\webapps\axis2\WEB-INF\conf\axis2.xml to set hostname by uncommenting the following line, and change "myhost.com" to your hostname.
<parameter name="hostname" locked="true">myhost.com</parameter>
- restart tomcat
- Download a manual build of the web services here: http://download.eclipse.org/technology/cosmos/1.0.0/i10/services-0415a.zip
- Install the services by unzipping the zip file to <tomcat_dir>\webapps\axis2\WEB-INF\services
- Sample client application: http://download.eclipse.org/technology/cosmos/1.0.0/i10/TestAPI.java
Creating a web service in WTP
- create a Dynamic web project
- add Axis2 facet
- add dependencies as J2EE modules, if needed
- Create service class. Simple Java class with operations to be exposed as web service declared as public methods. These methods will accept one parameter of the type OMElement, and returns an OMElement.
- Right click on the class, New > Other > Web Service
- Change Web Service runtime to Axis2
- Next > select No Data Binding, change package name if necessary, Finish
- in service class, the parameter of the operation methods is the XML element right under the <body> element of the SOAP message. Use AXIOM API to parse the input. You can turn the XML into a simple object model. (You could use ADB or XMLBeans as object model. I choice not to use them in my work to reduce legal work. But if you really need them, please let me know asap.)
- You can model your client after the broker client: org.eclipse.cosmos.dc.broker.ws.client.BrokerClient.java.
UI Integration
The following is a list of client scenarios that covers integration points with data collectoin:
- Navigator
- Get the list of Brokers from the management domain, get a list of Data Managers from a broker
- Determine if a data manager supports certain capabilities
- Get a list of properties from a data manager (e.g. epr, display name, etc.)
- Query
- Submit a query to a mdr and return a cmdbf graph response
- Service Meta Data
- Retrieve the service meta data xml document from a mdr
- Registration
- Full Register of ci with a federating cmdbf
- Partial Register of ci with a federating cmdbf
- DeRegistration
- Full DeRegister of ci with a federating cmdbf
- Partial DeRegister of ci with a federating cmdbf
- Log Report
- get content from cbe data manager for the log report. Change report template
- Stat Report
- get content from statistical data manager for the stat report. Change report template
Data managers
List of data managers that are affected by the data collection changes
- CBE
- Statistical
- SML
- Example
- Example federating CMDB
Client API
// Broker EPR is "entry point" to COSMOS. It will need to be specified in a config file. // It looks something like: http://localhost:8080/axis2/services/Broker BrokerClient brokerClient = new BrokerClient(epr); List<DataManager> dataManagers = brokerClient.getDataManagers(); ... DataManager dataManager = dataManagers.get(0); QueryClient queryClient; RegistrationClient registrationClient; // DataManager has convenient methods for getting CMDBf query and registration clients if (dataManager.supportsCMDBfQuery()) { queryClient = dataManager.getCMDBfQueryClient(); // returns null if not supported IQueryResponse queryResponse = queryClient.graphQuery(...); } if (dataManager.supportsCMDBfRegistration()) { registrationClient = dataManager.getCMDBfRegistrationClient(); // returns null if registration service is not supported IRegistrationResponse regResponse = registrationClient.register(...); } // another way to get service clients: get EPR by namespace: especially useful for non-CMDBf services, like logging service. String queryServiceEPR = dataManager.getServiceEPR(CMDBfConstants.QUERY_SERVICE_NAMESPACE); // http://cmdbf.org/schema/1-0-0/registration if (queryServiceEPR != null) { queryClient = new QueryClient(queryServiceEPR); IQueryResponse queryResponse = queryClient.graphQuery(...); } String loggingDataManagerEPR = dataManager.getServiceEPR("http://www.eclipse.org/cosmos/loggingDataManager"); // e.g. http://www.eclipse.org/cosmos/logging if (loggingDataManagerEPR != null) { LoggingDataManagerClient loggingDataManagerClient = new LoggingDataManagerClient(loggingDataManagerEPR); loggingDataManagerClient.getAllCBE(logfilename); } // Get data structure that stores all information about supported services. // Loop through the array of services to find out what is supported. // Namespaces tells you what services are supported. /* <service> <namespace></namespace> <endpoint></endpoint> <name></name>? <description></description>? </service> */ List<Service> services = dataManager.getServices();