/** * Allow the mediator factory finder to act as an XMLToObjectMapper for Mediators * (i.e. Sequence Mediator) loaded dynamically from a Registry * * @param om configuration from which the object is built * @param properties bag of properties to pass in any information to the factory * @return built object */ public Object getObjectFromOMNode(OMNode om, Properties properties) { if (om instanceof OMElement) { return getConfiguration((OMElement) om, properties); } else { handleException("Invalid configuration XML : " + om); } return null; } }
public static synchronized ConfigurationFactoryAndSerializerFinder getInstance() { if (!initialized) { loadConfigurationFatoriesAndSerializers(); } return instance; }
public static SynapseConfiguration getConfiguration(InputStream is, Properties properties) throws XMLStreamException { log.info("Generating the Synapse configuration model by parsing the XML configuration"); OMElement definitions = OMXMLBuilderFactory.createOMBuilder(is).getDocumentElement(); definitions.build(); return ConfigurationFactoryAndSerializerFinder.getInstance() .getConfiguration(definitions, properties); } }
/** * @param synCfg * @return */ public static OMElement serializeConfiguration(SynapseConfiguration synCfg) { if (synCfg.getDefaultQName() == null) { return serializeConfiguration(synCfg, XMLConfigConstants.DEFINITIONS_ELT); } else { return serializeConfiguration(synCfg, synCfg.getDefaultQName()); } }
private static void loadConfigurationFatoriesAndSerializers() { for (Class c : configurationFactories) { if (c != null) { 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 plugable mediator factories registerExtensions(); initialized = true; } /**
public static SynapseConfiguration getConfiguration(InputStream is, Properties properties) throws XMLStreamException { log.info("Generating the Synapse configuration model by parsing the XML configuration"); OMElement definitions = new StAXOMBuilder(is).getDocumentElement(); definitions.build(); return ConfigurationFactoryAndSerializerFinder.getInstance() .getConfiguration(definitions, properties); } }
/** * @param synCfg * @return */ public static OMElement serializeConfiguration(SynapseConfiguration synCfg) { if (synCfg.getDefaultQName() == null) { return serializeConfiguration(synCfg, XMLConfigConstants.DEFINITIONS_ELT); } else { return serializeConfiguration(synCfg, synCfg.getDefaultQName()); } }
private static void loadConfigurationFatoriesAndSerializers() { for (Class c : configurationFactories) { if (c != null) { 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 plugable mediator factories registerExtensions(); initialized = true; } /**
/** * Allow the mediator factory finder to act as an XMLToObjectMapper for Mediators * (i.e. Sequence Mediator) loaded dynamically from a Registry * * @param om configuration from which the object is built * @param properties bag of properties to pass in any information to the factory * @return built object */ public Object getObjectFromOMNode(OMNode om, Properties properties) { if (om instanceof OMElement) { return getConfiguration((OMElement) om, properties); } else { handleException("Invalid configuration XML : " + om); } return null; } }
/** * Order of entries is irrelevant, however its nice to have some order. * @param synCfg * @param outputStream * @throws XMLStreamException */ public static void serializeConfiguration(SynapseConfiguration synCfg, OutputStream outputStream) throws XMLStreamException { if (log.isDebugEnabled()) { log.debug("Serializing the XML Configuration to the output stream"); } OMElement definitions = ConfigurationFactoryAndSerializerFinder.serializeConfiguration(synCfg); definitions.serialize(outputStream); }
public static synchronized ConfigurationFactoryAndSerializerFinder getInstance() { if (!initialized) { loadConfigurationFatoriesAndSerializers(); } return instance; }
/** * Order of entries is irrelevant, however its nice to have some order. * @param synCfg * @param outputStream * @throws XMLStreamException */ public static void serializeConfiguration(SynapseConfiguration synCfg, OutputStream outputStream) throws XMLStreamException { if (log.isDebugEnabled()) { log.debug("Serializing the XML Configuration to the output stream"); } OMElement definitions = ConfigurationFactoryAndSerializerFinder.serializeConfiguration(synCfg); definitions.serialize(outputStream); }