Author: pzf
Date: Mon Jul 30 05:38:41 2007
New Revision: 560949
URL: http://svn.apache.org/viewvc?view=rev&rev=560949
Log:
updated synapse to support pluggable configuration XML file types see JIRA
https://issues.apache.org/jira/browse/SYNAPSE-111
Added:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ConfigurationFactory.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ConfigurationFactoryAndSerializerFinder.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ConfigurationSerializer.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationSerializer.java
Added:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ConfigurationFactory.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ConfigurationFactory.java?view=auto&rev=560949
==============================================================================
---
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ConfigurationFactory.java
(added)
+++
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ConfigurationFactory.java
Mon Jul 30 05:38:41 2007
@@ -0,0 +1,14 @@
+package org.apache.synapse.config.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.synapse.config.SynapseConfiguration;
+
+public interface ConfigurationFactory {
+
+ QName getTagQName();
+ SynapseConfiguration getConfiguration(OMElement element);
+ Class getSerializerClass();
+
+}
Added:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ConfigurationFactoryAndSerializerFinder.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ConfigurationFactoryAndSerializerFinder.java?view=auto&rev=560949
==============================================================================
---
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ConfigurationFactoryAndSerializerFinder.java
(added)
+++
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ConfigurationFactoryAndSerializerFinder.java
Mon Jul 30 05:38:41 2007
@@ -0,0 +1,244 @@
+/*
+ * 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.axiom.om.OMNode;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.config.SynapseConfiguration;
+import org.apache.synapse.config.XMLToObjectMapper;
+import sun.misc.Service;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ *
+ *
+ * This class is based on J2SE Service Provider model
+ * http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider
+ *
+ * It deals with both the problem of turning an XML into a Synapse config and
vice-versa
+ */
+
+/**
+ * @author paul
+ *
+ */
+public class ConfigurationFactoryAndSerializerFinder implements
XMLToObjectMapper {
+
+ private static final Log log =
LogFactory.getLog(ConfigurationFactoryAndSerializerFinder.class);
+
+ private static final Class[] configurationFactories = {
+ SynapseXMLConfigurationFactory.class,
+ };
+
+
+ private static ConfigurationFactoryAndSerializerFinder instance = null;
+
+ /**
+ * A map of mediator QNames to implementation class
+ */
+ private static Map factoryMap = new HashMap(), serializerMap = new
HashMap();
+
+ public static synchronized ConfigurationFactoryAndSerializerFinder
getInstance() {
+ if (instance == null) {
+ instance = new ConfigurationFactoryAndSerializerFinder();
+ }
+ return instance;
+ }
+
+ /**
+ * Force re initialization next time
+ */
+ public synchronized void reset() {
+ factoryMap.clear();
+ instance = null;
+ }
+
+ private ConfigurationFactoryAndSerializerFinder() {
+
+ factoryMap = new HashMap();
+
+ for (int i = 0; i < configurationFactories.length; i++) {
+ Class c = configurationFactories[i];
+ try {
+ ConfigurationFactory fac = (ConfigurationFactory)
c.newInstance();
+ factoryMap.put(fac.getTagQName(), c);
+ serializerMap.put(fac.getTagQName(), fac.getSerializerClass());
+ } catch (Exception e) {
+ throw new SynapseException("Error instantiating
" + c.getName(), e);
+ }
+ }
+ // now iterate through the available pluggable mediator factories
+ registerExtensions();
+ }
+
+ private void handleException(String msg, Exception e) {
+ log.error(msg, e);
+ throw new SynapseException(msg, e);
+ }
+
+ private void handleException(String msg) {
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ /**
+ * Register pluggable mediator factories from the classpath
+ *
+ * This looks for JAR files containing a META-INF/services that adheres to
the following
+ * http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider
+ */
+ private void registerExtensions() {
+
+ //log.debug("Registering mediator extensions found in the classpath :
" + System.getResource("java.class.path"));
+
+ // register MediatorFactory extensions
+ Iterator it = Service.providers(ConfigurationFactory.class);
+ while (it.hasNext()) {
+ ConfigurationFactory cf = (ConfigurationFactory) it.next();
+ QName tag = cf.getTagQName();
+ factoryMap.put(tag, cf.getClass());
+ serializerMap.put(tag, cf.getSerializerClass());
+ if (log.isDebugEnabled()) {
+ log.debug("Added MediatorFactory " + cf.getClass() + " to
handle " + tag);
+ }
+ }
+ }
+
+ /**
+ * This method returns a Processor given an OMElement. This will be used
+ * recursively by the elements which contain processor elements
themselves
+ * (e.g. rules)
+ *
+ * @param element
+ * @return Processor
+ */
+ public SynapseConfiguration getConfiguration(OMElement element) {
+
+ String localName = element.getLocalName();
+ QName qName = null;
+ if (element.getNamespace() != null) {
+ qName = new QName(element.getNamespace().getNamespaceURI(),
localName);
+ } else {
+ qName = new QName(localName);
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("getConfiguration(" + qName + ")");
+ }
+ Class cls = (Class) factoryMap.get(qName);
+
+
+
+ if (cls == null) {
+ String msg = "Unknown Configuration type referenced by
configuration element : " + qName;
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ try {
+ ConfigurationFactory cf = (ConfigurationFactory)
cls.newInstance();
+ return cf.getConfiguration(element);
+
+ } catch (InstantiationException e) {
+ String msg = "Error initializing configuration factory : " + cls;
+ log.error(msg);
+ throw new SynapseException(msg, e);
+
+ } catch (IllegalAccessException e) {
+ String msg = "Error initializing configuration factory : " + cls;
+ log.error(msg);
+ throw new SynapseException(msg, e);
+ }
+ }
+
+ public static void serializeConfiguration(SynapseConfiguration synCfg,
OutputStream outputStream) throws XMLStreamException {
+ if (synCfg.getDefaultQName()==null) {
+ serializeConfiguration(synCfg,
Constants.DEFINITIONS_ELT, outputStream);
+ }
+ else {
+ serializeConfiguration(synCfg,
synCfg.getDefaultQName(), outputStream);
+ }
+ }
+
+ /**
+ * This method will serialize the config using the supplied QName
(looking up the right class to do it)
+ * @param synCfg
+ * @param qName
+ * @param outputStream
+ * @throws XMLStreamException
+ */
+ public static void serializeConfiguration(SynapseConfiguration synCfg,
QName qName,
+ OutputStream outputStream) throws XMLStreamException {
+
+ Class cls = (Class) serializerMap.get(qName);
+ if (cls == null) {
+ String msg = "Unknown Configuration type referenced by
configuration element : " + qName;
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ try {
+ ConfigurationSerializer cs =
(ConfigurationSerializer) cls.newInstance();
+ cs.serializeConfiguration(synCfg, outputStream);
+
+ } catch (InstantiationException e) {
+ String msg = "Error initializing configuration factory : "
+ cls;
+ log.error(msg);
+ throw new SynapseException(msg, e);
+
+ } catch (IllegalAccessException e) {
+ String msg = "Error initializing configuration factory : "
+ cls;
+ log.error(msg);
+ throw new SynapseException(msg, e);
+ }
+ }
+
+ /*
+ This method exposes all the MediatorFactories and its Extensions
+ */
+ public Map getFactoryMap() {
+ return factoryMap;
+ }
+
+ /**
+ * Allow the mediator factory finder to act as an XMLToObjectMapper for
Mediators
+ * (i.e. Sequence Mediator) loaded dynamically from a Registry
+ * @param om
+ * @return
+ */
+ public Object getObjectFromOMNode(OMNode om) {
+ if (om instanceof OMElement) {
+ return getConfiguration((OMElement) om);
+ } else {
+ handleException("Invalid configuration XML : " + om);
+ }
+ return null;
+ }
+}
Added:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ConfigurationSerializer.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ConfigurationSerializer.java?view=auto&rev=560949
==============================================================================
---
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ConfigurationSerializer.java
(added)
+++
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ConfigurationSerializer.java
Mon Jul 30 05:38:41 2007
@@ -0,0 +1,16 @@
+package org.apache.synapse.config.xml;
+
+import java.io.OutputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.synapse.config.SynapseConfiguration;
+
+public interface ConfigurationSerializer {
+
+ void serializeConfiguration(SynapseConfiguration synCfg, OutputStream
outputStream) throws XMLStreamException;
+
+ QName getTagQName();
+
+}
Added:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java?view=auto&rev=560949
==============================================================================
---
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java
(added)
+++
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java
Mon Jul 30 05:38:41 2007
@@ -0,0 +1,203 @@
+package org.apache.synapse.config.xml;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.Mediator;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.config.Entry;
+import org.apache.synapse.config.SynapseConfiguration;
+import org.apache.synapse.config.Util;
+import org.apache.synapse.config.xml.endpoints.EndpointAbstractFactory;
+import org.apache.synapse.core.axis2.ProxyService;
+import org.apache.synapse.endpoints.Endpoint;
+import org.apache.synapse.mediators.base.SequenceMediator;
+import org.apache.synapse.mediators.builtin.LogMediator;
+import org.apache.synapse.mediators.builtin.SendMediator;
+
+public class SynapseXMLConfigurationFactory implements ConfigurationFactory {
+ private static Log log =
LogFactory.getLog(SynapseXMLConfigurationFactory.class);
+
+ public SynapseConfiguration getConfiguration(OMElement definitions) {
+ if (!definitions.getQName().equals(Constants.DEFINITIONS_ELT))
throw new SynapseException("Wrong QName for this config factory
"+definitions.getQName());
+
+
+ SynapseConfiguration config = new SynapseConfiguration();
+ config.setDefaultQName(definitions.getQName());
+ SequenceMediator rootSequence = new SequenceMediator();
+ rootSequence.setName(org.apache.synapse.Constants.MAIN_SEQUENCE_KEY);
+
+
+
+ Iterator iter = definitions.getChildren();
+
+ while (iter.hasNext()) {
+ Object o = iter.next();
+ if (o instanceof OMElement) {
+ OMElement elt = (OMElement) o;
+ if (Constants.SEQUENCE_ELT.equals(elt.getQName())) {
+ String key = elt.getAttributeValue(
+ new QName(Constants.NULL_NAMESPACE, "key"));
+ // this could be a sequence def or a mediator of
the main sequence
+ if (key != null) {
+ Mediator m =
MediatorFactoryFinder.getInstance().getMediator(elt);
+ rootSequence.addChild(m);
+ } else {
+ defineSequence(config, elt);
+ }
+ } else if
(Constants.ENDPOINT_ELT.equals(elt.getQName())) {
+ defineEndpoint(config, elt);
+ } else if (Constants.ENTRY_ELT.equals(elt.getQName()))
{
+ defineEntry(config, elt);
+ } else if (Constants.PROXY_ELT.equals(elt.getQName()))
{
+ defineProxy(config, elt);
+ } else if
(Constants.REGISTRY_ELT.equals(elt.getQName())) {
+ defineRegistry(config, elt);
+ } else {
+ Mediator m =
MediatorFactoryFinder.getInstance().getMediator(elt);
+ rootSequence.addChild(m);
+ }
+ }
+ }
+
+
+
+ if (config.getLocalRegistry().isEmpty() &&
config.getProxyServices().isEmpty() &&
+ rootSequence.getList().isEmpty() && config.getRegistry() !=
null) {
+ OMNode remoteConfigNode =
config.getRegistry().lookup("synapse.xml");
+ try {
+ config =
XMLConfigurationBuilder.getConfiguration(Util.getStreamSource(remoteConfigNode).getInputStream());
+ } catch (XMLStreamException xse) {
+ throw new SynapseException("Problem loading remote synapse.xml
",xse);
+ }
+
+ }
+
+ if (config.getMainSequence() == null) {
+ if (rootSequence.getList().isEmpty()) {
+ setDefaultMainSequence(config);
+ } else {
+ config.addSequence(rootSequence.getName(), rootSequence);
+ }
+ } else if (!rootSequence.getList().isEmpty()) {
+ handleException("Invalid Synapse Configuration : Conflict in
resolving the \"main\" " +
+ "mediator\n\tSynapse Configuration cannot have sequence
named \"main\" and " +
+ "toplevel mediators simultaniously");
+ }
+
+ if (config.getFaultSequence() == null) {
+ setDefaultFaultSequence(config);
+ }
+
+ return config;
+ }
+
+ private static void defineRegistry(SynapseConfiguration config, OMElement
elem) {
+ if (config.getRegistry() != null) {
+ handleException("Only one remote registry can be defined within a
configuration");
+ }
+ config.setRegistry(RegistryFactory.createRegistry(elem));
+ }
+
+ private static void defineProxy(SynapseConfiguration config, OMElement
elem) {
+ ProxyService proxy = ProxyServiceFactory.createProxy(elem);
+ if (config.getProxyService(proxy.getName()) != null) {
+ handleException("Duplicate proxy service with name : " +
proxy.getName());
+ }
+ config.addProxyService(proxy.getName(), proxy);
+ }
+
+ private static void defineEntry(SynapseConfiguration config, OMElement
elem) {
+ Entry entry = EntryFactory.createEntry(elem);
+ if (config.getLocalRegistry().get(entry.getKey()) != null) {
+ handleException("Duplicate registry entry definition for key : " +
entry.getKey());
+ }
+ config.addEntry(entry.getKey(), entry);
+ }
+
+ public static void defineSequence(SynapseConfiguration config, OMElement
ele) {
+
+ String name = ele.getAttributeValue(new
QName(Constants.NULL_NAMESPACE, "name"));
+ if (name != null) {
+ if (config.getLocalRegistry().get(name) != null) {
+ handleException("Duplicate sequence definition : " + name);
+ }
+ config.addSequence(name,
MediatorFactoryFinder.getInstance().getMediator(ele));
+ } else {
+ handleException("Invalid sequence definition without a name");
+ }
+ }
+
+ public static void defineEndpoint(SynapseConfiguration config, OMElement
ele) {
+
+ String name = ele.getAttributeValue(new
QName(Constants.NULL_NAMESPACE, "name"));
+ if (name != null) {
+ if (config.getLocalRegistry().get(name.trim()) != null) {
+ handleException("Duplicate endpoint definition : " + name);
+ }
+ Endpoint endpoint =
+
EndpointAbstractFactory.getEndpointFactroy(ele).createEndpoint(ele, false);
+ config.addEndpoint(name.trim(), endpoint);
+ } else {
+ handleException("Invalid endpoint definition without a name");
+ }
+ }
+
+ /**
+ * Return the main sequence if one is not defined. This implementation
defaults to
+ * a simple sequence with a <send/>
+ *
+ * @param config the configuration to be updated
+ */
+ private static void setDefaultMainSequence(SynapseConfiguration config) {
+ SequenceMediator main = new SequenceMediator();
+ main.setName(org.apache.synapse.Constants.MAIN_SEQUENCE_KEY);
+ main.addChild(new SendMediator());
+ config.addSequence(org.apache.synapse.Constants.MAIN_SEQUENCE_KEY,
main);
+ }
+
+ /**
+ * Return the fault sequence if one is not defined. This implementation
defaults to
+ * a simple sequence with a <log level="full"/>
+ *
+ * @param config the configuration to be updated
+ */
+ private static void setDefaultFaultSequence(SynapseConfiguration config) {
+ SequenceMediator fault = new SequenceMediator();
+ fault.setName(org.apache.synapse.Constants.FAULT_SEQUENCE_KEY);
+ LogMediator log = new LogMediator();
+ log.setLogLevel(LogMediator.FULL);
+ fault.addChild(log);
+ config.addSequence(org.apache.synapse.Constants.FAULT_SEQUENCE_KEY,
fault);
+ }
+
+ private static void handleException(String msg) {
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ private static void handleException(String msg, Exception e) {
+ log.error(msg, e);
+ throw new SynapseException(msg, e);
+ }
+
+
+ public QName getTagQName() {
+
+ return Constants.DEFINITIONS_ELT;
+ }
+
+ public Class getSerializerClass() {
+ return SynapseXMLConfigurationSerializer.class;
+ }
+
+}
Added:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationSerializer.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationSerializer.java?view=auto&rev=560949
==============================================================================
---
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationSerializer.java
(added)
+++
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationSerializer.java
Mon Jul 30 05:38:41 2007
@@ -0,0 +1,133 @@
+package org.apache.synapse.config.xml;
+
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.Mediator;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.config.Entry;
+import org.apache.synapse.config.SynapseConfiguration;
+import org.apache.synapse.config.xml.endpoints.EndpointAbstractSerializer;
+import org.apache.synapse.core.axis2.ProxyService;
+import org.apache.synapse.endpoints.Endpoint;
+
+public class SynapseXMLConfigurationSerializer implements
ConfigurationSerializer {
+
+
+
+ private static final Log log =
LogFactory.getLog(XMLConfigurationSerializer.class);
+
+ private static final OMFactory fac =
OMAbstractFactory.getOMFactory();
+ private static final OMNamespace synNS =
fac.createOMNamespace(Constants.SYNAPSE_NAMESPACE, "syn");
+ private static final OMNamespace nullNS =
fac.createOMNamespace(Constants.NULL_NAMESPACE, "");
+
+ /**
+ * order of entries is irrelavant, however its nice to have some
order
+ * @param synCfg
+ * @param outputStream
+ * @throws XMLStreamException
+ */
+
+ public void serializeConfiguration(SynapseConfiguration synCfg,
+ OutputStream outputStream) throws XMLStreamException {
+
+ OMElement definitions = fac.createOMElement("definitions",
synNS);
+
+ // first process a remote registry if present
+ if (synCfg.getRegistry() != null) {
+ RegistrySerializer.serializeRegistry(definitions,
synCfg.getRegistry());
+ }
+
+ // add proxy services
+ Iterator iter = synCfg.getProxyServices().iterator();
+ while (iter.hasNext()) {
+ ProxyService service = (ProxyService) iter.next();
+ ProxyServiceSerializer.serializeProxy(definitions, service);
+ }
+
+ Map entries = new HashMap();
+ Map endpoints = new HashMap();
+ Map sequences = new HashMap();
+
+ iter = synCfg.getLocalRegistry().keySet().iterator();
+ while (iter.hasNext()) {
+ Object key = iter.next();
+ Object o = synCfg.getLocalRegistry().get(key);
+ if (o instanceof Mediator) {
+ sequences.put(key, o);
+ } else if (o instanceof Endpoint) {
+ endpoints.put(key, o);
+ } else if (o instanceof Entry) {
+ entries.put(key, o);
+ } else {
+ handleException("Unknown object : " + o.getClass()
+ + " for serialization into Synapse configuration");
+ }
+ }
+
+ // process entries
+ serializeEntries(definitions, entries);
+
+ // process endpoints
+ serializeEndpoints(definitions, endpoints);
+
+ // process sequences
+ serializeSequences(definitions, sequences);
+
+ definitions.serialize(outputStream);
+ }
+
+ private static void serializeEntries(OMElement definitions, Map
entries) {
+ Iterator iter = entries.keySet().iterator();
+ while (iter.hasNext()) {
+ String key = (String) iter.next();
+ EntrySerializer.serializeEntry((Entry) entries.get(key),
definitions);
+ }
+ }
+
+ private static void serializeEndpoints(OMElement definitions, Map
endpoints) {
+ Iterator iter = endpoints.keySet().iterator();
+ while (iter.hasNext()) {
+ String key = (String) iter.next();
+ Object o = endpoints.get(key);
+ if (o instanceof Endpoint) {
+ Endpoint endpoint = (Endpoint) o;
+ OMElement epElement = EndpointAbstractSerializer.
+
getEndpointSerializer(endpoint).serializeEndpoint(endpoint);
+ definitions.addChild(epElement);
+ }
+
+ }
+ }
+
+ private static void serializeSequences(OMElement definitions, Map
sequences) {
+ Iterator iter = sequences.keySet().iterator();
+ while (iter.hasNext()) {
+ String key = (String) iter.next();
+ Mediator mediator = (Mediator) sequences.get(key);
+
MediatorSerializerFinder.getInstance().getSerializer(mediator)
+ .serializeMediator(definitions, mediator);
+ }
+ }
+
+ private static void handleException(String msg) {
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ public QName getTagQName() {
+ return Constants.DEFINITIONS_ELT;
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]