Author: davsclaus
Date: Sat Jul 5 08:03:24 2008
New Revision: 674203
URL: http://svn.apache.org/viewvc?rev=674203&view=rev
Log:
CAMEL-623: New option fileApplicationContext to support loading spring xml
files from the file path instead of classpath only. Added this new option to
maven tooling also.
Modified:
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
activemq/camel/trunk/tooling/archetypes/camel-component/ (props changed)
activemq/camel/trunk/tooling/archetypes/camel-router/ (props changed)
activemq/camel/trunk/tooling/maven/camel-maven-plugin/ (props changed)
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
activemq/camel/trunk/tooling/maven/maven-html-to-pdf/ (props changed)
Modified:
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java?rev=674203&r1=674202&r2=674203&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
(original)
+++
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
Sat Jul 5 08:03:24 2008
@@ -40,6 +40,7 @@
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.context.support.FileSystemXmlApplicationContext;
/**
* A command line tool for booting up a CamelContext using an optional Spring
@@ -50,6 +51,7 @@
public class Main extends ServiceSupport {
private static final Log LOG = LogFactory.getLog(Main.class);
private String applicationContextUri = "META-INF/spring/*.xml";
+ private String fileApplicationContextUri;
private AbstractApplicationContext applicationContext;
private List<Option> options = new ArrayList<Option>();
private CountDownLatch latch = new CountDownLatch(1);
@@ -81,6 +83,13 @@
}
});
+ addOption(new ParameterOption("fa", "fileApplicationContext",
+ "Sets the filesystem based spring ApplicationContext",
"fileApplicationContext") {
+ protected void doProcess(String arg, String parameter,
LinkedList<String> remainingArgs) {
+ setFileApplicationContextUri(parameter);
+ }
+ });
+
addOption(new ParameterOption("o", "outdir",
"Sets the DOT output directory where the visual
representations of the routes are generated",
"dot") {
@@ -273,7 +282,6 @@
this.applicationContext = applicationContext;
}
-
public String getApplicationContextUri() {
return applicationContextUri;
}
@@ -281,6 +289,15 @@
public void setApplicationContextUri(String applicationContextUri) {
this.applicationContextUri = applicationContextUri;
}
+
+ public String getFileApplicationContextUri() {
+ return fileApplicationContextUri;
+ }
+
+ public void setFileApplicationContextUri(String fileApplicationContextUri)
{
+ this.fileApplicationContextUri = fileApplicationContextUri;
+ }
+
public AbstractApplicationContext getParentApplicationContext() {
if (parentApplicationContext == null) {
if (parentApplicationContextUri != null) {
@@ -440,6 +457,19 @@
}
protected AbstractApplicationContext createDefaultApplicationContext() {
+ // file based
+ if (getFileApplicationContextUri() != null) {
+ String[] args = getFileApplicationContextUri().split(";");
+
+ ApplicationContext parentContext = getParentApplicationContext();
+ if (parentContext != null) {
+ return new FileSystemXmlApplicationContext(args,
parentContext);
+ } else {
+ return new FileSystemXmlApplicationContext(args);
+ }
+ }
+
+ // default to classpath based
String[] args = getApplicationContextUri().split(";");
ApplicationContext parentContext = getParentApplicationContext();
if (parentContext != null) {
Propchange: activemq/camel/trunk/tooling/archetypes/camel-component/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sat Jul 5 08:03:24 2008
@@ -5,3 +5,4 @@
target
.settings
eclipse-classes
+*.i??
Propchange: activemq/camel/trunk/tooling/archetypes/camel-router/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sat Jul 5 08:03:24 2008
@@ -5,3 +5,4 @@
.classpath
.project
.settings
+*.i??
Propchange: activemq/camel/trunk/tooling/maven/camel-maven-plugin/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sat Jul 5 08:03:24 2008
@@ -5,4 +5,4 @@
.classpath
.project
.settings
-
+*.i??
Modified:
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java?rev=674203&r1=674202&r2=674203&view=diff
==============================================================================
---
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java
(original)
+++
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java
Sat Jul 5 08:03:24 2008
@@ -76,13 +76,20 @@
protected boolean dotAggregationEnabled;
/**
- * The application context uri that spring wants to get.
+ * The classpath based application context uri that spring wants to get.
*
* @parameter expression="${camel.applicationContextUri}"
*/
protected String applicationContextUri;
/**
+ * The filesystem based application context uri that spring wants to get.
+ *
+ * @parameter expression="${camel.fileApplicationContextUri}"
+ */
+ protected String fileApplicationContextUri;
+
+ /**
* Project classpath.
*
* @parameter expression="${project.testClasspathElements}"
@@ -191,13 +198,11 @@
ArrayList<String> args = new ArrayList<String>(5);
if (isDotEnabled()) {
-
args.add("-outdir");
args.add(getOutputDirectory());
}
if (isDotAggregationEnabled()) {
-
args.add("-aggregate-dot");
args.add("true");
}
@@ -205,6 +210,9 @@
if (applicationContextUri != null) {
args.add("-applicationContext");
args.add(applicationContextUri);
+ } else if (fileApplicationContextUri != null) {
+ args.add("-fileApplicationContext");
+ args.add(fileApplicationContextUri);
}
args.add("-duration");
Modified:
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java?rev=674203&r1=674202&r2=674203&view=diff
==============================================================================
---
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
(original)
+++
activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
Sat Jul 5 08:03:24 2008
@@ -172,13 +172,20 @@
private String mainClass;
/**
- * The application context uri that spring want to gets.
+ * The classpath based application context uri that spring want to gets.
*
* @parameter expression="${camel.applicationContextUri}"
*/
private String applicationContextUri;
/**
+ * The filesystem based application context uri that spring want to gets.
+ *
+ * @parameter expression="${camel.fileApplicationContextUri}"
+ */
+ private String fileApplicationContextUri;
+
+ /**
* The class arguments.
*
* @parameter expression="${camel.arguments}"
@@ -338,6 +345,9 @@
if (applicationContextUri != null) {
args.add("-a");
args.add(applicationContextUri);
+ } else if (fileApplicationContextUri != null) {
+ args.add("-fa");
+ args.add(fileApplicationContextUri);
}
args.add("-d");
Propchange: activemq/camel/trunk/tooling/maven/maven-html-to-pdf/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sat Jul 5 08:03:24 2008
@@ -5,3 +5,4 @@
.classpath
.project
.settings
+*.i??