You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by su...@apache.org on 2011/03/07 12:37:23 UTC
svn commit: r1078748 - in /synapse/trunk/java/modules/core/src:
main/java/org/apache/synapse/config/xml/MultiXMLConfigurationBuilder.java
main/java/org/apache/synapse/endpoints/EndpointTemplate.java
test/java/org/apache/synapse/util/PropertyGenTest.java
Author: supun
Date: Mon Mar 7 11:37:22 2011
New Revision: 1078748
URL: http://svn.apache.org/viewvc?rev=1078748&view=rev
Log:
displaying an error message with the file name in case of an error happens during the loading of configuration
Added:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/EndpointTemplate.java
synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/util/PropertyGenTest.java
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationBuilder.java
Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationBuilder.java?rev=1078748&r1=1078747&r2=1078748&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationBuilder.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationBuilder.java Mon Mar 7 11:37:22 2011
@@ -26,6 +26,7 @@ import org.apache.commons.logging.LogFac
import org.apache.synapse.Mediator;
import org.apache.synapse.Startup;
import org.apache.synapse.SynapseConstants;
+import org.apache.synapse.SynapseException;
import org.apache.synapse.message.store.MessageStore;
import org.apache.synapse.commons.executors.PriorityExecutor;
import org.apache.synapse.config.Entry;
@@ -136,6 +137,9 @@ public class MultiXMLConfigurationBuilde
try {
return XMLConfigurationBuilder.getConfiguration(
new FileInputStream(synapseXML), properties);
+ } catch (SynapseException e) {
+ log.error("Error while loading the configuration from file: " + synapseXML.getName());
+ throw e;
} catch (FileNotFoundException ignored) {}
}
return null;
@@ -178,6 +182,9 @@ public class MultiXMLConfigurationBuilde
synapseConfig.getArtifactDeploymentStore().addArtifact(
file.getAbsolutePath(), entry.getKey());
}
+ } catch (SynapseException e) {
+ log.error("Error while loading the local-entry from file: " + file.getName());
+ throw e;
} catch (FileNotFoundException ignored) {}
}
}
@@ -202,6 +209,9 @@ public class MultiXMLConfigurationBuilde
synapseConfig.getArtifactDeploymentStore().addArtifact(
file.getAbsolutePath(), proxy.getName());
}
+ } catch (SynapseException e) {
+ log.error("Error while loading the proxy service from file: " + file.getName());
+ throw e;
} catch (FileNotFoundException ignored) {}
}
}
@@ -226,6 +236,9 @@ public class MultiXMLConfigurationBuilde
synapseConfig.getArtifactDeploymentStore().addArtifact(
file.getAbsolutePath(), startup.getName());
}
+ } catch (SynapseException e) {
+ log.error("Error while loading the task from file: " + file.getName());
+ throw e;
} catch (FileNotFoundException ignored) {}
}
}
@@ -251,6 +264,9 @@ public class MultiXMLConfigurationBuilde
synapseConfig.getArtifactDeploymentStore().addArtifact(
file.getAbsolutePath(), sequence.getName());
}
+ } catch (SynapseException e) {
+ log.error("Error while loading the sequence from file: " + file.getName());
+ throw e;
} catch (FileNotFoundException ignored) {}
}
}
@@ -275,6 +291,9 @@ public class MultiXMLConfigurationBuilde
synapseConfig.getArtifactDeploymentStore().addArtifact(
file.getAbsolutePath(), endpoint.getName());
}
+ } catch (SynapseException e) {
+ log.error("Error while loading the endpoint from file: " + file.getName());
+ throw e;
} catch (FileNotFoundException ignored) {}
}
}
@@ -299,6 +318,9 @@ public class MultiXMLConfigurationBuilde
synapseConfig.getArtifactDeploymentStore().addArtifact(
file.getAbsolutePath(), eventSource.getName());
}
+ } catch (SynapseException e) {
+ log.error("Error while loading the event-source from file: " + file.getName());
+ throw e;
} catch (FileNotFoundException ignored) {}
}
}
@@ -323,6 +345,9 @@ public class MultiXMLConfigurationBuilde
synapseConfig.getArtifactDeploymentStore().addArtifact(
file.getAbsolutePath(), executor.getName());
}
+ } catch (SynapseException e) {
+ log.error("Error while loading the executor from file: " + file.getName());
+ throw e;
} catch (FileNotFoundException ignored) {}
}
}
@@ -349,6 +374,9 @@ public class MultiXMLConfigurationBuilde
synapseConfig.getArtifactDeploymentStore().addArtifact(file.getAbsolutePath(),
messageStore.getName());
}
+ } catch (SynapseException e) {
+ log.error("Error while loading the message-store from file: " + file.getName());
+ throw e;
} catch (FileNotFoundException ignored ) { }
}
}
Added: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/EndpointTemplate.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/EndpointTemplate.java?rev=1078748&view=auto
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/EndpointTemplate.java (added)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/EndpointTemplate.java Mon Mar 7 11:37:22 2011
@@ -0,0 +1,26 @@
+/*
+ * 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.endpoints;
+
+public class EndpointTemplate {
+ private EndpointDefinition definition = null;
+
+
+}
Added: synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/util/PropertyGenTest.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/util/PropertyGenTest.java?rev=1078748&view=auto
==============================================================================
--- synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/util/PropertyGenTest.java (added)
+++ synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/util/PropertyGenTest.java Mon Mar 7 11:37:22 2011
@@ -0,0 +1,83 @@
+package org.apache.synapse.util;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.synapse.SynapseConstants;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.Iterator;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: supun
+ * Date: 3/4/11
+ * Time: 7:12 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class PropertyGenTest extends TestCase {
+
+ public void testCreate() {
+ //File file = new File("/Users/supun/dev/apache/synapse-1/general_dlc_sequence.xml");
+ File file = new File("/Users/supun/dev/apache/synapse-1/ib_gift_voucher_redemptions_result_dlc_sequence.xml");
+
+ InputStream is = null;
+ try {
+ is = new FileInputStream(file);
+
+ OMElement document = new StAXOMBuilder(is).getDocumentElement();
+ document.build();
+
+ document.toString();
+ String result = "";
+ OMElement switchEle = document.getFirstChildWithName(new QName(SynapseConstants.SYNAPSE_NAMESPACE, "switch"));
+
+ Iterator itr = switchEle.getChildrenWithName(new QName(SynapseConstants.SYNAPSE_NAMESPACE, "case"));
+ int no = 0;
+ while (itr.hasNext()) {
+
+
+ OMElement caseElem = (OMElement) itr.next();
+ Iterator classItr = caseElem.getChildrenWithName(new QName(SynapseConstants.SYNAPSE_NAMESPACE, "class"));
+ while (classItr.hasNext()) {
+ OMElement classElem = (OMElement) classItr.next();
+
+ if (classElem.getAttribute(new QName("name")).getAttributeValue().equals("com.jkh.tools.MessageStoreMediator")) {
+ Iterator propItr = classElem.getChildrenWithName(new QName(SynapseConstants.SYNAPSE_NAMESPACE, "property"));
+
+ String sequence = "";
+ String messageStore = "";
+
+ while (propItr.hasNext()) {
+ OMElement proElm = (OMElement) propItr.next();
+
+ if (proElm.getAttribute(new QName("name")).getAttributeValue().equals("sequence")) {
+ sequence = proElm.getAttribute(new QName("value")).getAttributeValue();
+ }
+
+ if (proElm.getAttribute(new QName("name")).getAttributeValue().equals("messageStore")) {
+ messageStore = proElm.getAttribute(new QName("value")).getAttributeValue();
+ }
+ }
+
+ result += "destination." + messageStore + "_" + sequence + "=direct://amq.direct//" + messageStore + "_" + sequence + "\n";
+ no++;
+ }
+ }
+ }
+
+ System.out.println(result);
+ System.out.println(no);
+
+ }catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (XMLStreamException e) {
+ e.printStackTrace();
+ }
+ }
+}