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 di...@apache.org on 2007/02/26 15:46:18 UTC
svn commit: r511827 - in /webservices/axis2/trunk/java: etc/
modules/kernel/src/org/apache/axis2/engine/ modules/ping/ modules/ping/src/
modules/ping/src/META-INF/ modules/ping/src/org/
modules/ping/src/org/apache/ modules/ping/src/org/apache/axis2/ mo...
Author: dims
Date: Mon Feb 26 06:46:16 2007
New Revision: 511827
URL: http://svn.apache.org/viewvc?view=rev&rev=511827
Log:
Fix for AXIS2-2233 - Pinging capability to services deployed in axis2
Added:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/Pingable.java
webservices/axis2/trunk/java/modules/ping/
webservices/axis2/trunk/java/modules/ping/maven.xml
webservices/axis2/trunk/java/modules/ping/pom.xml
webservices/axis2/trunk/java/modules/ping/project.xml
webservices/axis2/trunk/java/modules/ping/src/
webservices/axis2/trunk/java/modules/ping/src/META-INF/
webservices/axis2/trunk/java/modules/ping/src/META-INF/module.xml
webservices/axis2/trunk/java/modules/ping/src/org/
webservices/axis2/trunk/java/modules/ping/src/org/apache/
webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/
webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/
webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingConstants.java
webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingMessageReceiver.java
webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingModule.java
webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingResponse.java
Modified:
webservices/axis2/trunk/java/etc/project.properties
Modified: webservices/axis2/trunk/java/etc/project.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/etc/project.properties?view=diff&rev=511827&r1=511826&r2=511827
==============================================================================
--- webservices/axis2/trunk/java/etc/project.properties (original)
+++ webservices/axis2/trunk/java/etc/project.properties Mon Feb 26 06:46:16 2007
@@ -22,6 +22,7 @@
#version_affix=
axis2_version=${version_number}
addressing_version=${axis2_version}
+ping_version=${axis2_version}
soapmonitor_version=${axis2_version}
mex_version=${axis2_version}
@@ -60,6 +61,7 @@
modules/jibx/project.xml,\
modules/mex/project.xml,\
modules/mtompolicy/project.xml,\
+modules/ping/project.xml,\
${optional.includes}
#maven.multiproject.excludes=modules/tool/project.xml
Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/Pingable.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/Pingable.java?view=auto&rev=511827
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/Pingable.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/Pingable.java Mon Feb 26 06:46:16 2007
@@ -0,0 +1,31 @@
+/*
+* 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.engine;
+
+import org.apache.axis2.AxisFault;
+
+public interface Pingable {
+ public int PING_FAILD = 0;
+ public int PING_MODULE_LEVEL = 1;
+ public int PING_MR_LEVEL = 2;
+ public int PING_SUCCESSFUL = 3;
+
+ public String OPERATION_TO_PING = "operationToPing";
+
+ int ping() throws AxisFault;
+}
+
Added: webservices/axis2/trunk/java/modules/ping/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/ping/maven.xml?view=auto&rev=511827
==============================================================================
--- webservices/axis2/trunk/java/modules/ping/maven.xml (added)
+++ webservices/axis2/trunk/java/modules/ping/maven.xml Mon Feb 26 06:46:16 2007
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Revision: 1.21 $ $Date: 2004-10-27 20:54:09 +0600 (Wed, 27 Oct 2004) $ -->
+
+<project default="jar"
+ xmlns:j="jelly:core"
+ xmlns:u="jelly:util"
+ xmlns:maven="jelly:maven"
+ xmlns:deploy="deploy"
+ xmlns:ant="jelly:ant">
+ <postGoal name="java:compile">
+ <mkdir dir="target/classes/META-INF"/>
+ <copy file="src/META-INF/module.xml"
+ tofile="target/classes/META-INF/module.xml"/>
+ <copy file="../../LICENSE.txt"
+ tofile="target/classes/META-INF/LICENSE.txt" overwrite="true"/>
+ <copy file="../../NOTICE.txt"
+ tofile="target/classes/META-INF/NOTICE.txt" overwrite="true"/>
+ <!--<copy file="./test-resources/axis2.xml"
+ tofile="target/axis2.xml"/>-->
+ <mkdir dir="target/modules"/>
+ <jar jarfile="target/ping-${ping_version}.mar" basedir="target/classes">
+ <include name="**"/>
+ </jar>
+ <copy file="target/ping-${ping_version}.mar"
+ tofile="target/modules/ping-${ping_version}.mar"/>
+ <copy file="target/ping-${ping_version}.mar"
+ tofile="${maven.repo.local}/org.apache.axis2/mars/ping-${ping_version}.mar"/>
+ </postGoal>
+ <preGoal name="itest:compile">
+ <u:file var="file" name="${maven.itest.src}"/>
+ <j:if test="${!file.exists()}">
+ <j:expr value="${context.setVariable('maven.itest.skip', 'true')}"/>
+ </j:if>
+ </preGoal>
+</project>
Added: webservices/axis2/trunk/java/modules/ping/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/ping/pom.xml?view=auto&rev=511827
==============================================================================
--- webservices/axis2/trunk/java/modules/ping/pom.xml (added)
+++ webservices/axis2/trunk/java/modules/ping/pom.xml Mon Feb 26 06:46:16 2007
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ !
+ ! Copyright 2006 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.
+ !-->
+<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>addressing</artifactId>
+ <packaging>mar</packaging>
+ <name>Apache Axis 2.0 - Addressing</name>
+ <description>WS-Addressing implementation</description>
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/webservices/axis2/trunk/java/modules/addressing</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/webservices/axis2/trunk/java/modules/addressing</developerConnection>
+ <url>http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing</url>
+ </scm>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>${version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <sourceDirectory>src</sourceDirectory>
+ <testSourceDirectory>test</testSourceDirectory>
+ <resources>
+ <resource>
+ <directory>conf</directory>
+ <excludes>
+ <exclude>**/*.properties</exclude>
+ </excludes>
+ <filtering>false</filtering>
+ </resource>
+ <resource>
+ <directory>src</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <targetPath>../test-resources</targetPath>
+ <directory>test-resources</directory>
+ <includes>
+ <include>**/**</include>
+ </includes>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.axis2.maven2</groupId>
+ <artifactId>axis2-mar-maven-plugin</artifactId>
+ <version>${version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <includeDependencies>false</includeDependencies>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: webservices/axis2/trunk/java/modules/ping/project.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/ping/project.xml?view=auto&rev=511827
==============================================================================
--- webservices/axis2/trunk/java/modules/ping/project.xml (added)
+++ webservices/axis2/trunk/java/modules/ping/project.xml Mon Feb 26 06:46:16 2007
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * 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.
+ */
+ -->
+<project>
+ <pomVersion>3</pomVersion>
+ <extend>../../etc/project.xml</extend>
+
+ <name>Apache Axis 2.0 - ping</name>
+ <id>axis2-ping</id>
+ <groupId>org.apache.axis2</groupId>
+ <description>Pinging capability to services deployed in Axis2</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>${axiom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>${axiom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+ <!-- external JARs -->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${commons.logging.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>${stax.impl.groupid}</groupId>
+ <artifactId>${stax.impl.artifactid}</artifactId>
+ <version>${stax.impl.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>${stax.api.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ <version>${activation.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>${commons.httpclient.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>${commons.codec.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ <version>${backport_util_concurrent.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>${XmlSchema.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <version>${javamail.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ <version>${neethi.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ </dependencies>
+
+</project>
Added: webservices/axis2/trunk/java/modules/ping/src/META-INF/module.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/ping/src/META-INF/module.xml?view=auto&rev=511827
==============================================================================
--- webservices/axis2/trunk/java/modules/ping/src/META-INF/module.xml (added)
+++ webservices/axis2/trunk/java/modules/ping/src/META-INF/module.xml Mon Feb 26 06:46:16 2007
@@ -0,0 +1,6 @@
+<module name="ping" class="org.apache.axis2.ping.PingModule">
+ <operation name="pingService" mep="http://www.w3.org/2004/08/wsdl/in-out">
+ <actionMapping>http://ws.apache.org/axis2/modules/ping</actionMapping>
+ <messageReceiver class="org.apache.axis2.ping.PingMessageReceiver"/>
+ </operation>
+</module>
\ No newline at end of file
Added: webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingConstants.java?view=auto&rev=511827
==============================================================================
--- webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingConstants.java (added)
+++ webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingConstants.java Mon Feb 26 06:46:16 2007
@@ -0,0 +1,41 @@
+/*
+* 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.ping;
+
+public interface PingConstants {
+ String PING_SOAPACTION = "http://ws.apache.org/axis2/modules/ping";
+ String PING_METHOD_NAME = "ping";
+ String PING_NAMESPACE = "http://ws.apache.org/axis2/modules/ping/xsd";
+
+ String TYPE_PING_REQUEST = "pingRequest";
+ String TYPE_PING_RESPONSE = "pingResponse";
+
+ String TAG_SERVICE = "service";
+ String TAG_OPERATION = "operation";
+ String TAG_OPERATION_STATUS = "operationStatus";
+ String TAG_DESCRIPTION = "description";
+ String TAG_STATUS = "status";
+
+ String ATTRIBUTE_NAME = "name";
+
+ String PING_FAILD_STR = "Failed to ping the operation";
+ String PING_MODULE_LEVEL_STR = "Successful within the module level. Pingable interface " +
+ "may not be implemented by the MessageReceiver of the operation";
+ String PING_MR_LEVEL_STR = "Successful within the MessageReceiver of the operation. Pingable " +
+ "interface may not be implemented by the Service class of the operation";
+ String PING_SUCCESSFUL_STR = "Ping is successful for the operation";
+}
\ No newline at end of file
Added: webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingMessageReceiver.java?view=auto&rev=511827
==============================================================================
--- webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingMessageReceiver.java (added)
+++ webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingMessageReceiver.java Mon Feb 26 06:46:16 2007
@@ -0,0 +1,126 @@
+package org.apache.axis2.ping;
+
+import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver;
+import org.apache.axis2.engine.Pingable;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+import java.util.ArrayList;
+
+public class PingMessageReceiver extends AbstractInOutSyncMessageReceiver implements PingConstants {
+ private static Log log = LogFactory.getLog(PingMessageReceiver.class);
+
+ public void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage) throws AxisFault {
+
+ try {
+ int operationStatus;
+ AxisOperation axisOperation;
+ PingResponse pingResponse = new PingResponse();
+ pingResponse.initPingResponse(inMessage);
+ Iterator opListIterator = getAxisOperations(inMessage);
+
+ while (opListIterator.hasNext()) {
+ axisOperation = (AxisOperation) opListIterator.next();
+
+ if (!PING_METHOD_NAME.equals(axisOperation.getName().getLocalPart())) {
+ operationStatus = invokePingableMR(inMessage, axisOperation);
+ pingResponse.addOperationStatus(axisOperation, operationStatus);
+ }
+ }
+
+ SOAPEnvelope envelope = pingResponse.getResposeEnvelope();
+ outMessage.setEnvelope(envelope);
+
+ } catch (Exception e) {
+ String msg = "Exception occurred while trying to ping the service" +
+ inMessage.getAxisService().getName();
+
+ log.error(msg, e);
+ throw new AxisFault(msg);
+ }
+ }
+
+ /**
+ * This method identifies whether the ping request is an operation level or a service level one.
+ * If it is servicel level, returns the operation iterator from the AxisService
+ *
+ * @param inMessage
+ * @return Iterator for the list of AxisOperations
+ * @throws AxisFault
+ */
+ private Iterator getAxisOperations(MessageContext inMessage) throws AxisFault {
+ boolean serviceLevel = false;
+ Iterator operationsIterator;
+
+ OMElement element = null;
+ OMElement pingRequestElement = inMessage.getEnvelope().
+ getBody().getFirstChildWithName(new QName(TYPE_PING_REQUEST));
+
+ if (pingRequestElement == null) {
+ //throw new AxisFault("Ping Request is not specified");
+ //SOAP body is null or ping request is not specified
+ //This is considered as a service level ping.
+ serviceLevel = true;
+ } else {
+ element = pingRequestElement.getFirstChildWithName(new QName(TAG_OPERATION));
+ }
+
+
+ if (!serviceLevel && element != null) {
+ //Operations to be pinged has been specified in the ping request
+ Iterator elementIterator = pingRequestElement.getChildrenWithName(new QName(TAG_OPERATION));
+ ArrayList operationList = new ArrayList();
+ AxisOperation axisOperation;
+
+ while (elementIterator.hasNext()) {
+ OMElement opElement = (OMElement) elementIterator.next();
+ String operationName = opElement.getText();
+ axisOperation = inMessage.getAxisService().getOperation(new QName(operationName));
+
+ if (axisOperation != null) {
+ operationList.add(axisOperation);
+ } else {
+ String msg = "Operation not found: " + operationName +
+ " specified in the ping request for the service" +
+ inMessage.getAxisService().getName();
+ log.error(msg);
+ throw new AxisFault(msg);
+ }
+ }
+ operationsIterator = operationList.iterator();
+ } else {
+ //No operation is mentioned in the request.. So this is a service level ping
+ operationsIterator = inMessage.getAxisService().getOperations();
+ }
+ return operationsIterator;
+ }
+
+ /**
+ * This method checks whether the MessageReceiver is Pingable
+ * If it is Pingable invoke the ping() method after setting the operation name to be pinged as property.
+ *
+ * @param axisOperation
+ * @return
+ * @throws AxisFault
+ */
+ private int invokePingableMR(MessageContext inMessage, AxisOperation axisOperation) throws AxisFault {
+ MessageReceiver msgReceiver = axisOperation.getMessageReceiver();
+
+ if (msgReceiver != null && msgReceiver instanceof Pingable) {
+ Pingable pingableMR = (Pingable) msgReceiver;
+ //Adding the operation name to be pinged as a property
+ inMessage.setProperty(Pingable.OPERATION_TO_PING, axisOperation.getName().getLocalPart());
+ return pingableMR.ping();
+ }
+
+ return Pingable.PING_MODULE_LEVEL;
+ }
+}
Added: webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingModule.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingModule.java?view=auto&rev=511827
==============================================================================
--- webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingModule.java (added)
+++ webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingModule.java Mon Feb 26 06:46:16 2007
@@ -0,0 +1,50 @@
+/*
+* 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.ping;
+
+import org.apache.axis2.modules.Module;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.AxisModule;
+import org.apache.axis2.description.AxisDescription;
+import org.apache.axis2.AxisFault;
+import org.apache.neethi.Policy;
+import org.apache.neethi.Assertion;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class PingModule implements Module, PingConstants {
+ private static final Log log = LogFactory.getLog(PingModule.class);
+
+ public void init(ConfigurationContext configurationContext, AxisModule axisModule) throws AxisFault {
+ }
+
+ public void engageNotify(AxisDescription axisDescription) throws AxisFault {
+
+ }
+
+ public boolean canSupportAssertion(Assertion assertion) {
+ return false;
+ }
+
+ public void applyPolicy(Policy policy, AxisDescription axisDescription) throws AxisFault {
+
+ }
+
+ public void shutdown(ConfigurationContext configurationContext) throws AxisFault {
+
+ }
+}
Added: webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingResponse.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingResponse.java?view=auto&rev=511827
==============================================================================
--- webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingResponse.java (added)
+++ webservices/axis2/trunk/java/modules/ping/src/org/apache/axis2/ping/PingResponse.java Mon Feb 26 06:46:16 2007
@@ -0,0 +1,79 @@
+/*
+* 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.ping;
+
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+
+import javax.xml.namespace.QName;
+
+public class PingResponse implements PingConstants {
+
+ private OMElement pingResponse;
+ private SOAPFactory soapFactory;
+ private OMNamespace pingNamespace;
+
+ public PingResponse() {
+
+ }
+
+ public void initPingResponse(MessageContext msgContext) {
+ if (msgContext.isSOAP11()) {
+ soapFactory = OMAbstractFactory.getSOAP11Factory();
+ } else {
+ soapFactory = OMAbstractFactory.getSOAP12Factory();
+ }
+
+ OMElement pingRequestElement = msgContext.getEnvelope().
+ getBody().getFirstChildWithName(new QName(TYPE_PING_REQUEST));
+
+ if (pingRequestElement != null) {
+ pingNamespace = pingRequestElement.getNamespace();
+ } else {
+ pingNamespace = soapFactory.createOMNamespace(PING_NAMESPACE,"");
+ }
+
+ pingResponse = soapFactory.createOMElement(TYPE_PING_RESPONSE, pingNamespace);
+ }
+
+ public void addOperationStatus(String operationName, int opStatus) {
+ OMElement status = soapFactory.createOMElement(TAG_STATUS, pingNamespace);
+ //TODO Send the integer value or the string description
+ status.addChild(soapFactory.createOMText(Integer.toString(opStatus)));
+
+ OMElement operation = soapFactory.createOMElement(TAG_OPERATION_STATUS, pingNamespace);
+ operation.addAttribute(ATTRIBUTE_NAME, operationName, pingNamespace);
+ operation.addChild(status);
+
+ pingResponse.addChild(operation);
+ }
+
+ public void addOperationStatus(AxisOperation axisOperation, int opStatus) {
+ addOperationStatus(axisOperation.getName().getLocalPart(), opStatus);
+ }
+
+ public SOAPEnvelope getResposeEnvelope() {
+ SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
+ envelope.getBody().addChild(pingResponse);
+ return envelope;
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org