You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by am...@apache.org on 2007/08/13 07:06:04 UTC
svn commit: r565239 [1/5] - in /webservices/axis2/trunk/java: ./
modules/distribution/ modules/distribution/src/main/assembly/
modules/kernel/conf/ modules/rmi/ modules/rmi/src/ modules/rmi/src/org/
modules/rmi/src/org/apache/ modules/rmi/src/org/apach...
Author: amilas
Date: Sun Aug 12 22:05:58 2007
New Revision: 565239
URL: http://svn.apache.org/viewvc?view=rev&rev=565239
Log:
Add the axis2 rmi module and a sample
Added:
webservices/axis2/trunk/java/modules/rmi/
webservices/axis2/trunk/java/modules/rmi/pom.xml
webservices/axis2/trunk/java/modules/rmi/src/
webservices/axis2/trunk/java/modules/rmi/src/log4j.properties
webservices/axis2/trunk/java/modules/rmi/src/org/
webservices/axis2/trunk/java/modules/rmi/src/org/apache/
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/Configurator.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/client/
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/client/RMIClient.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/databind/
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/databind/JavaObjectSerializer.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/databind/RMIDataSource.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/databind/XmlStreamParser.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/deploy/
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/deploy/ClassDeployer.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/deploy/RMIServiceDeployer.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/deploy/config/
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/deploy/config/Config.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/deploy/config/ExtensionClasses.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/deploy/config/PackageToNamespaceMap.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/deploy/config/PackageToNamespaceMapings.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/deploy/config/Service.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/deploy/config/Services.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/exception/
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/exception/ConfigFileReadingException.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/exception/MetaDataPopulateException.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/exception/SchemaGenerationException.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/exception/XmlParsingException.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/exception/XmlSerializingException.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/metadata/
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/metadata/Attribute.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/metadata/Operation.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/metadata/Parameter.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/metadata/Service.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/metadata/Type.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/metadata/xml/
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/metadata/xml/XmlElement.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/metadata/xml/XmlImport.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/metadata/xml/XmlSchema.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/metadata/xml/XmlType.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/receiver/
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/receiver/RMIMessageReciever.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/util/
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/util/Constants.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/util/JavaTypeToConstructorMap.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/util/JavaTypeToQNameMap.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/util/NamespacePrefix.java
webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/util/Util.java
webservices/axis2/trunk/java/modules/rmi/test/
webservices/axis2/trunk/java/modules/rmi/test/com/
webservices/axis2/trunk/java/modules/rmi/test/com/test/
webservices/axis2/trunk/java/modules/rmi/test/com/test/service/
webservices/axis2/trunk/java/modules/rmi/test/org/
webservices/axis2/trunk/java/modules/rmi/test/org/apache/
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/client/
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/client/RMIClientService1Test.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/CollectionTest.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/ComplexArrayTest.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/ComplexDataBindTest.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/ComplexRequestResponseTest.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/ConfigObjectTest.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/DataBindTest.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/ExtensionRequestResponseTest.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/ExtensionTest.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/RequestResponseTest.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/SimpleArraysTest.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/SimpleDataBindTest.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/SimpleRequestResponseTest.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/dto/
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/dto/ChildClass.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/dto/ParentClass.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/dto/TestClass1.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/dto/TestClass10.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/dto/TestClass11.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/dto/TestClass2.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/dto/TestClass3.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/dto/TestClass4.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/dto/TestClass5.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/dto/TestClass6.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/dto/TestClass7.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/dto/TestClass8.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/dto/TestClass9.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/service/
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/service/Service1.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/service/Service2.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/databind/service/Service3.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/BasicServiceTest.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/ExtensionServiceTest.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/FaultServiceTest.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/TestReflection.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/TypeTest.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/service/
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/service/BasicService.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/service/ExtensionService.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/service/FaultService.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/service/dto/
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/service/dto/ChildClass.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/service/dto/ChildClass2.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/service/dto/ComplexType1.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/service/dto/ComplexType2.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/service/dto/ParentClass.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/service/exception/
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/service/exception/Exception1.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/service/exception/Exception2.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/service/exception/Exception3.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/metadata/service/exception/Exception4.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/server/
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/server/ServerTest.java
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/server/services/
webservices/axis2/trunk/java/modules/rmi/test/org/apache/axis2/rmi/server/services/Service1.java
webservices/axis2/trunk/java/modules/samples/rmi/
webservices/axis2/trunk/java/modules/samples/rmi/.build.xml.swp (with props)
webservices/axis2/trunk/java/modules/samples/rmi/README.txt
webservices/axis2/trunk/java/modules/samples/rmi/build.xml
webservices/axis2/trunk/java/modules/samples/rmi/conf/
webservices/axis2/trunk/java/modules/samples/rmi/conf/config.xml
webservices/axis2/trunk/java/modules/samples/rmi/src/
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/client/
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/client/TestService1.java
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/client/TestService2.java
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/client/TestService3.java
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/client/TestService4.java
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/server/
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/server/Service1.java
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/server/Service2.java
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/server/Service3.java
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/server/Service4.java
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/server/dto/
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/server/dto/ChildClass.java
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/server/dto/ParentClass.java
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/server/dto/TestClass1.java
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/server/exception/
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/server/exception/Exception1.java
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/server/exception/Exception2.java
webservices/axis2/trunk/java/modules/samples/rmi/src/sample/rmi/server/exception/Exception3.java
Modified:
webservices/axis2/trunk/java/modules/distribution/pom.xml
webservices/axis2/trunk/java/modules/distribution/src/main/assembly/bin-assembly.xml
webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml
webservices/axis2/trunk/java/pom.xml
Modified: webservices/axis2/trunk/java/modules/distribution/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/distribution/pom.xml?view=diff&rev=565239&r1=565238&r2=565239
==============================================================================
--- webservices/axis2/trunk/java/modules/distribution/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/distribution/pom.xml Sun Aug 12 22:05:58 2007
@@ -313,6 +313,7 @@
<mkdir dir="target/tmp-repository"/>
<mkdir dir="target/tmp-repository/modules"/>
<mkdir dir="target/tmp-repository/services"/>
+ <mkdir dir="target/tmp-repository/rmiservices"/>
<copy file="../../modules/soapmonitor/target/soapmonitor-${version}.mar" tofile="target/tmp-repository/modules/soapmonitor-${soapmonitor.mar.version}.mar"/>
<copy file="../../modules/addressing/target/addressing-${version}.mar" tofile="target/tmp-repository/modules/addressing-${addressing.mar.version}.mar"/>
Modified: webservices/axis2/trunk/java/modules/distribution/src/main/assembly/bin-assembly.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/distribution/src/main/assembly/bin-assembly.xml?view=diff&rev=565239&r1=565238&r2=565239
==============================================================================
--- webservices/axis2/trunk/java/modules/distribution/src/main/assembly/bin-assembly.xml (original)
+++ webservices/axis2/trunk/java/modules/distribution/src/main/assembly/bin-assembly.xml Sun Aug 12 22:05:58 2007
@@ -259,7 +259,13 @@
<include>mex-impl-${version}.jar</include>
</includes>
</fileSet>
-
+ <fileSet>
+ <directory>../../modules/rmi/target</directory>
+ <outputDirectory>lib</outputDirectory>
+ <includes>
+ <include>axis2-rmi-${version}.jar</include>
+ </includes>
+ </fileSet>
<fileSet>
<directory>../../legal</directory>
<outputDirectory>lib</outputDirectory>
@@ -321,6 +327,7 @@
<include>wsdl/**/*</include>
<include>yahoojsonsearch/**/*</include>
<include>yahoorestsearch/**/*</include>
+ <include>rmi/**/*</include>
</includes>
<excludes>
<exclude>**/*.iml</exclude>
Modified: webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml?view=diff&rev=565239&r1=565238&r2=565239
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml (original)
+++ webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml Sun Aug 12 22:05:58 2007
@@ -75,6 +75,8 @@
<!--POJO deployer , this will alow users to drop .class file and make that into a service-->
<deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>
+ <deployer extension=".rsa" directory="rmiservices" class="org.apache.axis2.rmi.deploy.RMIServiceDeployer"/>
+
<!-- Following parameter will set the host name for the epr-->
<!--<parameter name="hostname" locked="true">myhost.com</parameter>-->
Added: webservices/axis2/trunk/java/modules/rmi/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rmi/pom.xml?view=auto&rev=565239
==============================================================================
--- webservices/axis2/trunk/java/modules/rmi/pom.xml (added)
+++ webservices/axis2/trunk/java/modules/rmi/pom.xml Sun Aug 12 22:05:58 2007
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<project
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-parent</artifactId>
+ <version>SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>axis2-rmi</artifactId>
+ <name>Apache Axis 2.0 - Remote Method Invocation</name>
+ <description>Axis2 Remote Method Invocation</description>
+ <scm>
+ <connection>
+ scm:svn:http://svn.apache.org/repos/asf/webservices/axis2/trunk/java/modules/rmi</connection>
+ <developerConnection>
+ scm:svn:https://svn.apache.org/repos/asf/webservices/axis2/trunk/java/modules/rmi</developerConnection>
+ <url>http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rmi</url>
+ </scm>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>axis2-adb</artifactId>
+ <version>${version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <sourceDirectory>src</sourceDirectory>
+ <testSourceDirectory>test</testSourceDirectory>
+ <resources>
+ <resource>
+ <directory>src</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <skip>false</skip>
+ <excludes>
+ <exclude>**/RMIClientService1Test.java</exclude>
+ <exclude>**/ServerTest.java</exclude>
+ <exclude>**/DataBindTest.java</exclude>
+ <exclude>**/RequestResponseTest.java</exclude>
+ </excludes>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: webservices/axis2/trunk/java/modules/rmi/src/log4j.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rmi/src/log4j.properties?view=auto&rev=565239
==============================================================================
--- webservices/axis2/trunk/java/modules/rmi/src/log4j.properties (added)
+++ webservices/axis2/trunk/java/modules/rmi/src/log4j.properties Sun Aug 12 22:05:58 2007
@@ -0,0 +1,37 @@
+# -------------------------------------------------------------------
+# Copyright 2001-2004 The Apache Software Foundation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -------------------------------------------------------------------
+
+# Set root category priority to INFO and its only appender to CONSOLE.
+log4j.rootCategory=INFO, CONSOLE
+#log4j.rootCategory=INFO, CONSOLE, LOGFILE
+
+# Set the enterprise logger priority to FATAL
+log4j.logger.org.apache.axis2.enterprise=FATAL
+log4j.logger.de.hunsicker.jalopy.io=FATAL
+log4j.logger.httpclient.wire.header=FATAL
+log4j.logger.org.apache.commons.httpclient=FATAL
+
+# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d %-5p %c - %m%n
+
+# LOGFILE is set to be a File appender using a PatternLayout.
+log4j.appender.LOGFILE=org.apache.log4j.FileAppender
+log4j.appender.LOGFILE.File=axis2.log
+log4j.appender.LOGFILE.Append=true
+log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
\ No newline at end of file
Added: webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/Configurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/Configurator.java?view=auto&rev=565239
==============================================================================
--- webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/Configurator.java (added)
+++ webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/Configurator.java Sun Aug 12 22:05:58 2007
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.rmi;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * this class is used to keep all the
+ * user defined configuration parameters
+ */
+public class Configurator {
+
+ private boolean isBare;
+ private List extensionClasses;
+ private Map packageToNamespaceMap;
+
+ public Configurator() {
+ this.extensionClasses = new ArrayList();
+ this.packageToNamespaceMap = new HashMap();
+ }
+
+ public String getNamespace(String packageName){
+ if (this.packageToNamespaceMap.containsKey(packageName)){
+ return (String) this.packageToNamespaceMap.get(packageName);
+ } else {
+ return "urn:" + packageName;
+ }
+ }
+
+ public void addExtension(Class extensionClass){
+ this.extensionClasses.add(extensionClass);
+ }
+
+ public void addPackageToNamespaceMaping(String packageName,
+ String namespace){
+ this.packageToNamespaceMap.put(packageName,namespace);
+ }
+
+ public boolean isBare() {
+ return isBare;
+ }
+
+ public void setBare(boolean bare) {
+ isBare = bare;
+ }
+
+ public List getExtensionClasses() {
+ return extensionClasses;
+ }
+
+ public void setExtensionClasses(List extensionClasses) {
+ this.extensionClasses = extensionClasses;
+ }
+}
Added: webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/client/RMIClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/client/RMIClient.java?view=auto&rev=565239
==============================================================================
--- webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/client/RMIClient.java (added)
+++ webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/client/RMIClient.java Sun Aug 12 22:05:58 2007
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.rmi.client;
+
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter;
+import org.apache.axis2.rmi.metadata.Service;
+import org.apache.axis2.rmi.metadata.Operation;
+import org.apache.axis2.rmi.metadata.Parameter;
+import org.apache.axis2.rmi.metadata.xml.XmlElement;
+import org.apache.axis2.rmi.Configurator;
+import org.apache.axis2.rmi.databind.RMIDataSource;
+import org.apache.axis2.rmi.databind.JavaObjectSerializer;
+import org.apache.axis2.rmi.databind.XmlStreamParser;
+import org.apache.axis2.rmi.exception.MetaDataPopulateException;
+import org.apache.axis2.rmi.exception.XmlSerializingException;
+import org.apache.axis2.rmi.exception.XmlParsingException;
+import org.apache.axis2.rmi.exception.SchemaGenerationException;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMDataSource;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import java.net.URL;
+import java.util.List;
+
+
+public class RMIClient extends ServiceClient {
+
+ private Service service;
+ private JavaObjectSerializer javaObjectSerializer;
+ private XmlStreamParser xmlStreamParser;
+
+ public RMIClient(ConfigurationContext configContext,
+ AxisService axisService)
+ throws AxisFault {
+ super(configContext, axisService);
+ }
+
+ public RMIClient(ConfigurationContext configContext,
+ Definition wsdl4jDefinition,
+ QName wsdlServiceName,
+ String portName)
+ throws AxisFault {
+ super(configContext, wsdl4jDefinition, wsdlServiceName, portName);
+ }
+
+ public RMIClient(ConfigurationContext configContext,
+ URL wsdlURL,
+ QName wsdlServiceName,
+ String portName) throws AxisFault {
+ super(configContext, wsdlURL, wsdlServiceName, portName);
+ }
+
+ public RMIClient(Class serviceClass,
+ Configurator configurator,
+ String epr) throws AxisFault {
+ this.service = new Service(serviceClass, configurator);
+ this.setTargetEPR(new EndpointReference(epr));
+ try {
+ this.service.populateMetaData();
+ this.service.generateWSDL();
+ this.javaObjectSerializer = new JavaObjectSerializer(
+ this.service.getProcessedTypeMap(),
+ configurator,
+ this.service.getSchemaMap());
+ this.xmlStreamParser = new XmlStreamParser(
+ this.service.getProcessedTypeMap(),
+ configurator,
+ this.service.getSchemaMap());
+ } catch (MetaDataPopulateException e) {
+ throw AxisFault.makeFault(e);
+ } catch (SchemaGenerationException e) {
+ throw AxisFault.makeFault(e);
+ }
+ }
+
+ public RMIClient(Class serviceClass,
+ String epr) throws AxisFault {
+ this(serviceClass, new Configurator(), epr);
+ }
+
+ public Object invokeMethod(String operationName,
+ List inputObjects) throws Exception {
+
+ Operation operation = this.service.getOperation(operationName);
+ OMElement inputOMElement = getInputOMElement(inputObjects,
+ operation,
+ this.javaObjectSerializer,
+ OMAbstractFactory.getOMFactory());
+ this.getOptions().setAction("urn:" + operationName);
+ Object returnObject = null;
+ try {
+
+ OMElement returnOMElement = this.sendReceive(inputOMElement);
+ returnObject = this.xmlStreamParser.getOutputObject(
+ returnOMElement.getXMLStreamReaderWithoutCaching(),
+ operation);
+ } catch (XMLStreamException e) {
+ throw AxisFault.makeFault(e);
+ } catch (XmlParsingException e) {
+ throw AxisFault.makeFault(e);
+ } catch (AxisFault axisFault){
+ OMElement detailElement = axisFault.getDetail();
+ if (detailElement != null){
+ QName elementQName = detailElement.getQName();
+ Parameter parameter = this.service.getExceptionParameter(elementQName);
+ if (parameter != null){
+ Exception customException = (Exception) this.xmlStreamParser.getObjectForParameter(
+ detailElement.getXMLStreamReaderWithoutCaching(),
+ parameter);
+ throw customException;
+ }
+ throw axisFault;
+ }
+ throw axisFault;
+ }
+
+ return returnObject;
+ }
+
+ private OMElement getInputOMElement(final List inputObjects,
+ final Operation operation,
+ final JavaObjectSerializer javaObjectSerializer,
+ OMFactory omFactory) {
+ OMDataSource omDataSource = new RMIDataSource() {
+
+ public void serialize(MTOMAwareXMLStreamWriter xmlWriter) throws XMLStreamException {
+ try {
+ javaObjectSerializer.serializeInputElement(inputObjects,
+ operation.getInputElement(),
+ operation.getInputParameters(),
+ xmlWriter);
+ } catch (XmlSerializingException e) {
+ new XMLStreamException("Problem in serializing the return object", e);
+ }
+ }
+ };
+ XmlElement inputXmlElement = operation.getInputElement();
+ QName inputElementQName = new QName(inputXmlElement.getNamespace(), inputXmlElement.getName());
+ return new OMSourcedElementImpl(inputElementQName, omFactory, omDataSource);
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/databind/JavaObjectSerializer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/databind/JavaObjectSerializer.java?view=auto&rev=565239
==============================================================================
--- webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/databind/JavaObjectSerializer.java (added)
+++ webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/databind/JavaObjectSerializer.java Sun Aug 12 22:05:58 2007
@@ -0,0 +1,370 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.rmi.databind;
+
+import org.apache.axis2.rmi.metadata.Type;
+import org.apache.axis2.rmi.metadata.Attribute;
+import org.apache.axis2.rmi.metadata.Parameter;
+import org.apache.axis2.rmi.metadata.xml.XmlElement;
+import org.apache.axis2.rmi.util.Constants;
+import org.apache.axis2.rmi.util.NamespacePrefix;
+import org.apache.axis2.rmi.util.JavaTypeToQNameMap;
+import org.apache.axis2.rmi.exception.XmlSerializingException;
+import org.apache.axis2.rmi.exception.MetaDataPopulateException;
+import org.apache.axis2.rmi.exception.SchemaGenerationException;
+import org.apache.axis2.rmi.Configurator;
+import org.apache.axis2.databinding.utils.ConverterUtil;
+
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Collection;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Array;
+
+/**
+ * this class serializes a given java object with its corresponding
+ * type object
+ */
+public class JavaObjectSerializer {
+
+ private Map processedTypeMap;
+ private Configurator configurator;
+ private Map schemaMap;
+
+ public JavaObjectSerializer(Map processedTypeMap,
+ Configurator configurator,
+ Map schemaMap) {
+ this.processedTypeMap = processedTypeMap;
+ this.configurator = configurator;
+ this.schemaMap = schemaMap;
+ }
+
+ /**
+ * serialize all the input parameters
+ * @param objects
+ * @param inputXmlElement
+ * @param inputParameters
+ * @param writer
+ * @throws XMLStreamException
+ * @throws XmlSerializingException
+ */
+
+ public void serializeInputElement(List objects,
+ XmlElement inputXmlElement,
+ List inputParameters,
+ XMLStreamWriter writer) throws XMLStreamException,
+ XmlSerializingException {
+ NamespacePrefix namespacePrefix = new NamespacePrefix();
+ writeStartElement(writer,
+ inputXmlElement.getNamespace(),
+ inputXmlElement.getName(),
+ namespacePrefix);
+ for (int i = 0; i < objects.size(); i++) {
+ serializeParameter(objects.get(i),
+ (Parameter) inputParameters.get(i),
+ writer,
+ namespacePrefix);
+ }
+ writer.writeEndElement();
+ }
+
+ /**
+ * serialize the out put parameter
+ * @param object
+ * @param outputXmlElement
+ * @param outputParameter
+ * @param writer
+ * @throws XMLStreamException
+ * @throws XmlSerializingException
+ */
+
+ public void serializeOutputElement(Object object,
+ XmlElement outputXmlElement,
+ Parameter outputParameter,
+ XMLStreamWriter writer)
+ throws XMLStreamException, XmlSerializingException {
+ NamespacePrefix namespacePrefix = new NamespacePrefix();
+ //write output start element
+ writeStartElement(writer,
+ outputXmlElement.getNamespace(),
+ outputXmlElement.getName(),
+ namespacePrefix);
+ if (outputParameter != null) {
+ // null means this is the void type
+ serializeParameter(object, outputParameter, writer, namespacePrefix);
+ }
+ writer.writeEndElement();
+ }
+
+ /**
+ * serailize the parameter object. parameter represents an xml element.
+ * so it basically calls to the serialize element method.
+ * @param parameterValue
+ * @param parameter
+ * @param writer
+ * @param namespacePrefix
+ * @throws XMLStreamException
+ * @throws XmlSerializingException
+ */
+ public void serializeParameter(Object parameterValue,
+ Parameter parameter,
+ XMLStreamWriter writer,
+ NamespacePrefix namespacePrefix)
+ throws XMLStreamException,
+ XmlSerializingException {
+ QName parameterQName = new QName(parameter.getNamespace(), parameter.getName());
+ serializeElement(parameterValue,
+ parameterQName,
+ parameter.getType(),
+ writer,
+ namespacePrefix,
+ parameter.isArray(),
+ parameter.getClassType());
+ }
+
+ /**
+ * serailizes an element. elements can either be parameter or an attribute.
+ * @param elementValue
+ * @param elementQName
+ * @param elementType
+ * @param writer
+ * @param namespacePrefix
+ * @param isArray
+ * @param classType
+ * @throws XmlSerializingException
+ * @throws XMLStreamException
+ */
+
+ private void serializeElement(Object elementValue,
+ QName elementQName,
+ Type elementType,
+ XMLStreamWriter writer,
+ NamespacePrefix namespacePrefix,
+ boolean isArray,
+ int classType)
+ throws XmlSerializingException, XMLStreamException {
+ if ((elementValue == null) || !isArray) {
+ // then we can serializeInputElement it directly either it is array or not
+ serialize(elementValue,
+ elementQName,
+ elementType,
+ writer,
+ namespacePrefix);
+ } else {
+
+ // if this is a List we convert this to an Object array
+ if ((classType & Constants.COLLECTION_TYPE) == Constants.COLLECTION_TYPE) {
+ elementValue = ((Collection) elementValue).toArray();
+ }
+ // TODO: handle maps properly
+ int length = Array.getLength(elementValue);
+ Object object;
+ for (int i = 0; i < length; i++) {
+ object = Array.get(elementValue, i);
+ serialize(object,
+ elementQName,
+ elementType,
+ writer,
+ namespacePrefix);
+ }
+ }
+ }
+
+ /**
+ * this method serailizes the given object according to the type information
+ * given.
+ *
+ * @param object
+ * @param type
+ * @param writer
+ */
+
+ public void serialize(Object object,
+ QName parentQName,
+ Type type,
+ XMLStreamWriter writer,
+ NamespacePrefix namespacePrefix)
+ throws XMLStreamException,
+ XmlSerializingException {
+
+ // first write the start element
+ writeStartElement(writer,
+ parentQName.getNamespaceURI(),
+ parentQName.getLocalPart(),
+ namespacePrefix);
+ if (object == null) {
+ writeNullAttribute(writer, namespacePrefix);
+ } else {
+ // handle extensions here.
+ // primitive can not have excented types
+ if (!object.getClass().equals(type.getJavaClass()) && !type.getJavaClass().isPrimitive()) {
+ // i.e this is an extension
+ if (!processedTypeMap.containsKey(object.getClass())) {
+ Type newType = new Type(object.getClass());
+ processedTypeMap.put(object.getClass(), newType);
+ try {
+ newType.populateMetaData(this.configurator, this.processedTypeMap);
+ newType.generateSchema(this.configurator, this.schemaMap);
+ } catch (MetaDataPopulateException e) {
+ new XmlSerializingException("Problem in processing new type", e);
+ } catch (SchemaGenerationException e) {
+ new XmlSerializingException("Problem in processing new type", e);
+ }
+ }
+ type = (Type) processedTypeMap.get(object.getClass());
+ writeTypeAttribute(writer, type.getXmlType().getQname(), namespacePrefix);
+ }
+
+ if (type.getXmlType().isSimpleType()) {
+ // this is a know type for us
+ // get the string represenation of this object using converter util class.
+ try {
+ Class converterUtilClass = ConverterUtil.class;
+ Method methodToInvoke = converterUtilClass.getMethod("convertToString", new Class[]{type.getJavaClass()});
+ // these methods are static so use null as the object argument
+ String stringValue = (String) methodToInvoke.invoke(null, new Object[]{object});
+ if (!type.getJavaClass().equals(Object.class)) {
+ writer.writeCharacters(stringValue);
+ }
+ } catch (NoSuchMethodException e) {
+ new XmlSerializingException("Can not invoke converter util method convertToString for class "
+ + type.getJavaClass().getName(), e);
+ } catch (IllegalAccessException e) {
+ new XmlSerializingException("Can not invoke converter util method convertToString for class "
+ + type.getJavaClass().getName(), e);
+ } catch (InvocationTargetException e) {
+ new XmlSerializingException("Can not invoke converter util method convertToString for class "
+ + type.getJavaClass().getName(), e);
+ }
+
+ } else {
+ // this is a complex type
+ try {
+ // write the attributes
+ Attribute attribute;
+ Method getterMethod;
+ Object attributeValue;
+ QName attributeQName;
+ for (Iterator iter = type.getAllAttributes().iterator(); iter.hasNext();) {
+ attribute = (Attribute) iter.next();
+ getterMethod = attribute.getGetterMethod();
+ attributeValue = getterMethod.invoke(object, new Object[]{});
+ serializeAttribute(attributeValue,
+ attribute,
+ writer,
+ namespacePrefix);
+
+ }
+ } catch (IllegalAccessException e) {
+ throw new XmlSerializingException("problem with method inovocation " + type.getName());
+ } catch (InvocationTargetException e) {
+ throw new XmlSerializingException("problem with method inovocation " + type.getName());
+ }
+
+ }
+ }
+ writer.writeEndElement();
+ }
+
+ /**
+ * this method serializes the attributes by calling to serialize element method.
+ *
+ * @param attributeValue
+ * @param attribute
+ * @param writer
+ * @param namespacePrefix
+ */
+ private void serializeAttribute(Object attributeValue,
+ Attribute attribute,
+ XMLStreamWriter writer,
+ NamespacePrefix namespacePrefix)
+ throws XmlSerializingException, XMLStreamException {
+
+ QName attribueQName = new QName(attribute.getElement().getNamespace(),
+ attribute.getElement().getName());
+ serializeElement(attributeValue,
+ attribueQName,
+ attribute.getType(),
+ writer,
+ namespacePrefix,
+ attribute.isArray(),
+ attribute.getClassType());
+
+ }
+
+ private void writeStartElement(XMLStreamWriter writer,
+ String namespace,
+ String localPart,
+ NamespacePrefix namespacePrefix)
+ throws XMLStreamException {
+ if (!namespace.equals("")) {
+ String prefix = writer.getPrefix(namespace);
+ if (prefix == null) {
+ prefix = "ns" + namespacePrefix.getNamesapcePrefix();
+ writer.writeStartElement(prefix, localPart, namespace);
+ writer.writeNamespace(prefix, namespace);
+ writer.setPrefix(prefix, namespace);
+ } else {
+ writer.writeStartElement(namespace, localPart);
+ }
+ } else {
+ writer.writeStartElement(localPart);
+ }
+
+ }
+
+ private void writeTypeAttribute(XMLStreamWriter writer,
+ QName typeQname,
+ NamespacePrefix namespacePrefix)
+ throws XMLStreamException {
+ String xsiPrefix = writer.getPrefix(Constants.URI_DEFAULT_SCHEMA_XSI);
+ if (xsiPrefix == null) {
+ xsiPrefix = "ns" + namespacePrefix.getNamesapcePrefix();
+ writer.writeNamespace(xsiPrefix, Constants.URI_DEFAULT_SCHEMA_XSI);
+ writer.setPrefix(xsiPrefix, Constants.URI_DEFAULT_SCHEMA_XSI);
+ }
+
+ String typePrefix = writer.getPrefix(typeQname.getNamespaceURI());
+ if (typePrefix == null) {
+ typePrefix = "ns" + namespacePrefix.getNamesapcePrefix();
+ writer.writeNamespace(typePrefix, typeQname.getNamespaceURI());
+ writer.setPrefix(typePrefix, typeQname.getNamespaceURI());
+ }
+
+ String attributeValue = typeQname.getLocalPart();
+ if (!typePrefix.equals("")) {
+ attributeValue = typePrefix + ":" + attributeValue;
+ }
+ writer.writeAttribute(Constants.URI_DEFAULT_SCHEMA_XSI, "type", attributeValue);
+ }
+
+ private void writeNullAttribute(XMLStreamWriter writer,
+ NamespacePrefix namespacePrefix)
+ throws XMLStreamException {
+ String prefix = writer.getPrefix(Constants.URI_DEFAULT_SCHEMA_XSI);
+ if (prefix == null) {
+ prefix = "ns" + namespacePrefix.getNamesapcePrefix();
+ writer.writeNamespace(prefix, Constants.URI_DEFAULT_SCHEMA_XSI);
+ writer.setPrefix(prefix, Constants.URI_DEFAULT_SCHEMA_XSI);
+ }
+ writer.writeAttribute(Constants.URI_DEFAULT_SCHEMA_XSI, "nil", "1");
+ }
+}
Added: webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/databind/RMIDataSource.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/databind/RMIDataSource.java?view=auto&rev=565239
==============================================================================
--- webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/databind/RMIDataSource.java (added)
+++ webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/databind/RMIDataSource.java Sun Aug 12 22:05:58 2007
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.rmi.databind;
+
+import org.apache.axiom.om.OMDataSource;
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter;
+import org.apache.axis2.databinding.utils.writer.MTOMAwareOMBuilder;
+import org.apache.axis2.databinding.utils.writer.MTOMAwareXMLSerializer;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamReader;
+import java.io.OutputStream;
+import java.io.Writer;
+
+
+public abstract class RMIDataSource implements OMDataSource {
+ public void serialize(OutputStream outputStream,
+ OMOutputFormat omOutputFormat) throws XMLStreamException {
+ XMLStreamWriter xmlStreamWriter = StAXUtils.createXMLStreamWriter(outputStream);
+ serialize(xmlStreamWriter);
+ xmlStreamWriter.flush();
+ }
+
+ public void serialize(Writer writer,
+ OMOutputFormat omOutputFormat) throws XMLStreamException {
+ serialize(StAXUtils.createXMLStreamWriter(writer));
+ }
+
+ public void serialize(XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
+ MTOMAwareXMLStreamWriter mtomAwareXMLStreamWriter = new MTOMAwareXMLSerializer(xmlStreamWriter);
+ serialize(mtomAwareXMLStreamWriter);
+ }
+
+ public XMLStreamReader getReader() throws XMLStreamException {
+ // since only ADBBeans related to elements can be serialized
+ // we are safe in passing null here.
+ MTOMAwareOMBuilder mtomAwareOMBuilder = new MTOMAwareOMBuilder();
+ serialize(mtomAwareOMBuilder);
+ return mtomAwareOMBuilder.getOMElement().getXMLStreamReader();
+ }
+
+ public abstract void serialize(MTOMAwareXMLStreamWriter xmlWriter) throws XMLStreamException;
+}
Added: webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/databind/XmlStreamParser.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/databind/XmlStreamParser.java?view=auto&rev=565239
==============================================================================
--- webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/databind/XmlStreamParser.java (added)
+++ webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/databind/XmlStreamParser.java Sun Aug 12 22:05:58 2007
@@ -0,0 +1,554 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.rmi.databind;
+
+import org.apache.axis2.rmi.metadata.Attribute;
+import org.apache.axis2.rmi.metadata.Type;
+import org.apache.axis2.rmi.metadata.Parameter;
+import org.apache.axis2.rmi.metadata.Operation;
+import org.apache.axis2.rmi.exception.XmlParsingException;
+import org.apache.axis2.rmi.exception.MetaDataPopulateException;
+import org.apache.axis2.rmi.exception.SchemaGenerationException;
+import org.apache.axis2.rmi.util.Constants;
+import org.apache.axis2.rmi.util.JavaTypeToQNameMap;
+import org.apache.axis2.rmi.Configurator;
+import org.apache.axis2.databinding.utils.ConverterUtil;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.namespace.QName;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.util.*;
+
+
+public class XmlStreamParser {
+
+ private Configurator configurator;
+ private Map qNameToTypeMap;
+
+ public XmlStreamParser(Map processedTypeMap,
+ Configurator configurator,
+ Map schemaMap) {
+ this.configurator = configurator;
+ try {
+ populateQNameToTypeMap(processedTypeMap, schemaMap);
+ } catch (MetaDataPopulateException e) {
+ // TODO: what to do this exceptions is not going to happen
+ } catch (SchemaGenerationException e) {
+ // TODO: what to do thsi exceptions is not going to happen
+ }
+ }
+
+ private void populateQNameToTypeMap(Map processedTypeMap, Map schemaMap)
+ throws MetaDataPopulateException,
+ SchemaGenerationException {
+ // first add all the proceced type map values
+ Set defaultTypeMapKeys = JavaTypeToQNameMap.getKeys();
+ Class typeClass;
+ for (Iterator iter = defaultTypeMapKeys.iterator(); iter.hasNext();) {
+ typeClass = (Class) iter.next();
+ if (!processedTypeMap.containsKey(typeClass)) {
+ Type newType = new Type(typeClass);
+ processedTypeMap.put(typeClass, newType);
+ newType.populateMetaData(this.configurator, processedTypeMap);
+ newType.generateSchema(this.configurator, schemaMap);
+ }
+ }
+ this.qNameToTypeMap = new HashMap();
+ Type type = null;
+ for (Iterator iter = processedTypeMap.values().iterator(); iter.hasNext();) {
+ type = (Type) iter.next();
+ this.qNameToTypeMap.put(type.getXmlType().getQname(), type);
+ }
+
+ }
+
+ public Object getOutputObject(XMLStreamReader reader,
+ Operation operation)
+ throws XMLStreamException, XmlParsingException {
+ Object returnObject = null;
+ // first we have to point to the reader to the begining of the element
+ while (!reader.isStartElement() && !reader.isEndElement()) {
+ reader.next();
+ }
+
+ // first check whether we have got the correct input element or not
+ if (reader.getLocalName().equals(operation.getOutPutElement().getName()) &&
+ reader.getNamespaceURI().equals(operation.getOutPutElement().getNamespace())) {
+ reader.next();
+ if (operation.getOutputParameter() != null) {
+ // i.e this is not a void return type
+ returnObject = getObjectForParameter(reader, operation.getOutputParameter());
+ }
+ }
+ return returnObject;
+ }
+
+ public Object[] getInputParameters(XMLStreamReader reader,
+ Operation operation)
+ throws XMLStreamException,
+ XmlParsingException {
+
+ List returnObjects = new ArrayList();
+ // first we have to point to the reader to the begining for the element
+ while (!reader.isStartElement() && !reader.isEndElement()) {
+ reader.next();
+ }
+
+ // first check whether we have got the correct input element or not
+ if (reader.getLocalName().equals(operation.getInputElement().getName()) &&
+ reader.getNamespaceURI().equals(operation.getInputElement().getNamespace())) {
+ // point the reader to parameters
+ reader.next();
+ Parameter parameter = null;
+ List inputParameters = operation.getInputParameters();
+ QName parameterQName = null;
+
+ for (Iterator iter = inputParameters.iterator(); iter.hasNext();) {
+ parameter = (Parameter) iter.next();
+ parameterQName = new QName(parameter.getNamespace(), parameter.getName());
+ returnObjects.add(getObjectForParameter(reader, parameter));
+ // if the reader is at the end of this parameter
+ // then we move it to next element.
+ if (reader.isEndElement() && reader.getName().equals(parameterQName)){
+ reader.next();
+ }
+ }
+
+ } else {
+ throw new XmlParsingException("Unexpected Subelement " + reader.getName() + " but " +
+ "expected " + operation.getInputElement().getName());
+ }
+ return returnObjects.toArray();
+ }
+
+ /**
+ * parameter has the same logic as the attribute. so reader pre and post conditions same.
+ *
+ * @param reader
+ * @param parameter
+ * @return
+ * @throws XMLStreamException
+ * @throws XmlParsingException
+ */
+
+ public Object getObjectForParameter(XMLStreamReader reader,
+ Parameter parameter)
+ throws XMLStreamException,
+ XmlParsingException {
+
+ QName parameterQName = new QName(parameter.getNamespace(), parameter.getName());
+ return getObjectForElement(reader,
+ parameterQName,
+ parameter.getType(),
+ parameter.isArray(),
+ parameter.getElement().isNillable(),
+ parameter.getElement().isMinOccurs0(),
+ parameter.getClassType(),
+ parameter.getJavaClass());
+
+ }
+
+ /**
+ * when calls to this method reader must point to the start of the type.
+ * if it is a simple type it points the the text
+ * if it is a complex type it points to the start element of the first attribute. and we returning
+ * from the method it should point to the end element of the last parameter.
+ *
+ * @param reader
+ * @param type
+ * @return
+ * @throws XMLStreamException
+ * @throws XmlParsingException
+ */
+
+
+ public Object getObjectForType(XMLStreamReader reader,
+ Type type)
+ throws XMLStreamException,
+ XmlParsingException {
+
+ try {
+ Object returnObject = null;
+ if (type.getXmlType().isSimpleType()) {
+ // this is a simple known type for us
+ // constructor should be able to invoke with the string.
+ if (type.getJavaClass().equals(Object.class)) {
+ returnObject = new Object();
+ } else {
+ // find the object for this string using converter util classs
+ String methodName = null;
+ try {
+ methodName = getMethodName(type.getJavaClass().getName());
+ Method methodToInvoke = ConverterUtil.class.getMethod(methodName,new Class[]{String.class});
+ returnObject = methodToInvoke.invoke(null,new Object[]{reader.getText()});
+ } catch (NoSuchMethodException e) {
+ throw new XmlParsingException("Can not invoke the converter util class method " + methodName, e);
+ }
+ }
+ } else {
+ // first we have to point to the reader to the begining for the element
+ while (!reader.isStartElement() && !reader.isEndElement()) {
+ reader.next();
+ }
+ // this is a complex type
+ returnObject = type.getJavaClass().newInstance();
+ // we have to get all the attribute and populate them
+ List attributes = type.getAllAttributes();
+ Attribute attribute;
+ Object attributeObject;
+ QName attributeQName = null;
+
+ for (Iterator iter = attributes.iterator(); iter.hasNext();) {
+ attribute = (Attribute) iter.next();
+ attributeObject = getObjectForAttribute(reader, attribute);
+ attributeQName = new QName(attribute.getNamespace(), attribute.getName());
+ if (attributeObject != null) {
+ attribute.getSetterMethod().invoke(returnObject, new Object[]{attributeObject});
+ }
+ // if the reader is at the end of this attribute
+ // then we move it to next element.
+ if (reader.isEndElement() && reader.getName().equals(attributeQName)){
+ reader.next();
+ }
+
+ }
+
+ }
+ return returnObject;
+ } catch (InstantiationException e) {
+ throw new XmlParsingException("Constructor invoking exception for type " + type.getName());
+ } catch (IllegalAccessException e) {
+ throw new XmlParsingException("Constructor invoking exception for type " + type.getName());
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ throw new XmlParsingException("Constructor invoking exception for type " + type.getName());
+ }
+
+ }
+
+ private String getMethodName(String className) {
+ // first handle some exceptional casses
+ if (className.equals(Integer.class.getName())) {
+ return "convertToInt";
+ } else if (className.equals(Calendar.class.getName())) {
+ return "convertToDateTime";
+ }
+ if (className.indexOf(".") > -1) {
+ className = className.substring(className.lastIndexOf(".") + 1);
+ } else {
+ // this is a primitive type class
+ // so capitalize the firt letter
+ className = className.substring(0, 1).toUpperCase() + className.substring(1);
+ }
+ return "convertTo" + className;
+ }
+
+ /**
+ * give the relavent object for attribute.
+ *
+ * @param reader
+ * @param attribute
+ * @return
+ * @throws XMLStreamException
+ * @throws XmlParsingException
+ */
+
+ private Object getObjectForAttribute(XMLStreamReader reader,
+ Attribute attribute)
+ throws XMLStreamException,
+ XmlParsingException {
+ QName attributeQName = new QName(attribute.getNamespace(), attribute.getName());
+ return getObjectForElement(reader,
+ attributeQName,
+ attribute.getType(),
+ attribute.isArray(),
+ attribute.getElement().isNillable(),
+ attribute.getElement().isMinOccurs0(),
+ attribute.getClassType(),
+ attribute.getPropertyDescriptor().getPropertyType());
+
+ }
+
+ /**
+ * element parser corresponds to parse the element (for an attribute or parameter) correctly.
+ * when calling to this method reader must point to the start element of the elemetnt. and when returning
+ * it should point to the corresponding end eleemnt of the element.
+ * if the element is an array it may point to the start element of the next element.
+ *
+ * @param reader
+ * @param elementQName
+ * @param elementType
+ * @param isArray
+ * @param classType
+ * @param javaClass - if this is a list javaClass for the list
+ * @return
+ * @throws XMLStreamException
+ * @throws XmlParsingException
+ */
+
+ private Object getObjectForElement(XMLStreamReader reader,
+ QName elementQName,
+ Type elementType,
+ boolean isArray,
+ boolean isNillable,
+ boolean isMinOccurs0,
+ int classType,
+ Class javaClass)
+ throws XMLStreamException,
+ XmlParsingException {
+ // first we have to point to the reader to the begining for the element
+ while (!reader.isStartElement() && !reader.isEndElement()) {
+ reader.next();
+ }
+
+ // first validate the attribute
+ if (reader.getName().equals(elementQName)) {
+
+ String nillble = reader.getAttributeValue(Constants.URI_DEFAULT_SCHEMA_XSI, "nil");
+ // actual element type may be different from the element type given
+ // if extensions has used.
+ Type actualElementType = elementType;
+ QName typeQName = getTypeQName(reader);
+ if ((typeQName != null) && !elementType.getXmlType().getQname().equals(typeQName)) {
+ // i.e this is an extension type
+ if (this.qNameToTypeMap.containsKey(typeQName)) {
+ actualElementType = (Type) this.qNameToTypeMap.get(typeQName);
+ } else {
+ throw new XmlParsingException("Unknown type found ==> " + typeQName);
+ }
+ }
+ // point to the complex type elements
+ if (isArray) {
+ Collection objectsCollection = getCollectionObject(classType, javaClass);
+
+ // read the first element
+ if ("true".equals(nillble) || "1".equals(nillble)) {
+ // this is a nill attribute
+ while (!reader.isEndElement()) {
+ reader.next();
+ }
+ if (isNillable){
+ objectsCollection.add(null);
+ } else {
+ throw new XmlParsingException("Element " + elementQName + " can not be null");
+ }
+
+ } else {
+ reader.next();
+ objectsCollection.add(getObjectForType(reader, actualElementType));
+
+ // we have to move the cursor until the end element of this attribute
+ while (!reader.isEndElement() || !reader.getName().equals(elementQName)) {
+ reader.next();
+ }
+ }
+ boolean loop = true;
+ while (loop) {
+ while (!reader.isEndElement()) {
+ reader.next();
+ }
+ reader.next();
+ // now we are at the end element of the first element
+ while (!reader.isStartElement() && !reader.isEndElement()) {
+ reader.next();
+ }
+
+ // in this step if it is an end element we have found an end element
+ // so have to exit from the loop
+ if (reader.isEndElement()) {
+ loop = false;
+ } else {
+ // now it should be in a start element
+ // check whether still we read the original element attributes. otherwise return
+ if (reader.getName().equals(elementQName)) {
+ nillble = reader.getAttributeValue(Constants.URI_DEFAULT_SCHEMA_XSI, "nil");
+ // since this is a new element we check for extensions
+ actualElementType = elementType;
+ typeQName = getTypeQName(reader);
+ if ((typeQName != null) && !elementType.getXmlType().getQname().equals(typeQName)) {
+ // i.e this is an extension type
+ if (this.qNameToTypeMap.containsKey(typeQName)) {
+ actualElementType = (Type) this.qNameToTypeMap.get(typeQName);
+ } else {
+ throw new XmlParsingException("Unknown type found ==> " + typeQName);
+ }
+ }
+ if ("true".equals(nillble) || "1".equals(nillble)) {
+ // this is a nill attribute
+ while (!reader.isEndElement()) {
+ reader.next();
+ }
+ if (isNillable) {
+ objectsCollection.add(null);
+ } else {
+ throw new XmlParsingException("Element " + elementQName + " can not be null");
+ }
+ } else {
+ reader.next();
+ objectsCollection.add(getObjectForType(reader, actualElementType));
+ // we have to move the cursor until the end element of this attribute
+ while (!reader.isEndElement() || !reader.getName().equals(elementQName)) {
+ reader.next();
+ }
+ }
+ } else {
+ loop = false;
+ }
+
+ }
+ }
+
+ // this is very important in handling primitivs
+ // they can not have null values so if array then we have to return the
+ // array object is null
+ // for other also it is covenient to assume like that.
+ // TODO: dissable nillable true for primitives
+ if ((Constants.OTHER_TYPE & classType) == Constants.OTHER_TYPE){
+ // i.e this is not a collection type
+ List objectsList = (List) objectsCollection;
+ if ((objectsCollection.size() == 0) ||
+ ((objectsCollection.size() == 1) && (objectsList.get(0) == null))) {
+ return null;
+ } else {
+ // create an array with the original element type
+ Object objectArray = Array.newInstance(elementType.getJavaClass(), objectsCollection.size());
+ for (int i = 0; i < objectsCollection.size(); i++) {
+ Array.set(objectArray, i, objectsList.get(i));
+ }
+ return objectArray;
+ }
+ } else if ((Constants.COLLECTION_TYPE & classType) == Constants.COLLECTION_TYPE){
+ if ((objectsCollection.size() == 0) ||
+ ((objectsCollection.size() == 1) && (objectsCollection.iterator().next() == null))){
+ return null;
+ } else {
+ return objectsCollection;
+ }
+
+ } else if ((Constants.MAP_TYPE & classType) == Constants.MAP_TYPE){
+ // TODO : handle maps
+ return null;
+ } else {
+ throw new XmlParsingException("Unknow class type " + classType);
+ }
+
+ } else {
+ if ("true".equals(nillble) || "1".equals(nillble)) {
+ // this is a nill attribute
+ while (!reader.isEndElement()) {
+ reader.next();
+ }
+ reader.next();
+ if (isNillable) {
+ return null;
+ } else {
+ throw new XmlParsingException("Element " + elementQName + " can not be null");
+ }
+
+ } else {
+ reader.next();
+ Object returnObject = getObjectForType(reader, actualElementType);
+
+ // we have to move the cursor until the end element of this attribute
+ while (!reader.isEndElement() || !reader.getName().equals(elementQName)) {
+ reader.next();
+ }
+ return returnObject;
+ }
+ }
+ } else {
+ if (isMinOccurs0) {
+ return null;
+ } else {
+ throw new XmlParsingException("Unexpected Subelement " + reader.getName() + " but " +
+ "expected " + elementQName.getLocalPart());
+ }
+ }
+ }
+
+ /**
+ * returtns the collection object according to the type.
+ * @param classType
+ * @param javaClass
+ * @return
+ * @throws XmlParsingException
+ */
+
+ private Collection getCollectionObject(int classType,
+ Class javaClass)
+ throws XmlParsingException {
+
+ Collection objectsCollection = null;
+ try {
+ if ((Constants.OTHER_TYPE & classType) == Constants.OTHER_TYPE) {
+ // i.e this is not a list or a map
+ objectsCollection = new ArrayList();
+ } else {
+ if (javaClass.isInterface()) {
+ if ((Constants.LIST_TYPE & classType) == Constants.LIST_TYPE) {
+ objectsCollection = new ArrayList();
+ } else if ((Constants.SET_TYPE & classType) == Constants.SET_TYPE) {
+ objectsCollection = new HashSet();
+ } else if ((Constants.COLLECTION_TYPE & classType) == Constants.COLLECTION_TYPE) {
+ objectsCollection = new ArrayList();
+ } else if ((Constants.MAP_TYPE & classType) == Constants.MAP_TYPE) {
+ // TODO : handle maps
+ }
+ } else {
+ if ((Constants.COLLECTION_TYPE & classType) == Constants.COLLECTION_TYPE) {
+ objectsCollection = (Collection) javaClass.newInstance();
+ } else if ((Constants.MAP_TYPE & classType) == Constants.MAP_TYPE) {
+ // TODO: handle maps
+ }
+ }
+ }
+
+ } catch (InstantiationException e) {
+ throw new XmlParsingException("Problem with instanciating the element class " +
+ javaClass.getName() , e);
+ } catch (IllegalAccessException e) {
+ throw new XmlParsingException("Problem with instanciating the element class " +
+ javaClass.getName() , e);
+ }
+ return objectsCollection;
+ }
+
+ /**
+ * reader must be at the start of the element
+ *
+ * @param reader
+ * @return qName for the type attribute
+ */
+ private QName getTypeQName(XMLStreamReader reader) {
+ QName typeQName = null;
+ String typeValue = reader.getAttributeValue(Constants.URI_2001_SCHEMA_XSI, "type");
+ if ((typeValue != null) && !typeValue.equals("")) {
+ int index = typeValue.indexOf(":");
+ String nsPrefix = "";
+ if (index > -1) {
+ nsPrefix = typeValue.substring(0, index);
+ }
+
+ String localPart = typeValue.substring(index + 1);
+ typeQName = new QName(reader.getNamespaceURI(nsPrefix), localPart);
+ }
+ return typeQName;
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/deploy/ClassDeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/deploy/ClassDeployer.java?view=auto&rev=565239
==============================================================================
--- webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/deploy/ClassDeployer.java (added)
+++ webservices/axis2/trunk/java/modules/rmi/src/org/apache/axis2/rmi/deploy/ClassDeployer.java Sun Aug 12 22:05:58 2007
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.rmi.deploy;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.rmi.Configurator;
+import org.apache.axis2.rmi.exception.MetaDataPopulateException;
+import org.apache.axis2.rmi.exception.SchemaGenerationException;
+import org.apache.axis2.rmi.metadata.Operation;
+import org.apache.axis2.rmi.metadata.Service;
+import org.apache.axis2.rmi.receiver.RMIMessageReciever;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+import java.util.List;
+
+
+public class ClassDeployer {
+
+ private ConfigurationContext configurationContext;
+ private Configurator configurator;
+ private ClassLoader classLoader;
+
+ public ClassDeployer(ConfigurationContext configurationContext,
+ ClassLoader classLoader) {
+ this(configurationContext, classLoader, new Configurator());
+ }
+
+ public ClassDeployer(ConfigurationContext configurationContext,
+ ClassLoader classLoader,
+ Configurator configurator) {
+ this.configurationContext = configurationContext;
+ this.classLoader = classLoader;
+ this.configurator = configurator;
+ }
+
+ public ClassDeployer(ConfigurationContext configurationContext) {
+ this(configurationContext, new Configurator());
+ }
+
+ public ClassDeployer(ConfigurationContext configurationContext,
+ Configurator configurator) {
+ this.configurationContext = configurationContext;
+ this.configurator = configurator;
+ }
+
+ public void deployClass(Class serviceClass) throws AxisFault {
+ Service service = new Service(serviceClass, this.configurator);
+ try {
+ service.populateMetaData();
+ service.generateWSDL();
+ Definition definition = service.getWsdlDefinition();
+
+ WSDL11ToAxisServiceBuilder builder = new WSDL11ToAxisServiceBuilder(definition, null, null);
+ AxisService axisService = builder.populateService();
+ axisService.setClassLoader(this.classLoader);
+ axisService.addParameter(new Parameter("useOriginalwsdl", "true"));
+ axisService.addParameter(new Parameter("modifyUserWSDLPortAddress", "true"));
+
+ List operations = service.getOperations();
+ Operation operation = null;
+ QName qName = null;
+ AxisOperation axisOperation = null;
+ RMIMessageReciever messageReciever = new RMIMessageReciever(service);
+ for (Iterator iter = operations.iterator(); iter.hasNext();) {
+ operation = (Operation) iter.next();
+ qName = new QName(operation.getNamespace(), operation.getName());
+ axisOperation = axisService.getOperation(qName);
+ axisOperation.setMessageReceiver(messageReciever);
+ }
+
+ configurationContext.deployService(axisService);
+ } catch (MetaDataPopulateException e) {
+ throw AxisFault.makeFault(e);
+ } catch (SchemaGenerationException e) {
+ throw AxisFault.makeFault(e);
+ }
+
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org