CgallenDeveloperProject

JOSIF Main Page | Developers Sandbox | cgallen Sandbox

Craig Gallen's Sandbox

Location

https://openoss.svn.sourceforge.net/svnroot/openoss/tip/sandbox/cgallen/

Content

A number of historical projects are hosted in Craig Gallen's sand box. Most of these have been migrated into the
core project tree and are no longer being worked on actively.However two projects are still of interest for those wishing to investigate using Maven 2 to build a MTOSI interface.

Experimental MTOSI code generation

Three projects have been created to experiment with code generation using Apache CXF and Maven 2.0. These projects are being used to test the generation of code from WSDL prior to the completion of the TIP Soap plugin

The following two projects have been derived from the Apache CXF MTOSI 1.0 example which is an Ant build project at http://svn.apache.org/repos/asf/cxf/trunk/distribution/src/main/release/samples/mtosi_1.1/ .

See the README.txt in each project for more information.

MTOSI 1.0 Examples

CXFMavenMtosi_1.1Alarm_retrieval

svn co https://openoss.svn.sourceforge.net/svnroot/openoss/tip/sandbox/cgallen/experimental/CXFMavenMtosi_1.1Alarm_retrieval/

CXFMavenMtosi_1.1Code_gen

svn co https://openoss.svn.sourceforge.net/svnroot/openoss/tip/sandbox/cgallen/experimental/CXFMavenMtosi_1.1Code_gen/

MTOSI 2.0 Example

The Following project is a significant rewrite of the Apache CXF MTOSI 1.0 example for MTOSI 2.0 code

CXFMavenMtosi_2.0Code_gen

svn co https://openoss.svn.sourceforge.net/svnroot/openoss/tip/sandbox/cgallen/experimental/CXFMavenMtosi_2.0Code_gen/

Instructions

The following instructions apply to CXFMavenMtosi_2.0Code_gen. The other examples follow the same basic pattern so it should be obvious which variations on these instructions will work in the examples. PLEASE NOTE THAT WHILE I HOPE THESE EXAMPLES WILL BE USEFUL, THEY ARE OFFERED WITH NO SUPPORT.

1. Install Maven 2.0.9 or greater.

Note there was a class path problem with Maven 2.1.x which has now been fixed in the CXFMavenMtosi_2.0Code_gen example. To fix the other examples you should change the order of the dependencies in the pom.xml under the maven-antrun-plugin so that ant is declared first as below. (I have not had time to fix all the examples)

	<artifactId>maven-antrun-plugin</artifactId>
        etc.
		<dependencies>
			<!-- Note Ant dependency MUST be declared before ant-contrib -->
			<!-- since ant-contrib pom pulls Ant 1.5 into classpath      -->
			<dependency>
				<groupId>org.apache.ant</groupId>
				<artifactId>ant</artifactId>
				<version>1.7.1</version>
			</dependency>
			<dependency>
				<groupId>ant-contrib</groupId>
				<artifactId>ant-contrib</artifactId>
				<version>1.0b2</version>
			</dependency>

2. Check out the example into an Eclipse workspace

svn co https://openoss.svn.sourceforge.net/svnroot/openoss/tip/sandbox/cgallen/experimental/CXFMavenMtosi_2.0Code_gen/

3. Run Maven to compile the code and run the simple tests. This will download all the dependencies and run the example.

mvn install

If all works, the install script will run the tests which will provide this sort of output:

