Title: [702] trunk/core/src/main/java/org/servicemix/Main.java: SM-134: add 1.x compatibility mode
Revision
702
Author
gnt
Date
2005-10-28 21:04:48 -0400 (Fri, 28 Oct 2005)

Log Message

SM-134: add 1.x compatibility mode

Modified Paths


Diff

Modified: trunk/core/src/main/java/org/servicemix/Main.java (701 => 702)

--- trunk/core/src/main/java/org/servicemix/Main.java	2005-10-28 17:42:44 UTC (rev 701)
+++ trunk/core/src/main/java/org/servicemix/Main.java	2005-10-29 01:04:48 UTC (rev 702)
@@ -17,10 +17,14 @@
  **/
 package org.servicemix;
 
+import org.servicemix.jbi.config.spring.XBeanProcessor;
 import org.springframework.context.ApplicationContext;
 import org.xbean.spring.context.ClassPathXmlApplicationContext;
 import org.xbean.spring.context.FileSystemXmlApplicationContext;
 
+import java.util.Arrays;
+import java.util.List;
+
 /**
  * A simple stand alone application which runs ServiceMix from the command line.
  *
@@ -47,13 +51,28 @@
                 String file = args[0];
 
                 if (file.equals("-?") || file.equals("?") || file.equals("--help") || file.equals("-h")) {
-                    System.out.println("Usage: Main [xmlConfigFile]");
+                    System.out.println("Usage: Main [-v1] [xmlConfigFile]");
                     System.out.println("If an XML config file is not specified then servicemix.xml is used from the CLASSPATH");
                     return;
                 }
-
-                System.out.println("Loading ServiceMix from file: " + file);
-                context = new FileSystemXmlApplicationContext(file);
+                
+                if (file.equals("-v1")) {
+                    
+                    List processors = Arrays.asList(new Object[] { new XBeanProcessor() });
+                    if (args.length <= 1) {
+                        System.out.println("Loading ServiceMix (compatible 1.x) from servicemix.xml on the CLASSPATH");
+                        context = new ClassPathXmlApplicationContext("servicemix.xml", processors);
+                    }
+                    else {
+                        file = args[1];
+                        System.out.println("Loading ServiceMix (compatible 1.x) from file: " + file);
+                        context = new FileSystemXmlApplicationContext(file, processors);
+                    }
+                }
+                else {
+                    System.out.println("Loading ServiceMix from file: " + file);
+                    context = new FileSystemXmlApplicationContext(file);
+                }
             }
             context.getBean("jbi");
 

Reply via email to