You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by he...@apache.org on 2005/05/20 06:21:03 UTC
svn commit: r171044 - in /webservices/axis/trunk/java/modules:
core/src/org/apache/axis/context/ core/src/org/apache/axis/transport/
samples/test/org/apache/axis/engine/
Author: hemapani
Date: Thu May 19 21:21:01 2005
New Revision: 171044
URL: http://svn.apache.org/viewcvs?rev=171044&view=rev
Log:
cleaning up the code
Added:
webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/ConfigurationContextFactory.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/TransportListener.java
Removed:
webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/EngineContextFactory.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/TransportReceiver.java
Modified:
webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLOnTwoChannelsTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java
Added: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/ConfigurationContextFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/ConfigurationContextFactory.java?rev=171044&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/ConfigurationContextFactory.java (added)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/ConfigurationContextFactory.java Thu May 19 21:21:01 2005
@@ -0,0 +1,100 @@
+package org.apache.axis.context;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.deployment.DeploymentEngine;
+import org.apache.axis.deployment.DeploymentException;
+import org.apache.axis.description.ModuleDescription;
+import org.apache.axis.description.ServiceDescription;
+import org.apache.axis.engine.AxisConfiguration;
+import org.apache.axis.engine.AxisConfigurationImpl;
+import org.apache.axis.engine.AxisFault;
+import org.apache.axis.modules.Module;
+import org.apache.axis.phaseresolver.PhaseException;
+import org.apache.axis.phaseresolver.PhaseResolver;
+
+/**
+ * Created by IntelliJ IDEA.
+ * Author : Deepal Jayasinghe
+ * Date: Apr 19, 2005
+ * Time: 10:44:38 AM
+ */
+public class ConfigurationContextFactory {
+
+ public ConfigurationContext buildEngineContext(String RepositaryName) throws DeploymentException {
+ ConfigurationContext configurationContext = null;
+ try {
+ DeploymentEngine deploymentEngine = new DeploymentEngine(RepositaryName);
+ AxisConfiguration configuration = deploymentEngine.load();
+ PhaseResolver phaseResolver = new PhaseResolver(configuration);
+ //TODO have to do smt Deepal
+ configurationContext = new ConfigurationContext(configuration) ;
+ phaseResolver.buildTranspotsChains();
+ initModules(configurationContext);
+ } catch (AxisFault axisFault) {
+ throw new DeploymentException(axisFault.getMessage());
+ }
+ return configurationContext;
+ }
+
+ public ConfigurationContext buildClientEngineContext(String axis2home) throws DeploymentException {
+ ConfigurationContext engineContext = null;
+ try {
+ AxisConfiguration configuration = new DeploymentEngine().loadClient(axis2home);
+ PhaseResolver phaseResolver = new PhaseResolver(configuration);
+ //TODO have to do smt Deepal
+ engineContext = new ConfigurationContext(configuration) ;
+ phaseResolver.buildTranspotsChains();
+ initModules(engineContext);
+ } catch (AxisFault axisFault) {
+ throw new DeploymentException(axisFault.getMessage());
+ }
+ return engineContext;
+ }
+
+ /**
+ * Is used to initilize the modules , if the module needs to so some recovery process
+ * it can do inside init and this is differnt form module.engage()
+ *
+ * @param context
+ * @throws DeploymentException
+ */
+
+
+ private void initModules(ConfigurationContext context) throws DeploymentException {
+ try {
+ HashMap modules = ((AxisConfigurationImpl) context.getEngineConfig()).getModules();
+ Collection col = modules.values();
+ for (Iterator iterator = col.iterator(); iterator.hasNext();) {
+ ModuleDescription axismodule = (ModuleDescription) iterator.next();
+ Module module = axismodule.getModule();
+ if (module != null) {
+ module.init(context.getEngineConfig());
+ }
+ }
+ } catch (AxisFault e) {
+ throw new DeploymentException(e.getMessage());
+ }
+ }
+
+ public static void createChains(ServiceDescription service, AxisConfiguration configurationContextVal , ArrayList modules) throws PhaseException {
+ try {
+ PhaseResolver reolve = new PhaseResolver(configurationContextVal, service);
+ reolve.buildchains();
+ for (int i = 0; i < modules.size(); i++) {
+ QName qName = (QName) modules.get(i);
+ ModuleDescription moduledecs = configurationContextVal.getModule(qName);
+ reolve.engageModuleToService(service,moduledecs);
+ }
+ } catch (PhaseException e) {
+ throw new PhaseException(e.getMessage());
+ } catch (AxisFault axisFault) {
+ throw new PhaseException(axisFault.getMessage());
+ }
+ }
+}
Added: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/TransportListener.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/TransportListener.java?rev=171044&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/TransportListener.java (added)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/TransportListener.java Thu May 19 21:21:01 2005
@@ -0,0 +1,29 @@
+/*
+ * 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.axis.transport;
+
+
+import org.apache.axis.addressing.EndpointReference;
+import org.apache.axis.engine.AxisFault;
+
+/**
+ * Class TransportListener
+ */
+public abstract class TransportListener{
+ public abstract void start()throws AxisFault;
+ public abstract void stop()throws AxisFault;
+ public abstract EndpointReference replyToEPR(String serviceName)throws AxisFault ;
+}
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLOnTwoChannelsTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLOnTwoChannelsTest.java?rev=171044&r1=171043&r2=171044&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLOnTwoChannelsTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLOnTwoChannelsTest.java Thu May 19 21:21:01 2005
@@ -16,8 +16,6 @@
package org.apache.axis.engine;
-
-
import java.io.File;
import javax.xml.namespace.QName;
@@ -43,7 +41,6 @@
import org.apache.axis.om.OMElement;
import org.apache.axis.om.OMFactory;
import org.apache.axis.om.OMNamespace;
-import org.apache.axis.phaseresolver.PhaseResolver;
import org.apache.axis.soap.SOAPEnvelope;
import org.apache.axis.soap.SOAPFactory;
import org.apache.axis.transport.http.SimpleHTTPServer;
@@ -68,7 +65,7 @@
private Thread thisThread;
private SimpleHTTPServer sas;
private ServiceContext serviceContext;
-
+
private boolean finish = false;
public EchoRawXMLOnTwoChannelsTest() {
@@ -81,8 +78,9 @@
protected void setUp() throws Exception {
UtilServer.start();
- UtilServer.getConfigurationContext().getEngineConfig().engageModule(new QName("addressing"));
-
+ UtilServer.getConfigurationContext().getEngineConfig().engageModule(
+ new QName("addressing"));
+
ServiceDescription service =
Utils.createSimpleService(
serviceName,
@@ -110,15 +108,13 @@
return reqEnv;
}
-
public void testEchoXMLCompleteASync() throws Exception {
DeploymentEngine deploymentEngine = new DeploymentEngine();
File file = new File("target/test-resources/repository-client/modules/addressing.mar");
//File file = new File("modules/samples/target/test-resources/repository-client/modules/addressing.mar");
-
+
assertTrue(file.exists());
- ModuleDescription moduleDesc =
- deploymentEngine.buildModule(file);
+ ModuleDescription moduleDesc = deploymentEngine.buildModule(file);
ConfigurationContextFactory efac = new ConfigurationContextFactory();
ConfigurationContext sysContext = efac.buildClientEngineContext(null);
@@ -126,27 +122,22 @@
sysContext.getEngineConfig().addMdoule(moduleDesc);
sysContext.getEngineConfig().engageModule(moduleDesc.getName());
ServiceDescription service =
- Utils.createSimpleService(
- serviceName,
- org.apache.axis.engine.Echo.class.getName(),
- operationName);
+ Utils.createSimpleService(
+ serviceName,
+ org.apache.axis.engine.Echo.class.getName(),
+ operationName);
sysContext.getEngineConfig().addService(service);
- Utils.resolvePhases(sysContext.getEngineConfig(),service);
+ Utils.resolvePhases(sysContext.getEngineConfig(), service);
ServiceContext serviceContext = sysContext.createServiceContext(service.getName());
-
-
-
OMFactory fac = OMAbstractFactory.getOMFactory();
-
OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
OMElement method = fac.createOMElement("echoOMElement", omNs);
OMElement value = fac.createOMElement("myValue", omNs);
value.setText("Isaac Assimov, the foundation Sega");
method.addChild(value);
-
org.apache.axis.clientapi.Call call = new org.apache.axis.clientapi.Call(serviceContext);
call.setTo(targetEPR);
@@ -174,13 +165,13 @@
while (!finish) {
Thread.sleep(1000);
index++;
- if(index > 10 ){
+ if (index > 10) {
throw new AxisFault("Server is shutdown as the Async response take too longs time");
}
}
log.info("send the reqest");
-}
+ }
}
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java?rev=171044&r1=171043&r2=171044&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java Thu May 19 21:21:01 2005
@@ -56,8 +56,8 @@
private AxisConfiguration engineRegistry;
private MessageContext mc;
- private Thread thisThread;
- private SimpleHTTPServer sas;
+ //private Thread thisThread;
+ // private SimpleHTTPServer sas;
private ServiceContext serviceContext;
private ServiceDescription service;