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 Sanjiva Weerawarana <sa...@opensource.lk> on 2005/05/03 18:03:33 UTC

Re: svn commit: r167898 - /webservices/axis/trunk/java/modules/core/samples/deployment /webservices/axis/trunk/java/modules/core/samples/deployment/service1/META-INF /webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment /webservices/axis/trunk/java/modules/core/src/org/apache/axis/description /webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver

Hi Deepal,

It should be:
	<messageReceiver mep="xsd:anyURI" impl="xsd:string"/>

(Not @map ..)

Sanjiva.

On Tue, 2005-05-03 at 11:43 +0000, deepal@apache.org wrote:
> Author: deepal
> Date: Tue May  3 04:42:46 2005
> New Revision: 167898
> 
> URL: http://svn.apache.org/viewcvs?rev=167898&view=rev
> Log:
> Deployment refactoring , introducing MEP based messageRecievers . Build might faild will fix soon :)
> 
> Modified:
>     webservices/axis/trunk/java/modules/core/samples/deployment/server.xml
>     webservices/axis/trunk/java/modules/core/samples/deployment/service1/META-INF/service.xml
>     webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentConstants.java
>     webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java
>     webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/server.xml
>     webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisGlobal.java
>     webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisOperation.java
>     webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java
> 
> Modified: webservices/axis/trunk/java/modules/core/samples/deployment/server.xml
> URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/samples/deployment/server.xml?rev=167898&r1=167897&r2=167898&view=diff
> ==============================================================================
> --- webservices/axis/trunk/java/modules/core/samples/deployment/server.xml (original)
> +++ webservices/axis/trunk/java/modules/core/samples/deployment/server.xml Tue May  3 04:42:46 2005
> @@ -1,4 +1,6 @@
>  <server name ="AxisJava2.0" >
> +    <messageReciver map="name"  impl="abcs"/>
> +
>      <phaseOrder type="inflow">
>          <phase name="global"/>
>          <phase name="transport"/>
> 
> Modified: webservices/axis/trunk/java/modules/core/samples/deployment/service1/META-INF/service.xml
> URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/samples/deployment/service1/META-INF/service.xml?rev=167898&r1=167897&r2=167898&view=diff
> ==============================================================================
> --- webservices/axis/trunk/java/modules/core/samples/deployment/service1/META-INF/service.xml (original)
> +++ webservices/axis/trunk/java/modules/core/samples/deployment/service1/META-INF/service.xml Tue May  3 04:42:46 2005
> @@ -1,4 +1,4 @@
> -<service messageReceiver="org.apache.axis.receivers.RawXMLINOutMessageRecevier" style="rpc" contextPath="services">
> +<service name="">
>  
>      <parameter name="ServiceClass" locked="xsd:false">org.apache.axis.sample.echo.EchoImpl</parameter>
>  
> @@ -16,7 +16,10 @@
>          <handler name="logging2" class="org.apache.axis.sample.handlers.LoggingHandler"/>
>      </Outfaultflow>
>  
> -    <operation name="echoString"/>
> +    <operation name="echoString">
> +        <module ref="module1"/>
> +        <messageReceiver class="org.apache.axis.receivers.RawXMLINOutMessageRecevier"/>
> +    </operation>
>      <operation name="echoStringArray"/>
>      <operation name="echoEchoStruct"/>
>      <operation name="echoEchoStructArray"/>
> 
> Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentConstants.java
> URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentConstants.java?rev=167898&r1=167897&r2=167898&view=diff
> ==============================================================================
> --- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentConstants.java (original)
> +++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentConstants.java Tue May  3 04:42:46 2005
> @@ -61,6 +61,7 @@
>      // for operatiins
>      String ATQNAME = "name";
>      String ATUSE = "use";
> +    String MEP = "mep";
>  
>      //for handlers
>      String REF = "ref";
> 
> Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java
> URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java?rev=167898&r1=167897&r2=167898&view=diff
> ==============================================================================
> --- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java (original)
> +++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/DeploymentParser.java Tue May  3 04:42:46 2005
> @@ -38,6 +38,7 @@
>  import org.apache.axis.description.ParameterImpl;
>  import org.apache.axis.engine.AxisFault;
>  import org.apache.axis.engine.EngineConfigurationImpl;
> +import org.apache.axis.engine.MessageReceiver;
>  import org.apache.axis.transport.TransportReceiver;
>  import org.apache.axis.transport.TransportSender;
>  
> @@ -88,7 +89,6 @@
>                      String ST = pullparser.getLocalName();
>                      if (ST.equals(SERVICEXMLST)) {
>                          procesServiceXML(axisService);
> -                        axisService.setName(new QName(getAxisServiceName(dpengine.getCurrentFileItem().getServiceName())));
>                      }
>                      break;
>                  }
> @@ -125,6 +125,37 @@
>                          dpengine.getEngineconfig().addTransportIn(transportin);
>                      } else if (TYPEMAPPINGST.equals(ST)) {
>                          throw new UnsupportedOperationException("Type Mappings are not allowed in server.xml");
> +                    } else if (MEP.equals(ST)){
> +                        int attribCount = pullparser.getAttributeCount();
> +                        if (attribCount == 2) {
> +                            String attname = pullparser.getAttributeLocalName(1);
> +                            String attvalue = pullparser.getAttributeValue(1);
> +                            if(MEP.equals(attname)){
> +                                String name = attvalue;
> +                                attname = pullparser.getAttributeLocalName(2);
> +                                attvalue = pullparser.getAttributeValue(2);
> +                                if(CLASSNAME.equals(attname)){
> +                                    try {
> +                                        Class messageReceiver = null;
> +                                        ClassLoader loader1 = Thread.currentThread().getContextClassLoader();
> +                                        if (attvalue != null && !"".equals(attvalue)) {
> +                                            messageReceiver = Class.forName(attvalue, true, loader1);
> +                                            axisGlobal.addMessageReceiver(name,(MessageReceiver)messageReceiver.newInstance());
> +                                        }
> +                                    } catch (ClassNotFoundException e) {
> +                                        throw new DeploymentException("Error in loading messageRecivers " + e.getMessage());
> +                                    } catch (IllegalAccessException e) {
> +                                        throw new DeploymentException("Error in loading messageRecivers " + e.getMessage());
> +                                    } catch (InstantiationException e) {
> +                                        throw new DeploymentException("Error in loading messageRecivers " + e.getMessage());
> +                                    }
> +                                }  else
> +                                    throw new UnsupportedOperationException("invalid attributes in server.xml (messageReceiver elemet) " + attname);
> +                            }  else
> +                                throw new UnsupportedOperationException("invalid attributes in server.xml (messageReceiver elemet) " + attname);
> +                        }else
> +                            throw new UnsupportedOperationException("invalid attributes in server.xml (messageReceiver elemet)");
> +
>                      } else if (MODULEST.equals(ST)) {
>                          int attribCount = pullparser.getAttributeCount();
>                          if (attribCount > 0) {
> @@ -309,33 +340,23 @@
>       */
>      private void procesServiceXML(AxisService axisService) throws DeploymentException {
>          int attribCount = pullparser.getAttributeCount();
> -        boolean foundMR = false;
>          if (attribCount >= 1) {
>              for (int i = 0; i < attribCount; i++) {
>                  String attname = pullparser.getAttributeLocalName(i);
>                  String attvalue = pullparser.getAttributeValue(i);
> -                if (MESSAGERECEIVER.equals(attname)) {
> -                    dpengine.getCurrentFileItem().setMessgeReceiver(attvalue);
> -                    foundMR = true;
> -                } else if (STYLENAME.equals(attname)) {
> -                    axisService.setStyle(attvalue);
> -                } else if (CONTEXTPATHNAME.equals(attname)) {
> -                    axisService.setContextPath(getValue(attvalue));
> +                if (ATQNAME.equals(attname)) {
> +                    if(attname == null || attname.trim() =="") {
> +                        axisService.setName(new QName(getAxisServiceName(dpengine.getCurrentFileItem().getServiceName())));
> +                    }  else
> +                        axisService.setName(new QName(attvalue));
>                  } else {
>                      throw new DeploymentException("Bad arguments for the service" + axisService.getName());
>                  }
>              }
> -        } else
> -            throw new DeploymentException("Bad arguments" + axisService.getName());
> -        if (!foundMR) {
> -            throw new DeploymentException("Message Receiver dose not specify " + axisService.getName());
> +        } else {
> +            //if user dose not specify the service name then the default name will be the archive name
> +            axisService.setName(new QName(getAxisServiceName(dpengine.getCurrentFileItem().getServiceName())));
>          }
> -
> -        //*********************************************************************************************//
> -        // This is to process remainng part of the document
> -        /**
> -         * to check whether the End tage of the document has met
> -         */
>          boolean END_DOCUMENT = false;
>          try {
>              while (!END_DOCUMENT) {
> @@ -593,45 +614,57 @@
>          //  String name = pullparser.getLocalName();
>          AxisOperation operation = new AxisOperation();
>          int attribCount = pullparser.getAttributeCount();
> -        if (attribCount < 5) {  // there should be two attributes
> +        if (attribCount >0) {  // there should be two attributes
>              for (int i = 0; i < attribCount; i++) {
>                  String attname = pullparser.getAttributeLocalName(i);
>                  String attvalue = pullparser.getAttributeValue(i);
>                  if (ATTNAME.equals(attname)) {
>                      operation.setName(new QName(attvalue));
> -                } else if (ATQNAME.equals(attname)) {
> -                    //TODO fill this after getting the reply for the mail
> -                    //operation.setQname(attvalue);
> -                } else if (STYLENAME.equals(attname)) {
> -                    //TODO to be implementd after clarfing style
> -                    //operation.setStyle(attvalue);
> -                } else if (ATUSE.equals(attname)) {
> -                    //TODO this is to be implemnt
> -                    //  operation.setUse(attvalue);
> -                }
> +                }  else
> +                    throw new DeploymentException("bad attribute in operation " + attname);
>              }
> -        } else {
> -            throw new DeploymentException("bad parameter arguments");
>          }
> -
>          boolean END_OPERATION = false;
>          try {
>              while (!END_OPERATION) {
>                  int eventType = pullparser.next();
>                  if (eventType == XMLStreamConstants.END_DOCUMENT) {
> -// document end tag met , break the loop
> -// but the doc end tag wont meet here :)
>                      END_OPERATION = true;
>                  } else if (eventType == XMLStreamConstants.START_ELEMENT) {
>                      String ST = pullparser.getLocalName();
>                      if (MODULEXMLST.equals(ST)) {
> -                        throw new UnsupportedOperationException("nexted elements are not allowed for M1");
> +                        attribCount = pullparser.getAttributeCount();
> +                        if (attribCount > 0) {
> +                            for (int i = 0; i < attribCount; i++) {
> +                                String attname = pullparser.getAttributeLocalName(i);
> +                                String attvalue = pullparser.getAttributeValue(i);
> +                                if (REF.equals(attname)) {
> +                                    if (dpengine.getModule(new QName(attvalue)) == null) {
> +                                        throw new DeploymentException(ST + " module is invalid or dose not have bean deployed");
> +                                    } else
> +                                        operation.addModule(new QName(attvalue));
> +                                }
> +                            }
> +                        }
>                      } else if (IN_FAILTFLOW.equals(ST)) {
>                          throw new UnsupportedOperationException("nexted elements are not allowed for M1");
>                      } else if (INFLOWST.equals(ST)) {
>                          throw new UnsupportedOperationException("nexted elements are not allowed for M1");
>                      } else if (OUTFLOWST.equals(ST)) {
>                          throw new UnsupportedOperationException("nexted elements are not allowed for M1");
> +                    }else if (MESSAGERECEIVER.equals(ST)){
> +                        attribCount = pullparser.getAttributeCount();
> +                        if(attribCount > 0){
> +                            String attname = pullparser.getAttributeLocalName(1);
> +                            String attvalue = pullparser.getAttributeValue(1);
> +                            if(CLASSNAME.equals(attname)){
> +                                operation.setMessageReciever(attvalue);
> +                            } else {
> +                                throw new UnsupportedOperationException(attname +   " is not allowed in messageRecievr element");
> +                            }
> +                        }  else {
> +                            //todo   if user dose not specify the messageReciever then the defaullt one has to be used
> +                        }
>                      }
>  
>                  } else if (eventType == XMLStreamConstants.END_ELEMENT) {
> @@ -644,6 +677,8 @@
>              }
>          } catch (XMLStreamException e) {
>              throw new DeploymentException("parser Exception", e);
> +        } catch (AxisFault e){
> +            throw new DeploymentException("Axis fault , loading module", e);
>          }
>          return operation;
>      }
> @@ -685,7 +720,6 @@
>          int attribCount = pullparser.getAttributeCount();
>          boolean ref_name = false;
>          boolean foundClass = false;
> -
>          if (attribCount > 0) {
>              for (int i = 0; i < attribCount; i++) {
>                  String attname = pullparser.getAttributeLocalName(i);
> 
> Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/server.xml
> URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/server.xml?rev=167898&r1=167897&r2=167898&view=diff
> ==============================================================================
> --- webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/server.xml (original)
> +++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/deployment/server.xml Tue May  3 04:42:46 2005
> @@ -2,6 +2,8 @@
>      <parameter name="hotdeployment" locked="xsd:false">true</parameter>
>      <parameter name="hotupdate" locked="xsd:false">true</parameter>
>  
> +    <messageReceiver mep="" class=""/>
> +
>      <transportReceiver name="http">
>      </transportReceiver>
>      <transportSender name="http" class="org.apache.axis.transport.http.HTTPTransportSender">
> 
> Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisGlobal.java
> URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisGlobal.java?rev=167898&r1=167897&r2=167898&view=diff
> ==============================================================================
> --- webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisGlobal.java (original)
> +++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisGlobal.java Tue May  3 04:42:46 2005
> @@ -1,23 +1,26 @@
>  /*
> - * Copyright 2004,2005 The Apache Software Foundation.
> - *
> - * Licensed under the Apache License, Version 2.0 (the "License");
> - * you may not use this file except in compliance with the License.
> - * You may obtain a copy of the License at
> - *
> - *      http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing, software
> - * distributed under the License is distributed on an "AS IS" BASIS,
> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> - * See the License for the specific language governing permissions and
> - * limitations under the License.
> - */
> +* Copyright 2004,2005 The Apache Software Foundation.
> +*
> +* Licensed under the Apache License, Version 2.0 (the "License");
> +* you may not use this file except in compliance with the License.
> +* You may obtain a copy of the License at
> +*
> +*      http://www.apache.org/licenses/LICENSE-2.0
> +*
> +* Unless required by applicable law or agreed to in writing, software
> +* distributed under the License is distributed on an "AS IS" BASIS,
> +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> +* See the License for the specific language governing permissions and
> +* limitations under the License.
> +*/
>  package org.apache.axis.description;
>  
> +import org.apache.axis.engine.MessageReceiver;
> +
>  import java.util.ArrayList;
>  import java.util.Collection;
>  import java.util.List;
> +import java.util.HashMap;
>  
>  import javax.xml.namespace.QName;
>  
> @@ -44,6 +47,8 @@
>       */
>      protected final List modules;
>  
> +    protected HashMap messagRecievers;
> +
>      // TODO provide a way to store name (name attribute value server.xml)
>  
>      /**
> @@ -52,6 +57,16 @@
>      public AxisGlobal() {
>          paramInclude = new ParameterIncludeImpl();
>          modules = new ArrayList();
> +        messagRecievers = new HashMap();
> +    }
> +    
> +
> +    public void addMessageReceiver(String key ,MessageReceiver messageReceiver){
> +        messagRecievers.put(key,messageReceiver) ;
> +    }
> +
> +    public MessageReceiver getMessageReceiver(String key){
> +        return (MessageReceiver)messagRecievers.get(key);
>      }
>  
>      /**
> @@ -91,5 +106,5 @@
>          paramInclude.addParameter(param);
>      }
>  
> - 
> +
>  }
> 
> Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisOperation.java
> URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisOperation.java?rev=167898&r1=167897&r2=167898&view=diff
> ==============================================================================
> --- webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisOperation.java (original)
> +++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/description/AxisOperation.java Tue May  3 04:42:46 2005
> @@ -2,6 +2,8 @@
>  
>  import java.util.HashMap;
>  import java.util.Map;
> +import java.util.Collection;
> +import java.util.ArrayList;
>  
>  import javax.xml.namespace.QName;
>  
> @@ -18,12 +20,18 @@
>   */
>  public class AxisOperation extends WSDLOperationImpl implements
>  		ParameterInclude, WSDLOperation,DescriptionConstants {
> -	
> -	
> +
> +
> +    private HashMap modules;
> +
> +    private String messageReciever;
> +
>  	public AxisOperation(){
>          this.setMessageExchangePattern(MEP_URI_IN_OUT);
>  		this.setComponentProperty(PARAMETER_KEY, new ParameterIncludeImpl());
>          this.setComponentProperty(MEP_MAP, new HashMap());
> +        this.setComponentProperty(MODULEREF_KEY, new ArrayList());
> +        modules = new HashMap();
>  	}
>  	
>  	public AxisOperation(QName name){
> @@ -31,6 +39,31 @@
>  		this.setName(name);
>  	}
>  
> +
> +    public void addModule(QName moduleref) {
> +        if (moduleref == null) {
> +            return;
> +        }
> +        Collection collectionModule =
> +                (Collection) this.getComponentProperty(MODULEREF_KEY);
> +        collectionModule.add(moduleref);
> +    }
> +
> +    /*
> +     * (non-Javadoc)
> +     * @see org.apache.axis.description.AxisService#getModules()
> +     */
> +
> +    /**
> +     * Method getModules
> +     *
> +     * @return
> +     */
> +    public Collection getModules() {
> +        return (Collection) this.getComponentProperty(MODULEREF_KEY);
> +    }
> +
> +
>  	/**
>       * Method addParameter
>       *
> @@ -120,6 +153,14 @@
>  		return (MEPContext) ((Map) this.getComponentProperty(MEP_MAP)).get(messageID);
>  
>  	}
> -    
> +
> +    public String getMessageReciever() {
> +        return messageReciever;
> +    }
> +
> +    public void setMessageReciever(String messageReciever) {
> +        this.messageReciever = messageReciever;
> +    }
> +
>  }
>  
> 
> Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java
> URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java?rev=167898&r1=167897&r2=167898&view=diff
> ==============================================================================
> --- webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java (original)
> +++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/phaseresolver/PhaseResolver.java Tue May  3 04:42:46 2005
> @@ -108,7 +108,7 @@
>          ArrayList allHandlers = new ArrayList();
>          AxisModule module;
>          Flow flow = null;
> -        ArrayList modules = (ArrayList)engineConfig.getGlobal().getModules();
> +        ArrayList modules = (ArrayList)axisService.getModules();//   (ArrayList)engineConfig.getGlobal().getModules());
>          //Global modules
>          for (int i = 0; i < modules.size(); i++) {
>              QName name = (QName) modules.get(i);
> 
> 
> 
>