You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2008/11/03 22:07:21 UTC
svn commit: r710158 [14/20] - in
/webservices/commons/trunk/modules/transport: ./ modules/base/
modules/base/src/main/java/org/apache/axis2/format/
modules/base/src/main/java/org/apache/axis2/transport/base/
modules/base/src/main/java/org/apache/axis2/...
Modified: webservices/commons/trunk/modules/transport/modules/local/src/org/apache/axis2/transport/local/LocalTransportSender.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/local/src/org/apache/axis2/transport/local/LocalTransportSender.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/local/src/org/apache/axis2/transport/local/LocalTransportSender.java (original)
+++ webservices/commons/trunk/modules/transport/modules/local/src/org/apache/axis2/transport/local/LocalTransportSender.java Mon Nov 3 13:07:13 2008
@@ -1,114 +1,114 @@
-/*
- * 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.
- */
-
-
-package org.apache.axis2.transport.local;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.handlers.AbstractHandler;
-import org.apache.axis2.transport.TransportSender;
-import org.apache.axis2.transport.TransportUtils;
-import org.apache.axis2.transport.base.BaseUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-public class LocalTransportSender extends AbstractHandler implements TransportSender {
- protected static final Log log = LogFactory.getLog(LocalTransportSender.class);
-
- public void init(ConfigurationContext confContext, TransportOutDescription transportOut)
- throws AxisFault {
- }
-
- public void stop() {
- }
-
- public void cleanup(MessageContext msgContext) throws AxisFault {
- }
-
- /**
- * Method invoke
- *
- * @param msgContext the current MessageContext
- * @throws AxisFault
- */
- public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
-
- // Check for the REST behaviour, if you desire rest beahaviour
- // put a <parameter name="doREST" value="true"/> at the axis2.xml
- msgContext.setDoingMTOM(BaseUtils.doWriteMTOM(msgContext));
- msgContext.setDoingSwA(BaseUtils.doWriteSwA(msgContext));
-
- OutputStream out;
- EndpointReference epr = msgContext.getTo();
-
- if (log.isDebugEnabled()) {
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- TransportUtils.writeMessage(msgContext, os);
- log.debug("Sending - " + new String(os.toByteArray()));
- }
-
- if (epr != null) {
- if (!epr.hasNoneAddress()) {
- out = new ByteArrayOutputStream();
- TransportUtils.writeMessage(msgContext, out);
- finalizeSendWithToAddress(msgContext, (ByteArrayOutputStream)out);
- }
- } else {
- out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT);
-
- if (out != null) {
- TransportUtils.writeMessage(msgContext, out);
- } else {
- throw new AxisFault(
- "Both the TO and Property MessageContext.TRANSPORT_OUT is Null, No where to send");
- }
- }
-
- TransportUtils.setResponseWritten(msgContext, true);
-
- return InvocationResponse.CONTINUE;
- }
-
- public void finalizeSendWithToAddress(MessageContext msgContext, ByteArrayOutputStream out)
- throws AxisFault {
- try {
- InputStream in = new ByteArrayInputStream(out.toByteArray());
- ByteArrayOutputStream response = new ByteArrayOutputStream();
-
- LocalTransportReceiver localTransportReceiver = new LocalTransportReceiver(this);
- localTransportReceiver.processMessage(in, msgContext.getTo(), msgContext.getOptions().getAction(), response);
- in.close();
- out.close();
- in = new ByteArrayInputStream(response.toByteArray());
- msgContext.setProperty(MessageContext.TRANSPORT_IN, in);
- } catch (IOException e) {
- throw AxisFault.makeFault(e);
- }
- }
-}
+/*
+ * 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.
+ */
+
+
+package org.apache.axis2.transport.local;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.transport.TransportSender;
+import org.apache.axis2.transport.TransportUtils;
+import org.apache.axis2.transport.base.BaseUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public class LocalTransportSender extends AbstractHandler implements TransportSender {
+ protected static final Log log = LogFactory.getLog(LocalTransportSender.class);
+
+ public void init(ConfigurationContext confContext, TransportOutDescription transportOut)
+ throws AxisFault {
+ }
+
+ public void stop() {
+ }
+
+ public void cleanup(MessageContext msgContext) throws AxisFault {
+ }
+
+ /**
+ * Method invoke
+ *
+ * @param msgContext the current MessageContext
+ * @throws AxisFault
+ */
+ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
+
+ // Check for the REST behaviour, if you desire rest beahaviour
+ // put a <parameter name="doREST" value="true"/> at the axis2.xml
+ msgContext.setDoingMTOM(BaseUtils.doWriteMTOM(msgContext));
+ msgContext.setDoingSwA(BaseUtils.doWriteSwA(msgContext));
+
+ OutputStream out;
+ EndpointReference epr = msgContext.getTo();
+
+ if (log.isDebugEnabled()) {
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ TransportUtils.writeMessage(msgContext, os);
+ log.debug("Sending - " + new String(os.toByteArray()));
+ }
+
+ if (epr != null) {
+ if (!epr.hasNoneAddress()) {
+ out = new ByteArrayOutputStream();
+ TransportUtils.writeMessage(msgContext, out);
+ finalizeSendWithToAddress(msgContext, (ByteArrayOutputStream)out);
+ }
+ } else {
+ out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT);
+
+ if (out != null) {
+ TransportUtils.writeMessage(msgContext, out);
+ } else {
+ throw new AxisFault(
+ "Both the TO and Property MessageContext.TRANSPORT_OUT is Null, No where to send");
+ }
+ }
+
+ TransportUtils.setResponseWritten(msgContext, true);
+
+ return InvocationResponse.CONTINUE;
+ }
+
+ public void finalizeSendWithToAddress(MessageContext msgContext, ByteArrayOutputStream out)
+ throws AxisFault {
+ try {
+ InputStream in = new ByteArrayInputStream(out.toByteArray());
+ ByteArrayOutputStream response = new ByteArrayOutputStream();
+
+ LocalTransportReceiver localTransportReceiver = new LocalTransportReceiver(this);
+ localTransportReceiver.processMessage(in, msgContext.getTo(), msgContext.getOptions().getAction(), response);
+ in.close();
+ out.close();
+ in = new ByteArrayInputStream(response.toByteArray());
+ msgContext.setProperty(MessageContext.TRANSPORT_IN, in);
+ } catch (IOException e) {
+ throw AxisFault.makeFault(e);
+ }
+ }
+}
Propchange: webservices/commons/trunk/modules/transport/modules/local/src/org/apache/axis2/transport/local/LocalTransportSender.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/commons/trunk/modules/transport/modules/mail/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/LogWriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailOutTransportInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportSender.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/MailUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/PollTableEntry.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/WSMimeMessage.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/commons/trunk/modules/transport/modules/mail/src/main/java/org/apache/axis2/transport/mail/WriterOutputStream.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/commons/trunk/modules/transport/modules/parent/pom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/parent/pom.xml?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/parent/pom.xml (original)
+++ webservices/commons/trunk/modules/transport/modules/parent/pom.xml Mon Nov 3 13:07:13 2008
@@ -1,152 +1,152 @@
-<?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</groupId>
- <artifactId>apache</artifactId>
- <version>3</version>
- </parent>
-
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-transport</artifactId>
- <version>SNAPSHOT</version>
- <packaging>pom</packaging>
- <description>Axis2 Transport</description>
- <name>Apache Axis2 - Transport - Parent</name>
- <url>http://ws.apache.org/commons/transport/</url>
- <issueManagement>
- <system>JIRA</system>
- <url>http://issues.apache.org/jira/browse/WSCOMMONS</url>
- </issueManagement>
- <mailingLists>
- <mailingList>
- <name>WS Commons Developers</name>
- <subscribe>commons-dev-subscribe@ws.apache.org</subscribe>
- <unsubscribe>commons-dev-unsubscribe@ws.apache.org</unsubscribe>
- <post>commons-dev@ws.apache.org</post>
- <archive>http://mail-archives.apache.org/mod_mbox/ws-commons-dev/</archive>
- </mailingList>
- </mailingLists>
- <inceptionYear>2004</inceptionYear>
- <developers>
- <developer>
- <name>Saminda Abeyruwan</name>
- <id>saminda</id>
- <email>saminda AT wso2.com</email>
- <organization>WSO2</organization>
- </developer>
- <developer>
- <name>Eran Chinthaka</name>
- <id>chinthaka</id>
- <email>chinthaka AT wso2.com</email>
- <organization>WSO2</organization>
- <url>http://www.apache.org/~chinthaka</url>
- </developer>
- <developer>
- <name>Glen Daniels</name>
- <id>gdaniels</id>
- <email>gdaniels AT apache.org</email>
- <organization>Sonic Software</organization>
- </developer>
- <developer>
- <name>Deepal Jayasinghe</name>
- <id>deepal</id>
- <email>deepal AT wso2.com</email>
- <organization>WSO2</organization>
- <url>http://www.apache.org/~deepal</url>
- </developer>
- <developer>
- <name>Srinath Perera</name>
- <id>hemapani</id>
- <email>hemapani AT apache.org</email>
- <organization>Lanka Software Foundation</organization>
- <url>http://www.apache.org/~hemapani</url>
- </developer>
- <developer>
- <name>Ajith Ranabahu</name>
- <id>ajith</id>
- <email>ajith AT wso2.com</email>
- <organization>WSO2</organization>
- <url>http://www.apache.org/~ajith</url>
- </developer>
- <developer>
- <name>Davanum Srinivas</name>
- <id>dims</id>
- <email>dims AT wso2.com</email>
- <organization>WSO2</organization>
- </developer>
- <developer>
- <name>Andreas Veithen</name>
- <id>veithen</id>
- <email>veithen AT apache.org</email>
- <url>http://www.linkedin.com/in/aveithen</url>
- </developer>
- <developer>
- <name>Sanjiva Weerawarana</name>
- <id>sanjiva</id>
- <email>sanjiva AT wso2.com</email>
- <organization>WSO2</organization>
- </developer>
- </developers>
- <licenses>
- <license>
- <name>The Apache Software License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/transport</connection>
- <developerConnection>
- scm:svn:https://svn.apache.org/repos/asf/webservices/commons/trunk/modules/transport
- </developerConnection>
- <url>http://svn.apache.org/viewcvs.cgi/webservices/commons/trunk/modules/transport</url>
- </scm>
- <organization>
- <name>The Apache Software Foundation</name>
- <url>http://www.apache.org/</url>
- </organization>
- <profiles>
- <profile>
- <id>release</id>
- <activation>
- <property>
- <name>release</name>
- <value/>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <tagBase>http://svn.apache.org/repos/asf/webservices/commons/tags/transport</tagBase>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
+<?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</groupId>
+ <artifactId>apache</artifactId>
+ <version>3</version>
+ </parent>
+
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-transport</artifactId>
+ <version>SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <description>Axis2 Transport</description>
+ <name>Apache Axis2 - Transport - Parent</name>
+ <url>http://ws.apache.org/commons/transport/</url>
+ <issueManagement>
+ <system>JIRA</system>
+ <url>http://issues.apache.org/jira/browse/WSCOMMONS</url>
+ </issueManagement>
+ <mailingLists>
+ <mailingList>
+ <name>WS Commons Developers</name>
+ <subscribe>commons-dev-subscribe@ws.apache.org</subscribe>
+ <unsubscribe>commons-dev-unsubscribe@ws.apache.org</unsubscribe>
+ <post>commons-dev@ws.apache.org</post>
+ <archive>http://mail-archives.apache.org/mod_mbox/ws-commons-dev/</archive>
+ </mailingList>
+ </mailingLists>
+ <inceptionYear>2004</inceptionYear>
+ <developers>
+ <developer>
+ <name>Saminda Abeyruwan</name>
+ <id>saminda</id>
+ <email>saminda AT wso2.com</email>
+ <organization>WSO2</organization>
+ </developer>
+ <developer>
+ <name>Eran Chinthaka</name>
+ <id>chinthaka</id>
+ <email>chinthaka AT wso2.com</email>
+ <organization>WSO2</organization>
+ <url>http://www.apache.org/~chinthaka</url>
+ </developer>
+ <developer>
+ <name>Glen Daniels</name>
+ <id>gdaniels</id>
+ <email>gdaniels AT apache.org</email>
+ <organization>Sonic Software</organization>
+ </developer>
+ <developer>
+ <name>Deepal Jayasinghe</name>
+ <id>deepal</id>
+ <email>deepal AT wso2.com</email>
+ <organization>WSO2</organization>
+ <url>http://www.apache.org/~deepal</url>
+ </developer>
+ <developer>
+ <name>Srinath Perera</name>
+ <id>hemapani</id>
+ <email>hemapani AT apache.org</email>
+ <organization>Lanka Software Foundation</organization>
+ <url>http://www.apache.org/~hemapani</url>
+ </developer>
+ <developer>
+ <name>Ajith Ranabahu</name>
+ <id>ajith</id>
+ <email>ajith AT wso2.com</email>
+ <organization>WSO2</organization>
+ <url>http://www.apache.org/~ajith</url>
+ </developer>
+ <developer>
+ <name>Davanum Srinivas</name>
+ <id>dims</id>
+ <email>dims AT wso2.com</email>
+ <organization>WSO2</organization>
+ </developer>
+ <developer>
+ <name>Andreas Veithen</name>
+ <id>veithen</id>
+ <email>veithen AT apache.org</email>
+ <url>http://www.linkedin.com/in/aveithen</url>
+ </developer>
+ <developer>
+ <name>Sanjiva Weerawarana</name>
+ <id>sanjiva</id>
+ <email>sanjiva AT wso2.com</email>
+ <organization>WSO2</organization>
+ </developer>
+ </developers>
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/transport</connection>
+ <developerConnection>
+ scm:svn:https://svn.apache.org/repos/asf/webservices/commons/trunk/modules/transport
+ </developerConnection>
+ <url>http://svn.apache.org/viewcvs.cgi/webservices/commons/trunk/modules/transport</url>
+ </scm>
+ <organization>
+ <name>The Apache Software Foundation</name>
+ <url>http://www.apache.org/</url>
+ </organization>
+ <profiles>
+ <profile>
+ <id>release</id>
+ <activation>
+ <property>
+ <name>release</name>
+ <value/>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <tagBase>http://svn.apache.org/repos/asf/webservices/commons/tags/transport</tagBase>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
<profile>
<id>cobertura</id>
<dependencies>
@@ -183,210 +183,210 @@
</plugins>
</build>
</profile>
- </profiles>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/bin.xml</descriptor>
- <descriptor>src/main/assembly/src.xml</descriptor>
- </descriptors>
- <tarLongFileMode>gnu</tarLongFileMode>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <attach>true</attach>
- </configuration>
- </plugin>
-
- </plugins>
- </build>
- <pluginRepositories>
- <pluginRepository>
- <id>snapshot</id>
- <name>Snapshot repository</name>
- <url>http://snapshots.maven.codehaus.org/maven2/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </pluginRepository>
- <pluginRepository>
- <id>snapshot-apache</id>
- <name>Apache Snapshot repository</name>
- <url>http://people.apache.org/repo/m2-snapshot-repository</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </pluginRepository>
- </pluginRepositories>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-kernel</artifactId>
- <version>SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
- <version>1.1.2</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.3</version>
- </dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.1</version>
- </dependency>
- <dependency>
- <groupId>commons-fileupload</groupId>
- <artifactId>commons-fileupload</artifactId>
- <version>1.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpcore</artifactId>
- <version>4.0-beta1</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- </dependency>
-
- <!-- Smack Jabber client libraries to be included -->
- <dependency>
- <groupId>org.igniterealtime</groupId>
- <artifactId>smack</artifactId>
- <version>3.0.4</version>
- </dependency>
- <dependency>
- <groupId>org.igniterealtime</groupId>
- <artifactId>smackx</artifactId>
- <version>3.0.4</version>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.3</version>
- </dependency>
-
- <!-- Dependencies used in the unit tests -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.2</version>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- <version>1.6.1</version>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjweaver</artifactId>
- <version>1.6.1</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-kernel</artifactId>
-
- </dependency>
- </dependencies>
-
- <reporting>
- <plugins>
- <plugin>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jdepend-maven-plugin</artifactId>
- <version>2.0-beta-1</version>
- </plugin>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <inherited>true</inherited>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <aggregate>true</aggregate>
- </configuration>
- <reportSets>
- <reportSet>
- <reports>
- <report>javadoc</report>
- </reports>
- </reportSet>
- </reportSets>
- </plugin>
- <plugin>
- <artifactId>maven-site-plugin</artifactId>
- <inherited>false</inherited>
- </plugin>
- </plugins>
- </reporting>
- <distributionManagement>
- <repository>
- <id>apache-repo</id>
- <name>Maven Central Repository</name>
- <url>scpexe://people.apache.org//www/people.apache.org/repo/m2-ibiblio-rsync-repository</url>
- </repository>
- <snapshotRepository>
- <id>apache-snapshots</id>
- <name>Apache Development Repository</name>
- <url>scpexe://people.apache.org//www/people.apache.org/repo/m2-snapshot-repository</url>
- <uniqueVersion>false</uniqueVersion>
- </snapshotRepository>
- <site>
- <id>website</id>
- <url>scpexe://people.apache.org/www/ws.apache.org/commons/transport</url>
- </site>
- </distributionManagement>
- <!-- maven download repositry -->
- <repositories>
- <repository>
- <id>maven2</id>
- <name>Maven Central Development Repository</name>
- <url>http://repo1.maven.org/maven2</url>
- </repository>
- </repositories>
- <properties>
- <transport.version>SNAPSHOT</transport.version>
- <axis2.version>SNAPSHOT</axis2.version>
- </properties>
-</project>
+ </profiles>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/bin.xml</descriptor>
+ <descriptor>src/main/assembly/src.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <attach>true</attach>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>snapshot</id>
+ <name>Snapshot repository</name>
+ <url>http://snapshots.maven.codehaus.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </pluginRepository>
+ <pluginRepository>
+ <id>snapshot-apache</id>
+ <name>Apache Snapshot repository</name>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </pluginRepository>
+ </pluginRepositories>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
+ <version>1.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpcore</artifactId>
+ <version>4.0-beta1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+ <!-- Smack Jabber client libraries to be included -->
+ <dependency>
+ <groupId>org.igniterealtime</groupId>
+ <artifactId>smack</artifactId>
+ <version>3.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.igniterealtime</groupId>
+ <artifactId>smackx</artifactId>
+ <version>3.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.3</version>
+ </dependency>
+
+ <!-- Dependencies used in the unit tests -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjrt</artifactId>
+ <version>1.6.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjweaver</artifactId>
+ <version>1.6.1</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+
+ </dependency>
+ </dependencies>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jdepend-maven-plugin</artifactId>
+ <version>2.0-beta-1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <aggregate>true</aggregate>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>javadoc</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <inherited>false</inherited>
+ </plugin>
+ </plugins>
+ </reporting>
+ <distributionManagement>
+ <repository>
+ <id>apache-repo</id>
+ <name>Maven Central Repository</name>
+ <url>scpexe://people.apache.org//www/people.apache.org/repo/m2-ibiblio-rsync-repository</url>
+ </repository>
+ <snapshotRepository>
+ <id>apache-snapshots</id>
+ <name>Apache Development Repository</name>
+ <url>scpexe://people.apache.org//www/people.apache.org/repo/m2-snapshot-repository</url>
+ <uniqueVersion>false</uniqueVersion>
+ </snapshotRepository>
+ <site>
+ <id>website</id>
+ <url>scpexe://people.apache.org/www/ws.apache.org/commons/transport</url>
+ </site>
+ </distributionManagement>
+ <!-- maven download repositry -->
+ <repositories>
+ <repository>
+ <id>maven2</id>
+ <name>Maven Central Development Repository</name>
+ <url>http://repo1.maven.org/maven2</url>
+ </repository>
+ </repositories>
+ <properties>
+ <transport.version>SNAPSHOT</transport.version>
+ <axis2.version>SNAPSHOT</axis2.version>
+ </properties>
+</project>
Propchange: webservices/commons/trunk/modules/transport/modules/parent/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/commons/trunk/modules/transport/modules/tcp/pom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/tcp/pom.xml?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/tcp/pom.xml (original)
+++ webservices/commons/trunk/modules/transport/modules/tcp/pom.xml Mon Nov 3 13:07:13 2008
@@ -1,87 +1,87 @@
-<?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-transport</artifactId>
- <version>SNAPSHOT</version>
- <relativePath>../parent/pom.xml</relativePath>
- </parent>
- <artifactId>axis2-transport-tcp</artifactId>
- <name>Apache Axis2 - Transport - TCP</name>
- <description>This inclues all the available transports in Axis2</description>
- <packaging>bundle</packaging>
-
- <build>
- <sourceDirectory>src</sourceDirectory>
- <testSourceDirectory>test</testSourceDirectory>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.0</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-Version>1.0</Bundle-Version>
- <Bundle-Name>${pom.artifactId}</Bundle-Name>
- <Bundle-Vendor>Apache Software Foundation</Bundle-Vendor>
- <Bundle-Description>${pom.description}</Bundle-Description>
- <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
- <Export-Package>
- org.apache.axis2.transport.tcp.*;-split-package:=merge-last,
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- <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>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-transport-base</artifactId>
- <version>${transport.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
- </dependencies>
-</project>
+<?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-transport</artifactId>
+ <version>SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
+ <artifactId>axis2-transport-tcp</artifactId>
+ <name>Apache Axis2 - Transport - TCP</name>
+ <description>This inclues all the available transports in Axis2</description>
+ <packaging>bundle</packaging>
+
+ <build>
+ <sourceDirectory>src</sourceDirectory>
+ <testSourceDirectory>test</testSourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.4.0</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Version>1.0</Bundle-Version>
+ <Bundle-Name>${pom.artifactId}</Bundle-Name>
+ <Bundle-Vendor>Apache Software Foundation</Bundle-Vendor>
+ <Bundle-Description>${pom.description}</Bundle-Description>
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Export-Package>
+ org.apache.axis2.transport.tcp.*;-split-package:=merge-last,
+ </Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ <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>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-transport-base</artifactId>
+ <version>${transport.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Propchange: webservices/commons/trunk/modules/transport/modules/tcp/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPServer.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPServer.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPServer.java (original)
+++ webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPServer.java Mon Nov 3 13:07:13 2008
@@ -1,231 +1,231 @@
-/*
- * 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.
- */
-
-
-package org.apache.axis2.transport.tcp;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.util.Utils;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.SessionContext;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.engine.ListenerManager;
-import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.transport.TransportListener;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.SocketException;
-
-/**
- * Class TCPServer
- */
-public class TCPServer implements Runnable, TransportListener {
- private int port = 8000;
- private boolean started = false;
- private static final Log log = LogFactory.getLog(TCPServer.class);
- private ConfigurationContext configContext;
- private ServerSocket serversocket;
- private String hostAddress = null;
- private String contextPath;
-
- public TCPServer() {
- }
-
- public TCPServer(int port, ConfigurationContext configContext) throws AxisFault {
- try {
- this.configContext = configContext;
- serversocket = new ServerSocket(port);
-
- ListenerManager listenerManager = configContext.getListenerManager();
- TransportInDescription trsIn = new TransportInDescription(Constants.TRANSPORT_TCP);
- trsIn.setReceiver(this);
- if (listenerManager == null) {
- listenerManager = new ListenerManager();
- listenerManager.init(configContext);
- }
- listenerManager.addListener(trsIn, true);
- contextPath = configContext.getServiceContextPath();
-
- } catch (IOException e1) {
- throw AxisFault.makeFault(e1);
- }
- }
-
- public TCPServer(int port, String dir) throws AxisFault {
- this(port, ConfigurationContextFactory.createConfigurationContextFromFileSystem(dir, null));
- }
-
- public void init(ConfigurationContext axisConf, TransportInDescription transprtIn)
- throws AxisFault {
- this.configContext = axisConf;
-
- Parameter param = transprtIn.getParameter(PARAM_PORT);
-
- if (param != null) {
- this.port = Integer.parseInt((String) param.getValue());
- }
- param = transprtIn.getParameter(HOST_ADDRESS);
- if (param != null) {
- hostAddress = ((String) param.getValue()).trim();
- }
- contextPath = configContext.getServiceContextPath();
- }
-
- public static void main(String[] args) throws AxisFault, NumberFormatException {
- if (args.length != 2) {
- System.out.println("TCPServer repositoryLocation port");
- } else {
- File repository = new File(args[0]);
-
- if (!repository.exists()) {
- System.out.print("Repository file does not exists .. initializing repository");
- }
-
- TCPServer tcpServer = new TCPServer(Integer.parseInt(args[1]),
- repository.getAbsolutePath());
-
- System.out.println("[Axis2] Using the Repository " + repository.getAbsolutePath());
- System.out.println("[Axis2] Starting the TCP Server on port " + args[1]);
- tcpServer.start();
- Runtime.getRuntime().addShutdownHook(new Thread(tcpServer));
- }
- }
-
- public void run() {
- while (started) {
- Socket socket = null;
-
- try {
- socket = serversocket.accept();
- } catch (java.io.InterruptedIOException iie) {
- }
- catch (Exception e) {
- log.debug(e);
-
- break;
- }
-
- if (socket != null) {
- configContext.getThreadPool().execute(new TCPWorker(configContext, socket));
- }
- }
- }
-
- public synchronized void start() throws AxisFault {
- if (serversocket == null) {
- serversocket = openSocket(port);
- }
- started = true;
- this.configContext.getThreadPool().execute(this);
- }
-
-
- /**
- * Controls the number of server sockets kept open.
- */
- public ServerSocket openSocket(int port) throws AxisFault {
- for (int i = 0; i < 5; i++) {
- try {
- return new ServerSocket(port + i);
- } catch (IOException e) {
- // What I'm gonna do here. Try again.
- }
- }
-
- throw new AxisFault(Messages.getMessage("failedToOpenSocket"));
- }
-
-
- /*
- * (non-Javadoc)
- * @see org.apache.axis2.transport.TransportListener#stop()
- */
- public void stop() throws AxisFault {
- try {
- this.serversocket.close();
- started = false;
- } catch (IOException e) {
- throw AxisFault.makeFault(e);
- }
- }
-
- public ConfigurationContext getConfigurationContext() {
- return this.configContext;
- }
-
- /**
- * I fthe hostAddress parameter is present in axis2.xml then the EPR will be
- * created by taking the hostAddres into account
- * (non-Javadoc)
- *
- * @see org.apache.axis2.transport.TransportListener#getEPRForService(String, String)
- */
- public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault {
- EndpointReference[] epRsForService = getEPRsForService(serviceName, ip);
- return epRsForService != null ? epRsForService[0] : null;
- }
-
- public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault {
- //if host address is present
- if (hostAddress != null) {
- if (serversocket != null) {
- // todo this has to fix
- return new EndpointReference[]{
- new EndpointReference(hostAddress + "/" + contextPath + serviceName)};
- } else {
- log.debug("Unable to generate EPR for the transport tcp");
- return null;
- }
- }
- if (ip == null) {
- try {
- ip = Utils.getIpAddress(configContext.getAxisConfiguration());
- } catch (SocketException e) {
- throw AxisFault.makeFault(e);
- }
- }
- if (serversocket != null) {
- // todo this has to fix
- return new EndpointReference[]{
- new EndpointReference("tcp://" + ip + ":" + (serversocket.getLocalPort())
- + "/" + contextPath + "/" + serviceName)};
- } else {
- log.debug("Unable to generate EPR for the transport tcp");
- return null;
- }
- }
-
- public SessionContext getSessionContext(MessageContext messageContext) {
- return null;
- }
-
- public void destroy() {
- this.configContext = null;
- }
-}
+/*
+ * 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.
+ */
+
+
+package org.apache.axis2.transport.tcp;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.util.Utils;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.SessionContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.engine.ListenerManager;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.transport.TransportListener;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketException;
+
+/**
+ * Class TCPServer
+ */
+public class TCPServer implements Runnable, TransportListener {
+ private int port = 8000;
+ private boolean started = false;
+ private static final Log log = LogFactory.getLog(TCPServer.class);
+ private ConfigurationContext configContext;
+ private ServerSocket serversocket;
+ private String hostAddress = null;
+ private String contextPath;
+
+ public TCPServer() {
+ }
+
+ public TCPServer(int port, ConfigurationContext configContext) throws AxisFault {
+ try {
+ this.configContext = configContext;
+ serversocket = new ServerSocket(port);
+
+ ListenerManager listenerManager = configContext.getListenerManager();
+ TransportInDescription trsIn = new TransportInDescription(Constants.TRANSPORT_TCP);
+ trsIn.setReceiver(this);
+ if (listenerManager == null) {
+ listenerManager = new ListenerManager();
+ listenerManager.init(configContext);
+ }
+ listenerManager.addListener(trsIn, true);
+ contextPath = configContext.getServiceContextPath();
+
+ } catch (IOException e1) {
+ throw AxisFault.makeFault(e1);
+ }
+ }
+
+ public TCPServer(int port, String dir) throws AxisFault {
+ this(port, ConfigurationContextFactory.createConfigurationContextFromFileSystem(dir, null));
+ }
+
+ public void init(ConfigurationContext axisConf, TransportInDescription transprtIn)
+ throws AxisFault {
+ this.configContext = axisConf;
+
+ Parameter param = transprtIn.getParameter(PARAM_PORT);
+
+ if (param != null) {
+ this.port = Integer.parseInt((String) param.getValue());
+ }
+ param = transprtIn.getParameter(HOST_ADDRESS);
+ if (param != null) {
+ hostAddress = ((String) param.getValue()).trim();
+ }
+ contextPath = configContext.getServiceContextPath();
+ }
+
+ public static void main(String[] args) throws AxisFault, NumberFormatException {
+ if (args.length != 2) {
+ System.out.println("TCPServer repositoryLocation port");
+ } else {
+ File repository = new File(args[0]);
+
+ if (!repository.exists()) {
+ System.out.print("Repository file does not exists .. initializing repository");
+ }
+
+ TCPServer tcpServer = new TCPServer(Integer.parseInt(args[1]),
+ repository.getAbsolutePath());
+
+ System.out.println("[Axis2] Using the Repository " + repository.getAbsolutePath());
+ System.out.println("[Axis2] Starting the TCP Server on port " + args[1]);
+ tcpServer.start();
+ Runtime.getRuntime().addShutdownHook(new Thread(tcpServer));
+ }
+ }
+
+ public void run() {
+ while (started) {
+ Socket socket = null;
+
+ try {
+ socket = serversocket.accept();
+ } catch (java.io.InterruptedIOException iie) {
+ }
+ catch (Exception e) {
+ log.debug(e);
+
+ break;
+ }
+
+ if (socket != null) {
+ configContext.getThreadPool().execute(new TCPWorker(configContext, socket));
+ }
+ }
+ }
+
+ public synchronized void start() throws AxisFault {
+ if (serversocket == null) {
+ serversocket = openSocket(port);
+ }
+ started = true;
+ this.configContext.getThreadPool().execute(this);
+ }
+
+
+ /**
+ * Controls the number of server sockets kept open.
+ */
+ public ServerSocket openSocket(int port) throws AxisFault {
+ for (int i = 0; i < 5; i++) {
+ try {
+ return new ServerSocket(port + i);
+ } catch (IOException e) {
+ // What I'm gonna do here. Try again.
+ }
+ }
+
+ throw new AxisFault(Messages.getMessage("failedToOpenSocket"));
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.axis2.transport.TransportListener#stop()
+ */
+ public void stop() throws AxisFault {
+ try {
+ this.serversocket.close();
+ started = false;
+ } catch (IOException e) {
+ throw AxisFault.makeFault(e);
+ }
+ }
+
+ public ConfigurationContext getConfigurationContext() {
+ return this.configContext;
+ }
+
+ /**
+ * I fthe hostAddress parameter is present in axis2.xml then the EPR will be
+ * created by taking the hostAddres into account
+ * (non-Javadoc)
+ *
+ * @see org.apache.axis2.transport.TransportListener#getEPRForService(String, String)
+ */
+ public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault {
+ EndpointReference[] epRsForService = getEPRsForService(serviceName, ip);
+ return epRsForService != null ? epRsForService[0] : null;
+ }
+
+ public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault {
+ //if host address is present
+ if (hostAddress != null) {
+ if (serversocket != null) {
+ // todo this has to fix
+ return new EndpointReference[]{
+ new EndpointReference(hostAddress + "/" + contextPath + serviceName)};
+ } else {
+ log.debug("Unable to generate EPR for the transport tcp");
+ return null;
+ }
+ }
+ if (ip == null) {
+ try {
+ ip = Utils.getIpAddress(configContext.getAxisConfiguration());
+ } catch (SocketException e) {
+ throw AxisFault.makeFault(e);
+ }
+ }
+ if (serversocket != null) {
+ // todo this has to fix
+ return new EndpointReference[]{
+ new EndpointReference("tcp://" + ip + ":" + (serversocket.getLocalPort())
+ + "/" + contextPath + "/" + serviceName)};
+ } else {
+ log.debug("Unable to generate EPR for the transport tcp");
+ return null;
+ }
+ }
+
+ public SessionContext getSessionContext(MessageContext messageContext) {
+ return null;
+ }
+
+ public void destroy() {
+ this.configContext = null;
+ }
+}
Propchange: webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPServer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPTransportSender.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPTransportSender.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPTransportSender.java (original)
+++ webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPTransportSender.java Mon Nov 3 13:07:13 2008
@@ -1,134 +1,134 @@
-/*
- * 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.
- */
-
-
-package org.apache.axis2.transport.tcp;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.handlers.AbstractHandler;
-import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.transport.TransportSender;
-import org.apache.axis2.transport.TransportUtils;
-import org.apache.axis2.transport.base.BaseUtils;
-import org.apache.axis2.util.URL;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Writer;
-import java.net.InetSocketAddress;
-import java.net.MalformedURLException;
-import java.net.Socket;
-import java.net.SocketAddress;
-
-public class TCPTransportSender extends AbstractHandler implements TransportSender {
- protected Writer out;
- private Socket socket;
-
- public void init(ConfigurationContext confContext, TransportOutDescription transportOut)
- throws AxisFault {
- }
-
- public void stop() {
- }
-
- public void cleanup(MessageContext msgContext) throws AxisFault {
- try {
- if (socket != null) {
- socket.close();
- socket = null;
- }
- } catch (IOException e) {
- // TODO: Log this?
- }
- }
-
- /**
- * Method invoke
- *
- * @param msgContext
- * @throws AxisFault
- */
- public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
-
- // Check for the REST behaviour, if you desire rest beahaviour
- // put a <parameter name="doREST" value="true"/> at the axis2.xml
- msgContext.setDoingMTOM(BaseUtils.doWriteMTOM(msgContext));
- msgContext.setDoingSwA(BaseUtils.doWriteSwA(msgContext));
-
- OutputStream out;
- EndpointReference epr = null;
-
- if (msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) {
- epr = msgContext.getTo();
- }
-
- if (epr != null) {
- if (!epr.hasNoneAddress()) {
- out = openTheConnection(epr, msgContext);
- TransportUtils.writeMessage(msgContext, out);
- try {
- socket.shutdownOutput();
- msgContext.setProperty(MessageContext.TRANSPORT_IN, socket.getInputStream());
- } catch (IOException e) {
- throw AxisFault.makeFault(e);
- }
- }
- } else {
- out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT);
-
- if (out != null) {
- TransportUtils.writeMessage(msgContext, out);
- } else {
- throw new AxisFault(
- "Both the TO and Property MessageContext.TRANSPORT_OUT is Null, No where to send");
- }
- }
-
- TransportUtils.setResponseWritten(msgContext, true);
-
- return InvocationResponse.CONTINUE;
- }
-
- protected OutputStream openTheConnection(EndpointReference toURL, MessageContext msgContext)
- throws AxisFault {
- if (toURL != null) {
- try {
- URL url = new URL(toURL.getAddress());
- SocketAddress add = new InetSocketAddress(url.getHost(), (url.getPort() == -1)
- ? 80
- : url.getPort());
-
- socket = new Socket();
- socket.connect(add);
-
- return socket.getOutputStream();
- } catch (MalformedURLException e) {
- throw AxisFault.makeFault(e);
- } catch (IOException e) {
- throw AxisFault.makeFault(e);
- }
- } else {
- throw new AxisFault(Messages.getMessage("canNotBeNull", "End point reference"));
- }
- }
-}
+/*
+ * 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.
+ */
+
+
+package org.apache.axis2.transport.tcp;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.transport.TransportSender;
+import org.apache.axis2.transport.TransportUtils;
+import org.apache.axis2.transport.base.BaseUtils;
+import org.apache.axis2.util.URL;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.net.InetSocketAddress;
+import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.SocketAddress;
+
+public class TCPTransportSender extends AbstractHandler implements TransportSender {
+ protected Writer out;
+ private Socket socket;
+
+ public void init(ConfigurationContext confContext, TransportOutDescription transportOut)
+ throws AxisFault {
+ }
+
+ public void stop() {
+ }
+
+ public void cleanup(MessageContext msgContext) throws AxisFault {
+ try {
+ if (socket != null) {
+ socket.close();
+ socket = null;
+ }
+ } catch (IOException e) {
+ // TODO: Log this?
+ }
+ }
+
+ /**
+ * Method invoke
+ *
+ * @param msgContext
+ * @throws AxisFault
+ */
+ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
+
+ // Check for the REST behaviour, if you desire rest beahaviour
+ // put a <parameter name="doREST" value="true"/> at the axis2.xml
+ msgContext.setDoingMTOM(BaseUtils.doWriteMTOM(msgContext));
+ msgContext.setDoingSwA(BaseUtils.doWriteSwA(msgContext));
+
+ OutputStream out;
+ EndpointReference epr = null;
+
+ if (msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) {
+ epr = msgContext.getTo();
+ }
+
+ if (epr != null) {
+ if (!epr.hasNoneAddress()) {
+ out = openTheConnection(epr, msgContext);
+ TransportUtils.writeMessage(msgContext, out);
+ try {
+ socket.shutdownOutput();
+ msgContext.setProperty(MessageContext.TRANSPORT_IN, socket.getInputStream());
+ } catch (IOException e) {
+ throw AxisFault.makeFault(e);
+ }
+ }
+ } else {
+ out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT);
+
+ if (out != null) {
+ TransportUtils.writeMessage(msgContext, out);
+ } else {
+ throw new AxisFault(
+ "Both the TO and Property MessageContext.TRANSPORT_OUT is Null, No where to send");
+ }
+ }
+
+ TransportUtils.setResponseWritten(msgContext, true);
+
+ return InvocationResponse.CONTINUE;
+ }
+
+ protected OutputStream openTheConnection(EndpointReference toURL, MessageContext msgContext)
+ throws AxisFault {
+ if (toURL != null) {
+ try {
+ URL url = new URL(toURL.getAddress());
+ SocketAddress add = new InetSocketAddress(url.getHost(), (url.getPort() == -1)
+ ? 80
+ : url.getPort());
+
+ socket = new Socket();
+ socket.connect(add);
+
+ return socket.getOutputStream();
+ } catch (MalformedURLException e) {
+ throw AxisFault.makeFault(e);
+ } catch (IOException e) {
+ throw AxisFault.makeFault(e);
+ }
+ } else {
+ throw new AxisFault(Messages.getMessage("canNotBeNull", "End point reference"));
+ }
+ }
+}
Propchange: webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPTransportSender.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPWorker.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPWorker.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPWorker.java (original)
+++ webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPWorker.java Mon Nov 3 13:07:13 2008
@@ -1,117 +1,117 @@
-/*
- * 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.
- */
-
-
-package org.apache.axis2.transport.tcp;
-
-import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.builder.BuilderUtil;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.util.MessageContextBuilder;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.net.Socket;
-
-/**
- * This Class is the work hoarse of the TCP request, this process the incomming SOAP Message.
- */
-public class TCPWorker implements Runnable {
- private static final Log log = LogFactory.getLog(TCPWorker.class);
- private ConfigurationContext configurationContext;
- private Socket socket;
-
- public TCPWorker(ConfigurationContext configurationContext, Socket socket) {
- this.configurationContext = configurationContext;
- this.socket = socket;
- }
-
- public void run() {
- MessageContext msgContext = null;
-
- try {
- AxisConfiguration axisConf = configurationContext.getAxisConfiguration();
- TransportOutDescription transportOut =
- axisConf.getTransportOut(Constants.TRANSPORT_TCP);
- TransportInDescription transportIn =
- axisConf.getTransportIn(Constants.TRANSPORT_TCP);
-
- if ((transportOut != null) && (transportIn != null)) {
-
- // create the Message Context and fill in the values
- msgContext = configurationContext.createMessageContext();
- msgContext.setIncomingTransportName(Constants.TRANSPORT_TCP);
- msgContext.setTransportIn(transportIn);
- msgContext.setTransportOut(transportOut);
- msgContext.setServerSide(true);
-
- OutputStream out = socket.getOutputStream();
-
- msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
-
- // create the SOAP Envelope
- Reader in = new InputStreamReader(socket.getInputStream());
- OMXMLParserWrapper builder = BuilderUtil.getBuilder(in);
- SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
-
- msgContext.setEnvelope(envelope);
- AxisEngine.receive(msgContext);
- } else {
- throw new AxisFault(Messages.getMessage("unknownTransport",
- Constants.TRANSPORT_TCP));
- }
- } catch (Throwable e) {
- log.error(e.getMessage(), e);
- try {
-
- if (msgContext != null) {
- msgContext.setProperty(MessageContext.TRANSPORT_OUT, socket.getOutputStream());
-
- MessageContext faultContext =
- MessageContextBuilder.createFaultMessageContext(msgContext, e);
-
- AxisEngine.sendFault(faultContext);
- }
- } catch (Exception e1) {
- log.error(e1.getMessage(), e1);
- }
- } finally {
- if (socket != null) {
- try {
- this.socket.close();
- } catch (IOException e1) {
- // Do nothing
- }
- }
- }
- }
-}
+/*
+ * 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.
+ */
+
+
+package org.apache.axis2.transport.tcp;
+
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.builder.BuilderUtil;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.util.MessageContextBuilder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.net.Socket;
+
+/**
+ * This Class is the work hoarse of the TCP request, this process the incomming SOAP Message.
+ */
+public class TCPWorker implements Runnable {
+ private static final Log log = LogFactory.getLog(TCPWorker.class);
+ private ConfigurationContext configurationContext;
+ private Socket socket;
+
+ public TCPWorker(ConfigurationContext configurationContext, Socket socket) {
+ this.configurationContext = configurationContext;
+ this.socket = socket;
+ }
+
+ public void run() {
+ MessageContext msgContext = null;
+
+ try {
+ AxisConfiguration axisConf = configurationContext.getAxisConfiguration();
+ TransportOutDescription transportOut =
+ axisConf.getTransportOut(Constants.TRANSPORT_TCP);
+ TransportInDescription transportIn =
+ axisConf.getTransportIn(Constants.TRANSPORT_TCP);
+
+ if ((transportOut != null) && (transportIn != null)) {
+
+ // create the Message Context and fill in the values
+ msgContext = configurationContext.createMessageContext();
+ msgContext.setIncomingTransportName(Constants.TRANSPORT_TCP);
+ msgContext.setTransportIn(transportIn);
+ msgContext.setTransportOut(transportOut);
+ msgContext.setServerSide(true);
+
+ OutputStream out = socket.getOutputStream();
+
+ msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
+
+ // create the SOAP Envelope
+ Reader in = new InputStreamReader(socket.getInputStream());
+ OMXMLParserWrapper builder = BuilderUtil.getBuilder(in);
+ SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
+
+ msgContext.setEnvelope(envelope);
+ AxisEngine.receive(msgContext);
+ } else {
+ throw new AxisFault(Messages.getMessage("unknownTransport",
+ Constants.TRANSPORT_TCP));
+ }
+ } catch (Throwable e) {
+ log.error(e.getMessage(), e);
+ try {
+
+ if (msgContext != null) {
+ msgContext.setProperty(MessageContext.TRANSPORT_OUT, socket.getOutputStream());
+
+ MessageContext faultContext =
+ MessageContextBuilder.createFaultMessageContext(msgContext, e);
+
+ AxisEngine.sendFault(faultContext);
+ }
+ } catch (Exception e1) {
+ log.error(e1.getMessage(), e1);
+ }
+ } finally {
+ if (socket != null) {
+ try {
+ this.socket.close();
+ } catch (IOException e1) {
+ // Do nothing
+ }
+ }
+ }
+ }
+}
Propchange: webservices/commons/trunk/modules/transport/modules/tcp/src/org/apache/axis2/transport/tcp/TCPWorker.java
------------------------------------------------------------------------------
svn:eol-style = native