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 de...@apache.org on 2005/04/19 07:43:56 UTC
svn commit: r161846 - in webservices/axis/trunk/java/modules/core:
src/org/apache/axis/deployment/ src/org/apache/axis/phaseresolver/
src/org/apache/axis/transport/mail/ test/org/apache/axis/deployment/
Author: deepal
Date: Mon Apr 18 22:43:55 2005
New Revision: 161846
URL: http://svn.apache.org/viewcvs?view=rev&rev=161846
Log:
Moved phase reslover from Deployment and Introduce new class called ContextBuilder which can use to build EnginContext , inside ContextBuilder it will create a deploymentEngine and throgh that all the configuration will be craeted .
Then using congigs and PhaseResolver EngineContext will be created
Modified:
webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/EngineRegistryFactoryImpl.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/SimpleMailListner.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/BuildERWithDeploymentTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/DeploymentotalTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/TransportDeploymentTest.java
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java?view=diff&r1=161845&r2=161846
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java Mon Apr 18 22:43:55 2005
@@ -29,8 +29,6 @@
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
-import org.apache.axis.context.EngineContext;
-import org.apache.axis.context.ServiceContext;
import org.apache.axis.deployment.listener.RepositoryListenerImpl;
import org.apache.axis.deployment.repository.utill.HDFileItem;
import org.apache.axis.deployment.repository.utill.UnZipJAR;
@@ -49,8 +47,6 @@
import org.apache.axis.engine.EngineConfigurationImpl;
import org.apache.axis.engine.Handler;
import org.apache.axis.engine.MessageReceiver;
-import org.apache.axis.phaseresolver.PhaseException;
-import org.apache.axis.phaseresolver.PhaseResolver;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -92,11 +88,8 @@
/**
* This to keep a referance to serverMetaData object
*/
- // private static ServerMetaData server = new ServerMetaData();
- private AxisGlobal server;
-
- private EngineContext engineContext;
-
+ // private static ServerMetaData axisGlobal = new ServerMetaData();
+ private AxisGlobal axisGlobal;
private HDFileItem currentFileItem;
@@ -109,7 +102,7 @@
*/
public DeploymentEngine(String RepositaryName) throws DeploymentException {
- this(RepositaryName, "server.xml");
+ this(RepositaryName, "axisGlobal.xml");
}
/**
@@ -135,7 +128,7 @@
File serverConf = new File(repository, serverXMLFile);
if (!serverConf.exists()) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
- InputStream in = cl.getResourceAsStream("org/apache/axis/deployment/server.xml");
+ InputStream in = cl.getResourceAsStream("org/apache/axis/deployment/axisGlobal.xml");
if (in != null) {
try {
serverConf.createNewFile();
@@ -154,18 +147,13 @@
} else {
- throw new DeploymentException("can not found org/apache/axis/deployment/server.xml");
+ throw new DeploymentException("can not found org/apache/axis/deployment/axisGlobal.xml");
}
}
this.serverConfigName = RepositaryName + '/' + serverXMLFile;
}
-// public DeploymentEngine(String RepositaryName , String configFileName) {
-// this.folderName = RepositaryName;
-// this.serverConfigName = configFileName;
-// }
-
public HDFileItem getCurrentFileItem() {
return currentFileItem;
}
@@ -181,24 +169,41 @@
}
/**
- * This method will fill the engine registry and return it to Engine
- *
- * @return
- * @throws AxisFault
+ * To set hotDeployment and hot update
*/
- public EngineContext start() throws AxisFault, DeploymentException, XMLStreamException {
- //String fileName;
- if (serverConfigName == null) {
+ private void setDeploymentFeatures() {
+ String value;
+ Parameter parahotdeployment = axisGlobal.getParameter(HOTDEPLOYMENT);
+ Parameter parahotupdate = axisGlobal.getParameter(HOTUPDATE);
+ if (parahotdeployment != null) {
+ value = (String) parahotdeployment.getValue();
+ if ("false".equals(value))
+ hotDeployment = false;
+ }
+ if (parahotupdate != null) {
+ value = (String) parahotupdate.getValue();
+ if ("false".equals(value))
+ hotUpdate = false;
+
+ }
+ }
+
+ public EngineConfiguration load() throws DeploymentException {
+ if (serverConfigName == null) {
throw new DeploymentException("path to Server.xml can not be NUll");
}
File tempfile = new File(serverConfigName);
try {
InputStream in = new FileInputStream(tempfile);
- engineconfig = createEngineRegistry();
+ engineconfig = createEngineConfig();
DeploymentParser parser = new DeploymentParser(in, this);
- parser.procesServerXML(server);
+ parser.procesServerXML(axisGlobal);
} catch (FileNotFoundException e) {
- throw new AxisFault("Exception at deployment", e);
+ throw new DeploymentException("Exception at deployment", e);
+ } catch (AxisFault axisFault) {
+ throw new DeploymentException(axisFault.getMessage());
+ } catch (XMLStreamException e) {
+ throw new DeploymentException(e.getMessage());
}
setDeploymentFeatures();
if (hotDeployment) {
@@ -207,54 +212,31 @@
new RepositoryListenerImpl(folderName, this);
}
try {
- valideServerModule();
- } catch (PhaseException e) {
- log.info("Module validation failed" + e.getMessage());
- }
- return engineContext;
- }
-
- /**
- * To set hotDeployment and hot update
- */
- private void setDeploymentFeatures() {
- String value;
- Parameter parahotdeployment = server.getParameter(HOTDEPLOYMENT);
- Parameter parahotupdate = server.getParameter(HOTUPDATE);
- if (parahotdeployment != null) {
- value = (String) parahotdeployment.getValue();
- if ("false".equals(value))
- hotDeployment = false;
- }
- if (parahotupdate != null) {
- value = (String) parahotupdate.getValue();
- if ("false".equals(value))
- hotUpdate = false;
-
+ validateServerModule();
+ } catch (AxisFault axisFault) {
+ log.info("Module validation failed" + axisFault.getMessage());
+ throw new DeploymentException(axisFault.getMessage());
}
+ return engineconfig;
}
/**
- * This methode used to check the modules referd by server.xml
+ * This methode used to check the modules referd by axisGlobal.xml
* are exist , or they have deployed
*/
- private void valideServerModule() throws AxisFault, PhaseException {
- Iterator itr = server.getModules().iterator();
+ private void validateServerModule() throws AxisFault{
+ Iterator itr = axisGlobal.getModules().iterator();
while (itr.hasNext()) {
QName qName = (QName) itr.next();
if (getModule(qName) == null) {
- throw new AxisFault(server + " Refer to invalid module " + qName + " has not bean deployed yet !");
+ throw new AxisFault(axisGlobal + " Refer to invalid module " + qName + " has not bean deployed yet !");
}
}
- PhaseResolver phaseResolver = new PhaseResolver(engineconfig);
- phaseResolver.buildGlobalChains(engineContext);
- phaseResolver.buildTranspotsChains();
-
}
public AxisModule getModule(QName moduleName) throws AxisFault {
- AxisModule metaData = engineconfig.getModule(moduleName);
- return metaData;
+ AxisModule axisModule = engineconfig.getModule(moduleName);
+ return axisModule;
}
/**
@@ -266,78 +248,49 @@
scheduler.schedule(new SchedulerTask(engine, folderName), new DeploymentIterator());
}
- private EngineConfiguration createEngineRegistry() throws AxisFault {
- EngineConfiguration newEngineRegisty;
-
- server = new AxisGlobal();
- newEngineRegisty = new EngineConfigurationImpl(server);
- engineContext = new EngineContext(newEngineRegisty);
-
- return newEngineRegisty;
+ private EngineConfiguration createEngineConfig() throws AxisFault {
+ axisGlobal = new AxisGlobal();
+ EngineConfiguration newEngineConfig = new EngineConfigurationImpl(axisGlobal);
+ return newEngineConfig;
}
- private void addnewService(AxisService serviceMetaData) throws AxisFault, PhaseException {
+ private void addnewService(AxisService serviceMetaData) throws AxisFault{
currentFileItem.setClassLoader();
- ServiceContext serviceContext = getRunnableService(serviceMetaData);
- engineContext.addService(serviceContext);
+ loadServiceProperties(serviceMetaData);
engineconfig.addService(serviceMetaData);
System.out.println("adding new service" + serviceMetaData.getName().getLocalPart());
- /*Parameter para = serviceMetaData.getParameter("OUTSERVICE");
- if (para != null) {
- String value = (String) para.getValue();
- if ("true".equals(value)) {
- Class temp = serviceMetaData.getServiceClass();
- try {
- Thread servie = (Thread) temp.newInstance();
- servie.start();
- } catch (InstantiationException e) {
- throw new AxisFault(e.getMessage());
- } catch (IllegalAccessException e) {
- throw new AxisFault(e.getMessage());
- }
-
- }
- }*/
}
/**
* This method is used to fill the axis service , it dose loading service class and also the provider class
* and it will also load the service handlers
*
- * @param serviceMetaData
- * @return
+ * @param axisService
* @throws AxisFault
- * @throws PhaseException
*/
- private ServiceContext getRunnableService(AxisService serviceMetaData) throws AxisFault, PhaseException {
- loadMessageReceiver(serviceMetaData);
- Flow inflow = serviceMetaData.getInFlow();
+ private void loadServiceProperties(AxisService axisService) throws AxisFault{
+ loadMessageReceiver(axisService);
+ Flow inflow = axisService.getInFlow();
if (inflow != null) {
addFlowHandlers(inflow);
}
- Flow outFlow = serviceMetaData.getOutFlow();
+ Flow outFlow = axisService.getOutFlow();
if (outFlow != null) {
addFlowHandlers(outFlow);
}
- Flow faultInFlow = serviceMetaData.getFaultInFlow();
+ Flow faultInFlow = axisService.getFaultInFlow();
if (faultInFlow != null) {
addFlowHandlers(faultInFlow);
}
- Flow faultOutFlow = serviceMetaData.getFaultOutFlow();
+ Flow faultOutFlow = axisService.getFaultOutFlow();
if (faultOutFlow != null) {
addFlowHandlers(faultOutFlow);
}
-
-
- ServiceContext serviceContext = new ServiceContext(serviceMetaData);
- PhaseResolver reolve = new PhaseResolver(engineconfig,serviceContext);
- serviceContext = reolve.buildchains();
- serviceMetaData.setClassLoader(currentFileItem.getClassLoader());
- return serviceContext;
+ axisService.setClassLoader(currentFileItem.getClassLoader());
}
@@ -536,7 +489,7 @@
service = new AxisService();
DeploymentParser schme = new DeploymentParser(serviceStream, this);
schme.parseServiceXML(service);
- service = getRunnableService(service);
+ service = loadServiceProperties(service);
} catch (XMLStreamException e) {
throw new DeploymentException(e.getMessage());
} catch (PhaseException e) {
@@ -559,26 +512,22 @@
* @return
* @throws DeploymentException
*/
- public ServiceContext buildService(AxisService axisService , InputStream serviceInputStream, ClassLoader classLoader) throws DeploymentException {
- ServiceContext serviceContext;
+ public AxisService buildService(AxisService axisService , InputStream serviceInputStream, ClassLoader classLoader) throws DeploymentException {
try {
DeploymentParser schme = new DeploymentParser(serviceInputStream, this);
schme.parseServiceXML(axisService);
axisService.setClassLoader(classLoader);
- serviceContext = getRunnableService(axisService);
- engineContext.addService(serviceContext);
+ loadServiceProperties(axisService);
engineconfig.addService(axisService);
} catch (XMLStreamException e) {
throw new DeploymentException("XMLStreamException" + e.getMessage());
} catch (DeploymentException e) {
throw new DeploymentException(e.getMessage()) ;
- } catch (PhaseException e) {
- throw new DeploymentException(e.getMessage());
- } catch (AxisFault axisFault) {
+ } catch (AxisFault axisFault) {
throw new DeploymentException(axisFault.getMessage());
}
- return serviceContext;
+ return axisService;
}
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java?view=diff&r1=161845&r2=161846
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java Mon Apr 18 22:43:55 2005
@@ -76,7 +76,7 @@
pullparser = XMLInputFactory.newInstance().createXMLStreamReader(inputStream);
}
- public void parseServiceXML(AxisService axisService) throws DeploymentException, PhaseException {
+ public void parseServiceXML(AxisService axisService) throws DeploymentException{
//To check whether document end tag has encountered
boolean END_DOCUMENT = false;
// ServiceMetaData service = null;
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/EngineRegistryFactoryImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/EngineRegistryFactoryImpl.java?view=diff&r1=161845&r2=161846
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/EngineRegistryFactoryImpl.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/EngineRegistryFactoryImpl.java Mon Apr 18 22:43:55 2005
@@ -19,6 +19,7 @@
import javax.xml.stream.XMLStreamException;
import org.apache.axis.context.EngineContext;
+import org.apache.axis.context.ContextBuilder;
import org.apache.axis.engine.AxisFault;
import org.apache.axis.engine.EngineRegistryFactory;
@@ -26,11 +27,9 @@
public class EngineRegistryFactoryImpl implements EngineRegistryFactory {
public EngineContext createEngineRegistry(String file) throws AxisFault {
try {
- DeploymentEngine deploymentEngine = new DeploymentEngine(file);
- return deploymentEngine.start();
+ ContextBuilder builder = new ContextBuilder();
+ return builder.buildEngineContext(file);
} catch (DeploymentException e) {
- throw AxisFault.makeFault(e);
- } catch (XMLStreamException e) {
throw AxisFault.makeFault(e);
}
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java?view=diff&r1=161845&r2=161846
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java Mon Apr 18 22:43:55 2005
@@ -107,7 +107,9 @@
int flowtype = type;
ArrayList allHandlers = new ArrayList();
- // int count = server.getModuleCount();
+ // engineConfig.getGlobal().getModules()
+
+ // int count = server.getModuleCount();
// QName moduleName;
AxisModule module;
Flow flow = null;
@@ -331,13 +333,13 @@
/**
* Method buildGlobalChains
*
- * @param engineContext
* @throws AxisFault
* @throws PhaseException
*/
- public void buildGlobalChains(EngineContext engineContext)
+ public EngineContext buildGlobalChains()
throws AxisFault, PhaseException {
- AxisGlobal global =engineContext.getEngineConfig().getGlobal();
+ EngineContext engineContext = new EngineContext(engineConfig);
+ AxisGlobal global =engineConfig.getGlobal();
List modules = (List) global.getModules();
int count = modules.size();
QName moduleName;
@@ -385,5 +387,6 @@
}
phaseHolder.buildGlobalChain(engineContext, type);
}
+ return engineContext;
}
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/SimpleMailListner.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/SimpleMailListner.java?view=diff&r1=161845&r2=161846
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/SimpleMailListner.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/mail/SimpleMailListner.java Mon Apr 18 22:43:55 2005
@@ -25,6 +25,7 @@
import javax.mail.internet.MimeMessage;
import org.apache.axis.context.EngineContext;
+import org.apache.axis.context.ContextBuilder;
import org.apache.axis.deployment.DeploymentEngine;
import org.apache.axis.engine.AxisEngine;
import org.apache.axis.engine.EngineConfiguration;
@@ -74,8 +75,8 @@
this.userid = userid;
this.password = password;
try {
- DeploymentEngine deploymentEngine = new DeploymentEngine(dir);
- er = deploymentEngine.start();
+ ContextBuilder builder = new ContextBuilder();
+ er = builder.buildEngineContext(dir);
} catch (Exception e) {
e.printStackTrace();
}
Modified: webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/BuildERWithDeploymentTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/BuildERWithDeploymentTest.java?view=diff&r1=161845&r2=161846
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/BuildERWithDeploymentTest.java (original)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/BuildERWithDeploymentTest.java Mon Apr 18 22:43:55 2005
@@ -19,6 +19,7 @@
import javax.xml.namespace.QName;
import org.apache.axis.AbstractTestCase;
+import org.apache.axis.context.ContextBuilder;
import org.apache.axis.description.AxisOperation;
import org.apache.axis.description.AxisService;
import org.apache.axis.description.Flow;
@@ -36,8 +37,9 @@
public void testDeployment() throws Exception {
String filename = "./target/test-resources/deployment";
- DeploymentEngine deploymentEngine = new DeploymentEngine(filename);
- EngineConfiguration er = deploymentEngine.start().getEngineConfig();
+ ContextBuilder builder = new ContextBuilder();
+ EngineConfiguration er = builder.buildEngineContext(filename).getEngineConfig();
+
assertNotNull(er);
assertNotNull(er.getGlobal());
Modified: webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/DeploymentotalTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/DeploymentotalTest.java?view=diff&r1=161845&r2=161846
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/DeploymentotalTest.java (original)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/DeploymentotalTest.java Mon Apr 18 22:43:55 2005
@@ -1,19 +1,19 @@
/*
- * 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.
- */
-
+* 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.deployment;
import javax.xml.stream.XMLStreamException;
@@ -23,14 +23,16 @@
import org.apache.axis.engine.AxisFault;
import org.apache.axis.engine.EngineConfiguration;
import org.apache.axis.phaseresolver.PhaseException;
+import org.apache.axis.context.ContextBuilder;
public class DeploymentotalTest extends TestCase {
EngineConfiguration er;
public void testparseService1() throws PhaseException, DeploymentException, AxisFault, XMLStreamException {
String filename = "./target/test-resources/deployment";
- DeploymentEngine deploymentEngine = new DeploymentEngine(filename);
- er = deploymentEngine.start().getEngineConfig();
+
+ ContextBuilder builder = new ContextBuilder();
+ er = builder.buildEngineContext(filename).getEngineConfig();
}
}
Modified: webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/TransportDeploymentTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/TransportDeploymentTest.java?view=diff&r1=161845&r2=161846
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/TransportDeploymentTest.java (original)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/TransportDeploymentTest.java Mon Apr 18 22:43:55 2005
@@ -20,6 +20,7 @@
import javax.xml.stream.XMLStreamException;
import org.apache.axis.AbstractTestCase;
+import org.apache.axis.context.ContextBuilder;
import org.apache.axis.description.AxisTransportIn;
import org.apache.axis.description.AxisTransportOut;
import org.apache.axis.engine.AxisFault;
@@ -36,7 +37,7 @@
public void testTransports() throws AxisFault, PhaseException, DeploymentException, XMLStreamException {
DeploymentEngine engine = new DeploymentEngine(testResourceDir + "/deployment", "server-transport.xml");
- engine.start();
+ engine.load();
EngineConfiguration er = engine.getEngineconfig();
AxisTransportIn transport = er.getTransportIn(new QName("http"));
assertNotNull(transport);