You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ru...@apache.org on 2010/03/05 18:24:39 UTC
svn commit: r919513 -
/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationSerializer.java
Author: ruwan
Date: Fri Mar 5 17:24:39 2010
New Revision: 919513
URL: http://svn.apache.org/viewvc?rev=919513&view=rev
Log:
Fixing an issue with full configuration serialization
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationSerializer.java
Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationSerializer.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationSerializer.java?rev=919513&r1=919512&r2=919513&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationSerializer.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationSerializer.java Fri Mar 5 17:24:39 2010
@@ -19,6 +19,7 @@
package org.apache.synapse.config.xml;
+import org.apache.synapse.ServerManager;
import org.apache.synapse.config.SynapseConfiguration;
import org.apache.synapse.config.Entry;
import org.apache.synapse.config.xml.eventing.EventSourceSerializer;
@@ -45,6 +46,7 @@
import java.io.File;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.OutputStream;
import java.util.GregorianCalendar;
import java.util.Collection;
@@ -80,6 +82,7 @@
OMElement definitions = fac.createOMElement("definitions", synNS);
try {
+ markConfigurationForSerialization();
// TO start with clean up the existing configuration files
cleanUpDirectory();
createDirectoryStructure();
@@ -116,6 +119,61 @@
}
}
+ private void markConfigurationForSerialization() throws IOException {
+
+ // get the existing configuration and mark those files to be not to effect on deployers for deletion
+ SynapseConfiguration synCfg = ServerManager.getInstance()
+ .getServerContextInformation().getSynapseConfiguration();
+
+ for (SequenceMediator seq : synCfg.getDefinedSequences().values()) {
+ if (seq.getFileName() != null) {
+ deploymentStore.addBackedUpArtifact((new File(rootDirectory,
+ MultiXMLConfigurationBuilder.SEQUENCES_DIR)).getCanonicalPath()
+ + seq.getFileName());
+ }
+ }
+
+ for (Endpoint ep : synCfg.getDefinedEndpoints().values()) {
+ if (ep.getFileName() != null) {
+ deploymentStore.addBackedUpArtifact((new File(rootDirectory,
+ MultiXMLConfigurationBuilder.ENDPOINTS_DIR)).getCanonicalPath()
+ + ep.getFileName());
+ }
+ }
+
+ for (ProxyService proxy : synCfg.getProxyServices()) {
+ if (proxy.getFileName() != null) {
+ deploymentStore.addBackedUpArtifact((new File(rootDirectory,
+ MultiXMLConfigurationBuilder.PROXY_SERVICES_DIR)).getCanonicalPath()
+ + proxy.getFileName());
+ }
+ }
+
+ for (Entry e : synCfg.getDefinedEntries().values()) {
+ if (e.getFileName() != null) {
+ deploymentStore.addBackedUpArtifact((new File(rootDirectory,
+ MultiXMLConfigurationBuilder.LOCAL_ENTRY_DIR)).getCanonicalPath()
+ + e.getFileName());
+ }
+ }
+
+ for (SynapseEventSource es : synCfg.getEventSources()) {
+ if (es.getFileName() != null) {
+ deploymentStore.addBackedUpArtifact((new File(rootDirectory,
+ MultiXMLConfigurationBuilder.EVENTS_DIR)).getCanonicalPath()
+ + es.getFileName());
+ }
+ }
+
+ for (Startup s : synCfg.getStartups()) {
+ if (s.getFileName() != null) {
+ deploymentStore.addBackedUpArtifact((new File(rootDirectory,
+ MultiXMLConfigurationBuilder.TASKS_DIR)).getCanonicalPath()
+ + s.getFileName());
+ }
+ }
+ }
+
public void createDirectoryStructure() throws Exception {
File proxyDir = new File(rootDirectory, MultiXMLConfigurationBuilder.PROXY_SERVICES_DIR);