axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r357187 [5/25] - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: ./ addressing/ client/ client/async/ context/ deployment/ deployment/listener/ deployment/repository/util/ deployment/scheduler/ deployment/util/ descripti...
Date Fri, 16 Dec 2005 17:18:08 GMT
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=357187&r1=357186&r2=357187&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 Fri Dec 16 09:13:57 2005
@@ -1,25 +1,30 @@
 /*
- * 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.axis2.deployment;
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.deployment.util.Utils;
-import org.apache.axis2.description.*;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.description.ModuleConfiguration;
+import org.apache.axis2.description.ParameterInclude;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisObserver;
 import org.apache.axis2.engine.MessageReceiver;
@@ -39,7 +44,6 @@
 import java.util.Iterator;
 
 public class AxisConfigBuilder extends DescriptionBuilder {
-
     private AxisConfiguration axisConfiguration;
     private DeploymentEngine engine;
 
@@ -54,50 +58,57 @@
         try {
             OMElement config_element = buildOM();
 
-            //processing Parameters
-            //Processing service level parameters
-            Iterator itr = config_element.getChildrenWithName(
-                    new QName(PARAMETER));
-            processParameters(itr, axisConfiguration, axisConfiguration);
+            // processing Parameters
+            // Processing service level parameters
+            Iterator itr = config_element.getChildrenWithName(new QName(PARAMETER));
 
-            //process MessageReciver
+            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);
+                MessageReceiver msgrecivere =
+                        loadMessageReceiver(Thread.currentThread().getContextClassLoader(), msgRev);
                 OMAttribute mepAtt = msgRev.getAttribute(new QName(MEP));
-                axisConfiguration.addMessageReceiver(
-                        mepAtt.getAttributeValue(), msgrecivere);
+
+                axisConfiguration.addMessageReceiver(mepAtt.getAttributeValue(), msgrecivere);
             }
 
-            //Process Module refs
-            Iterator moduleitr = config_element.getChildrenWithName(
-                    new QName(DeploymentConstants.MODULEST));
+            // 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
+            // processing Phase orders
             Iterator phaserders = config_element.getChildrenWithName(new QName(PHASE_ORDER));
+
             processPhaseOrders(phaserders);
 
             Iterator moduleConfigs = config_element.getChildrenWithName(new QName(MODULECONFIG));
+
             processModuleConfig(moduleConfigs, axisConfiguration, axisConfiguration);
 
             // setting host configuration
             OMElement hostElement = config_element.getFirstChildWithName(new QName(HOST_CONFIG));
+
             if (hostElement != null) {
                 processHostCongiguration(hostElement, axisConfiguration);
             }
@@ -106,325 +117,351 @@
         }
     }
 
+    private void processHostCongiguration(OMElement element, AxisConfiguration config) {
+        OMElement ipele = element.getFirstChildWithName(new QName("ip"));
+        String ip = null;
+        int port = -1;
+
+        if (ipele != null) {
+            ip = ipele.getText().trim();
+        }
+
+        OMElement portele = element.getFirstChildWithName(new QName("port"));
+
+        if (portele != null) {
+            port = Integer.parseInt(portele.getText().trim());
+        }
+
+        HostConfiguration hostconfig = new HostConfiguration(ip, port);
+
+        config.setHostConfiguration(hostconfig);
+    }
+
+    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(
+                        Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE_CONFIG));
+            } else {
+                String module = moduleName_att.getAttributeValue();
+                ModuleConfiguration moduleConfiguration =
+                        new ModuleConfiguration(new QName(module), parent);
+                Iterator parameters = moduleConfig.getChildrenWithName(new QName(PARAMETER));
+
+                processParameters(parameters, moduleConfiguration, parent);
+                config.addModuleConfig(moduleConfiguration);
+            }
+        }
+    }
+
     /**
-     * To process all the phase orders which are defined in axis2.xml
+     * To get the list og modules that is requird to be engage globally
      *
-     * @param phaserders
+     * @param moduleRefs <code>java.util.Iterator</code>
      */
