You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2005/09/15 21:07:03 UTC
svn commit: r289289 [11/134] - in /webservices/axis2/trunk/java: ./ etc/
modules/addressing/ modules/addressing/src/META-INF/
modules/addressing/src/org/apache/axis2/handlers/addressing/
modules/addressing/test-resources/ modules/addressing/test/org/ap...
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceGroupContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceGroupContext.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceGroupContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceGroupContext.java Thu Sep 15 11:52:11 2005
@@ -1,116 +1,116 @@
-package org.apache.axis2.context;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.AxisConfigurationImpl;
-import org.apache.axis2.description.ServiceGroupDescription;
-import org.apache.axis2.description.ServiceDescription;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Iterator;
-
-/*
-* 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
- * : Eran Chinthaka
- */
-public class ServiceGroupContext extends AbstractContext {
-
- private String id;
- private Map serviceContextMap;
- private transient ServiceGroupDescription description;
- private String serviceGroupDescName=null;
-
- public void init(AxisConfiguration axisConfiguration) throws AxisFault {
- if (serviceGroupDescName!=null)
- description = axisConfiguration.getServiceGroup(serviceGroupDescName);
- }
-
- private void writeObject(ObjectOutputStream out) throws IOException {
- if (description!=null)
- this.serviceGroupDescName = description.getServiceGroupName();
-
- out.defaultWriteObject();
- }
-
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
- in.defaultReadObject();
- nonPersistentMap = new HashMap ();
- }
-
- public ServiceGroupContext(ConfigurationContext parent ,ServiceGroupDescription description) {
- super(parent);
- this.description = description;
- serviceContextMap = new HashMap();
-
- if (description!=null)
- this.serviceGroupDescName = description.getServiceGroupName();
- fillServiceContexts();
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- //if the servic name is foo:bar , you should pass only bar
- public ServiceContext getServiceContext(String serviceName) {
- return (ServiceContext) serviceContextMap.get(serviceName);
- }
-
- /**
- * This will create one ServiceContext per each serviceDesc in descrpition
- * if serviceGroup desc has 2 service init , then two serviceContext will be
- * created
- */
- private void fillServiceContexts(){
- Iterator services = description.getServices();
- while (services.hasNext()) {
- ServiceDescription serviceDescription = (ServiceDescription) services.next();
- ServiceContext serviceContext = new ServiceContext(serviceDescription,this);
- String [] servicNams = AxisConfigurationImpl.splitServiceName(
- serviceDescription.getName().getLocalPart());
- serviceContextMap.put(servicNams[1],serviceContext);
- }
- }
-
-
-
-// public void registerServiceContext(ServiceContext serviceContext) throws AxisFault {
-// String serviceName = serviceContext.getServiceConfig().
-// getName().getLocalPart();
-// ServiceContext serviceContextAlreadyRegistered = (ServiceContext) serviceContextMap.get(serviceName);
-// if (serviceContextAlreadyRegistered == null) {
-// serviceContextMap.put(serviceName, serviceContext);
-// serviceContext.setParent(this);
-// }
-// }
-
- public ServiceGroupDescription getDescription() {
- return description;
- }
-}
+package org.apache.axis2.context;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.AxisConfigurationImpl;
+import org.apache.axis2.description.ServiceGroupDescription;
+import org.apache.axis2.description.ServiceDescription;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Iterator;
+
+/*
+* 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
+ * : Eran Chinthaka
+ */
+public class ServiceGroupContext extends AbstractContext {
+
+ private String id;
+ private Map serviceContextMap;
+ private transient ServiceGroupDescription description;
+ private String serviceGroupDescName=null;
+
+ public void init(AxisConfiguration axisConfiguration) throws AxisFault {
+ if (serviceGroupDescName!=null)
+ description = axisConfiguration.getServiceGroup(serviceGroupDescName);
+ }
+
+ private void writeObject(ObjectOutputStream out) throws IOException {
+ if (description!=null)
+ this.serviceGroupDescName = description.getServiceGroupName();
+
+ out.defaultWriteObject();
+ }
+
+ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ nonPersistentMap = new HashMap ();
+ }
+
+ public ServiceGroupContext(ConfigurationContext parent ,ServiceGroupDescription description) {
+ super(parent);
+ this.description = description;
+ serviceContextMap = new HashMap();
+
+ if (description!=null)
+ this.serviceGroupDescName = description.getServiceGroupName();
+ fillServiceContexts();
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ //if the servic name is foo:bar , you should pass only bar
+ public ServiceContext getServiceContext(String serviceName) {
+ return (ServiceContext) serviceContextMap.get(serviceName);
+ }
+
+ /**
+ * This will create one ServiceContext per each serviceDesc in descrpition
+ * if serviceGroup desc has 2 service init , then two serviceContext will be
+ * created
+ */
+ private void fillServiceContexts(){
+ Iterator services = description.getServices();
+ while (services.hasNext()) {
+ ServiceDescription serviceDescription = (ServiceDescription) services.next();
+ ServiceContext serviceContext = new ServiceContext(serviceDescription,this);
+ String [] servicNams = AxisConfigurationImpl.splitServiceName(
+ serviceDescription.getName().getLocalPart());
+ serviceContextMap.put(servicNams[1],serviceContext);
+ }
+ }
+
+
+
+// public void registerServiceContext(ServiceContext serviceContext) throws AxisFault {
+// String serviceName = serviceContext.getServiceConfig().
+// getName().getLocalPart();
+// ServiceContext serviceContextAlreadyRegistered = (ServiceContext) serviceContextMap.get(serviceName);
+// if (serviceContextAlreadyRegistered == null) {
+// serviceContextMap.put(serviceName, serviceContext);
+// serviceContext.setParent(this);
+// }
+// }
+
+ public ServiceGroupDescription getDescription() {
+ return description;
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceGroupContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/SessionContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/SessionContext.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/SessionContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/SessionContext.java Thu Sep 15 11:52:11 2005
@@ -1,38 +1,38 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis2.context;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.engine.AxisConfiguration;
-
-/**
- * All the engine componets are stateless accross the executions and all the states should be kept in the
- * Contexts, there are three context Global, Session and Message
- */
-public class SessionContext extends AbstractContext {
- /**
- * @param parent
- */
- public SessionContext(AbstractContext parent) {
- super(parent);
- }
-
- public void init(AxisConfiguration axisConfiguration) throws AxisFault {
-
- }
-
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.context;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.engine.AxisConfiguration;
+
+/**
+ * All the engine componets are stateless accross the executions and all the states should be kept in the
+ * Contexts, there are three context Global, Session and Message
+ */
+public class SessionContext extends AbstractContext {
+ /**
+ * @param parent
+ */
+ public SessionContext(AbstractContext parent) {
+ super(parent);
+ }
+
+ public void init(AxisConfiguration axisConfiguration) throws AxisFault {
+
+ }
+
+
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/SessionContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisConfigBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisConfigBuilder.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisConfigBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisConfigBuilder.java Thu Sep 15 11:52:11 2005
@@ -1,487 +1,487 @@
-package org.apache.axis2.deployment;
-
-import org.apache.axis2.engine.*;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMAttribute;
-import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.phaseresolver.PhaseMetadata;
-import org.apache.axis2.storage.AxisStorage;
-import org.apache.axis2.deployment.util.PhasesInfo;
-import org.apache.axis2.transport.TransportSender;
-import org.apache.axis2.transport.TransportListener;
-import org.apache.axis2.description.*;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.namespace.QName;
-import java.io.InputStream;
-import java.util.Iterator;
-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: Aug 26, 2005
- * Time: 4:44:46 PM
- */
-public class AxisConfigBuilder extends DescriptionBuilder{
-
- private AxisConfiguration axisConfiguration;
-
- public AxisConfigBuilder(InputStream serviceInputSteram, DeploymentEngine engine,
- AxisConfiguration axisConfiguration) {
- super(serviceInputSteram, engine);
- this.axisConfiguration = axisConfiguration;
- }
-
- public void populateConfig() throws DeploymentException {
- try {
- OMElement config_element = buildOM();
-
- //processing Paramters
- //Processing service level paramters
- Iterator itr = config_element.getChildrenWithName(
- new QName(PARAMETERST));
- processParameters(itr,axisConfiguration,axisConfiguration);
-
- //process MessageReciver
-
- Iterator msgRecives = config_element.getChildrenWithName(new QName(MESSAGERECEIVER));
- while (msgRecives.hasNext()) {
- OMElement msgRev = (OMElement) msgRecives.next();
- MessageReceiver msgrecivere= loadMessageReceiver(
- Thread.currentThread().getContextClassLoader(),msgRev);
- OMAttribute mepAtt = msgRev.getAttribute(new QName(MEP));
- ((AxisConfigurationImpl)axisConfiguration).addMessageReceiver(
- mepAtt.getValue(),msgrecivere);
- }
-
- //processing Dispatching Order
- OMElement dispatch_order = config_element.getFirstChildWithName(
- new QName(DIPSTCH_ORDER));
- if(dispatch_order !=null){
- processDispatchingOrder(dispatch_order);
- log.info("found the custom disptaching order and continue with that order");
- } else {
- ((AxisConfigurationImpl)axisConfiguration).setDefaultDispatchers();
- log.info("no custom diaptching order found continue with default dispatcing order");
- }
-
-
- //Process Module refs
- Iterator moduleitr = config_element.getChildrenWithName(
- new QName(DeploymentConstants.MODULEST));
- processModuleRefs(moduleitr);
-
- // Proccessing Transport Sennders
- Iterator trs_senders = config_element.getChildrenWithName(new QName(TRANSPORTSENDER)) ;
- processTransportSenders(trs_senders);
-
- // Proccessing Transport Recivers
- Iterator trs_Reivers = config_element.getChildrenWithName(new QName(TRANSPORTRECEIVER)) ;
- processTransportReceivers(trs_Reivers);
-
- // Process Observers
- Iterator obs_ittr=config_element.getChildrenWithName(new QName(LISTENERST)) ;
- processObservers(obs_ittr);
-
- //processing Phase orders
- Iterator phaserders =config_element.getChildrenWithName(new QName(PHASE_ORDER)) ;
- processPhaseOrders(phaserders);
-
- //processing Axis Storages
- OMElement storages = config_element.getFirstChildWithName(new QName(AXIS_STORAGE)) ;
- processAxisStorage(storages);
-
- Iterator moduleConfigs = config_element.getChildrenWithName(new QName(MODULECONFIG));
- processModuleConfig(moduleConfigs,axisConfiguration,axisConfiguration);
-
-
- } catch (XMLStreamException e) {
- throw new DeploymentException(e);
- }
- }
-
-
- private void processDispatchingOrder(OMElement dispatch_order) throws DeploymentException {
- Iterator dispatchers = dispatch_order.getChildrenWithName(new QName(DIPSTCHER));
- boolean foundDiaptcher= false;
- Phase dispatchPhae = new Phase(PhaseMetadata.PHASE_DISPATCH);
- int count =0;
- while (dispatchers.hasNext()) {
- foundDiaptcher = true;
- OMElement dispchter = (OMElement) dispatchers.next();
- String clssName = dispchter.getAttribute(new QName(CLASSNAME)).getValue();
- AbstractDispatcher disptachClas;
- Class classInstance;
- try {
- classInstance = Class.forName(
- clssName,true,Thread.currentThread().getContextClassLoader());
- disptachClas =(AbstractDispatcher)classInstance.newInstance();
- disptachClas.initDispatcher();
- disptachClas.getHandlerDesc().setParent(axisConfiguration);
- dispatchPhae.addHandler(disptachClas, count);
- count ++;
- } catch (ClassNotFoundException e) {
- throw new DeploymentException(e);
- } catch (IllegalAccessException e) {
- throw new DeploymentException(e);
- } catch (InstantiationException e) {
- throw new DeploymentException(e);
- }
- }
-
- if(!foundDiaptcher){
- throw new DeploymentException("No dispatcher found , can not continue ....");
- } else {
- ((AxisConfigurationImpl)axisConfiguration).setDispatchPhase(dispatchPhae);
- }
-
- }
-
- private void processAxisStorage(OMElement storageElement) throws DeploymentException {
- AxisStorage axisStorage;
- if(storageElement !=null){
- OMAttribute className = storageElement.getAttribute(new QName(CLASSNAME));
- if(className== null){
- throw new DeploymentException("Invalid Storage Class defintion , class name missing");
- } else {
- String classNameStr =className.getValue();
- Class stoarge ;
- if (classNameStr != null &&!"".equals(classNameStr)) {
- try {
- stoarge = Class.forName(classNameStr,true,
- Thread.currentThread().getContextClassLoader());
- axisStorage = (AxisStorage) stoarge.newInstance();
- axisConfiguration.setAxisStorage(axisStorage);
-
- // adding storage paramters
- Iterator paramters = storageElement.getChildrenWithName(
- new QName(PARAMETERST));
- processParameters(paramters,axisStorage,axisConfiguration);
-
-
- } catch (ClassNotFoundException e) {
- throw new DeploymentException
- ("ClassNotFoundException in Axis Storage processing " + e);
- } catch (InstantiationException e) {
- throw new DeploymentException
- ("InstantiationException in Axis Storage processing " + e);
- } catch (IllegalAccessException e) {
- throw new DeploymentException
- ("IllegalAccessException in Axis Storage processing " + e);
- }
- } else {
- throw new DeploymentException("Invalid Storage Class defintion , class name missing");
- }
-
- }
-
- } else {
- try {
- //Default Storeg : org.apache.axis2.storage.impl.AxisMemoryStorage
- Class stoarge = Class.forName("org.apache.axis2.storage.impl.AxisMemoryStorage",true,
- Thread.currentThread().getContextClassLoader());
- axisStorage = (AxisStorage) stoarge.newInstance();
- axisConfiguration.setAxisStorage(axisStorage);
- }catch (ClassNotFoundException e) {
- throw new DeploymentException
- ("ClassNotFoundException in Axis Storage processing " + e);
- } catch (InstantiationException e) {
- throw new DeploymentException
- ("InstantiationException in Axis Storage processing " + e);
- } catch (IllegalAccessException e) {
- throw new DeploymentException
- ("IllegalAccessException in Axis Storage processing " + e);
- }
- }
-
- }
-
- /**
- * To process all the phase orders which are defined in axis2.xml
- * @param phaserders
- */
- private void processPhaseOrders(Iterator phaserders){
- PhasesInfo info = engine.getPhasesinfo();
- while (phaserders.hasNext()) {
- OMElement phaseOrders = (OMElement) phaserders.next();
- String flowType = phaseOrders.getAttribute(new QName(TYPE)).getValue();
- if(INFLOWST.equals(flowType)){
- info.setINPhases(getPhaseList(phaseOrders));
- } else if (IN_FAILTFLOW.equals(flowType)){
- info.setIN_FaultPhases(getPhaseList(phaseOrders));
- } else if (OUTFLOWST.equals(flowType)){
- info.setOUTPhases(getPhaseList(phaseOrders));
- } else if (OUT_FAILTFLOW.equals(flowType)){
- info.setOUT_FaultPhases(getPhaseList(phaseOrders));
- }
-
- }
- }
-
-
- private ArrayList getPhaseList(OMElement phaseOrders){
- ArrayList phaselist = new ArrayList();
- Iterator phases = phaseOrders.getChildrenWithName(new QName(PHASE));
- while (phases.hasNext()) {
- OMElement phase = (OMElement) phases.next();
- phaselist.add(phase.getAttribute(new QName(ATTNAME)).getValue());
- }
- return phaselist;
- }
-
-
- private void processTransportSenders(Iterator trs_senders) throws DeploymentException {
- while (trs_senders.hasNext()) {
- TransportOutDescription transportout;
- OMElement transport = (OMElement) trs_senders.next();
-
- // getting trsnport Name
- OMAttribute trsName = transport.getAttribute(
- new QName(ATTNAME));
- if(trsName !=null){
- String name = trsName.getValue();
- transportout = new TransportOutDescription(new QName(name));
-
- //tranport impl class
- OMAttribute trsClas = transport.getAttribute(
- new QName(CLASSNAME));
- if(trsClas == null){
- throw new DeploymentException("TransportSEnder Implementation class is required " +
- "for the transport" + name);
- }
- String clasName = trsClas.getValue();
- Class sender;
- try {
- sender =Class.forName(clasName,true,
- Thread.currentThread()
- .getContextClassLoader());
- TransportSender transportSender = (TransportSender) sender.newInstance();
- transportout.setSender(transportSender);
-
-
- //process Parameters
- //processing Paramters
- //Processing service level paramters
- Iterator itr = transport.getChildrenWithName(
- new QName(PARAMETERST));
- processParameters(itr,transportout,axisConfiguration);
-
- //process INFLOW
- OMElement inFlow = transport.getFirstChildWithName(
- new QName(INFLOWST));
- if(inFlow !=null){
- throw new DeploymentException(
- Messages.getMessage(
- DeploymentErrorMsgs.INFLOW_NOT_ALLOWED_IN_TRS_OUT, name));
- }
-
- OMElement outFlow = transport.getFirstChildWithName(
- new QName(OUTFLOWST));
- if(outFlow !=null){
- transportout.setOutFlow(processFlow(outFlow,axisConfiguration));
- }
-
- OMElement inFaultFlow = transport.getFirstChildWithName(
- new QName(IN_FAILTFLOW));
- if(inFaultFlow !=null){
- throw new DeploymentException(
- Messages.getMessage(
- DeploymentErrorMsgs.INFLOW_NOT_ALLOWED_IN_TRS_OUT, name));
- }
-
- OMElement outFaultFlow = transport.getFirstChildWithName(
- new QName(OUT_FAILTFLOW));
- if(outFaultFlow !=null){
- transportout.setFaultFlow(processFlow(outFaultFlow,axisConfiguration));
- }
-
- //adding to axis config
- axisConfiguration.addTransportOut(transportout);
-
- } catch (ClassNotFoundException e) {
- throw new DeploymentException(e);
- } catch (IllegalAccessException e) {
- throw new DeploymentException(e);
- } catch (InstantiationException e) {
- throw new DeploymentException(e);
- } catch (AxisFault axisFault) {
- throw new DeploymentException(axisFault);
- }
-
- }
- }
- }
-
-
- private void processTransportReceivers(Iterator trs_senders) throws DeploymentException {
- while (trs_senders.hasNext()) {
- TransportInDescription transportIN;
- OMElement transport = (OMElement) trs_senders.next();
-
- // getting trsnport Name
- OMAttribute trsName = transport.getAttribute(
- new QName(ATTNAME));
- if(trsName !=null){
- String name = trsName.getValue();
- transportIN = new TransportInDescription(new QName(name));
-
- //tranport impl class
- OMAttribute trsClas = transport.getAttribute(new QName(CLASSNAME));
- if(trsClas !=null) {
- try {
- String clasName = trsClas.getValue();
- Class receiverClass =Class.forName(clasName,true,
- Thread.currentThread()
- .getContextClassLoader());
- TransportListener receiver = (TransportListener) receiverClass.newInstance();
- transportIN.setReceiver(receiver);
- } catch (ClassNotFoundException e) {
- throw new DeploymentException(e);
- } catch (IllegalAccessException e) {
- throw new DeploymentException(e);
- } catch (InstantiationException e) {
- throw new DeploymentException(e);
- }
- }
- try {
-
- //process Parameters
- //processing Paramters
- //Processing service level paramters
- Iterator itr = transport.getChildrenWithName(
- new QName(PARAMETERST));
- processParameters(itr,transportIN,axisConfiguration);
-
- //process INFLOW
- OMElement inFlow = transport.getFirstChildWithName(
- new QName(INFLOWST));
- if(inFlow !=null){
- throw new DeploymentException(
- Messages.getMessage(
- DeploymentErrorMsgs.INFLOW_NOT_ALLOWED_IN_TRS_OUT, name));
- }
-
- OMElement outFlow = transport.getFirstChildWithName(
- new QName(OUTFLOWST));
- if(outFlow !=null){
- transportIN.setInFlow( processFlow(outFlow,axisConfiguration));
- }
-
- OMElement inFaultFlow = transport.getFirstChildWithName(
- new QName(IN_FAILTFLOW));
- if(inFaultFlow !=null){
- transportIN.setFaultFlow(processFlow(inFaultFlow,axisConfiguration));
- }
-
- OMElement outFaultFlow = transport.getFirstChildWithName(
- new QName(OUT_FAILTFLOW));
- if(outFaultFlow !=null){
- throw new DeploymentException(Messages.getMessage(
- DeploymentErrorMsgs.OUTFLOW_NOT_ALLOWED_IN_TRS_IN, name));
- }
-
- //adding to axis config
- axisConfiguration.addTransportIn(transportIN);
-
- } catch (AxisFault axisFault) {
- throw new DeploymentException(axisFault);
- }
-
- }
- }
- }
-
- /**
- * To process AxisObservers
- * @param oservers
- */
- private void processObservers(Iterator oservers) throws DeploymentException {
- while (oservers.hasNext()) {
- OMElement observerelement = (OMElement) oservers.next();
- AxisObserver observer;
- OMAttribute trsClas = observerelement.getAttribute(
- new QName(CLASSNAME));
- String clasName;
- if (trsClas !=null) {
- clasName = trsClas.getValue();
- } else {
- throw new DeploymentException("Observer Implementation Class is requird");
- }
- try {
- Class observerclass = Class.forName(clasName, true, Thread.currentThread().
- getContextClassLoader());
- observer = (AxisObserver) observerclass.newInstance();
- //processing Paramters
- //Processing service level paramters
- Iterator itr = observerelement.getChildrenWithName(
- new QName(PARAMETERST));
- processParameters(itr,observer,axisConfiguration);
-
- // initilization
- observer.init();
- ((AxisConfigurationImpl)axisConfiguration).addObservers(observer);
-
- } catch (ClassNotFoundException e) {
- throw new DeploymentException(e);
- } catch (IllegalAccessException e) {
- throw new DeploymentException(e);
- } catch (InstantiationException e) {
- throw new DeploymentException(e);
- }
- }
-
- }
-
- /**
- * To get the list og modules that is requird to be engage globally
- * @param moduleRefs <code>java.util.Iterator</code>
- */
- protected void processModuleRefs(Iterator moduleRefs) {
- while (moduleRefs.hasNext()) {
- OMElement moduleref = (OMElement) moduleRefs.next();
- OMAttribute moduleRefAttribute = moduleref.getAttribute(
- new QName(REF));
- String refName = moduleRefAttribute.getValue();
- engine.addModule(new QName(refName));
- }
- }
-
- protected void processModuleConfig(Iterator moduleConfigs ,
- ParameterInclude parent, AxisConfiguration config)
- throws DeploymentException {
- while (moduleConfigs.hasNext()) {
- OMElement moduleConfig = (OMElement) moduleConfigs.next();
- OMAttribute moduleName_att = moduleConfig.getAttribute(
- new QName(ATTNAME));
- if(moduleName_att == null){
- throw new DeploymentException("Invalid module configuration");
- } else {
- String module = moduleName_att.getValue();
- ModuleConfiguration moduleConfiguration =
- new ModuleConfiguration(new QName(module),parent);
- Iterator paramters= moduleConfig.getChildrenWithName(new QName(PARAMETERST));
- processParameters(paramters,moduleConfiguration,parent);
- ((AxisConfigurationImpl)config).addModuleConfig(moduleConfiguration);
- }
- }
- }
-
-}
+package org.apache.axis2.deployment;
+
+import org.apache.axis2.engine.*;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMAttribute;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.phaseresolver.PhaseMetadata;
+import org.apache.axis2.storage.AxisStorage;
+import org.apache.axis2.deployment.util.PhasesInfo;
+import org.apache.axis2.transport.TransportSender;
+import org.apache.axis2.transport.TransportListener;
+import org.apache.axis2.description.*;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.namespace.QName;
+import java.io.InputStream;
+import java.util.Iterator;
+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: Aug 26, 2005
+ * Time: 4:44:46 PM
+ */
+public class AxisConfigBuilder extends DescriptionBuilder{
+
+ private AxisConfiguration axisConfiguration;
+
+ public AxisConfigBuilder(InputStream serviceInputSteram, DeploymentEngine engine,
+ AxisConfiguration axisConfiguration) {
+ super(serviceInputSteram, engine);
+ this.axisConfiguration = axisConfiguration;
+ }
+
+ public void populateConfig() throws DeploymentException {
+ try {
+ OMElement config_element = buildOM();
+
+ //processing Paramters
+ //Processing service level paramters
+ Iterator itr = config_element.getChildrenWithName(
+ new QName(PARAMETERST));
+ processParameters(itr,axisConfiguration,axisConfiguration);
+
+ //process MessageReciver
+
+ Iterator msgRecives = config_element.getChildrenWithName(new QName(MESSAGERECEIVER));
+ while (msgRecives.hasNext()) {
+ OMElement msgRev = (OMElement) msgRecives.next();
+ MessageReceiver msgrecivere= loadMessageReceiver(
+ Thread.currentThread().getContextClassLoader(),msgRev);
+ OMAttribute mepAtt = msgRev.getAttribute(new QName(MEP));
+ ((AxisConfigurationImpl)axisConfiguration).addMessageReceiver(
+ mepAtt.getValue(),msgrecivere);
+ }
+
+ //processing Dispatching Order
+ OMElement dispatch_order = config_element.getFirstChildWithName(
+ new QName(DIPSTCH_ORDER));
+ if(dispatch_order !=null){
+ processDispatchingOrder(dispatch_order);
+ log.info("found the custom disptaching order and continue with that order");
+ } else {
+ ((AxisConfigurationImpl)axisConfiguration).setDefaultDispatchers();
+ log.info("no custom diaptching order found continue with default dispatcing order");
+ }
+
+
+ //Process Module refs
+ Iterator moduleitr = config_element.getChildrenWithName(
+ new QName(DeploymentConstants.MODULEST));
+ processModuleRefs(moduleitr);
+
+ // Proccessing Transport Sennders
+ Iterator trs_senders = config_element.getChildrenWithName(new QName(TRANSPORTSENDER)) ;
+ processTransportSenders(trs_senders);
+
+ // Proccessing Transport Recivers
+ Iterator trs_Reivers = config_element.getChildrenWithName(new QName(TRANSPORTRECEIVER)) ;
+ processTransportReceivers(trs_Reivers);
+
+ // Process Observers
+ Iterator obs_ittr=config_element.getChildrenWithName(new QName(LISTENERST)) ;
+ processObservers(obs_ittr);
+
+ //processing Phase orders
+ Iterator phaserders =config_element.getChildrenWithName(new QName(PHASE_ORDER)) ;
+ processPhaseOrders(phaserders);
+
+ //processing Axis Storages
+ OMElement storages = config_element.getFirstChildWithName(new QName(AXIS_STORAGE)) ;
+ processAxisStorage(storages);
+
+ Iterator moduleConfigs = config_element.getChildrenWithName(new QName(MODULECONFIG));
+ processModuleConfig(moduleConfigs,axisConfiguration,axisConfiguration);
+
+
+ } catch (XMLStreamException e) {
+ throw new DeploymentException(e);
+ }
+ }
+
+
+ private void processDispatchingOrder(OMElement dispatch_order) throws DeploymentException {
+ Iterator dispatchers = dispatch_order.getChildrenWithName(new QName(DIPSTCHER));
+ boolean foundDiaptcher= false;
+ Phase dispatchPhae = new Phase(PhaseMetadata.PHASE_DISPATCH);
+ int count =0;
+ while (dispatchers.hasNext()) {
+ foundDiaptcher = true;
+ OMElement dispchter = (OMElement) dispatchers.next();
+ String clssName = dispchter.getAttribute(new QName(CLASSNAME)).getValue();
+ AbstractDispatcher disptachClas;
+ Class classInstance;
+ try {
+ classInstance = Class.forName(
+ clssName,true,Thread.currentThread().getContextClassLoader());
+ disptachClas =(AbstractDispatcher)classInstance.newInstance();
+ disptachClas.initDispatcher();
+ disptachClas.getHandlerDesc().setParent(axisConfiguration);
+ dispatchPhae.addHandler(disptachClas, count);
+ count ++;
+ } catch (ClassNotFoundException e) {
+ throw new DeploymentException(e);
+ } catch (IllegalAccessException e) {
+ throw new DeploymentException(e);
+ } catch (InstantiationException e) {
+ throw new DeploymentException(e);
+ }
+ }
+
+ if(!foundDiaptcher){
+ throw new DeploymentException("No dispatcher found , can not continue ....");
+ } else {
+ ((AxisConfigurationImpl)axisConfiguration).setDispatchPhase(dispatchPhae);
+ }
+
+ }
+
+ private void processAxisStorage(OMElement storageElement) throws DeploymentException {
+ AxisStorage axisStorage;
+ if(storageElement !=null){
+ OMAttribute className = storageElement.getAttribute(new QName(CLASSNAME));
+ if(className== null){
+ throw new DeploymentException("Invalid Storage Class defintion , class name missing");
+ } else {
+ String classNameStr =className.getValue();
+ Class stoarge ;
+ if (classNameStr != null &&!"".equals(classNameStr)) {
+ try {
+ stoarge = Class.forName(classNameStr,true,
+ Thread.currentThread().getContextClassLoader());
+ axisStorage = (AxisStorage) stoarge.newInstance();
+ axisConfiguration.setAxisStorage(axisStorage);
+
+ // adding storage paramters
+ Iterator paramters = storageElement.getChildrenWithName(
+ new QName(PARAMETERST));
+ processParameters(paramters,axisStorage,axisConfiguration);
+
+
+ } catch (ClassNotFoundException e) {
+ throw new DeploymentException
+ ("ClassNotFoundException in Axis Storage processing " + e);
+ } catch (InstantiationException e) {
+ throw new DeploymentException
+ ("InstantiationException in Axis Storage processing " + e);
+ } catch (IllegalAccessException e) {
+ throw new DeploymentException
+ ("IllegalAccessException in Axis Storage processing " + e);
+ }
+ } else {
+ throw new DeploymentException("Invalid Storage Class defintion , class name missing");
+ }
+
+ }
+
+ } else {
+ try {
+ //Default Storeg : org.apache.axis2.storage.impl.AxisMemoryStorage
+ Class stoarge = Class.forName("org.apache.axis2.storage.impl.AxisMemoryStorage",true,
+ Thread.currentThread().getContextClassLoader());
+ axisStorage = (AxisStorage) stoarge.newInstance();
+ axisConfiguration.setAxisStorage(axisStorage);
+ }catch (ClassNotFoundException e) {
+ throw new DeploymentException
+ ("ClassNotFoundException in Axis Storage processing " + e);
+ } catch (InstantiationException e) {
+ throw new DeploymentException
+ ("InstantiationException in Axis Storage processing " + e);
+ } catch (IllegalAccessException e) {
+ throw new DeploymentException
+ ("IllegalAccessException in Axis Storage processing " + e);
+ }
+ }
+
+ }
+
+ /**
+ * To process all the phase orders which are defined in axis2.xml
+ * @param phaserders
+ */
+ private void processPhaseOrders(Iterator phaserders){
+ PhasesInfo info = engine.getPhasesinfo();
+ while (phaserders.hasNext()) {
+ OMElement phaseOrders = (OMElement) phaserders.next();
+ String flowType = phaseOrders.getAttribute(new QName(TYPE)).getValue();
+ if(INFLOWST.equals(flowType)){
+ info.setINPhases(getPhaseList(phaseOrders));
+ } else if (IN_FAILTFLOW.equals(flowType)){
+ info.setIN_FaultPhases(getPhaseList(phaseOrders));
+ } else if (OUTFLOWST.equals(flowType)){
+ info.setOUTPhases(getPhaseList(phaseOrders));
+ } else if (OUT_FAILTFLOW.equals(flowType)){
+ info.setOUT_FaultPhases(getPhaseList(phaseOrders));
+ }
+
+ }
+ }
+
+
+ private ArrayList getPhaseList(OMElement phaseOrders){
+ ArrayList phaselist = new ArrayList();
+ Iterator phases = phaseOrders.getChildrenWithName(new QName(PHASE));
+ while (phases.hasNext()) {
+ OMElement phase = (OMElement) phases.next();
+ phaselist.add(phase.getAttribute(new QName(ATTNAME)).getValue());
+ }
+ return phaselist;
+ }
+
+
+ private void processTransportSenders(Iterator trs_senders) throws DeploymentException {
+ while (trs_senders.hasNext()) {
+ TransportOutDescription transportout;
+ OMElement transport = (OMElement) trs_senders.next();
+
+ // getting trsnport Name
+ OMAttribute trsName = transport.getAttribute(
+ new QName(ATTNAME));
+ if(trsName !=null){
+ String name = trsName.getValue();
+ transportout = new TransportOutDescription(new QName(name));
+
+ //tranport impl class
+ OMAttribute trsClas = transport.getAttribute(
+ new QName(CLASSNAME));
+ if(trsClas == null){
+ throw new DeploymentException("TransportSEnder Implementation class is required " +
+ "for the transport" + name);
+ }
+ String clasName = trsClas.getValue();
+ Class sender;
+ try {
+ sender =Class.forName(clasName,true,
+ Thread.currentThread()
+ .getContextClassLoader());
+ TransportSender transportSender = (TransportSender) sender.newInstance();
+ transportout.setSender(transportSender);
+
+
+ //process Parameters
+ //processing Paramters
+ //Processing service level paramters
+ Iterator itr = transport.getChildrenWithName(
+ new QName(PARAMETERST));
+ processParameters(itr,transportout,axisConfiguration);
+
+ //process INFLOW
+ OMElement inFlow = transport.getFirstChildWithName(
+ new QName(INFLOWST));
+ if(inFlow !=null){
+ throw new DeploymentException(
+ Messages.getMessage(
+ DeploymentErrorMsgs.INFLOW_NOT_ALLOWED_IN_TRS_OUT, name));
+ }
+
+ OMElement outFlow = transport.getFirstChildWithName(
+ new QName(OUTFLOWST));
+ if(outFlow !=null){
+ transportout.setOutFlow(processFlow(outFlow,axisConfiguration));
+ }
+
+ OMElement inFaultFlow = transport.getFirstChildWithName(
+ new QName(IN_FAILTFLOW));
+ if(inFaultFlow !=null){
+ throw new DeploymentException(
+ Messages.getMessage(
+ DeploymentErrorMsgs.INFLOW_NOT_ALLOWED_IN_TRS_OUT, name));
+ }
+
+ OMElement outFaultFlow = transport.getFirstChildWithName(
+ new QName(OUT_FAILTFLOW));
+ if(outFaultFlow !=null){
+ transportout.setFaultFlow(processFlow(outFaultFlow,axisConfiguration));
+ }
+
+ //adding to axis config
+ axisConfiguration.addTransportOut(transportout);
+
+ } catch (ClassNotFoundException e) {
+ throw new DeploymentException(e);
+ } catch (IllegalAccessException e) {
+ throw new DeploymentException(e);
+ } catch (InstantiationException e) {
+ throw new DeploymentException(e);
+ } catch (AxisFault axisFault) {
+ throw new DeploymentException(axisFault);
+ }
+
+ }
+ }
+ }
+
+
+ private void processTransportReceivers(Iterator trs_senders) throws DeploymentException {
+ while (trs_senders.hasNext()) {
+ TransportInDescription transportIN;
+ OMElement transport = (OMElement) trs_senders.next();
+
+ // getting trsnport Name
+ OMAttribute trsName = transport.getAttribute(
+ new QName(ATTNAME));
+ if(trsName !=null){
+ String name = trsName.getValue();
+ transportIN = new TransportInDescription(new QName(name));
+
+ //tranport impl class
+ OMAttribute trsClas = transport.getAttribute(new QName(CLASSNAME));
+ if(trsClas !=null) {
+ try {
+ String clasName = trsClas.getValue();
+ Class receiverClass =Class.forName(clasName,true,
+ Thread.currentThread()
+ .getContextClassLoader());
+ TransportListener receiver = (TransportListener) receiverClass.newInstance();
+ transportIN.setReceiver(receiver);
+ } catch (ClassNotFoundException e) {
+ throw new DeploymentException(e);
+ } catch (IllegalAccessException e) {
+ throw new DeploymentException(e);
+ } catch (InstantiationException e) {
+ throw new DeploymentException(e);
+ }
+ }
+ try {
+
+ //process Parameters
+ //processing Paramters
+ //Processing service level paramters
+ Iterator itr = transport.getChildrenWithName(
+ new QName(PARAMETERST));
+ processParameters(itr,transportIN,axisConfiguration);
+
+ //process INFLOW
+ OMElement inFlow = transport.getFirstChildWithName(
+ new QName(INFLOWST));
+ if(inFlow !=null){
+ throw new DeploymentException(
+ Messages.getMessage(
+ DeploymentErrorMsgs.INFLOW_NOT_ALLOWED_IN_TRS_OUT, name));
+ }
+
+ OMElement outFlow = transport.getFirstChildWithName(
+ new QName(OUTFLOWST));
+ if(outFlow !=null){
+ transportIN.setInFlow( processFlow(outFlow,axisConfiguration));
+ }
+
+ OMElement inFaultFlow = transport.getFirstChildWithName(
+ new QName(IN_FAILTFLOW));
+ if(inFaultFlow !=null){
+ transportIN.setFaultFlow(processFlow(inFaultFlow,axisConfiguration));
+ }
+
+ OMElement outFaultFlow = transport.getFirstChildWithName(
+ new QName(OUT_FAILTFLOW));
+ if(outFaultFlow !=null){
+ throw new DeploymentException(Messages.getMessage(
+ DeploymentErrorMsgs.OUTFLOW_NOT_ALLOWED_IN_TRS_IN, name));
+ }
+
+ //adding to axis config
+ axisConfiguration.addTransportIn(transportIN);
+
+ } catch (AxisFault axisFault) {
+ throw new DeploymentException(axisFault);
+ }
+
+ }
+ }
+ }
+
+ /**
+ * To process AxisObservers
+ * @param oservers
+ */
+ private void processObservers(Iterator oservers) throws DeploymentException {
+ while (oservers.hasNext()) {
+ OMElement observerelement = (OMElement) oservers.next();
+ AxisObserver observer;
+ OMAttribute trsClas = observerelement.getAttribute(
+ new QName(CLASSNAME));
+ String clasName;
+ if (trsClas !=null) {
+ clasName = trsClas.getValue();
+ } else {
+ throw new DeploymentException("Observer Implementation Class is requird");
+ }
+ try {
+ Class observerclass = Class.forName(clasName, true, Thread.currentThread().
+ getContextClassLoader());
+ observer = (AxisObserver) observerclass.newInstance();
+ //processing Paramters
+ //Processing service level paramters
+ Iterator itr = observerelement.getChildrenWithName(
+ new QName(PARAMETERST));
+ processParameters(itr,observer,axisConfiguration);
+
+ // initilization
+ observer.init();
+ ((AxisConfigurationImpl)axisConfiguration).addObservers(observer);
+
+ } catch (ClassNotFoundException e) {
+ throw new DeploymentException(e);
+ } catch (IllegalAccessException e) {
+ throw new DeploymentException(e);
+ } catch (InstantiationException e) {
+ throw new DeploymentException(e);
+ }
+ }
+
+ }
+
+ /**
+ * To get the list og modules that is requird to be engage globally
+ * @param moduleRefs <code>java.util.Iterator</code>
+ */
+ protected void processModuleRefs(Iterator moduleRefs) {
+ while (moduleRefs.hasNext()) {
+ OMElement moduleref = (OMElement) moduleRefs.next();
+ OMAttribute moduleRefAttribute = moduleref.getAttribute(
+ new QName(REF));
+ String refName = moduleRefAttribute.getValue();
+ engine.addModule(new QName(refName));
+ }
+ }
+
+ protected void processModuleConfig(Iterator moduleConfigs ,
+ ParameterInclude parent, AxisConfiguration config)
+ throws DeploymentException {
+ while (moduleConfigs.hasNext()) {
+ OMElement moduleConfig = (OMElement) moduleConfigs.next();
+ OMAttribute moduleName_att = moduleConfig.getAttribute(
+ new QName(ATTNAME));
+ if(moduleName_att == null){
+ throw new DeploymentException("Invalid module configuration");
+ } else {
+ String module = moduleName_att.getValue();
+ ModuleConfiguration moduleConfiguration =
+ new ModuleConfiguration(new QName(module),parent);
+ Iterator paramters= moduleConfig.getChildrenWithName(new QName(PARAMETERST));
+ processParameters(paramters,moduleConfiguration,parent);
+ ((AxisConfigurationImpl)config).addModuleConfig(moduleConfiguration);
+ }
+ }
+ }
+
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisConfigBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentClassLoader.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentClassLoader.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentClassLoader.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentClassLoader.java Thu Sep 15 11:52:11 2005
@@ -1,197 +1,197 @@
-package org.apache.axis2.deployment;
-
-import org.apache.axis2.i18n.Messages;
-
-import java.io.*;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-/*
-* 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 11, 2005
- * Time: 1:07:03 PM
- */
-public class DeploymentClassLoader extends URLClassLoader {
-
- //urls which gives to create the classLoader
- private URL[] urls;
-
- //To keep jar files inside /lib directory in the main jar
- private ArrayList lib_jars_list;
-
- private HashMap loadedclass;
-
-
- /**
- * DeploymentClassLoader is exetend form URLClassLoader , and the constructor
- * has not overide the super constroctor , but has done some stuff to find out
- * jar fils inside /lib director
- *
- * @param urls <code>URL</code>
- * @param parent parent classloader <code>ClassLoader</code>
- */
- public DeploymentClassLoader(URL[] urls, ClassLoader parent) {
- super(urls, parent);
- this.urls = urls;
- lib_jars_list = new ArrayList();
- loadedclass = new HashMap();
- findLibJars();
- }
-
- /**
- * This just search for jar files inside /lib dirctory and if there are any then those
- * will be added to the arraylit (only the name of the jar file)
- */
- private void findLibJars() {
- /**
- * though the URL array can contains one or more urls , I have only consider the
- * first one , that is this classLoader is only for Axis2 stuff and the classloader
- * is created by Deployment , so there wont be any chance to have more the one urls for
- * the URL array list
- */
- File file = new File(urls[0].getFile());
- try {
- ZipInputStream zin = new ZipInputStream(new FileInputStream(file));
- ZipEntry entry;
- String entryName = "";
- while ((entry = zin.getNextEntry()) != null) {
- entryName = entry.getName();
- /**
- * id the entry name start with /lib and end with .jar
- * then those entry name will be added to the arraylist
- */
- if (entryName != null && (entryName.startsWith("lib/") ||
- entryName.startsWith("Lib/")) &&
- entryName.endsWith(".jar")) {
- lib_jars_list.add(entryName);
- }
- }
- zin.close();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * @param name <code>String</code> Name of the file to be loaded
- * @return <code>Class</code> return a class object if it found else
- * will return null or classNotfoun exeption
- * <p/>
- * The method has ovride in the following way
- * 1. called the super class and check to see wether the class is there
- * if the class is found then return that , else if super returns ClassNotfoundExeption
- * 2. Check wether the entry corresponding to the class name exsit in one of jar files
- * in /lib director
- * 3. If it is there get the byte array out of that and creat a Class object out of that
- * by calling "defineClass()" , if it sucssed then return that else
- * 4. Throw classNotfound exeption
- * @throws ClassNotFoundException
- */
- protected Class findClass(final String name)
- throws ClassNotFoundException {
- Class cla = null;
- try {
- cla = (Class)loadedclass.get(name);
- if(cla != null){
- return cla;
- }
- boolean foundClass = false;
- try {
- cla = super.findClass(name);
- foundClass = true;
- loadedclass.put(name, cla);
- return cla;
- } catch (ClassNotFoundException e) {
- foundClass = false;
- }
- if (!foundClass) {
- byte raw[] = getBytes(name);
- cla = defineClass(name, raw, 0, raw.length);
- loadedclass.put(name, cla);
- foundClass = true;
- return cla;
- }
- if (!foundClass) {
-// throw new ClassNotFoundException("Class Not found : " + name);
- throw new ClassNotFoundException(Messages.getMessage(
- DeploymentErrorMsgs.CLASS_NOT_FOUND, name));
- }
-
- } catch (Exception e) {
-
- }
- return null;
- }
-
- /**
- * Read jar file (/lib) one by one , then for each file craete <code>ZipInputStream</code>
- * that and check to see wether there is any entry eith given name if it found then
- * Creat ByteArrayOutPutStream and get the class bytes to that .
- * after goning throgh each and evry jar file if there is no entry with given name
- * will throug a ClassNotFound execption
- *
- * @param filename <code>String</code> Name of the file to be loaded (Class Name)
- * @return bytt[]
- * @throws java.io.IOException <code>Exception</code>
- */
- private byte[] getBytes(String filename) throws Exception {
- String completeFileName = filename;
- /**
- * Replacing org.apache. -> org/apache/...
- */
- completeFileName = completeFileName.replace('.', '/').concat(".class");
- byte raw[] = null;
- for (int i = 0; i < lib_jars_list.size(); i++) {
- String libjar_name = (String) lib_jars_list.get(i);
- InputStream in = this.getResourceAsStream(libjar_name);
- try {
- ZipInputStream zin = new ZipInputStream(in);
- ZipEntry entry;
- String entryName = "";
- while ((entry = zin.getNextEntry()) != null) {
- entryName = entry.getName();
- if (entryName != null &&
- entryName.endsWith(completeFileName)) {
- byte data[] = new byte[2048];
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- int count;
- while ((count = zin.read(data, 0, 2048)) != -1) {
- out.write(data, 0, count);
- }
- raw = out.toByteArray();
- out.close();
- zin.close();
- return raw;
- }
- }
- } catch (IOException e) {
- throw e;
- }
-
- }
- throw new ClassNotFoundException(Messages.getMessage(DeploymentErrorMsgs.CLASS_NOT_FOUND, filename));
- }
-}
-
+package org.apache.axis2.deployment;
+
+import org.apache.axis2.i18n.Messages;
+
+import java.io.*;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+/*
+* 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 11, 2005
+ * Time: 1:07:03 PM
+ */
+public class DeploymentClassLoader extends URLClassLoader {
+
+ //urls which gives to create the classLoader
+ private URL[] urls;
+
+ //To keep jar files inside /lib directory in the main jar
+ private ArrayList lib_jars_list;
+
+ private HashMap loadedclass;
+
+
+ /**
+ * DeploymentClassLoader is exetend form URLClassLoader , and the constructor
+ * has not overide the super constroctor , but has done some stuff to find out
+ * jar fils inside /lib director
+ *
+ * @param urls <code>URL</code>
+ * @param parent parent classloader <code>ClassLoader</code>
+ */
+ public DeploymentClassLoader(URL[] urls, ClassLoader parent) {
+ super(urls, parent);
+ this.urls = urls;
+ lib_jars_list = new ArrayList();
+ loadedclass = new HashMap();
+ findLibJars();
+ }
+
+ /**
+ * This just search for jar files inside /lib dirctory and if there are any then those
+ * will be added to the arraylit (only the name of the jar file)
+ */
+ private void findLibJars() {
+ /**
+ * though the URL array can contains one or more urls , I have only consider the
+ * first one , that is this classLoader is only for Axis2 stuff and the classloader
+ * is created by Deployment , so there wont be any chance to have more the one urls for
+ * the URL array list
+ */
+ File file = new File(urls[0].getFile());
+ try {
+ ZipInputStream zin = new ZipInputStream(new FileInputStream(file));
+ ZipEntry entry;
+ String entryName = "";
+ while ((entry = zin.getNextEntry()) != null) {
+ entryName = entry.getName();
+ /**
+ * id the entry name start with /lib and end with .jar
+ * then those entry name will be added to the arraylist
+ */
+ if (entryName != null && (entryName.startsWith("lib/") ||
+ entryName.startsWith("Lib/")) &&
+ entryName.endsWith(".jar")) {
+ lib_jars_list.add(entryName);
+ }
+ }
+ zin.close();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * @param name <code>String</code> Name of the file to be loaded
+ * @return <code>Class</code> return a class object if it found else
+ * will return null or classNotfoun exeption
+ * <p/>
+ * The method has ovride in the following way
+ * 1. called the super class and check to see wether the class is there
+ * if the class is found then return that , else if super returns ClassNotfoundExeption
+ * 2. Check wether the entry corresponding to the class name exsit in one of jar files
+ * in /lib director
+ * 3. If it is there get the byte array out of that and creat a Class object out of that
+ * by calling "defineClass()" , if it sucssed then return that else
+ * 4. Throw classNotfound exeption
+ * @throws ClassNotFoundException
+ */
+ protected Class findClass(final String name)
+ throws ClassNotFoundException {
+ Class cla = null;
+ try {
+ cla = (Class)loadedclass.get(name);
+ if(cla != null){
+ return cla;
+ }
+ boolean foundClass = false;
+ try {
+ cla = super.findClass(name);
+ foundClass = true;
+ loadedclass.put(name, cla);
+ return cla;
+ } catch (ClassNotFoundException e) {
+ foundClass = false;
+ }
+ if (!foundClass) {
+ byte raw[] = getBytes(name);
+ cla = defineClass(name, raw, 0, raw.length);
+ loadedclass.put(name, cla);
+ foundClass = true;
+ return cla;
+ }
+ if (!foundClass) {
+// throw new ClassNotFoundException("Class Not found : " + name);
+ throw new ClassNotFoundException(Messages.getMessage(
+ DeploymentErrorMsgs.CLASS_NOT_FOUND, name));
+ }
+
+ } catch (Exception e) {
+
+ }
+ return null;
+ }
+
+ /**
+ * Read jar file (/lib) one by one , then for each file craete <code>ZipInputStream</code>
+ * that and check to see wether there is any entry eith given name if it found then
+ * Creat ByteArrayOutPutStream and get the class bytes to that .
+ * after goning throgh each and evry jar file if there is no entry with given name
+ * will throug a ClassNotFound execption
+ *
+ * @param filename <code>String</code> Name of the file to be loaded (Class Name)
+ * @return bytt[]
+ * @throws java.io.IOException <code>Exception</code>
+ */
+ private byte[] getBytes(String filename) throws Exception {
+ String completeFileName = filename;
+ /**
+ * Replacing org.apache. -> org/apache/...
+ */
+ completeFileName = completeFileName.replace('.', '/').concat(".class");
+ byte raw[] = null;
+ for (int i = 0; i < lib_jars_list.size(); i++) {
+ String libjar_name = (String) lib_jars_list.get(i);
+ InputStream in = this.getResourceAsStream(libjar_name);
+ try {
+ ZipInputStream zin = new ZipInputStream(in);
+ ZipEntry entry;
+ String entryName = "";
+ while ((entry = zin.getNextEntry()) != null) {
+ entryName = entry.getName();
+ if (entryName != null &&
+ entryName.endsWith(completeFileName)) {
+ byte data[] = new byte[2048];
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ int count;
+ while ((count = zin.read(data, 0, 2048)) != -1) {
+ out.write(data, 0, count);
+ }
+ raw = out.toByteArray();
+ out.close();
+ zin.close();
+ return raw;
+ }
+ }
+ } catch (IOException e) {
+ throw e;
+ }
+
+ }
+ throw new ClassNotFoundException(Messages.getMessage(DeploymentErrorMsgs.CLASS_NOT_FOUND, filename));
+ }
+}
+
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentClassLoader.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentConstants.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentConstants.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentConstants.java Thu Sep 15 11:52:11 2005
@@ -1,99 +1,99 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.axis2.deployment;
-
-/**
- * DeployCons interface is to keep constent value required for Deployemnt
- */
-public interface DeploymentConstants {
- int SERVICE = 0; // if it is a servise
- int MODULE = 1; // if it is a module
-
- String META_INF ="META-INF";
- String SERVICEXML = "META-INF/service.xml";
- String SERVICEWSDL = "META-INF/service.wsdl";
- String MODULEXML = "META-INF/module.xml";
- String PARAMETERST = "parameter";// paramater start tag
- String LISTENERST = "listener";// paramater start tag
- String HANDERST = "handler";
- String MODULEST = "module";
- String MODULECONFIG = "moduleConfig";
- String PHASEST = "phase";
- String PHASE_ORDER = "phaseOrder";
- String TYPEMAPPINGST = "typeMapping";// typeMapping start tag
- String BEANMAPPINGST = "beanMapping";// beanMapping start tag
- String OPRATIONST = "operation";// operation start tag
- String INFLOWST = "inflow";// inflow start tag
- String OUTFLOWST = "outflow";// outflowr start tag
- String IN_FAILTFLOW = "INfaultflow";// faultflow start tag
- String OUT_FAILTFLOW = "Outfaultflow";// faultflow start tag
-
- // String FOLDE_NAME = "D:/Axis 2.0/projects/Deployement/test-data";
- String MODULE_PATH = "/modules/";
- String SERVICE_PATH = "/services/";
-
- // for jws file extension
- String JWS_EXTENSION = ".jws";
-
- String SERVICETAG = "service";
- String AXIS2CONFIG = "axisconfig";
-
- // for serviemetadat
- String STYLENAME = "style";
- String CONTEXTPATHNAME = "contextPath";
-
- // for parameters
- String ATTNAME = "name";
- String ATTLOCKED = "locked";
- String TYPE = "type";
-
- // for operatiins
- String ATQNAME = "name";
- String ATUSE = "use";
- String MEP = "mep";
-
- //for handlers
- String REF = "ref";
- String CLASSNAME = "class";
- String BEFORE = "before";
- String AFTER = "after";
- String PHASE = "phase";
- String PHASEFIRST = "phaseFirst";
- String PHASELAST = "phaseLast";
- String ORDER = "order"; // to resolve the order tag
- String DESCRIPTION = "description";
-
- String TRANSPORTSTAG = "transports";
- String TRANSPORTTAG = "transport";
- String TRANSPORTSENDER = "transportSender";
- String TRANSPORTRECEIVER = "transportReceiver";
-
- String MESSAGERECEIVER = "messageReceiver";
-
-
- String HOTDEPLOYMENT = "hotdeployment";
- String HOTUPDATE = "hotupdate";
- String EXTRACTSERVICEARCHIVE = "extractServiceArchive";
- String DIPSTCH_ORDER ="dispatchOrder";
- String DIPSTCHER ="dispatcher";
-
- String AXIS_STORAGE = "axisStorage";
-
- //element in a services.xml
- String SERVICE_ELEMENT ="service";
- String SERVICE_GROUP_ELEMENT ="serviceGroup";
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.deployment;
+
+/**
+ * DeployCons interface is to keep constent value required for Deployemnt
+ */
+public interface DeploymentConstants {
+ int SERVICE = 0; // if it is a servise
+ int MODULE = 1; // if it is a module
+
+ String META_INF ="META-INF";
+ String SERVICEXML = "META-INF/service.xml";
+ String SERVICEWSDL = "META-INF/service.wsdl";
+ String MODULEXML = "META-INF/module.xml";
+ String PARAMETERST = "parameter";// paramater start tag
+ String LISTENERST = "listener";// paramater start tag
+ String HANDERST = "handler";
+ String MODULEST = "module";
+ String MODULECONFIG = "moduleConfig";
+ String PHASEST = "phase";
+ String PHASE_ORDER = "phaseOrder";
+ String TYPEMAPPINGST = "typeMapping";// typeMapping start tag
+ String BEANMAPPINGST = "beanMapping";// beanMapping start tag
+ String OPRATIONST = "operation";// operation start tag
+ String INFLOWST = "inflow";// inflow start tag
+ String OUTFLOWST = "outflow";// outflowr start tag
+ String IN_FAILTFLOW = "INfaultflow";// faultflow start tag
+ String OUT_FAILTFLOW = "Outfaultflow";// faultflow start tag
+
+ // String FOLDE_NAME = "D:/Axis 2.0/projects/Deployement/test-data";
+ String MODULE_PATH = "/modules/";
+ String SERVICE_PATH = "/services/";
+
+ // for jws file extension
+ String JWS_EXTENSION = ".jws";
+
+ String SERVICETAG = "service";
+ String AXIS2CONFIG = "axisconfig";
+
+ // for serviemetadat
+ String STYLENAME = "style";
+ String CONTEXTPATHNAME = "contextPath";
+
+ // for parameters
+ String ATTNAME = "name";
+ String ATTLOCKED = "locked";
+ String TYPE = "type";
+
+ // for operatiins
+ String ATQNAME = "name";
+ String ATUSE = "use";
+ String MEP = "mep";
+
+ //for handlers
+ String REF = "ref";
+ String CLASSNAME = "class";
+ String BEFORE = "before";
+ String AFTER = "after";
+ String PHASE = "phase";
+ String PHASEFIRST = "phaseFirst";
+ String PHASELAST = "phaseLast";
+ String ORDER = "order"; // to resolve the order tag
+ String DESCRIPTION = "description";
+
+ String TRANSPORTSTAG = "transports";
+ String TRANSPORTTAG = "transport";
+ String TRANSPORTSENDER = "transportSender";
+ String TRANSPORTRECEIVER = "transportReceiver";
+
+ String MESSAGERECEIVER = "messageReceiver";
+
+
+ String HOTDEPLOYMENT = "hotdeployment";
+ String HOTUPDATE = "hotupdate";
+ String EXTRACTSERVICEARCHIVE = "extractServiceArchive";
+ String DIPSTCH_ORDER ="dispatchOrder";
+ String DIPSTCHER ="dispatcher";
+
+ String AXIS_STORAGE = "axisStorage";
+
+ //element in a services.xml
+ String SERVICE_ELEMENT ="service";
+ String SERVICE_GROUP_ELEMENT ="serviceGroup";
+}
Propchange: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentConstants.java
------------------------------------------------------------------------------
svn:eol-style = native