You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by de...@apache.org on 2005/07/08 12:54:37 UTC
svn commit: r209734 - in
/webservices/axis/trunk/java/modules/core/src/org/apache/axis2: deployment/
deployment/util/ engine/ transport/http/
Author: deepal
Date: Fri Jul 8 03:54:34 2005
New Revision: 209734
URL: http://svn.apache.org/viewcvs?rev=209734&view=rev
Log:
Fixing a bug , thre were some static data in the deployment module , and which caused some probmles when module engaging (when both clinet and server running in same JVM)
Added:
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/util/PhasesInfo.java
Removed:
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/util/DeploymentData.java
Modified:
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentParser.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationImpl.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java?rev=209734&r1=209733&r2=209734&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java Fri Jul 8 03:54:34 2005
@@ -16,7 +16,6 @@
package org.apache.axis2.deployment;
-import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.deployment.listener.RepositoryListenerImpl;
import org.apache.axis2.deployment.repository.util.ArchiveFileData;
import org.apache.axis2.deployment.repository.util.ArchiveReader;
@@ -24,7 +23,7 @@
import org.apache.axis2.deployment.scheduler.DeploymentIterator;
import org.apache.axis2.deployment.scheduler.Scheduler;
import org.apache.axis2.deployment.scheduler.SchedulerTask;
-import org.apache.axis2.deployment.util.DeploymentData;
+import org.apache.axis2.deployment.util.PhasesInfo;
import org.apache.axis2.description.*;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.engine.AxisConfigurationImpl;
@@ -86,7 +85,14 @@
private ArchiveFileData currentArchiveFile;
//tobuild chains
- private ConfigurationContextFactory factory;
+// private ConfigurationContextFactory factory;
+
+ /**
+ * To store the module specified in the server.xml at the document parsing time
+ */
+ private ArrayList modulelist = new ArrayList();
+
+ private PhasesInfo phasesinfo = new PhasesInfo(); //to store phases list in axis2.xml
/**
* Default constructor is need to deploye module and service programatically
@@ -146,7 +152,7 @@
}
}
- factory = new ConfigurationContextFactory();
+// factory = new ConfigurationContextFactory();
this.engineConfigName = RepositaryName + '/' + serverXMLFile;
}
@@ -208,6 +214,7 @@
try {
engagdeModules();
validateSystemPredefinedPhases();
+ ((AxisConfigurationImpl)axisConfig).setPhasesinfo(phasesinfo);
} catch (AxisFault axisFault) {
log.info("Module validation failed" + axisFault.getMessage());
throw new DeploymentException(axisFault);
@@ -246,6 +253,7 @@
new RepositoryListenerImpl(folderName, this);
try {
engagdeModules();
+ ((AxisConfigurationImpl)axisConfig).setPhasesinfo(phasesinfo);
} catch (AxisFault axisFault) {
log.info("Module validation failed" + axisFault.getMessage());
throw new DeploymentException(axisFault);
@@ -292,7 +300,7 @@
}
}
- factory = new ConfigurationContextFactory();
+// factory = new ConfigurationContextFactory();
this.engineConfigName = clientHome + '/' + clientXML;
}
@@ -301,9 +309,9 @@
* are exist , or they have deployed
*/
private void engagdeModules() throws AxisFault {
- ArrayList modules = DeploymentData.getInstance().getModules();
+ // ArrayList modules = DeploymentData.getInstance().getModules();
// PhaseResolver resolver = new PhaseResolver(axisConfig);
- for (Iterator iterator = modules.iterator(); iterator.hasNext();) {
+ for (Iterator iterator = modulelist.iterator(); iterator.hasNext();) {
QName name = (QName) iterator.next();
((AxisConfigurationImpl) axisConfig).engageModule(name);
}
@@ -316,8 +324,7 @@
* @throws DeploymentException
*/
private void validateSystemPredefinedPhases() throws DeploymentException {
- DeploymentData tempdata = DeploymentData.getInstance();
- ArrayList inPhases = tempdata.getINPhases();
+ ArrayList inPhases = phasesinfo.getINPhases();
//TODO condition checking should be otherway since null value can occur
if (!(((String) inPhases.get(0)).equals(PhaseMetadata.PHASE_TRANSPORTIN) &&
((String) inPhases.get(1)).equals(PhaseMetadata.PHASE_PRE_DISPATCH) &&
@@ -326,7 +333,7 @@
throw new DeploymentException("Invalid System predefined inphases , phase order dose not" +
" support\n recheck axis2.xml");
}
- // ArrayList outPhaes = tempdata.getOUTPhases();
+ // ArrayList outPhaes = tempdata.getOutphases();
//TODO do the validation code here
//ArrayList systemDefaultPhases =((AxisConfigurationImpl)axisConfig).getInPhasesUptoAndIncludingPostDispatch();
}
@@ -530,7 +537,7 @@
switch (type) {
case SERVICE:
try {
- // ServiceDescription service = archiveReader.createService(currentArchiveFile.getAbsolutePath());
+ // ServiceDescription service = archiveReader.createService(currentArchiveFile.getAbsolutePath());
ServiceDescription service = archiveReader.createService(currentArchiveFile);
archiveReader.readServiceArchive(currentArchiveFile.getAbsolutePath(), this, service);
addnewService(service);
@@ -634,6 +641,23 @@
return value;
}
return fileName;
+ }
+
+ /**
+ * while parsing the axis2.xml the module refferences have to be store some where , since at that
+ * time none of module availble (they load after parsing the document)
+ * @param moduleName <code>QName</code>
+ */
+ public void addModule(QName moduleName){
+ modulelist.add(moduleName);
+ }
+
+ public PhasesInfo getPhasesinfo() {
+ return phasesinfo;
+ }
+
+ public void setPhasesinfo(PhasesInfo phasesinfo) {
+ this.phasesinfo = phasesinfo;
}
/* public ServiceDescription deployService(ClassLoader classLoder, InputStream serviceStream, String servieName) throws DeploymentException {
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentParser.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentParser.java?rev=209734&r1=209733&r2=209734&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentParser.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentParser.java Fri Jul 8 03:54:34 2005
@@ -16,7 +16,7 @@
package org.apache.axis2.deployment;
-import org.apache.axis2.deployment.util.DeploymentData;
+import org.apache.axis2.deployment.util.PhasesInfo;
import org.apache.axis2.description.*;
import org.apache.axis2.engine.AxisConfigurationImpl;
import org.apache.axis2.engine.AxisFault;
@@ -170,26 +170,27 @@
String attname = pullparser.getAttributeLocalName(i);
String attvalue = pullparser.getAttributeValue(i);
if (REF.equals(attname)) {
- DeploymentData.getInstance().addModule(new QName(attvalue));
+ dpengine.addModule(new QName(attvalue));
+ // DeploymentData.getInstance().addModule(new QName(attvalue));
}
}
}
} else if (PHASE_ORDER.equals(ST)) {
int attribCount = pullparser.getAttributeCount();
- DeploymentData tempdata = DeploymentData.getInstance();
+ PhasesInfo info = dpengine.getPhasesinfo();
if (attribCount > 0) {
for (int i = 0; i < attribCount; i++) {
String attname = pullparser.getAttributeLocalName(i);
String attvalue = pullparser.getAttributeValue(i);
if (TYPE.equals(attname)) {
if (INFLOWST.equals(attvalue)) {
- tempdata.setINPhases(processPhaseOrder());
+ info.setINPhases(processPhaseOrder());
} else if (OUTFLOWST.equals(attvalue)) {
- tempdata.setOUTPhases(processPhaseOrder());
+ info.setOUTPhases(processPhaseOrder());
} else if (IN_FAILTFLOW.equals(attvalue)) {
- tempdata.setIN_FaultPhases(processPhaseOrder());
+ info.setIN_FaultPhases(processPhaseOrder());
} else if (OUT_FAILTFLOW.equals(attvalue)) {
- tempdata.setOUT_FaultPhases(processPhaseOrder());
+ info.setOUT_FaultPhases(processPhaseOrder());
} else {
throw new DeploymentException(
"un defined flow type " + ST);
@@ -411,7 +412,9 @@
// processBeanMapping();
} else if (OPRATIONST.equals(ST)) {
OperationDescription operation = processOperation(axisService);
- DeploymentData.getInstance().setOperationPhases(operation);
+ PhasesInfo info = dpengine.getPhasesinfo();
+ info.setOperationPhases(operation);
+// DeploymentData.getInstance().setOperationPhases(operation);
if (operation.getMessageReciever() == null) {
try {
/**
@@ -891,7 +894,9 @@
module.setOutFlow(outFlow);
} else if (OPRATIONST.equals(ST)) {
OperationDescription operation = processOperation(null);
- DeploymentData.getInstance().setOperationPhases(operation);
+ PhasesInfo info= dpengine.getPhasesinfo();
+ info.setOperationPhases(operation);
+// DeploymentData.getInstance().setOperationPhases(operation);
if (operation.getMessageReciever() == null) {
try {
/**
Added: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/util/PhasesInfo.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/util/PhasesInfo.java?rev=209734&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/util/PhasesInfo.java (added)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/util/PhasesInfo.java Fri Jul 8 03:54:34 2005
@@ -0,0 +1,135 @@
+package org.apache.axis2.deployment.util;
+
+import org.apache.axis2.engine.Phase;
+import org.apache.axis2.phaseresolver.PhaseMetadata;
+import org.apache.axis2.description.OperationDescription;
+
+import java.util.ArrayList;
+
+/*
+* 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.
+*
+*
+*/
+
+/**
+ * Author : Deepal Jayasinghe
+ * Date: Jul 8, 2005
+ * Time: 3:49:28 PM
+ */
+public class PhasesInfo {
+
+ private ArrayList INPhases;
+ private ArrayList OUTPhases;
+ private ArrayList IN_FaultPhases;
+ private ArrayList OUT_FaultPhases;
+
+ private ArrayList oprationINPhases;
+ private ArrayList oprationOUTPhases;
+ private ArrayList oprationIN_FaultPhases;
+ private ArrayList oprationOUT_FaultPhases;
+
+ public void setINPhases(ArrayList INPhases) {
+ this.INPhases = INPhases;
+ }
+
+ public void setOUTPhases(ArrayList OUTPhases) {
+ this.OUTPhases = OUTPhases;
+ }
+
+ public void setIN_FaultPhases(ArrayList IN_FaultPhases) {
+ this.IN_FaultPhases = IN_FaultPhases;
+ }
+
+ public void setOUT_FaultPhases(ArrayList OUT_FaultPhases) {
+ this.OUT_FaultPhases = OUT_FaultPhases;
+ }
+
+ public ArrayList getINPhases() {
+ return INPhases;
+ }
+
+ public ArrayList getOUTPhases() {
+ return OUTPhases;
+ }
+
+ public ArrayList getIN_FaultPhases() {
+ return IN_FaultPhases;
+ }
+
+ public ArrayList getOUT_FaultPhases() {
+ return OUT_FaultPhases;
+ }
+
+ public ArrayList getOperationInPhases() {
+ oprationINPhases = new ArrayList();
+ oprationINPhases.add(new Phase(PhaseMetadata.PHASE_POLICY_DETERMINATION));
+ for (int i = 0; i < INPhases.size(); i++) {
+ String phaseName = (String) INPhases.get(i);
+ if (PhaseMetadata.PHASE_TRANSPORTIN.equals(phaseName) ||
+ PhaseMetadata.PHASE_PRE_DISPATCH.equals(phaseName) ||
+ PhaseMetadata.PHASE_DISPATCH.equals(phaseName) ||
+ PhaseMetadata.PHASE_POST_DISPATCH.equals(phaseName)) {
+ continue;
+ } else {
+ oprationINPhases.add(new Phase(phaseName));
+ }
+ }
+ return oprationINPhases;
+ }
+
+ public ArrayList getOperationOutPhases() {
+ oprationOUTPhases = new ArrayList();
+ for (int i = 0; i < OUTPhases.size(); i++) {
+ String phaseName = (String) OUTPhases.get(i);
+ if (PhaseMetadata.PHASE_TRANSPORT_OUT.equals(phaseName)) {
+ continue;
+ } else {
+ oprationOUTPhases.add(new Phase(phaseName));
+ }
+ }
+ oprationOUTPhases.add(new Phase(PhaseMetadata.PHASE_POLICY_DETERMINATION));
+ oprationOUTPhases.add(new Phase(PhaseMetadata.PHASE_MESSAGE_OUT));
+ return oprationOUTPhases;
+ }
+
+ public ArrayList getOperationInFaultPhases() {
+ oprationIN_FaultPhases = new ArrayList();
+ for (int i = 0; i < IN_FaultPhases.size(); i++) {
+ String phaseName = (String) IN_FaultPhases.get(i);
+ oprationIN_FaultPhases.add(new Phase(phaseName));
+ }
+ return oprationIN_FaultPhases;
+ }
+
+ public ArrayList getOperationOutFaultPhases() {
+ oprationOUT_FaultPhases = new ArrayList();
+ for (int i = 0; i < OUT_FaultPhases.size(); i++) {
+ String phaseName = (String) OUT_FaultPhases.get(i);
+ oprationOUT_FaultPhases.add(new Phase(phaseName));
+ }
+ return oprationOUT_FaultPhases;
+ }
+
+ public void setOperationPhases(OperationDescription operation) {
+ if (operation != null) {
+ operation.setRemainingPhasesInFlow(getOperationInPhases());
+ operation.setPhasesOutFlow(getOperationOutPhases());
+ operation.setPhasesInFaultFlow(getOperationInFaultPhases());
+ operation.setPhasesOutFaultFlow(getOperationOutFaultPhases());
+ }
+ }
+
+}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationImpl.java?rev=209734&r1=209733&r2=209734&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationImpl.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationImpl.java Fri Jul 8 03:54:34 2005
@@ -16,6 +16,7 @@
package org.apache.axis2.engine;
import org.apache.axis2.deployment.DeploymentEngine;
+import org.apache.axis2.deployment.util.PhasesInfo;
import org.apache.axis2.deployment.repository.util.ArchiveReader;
import org.apache.axis2.description.*;
import org.apache.axis2.phaseresolver.PhaseMetadata;
@@ -70,6 +71,9 @@
*/
protected final ParameterInclude paramInclude;
+
+ protected PhasesInfo phasesinfo;
+
/**
* Field modules
*/
@@ -339,6 +343,14 @@
public boolean isEngaged(QName moduleName){
return engagedModules.contains(moduleName);
+ }
+
+ public PhasesInfo getPhasesinfo() {
+ return phasesinfo;
+ }
+
+ public void setPhasesinfo(PhasesInfo phasesinfo) {
+ this.phasesinfo = phasesinfo;
}
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java?rev=209734&r1=209733&r2=209734&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java Fri Jul 8 03:54:34 2005
@@ -19,7 +19,7 @@
import org.apache.axis2.Constants;
import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.deployment.util.DeploymentData;
+import org.apache.axis2.deployment.util.PhasesInfo;
import org.apache.axis2.description.OperationDescription;
import org.apache.axis2.description.ServiceDescription;
import org.apache.axis2.engine.AxisConfigurationImpl;
@@ -29,7 +29,6 @@
import javax.servlet.http.HttpServletResponse;
import javax.xml.namespace.QName;
import java.io.IOException;
-import java.io.StringWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -348,17 +347,16 @@
private void listPhases(HttpServletRequest req, HttpServletResponse res) throws IOException {
ArrayList phaselist = new ArrayList();
- DeploymentData depdata = DeploymentData.getInstance();
- phaselist.add(depdata.getINPhases());
- phaselist.add(depdata.getIN_FaultPhases());
- phaselist.add(depdata.getOUTPhases());
- phaselist.add(depdata.getOUT_FaultPhases());
-
- phaselist.add(depdata.getOperationInPhases());
- phaselist.add(depdata.getOperationInFaultPhases());
- phaselist.add(depdata.getOperationOutPhases());
- phaselist.add(depdata.getOperationOutFaultPhases());
-
+ PhasesInfo info = ((AxisConfigurationImpl)configContext.getAxisConfiguration()).getPhasesinfo();
+ phaselist.add(info.getINPhases());
+ phaselist.add(info.getIN_FaultPhases());
+ phaselist.add(info.getOUTPhases());
+ phaselist.add(info.getOUT_FaultPhases());
+
+ phaselist.add(info.getOperationInPhases());
+ phaselist.add(info.getOperationInFaultPhases());
+ phaselist.add(info.getOperationOutPhases());
+ phaselist.add(info.getOperationOutFaultPhases());
req.getSession().setAttribute(Constants.PHASE_LIST, phaselist);
res.sendRedirect(LIST_PHASES_JSP_NAME);
}