synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r393175 - in /incubator/synapse/trunk/java/modules/core: src/org/apache/synapse/ src/org/apache/synapse/axis2/ src/org/apache/synapse/registry/ src/org/apache/synapse/resources/xml/ test/org/apache/synapse/ test/org/apache/synapse/mediators/
Date Tue, 11 Apr 2006 10:28:10 GMT
Author: pzf
Date: Tue Apr 11 03:28:06 2006
New Revision: 393175

URL: http://svn.apache.org/viewcvs?rev=393175&view=rev
Log:
Add a "registry" concept  (still not implemented) - and refactor SynEnv to be an interface
(since not using Abstract)

Added:
    incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/registry/
    incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/registry/Registry.java
Modified:
    incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/SynapseEnvironment.java
    incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
    incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
    incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java
    incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/resources/xml/ResourceMediatorFactory.java
    incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/TestSynapseMessage.java
    incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/mediators/SimpleGETResourceAquiringMediator.java

Modified: incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/SynapseEnvironment.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/SynapseEnvironment.java?rev=393175&r1=393174&r2=393175&view=diff
==============================================================================
--- incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/SynapseEnvironment.java
(original)
+++ incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/SynapseEnvironment.java
Tue Apr 11 03:28:06 2006
@@ -16,11 +16,7 @@
 package org.apache.synapse;
 
 import org.apache.synapse.api.Mediator;
-import org.apache.synapse.resources.ResourceHelper;
-
-
-import java.util.Map;
-import java.util.HashMap;
+import org.apache.synapse.registry.Registry;
 
 
 /**
@@ -31,51 +27,9 @@
  * 
  *
  */