INFO: Started SelectChannelConnector@0.0.0.0:9091
INFO - TEST: ServerClientTest Server ready...
INFO - TEST: ServerClientTest testing client
INFO - TEST: URL wsdl = http://localhost:9091/mtosi/v2/AlarmRetrieval?wsdl
03-Aug-2009 10:12:28 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromWSDL
INFO: Creating Service {http://www.tmforum.org/mtop/rtm/wsdl/ar/v1-0}AlarmRetrievalHttp from WSDL: http://localhost:9091/mtosi/v2/AlarmRetrieval?wsdl
Invoking getActiveAlarmsCountAsync using polling.
waiting for operation response...
waiting for operation response...
getActiveAlarmsCount() called.
03-Aug-2009 10:12:29 org.openoss.mtosi.experimental.alarm_retrieval.server.AlarmRetrievalImpl getActiveAlarmsCount
INFO: Executing operation getActiveAlarmsCount
waiting for operation response...
Active Alarms Count: 3

Invoking getActiveAlarmsAsync using callback.
waiting for handler to receive response...
03-Aug-2009 10:12:29 org.openoss.mtosi.experimental.alarm_retrieval.server.AlarmRetrievalImpl getActiveAlarms
INFO: Executing operation getActiveAlarms
getActiveAlarms() called.
03-Aug-2009 10:12:29 org.openoss.mtosi.experimental.alarm_retrieval.server.AlarmRetrievalImpl getActiveAlarms
INFO: Executing operation getActiveAlarms
getActiveAlarms() called.
handling asynchronous response...
getActiveAlarmsAsync operation completed.
Displaying details for 2 alarms:

Alarm #0:
        Additional Text: null
        Native Probable Cause: null
        NotificationId: null
        ObjectType: null
        X733BackedUpStatus: null
        X733EventType: null
        X733TrendIndication: null
        AcknowledgeIndication: null
        AffectedPtpRefList: null
        AliasNameList: null
        LayerRate(: org.tmforum.mtop.nrb.xsd.lay.v1.LayerRateType@598d00
    ObjectName: null
    OsTime: null
    PerceivedSeverity: PS_CLEARED
    ProbableCause: org.tmforum.mtop.nra.xsd.prc.v1.ProbableCauseType@13816e0
    SourceTime: null
    VendorExtensions: null
    X733AdditionalInformation: null
    X733BackUpObjectRef: null
    X733CorrelatedNotificationList: null
    X733MonitoredAttributeList: null
    X733ProposedRepairActionList: null
    X733SpecificProblems: null

Alarm #1:
        Additional Text: null
        Native Probable Cause: null
        NotificationId: null
        ObjectType: null
        X733BackedUpStatus: null
        X733EventType: null
        X733TrendIndication: null
        AcknowledgeIndication: null
        AffectedPtpRefList: null
        AliasNameList: null
        LayerRate(: org.tmforum.mtop.nrb.xsd.lay.v1.LayerRateType@165e55e
    ObjectName: null
    OsTime: null
    PerceivedSeverity: PS_CLEARED
    ProbableCause: org.tmforum.mtop.nra.xsd.prc.v1.ProbableCauseType@b5ac2c
    SourceTime: null
    VendorExtensions: null
    X733AdditionalInformation: null
    X733BackUpObjectRef: null
    X733CorrelatedNotificationList: null
    X733MonitoredAttributeList: null
    X733ProposedRepairActionList: null
    X733SpecificProblems: null

INFO - TEST: ServerClientTest  End of ClientTest
INFO - TEST: ServerClientTest finished testing client
INFO - TEST: ServerClientTest Server exiting

3. To work with the code in Eclipse you should use the Maven eclipse plugin to create an eclipse project with dependencies. To do this use;

mvn eclipse:eclipse

4. Open Eclipse and point at the workspace with the new project in it. Right click on the project explorer panel and select
import > import existing project into workspace. Import the <your workspace>CXFMavenMtosi_2.0Code_gen project. The project should import with no problems into your workspace

5. Make sure you have added the M2_REPO class path variable to your eclipse workspace preferences variable pointing to your local .m2/repository directory. The workspace will rebuild when this variable has been added and there should be no errors showing against the project after the recompilation.

5. To run the simple example. Navigate in your eclipse project explorer to the ServerClientTest.java under the src/test/java directory. Right click on ServerClientTest.java and select run as Junit test. The test should start the Jetty server which offers up the MTOSI service and a simple client should run to retrieve test alarms. Thats all the example does.