You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by as...@apache.org on 2007/03/17 17:18:47 UTC
svn commit: r519363 [2/16] - in /webservices/synapse/trunk/java:
modules/core/ modules/core/src/main/java/org/apache/synapse/
modules/core/src/main/java/org/apache/synapse/config/
modules/core/src/main/java/org/apache/synapse/config/xml/ modules/core/s...
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java Sat Mar 17 09:18:32 2007
@@ -1,420 +1,420 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.Mediator;
-import org.apache.synapse.Constants;
-import org.apache.synapse.endpoints.Endpoint;
-import org.apache.synapse.mediators.base.SequenceMediator;
-import org.apache.synapse.config.xml.MediatorFactoryFinder;
-import org.apache.synapse.config.xml.endpoints.XMLToEndpointMapper;
-import org.apache.synapse.core.axis2.ProxyService;
-import org.apache.synapse.registry.Registry;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import java.util.*;
-import java.net.URLConnection;
-import java.io.IOException;
-
-/**
- * The SynapseConfiguration holds the global configuration for a Synapse
- * instance.
- */
-public class SynapseConfiguration {
-
- private static final Log log = LogFactory.getLog(SynapseConfiguration.class);
-
- /** The remote registry made available to the Synapse configuration. Only one is supported */
- Registry registry = null;
-
- /** Holds Proxy services defined through Synapse */
- private Map proxyServices = new HashMap();
-
- /**
- * The local registry is a simple HashMap and provides the ability to override definitions
- * of a remote registry for entries defined locally with the same key
- */
- private Map localRegistry = new HashMap();
-
- /** Hold reference to the Axis2 ConfigurationContext */
- private AxisConfiguration axisConfiguration = null;
-
- /** Save the path to the configuration file loaded, to save it later if required */
- private String pathToConfigFile = null;
-
- /**
- * Add a named sequence into the local registry
- * @param key the name for the sequence
- * @param mediator a Sequence mediator
- */
- public void addSequence(String key, Mediator mediator) {
- localRegistry.put(key, mediator);
- }
-
- /**
- * Allow a dynamic sequence to be cached and made available through the local registry
- * @param key the key to lookup the sequence from the remote registry
- * @param entry the Entry object which holds meta information and the cached resource
- */
- public void addSequence(String key, Entry entry) {
- localRegistry.put(key, entry);
- }
-
- /**
- * Returns the map of defined sequences in the configuraiton excluding the fetched sequences
- * from remote registry
- * @return Map of SequenceMediators defined in the local configuraion
- */
- public Map getDefinedSequences() {
- Map definedSequences = new HashMap();
- Iterator itr = localRegistry.values().iterator();
- while(itr.hasNext()) {
- Object o = itr.next();
- if(o instanceof SequenceMediator) {
- definedSequences.put(((SequenceMediator) o).getName(), o);
- }
- }
- return definedSequences;
- }
-
- /**
- * Return the sequence specified with the given key
- * @param key the key being referenced
- * @return the sequence referenced by the key
- */
- public Mediator getSequence(String key) {
- Object o = localRegistry.get(key);
- if (o != null && o instanceof Mediator) {
- return (Mediator) o;
- }
-
- Entry entry = null;
- if (o != null && o instanceof Entry) {
- entry = (Entry) o;
- } else {
- entry = new Entry(key);
- entry.setType(Entry.REMOTE_ENTRY);
- entry.setMapper(MediatorFactoryFinder.getInstance());
- }
-
- if (registry != null) {
- o = registry.getResource(entry);
- if (o != null && o instanceof Mediator) {
- localRegistry.put(key, entry);
- return (Mediator) o;
- }
- }
-
- return null;
- }
-
- /**
- * Removes a sequence from the local registry
- * @param key of the sequence to be removed
- */
- public void removeSequence(String key) {
- localRegistry.remove(key);
- }
-
- /**
- * Return the main/default sequence to be executed. This is the sequence which
- * will execute for all messages when message mediation takes place
- * @return the main mediator sequence
- */
- public Mediator getMainSequence() {
- return getSequence(Constants.MAIN_SEQUENCE_KEY);
- }
-
- /**
- * Return the fault sequence to be executed when Synapse encounters a fault scenario
- * during processing
- * @return the fault sequence
- */
- public Mediator getFaultSequence() {
- return getSequence(Constants.FAULT_SEQUENCE_KEY);
- }
-
- /**
- * Define a resource to the local registry. All static resources (e.g. URL source)
- * are loaded during this definition phase, and the inability to load such a resource
- * will not allow the definition of the resource to the local registry
- *
- * @param key the key associated with the resource
- * @param entry the Entry that holds meta information about the resource and its
- * contents (or cached contents if the Entry refers to a dynamic resource off a
- * remote registry)
- */
- public void addEntry(String key, Entry entry) {
-
- if (entry.getType() == Entry.URL_SRC) {
- try {
- URLConnection urlc = entry.getSrc().openConnection();
- XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(
- urlc.getInputStream());
- StAXOMBuilder builder = new StAXOMBuilder(parser);
- entry.setValue(builder.getDocumentElement());
- localRegistry.put(key, entry);
-
- } catch (IOException e) {
- handleException("Can not read from source URL : " + entry.getSrc());
- } catch (XMLStreamException e) {
- handleException("Source URL : " + entry.getSrc() + " refers to an invalid XML");
- }
- } else {
- localRegistry.put(key, entry);
- }
- }
-
- /**
- * Returns the map of defined entries in the configuraiton excluding the fetched entries
- * from remote registry
- * @return Map of Entries defined in the local configuraion
- */
- public Map getDefinedEntries() {
- Map definedEntries = new HashMap();
- Iterator itr = localRegistry.values().iterator();
- while(itr.hasNext()) {
- Object o = itr.next();
- if(o instanceof Entry && ((Entry) o).getType() != Entry.REMOTE_ENTRY) {
- definedEntries.put(((Entry) o).getKey(), o);
- }
- }
- return definedEntries;
- }
-
- /**
- * Get the resource with the given key
- * @param key the key of the resource required
- * @return its value
- */
- public Object getEntry(String key) {
- Object o = localRegistry.get(key);
- if (o != null && o instanceof Entry) {
- Entry entry = (Entry) o;
- if (entry.isDynamic()) {
- if (entry.isCached() && !entry.isExpired()) {
- return entry.getValue();
- }
- } else {
- return entry.getValue();
- }
- }
- if (registry != null) {
- o = registry.getResource(new Entry(key));
- }
- return o;
- }
-
- /**
- * Get the Entry object mapped to the given key
- * @param key the key for which the Entry is required
- * @return its value
- */
- public Entry getEntryDefinition(String key) {
- return (Entry) localRegistry.get(key);
- }
-
- /**
- * Deletes any reference mapped to the given key from the local registry
- * @param key the key of the reference to be removed
- */
- public void removeEntry(String key) {
- localRegistry.remove(key);
- }
-
- /**
- * Define a named endpoint with the given key
- * @param key the key for the endpoint
- * @param endpoint the endpoint definition
- */
- public void addEndpoint(String key, Endpoint endpoint) {
- localRegistry.put(key, endpoint);
- }
-
- /**
- * Add a dynamic endpoint definition to the local registry
- * @param key the key for the endpoint definition
- * @param entry the actual endpoint definition to be added
- */
- public void addEndpoint(String key, Entry entry) {
- localRegistry.put(key, entry);
- }
-
- /**
- * Returns the map of defined endpoints in the configuraiton excluding the fetched endpoints
- * from remote registry
- * @return Map of Endpoints defined in the local configuraion
- */
- public Map getDefinedEndpoints() {
- Map definedEndpoints = new HashMap();
- Iterator itr = localRegistry.values().iterator();
- while(itr.hasNext()) {
- Object o = itr.next();
- if(o instanceof Endpoint) {
- definedEndpoints.put(((Endpoint) o).getName(), o);
- }
- }
- return definedEndpoints;
- }
-
- /**
- * Get the definition of the endpoint with the given key
- * @param key the key of the endpoint
- * @return the endpoint definition
- */
- public Endpoint getEndpoint(String key) {
- Object o = localRegistry.get(key);
- if (o != null && o instanceof Endpoint) {
- return (Endpoint) o;
- } else if (registry != null) {
- Entry entry = new Entry(key);
- entry.setMapper(XMLToEndpointMapper.getInstance());
- o = registry.getResource(entry);
- if (o != null && o instanceof Endpoint) {
- return (Endpoint) o;
- }
- }
- return null;
- }
-
- /**
- * Deletes the endpoint with the given key
- * @param key of the endpoint to be deleted
- */
- public void removeEndpoint(String key) {
- localRegistry.remove(key);
- }
-
- /**
- * Add a Proxy service to the configuration
- * @param name the name of the Proxy service
- * @param proxy the Proxy service instance
- */
- public void addProxyService(String name, ProxyService proxy) {
- proxyServices.put(name, proxy);
- }
-
- /**
- * Get the Proxy service with the given name
- * @param name the name being looked up
- * @return the Proxy service
- */
- public ProxyService getProxyService(String name) {
- return (ProxyService) proxyServices.get(name);
- }
-
- /**
- * Deletes the Proxy Service named with the given name
- * @param name of the Proxy Service to be deleted
- */
- public void removeProxyService(String name) {
- Object o = proxyServices.get(name);
- if (o == null) {
- handleException("Unknown proxy service for name : " + name);
- } else {
- try {
- if(getAxisConfiguration().getServiceForActivation(name).isActive()) {
- getAxisConfiguration().getService(name).setActive(false);
- }
- getAxisConfiguration().removeService(name);
- proxyServices.remove(name);
- } catch (AxisFault axisFault) {
- handleException(axisFault.getMessage());
- }
- }
- }
-
- /**
- * Return the list of defined proxy services
- * @return the proxy services defined
- */
- public Collection getProxyServices() {
- return proxyServices.values();
- }
-
- /**
- * Return an unmodifiable copy of the local registry
- * @return an unmodifiable copy of the local registry
- */
- public Map getLocalRegistry() {
- return Collections.unmodifiableMap(localRegistry);
- }
-
- /**
- * Get the remote registry defined (if any)
- * @return the currently defined remote registry
- */
- public Registry getRegistry() {
- return registry;
- }
-
- /**
- * Set the remote registry for the configuration
- * @param registry the remote registry for the configuration
- */
- public void setRegistry(Registry registry) {
- this.registry = registry;
- }
-
- /**
- * Set the Axis2 AxisConfiguration to the SynapseConfiguration
- * @param axisConfig
- */
- public void setAxisConfiguration(AxisConfiguration axisConfig) {
- this.axisConfiguration = axisConfig;
- }
-
- /**
- * Get the Axis2 AxisConfiguration for the SynapseConfiguration
- * @return AxisConfiguration of the Axis2
- */
- public AxisConfiguration getAxisConfiguration() {
- return axisConfiguration;
- }
-
- /**
- * The path to the currently loaded configuration file
- * @return file path to synapse.xml
- */
- public String getPathToConfigFile() {
- return pathToConfigFile;
- }
-
- /**
- * Set the path to the loaded synapse.xml
- * @param pathToConfigFile path to the synapse.xml loaded
- */
- public void setPathToConfigFile(String pathToConfigFile) {
- this.pathToConfigFile = pathToConfigFile;
- }
-
- private void handleException(String msg) {
- log.error(msg);
- throw new SynapseException(msg);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.Mediator;
+import org.apache.synapse.Constants;
+import org.apache.synapse.endpoints.Endpoint;
+import org.apache.synapse.mediators.base.SequenceMediator;
+import org.apache.synapse.config.xml.MediatorFactoryFinder;
+import org.apache.synapse.config.xml.endpoints.XMLToEndpointMapper;
+import org.apache.synapse.core.axis2.ProxyService;
+import org.apache.synapse.registry.Registry;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import java.util.*;
+import java.net.URLConnection;
+import java.io.IOException;
+
+/**
+ * The SynapseConfiguration holds the global configuration for a Synapse
+ * instance.
+ */
+public class SynapseConfiguration {
+
+ private static final Log log = LogFactory.getLog(SynapseConfiguration.class);
+
+ /** The remote registry made available to the Synapse configuration. Only one is supported */
+ Registry registry = null;
+
+ /** Holds Proxy services defined through Synapse */
+ private Map proxyServices = new HashMap();
+
+ /**
+ * The local registry is a simple HashMap and provides the ability to override definitions
+ * of a remote registry for entries defined locally with the same key
+ */
+ private Map localRegistry = new HashMap();
+
+ /** Hold reference to the Axis2 ConfigurationContext */
+ private AxisConfiguration axisConfiguration = null;
+
+ /** Save the path to the configuration file loaded, to save it later if required */
+ private String pathToConfigFile = null;
+
+ /**
+ * Add a named sequence into the local registry
+ * @param key the name for the sequence
+ * @param mediator a Sequence mediator
+ */
+ public void addSequence(String key, Mediator mediator) {
+ localRegistry.put(key, mediator);
+ }
+
+ /**
+ * Allow a dynamic sequence to be cached and made available through the local registry
+ * @param key the key to lookup the sequence from the remote registry
+ * @param entry the Entry object which holds meta information and the cached resource
+ */
+ public void addSequence(String key, Entry entry) {
+ localRegistry.put(key, entry);
+ }
+
+ /**
+ * Returns the map of defined sequences in the configuraiton excluding the fetched sequences
+ * from remote registry
+ * @return Map of SequenceMediators defined in the local configuraion
+ */
+ public Map getDefinedSequences() {
+ Map definedSequences = new HashMap();
+ Iterator itr = localRegistry.values().iterator();
+ while(itr.hasNext()) {
+ Object o = itr.next();
+ if(o instanceof SequenceMediator) {
+ definedSequences.put(((SequenceMediator) o).getName(), o);
+ }
+ }
+ return definedSequences;
+ }
+
+ /**
+ * Return the sequence specified with the given key
+ * @param key the key being referenced
+ * @return the sequence referenced by the key
+ */
+ public Mediator getSequence(String key) {
+ Object o = localRegistry.get(key);
+ if (o != null && o instanceof Mediator) {
+ return (Mediator) o;
+ }
+
+ Entry entry = null;
+ if (o != null && o instanceof Entry) {
+ entry = (Entry) o;
+ } else {
+ entry = new Entry(key);
+ entry.setType(Entry.REMOTE_ENTRY);
+ entry.setMapper(MediatorFactoryFinder.getInstance());
+ }
+
+ if (registry != null) {
+ o = registry.getResource(entry);
+ if (o != null && o instanceof Mediator) {
+ localRegistry.put(key, entry);
+ return (Mediator) o;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Removes a sequence from the local registry
+ * @param key of the sequence to be removed
+ */
+ public void removeSequence(String key) {
+ localRegistry.remove(key);
+ }
+
+ /**
+ * Return the main/default sequence to be executed. This is the sequence which
+ * will execute for all messages when message mediation takes place
+ * @return the main mediator sequence
+ */
+ public Mediator getMainSequence() {
+ return getSequence(Constants.MAIN_SEQUENCE_KEY);
+ }
+
+ /**
+ * Return the fault sequence to be executed when Synapse encounters a fault scenario
+ * during processing
+ * @return the fault sequence
+ */
+ public Mediator getFaultSequence() {
+ return getSequence(Constants.FAULT_SEQUENCE_KEY);
+ }
+
+ /**
+ * Define a resource to the local registry. All static resources (e.g. URL source)
+ * are loaded during this definition phase, and the inability to load such a resource
+ * will not allow the definition of the resource to the local registry
+ *
+ * @param key the key associated with the resource
+ * @param entry the Entry that holds meta information about the resource and its
+ * contents (or cached contents if the Entry refers to a dynamic resource off a
+ * remote registry)
+ */
+ public void addEntry(String key, Entry entry) {
+
+ if (entry.getType() == Entry.URL_SRC) {
+ try {
+ URLConnection urlc = entry.getSrc().openConnection();
+ XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(
+ urlc.getInputStream());
+ StAXOMBuilder builder = new StAXOMBuilder(parser);
+ entry.setValue(builder.getDocumentElement());
+ localRegistry.put(key, entry);
+
+ } catch (IOException e) {
+ handleException("Can not read from source URL : " + entry.getSrc());
+ } catch (XMLStreamException e) {
+ handleException("Source URL : " + entry.getSrc() + " refers to an invalid XML");
+ }
+ } else {
+ localRegistry.put(key, entry);
+ }
+ }
+
+ /**
+ * Returns the map of defined entries in the configuraiton excluding the fetched entries
+ * from remote registry
+ * @return Map of Entries defined in the local configuraion
+ */
+ public Map getDefinedEntries() {
+ Map definedEntries = new HashMap();
+ Iterator itr = localRegistry.values().iterator();
+ while(itr.hasNext()) {
+ Object o = itr.next();
+ if(o instanceof Entry && ((Entry) o).getType() != Entry.REMOTE_ENTRY) {
+ definedEntries.put(((Entry) o).getKey(), o);
+ }
+ }
+ return definedEntries;
+ }
+
+ /**
+ * Get the resource with the given key
+ * @param key the key of the resource required
+ * @return its value
+ */
+ public Object getEntry(String key) {
+ Object o = localRegistry.get(key);
+ if (o != null && o instanceof Entry) {
+ Entry entry = (Entry) o;
+ if (entry.isDynamic()) {
+ if (entry.isCached() && !entry.isExpired()) {
+ return entry.getValue();
+ }
+ } else {
+ return entry.getValue();
+ }
+ }
+ if (registry != null) {
+ o = registry.getResource(new Entry(key));
+ }
+ return o;
+ }
+
+ /**
+ * Get the Entry object mapped to the given key
+ * @param key the key for which the Entry is required
+ * @return its value
+ */
+ public Entry getEntryDefinition(String key) {
+ return (Entry) localRegistry.get(key);
+ }
+
+ /**
+ * Deletes any reference mapped to the given key from the local registry
+ * @param key the key of the reference to be removed
+ */
+ public void removeEntry(String key) {
+ localRegistry.remove(key);
+ }
+
+ /**
+ * Define a named endpoint with the given key
+ * @param key the key for the endpoint
+ * @param endpoint the endpoint definition
+ */
+ public void addEndpoint(String key, Endpoint endpoint) {
+ localRegistry.put(key, endpoint);
+ }
+
+ /**
+ * Add a dynamic endpoint definition to the local registry
+ * @param key the key for the endpoint definition
+ * @param entry the actual endpoint definition to be added
+ */
+ public void addEndpoint(String key, Entry entry) {
+ localRegistry.put(key, entry);
+ }
+
+ /**
+ * Returns the map of defined endpoints in the configuraiton excluding the fetched endpoints
+ * from remote registry
+ * @return Map of Endpoints defined in the local configuraion
+ */
+ public Map getDefinedEndpoints() {
+ Map definedEndpoints = new HashMap();
+ Iterator itr = localRegistry.values().iterator();
+ while(itr.hasNext()) {
+ Object o = itr.next();
+ if(o instanceof Endpoint) {
+ definedEndpoints.put(((Endpoint) o).getName(), o);
+ }
+ }
+ return definedEndpoints;
+ }
+
+ /**
+ * Get the definition of the endpoint with the given key
+ * @param key the key of the endpoint
+ * @return the endpoint definition
+ */
+ public Endpoint getEndpoint(String key) {
+ Object o = localRegistry.get(key);
+ if (o != null && o instanceof Endpoint) {
+ return (Endpoint) o;
+ } else if (registry != null) {
+ Entry entry = new Entry(key);
+ entry.setMapper(XMLToEndpointMapper.getInstance());
+ o = registry.getResource(entry);
+ if (o != null && o instanceof Endpoint) {
+ return (Endpoint) o;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Deletes the endpoint with the given key
+ * @param key of the endpoint to be deleted
+ */
+ public void removeEndpoint(String key) {
+ localRegistry.remove(key);
+ }
+
+ /**
+ * Add a Proxy service to the configuration
+ * @param name the name of the Proxy service
+ * @param proxy the Proxy service instance
+ */
+ public void addProxyService(String name, ProxyService proxy) {
+ proxyServices.put(name, proxy);
+ }
+
+ /**
+ * Get the Proxy service with the given name
+ * @param name the name being looked up
+ * @return the Proxy service
+ */
+ public ProxyService getProxyService(String name) {
+ return (ProxyService) proxyServices.get(name);
+ }
+
+ /**
+ * Deletes the Proxy Service named with the given name
+ * @param name of the Proxy Service to be deleted
+ */
+ public void removeProxyService(String name) {
+ Object o = proxyServices.get(name);
+ if (o == null) {
+ handleException("Unknown proxy service for name : " + name);
+ } else {
+ try {
+ if(getAxisConfiguration().getServiceForActivation(name).isActive()) {
+ getAxisConfiguration().getService(name).setActive(false);
+ }
+ getAxisConfiguration().removeService(name);
+ proxyServices.remove(name);
+ } catch (AxisFault axisFault) {
+ handleException(axisFault.getMessage());
+ }
+ }
+ }
+
+ /**
+ * Return the list of defined proxy services
+ * @return the proxy services defined
+ */
+ public Collection getProxyServices() {
+ return proxyServices.values();
+ }
+
+ /**
+ * Return an unmodifiable copy of the local registry
+ * @return an unmodifiable copy of the local registry
+ */
+ public Map getLocalRegistry() {
+ return Collections.unmodifiableMap(localRegistry);
+ }
+
+ /**
+ * Get the remote registry defined (if any)
+ * @return the currently defined remote registry
+ */
+ public Registry getRegistry() {
+ return registry;
+ }
+
+ /**
+ * Set the remote registry for the configuration
+ * @param registry the remote registry for the configuration
+ */
+ public void setRegistry(Registry registry) {
+ this.registry = registry;
+ }
+
+ /**
+ * Set the Axis2 AxisConfiguration to the SynapseConfiguration
+ * @param axisConfig
+ */
+ public void setAxisConfiguration(AxisConfiguration axisConfig) {
+ this.axisConfiguration = axisConfig;
+ }
+
+ /**
+ * Get the Axis2 AxisConfiguration for the SynapseConfiguration
+ * @return AxisConfiguration of the Axis2
+ */
+ public AxisConfiguration getAxisConfiguration() {
+ return axisConfiguration;
+ }
+
+ /**
+ * The path to the currently loaded configuration file
+ * @return file path to synapse.xml
+ */
+ public String getPathToConfigFile() {
+ return pathToConfigFile;
+ }
+
+ /**
+ * Set the path to the loaded synapse.xml
+ * @param pathToConfigFile path to the synapse.xml loaded
+ */
+ public void setPathToConfigFile(String pathToConfigFile) {
+ this.pathToConfigFile = pathToConfigFile;
+ }
+
+ private void handleException(String msg) {
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+}
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfigurationBuilder.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfigurationBuilder.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfigurationBuilder.java Sat Mar 17 09:18:32 2007
@@ -1,82 +1,82 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.config.xml.XMLConfigurationBuilder;
-import org.apache.synapse.mediators.base.SynapseMediator;
-import org.apache.synapse.mediators.builtin.SendMediator;
-
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.File;
-
-/**
- * Builds a Synapse Configuration model with a given input (e.g. XML, programmatic creation, default etc)
- */
-public class SynapseConfigurationBuilder implements Constants {
-
- private static Log log = LogFactory.getLog(SynapseConfigurationBuilder.class);
-
- /**
- * Return the default Synapse Configuration
- * @return the default configuration to be used
- */
- public static SynapseConfiguration getDefaultConfiguration() {
- // programatically create an empty configuration which just sends messages to thier implicit destinations
- SynapseConfiguration config = new SynapseConfiguration();
- SynapseMediator mainmediator = new SynapseMediator();
- mainmediator.addChild(new SendMediator());
- config.addSequence("main", mainmediator);
- return config;
- }
-
- /**
- * Build a Synapse configuration from a given XML configuration file
- *
- * @param configFile the XML configuration
- * @return the Synapse configuration model
- */
- public static SynapseConfiguration getConfiguration(String configFile) {
-
- // build the Synapse configuration parsing the XML config file
- try {
- SynapseConfiguration synCfg = XMLConfigurationBuilder.getConfiguration(new FileInputStream(configFile));
- log.info("Loaded Synapse configuration from : " + configFile);
- synCfg.setPathToConfigFile(new File(configFile).getAbsolutePath());
- return synCfg;
-
- } catch (FileNotFoundException fnf) {
- handleException("Cannot load Synapse configuration from : " + configFile, fnf);
- } catch (Exception e) {
- handleException("Could not initialize Synapse : " + e.getMessage(), e);
- }
- return null;
- }
-
- private static void handleException(String msg, Exception e) {
- log.error(msg, e);
- throw new SynapseException(msg, e);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.Constants;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.config.xml.XMLConfigurationBuilder;
+import org.apache.synapse.mediators.base.SynapseMediator;
+import org.apache.synapse.mediators.builtin.SendMediator;
+
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.File;
+
+/**
+ * Builds a Synapse Configuration model with a given input (e.g. XML, programmatic creation, default etc)
+ */
+public class SynapseConfigurationBuilder implements Constants {
+
+ private static Log log = LogFactory.getLog(SynapseConfigurationBuilder.class);
+
+ /**
+ * Return the default Synapse Configuration
+ * @return the default configuration to be used
+ */
+ public static SynapseConfiguration getDefaultConfiguration() {
+ // programatically create an empty configuration which just sends messages to thier implicit destinations
+ SynapseConfiguration config = new SynapseConfiguration();
+ SynapseMediator mainmediator = new SynapseMediator();
+ mainmediator.addChild(new SendMediator());
+ config.addSequence("main", mainmediator);
+ return config;
+ }
+
+ /**
+ * Build a Synapse configuration from a given XML configuration file
+ *
+ * @param configFile the XML configuration
+ * @return the Synapse configuration model
+ */
+ public static SynapseConfiguration getConfiguration(String configFile) {
+
+ // build the Synapse configuration parsing the XML config file
+ try {
+ SynapseConfiguration synCfg = XMLConfigurationBuilder.getConfiguration(new FileInputStream(configFile));
+ log.info("Loaded Synapse configuration from : " + configFile);
+ synCfg.setPathToConfigFile(new File(configFile).getAbsolutePath());
+ return synCfg;
+
+ } catch (FileNotFoundException fnf) {
+ handleException("Cannot load Synapse configuration from : " + configFile, fnf);
+ } catch (Exception e) {
+ handleException("Could not initialize Synapse : " + e.getMessage(), e);
+ }
+ return null;
+ }
+
+ private static void handleException(String msg, Exception e) {
+ log.error(msg, e);
+ throw new SynapseException(msg, e);
+ }
+}
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfigurationBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/Util.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/XMLToObjectMapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AbstractListMediatorFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AbstractListMediatorFactory.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AbstractListMediatorFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AbstractListMediatorFactory.java Sat Mar 17 09:18:32 2007
@@ -1,53 +1,53 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.xml;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.mediators.ListMediator;
-import org.apache.synapse.Mediator;
-
-import java.util.Iterator;
-
-/**
- * This implements the basic logic to build a list mediator from a given XML
- * configuration. It recursively builds the child mediators of the list.
- */
-public abstract class AbstractListMediatorFactory extends AbstractMediatorFactory {
-
- private static final Log log = LogFactory.getLog(AbstractListMediatorFactory.class);
-
- protected static void addChildren(OMElement el, ListMediator m) {
- Iterator it = el.getChildElements();
- while (it.hasNext()) {
- OMElement child = (OMElement) it.next();
- Mediator med = MediatorFactoryFinder.getInstance().getMediator(child);
- if (med != null) {
- m.addChild(med);
- } else {
- String msg = "Unknown mediator : " + child.getLocalName();
- log.error(msg);
- throw new SynapseException(msg);
- }
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.xml;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.mediators.ListMediator;
+import org.apache.synapse.Mediator;
+
+import java.util.Iterator;
+
+/**
+ * This implements the basic logic to build a list mediator from a given XML
+ * configuration. It recursively builds the child mediators of the list.
+ */
+public abstract class AbstractListMediatorFactory extends AbstractMediatorFactory {
+
+ private static final Log log = LogFactory.getLog(AbstractListMediatorFactory.class);
+
+ protected static void addChildren(OMElement el, ListMediator m) {
+ Iterator it = el.getChildElements();
+ while (it.hasNext()) {
+ OMElement child = (OMElement) it.next();
+ Mediator med = MediatorFactoryFinder.getInstance().getMediator(child);
+ if (med != null) {
+ m.addChild(med);
+ } else {
+ String msg = "Unknown mediator : " + child.getLocalName();
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+ }
+ }
+}
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AbstractListMediatorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AbstractListMediatorSerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AbstractMediatorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AbstractMediatorSerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AnonymousListMediator.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AnonymousListMediator.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AnonymousListMediator.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AnonymousListMediator.java Sat Mar 17 09:18:32 2007
@@ -1,35 +1,35 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.xml;
-
-import org.apache.synapse.mediators.AbstractListMediator;
-import org.apache.synapse.MessageContext;
-
-/**
- * This mediator represents an unnamed the list of mediator
- *
- */
-
-public class AnonymousListMediator extends AbstractListMediator {
-
- public boolean mediate(MessageContext synCtx) {
- return super.mediate(synCtx);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.xml;
+
+import org.apache.synapse.mediators.AbstractListMediator;
+import org.apache.synapse.MessageContext;
+
+/**
+ * This mediator represents an unnamed the list of mediator
+ *
+ */
+
+public class AnonymousListMediator extends AbstractListMediator {
+
+ public boolean mediate(MessageContext synCtx) {
+ return super.mediate(synCtx);
+ }
+
+}
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AnonymousListMediator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AnonymousListMediatorFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AnonymousListMediatorFactory.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AnonymousListMediatorFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AnonymousListMediatorFactory.java Sat Mar 17 09:18:32 2007
@@ -1,52 +1,52 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.xml;
-
-import org.apache.synapse.Mediator;
-import org.apache.synapse.SynapseException;
-import org.apache.axiom.om.OMElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-
-import java.util.Iterator;
-
-/**
- * This is factory for creating an anonymous list mediator(an unnamed list of mediators )
- *
- */
-
-public abstract class AnonymousListMediatorFactory extends AbstractListMediatorFactory {
-
- private static final Log log = LogFactory.getLog(AnonymousListMediator.class);
-
- /**
- * To create an anonymous list mediator form OMElement
- * @param el
- * @return List mediator
- */
- public static AnonymousListMediator createAnonymousListMediator(OMElement el) {
- AnonymousListMediator mediator = new AnonymousListMediator();
- {
- addChildren(el, mediator);
- }
- return mediator;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.xml;
+
+import org.apache.synapse.Mediator;
+import org.apache.synapse.SynapseException;
+import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+import java.util.Iterator;
+
+/**
+ * This is factory for creating an anonymous list mediator(an unnamed list of mediators )
+ *
+ */
+
+public abstract class AnonymousListMediatorFactory extends AbstractListMediatorFactory {
+
+ private static final Log log = LogFactory.getLog(AnonymousListMediator.class);
+
+ /**
+ * To create an anonymous list mediator form OMElement
+ * @param el
+ * @return List mediator
+ */
+ public static AnonymousListMediator createAnonymousListMediator(OMElement el) {
+ AnonymousListMediator mediator = new AnonymousListMediator();
+ {
+ addChildren(el, mediator);
+ }
+ return mediator;
+ }
+
+}
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AnonymousListMediatorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AnonymousListMediatorSerializer.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AnonymousListMediatorSerializer.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AnonymousListMediatorSerializer.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AnonymousListMediatorSerializer.java Sat Mar 17 09:18:32 2007
@@ -1,55 +1,55 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.xml;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.synapse.Mediator;
-import org.apache.synapse.SynapseException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * This is Serializer for serialization of an anonymous list mediator(an unnamed list of mediators )
- */
-
-public abstract class AnonymousListMediatorSerializer extends AbstractListMediatorSerializer {
-
- private static final Log log = LogFactory.getLog(AnonymousListMediatorSerializer.class);
-
- /**
- * To serialize an anonymous list mediator
- *
- * @param parent
- * @param m
- * @return OMElement
- */
- public static OMElement serializeAnonymousListMediator(OMElement parent, Mediator m) {
- if (!(m instanceof AnonymousListMediator)) {
- handleException("Unsupported mediator passed in for serialization : " + m.getType());
- }
- AnonymousListMediator mediator = (AnonymousListMediator) m;
- serializeChildren(parent, mediator.getList());
- return parent;
- }
-
- private static void handleException(String msg) {
- log.error(msg);
- throw new SynapseException(msg);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.xml;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.synapse.Mediator;
+import org.apache.synapse.SynapseException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * This is Serializer for serialization of an anonymous list mediator(an unnamed list of mediators )
+ */
+
+public abstract class AnonymousListMediatorSerializer extends AbstractListMediatorSerializer {
+
+ private static final Log log = LogFactory.getLog(AnonymousListMediatorSerializer.class);
+
+ /**
+ * To serialize an anonymous list mediator
+ *
+ * @param parent
+ * @param m
+ * @return OMElement
+ */
+ public static OMElement serializeAnonymousListMediator(OMElement parent, Mediator m) {
+ if (!(m instanceof AnonymousListMediator)) {
+ handleException("Unsupported mediator passed in for serialization : " + m.getType());
+ }
+ AnonymousListMediator mediator = (AnonymousListMediator) m;
+ serializeChildren(parent, mediator.getList());
+ return parent;
+ }
+
+ private static void handleException(String msg) {
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+}
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/AnonymousListMediatorSerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ClassMediatorFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ClassMediatorFactory.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ClassMediatorFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ClassMediatorFactory.java Sat Mar 17 09:18:32 2007
@@ -1,78 +1,78 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.xml;
-
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.Mediator;
-import org.apache.synapse.mediators.ext.ClassMediator;
-
-import javax.xml.namespace.QName;
-
-/**
- * Creates an instance of a Class mediator using XML configuration specified
- *
- * <pre>
- * <class name="class-name">
- * <property name="string" (value="literal" | expression="xpath")/>*
- * </class>
- * </pre>
- */
-public class ClassMediatorFactory extends AbstractMediatorFactory {
-
- private static final Log log = LogFactory.getLog(LogMediatorFactory.class);
-
- private static final QName CLASS_Q = new QName(Constants.SYNAPSE_NAMESPACE, "class");
-
- public Mediator createMediator(OMElement elem) {
-
- ClassMediator classMediator = new ClassMediator();
-
- OMAttribute name = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
- if (name == null) {
- String msg = "The name of the actual mediator class is a required attribute";
- log.error(msg);
- throw new SynapseException(msg);
- }
-
- try {
- Class clazz = getClass().getClassLoader().loadClass(name.getAttributeValue());
- classMediator.setClazz(clazz);
- } catch (ClassNotFoundException e) {
- String msg = "Cannot find class : " + name.getAttributeValue();
- log.error(msg, e);
- throw new SynapseException(msg, e);
- }
- // after successfully creating the mediator
- // set its common attributes such as tracing etc
- initMediator(classMediator,elem);
- classMediator.addAllProperties(MediatorPropertyFactory.getMediatorProperties(elem));
-
- return classMediator;
- }
-
-
- public QName getTagQName() {
- return CLASS_Q;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.xml;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.Mediator;
+import org.apache.synapse.mediators.ext.ClassMediator;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Creates an instance of a Class mediator using XML configuration specified
+ *
+ * <pre>
+ * <class name="class-name">
+ * <property name="string" (value="literal" | expression="xpath")/>*
+ * </class>
+ * </pre>
+ */
+public class ClassMediatorFactory extends AbstractMediatorFactory {
+
+ private static final Log log = LogFactory.getLog(LogMediatorFactory.class);
+
+ private static final QName CLASS_Q = new QName(Constants.SYNAPSE_NAMESPACE, "class");
+
+ public Mediator createMediator(OMElement elem) {
+
+ ClassMediator classMediator = new ClassMediator();
+
+ OMAttribute name = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
+ if (name == null) {
+ String msg = "The name of the actual mediator class is a required attribute";
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ try {
+ Class clazz = getClass().getClassLoader().loadClass(name.getAttributeValue());
+ classMediator.setClazz(clazz);
+ } catch (ClassNotFoundException e) {
+ String msg = "Cannot find class : " + name.getAttributeValue();
+ log.error(msg, e);
+ throw new SynapseException(msg, e);
+ }
+ // after successfully creating the mediator
+ // set its common attributes such as tracing etc
+ initMediator(classMediator,elem);
+ classMediator.addAllProperties(MediatorPropertyFactory.getMediatorProperties(elem));
+
+ return classMediator;
+ }
+
+
+ public QName getTagQName() {
+ return CLASS_Q;
+ }
+}
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ClassMediatorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ClassMediatorSerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/Constants.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/Constants.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/Constants.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/Constants.java Sat Mar 17 09:18:32 2007
@@ -1,101 +1,101 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.xml;
-
-import javax.xml.namespace.QName;
-
-/**
- * Constants used in the XML processing
- */
-public interface Constants {
- public static final QName DEFINITIONS_ELT
- = new QName(Constants.SYNAPSE_NAMESPACE, "definitions");
- public static final QName SEQUENCE_ELT
- = new QName(Constants.SYNAPSE_NAMESPACE, "sequence");
- public static final QName ENDPOINT_ELT
- = new QName(Constants.SYNAPSE_NAMESPACE, "endpoint");
- public static final QName ENTRY_ELT
- = new QName(Constants.SYNAPSE_NAMESPACE, "localEntry");
- public static final QName REGISTRY_ELT
- = new QName(Constants.SYNAPSE_NAMESPACE, "registry");
- public static final QName PROXY_ELT
- = new QName(Constants.SYNAPSE_NAMESPACE, "proxy");
-
- public static final String SYNAPSE_NAMESPACE
- = org.apache.synapse.Constants.SYNAPSE_NAMESPACE;
- public static final String NULL_NAMESPACE = "";
- public static final String RAMPART_POLICY = "rampartPolicy";
- public static final String SANDESHA_POLICY = "sandeshaPolicy";
-
- /** The Trace attribute name */
- public static final String TRACE_ATTRIB_NAME ="trace";
- /** The Trace value 'enable' */
- public static final String TRACE_ENABLE ="enable";
- /** The Trace value 'disable' */
- public static final String TRACE_DISABLE ="disable";
- /** The statistics attribute name */
- public static final String STATISTICS_ATTRIB_NAME ="statistics";
- /** The statistics value 'enable' */
- public static final String STATISTICS_ENABLE ="enable";
- /** The statistics value 'disable' */
- public static final String STATISTICS_DISABLE ="disable";
-
- // -- variables for the scoping of a property mediator --
- /** The String value for an Axis2 messagecontext property */
- public static final String SCOPE_AXIS2 = org.apache.synapse.Constants.SCOPE_AXIS2;
- /**
- * The scope for a set-property mediator, when the property should be set
- * on the underlying transport
- */
- String SCOPE_TRANSPORT = org.apache.synapse.Constants.SCOPE_TRANSPORT;
-
- // -- Synapse message context property keys --
- /** The scope for the synapse message context properties */
- String SCOPE_DEFAULT = org.apache.synapse.Constants.SCOPE_DEFAULT;
-
-
- // -- Synapse property values for WS-RM sequence handling --
- /** The String value for a WS-RM version 1.0*/
- public static final String SEQUENCE_VERSION_1_0
- = org.apache.synapse.Constants.SEQUENCE_VERSION_1_0;
- /** The String value for a WS-RM version 1.1*/
- public static final String SEQUENCE_VERSION_1_1
- = org.apache.synapse.Constants.SEQUENCE_VERSION_1_1;
-
- // -- Synapse Send mediator releated constants -- //
- String SEND_ELEMENT = "send";
- String LOADBALANCE_ELEMENT = "loadbalance";
- /** failover only element */
- String FAILOVER_ELEMENT = "failover";
- String RETRY_AFTER_FAILURE_TIME = "retryAfterFailure";
- String MAXIMUM_RETRIES = "maximumRetries";
- String RETRY_INTERVAL = "retryInterval";
- /** failover attribute in the loadbalance element */
- String FAILOVER = "failover";
- String SESSION_AFFINITY = "sessionAffinity";
- String ALGORITHM_NAME = "policy";
- /** failover group element inside the loadbalance element */
- String FAILOVER_GROUP_ELEMENT = "failover";
- String DISPATCH_MANAGER = "DISPATCH_MANAGER";
- String DISPATCHERS_ELEMENT = "dispatchers";
- String DISPATCHER_ELEMENT = "dispatcher";
- QName ATT_KEY_Q = new QName(NULL_NAMESPACE, "key");
- QName ATT_ADDRESS_Q = new QName(NULL_NAMESPACE, "address");
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.xml;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Constants used in the XML processing
+ */
+public interface Constants {
+ public static final QName DEFINITIONS_ELT
+ = new QName(Constants.SYNAPSE_NAMESPACE, "definitions");
+ public static final QName SEQUENCE_ELT
+ = new QName(Constants.SYNAPSE_NAMESPACE, "sequence");
+ public static final QName ENDPOINT_ELT
+ = new QName(Constants.SYNAPSE_NAMESPACE, "endpoint");
+ public static final QName ENTRY_ELT
+ = new QName(Constants.SYNAPSE_NAMESPACE, "localEntry");
+ public static final QName REGISTRY_ELT
+ = new QName(Constants.SYNAPSE_NAMESPACE, "registry");
+ public static final QName PROXY_ELT
+ = new QName(Constants.SYNAPSE_NAMESPACE, "proxy");
+
+ public static final String SYNAPSE_NAMESPACE
+ = org.apache.synapse.Constants.SYNAPSE_NAMESPACE;
+ public static final String NULL_NAMESPACE = "";
+ public static final String RAMPART_POLICY = "rampartPolicy";
+ public static final String SANDESHA_POLICY = "sandeshaPolicy";
+
+ /** The Trace attribute name */
+ public static final String TRACE_ATTRIB_NAME ="trace";
+ /** The Trace value 'enable' */
+ public static final String TRACE_ENABLE ="enable";
+ /** The Trace value 'disable' */
+ public static final String TRACE_DISABLE ="disable";
+ /** The statistics attribute name */
+ public static final String STATISTICS_ATTRIB_NAME ="statistics";
+ /** The statistics value 'enable' */
+ public static final String STATISTICS_ENABLE ="enable";
+ /** The statistics value 'disable' */
+ public static final String STATISTICS_DISABLE ="disable";
+
+ // -- variables for the scoping of a property mediator --
+ /** The String value for an Axis2 messagecontext property */
+ public static final String SCOPE_AXIS2 = org.apache.synapse.Constants.SCOPE_AXIS2;
+ /**
+ * The scope for a set-property mediator, when the property should be set
+ * on the underlying transport
+ */
+ String SCOPE_TRANSPORT = org.apache.synapse.Constants.SCOPE_TRANSPORT;
+
+ // -- Synapse message context property keys --
+ /** The scope for the synapse message context properties */
+ String SCOPE_DEFAULT = org.apache.synapse.Constants.SCOPE_DEFAULT;
+
+
+ // -- Synapse property values for WS-RM sequence handling --
+ /** The String value for a WS-RM version 1.0*/
+ public static final String SEQUENCE_VERSION_1_0
+ = org.apache.synapse.Constants.SEQUENCE_VERSION_1_0;
+ /** The String value for a WS-RM version 1.1*/
+ public static final String SEQUENCE_VERSION_1_1
+ = org.apache.synapse.Constants.SEQUENCE_VERSION_1_1;
+
+ // -- Synapse Send mediator releated constants -- //
+ String SEND_ELEMENT = "send";
+ String LOADBALANCE_ELEMENT = "loadbalance";
+ /** failover only element */
+ String FAILOVER_ELEMENT = "failover";
+ String RETRY_AFTER_FAILURE_TIME = "retryAfterFailure";
+ String MAXIMUM_RETRIES = "maximumRetries";
+ String RETRY_INTERVAL = "retryInterval";
+ /** failover attribute in the loadbalance element */
+ String FAILOVER = "failover";
+ String SESSION_AFFINITY = "sessionAffinity";
+ String ALGORITHM_NAME = "policy";
+ /** failover group element inside the loadbalance element */
+ String FAILOVER_GROUP_ELEMENT = "failover";
+ String DISPATCH_MANAGER = "DISPATCH_MANAGER";
+ String DISPATCHERS_ELEMENT = "dispatchers";
+ String DISPATCHER_ELEMENT = "dispatcher";
+ QName ATT_KEY_Q = new QName(NULL_NAMESPACE, "key");
+ QName ATT_ADDRESS_Q = new QName(NULL_NAMESPACE, "address");
+}
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/Constants.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/DropMediatorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/DropMediatorSerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/EntryFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/EntrySerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org