You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2005/04/07 07:18:41 UTC

svn commit: r160373 - in webservices/axis/trunk/java/modules: core/src/org/apache/axis/deployment/ core/src/org/apache/axis/deployment/repository/utill/ xml/src/org/apache/axis/om/ xml/src/org/apache/axis/om/impl/llom/ xml/src/org/apache/axis/om/impl/llom/traverse/

Author: chinthaka
Date: Wed Apr  6 22:18:38 2005
New Revision: 160373

URL: http://svn.apache.org/viewcvs?view=rev&rev=160373
Log:
- making some method refactoring in the deployment module
- removing OMNamedNode, as its no longer required
- adding seriliase(writer) method with populateYourSelf() method to OMNode and OMElement.

Removed:
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMNamedNode.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMNamedNodeImpl.java
Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/repository/utill/WSInfoList.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMElement.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMNode.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMNodeImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMStAXWrapper.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMTextImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/traverse/OMChildrenQNameIterator.java

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java?view=diff&r1=160372&r2=160373
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentEngine.java Wed Apr  6 22:18:38 2005
@@ -43,8 +43,8 @@
     private static Scheduler scheduler;
 
 
-    private boolean hotdeployment = true;   //to do hot deployment or not
-    private boolean hotupdate = true;  // to do hot update or not
+    private boolean hotDeployment = true;   //to do hot deployment or not
+    private boolean hotUpdate = true;  // to do hot update or not
 
 
     /**
@@ -69,7 +69,7 @@
 
     private String folderName;
 
-    private String serverconfigName;
+    private String serverConfigName;
 
     /**
      * This to keep a referance to serverMetaData object
@@ -139,12 +139,12 @@
 
             }
         }
-        this.serverconfigName = RepositaryName + '/' + serverXMLFile;
+        this.serverConfigName = RepositaryName + '/' + serverXMLFile;
     }
 
 //    public DeploymentEngine(String RepositaryName , String configFileName) {
 //        this.folderName = RepositaryName;
-//        this.serverconfigName = configFileName;
+//        this.serverConfigName = configFileName;
 //    }
 
     public HDFileItem getCurrentFileItem() {
@@ -169,10 +169,10 @@
      */
     public EngineRegistry start() throws AxisFault, DeploymentException, XMLStreamException {
         //String fileName;
-        if (serverconfigName == null) {
+        if (serverConfigName == null) {
             throw new DeploymentException("path to Server.xml can not be NUll");
         }
-        File tempfile = new File(serverconfigName);
+        File tempfile = new File(serverConfigName);
         try {
             InputStream in = new FileInputStream(tempfile);
             engineRegistry = createEngineRegistry();
@@ -182,7 +182,7 @@
             throw new AxisFault("Exception at deployment", e);
         }
         setDeploymentFeatures();
-        if (hotdeployment) {
+        if (hotDeployment) {
             startSearch(this);
         } else {
             new RepositoryListenerImpl(folderName, this);
@@ -197,7 +197,7 @@
     }
 
     /**
-     * To set hotdeployment and hot update
+     * To set hotDeployment and hot update
      */
     private void setDeploymentFeatures() {
         String value;
@@ -206,12 +206,12 @@
         if (parahotdeployment != null) {
             value = (String) parahotdeployment.getValue();
             if ("false".equals(value))
-                hotdeployment = false;
+                hotDeployment = false;
         }
         if (parahotupdate != null) {
             value = (String) parahotupdate.getValue();
             if ("false".equals(value))
-                hotupdate = false;
+                hotUpdate = false;
 
         }
     }
@@ -260,7 +260,7 @@
 
     private void addnewService(AxisService serviceMetaData) throws AxisFault, PhaseException {
         currentFileItem.setClassLoader();
-        serviceMetaData = getRunnerbleService(serviceMetaData);
+        serviceMetaData = getRunnableService(serviceMetaData);
         engineRegistry.addService(serviceMetaData);
         Parameter para = serviceMetaData.getParameter("OUTSERVICE");
         if (para != null) {
@@ -289,7 +289,7 @@
      * @throws AxisFault
      * @throws PhaseException
      */
-    private AxisService getRunnerbleService(AxisService serviceMetaData) throws AxisFault, PhaseException {
+    private AxisService getRunnableService(AxisService serviceMetaData) throws AxisFault, PhaseException {
         loadServiceClass(serviceMetaData);
         Flow inflow = serviceMetaData.getInFlow();
         if (inflow != null) {
@@ -458,7 +458,7 @@
         wsToDeploy.clear();
     }
 
-    public void doUnDeploye() {
+    public void unDeploy() {
         //todo complete this
         String serviceName = "";
         try {
@@ -480,8 +480,8 @@
         wsToUnDeploy.clear();
     }
 
-    public boolean isHotupdate() {
-        return hotupdate;
+    public boolean isHotUpdate() {
+        return hotUpdate;
     }
 
     /**
@@ -510,7 +510,7 @@
             service = new AxisService();
             DeploymentParser schme = new DeploymentParser(serviceStream, this, "");
             schme.parseServiceXML(service);
-            service = getRunnerbleService(service);
+            service = getRunnableService(service);
         } catch (XMLStreamException e) {
             throw  new DeploymentException(e.getMessage());
         } catch (PhaseException e) {

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/repository/utill/WSInfoList.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/repository/utill/WSInfoList.java?view=diff&r1=160372&r2=160373
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/repository/utill/WSInfoList.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/repository/utill/WSInfoList.java Wed Apr  6 22:18:38 2005
@@ -76,7 +76,7 @@
                         HDFileItem hdFileItem = new HDFileItem(file, SERVICE);
                         deplorer.addtowsToDeploy(hdFileItem);//to inform that new web service is deployed
                     } else {
-                        if (deplorer.isHotupdate()) {
+                        if (deplorer.isHotUpdate()) {
                             WSInfo tempWSInfo = getFileItem(file.getName());
                             if (isModified(file, tempWSInfo)) {  // caheck whether file is updated
                                 tempWSInfo.setLastmodifieddate(file.lastModified());
@@ -98,7 +98,7 @@
                         HDFileItem hdFileItem = new HDFileItem(file, MODULE);
                         deplorer.addtowsToDeploy(hdFileItem);//to inform that new web service is deployed
                     } else {
-                        if (deplorer.isHotupdate()) {
+                        if (deplorer.isHotUpdate()) {
                             WSInfo tempWSInfo = getFileItem(file.getName());
                             if (isModified(file, tempWSInfo)) {
                                 tempWSInfo.setLastmodifieddate(file.lastModified());
@@ -207,8 +207,8 @@
      */
     public void update() {
         checkForUndeploye();
-        if (deplorer.isHotupdate()) {
-            deplorer.doUnDeploye();
+        if (deplorer.isHotUpdate()) {
+            deplorer.unDeploy();
         }
         deplorer.doDeploy();
 

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMElement.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMElement.java?view=diff&r1=160372&r2=160373
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMElement.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMElement.java Wed Apr  6 22:18:38 2005
@@ -22,7 +22,7 @@
 /**
  * Interface OMElement
  */
-public interface OMElement extends OMNamedNode {
+public interface OMElement extends OMNode {
     /**
      * This will add child to the element. One must preserve the order of children, in this operation
      * Tip : appending the new child is prefered
@@ -207,5 +207,48 @@
      */
     public String getText();
 
+    /**
+     * Method getLocalName
+     *
+     * @return
+     */
+    public String getLocalName();
+
+    /**
+     * Method setLocalName
+     *
+     * @param localName
+     */
+    public void setLocalName(String localName);
 
+    /**
+     * Method getNamespace
+     *
+     * @return
+     * @throws OMException
+     */
+    public OMNamespace getNamespace() throws OMException;
+
+    /**
+     * Method getNamespaceName
+     *
+     * @return
+     */
+    public String getNamespaceName();
+
+    /**
+     * Method setNamespace
+     *
+     * @param namespace
+     */
+    public void setNamespace(OMNamespace namespace);
+
+    public QName getQName();
+
+
+    /**
+     * This will completely parse this node and build the object structure in the memory
+     * @throws OMException
+     */
+    public void populateYourSelf() throws OMException ;
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMNode.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMNode.java?view=diff&r1=160372&r2=160373
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMNode.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/OMNode.java Wed Apr  6 22:18:38 2005
@@ -177,4 +177,8 @@
      */
     public void serialize(XMLStreamWriter writer, boolean cache)
             throws XMLStreamException;
+
+    public void serialize(XMLStreamWriter writer)
+            throws XMLStreamException;
+
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java?view=diff&r1=160372&r2=160373
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java Wed Apr  6 22:18:38 2005
@@ -33,8 +33,15 @@
 /**
  * Class OMElementImpl
  */
-public class OMElementImpl extends OMNamedNodeImpl
+public class OMElementImpl extends OMNodeImpl
         implements OMElement, OMConstants {
+
+    protected OMNamespace ns;
+
+    /**
+     * Field localName
+     */
+    protected String localName;
     /**
      * Field firstChild
      */
@@ -75,7 +82,8 @@
      */
     public OMElementImpl(String localName, OMNamespace ns, OMElement parent,
                          OMXMLParserWrapper builder) {
-        super(localName, null, parent);
+        super(parent);
+        this.localName = localName;
         if (ns != null) {
             setNamespace(handleNamespace(ns));
         }
@@ -99,7 +107,8 @@
      * @param ns
      */
     public OMElementImpl(String localName, OMNamespace ns) {
-        super(localName, null, null);
+        super(null);
+        this.localName = localName;
         this.done = true;
         if (ns != null) {
             setNamespace(handleNamespace(ns));
@@ -114,7 +123,8 @@
      * @throws OMException
      */
     public OMElementImpl(QName qname, OMElement parent) throws OMException {
-        super(qname.getLocalPart(), null, parent);
+        super(parent);
+        this.localName = qname.getLocalPart();
         this.done = true;
         handleNamespace(qname, parent);
     }
@@ -665,6 +675,19 @@
     }
 
     /**
+     * This was requested during the second Axis2 summit. When one call this method, this will
+     * serialise without building the object structure in the memory. Misuse of this method will cause loss of data.
+     * So its adviced to use populateYourSelf() method, before this, if you want to preserve data in the stream.
+     * @param writer
+     * @throws XMLStreamException
+     */
+    public void serialize(XMLStreamWriter writer) throws XMLStreamException {
+        this.serialize(writer, false);
+    }
+
+
+
+    /**
      * Method serializeStartpart
      *
      * @param writer
@@ -840,8 +863,84 @@
         return null;
     }
 
+
+    /**
+     * Method getLocalName
+     *
+     * @return
+     */
+    public String getLocalName() {
+        return localName;
+    }
+
+    /**
+     * Method setLocalName
+     *
+     * @param localName
+     */
+    public void setLocalName(String localName) {
+        this.localName = localName;
+    }
+
+    /**
+     * Method getNamespace
+     *
+     * @return
+     * @throws OMException
+     */
+    public OMNamespace getNamespace() throws OMException {
+        if ((ns == null) && (parent != null)) {
+            ns = parent.getNamespace();
+        }
+        if (ns == null) {
+            throw new OMException("all elements in a soap message must be namespace qualified");
+        }
+        return ns;
+    }
+
+    /**
+     * Method getNamespaceName
+     *
+     * @return
+     */
+    public String getNamespaceName() {
+        if (ns != null) {
+            return ns.getName();
+        }
+        return null;
+    }
+
+    /**
+     * @param namespace
+     */
+    public void setNamespace(OMNamespace namespace) {
+        this.ns = namespace;
+    }
+
+    /**
+     * Method getQName
+     *
+     * @return
+     */
     public QName getQName() {
-        return super.getQName();    //To change body of overridden methods use File | Settings | File Templates.
+        QName qName = null;
+
+        if (ns != null) {
+            qName = new QName(ns.getName(), localName, ns.getPrefix());
+        }else{
+            qName = new QName(localName);
+        }
+        return qName;
+    }
+
+    /**
+     * This will completely parse this node and build the object structure in the memory
+     * @throws OMException
+     */
+    public void populateYourSelf() throws OMException {
+        while(!done){
+            builder.next();
+        }
     }
 
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMNodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMNodeImpl.java?view=diff&r1=160372&r2=160373
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMNodeImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMNodeImpl.java Wed Apr  6 22:18:38 2005
@@ -289,6 +289,7 @@
      * @param cache
      * @throws XMLStreamException
      */
-    public abstract void serialize(XMLStreamWriter writer, boolean cache)
-            throws XMLStreamException ;
+
+
+
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMStAXWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMStAXWrapper.java?view=diff&r1=160372&r2=160373
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMStAXWrapper.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMStAXWrapper.java Wed Apr  6 22:18:38 2005
@@ -17,7 +17,6 @@
 
 import org.apache.axis.om.OMAttribute;
 import org.apache.axis.om.OMElement;
-import org.apache.axis.om.OMNamedNode;
 import org.apache.axis.om.OMNamespace;
 import org.apache.axis.om.OMNode;
 import org.apache.axis.om.OMText;
@@ -272,7 +271,7 @@
         } else {
             if ((currentEvent == START_ELEMENT)
                     || (currentEvent == END_ELEMENT)) {
-                returnName = getQName((OMNamedNode) lastNode);
+                returnName = getQName((OMElement) lastNode);
             }
         }
         return returnName;
@@ -1129,13 +1128,13 @@
     /**
      * Helper method
      *
-     * @param namedNode
+     * @param element
      * @return
      */
-    private QName getQName(OMNamedNode namedNode) {
+    private QName getQName(OMElement element) {
         QName returnName;
-        OMNamespace ns = namedNode.getNamespace();
-        String localPart = namedNode.getLocalName();
+        OMNamespace ns = element.getNamespace();
+        String localPart = element.getLocalName();
         if (ns != null) {
             String prefix = ns.getPrefix();
             String uri = ns.getName();

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMTextImpl.java?view=diff&r1=160372&r2=160373
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMTextImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMTextImpl.java Wed Apr  6 22:18:38 2005
@@ -127,4 +127,8 @@
             nextSibling.serialize(writer, cache);
         }
     }
+
+    public void serialize(XMLStreamWriter writer) throws XMLStreamException {
+        this.serialize(writer, false);
+    }
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/traverse/OMChildrenQNameIterator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/traverse/OMChildrenQNameIterator.java?view=diff&r1=160372&r2=160373
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/traverse/OMChildrenQNameIterator.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/traverse/OMChildrenQNameIterator.java Wed Apr  6 22:18:38 2005
@@ -16,7 +16,7 @@
 package org.apache.axis.om.impl.llom.traverse;
 
 import org.apache.axis.om.OMNode;
-import org.apache.axis.om.impl.llom.OMNamedNodeImpl;
+import org.apache.axis.om.impl.llom.OMElementImpl;
 
 import javax.xml.namespace.QName;
 
@@ -62,9 +62,9 @@
             if (currentChild != null) {
 
                 // check the current node for the criteria
-                if ((currentChild instanceof OMNamedNodeImpl)
+                if ((currentChild instanceof OMElementImpl)
                         && (isQNamesMatch(
-                                   ((OMNamedNodeImpl) currentChild).getQName(),
+                                   ((OMElementImpl) currentChild).getQName(),
                                    this.givenQName))) {
                     isMatchingNodeFound = true;
                     needToMoveForward = false;