You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by sa...@apache.org on 2006/05/02 07:59:13 UTC
svn commit: r398818 [1/2] - in
/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse:
./ api/ axis2/ config/ mediators/ mediators/base/ mediators/builtin/
mediators/builtin/axis2/ mediators/builtin/xslt/ mediators/ext/ mediators...
Author: saminda
Date: Mon May 1 22:59:02 2006
New Revision: 398818
URL: http://svn.apache.org/viewcvs?rev=398818&view=rev
Log:
Perform initial cleanup of codebase and introduce SynapseConfiguration. This is WIP and is not yet ready..
Added:
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/
- copied from r398812, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/xml/
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseConfiguration.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseConfigurationFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/AbstractListMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/AbstractMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/base/SequenceMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/ext/
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/ext/ClassMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/ext/ServiceMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/filters/FilterMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/FaultMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/XSLTMediator.java
Removed:
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/Metrics.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/MetricsFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/Processor.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/SynapseMessageConstants.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/api/EnvironmentAware.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/api/ResourceUpdateAware.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/AddressingInMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/AddressingOutMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/DefaultMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/DefineMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/ExactlyOneMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/InMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/NeverMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/OutMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/ProcessorConfigurator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/RefDefineMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/RefMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/RegexMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SecurityMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SendNowMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/StageMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/XPathMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/base/AbstractListMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/base/DefineMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/base/InMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/base/NeverMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/base/OutMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/base/RefDefineMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/base/RefMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/base/StageMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/SendNowMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/axis2/
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/xslt/
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/filters/AbstractFilterMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/filters/DefaultMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/filters/ExactlyOneMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/filters/RegexMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/filters/XPathMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/types/
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/registry/
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/resources/
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/xml/
Modified:
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/Constants.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/HeaderType.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/SynapseEnvironment.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/SynapseException.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/SynapseMessage.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/api/ListMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/api/Mediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2Sender.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/AbstractMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/ClassMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/Constants.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/DropMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/FaultMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/HeaderMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/LogMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/MediatorFactoryFinder.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SendMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/ServiceMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseMediatorFactory.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/base/SynapseMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/DropMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/HeaderMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/LogMediator.java
incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/SendMediator.java
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/Constants.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/Constants.java?rev=398818&r1=398817&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/Constants.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/Constants.java Mon May 1 22:59:02 2006
@@ -18,33 +18,29 @@
import javax.xml.namespace.QName;
-
/**
- *
- *
* <p> Global constants for the Synapse project
- *
*/
public interface Constants {
-
- String CLASSMEDIATOR = "classmediator";
- QName MEDIATE_OPERATION_NAME = new QName("mediate");
+ String CLASSMEDIATOR = "classmediator";
+
+ QName MEDIATE_OPERATION_NAME = new QName("mediate");
- String MEDIATOR_RESPONSE_PROPERTY = "synapse.mediator.response";
- String MEDIATOR_SYNAPSE_ENV_PROPERTY = "synapse.mediator.environment";
+ String MEDIATOR_RESPONSE_PROPERTY = "synapse.mediator.response";
+ String MEDIATOR_SYNAPSE_ENV_PROPERTY = "synapse.mediator.environment";
- String ISRESPONSE_PROPERTY = "synapse.isresponse";
+ String ISRESPONSE_PROPERTY = "synapse.isresponse";
- String EMPTYMEDIATOR = "emptymediator";
+ String EMPTYMEDIATOR = "emptymediator";
- //this is for the synapse.xml config
+ //this is for the synapse.config config
String SYNAPSECONFIGURATION = "SynapseConfiguration";
- String SYNAPSE_ENVIRONMENT = "synapse.environment";
+ String SYNAPSE_ENVIRONMENT = "synapse.environment";
- String ADD_ADDRESSING = "synapse.send.useaddressing";
+ String ADD_ADDRESSING = "synapse.send.useaddressing";
// for security supporting
@@ -55,7 +51,7 @@
String ENGAGE_ADDRESSING_IN_MESSAGE = "__ENGAGE_ADDRESSING_IN_MESSAGE__";
- String ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE = "__ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE__";
+ String ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE = "__ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE__";
}
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/HeaderType.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/HeaderType.java?rev=398818&r1=398817&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/HeaderType.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/HeaderType.java Mon May 1 22:59:02 2006
@@ -19,112 +19,110 @@
import org.apache.axis2.addressing.EndpointReference;
/**
- *
- * <p> This class encapsulates access to headers. It has a set of "logical names" (e.g. strings)
+ * <p> This class encapsulates access to headers. It has a set of "logical names" (e.g. strings)
* Once you have set the logical name you can read and write that header on a SynapseMessage
* It is used by the RegexProcessor and the HeaderProcessor classes.
- *
*/
public class HeaderType {
- private final static int TO = 1, FROM = 2, FAULT = 3, ACTION = 4,
- REPLYTO = 5;
+ private final static int TO = 1, FROM = 2, FAULT = 3, ACTION = 4,
+ REPLYTO = 5;
- public final static String STRTO = "to", STRFROM = "from",
- STRFAULT = "faultto", STRACTION = "action", STRREPLYTO = "replyto";
+ public final static String STRTO = "to", STRFROM = "from",
+ STRFAULT = "faultto", STRACTION = "action", STRREPLYTO = "replyto";
- private int headerType = 0;
+ private int headerType = 0;
- public void setHeaderType(String header) {
- if (header.equalsIgnoreCase(STRTO))
- headerType = TO;
- else if (header.equalsIgnoreCase(STRFROM))
- headerType = FROM;
- else if (header.equalsIgnoreCase(STRFAULT))
- headerType = FAULT;
- else if (header.equalsIgnoreCase(STRACTION))
- headerType = ACTION;
- else if (header.equalsIgnoreCase(STRREPLYTO))
- headerType = REPLYTO;
- else
- throw new SynapseException("unknown header type");
- }
-
- public String getHeaderType() {
- switch (headerType) {
-
- case TO:
- return STRTO;
- case FROM:
- return STRFROM;
- case FAULT:
- return STRFAULT;
- case ACTION:
- return STRACTION;
- case REPLYTO:
- return STRREPLYTO;
-
- }
- return null;
- }
-
- public String getHeader(SynapseMessage sm) {
- switch (headerType) {
- case TO: {
- if (sm.getTo() != null)
- return sm.getTo().getAddress();
-
- }
- case FROM: {
- if (sm.getFrom() != null)
- return sm.getFrom().getAddress();
- break;
- }
- case FAULT: {
- if (sm.getFaultTo() != null)
- return sm.getFaultTo().getAddress();
- break;
- }
- case ACTION: {
- if (sm.getWSAAction() != null)
- return sm.getWSAAction();
- break;
- }
- case REPLYTO: {
- if (sm.getReplyTo() != null)
- return sm.getReplyTo().getAddress();
- break;
- }
- }
-
- return null;
- }
-
- public void setHeader(SynapseMessage sm, String value) {
- switch (headerType) {
- case 0: {
- throw new SynapseException(
- "headerType=0 in setHeader. Assume called setHeader before setHeaderType");
- }
-
- case TO: {
-
- sm.setTo(new EndpointReference(value));
- break;
- }
- case FROM: {
- sm.setFrom(new EndpointReference(value));
- break;
- }
- case REPLYTO: {
- sm.setReplyTo(new EndpointReference(value));
- break;
- }
- case ACTION: {
- sm.setWSAAction(value);
- break;
- }
+ public void setHeaderType(String header) {
+ if (header.equalsIgnoreCase(STRTO))
+ headerType = TO;
+ else if (header.equalsIgnoreCase(STRFROM))
+ headerType = FROM;
+ else if (header.equalsIgnoreCase(STRFAULT))
+ headerType = FAULT;
+ else if (header.equalsIgnoreCase(STRACTION))
+ headerType = ACTION;
+ else if (header.equalsIgnoreCase(STRREPLYTO))
+ headerType = REPLYTO;
+ else
+ throw new SynapseException("unknown header type");
+ }
+
+ public String getHeaderType() {
+ switch (headerType) {
+
+ case TO:
+ return STRTO;
+ case FROM:
+ return STRFROM;
+ case FAULT:
+ return STRFAULT;
+ case ACTION:
+ return STRACTION;
+ case REPLYTO:
+ return STRREPLYTO;
+
+ }
+ return null;
+ }
+
+ public String getHeader(SynapseMessage sm) {
+ switch (headerType) {
+ case TO: {
+ if (sm.getTo() != null)
+ return sm.getTo().getAddress();
+
+ }
+ case FROM: {
+ if (sm.getFrom() != null)
+ return sm.getFrom().getAddress();
+ break;
+ }
+ case FAULT: {
+ if (sm.getFaultTo() != null)
+ return sm.getFaultTo().getAddress();
+ break;
+ }
+ case ACTION: {
+ if (sm.getWSAAction() != null)
+ return sm.getWSAAction();
+ break;
+ }
+ case REPLYTO: {
+ if (sm.getReplyTo() != null)
+ return sm.getReplyTo().getAddress();
+ break;
+ }
+ }
+
+ return null;
+ }
+
+ public void setHeader(SynapseMessage sm, String value) {
+ switch (headerType) {
+ case 0: {
+ throw new SynapseException(
+ "headerType=0 in setHeader. Assume called setHeader before setHeaderType");
+ }
+
+ case TO: {
+
+ sm.setTo(new EndpointReference(value));
+ break;
+ }
+ case FROM: {
+ sm.setFrom(new EndpointReference(value));
+ break;
+ }
+ case REPLYTO: {
+ sm.setReplyTo(new EndpointReference(value));
+ break;
+ }
+ case ACTION: {
+ sm.setWSAAction(value);
+ break;
+ }
- }
- }
+ }
+ }
}
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/SynapseEnvironment.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/SynapseEnvironment.java?rev=398818&r1=398817&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/SynapseEnvironment.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/SynapseEnvironment.java Mon May 1 22:59:02 2006
@@ -16,90 +16,53 @@
package org.apache.synapse;
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.synapse.api.Mediator;
-import org.apache.synapse.registry.Registry;
+import org.apache.synapse.config.SynapseConfiguration;
/**
- *
- *
- * <p>Common stuff needed to embed Synapse into a given runtime (e.g. Axis2)
- * <p>This interface is used by the mediators, and also by EnvironmentAware mediators
- *
- *
+ * The Synapse Environment is available to mediators through the SynapseMessage. It
+ * allows one to call to the underlying SOAP engine (such as Axis2) where required.
+ * e.g. send message, get classloader etc. It also holds a reference to the current
+ * SynapseConfiguration.
*/
public interface SynapseEnvironment {
-
-
/*
- * This method injects a new message into the Synapse engine
- * It is used in a couple of ways. Firstly, this is how, for example,
- * Axis2 kicks messages into Synapse to start with.
- * <p>
- * Also mediators can use this to send messages that they want to be mediated by Synapse
- * <p>For example if you want to send a copy of a message somewhere, you can clone it and then
- * injectMessage()
- */
+ * This method injects a new message into the Synapse engine
+ * It is used in a couple of ways. Firstly, this is how, for example,
+ * Axis2 kicks messages into Synapse to start with.
+ * <p>
+ * Also mediators can use this to send messages that they want to be mediated by Synapse
+ * <p>For example if you want to send a copy of a message somewhere, you can clone it and then
+ * injectMessage()
+ */
public void injectMessage(SynapseMessage smc);
/*
- * Mediators that wish to load classes should use the ClassLoader given here
- */
+ * Mediators that wish to load classes should use the ClassLoader given here
+ */
public ClassLoader getClassLoader();
-
/**
* This method allows you send messages on. As opposed to injectMessage send message does not
* process these through Synapse.
- * <p>
+ * <p/>
* This will send request messages on, and send response messages back to the client
*/
public void send(SynapseMessage smc);
-
/**
- * This is used by the references to find a processor with a given name
+ * Get a reference to the current SynapseConfiguration
*
+ * @return the current synapse configuration
*/
- 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()
- */
- public void addMediator(String name, Mediator m);
-
+ public SynapseConfiguration getConfiguration();
/**
- * This returns the "Master Processor" which is the root processor for this instance of
- * Synapse. Usually this would be the processor derived from <synapse>.
- */
- public Mediator getMasterMediator();
-
-
- /**
- * This sets the root processor for the engine.
+ * Set or replace the Synapse Configuration instance to be used
+ *
+ * @param cfg The new synapse configuration instance
*/
- public void setMasterMediator(Mediator p);
-
- public Object getProperty(String string);
-
- public void setProperty(String string, Object object);
-
- public Registry getRegistry();
- public void setRegistry(Registry reg);
-
- public Metrics getMetrics(String URI);
- public Metrics getMetrics(EndpointReference epr);
- public void setMetricsFactory(MetricsFactory mf);
-
- public void publish(OMElement element);
-
- //public ResourceHelper getResourceHelper();
+ public void setConfiguration(SynapseConfiguration cfg);
- //public void addResourceMediator(String name, Mediator p);
}
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/SynapseException.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/SynapseException.java?rev=398818&r1=398817&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/SynapseException.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/SynapseException.java Mon May 1 22:59:02 2006
@@ -16,27 +16,25 @@
package org.apache.synapse;
/**
- *
* <p>Runtime exception for Synapse code to throw
- *
*/
public class SynapseException extends RuntimeException {
- private static final long serialVersionUID = -7244032125641596311L;
+ private static final long serialVersionUID = -7244032125641596311L;
- public SynapseException(String string) {
- super(string);
+ public SynapseException(String string) {
+ super(string);
- }
+ }
- public SynapseException(String msg, Throwable e) {
- super(msg, e);
+ public SynapseException(String msg, Throwable e) {
+ super(msg, e);
- }
+ }
- public SynapseException(Throwable t) {
- super(t);
+ public SynapseException(Throwable t) {
+ super(t);
- }
+ }
}
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/SynapseMessage.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/SynapseMessage.java?rev=398818&r1=398817&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/SynapseMessage.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/SynapseMessage.java Mon May 1 22:59:02 2006
@@ -16,22 +16,20 @@
package org.apache.synapse;
+import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.addressing.RelatesTo;
-import org.apache.axiom.soap.SOAPEnvelope;
/**
- *
- *
* <p> The core definition of a message flowing thru Synapse.
* <p> The aim of this is to capture the Message Addressing Properties
- * (aka Message Information Headers) and the SOAP Envelope.
+ * (aka Message Information Headers) and the SOAP Envelope.
* The core To/From/FaultTo/ReplyTo/MessageID/RelatesTo stuff is here. <p>
* In addition this has get/setEnvelope.
- * <p>
- * There is also a bag of properties<p>
- * There are markers for whether we support REST, MTOM and also if this is a response or not
+ * <p/>
+ * There is also a bag of properties<p>
+ * There are markers for whether we support REST, MTOM and also if this is a response or not
*/
public interface SynapseMessage {
@@ -67,10 +65,6 @@
public String getWSAAction();
- public void setMessageId(String messageID);
-
- public String getMessageId();
-
public Object getProperty(String key);
public void setProperty(String key, Object value);
@@ -96,7 +90,8 @@
public void setFaultResponse(boolean b);
public boolean isFaultResponse();
-
+
public SynapseEnvironment getSynapseEnvironment();
+
public void setSynapseEnvironment(SynapseEnvironment env);
}
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/api/ListMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/api/ListMediator.java?rev=398818&r1=398817&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/api/ListMediator.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/api/ListMediator.java Mon May 1 22:59:02 2006
@@ -2,7 +2,20 @@
import java.util.List;
+/**
+ * The List mediator executes a given sequence/list of child mediators
+ */
public interface ListMediator extends Mediator {
- public void setList(List m);
- public List getList();
+
+ public boolean addChild(Mediator m);
+
+ public Mediator getChild(int pos);
+
+ public boolean removeChild(Mediator m);
+
+ public Mediator removeChild(int pos);
+
+ public List getList();
+
+ public void setList(List l); //TODO do we need this?
}
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/api/Mediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/api/Mediator.java?rev=398818&r1=398817&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/api/Mediator.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/api/Mediator.java Mon May 1 22:59:02 2006
@@ -18,12 +18,11 @@
import org.apache.synapse.SynapseMessage;
/**
- *
- * <p>API interface for pluggable mediators
- *
+ * All Synapse mediators must implement this Mediator interface. As a message passes
+ * through the synapse system, each mediator's mediate() method is invoked.
*/
public interface Mediator {
- public boolean mediate(SynapseMessage smc);
- //public String getName();
- //public void setName(String name);
+ public boolean mediate(SynapseMessage smc);
+
+ public String getName();
}
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java?rev=398818&r1=398817&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java Mon May 1 22:59:02 2006
@@ -17,30 +17,27 @@
package org.apache.synapse.axis2;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.deployment.util.PhasesInfo;
import org.apache.axis2.description.*;
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;
-import org.apache.axis2.client.OperationClient;
-import org.apache.axis2.client.Options;
-
import org.apache.synapse.Constants;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPHeader;
-import org.apache.axiom.soap.SOAPHeaderBlock;
-
import javax.xml.namespace.QName;
-import java.util.Iterator;
import java.util.ArrayList;
+import java.util.Iterator;
/**
@@ -54,13 +51,13 @@
ArrayList addressingHeaders;
if (soapHeader != null) {
addressingHeaders = soapHeader.getHeaderBlocksWithNSURI(
- AddressingConstants.Submission.WSA_NAMESPACE);
+ AddressingConstants.Submission.WSA_NAMESPACE);
if (addressingHeaders != null && addressingHeaders.size() != 0) {
detachAddressingInformation(addressingHeaders);
} else {
addressingHeaders = soapHeader.getHeaderBlocksWithNSURI(
- AddressingConstants.Final.WSA_NAMESPACE);
+ AddressingConstants.Final.WSA_NAMESPACE);
if (addressingHeaders != null && addressingHeaders.size() != 0) {
detachAddressingInformation(addressingHeaders);
}
@@ -70,7 +67,6 @@
}
/**
- *
* @param headerInformation
*/
private static void detachAddressingInformation(ArrayList headerInformation) {
@@ -97,18 +93,18 @@
if (ac.getService("__ANONYMOUS_SERVICE__") == null) {
// Lets default be OUT_IN
OutInAxisOperation outInOperation =
- new OutInAxisOperation(new QName(
- "__OPERATION_OUT_IN__"));
+ new OutInAxisOperation(new QName(
+ "__OPERATION_OUT_IN__"));
AxisService axisAnonymousService =
- new AxisService("__ANONYMOUS_SERVICE__");
+ new AxisService("__ANONYMOUS_SERVICE__");
axisAnonymousService.addOperation(outInOperation);
ac.addService(axisAnonymousService);
phasesInfo.setOperationPhases(outInOperation);
}
ServiceGroupContext sgc = new ServiceGroupContext(cc,
- (AxisServiceGroup)ac.getService("__ANONYMOUS_SERVICE__").getParent());
+ (AxisServiceGroup) ac.getService("__ANONYMOUS_SERVICE__").getParent());
ServiceContext sc =
- sgc.getServiceContext(new AxisService("__ANONYMOUS_SERVICE__"));
+ sgc.getServiceContext(new AxisService("__ANONYMOUS_SERVICE__"));
MessageContext mc = new MessageContext();
mc.setConfigurationContext(sc.getConfigurationContext());
@@ -124,17 +120,17 @@
mc.setMessageID(smc.getMessageID());
else
mc.setMessageID(String.valueOf("uuid:"
- + UUIDGenerator.getUUID()));
+ + UUIDGenerator.getUUID()));
if (smc.getReplyTo() != null)
mc.setReplyTo(smc.getReplyTo());
if (smc.getRelatesTo() != null)
- mc.setRelatesTo(smc.getRelatesTo());
- if (smc.getTo() != null) {
- mc.setTo(smc.getTo());
- } else {
- throw new AxisFault(
+ //mc.setRelatesTo(smc.getRelatesTo());
+ if (smc.getTo() != null) {
+ mc.setTo(smc.getTo());
+ } else {
+ throw new AxisFault(
"To canno't be null, if null Synapse can't infer the transport");
- }
+ }
if (smc.isDoingREST()) {
mc.setDoingREST(true);
}
@@ -142,37 +138,35 @@
// handling the outbound message with addressing
AxisModule module = ac.getModule(new QName(org.apache.axis2.Constants.MODULE_ADDRESSING));
if ((smc.getProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE) != null) ||
- (smc.getProperty(
- Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) != null)){
+ (smc.getProperty(
+ Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) != null)) {
if (!ac.getService("__ANONYMOUS_SERVICE__")
- .isEngaged(module.getName())) {
+ .isEngaged(module.getName())) {
ac.getService("__ANONYMOUS_SERVICE__").engageModule(module, ac);
}
}
-
//TODO; following line needed to be removed
mc.setEnvelope(outEnvelopeConfiguration(smc));
AxisOperation axisAnonymousOperation =
- ac.getService("__ANONYMOUS_SERVICE__")
- .getOperation(new QName("__OPERATION_OUT_IN__"));
+ ac.getService("__ANONYMOUS_SERVICE__")
+ .getOperation(new QName("__OPERATION_OUT_IN__"));
//Options class from Axis2 holds client side settings
Options options = new Options();
OperationClient mepClient =
- axisAnonymousOperation.createClient(sc, options);
+ axisAnonymousOperation.createClient(sc, options);
mepClient.addMessageContext(mc);
mepClient.execute(true);
MessageContext response = mepClient
- .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
response.setProperty(MessageContext.TRANSPORT_OUT,
- smc.getProperty(MessageContext.TRANSPORT_OUT));
+ smc.getProperty(MessageContext.TRANSPORT_OUT));
response.setProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO,
- smc.getProperty(
- org.apache.axis2.Constants.OUT_TRANSPORT_INFO));
-
+ smc.getProperty(
+ org.apache.axis2.Constants.OUT_TRANSPORT_INFO));
// If request is REST we assume the response is REST, so set the
// variable
@@ -180,9 +174,9 @@
response.setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.TRUE);
if (ac.getService("__ANONYMOUS_SERVICE__")
- .isEngaged(module.getName())) {
+ .isEngaged(module.getName())) {
ac.getService("__ANONYMOUS_SERVICE__")
- .disEngageModule(ac.getModule(module.getName()));
+ .disEngageModule(ac.getModule(module.getName()));
}
return response;
}
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2Sender.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2Sender.java?rev=398818&r1=398817&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2Sender.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2Sender.java Mon May 1 22:59:02 2006
@@ -17,18 +17,14 @@
package org.apache.synapse.axis2;
import org.apache.axis2.AxisFault;
-
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.TransportInDescription;
-
import org.apache.axis2.engine.AxisEngine;
-
import org.apache.synapse.Constants;
import org.apache.synapse.SynapseException;
import org.apache.synapse.SynapseMessage;
-
/**
* This class helps the Axis2SynapseEnvironment implement the send method
*/
@@ -39,30 +35,29 @@
try {
MessageContext messageContext = ((Axis2SynapseMessage) smc)
- .getMessageContext();
+ .getMessageContext();
// At any time any QOS is disengaged. It's engaged iff, a flag is
// set in execution chain.
// ex: addressing will be engage in outpath iff ADDRESSING_PROCESSED
// is set.
- if (smc.getProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE) != null)
- {
+ if (smc.getProperty(Constants.ENGAGE_ADDRESSING_IN_MESSAGE) != null) {
messageContext.setProperty(
- Constants.ENGAGE_ADDRESSING_IN_MESSAGE, Boolean.TRUE);
+ Constants.ENGAGE_ADDRESSING_IN_MESSAGE, Boolean.TRUE);
}
//Now hadle the outbound message with addressing
if (smc.getProperty(
- Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) != null) {
+ Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE) != null) {
messageContext.setProperty(
- Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE,
- Boolean.TRUE);
+ Constants.ENGAGE_ADDRESSING_OUT_BOUND_MESSAGE,
+ Boolean.TRUE);
}
MessageContext outMsgContext = Axis2FlexibleMEPClient
- .send(messageContext);
+ .send(messageContext);
// run all rules on response
@@ -71,7 +66,7 @@
outMsgContext.setServerSide(true);
Object os = messageContext
- .getProperty(MessageContext.TRANSPORT_OUT);
+ .getProperty(MessageContext.TRANSPORT_OUT);
outMsgContext.setProperty(MessageContext.TRANSPORT_OUT, os);
TransportInDescription ti = messageContext.getTransportIn();
@@ -81,7 +76,7 @@
throw new SynapseException("no Synapse Env set on message");
}
smc.getSynapseEnvironment().injectMessage(new Axis2SynapseMessage(
- outMsgContext, smc.getSynapseEnvironment()));
+ outMsgContext, smc.getSynapseEnvironment()));
} catch (Exception e) {
e.printStackTrace();
throw new SynapseException(e);
@@ -90,15 +85,15 @@
public static void sendBack(SynapseMessage smc) {
MessageContext messageContext = ((Axis2SynapseMessage) smc)
- .getMessageContext();
+ .getMessageContext();
AxisEngine ae =
- new AxisEngine(messageContext.getConfigurationContext());
+ new AxisEngine(messageContext.getConfigurationContext());
try {
//
messageContext
- .setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.TRUE);
+ .setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.TRUE);
// check for addressing is alredy engaged for this message.
// if engage we should use the address enable Configuraion context.
//
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java?rev=398818&r1=398817&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java Mon May 1 22:59:02 2006
@@ -16,91 +16,34 @@
package org.apache.synapse.axis2;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import org.apache.axiom.om.OMElement;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
-
-import org.apache.synapse.Metrics;
-import org.apache.synapse.MetricsFactory;
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;
-
-import org.apache.synapse.xml.MediatorFactoryFinder;
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.addressing.EndpointReference;
+import org.apache.synapse.config.SynapseConfiguration;
/**
- *
- *
- *
* <p> This is the Axis2 implementation of the 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 SynapseConfiguration config = null;
private Log log = LogFactory.getLog(getClass());
public Axis2SynapseEnvironment(OMElement synapseConfiguration,
ClassLoader cl) {
super();
this.cl = cl;
- if (synapseConfiguration!=null)
- mainmediator = MediatorFactoryFinder.getMediator(this, synapseConfiguration);
+// if (synapseConfiguration!=null)
+// mainmediator = MediatorFactoryFinder.getMediator(this, synapseConfiguration);
+ // TODO set main mediator here
}
- /**
- * 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);
- }
-
- public ClassLoader getClassLoader() {
- return cl;
- }
-
- public void setClassLoader(ClassLoader cl) {
- this.cl = cl;
+ smc.setSynapseEnvironment(this);
+ getConfiguration().getMainMediator().mediate(smc);
}
public void send(SynapseMessage sm) {
@@ -110,80 +53,20 @@
Axis2Sender.sendOn(sm);
}
-
- public Mediator lookupMediator(String name) {
- return (Mediator) mediators.get(name);
+ public ClassLoader getClassLoader() {
+ return cl;
}
- public void addMediator(String name, Mediator m) {
- log.debug("adding mediator with name " + name);
- if (mediators.containsKey(name))
- log.warn("name " + name + "already present");
- mediators.put(name, m);
+ public void setClassLoader(ClassLoader cl) {
+ this.cl = cl;
}
- public Mediator getMasterMediator() {
- return mainmediator;
+ public SynapseConfiguration getConfiguration() {
+ return config;
}
- public void setMasterMediator(Mediator m) {
- mainmediator = m;
+ public void setConfiguration(SynapseConfiguration cfg) {
+ this.config = cfg;
}
- public Registry getRegistry() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void setRegistry(Registry reg) {
- // TODO Auto-generated method stub
-
- }
-
- public Metrics getMetrics(String URI) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Metrics getMetrics(EndpointReference epr) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void setMetricsFactory(MetricsFactory mf) {
- // TODO Auto-generated method stub
-
- }
-
- public void publish(OMElement element) {
- // TODO Auto-generated method stub
-
- }
-
- // lookup methods for resources handling
- // public Mediator lookupResourceMediator(String uriRoot) {
- // return (Mediator) fac.getResourceMediator(uriRoot);
- // }
-
- // 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);
- // }
-
- // public ResourceHelper getResourceHelper() {
- //ResourceHelperFactory fac = ResourceHelperFactory.newInstance();
- //fac.setResourceProcessorsMap(this.resourceMediators);
- //log.debug("size in env is "+this.resourceMediators.size());
- // return fac.createResourceHelper();
- // }
-
-
-
-
}
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java?rev=398818&r1=398817&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java Mon May 1 22:59:02 2006
@@ -16,22 +16,20 @@
package org.apache.synapse.axis2;
-import java.io.InputStream;
-
-import javax.xml.stream.XMLStreamException;
-
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.engine.AxisConfiguration;
-
-import org.apache.synapse.SynapseEnvironment;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.Constants;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axiom.om.OMElement;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.Constants;
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseException;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.InputStream;
/**
* <p/>
@@ -39,22 +37,23 @@
* This class is used by the SynapseMessageReceiver to find the environment. The env is stored in a Parameter to the Axis2 config
*/
public class Axis2SynapseEnvironmentFinder implements Constants {
- private static Log log = LogFactory.getLog(Axis2SynapseEnvironmentFinder.class);
+ private static Log log = LogFactory.getLog(Axis2SynapseEnvironmentFinder.class);
+
public static synchronized SynapseEnvironment getSynapseEnvironment(
- MessageContext mc) {
+ MessageContext mc) {
AxisConfiguration ac =
- mc.getConfigurationContext().getAxisConfiguration();
+ mc.getConfigurationContext().getAxisConfiguration();
Parameter synapseEnvParam = ac.getParameter(SYNAPSE_ENVIRONMENT);
if (synapseEnvParam == null) {
- log.debug("synapse env not available - creating");
+ log.debug("synapse env not available - creating");
Parameter param = ac.getParameter(SYNAPSECONFIGURATION);
if (param == null) {
throw new SynapseException("no parameter '"
- + SYNAPSECONFIGURATION + "' in axis2.xml");
+ + SYNAPSECONFIGURATION + "' in axis2.config");
}
String synapseConfig = (String) param.getValue();
InputStream is = mc.getAxisService().getClassLoader()
- .getResourceAsStream(synapseConfig.trim());
+ .getResourceAsStream(synapseConfig.trim());
StAXOMBuilder builder;
try {
@@ -62,13 +61,13 @@
} catch (XMLStreamException e1) {
throw new SynapseException(
- "Trouble parsing Synapse Configuration ", e1);
+ "Trouble parsing Synapse Configuration ", e1);
}
OMElement config = builder.getDocumentElement();
config.build();
Axis2SynapseEnvironment se = new Axis2SynapseEnvironment(config, mc
- .getAxisService().getClassLoader());
+ .getAxisService().getClassLoader());
synapseEnvParam = new Parameter(SYNAPSE_ENVIRONMENT, null);
synapseEnvParam.setValue(se);
@@ -81,17 +80,18 @@
return (SynapseEnvironment) synapseEnvParam.getValue();
}
+
public static synchronized void setSynapseEnvironment(MessageContext mc, SynapseEnvironment se) {
- AxisConfiguration ac =
- mc.getConfigurationContext().getAxisConfiguration();
- Parameter synapseEnvParam = new Parameter(SYNAPSE_ENVIRONMENT, null);
- synapseEnvParam.setValue(se);
- try {
- ac.addParameter(synapseEnvParam);
- } catch (AxisFault e) {
- throw new SynapseException(e);
- }
-
+ AxisConfiguration ac =
+ mc.getConfigurationContext().getAxisConfiguration();
+ Parameter synapseEnvParam = new Parameter(SYNAPSE_ENVIRONMENT, null);
+ synapseEnvParam.setValue(se);
+ try {
+ ac.addParameter(synapseEnvParam);
+ } catch (AxisFault e) {
+ throw new SynapseException(e);
+ }
+
}
}
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java?rev=398818&r1=398817&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java Mon May 1 22:59:02 2006
@@ -16,9 +16,7 @@
package org.apache.synapse.axis2;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
+import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.addressing.RelatesTo;
@@ -26,14 +24,14 @@
import org.apache.synapse.Constants;
import org.apache.synapse.SynapseEnvironment;
import org.apache.synapse.SynapseMessage;
-import org.apache.axiom.soap.SOAPEnvelope;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
/**
- *
- *
- * <p>
+ * <p/>
* A wrapper on Axis2's Message Context that implements the SynapseMessage interface
- *
*/
public class Axis2SynapseMessage implements SynapseMessage {
@@ -92,8 +90,7 @@
}
public void setRelatesTo(RelatesTo reference) {
- mc.setRelatesTo(reference);
-
+ //TODO mc.setRelatesTo(reference);
}
public EndpointReference getReplyTo() {
@@ -137,7 +134,7 @@
public Object getProperty(String key) {
Object obj = props.get(key);
- if ( obj == null) {
+ if (obj == null) {
obj = mc.getProperty(key);
}
return obj;
@@ -214,15 +211,14 @@
return this.faultResponse;
}
- public SynapseEnvironment getSynapseEnvironment() {
- return Axis2SynapseEnvironmentFinder.getSynapseEnvironment(mc);
- }
-
- public void setSynapseEnvironment(SynapseEnvironment env) {
- Axis2SynapseEnvironmentFinder.setSynapseEnvironment(mc, env);
- return;
- }
-
-
+ public SynapseEnvironment getSynapseEnvironment() {
+ return Axis2SynapseEnvironmentFinder.getSynapseEnvironment(mc);
+ }
+
+ public void setSynapseEnvironment(SynapseEnvironment env) {
+ Axis2SynapseEnvironmentFinder.setSynapseEnvironment(mc, env);
+ return;
+ }
+
}
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java?rev=398818&r1=398817&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java Mon May 1 22:59:02 2006
@@ -17,26 +17,20 @@
package org.apache.synapse.axis2;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.AxisFault;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.axis2.engine.AxisEngine;
import org.apache.axis2.addressing.EndpointReference;
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.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.description.*;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.synapse.SynapseException;
-
import javax.xml.namespace.QName;
import java.util.HashMap;
@@ -56,13 +50,13 @@
OperationContext opContext) throws AxisFault {
HashMap mep = opContext.getMessageContexts();
MessageContext immsgContext = (MessageContext) mep
- .get(MESSAGE_LABEL_IN_VALUE);
+ .get(MESSAGE_LABEL_IN_VALUE);
MessageContext outmsgContext = (MessageContext) mep
- .get(MESSAGE_LABEL_OUT_VALUE);
+ .get(MESSAGE_LABEL_OUT_VALUE);
if ((immsgContext != null) && (outmsgContext != null)) {
throw new AxisFault(
- "Invalid message addition , operation context completed");
+ "Invalid message addition , operation context completed");
}
if (outmsgContext == null) {
@@ -75,7 +69,7 @@
public OperationClient createClient(ServiceContext sc, Options options) {
- return new DynamicOperationClient(this,sc,options);
+ return new DynamicOperationClient(this, sc, options);
}
}
@@ -86,11 +80,11 @@
private OperationContext oc;
private Options options;
- public DynamicOperationClient(DynamicAxisOperation axisOp, ServiceContext sc, Options options){
+ public DynamicOperationClient(DynamicAxisOperation axisOp, ServiceContext sc, Options options) {
this.options = options;
this.axisOp = axisOp;
this.sc = sc;
- this.oc = new OperationContext(axisOp,sc);
+ this.oc = new OperationContext(axisOp, sc);
this.oc.setParent(this.sc);
}
@@ -121,17 +115,17 @@
// copy interesting info from options to message context.
MessageContext mc = oc
- .getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+ .getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
if (mc == null) {
throw new AxisFault(
- "Out message context is null ,"
- + " please set the out message context before calling this method");
+ "Out message context is null ,"
+ + " please set the out message context before calling this method");
}
EndpointReference toEPR = mc.getTo();
TransportOutDescription transportOut = ClientUtils.inferOutTransport(cc
- .getAxisConfiguration(), toEPR, mc);
+ .getAxisConfiguration(), toEPR, mc);
mc.setTransportOut(transportOut);
/*
@@ -141,7 +135,7 @@
TransportInDescription transportIn = options.getTransportIn();
if (transportIn == null) {
mc.setTransportIn(ClientUtils.inferInTransport(cc
- .getAxisConfiguration(), options, mc));
+ .getAxisConfiguration(), options, mc));
} else {
mc.setTransportIn(transportIn);
}
@@ -161,8 +155,9 @@
}
}
+
public OperationContext getOperationContext() {
- return oc;
+ return oc;
}
public void reset() throws AxisFault {
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java?rev=398818&r1=398817&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java Mon May 1 22:59:02 2006
@@ -18,20 +18,17 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
-
import org.apache.axis2.engine.MessageReceiver;
import org.apache.synapse.Constants;
/**
- *
* <p>Does nothing! Used as an endpoint so we can engage modules
- *
*/
public class EmptyMessageReceiver implements MessageReceiver {
- public void receive(MessageContext mc) throws AxisFault {
- mc.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY, Boolean
- .valueOf(true));
- }
+ public void receive(MessageContext mc) throws AxisFault {
+ mc.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY, Boolean
+ .valueOf(true));
+ }
}
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java?rev=398818&r1=398817&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java Mon May 1 22:59:02 2006
@@ -25,6 +25,6 @@
SynapseMessage smc = new Axis2SynapseMessage(messageContext, Axis2SynapseEnvironmentFinder.getSynapseEnvironment(messageContext));
boolean returnValue = mediator.mediate(smc);
messageContext.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY,
- new Boolean(returnValue));
+ new Boolean(returnValue));
}
}
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java?rev=398818&r1=398817&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java Mon May 1 22:59:02 2006
@@ -15,8 +15,6 @@
*/
package org.apache.synapse.axis2;
-import javax.xml.namespace.QName;
-
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.AxisOperation;
@@ -25,39 +23,38 @@
import org.apache.axis2.engine.AbstractDispatcher;
import org.apache.axis2.engine.AxisConfiguration;
+import javax.xml.namespace.QName;
+
/**
- *
- *
* This sends every message to the SynapseMessageReceiver so that it can pass them to Synapse
- *
*/
public class SynapseDispatcher extends AbstractDispatcher {
- // FOR EVERY REQUEST - ALWAYS DISPATH TO THE SYNAPSE SERVICE
+ // FOR EVERY REQUEST - ALWAYS DISPATH TO THE SYNAPSE SERVICE
- private static final long serialVersionUID = -6970206989111592645L;
+ private static final long serialVersionUID = -6970206989111592645L;
- private static final String SYNAPSE_SERVICE_NAME = "synapse";
+ private static final String SYNAPSE_SERVICE_NAME = "synapse";
- private static final QName MEDIATE_OPERATION_NAME = new QName("mediate");
+ private static final QName MEDIATE_OPERATION_NAME = new QName("mediate");
- public void initDispatcher() {
- QName qn = new QName("http://synapse.apache.org", "SynapseDispatcher");
- HandlerDescription hd = new HandlerDescription(qn);
- super.init(hd);
+ public void initDispatcher() {
+ QName qn = new QName("http://synapse.apache.org", "SynapseDispatcher");
+ HandlerDescription hd = new HandlerDescription(qn);
+ super.init(hd);
- }
+ }
- public AxisService findService(MessageContext mc) throws AxisFault {
- AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
- AxisService as = ac.getService(SYNAPSE_SERVICE_NAME);
- return as;
- }
+ public AxisService findService(MessageContext mc) throws AxisFault {
+ AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
+ AxisService as = ac.getService(SYNAPSE_SERVICE_NAME);
+ return as;
+ }
- public AxisOperation findOperation(AxisService svc, MessageContext mc)
- throws AxisFault {
+ public AxisOperation findOperation(AxisService svc, MessageContext mc)
+ throws AxisFault {
- AxisOperation ao = svc.getOperation(MEDIATE_OPERATION_NAME);
- return ao;
- }
+ AxisOperation ao = svc.getOperation(MEDIATE_OPERATION_NAME);
+ return ao;
+ }
}
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java?rev=398818&r1=398817&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java Mon May 1 22:59:02 2006
@@ -18,11 +18,9 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.context.MessageContext;
-
import org.apache.axis2.engine.MessageReceiver;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.apache.synapse.SynapseEnvironment;
import org.apache.synapse.SynapseMessage;
@@ -38,14 +36,14 @@
public void receive(MessageContext mc) throws AxisFault {
log.debug("receiving message");
SynapseEnvironment env = Axis2SynapseEnvironmentFinder
- .getSynapseEnvironment(mc);
+ .getSynapseEnvironment(mc);
////////////////////////////////////////////////////////////////////////
// SynapseEnvironment is set as a property in MessageContext. This is due
// use we can expect in ServiceMediatorProcessor and many extensions yet to come
// So it a mediator uses EnvironmentAware, that mediator will be injected with the correct environment
-
+
////////////////////////////////////////////////////////////////////////
- SynapseMessage smc = new Axis2SynapseMessage(mc,env);
+ SynapseMessage smc = new Axis2SynapseMessage(mc, env);
smc.setSynapseEnvironment(env);
env.injectMessage(smc);
@@ -56,12 +54,12 @@
// smc.isFaultRespose = true then the response is a fault with 500 Internal Server Error
if (smc.isResponse()) {
mc.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN,
- Constants.VALUE_TRUE);
+ Constants.VALUE_TRUE);
}
if (smc.isFaultResponse()) {
// todo: a good way to inject faultSoapEnv to the Axis2 Transport
throw new AxisFault(
- "Synapse Encounters an Error - Please See Log for More Details");
+ "Synapse Encounters an Error - Please See Log for More Details");
}
///////////////////////////////////////////////////////////////////////
}
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/AbstractMediatorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/AbstractMediatorFactory.java?rev=398818&r1=398812&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/AbstractMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/AbstractMediatorFactory.java Mon May 1 22:59:02 2006
@@ -43,7 +43,7 @@
if (nm != null) {
name = nm.getAttributeValue().trim();
//m.setName(name);
- se.addMediator(name, m);
+ //se.addMediator(name, m); TODO fix this later!
}
log.debug("compile "+el.getLocalName()+" with name '"+name+"' on "+m.getClass());
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/ClassMediatorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/ClassMediatorFactory.java?rev=398818&r1=398812&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/ClassMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/ClassMediatorFactory.java Mon May 1 22:59:02 2006
@@ -17,11 +17,11 @@
import javax.xml.namespace.QName;
-import org.apache.synapse.xml.Constants;
+import org.apache.synapse.config.Constants;
import org.apache.synapse.SynapseEnvironment;
import org.apache.synapse.SynapseException;
import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.types.ClassMediator;
+import org.apache.synapse.mediators.ext.ClassMediator;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMAttribute;
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/Constants.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/Constants.java?rev=398818&r1=398812&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/Constants.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/Constants.java Mon May 1 22:59:02 2006
@@ -13,13 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.synapse.xml;
+package org.apache.synapse.config;
+
+import javax.xml.namespace.QName;
/**
* <p/>
* Constants used in the XML processing
*/
public interface Constants {
- String SYNAPSE_NAMESPACE = "http://ws.apache.org/ns/synapse";
- String SYNAPSE = "synapse";
+ public static final QName DEFINITIONS_ELT = new QName("definitions");
+ public static final QName SEQUENCE_ELT = new QName("sequence");
+ public static final QName ENDPOINT_ELT = new QName("endpoint");
+ public static final QName PROPERTY_ELT = new QName("set-property");
+
+ public static final String SYNAPSE_NAMESPACE = "http://ws.apache.org/ns/synapse";
+ public static final String SYNAPSE = "synapse";
+ public static final String NULL_NAMESPACE = "";
}
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/DropMediatorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/DropMediatorFactory.java?rev=398818&r1=398812&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/DropMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/DropMediatorFactory.java Mon May 1 22:59:02 2006
@@ -17,6 +17,7 @@
package org.apache.synapse.xml;
import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.config.Constants;
import org.apache.synapse.api.Mediator;
import org.apache.synapse.mediators.builtin.DropMediator;
import org.apache.axiom.om.OMElement;
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/FaultMediatorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/FaultMediatorFactory.java?rev=398818&r1=398812&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/FaultMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/FaultMediatorFactory.java Mon May 1 22:59:02 2006
@@ -18,8 +18,9 @@
import javax.xml.namespace.QName;
import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.config.Constants;
import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.builtin.axis2.FaultMediator;
+import org.apache.synapse.mediators.transform.FaultMediator;
import org.apache.axiom.om.OMElement;
/**
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/HeaderMediatorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/HeaderMediatorFactory.java?rev=398818&r1=398812&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/HeaderMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/HeaderMediatorFactory.java Mon May 1 22:59:02 2006
@@ -19,6 +19,7 @@
import org.apache.synapse.SynapseEnvironment;
import org.apache.synapse.SynapseException;
+import org.apache.synapse.config.Constants;
import org.apache.synapse.api.Mediator;
import org.apache.synapse.mediators.builtin.HeaderMediator;
import org.apache.axiom.om.OMElement;
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/LogMediatorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/LogMediatorFactory.java?rev=398818&r1=398812&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/LogMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/LogMediatorFactory.java Mon May 1 22:59:02 2006
@@ -19,6 +19,7 @@
import javax.xml.namespace.QName;
import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.config.Constants;
import org.apache.synapse.api.Mediator;
import org.apache.synapse.mediators.builtin.LogMediator;
import org.apache.axiom.om.OMElement;
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/MediatorFactoryFinder.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/MediatorFactoryFinder.java?rev=398818&r1=398812&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/MediatorFactoryFinder.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/MediatorFactoryFinder.java Mon May 1 22:59:02 2006
@@ -29,9 +29,6 @@
import org.apache.synapse.SynapseEnvironment;
import org.apache.synapse.SynapseException;
-import org.apache.synapse.mediators.builtin.xslt.XSLTMediatorFactory;
-import org.apache.synapse.resources.xml.PropertyMediatorFactory;
-import org.apache.synapse.resources.xml.ResourceMediatorFactory;
import org.apache.synapse.api.Mediator;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMNamespace;
@@ -54,23 +51,13 @@
private static Class[] mediatorFactories = {
SynapseMediatorFactory.class,
- StageMediatorFactory.class, RegexMediatorFactory.class,
- XPathMediatorFactory.class,
HeaderMediatorFactory.class,
ClassMediatorFactory.class,
ServiceMediatorFactory.class,
LogMediatorFactory.class, SendMediatorFactory.class,
FaultMediatorFactory.class,
- AddressingInMediatorFactory.class,
- AddressingOutMediatorFactory.class,
- InMediatorFactory.class, OutMediatorFactory.class,
- NeverMediatorFactory.class, RefMediatorFactory.class,
- XSLTMediatorFactory.class,DefineMediatorFactory.class,
- SendNowMediatorFactory.class,SendMediatorFactory.class,
- DropMediatorFactory.class,
- RefDefineMediatorFactory.class, ExactlyOneMediatorFactory.class,
- DefaultMediatorFactory.class,
- PropertyMediatorFactory.class, ResourceMediatorFactory.class,
+ SendMediatorFactory.class,
+ DropMediatorFactory.class
};
private static void initialise() {
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SendMediatorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SendMediatorFactory.java?rev=398818&r1=398812&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SendMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SendMediatorFactory.java Mon May 1 22:59:02 2006
@@ -22,6 +22,7 @@
import org.apache.synapse.api.Mediator;
import org.apache.synapse.mediators.builtin.SendMediator;
import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.config.Constants;
import org.apache.axiom.om.OMElement;
public class SendMediatorFactory extends AbstractMediatorFactory {
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/ServiceMediatorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/ServiceMediatorFactory.java?rev=398818&r1=398812&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/ServiceMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/ServiceMediatorFactory.java Mon May 1 22:59:02 2006
@@ -22,8 +22,9 @@
import org.apache.synapse.SynapseEnvironment;
import org.apache.synapse.SynapseException;
+import org.apache.synapse.config.Constants;
import org.apache.synapse.api.Mediator;
-import org.apache.synapse.mediators.types.axis2.ServiceMediator;
+import org.apache.synapse.mediators.ext.ServiceMediator;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMAttribute;
Added: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseConfiguration.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseConfiguration.java?rev=398818&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseConfiguration.java (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseConfiguration.java Mon May 1 22:59:02 2006
@@ -0,0 +1,46 @@
+/*
+* 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.synapse.config;
+
+import org.apache.synapse.api.Mediator;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class SynapseConfiguration {
+
+ private Map namedSequences = new HashMap();
+ private Map namedEndpoints = new HashMap();
+ private Map globalProps = new HashMap();
+
+ private Mediator mainMediator = null;
+
+ public void addNamedMediator(String name, Mediator m) {
+ namedSequences.put(name, m);
+ }
+
+ public Mediator getNamedMediator(String name) {
+ return (Mediator) namedSequences.get(name);
+ }
+
+ public Mediator getMainMediator() {
+ return mainMediator;
+ }
+
+ public void setMainMediator(Mediator mainMediator) {
+ this.mainMediator = mainMediator;
+ }
+}
Added: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseConfigurationFactory.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseConfigurationFactory.java?rev=398818&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseConfigurationFactory.java (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseConfigurationFactory.java Mon May 1 22:59:02 2006
@@ -0,0 +1,60 @@
+/*
+* 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.synapse.config;
+
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Iterator;
+
+public class SynapseConfigurationFactory {
+
+ public SynapseConfigurationFactory() {
+
+ }
+
+ public static SynapseConfiguration getConfiguration(String fileName) throws XMLStreamException, IOException {
+
+ SynapseConfiguration config = new SynapseConfiguration();
+
+ OMElement root =
+ new StAXOMBuilder(XMLInputFactory.newInstance().
+ createXMLStreamReader(new FileReader(fileName)))
+ .getDocumentElement();
+ root.build();
+
+ OMContainer definitions = root.getFirstChildWithName(Constants.DEFINITIONS_ELT);
+ if (definitions != null) {
+ Iterator iter = definitions.getChildrenWithName(Constants.SEQUENCE_ELT);
+ while (iter.hasNext()) {
+ OMElement elt = (OMElement) iter.next();
+ defineSequence(elt);
+ }
+ }
+
+ return null;
+ }
+
+ private static void defineSequence(OMElement ele) {
+ //Mediator med = MediatorFactoryFinder.getMediator(synapseEnv, ele);
+ System.out.println("med");
+ }
+}
Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseMediatorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseMediatorFactory.java?rev=398818&r1=398812&r2=398818&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseMediatorFactory.java Mon May 1 22:59:02 2006
@@ -19,6 +19,7 @@
import javax.xml.namespace.QName;
import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.config.Constants;
import org.apache.synapse.api.Mediator;
import org.apache.synapse.mediators.base.SynapseMediator;
import org.apache.axiom.om.OMElement;
@@ -35,7 +36,7 @@
public Mediator createMediator(SynapseEnvironment se, OMElement el) {
SynapseMediator sm = new SynapseMediator();
- super.addChildrenAndSetName(se, el, sm);
+ //super.addChildrenAndSetName(se, el, sm); TODO fix this later
return sm;
}
Added: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/AbstractListMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/AbstractListMediator.java?rev=398818&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/AbstractListMediator.java (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/AbstractListMediator.java Mon May 1 22:59:02 2006
@@ -0,0 +1,63 @@
+/*
+ * 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.synapse.mediators;
+
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.api.Mediator;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public abstract class AbstractListMediator extends AbstractMediator {
+
+ protected List mediators = new ArrayList();
+
+ public boolean mediate(SynapseMessage synMsg) {
+ log.debug("List mediator : mediate() " + getName());
+
+ Iterator it = mediators.iterator();
+ while (it.hasNext()) {
+ Mediator m = (Mediator) it.next();
+ log.debug(m.getClass());
+ if (!m.mediate(synMsg)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public List getList() {
+ return mediators;
+ }
+
+ public boolean addChild(Mediator m) {
+ return mediators.add(m);
+ }
+
+ public Mediator getChild(int pos) {
+ return (Mediator) mediators.get(pos);
+ }
+
+ public boolean removeChild(Mediator m) {
+ return mediators.remove(m);
+ }
+
+ public Mediator removeChild(int pos) {
+ return (Mediator) mediators.remove(pos);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org