-public abstract class SynapseEnvironment {
-
-    protected SynapseEnvironment parent;
-    protected Map properties;
-
-    protected SynapseEnvironment(SynapseEnvironment parent) {
-        this.properties = new HashMap();
-        this.parent = parent;
-    }
-
-    public SynapseEnvironment getParent() {
-        return this.parent;
-    }
-
-    public void setParent(SynapseEnvironment parent) {
-        this.parent = parent;
-    }
-
-    /**
-     * Retrieves an object given a key.
-     *
-     * @param key - if not found, will return null
-     * @return Returns the property.
-     */
-    public Object getProperty(String key) {
-        Object obj = null;
-
-        obj = properties.get(key);
+public interface SynapseEnvironment {
 
-        if ((obj == null) && (parent != null)) {
-            obj = parent.getProperty(key);
-        }
 
-        return obj;
-    }
-
-    /**
-     * Store a property for message context
-     *
-     * @param key
-     * @param value
-     */
-    public void setProperty(String key, Object value) {
-        properties.put(key, value);
-    }
     
     /*
       * This method injects a new message into the Synapse engine
@@ -86,12 +40,12 @@
       * <p>For example if you want to send a copy of a message somewhere, you can clone
it and then
       * injectMessage()
       */
-    abstract public void injectMessage(SynapseMessage smc);
+    public void injectMessage(SynapseMessage smc);
 
     /*
       * Mediators that wish to load classes should use the ClassLoader given here
       */
-    abstract public ClassLoader getClassLoader();
+    public ClassLoader getClassLoader();
 
 
     /**
@@ -100,40 +54,43 @@
      * <p>
      * This will send request messages on, and send response messages back to the client
      */
-    abstract public void send(SynapseMessage smc);
+    public void send(SynapseMessage smc);
 
 
     /**
      * This is used by the references to find a processor with a given name
      *
      */
-    abstract public Mediator lookupMediator(String name);
+    public Mediator lookupMediator(String name);
 
 
     /**
      * This is how you add a processor to the list of processors. The name which it can be
      * retrieved by is the processor.getName()
      */
-    abstract public void addMediator(String name, Mediator m);
+    public void addMediator(String name, Mediator m);
 
 
     /**
      * This returns the "Master Processor" which is the root processor for this instance
of
      * Synapse. Usually this would be the processor derived from &ltsynapse>.
      */
-    abstract public Mediator getMasterMediator();
+    public Mediator getMasterMediator();
 
 
     /**
      * This sets the root processor for the engine.
      */
-    abstract public void setMasterMediator(Mediator p);
+    public void setMasterMediator(Mediator p);
 
-    /**
-     * This method is responsible for updating resources via simple GET interface.
-     */
-   
-    abstract public ResourceHelper getResourceHelper();
+	public Object getProperty(String string);
+
+	public void setProperty(String string, Object object);
+
+	public Registry getRegistry();
+	public Registry getRegistry(String name);
+	
+    //public ResourceHelper getResourceHelper();
 
-    abstract  public void addResourceMediator(String name, Mediator p);
+    //public void addResourceMediator(String name, Mediator p);
 }

Modified: incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java?rev=393175&r1=393174&r2=393175&view=diff
==============================================================================
--- incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
(original)
+++ incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
Tue Apr 11 03:28:06 2006
@@ -25,6 +25,7 @@
 import org.apache.axis2.engine.AxisConfiguration;
 
 import org.apache.axis2.util.UUIDGenerator;
+import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.AddressingConstants;
@@ -32,7 +33,6 @@
 import org.apache.axis2.client.Options;
 
 import org.apache.synapse.Constants;
-import org.apache.wsdl.WSDLConstants;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.SOAPHeader;
 import org.apache.axiom.soap.SOAPHeaderBlock;

Modified: incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java?rev=393175&r1=393174&r2=393175&view=diff
==============================================================================
--- incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
(original)
+++ incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
Tue Apr 11 03:28:06 2006
@@ -26,6 +26,7 @@
 import org.apache.synapse.SynapseEnvironment;
 import org.apache.synapse.SynapseMessage;
 import org.apache.synapse.api.Mediator;
+import org.apache.synapse.registry.Registry;
 import org.apache.synapse.resources.ResourceHelperFactory;
 import org.apache.synapse.resources.ResourceHelper;
 import org.apache.synapse.resources.xml.ResourceMediator;
@@ -40,28 +41,51 @@
  * <p> This is the Axis2 implementation of the SynapseEnvironment
  *
  */
-public class Axis2SynapseEnvironment extends SynapseEnvironment {
-	
+public class Axis2SynapseEnvironment implements SynapseEnvironment {
 	
     private Mediator mainmediator = null;
 
     private ClassLoader cl = null;
-
+    private Map properties = new HashMap();
     private Map mediators = new HashMap();
 
     private Log log = LogFactory.getLog(getClass());
-    private ResourceHelperFactory fac = ResourceHelperFactory.newInstance();
-    //resourceProcessors keeps track of all <resources/>
-    //private HashMap resourceMediators = new HashMap();
 
     public Axis2SynapseEnvironment(OMElement synapseConfiguration,
                                    ClassLoader cl) {
-        super(null);
+        super();
         this.cl = cl;
         if (synapseConfiguration!=null)
             mainmediator = MediatorFactoryFinder.getMediator(this, synapseConfiguration);
     }
 
+    /**
+     * Retrieves an object given a key.
+     *
+     * @param key - if not found, will return null
+     * @return Returns the property.
+     */
+
+    public Object getProperty(String key) {
+        Object obj = null;
+
+        obj = properties.get(key);
+
+
+        return obj;
+    }
+    
+    /**
+     * Store a property for message context
+     *
+     * @param key
+     * @param value
+     */
+    public void setProperty(String key, Object value) {
+        properties.put(key, value);
+    }
+
+    
     public void injectMessage(SynapseMessage smc) {
     	smc.setSynapseEnvironment(this);
     	mainmediator.mediate(smc);
@@ -103,27 +127,37 @@
     }
 
     // lookup methods for resources handling
-    public Mediator lookupResourceMediator(String uriRoot) {
-        return (Mediator) fac.getResourceMediator(uriRoot);
-    }
+ //   public Mediator lookupResourceMediator(String uriRoot) {
+   //     return (Mediator) fac.getResourceMediator(uriRoot);
+   // }
 
-    public void addResourceMediator(String uri, Mediator m) {
-        log.debug("adding "+uri+" with "+m.getClass());
+  //  public void addResourceMediator(String uri, Mediator m) {
+   //     log.debug("adding "+uri+" with "+m.getClass());
     	
     	/*if (resourceMediators.containsKey(uri)) {
             throw new SynapseException(
                     "Uri Root is already exists. Not acceptable");
         }*/
         
-        fac.addResourceMediator(uri, (ResourceMediator)m);
-    }
+   //     fac.addResourceMediator(uri, (ResourceMediator)m);
+   // }
 
-    public ResourceHelper getResourceHelper() {
+   // public ResourceHelper getResourceHelper() {
         //ResourceHelperFactory fac = ResourceHelperFactory.newInstance();
         //fac.setResourceProcessorsMap(this.resourceMediators);
         //log.debug("size in env is "+this.resourceMediators.size());
-        return fac.createResourceHelper();
-    }
+    //    return fac.createResourceHelper();
+   // }
+
+	public Registry getRegistry() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Registry getRegistry(String name) {
+		// TODO Auto-generated method stub
+		return null;
+	}
 
 	
 }

Modified: incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java?rev=393175&r1=393174&r2=393175&view=diff
==============================================================================
--- incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java
(original)
+++ incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java
Tue Apr 11 03:28:06 2006
@@ -16,7 +16,7 @@
 
 package org.apache.synapse.axis2;
 
-import org.apache.axis2.description.*;
+
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.context.ServiceContext;
@@ -27,8 +27,15 @@
 import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.async.Callback;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.ClientUtils;
+import org.apache.axis2.description.InOutAxisOperation;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.TransportOutDescription;
 import org.apache.synapse.SynapseException;
 import org.apache.wsdl.WSDLConstants;
+
 
 import javax.xml.namespace.QName;
 import java.util.HashMap;

Added: incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/registry/Registry.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/registry/Registry.java?rev=393175&view=auto
==============================================================================
--- incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/registry/Registry.java
(added)
+++ incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/registry/Registry.java
Tue Apr 11 03:28:06 2006
@@ -0,0 +1,22 @@
+package org.apache.synapse.registry;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.addressing.EndpointReference;
+//import org.apache.ws.commons.schema.XmlSchema;
+//import org.apache.ws.policy.Policy;
+//import org.apache.wsdl.WSDLDescription;
+
+public interface Registry {
+	public OMElement getXML(String identifier);
+	public String getString(String identifier);
+	public String getURI(String identifier); // guaranteed a URI
+	public EndpointReference getEPR(String identifier);
+	public List getURIList(String identifier); // could be a list of links to other entries
+//	public Policy getPolicy(String identifier);
+//	public XmlSchema getSchema(String identifier);
+//	public WSDLDescription getWSDL(String identifier);
+	public Properties getProperties(String identifier); 
+}

Modified: incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/resources/xml/ResourceMediatorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/resources/xml/ResourceMediatorFactory.java?rev=393175&r1=393174&r2=393175&view=diff
==============================================================================
--- incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/resources/xml/ResourceMediatorFactory.java
(original)
+++ incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/resources/xml/ResourceMediatorFactory.java
Tue Apr 11 03:28:06 2006
@@ -105,7 +105,7 @@
 		OMAttribute uriRoot = el.getAttribute(RESOURCE_URI_ROOT_ATT_Q);
 		if (uriRoot != null) {
             // uri-root has already set
-            se.addResourceMediator(uriRoot.getAttributeValue(), m);
+       //     se.addResourceMediator(uriRoot.getAttributeValue(), m);
             m.setURIRoot(uriRoot.getAttributeValue());
 		}
 		log.debug("compile "+el.getLocalName()+" with uri-root '"+uriRoot.getAttributeValue() +"'
on "+m.getClass());

Modified: incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/TestSynapseMessage.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/TestSynapseMessage.java?rev=393175&r1=393174&r2=393175&view=diff
==============================================================================
--- incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/TestSynapseMessage.java
(original)
+++ incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/TestSynapseMessage.java
Tue Apr 11 03:28:06 2006
@@ -6,9 +6,7 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.synapse.axis2.Axis2SynapseEnvironment;
 import org.apache.synapse.axis2.Axis2SynapseMessage;
-import org.apache.synapse.util.Axis2EnvSetup;
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;

Modified: incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/mediators/SimpleGETResourceAquiringMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/mediators/SimpleGETResourceAquiringMediator.java?rev=393175&r1=393174&r2=393175&view=diff
==============================================================================
--- incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/mediators/SimpleGETResourceAquiringMediator.java
(original)
+++ incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/mediators/SimpleGETResourceAquiringMediator.java
Tue Apr 11 03:28:06 2006
@@ -3,8 +3,8 @@
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.SynapseMessage;
-import org.apache.axiom.om.OMElement;
-import junit.framework.TestCase;
+//import org.apache.axiom.om.OMElement;
+//import junit.framework.TestCase;
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
  *
@@ -33,10 +33,10 @@
     }
 
     public boolean mediate(SynapseMessage smc) {
-        OMElement resourcesElement = smc.getSynapseEnvironment().getResourceHelper()
-                .get("http://127.0.0.1:8090/axis2/services/npe/simple_resources");
+   //     OMElement resourcesElement = smc.getSynapseEnvironment().getResourceHelper()
+     //           .get("http://127.0.0.1:8090/axis2/services/npe/simple_resources");
         // test for resources being not null
-        TestCase.assertNotNull(resourcesElement);
+   //     TestCase.assertNotNull(resourcesElement);
         return true;
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


Mime
View raw message