-    private void processPhaseOrders(Iterator phaserders) throws DeploymentException {
-        PhasesInfo info = engine.getPhasesinfo();
-        while (phaserders.hasNext()) {
-            OMElement phaseOrders = (OMElement) phaserders.next();
-            String flowType = phaseOrders.getAttribute(new QName(TYPE)).getAttributeValue();
-            if (INFLOWST.equals(flowType)) {
-                info.setINPhases(processPhaseList(phaseOrders));
-            } else if (IN_FAILTFLOW.equals(flowType)) {
-                info.setIN_FaultPhases(processPhaseList(phaseOrders));
-            } else if (OUTFLOWST.equals(flowType)) {
-                info.setOUTPhases(processPhaseList(phaseOrders));
-            } else if (OUT_FAILTFLOW.equals(flowType)) {
-                info.setOUT_FaultPhases(processPhaseList(phaseOrders));
+    protected void processModuleRefs(Iterator moduleRefs) {
+        while (moduleRefs.hasNext()) {
+            OMElement moduleref = (OMElement) moduleRefs.next();
+            OMAttribute moduleRefAttribute = moduleref.getAttribute(new QName(REF));
+            String refName = moduleRefAttribute.getAttributeValue();
+
+            engine.addModule(new QName(refName));
+        }
+    }
+
+    /**
+     * 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.getAttributeValue();
+            } else {
+                throw new DeploymentException(
+                        Messages.getMessage(DeploymentErrorMsgs.OBSERVER_ERROR));
             }
 
+            try {
+                Class observerclass = Class.forName(clasName, true,
+                        Thread.currentThread().getContextClassLoader());
+
+                observer = (AxisObserver) observerclass.newInstance();
+
+                // processing Parameters
+                // Processing service level parameters
+                Iterator itr = observerelement.getChildrenWithName(new QName(PARAMETER));
+
+                processParameters(itr, observer, axisConfiguration);
+
+                // initilization
+                observer.init();
+                axisConfiguration.addObservers(observer);
+            } catch (ClassNotFoundException e) {
+                throw new DeploymentException(e);
+            } catch (IllegalAccessException e) {
+                throw new DeploymentException(e);
+            } catch (InstantiationException e) {
+                throw new DeploymentException(e);
+            }
         }
     }
 
     private ArrayList processPhaseList(OMElement phaseOrders) throws DeploymentException {
         ArrayList phaselist = new ArrayList();
         Iterator phases = phaseOrders.getChildrenWithName(new QName(PHASE));
+
         while (phases.hasNext()) {
             OMElement phaseelement = (OMElement) phases.next();
-            String phaseName = phaseelement.getAttribute(new QName(ATTNAME)).getAttributeValue();
+            String phaseName =
+                    phaseelement.getAttribute(new QName(ATTNAME)).getAttributeValue();
             String phaseClass = phaseelement.getAttributeValue(new QName(CLASSNAME));
             Phase phase;
+
             try {
                 phase = getPhase(phaseClass);
             } catch (Exception e) {
                 throw new DeploymentException("Couldn't find phase class : " + phaseClass, e);
             }
+
             phase.setName(phaseName);
 
             Iterator handlers = phaseelement.getChildrenWithName(new QName(HANDERST));
+
             while (handlers.hasNext()) {
                 OMElement omElement = (OMElement) handlers.next();
                 HandlerDescription handler = processHandler(omElement, axisConfiguration);
+
                 handler.getRules().setPhaseName(phaseName);
                 Utils.loadHandler(axisConfiguration.getSystemClassLoader(), handler);
+
                 try {
                     phase.addHandler(handler);
                 } catch (PhaseException e) {
                     throw new DeploymentException(e);
                 }
             }
+
             phaselist.add(phase);
         }
+
         return phaselist;
     }
 
-    private Phase getPhase(String className)
-            throws ClassNotFoundException, IllegalAccessException, InstantiationException {
-        if (className == null) {
-            return new Phase();
+    /**
+     * To process all the phase orders which are defined in axis2.xml
+     *
+     * @param phaserders
+     */
+    private void processPhaseOrders(Iterator phaserders) throws DeploymentException {
+        PhasesInfo info = engine.getPhasesinfo();
+
+        while (phaserders.hasNext()) {
+            OMElement phaseOrders = (OMElement) phaserders.next();
+            String flowType = phaseOrders.getAttribute(new QName(TYPE)).getAttributeValue();
+
+            if (INFLOWST.equals(flowType)) {
+                info.setINPhases(processPhaseList(phaseOrders));
+            } else if (IN_FAILTFLOW.equals(flowType)) {
+                info.setIN_FaultPhases(processPhaseList(phaseOrders));
+            } else if (OUTFLOWST.equals(flowType)) {
+                info.setOUTPhases(processPhaseList(phaseOrders));
+            } else if (OUT_FAILTFLOW.equals(flowType)) {
+                info.setOUT_FaultPhases(processPhaseList(phaseOrders));
+            }
         }
-//        Class phaseClass = Class.forName(className);
-        Class phaseClass = axisConfiguration.getSystemClassLoader().loadClass(className);
-        return (Phase) phaseClass.newInstance();
     }
 
-    private void processTransportSenders(Iterator trs_senders) throws DeploymentException {
+    private void processTransportReceivers(Iterator trs_senders) throws DeploymentException {
         while (trs_senders.hasNext()) {
-            TransportOutDescription transportout;
+            TransportInDescription transportIN;
             OMElement transport = (OMElement) trs_senders.next();
 
             // getting trsnport Name
-            OMAttribute trsName = transport.getAttribute(
-                    new QName(ATTNAME));
+            OMAttribute trsName = transport.getAttribute(new QName(ATTNAME));
+
             if (trsName != null) {
                 String name = trsName.getAttributeValue();
-                transportout = new TransportOutDescription(new QName(name));
 
-                //tranport impl class
-                OMAttribute trsClas = transport.getAttribute(
-                        new QName(CLASSNAME));
-                if (trsClas == null) {
-                    throw new DeploymentException(Messages.getMessage(
-                            DeploymentErrorMsgs.TRANSPORT_SENDER_ERROR, name));
+                transportIN = new TransportInDescription(new QName(name));
+
+                // tranport impl class
+                OMAttribute trsClas = transport.getAttribute(new QName(CLASSNAME));
+
+                if (trsClas != null) {
+                    try {
+                        String clasName = trsClas.getAttributeValue();
+                        Class receiverClass = Class.forName(clasName, true,
+                                Thread.currentThread().getContextClassLoader());
+                        TransportListener receiver =
+                                (TransportListener) receiverClass.newInstance();
+
+                        transportIN.setReceiver(receiver);
+                    } catch (NoClassDefFoundError e) {
+                        log.info(Messages.getMessage("classnotfound", trsClas.getAttributeValue()));
+                    } catch (ClassNotFoundException e) {
+                        throw new DeploymentException(e);
+                    } catch (IllegalAccessException e) {
+                        throw new DeploymentException(e);
+                    } catch (InstantiationException e) {
+                        throw new DeploymentException(e);
+                    }
                 }
-                String clasName = trsClas.getAttributeValue();
-                Class sender;
+
                 try {
-                    sender = Class.forName(clasName, true,
-                            Thread.currentThread()
-                                    .getContextClassLoader());
-                    TransportSender transportSender = (TransportSender) sender.newInstance();
-                    transportout.setSender(transportSender);
 
-                    //process Parameters
-                    //processing Parameters
-                    //Processing service level parameters
-                    Iterator itr = transport.getChildrenWithName(
-                            new QName(PARAMETER));
-                    processParameters(itr, transportout, axisConfiguration);
+                    // process Parameters
+                    // processing Parameters
+                    // Processing service level parameters
+                    Iterator itr = transport.getChildrenWithName(new QName(PARAMETER));
+
+                    processParameters(itr, transportIN, axisConfiguration);
+
+                    // process INFLOW
+                    OMElement inFlow = transport.getFirstChildWithName(new QName(INFLOWST));
 
-                    //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));
+                    OMElement outFlow = transport.getFirstChildWithName(new QName(OUTFLOWST));
+
                     if (outFlow != null) {
-                        transportout.setOutFlow(processFlow(outFlow, axisConfiguration));
+                        transportIN.setInFlow(processFlow(outFlow, axisConfiguration));
                     }
 
-                    OMElement inFaultFlow = transport.getFirstChildWithName(
-                            new QName(IN_FAILTFLOW));
+                    OMElement inFaultFlow =
+                            transport.getFirstChildWithName(new QName(IN_FAILTFLOW));
+
                     if (inFaultFlow != null) {
-                        throw new DeploymentException(
-                                Messages.getMessage(
-                                        DeploymentErrorMsgs.INFLOW_NOT_ALLOWED_IN_TRS_OUT, name));
+                        transportIN.setFaultFlow(processFlow(inFaultFlow, axisConfiguration));
                     }
 
-                    OMElement outFaultFlow = transport.getFirstChildWithName(
-                            new QName(OUT_FAILTFLOW));
+                    OMElement outFaultFlow =
+                            transport.getFirstChildWithName(new QName(OUT_FAILTFLOW));
+
                     if (outFaultFlow != null) {
-                        transportout.setFaultFlow(processFlow(outFaultFlow, axisConfiguration));
+                        throw new DeploymentException(
+                                Messages.getMessage(
+                                        DeploymentErrorMsgs.OUTFLOW_NOT_ALLOWED_IN_TRS_IN, name));
                     }
 
-                    //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);
+                    // adding to axis config
+                    axisConfiguration.addTransportIn(transportIN);
                 } catch (AxisFault axisFault) {
                     throw new DeploymentException(axisFault);
                 }
-
             }
         }
     }
 
-
-    private void processTransportReceivers(Iterator trs_senders) throws DeploymentException {
+    private void processTransportSenders(Iterator trs_senders) throws DeploymentException {
         while (trs_senders.hasNext()) {
-            TransportInDescription transportIN;
+            TransportOutDescription transportout;
             OMElement transport = (OMElement) trs_senders.next();
 
             // getting trsnport Name
-            OMAttribute trsName = transport.getAttribute(
-                    new QName(ATTNAME));
+            OMAttribute trsName = transport.getAttribute(new QName(ATTNAME));
+
             if (trsName != null) {
                 String name = trsName.getAttributeValue();
-                transportIN = new TransportInDescription(new QName(name));
 
-                //tranport impl class
+                transportout = new TransportOutDescription(new QName(name));
+
+                // tranport impl class
                 OMAttribute trsClas = transport.getAttribute(new QName(CLASSNAME));
-                if (trsClas != null) {
-                    try {
-                        String clasName = trsClas.getAttributeValue();
-                        Class receiverClass = Class.forName(clasName, true,
-                                Thread.currentThread()
-                                        .getContextClassLoader());
-                        TransportListener receiver = (TransportListener) receiverClass.newInstance();
-                        transportIN.setReceiver(receiver);
-                    } catch (NoClassDefFoundError e) {
-                        log.info(Messages.getMessage("classnotfound", trsClas.getAttributeValue()));
-                    } catch (ClassNotFoundException e) {
-                        throw new DeploymentException(e);
-                    } catch (IllegalAccessException e) {
-                        throw new DeploymentException(e);
-                    } catch (InstantiationException e) {
-                        throw new DeploymentException(e);
-                    }
+
+                if (trsClas == null) {
+                    throw new DeploymentException(
+                            Messages.getMessage(DeploymentErrorMsgs.TRANSPORT_SENDER_ERROR, name));
                 }
+
+                String clasName = trsClas.getAttributeValue();
+                Class sender;
+
                 try {
+                    sender = Class.forName(clasName, true,
+                            Thread.currentThread().getContextClassLoader());
 
-                    //process Parameters
-                    //processing Parameters
-                    //Processing service level parameters
-                    Iterator itr = transport.getChildrenWithName(
-                            new QName(PARAMETER));
-                    processParameters(itr, transportIN, axisConfiguration);
+                    TransportSender transportSender = (TransportSender) sender.newInstance();
+
+                    transportout.setSender(transportSender);
+
+                    // process Parameters
+                    // processing Parameters
+                    // Processing service level parameters
+                    Iterator itr = transport.getChildrenWithName(new QName(PARAMETER));
+
+                    processParameters(itr, transportout, axisConfiguration);
+
+                    // process INFLOW
+                    OMElement inFlow = transport.getFirstChildWithName(new QName(INFLOWST));
 
-                    //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));
+                    OMElement outFlow = transport.getFirstChildWithName(new QName(OUTFLOWST));
+
                     if (outFlow != null) {
-                        transportIN.setInFlow(processFlow(outFlow, axisConfiguration));
+                        transportout.setOutFlow(processFlow(outFlow, axisConfiguration));
                     }
 
-                    OMElement inFaultFlow = transport.getFirstChildWithName(
-                            new QName(IN_FAILTFLOW));
+                    OMElement inFaultFlow =
+                            transport.getFirstChildWithName(new QName(IN_FAILTFLOW));
+
                     if (inFaultFlow != null) {
-                        transportIN.setFaultFlow(processFlow(inFaultFlow, axisConfiguration));
+                        throw new DeploymentException(
+                                Messages.getMessage(
+                                        DeploymentErrorMsgs.INFLOW_NOT_ALLOWED_IN_TRS_OUT, name));
                     }
 
-                    OMElement outFaultFlow = transport.getFirstChildWithName(
-                            new QName(OUT_FAILTFLOW));
+                    OMElement outFaultFlow =
+                            transport.getFirstChildWithName(new QName(OUT_FAILTFLOW));
+
                     if (outFaultFlow != null) {
-                        throw new DeploymentException(Messages.getMessage(
-                                DeploymentErrorMsgs.OUTFLOW_NOT_ALLOWED_IN_TRS_IN, name));
+                        transportout.setFaultFlow(processFlow(outFaultFlow, axisConfiguration));
                     }
 
-                    //adding to axis config
-                    axisConfiguration.addTransportIn(transportIN);
-
+                    // 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 processHostCongiguration(OMElement element, AxisConfiguration config) {
-        OMElement ipele = element.getFirstChildWithName(new QName("ip"));
-        String ip = null;
-        int port = -1;
-        if (ipele != null) {
-            ip = ipele.getText().trim();
-        }
-        OMElement portele = element.getFirstChildWithName(new QName("port"));
-        if (portele != null) {
-            port = Integer.parseInt(portele.getText().trim());
-        }
-        HostConfiguration hostconfig = new HostConfiguration(ip, port);
-        config.setHostConfiguration(hostconfig);
-    }
-
-    /**
-     * 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.getAttributeValue();
-            } else {
-                throw new DeploymentException(Messages.getMessage(
-                        DeploymentErrorMsgs.OBSERVER_ERROR));
-            }
-            try {
-                Class observerclass = Class.forName(clasName, true, Thread.currentThread().
-                        getContextClassLoader());
-                observer = (AxisObserver) observerclass.newInstance();
-                //processing Parameters
-                //Processing service level parameters
-                Iterator itr = observerelement.getChildrenWithName(
-                        new QName(PARAMETER));
-                processParameters(itr, observer, axisConfiguration);
-
-                // initilization
-                observer.init();
-                axisConfiguration.addObservers(observer);
-
-            } catch (ClassNotFoundException e) {
-                throw new DeploymentException(e);
-            } catch (IllegalAccessException e) {
-                throw new DeploymentException(e);
-            } catch (InstantiationException e) {
-                throw new DeploymentException(e);
-            }
+    private Phase getPhase(String className)
+            throws ClassNotFoundException, IllegalAccessException, InstantiationException {
+        if (className == null) {
+            return new Phase();
         }
 
-    }
-
-    /**
-     * 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.getAttributeValue();
-            engine.addModule(new QName(refName));
-        }
-    }
+//      Class phaseClass = Class.forName(className);
+        Class phaseClass = axisConfiguration.getSystemClassLoader().loadClass(className);
 
-    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(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE_CONFIG));
-            } else {
-                String module = moduleName_att.getAttributeValue();
-                ModuleConfiguration moduleConfiguration =
-                        new ModuleConfiguration(new QName(module), parent);
-                Iterator parameters = moduleConfig.getChildrenWithName(new QName(PARAMETER));
-                processParameters(parameters, moduleConfiguration, parent);
-                config.addModuleConfig(moduleConfiguration);
-            }
-        }
+        return (Phase) phaseClass.newInstance();
     }
-
 }

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=357187&r1=357186&r2=357187&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 Fri Dec 16 09:13:57 2005
@@ -1,24 +1,30 @@
 /*
- * 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.axis2.deployment;
 
 import org.apache.axis2.i18n.Messages;
 
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.ArrayList;
@@ -28,14 +34,12 @@
 
 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
+    // To keep jar files inside /lib directory in the main jar
     private ArrayList lib_jars_list;
-
     private HashMap loadedClass;
 
+    // urls which gives to create the classLoader
+    private URL[] urls;
 
     /**
      * DeploymentClassLoader is exetend form URLClassLoader , and the constructor
@@ -54,40 +58,6 @@
     }
 
     /**
-     * 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.toLowerCase().startsWith("lib/") &&
-                        entryName.toLowerCase().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
@@ -102,27 +72,34 @@
      *         4. Throw classNotfound exeption
      * @throws ClassNotFoundException
      */
-    protected Class findClass(final String name)
-            throws ClassNotFoundException {
+    protected Class findClass(final String name) throws ClassNotFoundException {
         Class cla;
+
         try {
             cla = (Class) loadedClass.get(name);
+
             if (cla != null) {
                 return cla;
             }
+
             boolean foundClass;
+
             try {
                 cla = super.findClass(name);
                 loadedClass.put(name, cla);
+
                 return cla;
             } catch (ClassNotFoundException e) {
                 foundClass = false;
             }
+
             if (!foundClass) {
                 try {
                     byte raw[] = getClassByteCodes(name);
+
                     cla = defineClass(name, raw, 0, raw.length);
                     loadedClass.put(name, cla);
+
                     return cla;
                 } catch (Exception e) {
                     foundClass = false;
@@ -130,45 +107,57 @@
                     foundClass = false;
                 }
             }
+
             if (!foundClass) {
-                throw new ClassNotFoundException(Messages.getMessage(
-                        DeploymentErrorMsgs.CLASS_NOT_FOUND, name));
+                throw new ClassNotFoundException(
+                        Messages.getMessage(DeploymentErrorMsgs.CLASS_NOT_FOUND, name));
             }
-
         } catch (Exception e) {
-            throw new ClassNotFoundException(Messages.getMessage(
-                    DeploymentErrorMsgs.CLASS_NOT_FOUND, name));
+            throw new ClassNotFoundException(
+                    Messages.getMessage(DeploymentErrorMsgs.CLASS_NOT_FOUND, name));
         }
+
         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>
+     * 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 byte[] getClassByteCodes(String filename) throws Exception {
-        String completeFileName = filename;
+    private void findLibJars() {
+
         /**
-         * Replacing org.apache. -> org/apache/...
+         * 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
          */
-        completeFileName = completeFileName.replace('.', '/').concat(".class");
-        byte [] byteCodes = getBytes(completeFileName);
-        if (byteCodes != null) {
-            return byteCodes;
-        } else {
-            throw new ClassNotFoundException(Messages.getMessage(
-                    DeploymentErrorMsgs.CLASS_NOT_FOUND, filename));
+        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.toLowerCase().startsWith("lib/")
+                        && entryName.toLowerCase().endsWith(".jar")) {
+                    lib_jars_list.add(entryName);
+                }
+            }
+
+            zin.close();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
         }
     }
 
-
     /**
      * 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
@@ -180,25 +169,32 @@
     private byte[] getBytes(String resourceName) {
         byte raw[];
         ZipInputStream zin = null;
+
         for (int i = 0; i < lib_jars_list.size(); i++) {
             String libjar_name = (String) lib_jars_list.get(i);
             InputStream in = getResourceAsStream(libjar_name);
+
             try {
                 zin = new ZipInputStream(in);
+
                 ZipEntry entry;
                 String entryName;
+
                 while ((entry = zin.getNextEntry()) != null) {
                     entryName = entry.getName();
-                    if (entryName != null &&
-                            entryName.endsWith(resourceName)) {
+
+                    if ((entryName != null) && entryName.endsWith(resourceName)) {
                         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();
+
                         return raw;
                     }
                 }
@@ -210,30 +206,63 @@
                         zin.close();
                     }
                 } catch (IOException e) {
-                    //what to do, better to log
+
+                    // what to do, better to log
                 }
             }
-
         }
+
         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[] getClassByteCodes(String filename) throws Exception {
+        String completeFileName = filename;
+
+        /**
+         * Replacing org.apache. -> org/apache/...
+         */
+        completeFileName = completeFileName.replace('.', '/').concat(".class");
+
+        byte[] byteCodes = getBytes(completeFileName);
+
+        if (byteCodes != null) {
+            return byteCodes;
+        } else {
+            throw new ClassNotFoundException(
+                    Messages.getMessage(DeploymentErrorMsgs.CLASS_NOT_FOUND, filename));
+        }
+    }
+
     /*
-    * This override locates resources similar to the way that getClassByteCodes() locates classes.
-    * We do not store the bytes from resources in memory, as
-    * the size of resources is generally unpredictable
-    *
-    * @param name
-    * @return inputstream
-    */
+     * This override locates resources similar to the way that getClassByteCodes() locates classes.
+     * We do not store the bytes from resources in memory, as
+     * the size of resources is generally unpredictable
+     *
+     * @param name
+     * @return inputstream
+     */
     public InputStream getResourceAsStream(String name) {
-        if (name == null)
+        if (name == null) {
             return null;
+        }
 
         InputStream is = super.getResourceAsStream(name);
-        //ohh , input stream is null , so need to check whether thats there in lib/*.jar
+
+        // ohh , input stream is null , so need to check whether thats there in lib/*.jar
         if (is == null) {
             byte data[] = getBytes(name);
+
             if (data == null) {
                 return null;
             } else {
@@ -244,4 +273,3 @@
         }
     }
 }
-

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=357187&r1=357186&r2=357187&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 Fri Dec 16 09:13:57 2005
@@ -1,18 +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.axis2.deployment;
 
@@ -20,82 +21,76 @@
  * 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
-
-    public static String META_INF ="META-INF";
-    String SERVICEXML = "META-INF/services.xml";
+    public static String META_INF = "META-INF";
     public static final String SERVICE_WSDL_NAME = "service.wsdl";
+    int SERVICE = 0;                // if it is a servise
+    int MODULE = 1;                // if it is a module
+    String SERVICEXML = "META-INF/services.xml";
     String SERVICE_WSDL_WITH_FOLDER = "META-INF/service.wsdl";
+    String PHASE_ORDER = "phaseOrder";
+    String PHASEST = "phase";
+    String PARAMETER = "parameter";      // paramater start tag
     String MODULEXML = "META-INF/module.xml";
-    String PARAMETER = "parameter";// paramater start tag
-    String LISTENERST = "listener";// paramater start tag
-    String HANDERST = "handler";
     String MODULEST = "module";
+    String MODULECONFIG = "moduleConfig";
     String MESSGES = "message";
+    String LISTENERST = "listener";       // paramater start tag
     String LABEL = "label";
-    String MODULECONFIG = "moduleConfig";
     String HOST_CONFIG = "hostConfiguration";
-    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 HANDERST = "handler";
+    String TYPEMAPPINGST = "typeMapping";    // typeMapping start tag
+    String TYPE = "type";
+    String TRANSPORTTAG = "transport";
+    String TRANSPORTSTAG = "transports";
+    String TRANSPORTSENDER = "transportSender";
+    String TRANSPORTRECEIVER = "transportReceiver";
+
+    // for serviemetadat
+    String STYLENAME = "style";
+    String SERVICE_PATH = "/services/";
+    String SERVICE_GROUP_ELEMENT = "serviceGroup";
+
+    // element in a services.xml
+    String SERVICE_ELEMENT = "service";
+    String SERVICETAG = "service";
+
+    // for handlers
+    String REF = "ref";
+    String PHASELAST = "phaseLast";
+    String PHASEFIRST = "phaseFirst";
+    String PHASE = "phase";
+    String OUT_FAILTFLOW = "Outfaultflow";    // faultflow start tag
+    String OUTFLOWST = "outflow";         // outflowr start tag
+    String ORDER = "order";           // to resolve the order tag
+    String OPRATIONST = "operation";       // operation start tag
 
     // String FOLDE_NAME = "D:/Axis 2.0/projects/Deployement/test-data";
     String MODULE_PATH = "/modules/";
-    String SERVICE_PATH = "/services/";
+    String MESSAGERECEIVER = "messageReceiver";
+    String MEP = "mep";
 
     // for jws file extension
     String JWS_EXTENSION = ".jws";
-
-    String SERVICETAG = "service";
-    String AXIS2CONFIG = "axisconfig";
-
-    // for serviemetadat
-    String STYLENAME = "style";
+    String IN_FAILTFLOW = "INfaultflow";    // faultflow start tag
+    String INFLOWST = "inflow";         // inflow start tag
+    String HOTUPDATE = "hotupdate";
+    String HOTDEPLOYMENT = "hotdeployment";
+    String EXTRACTSERVICEARCHIVE = "extractServiceArchive";
+    String DISPATCH_ORDER = "dispatchOrder";
+    String DISPATCHER = "dispatcher";
+    String DESCRIPTION = "description";
     String CONTEXTPATHNAME = "contextPath";
+    String CLASSNAME = "class";
+    String BEFORE = "before";
+    String BEANMAPPINGST = "beanMapping";    // beanMapping start tag
+    String AXIS2CONFIG = "axisconfig";
+    String ATUSE = "use";
 
     // 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 DISPATCH_ORDER ="dispatchOrder";
-    String DISPATCHER ="dispatcher";
-
-    //element in a services.xml
-    String SERVICE_ELEMENT ="service";
-    String SERVICE_GROUP_ELEMENT ="serviceGroup";
 }



Mime
View raw message