Author: kentam
Date: Mon Jul 24 19:03:35 2006
New Revision: 425257

URL: http://svn.apache.org/viewvc?rev=425257&view=rev
Log:
Add an SCA web distribution: this archive can be extracted into a webapp e.g. a 
WEB-INF dir or Tomcat's "shared" dir, supplying all dependencies required by 
the core runtime.

Refactor/cleanup of the launcher code to support the web distribution.

Initial work to support dynamic selection of MonitorFactory implementations, 
and allow e.g. using a properties file read at startup to specify monitoring 
details.


Example usage of the web distribution w/ Tomcat:

Extract web-1.0-SNAPSHOT-bin.zip into Tomcat's "shared" directory.

Create a web-app with the following entries in web.xml:

<context-param>
  <param-name>applicationScdlPath</param-name>
  <param-value>META-INF/sca/default.scdl</param-value>
</context-param>
<listener>
    
<listener-class>org.apache.tuscany.core.launcher.ServletLauncherListener</listener-class>
</listener>

Copy one of the current SCA app sample jars (e.g 
sample-calculator-1.0-SNAPSHOT.jar) into WEB-INF/lib

Other webapp code (e.g. a JSP) can now access the SCA app via 
CurrentCompositeContext.getContext() etc.





Added:
    incubator/tuscany/java/distribution/sca/web/
    incubator/tuscany/java/distribution/sca/web/LICENSE.txt   (with props)
    incubator/tuscany/java/distribution/sca/web/pom.xml   (with props)
    incubator/tuscany/java/distribution/sca/web/src/
    incubator/tuscany/java/distribution/sca/web/src/main/
    incubator/tuscany/java/distribution/sca/web/src/main/assembly/
    incubator/tuscany/java/distribution/sca/web/src/main/assembly/servlet.xml   
(with props)
    
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/util/ClassLoaderHelper.java
   (with props)
Modified:
    incubator/tuscany/java/pom.xml
    
incubator/tuscany/java/sca/commands/launcher/src/main/resources/org/apache/tuscany/launcher/MainLauncher.properties
    
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/Launcher.java
    
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/MainLauncher.java
    
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/ServletLauncherListener.java
    
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/IncludeLoader.java
    
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/monitor/JavaLoggingMonitorFactory.java
    
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/monitor/NullMonitorFactory.java
    
incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/monitor/MonitorFactory.java
    
incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/SCATestCase.java

Added: incubator/tuscany/java/distribution/sca/web/LICENSE.txt
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/distribution/sca/web/LICENSE.txt?rev=425257&view=auto
==============================================================================
--- incubator/tuscany/java/distribution/sca/web/LICENSE.txt (added)
+++ incubator/tuscany/java/distribution/sca/web/LICENSE.txt Mon Jul 24 19:03:35 
2006
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.

Propchange: incubator/tuscany/java/distribution/sca/web/LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/tuscany/java/distribution/sca/web/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/distribution/sca/web/pom.xml?rev=425257&view=auto
==============================================================================
--- incubator/tuscany/java/distribution/sca/web/pom.xml (added)
+++ incubator/tuscany/java/distribution/sca/web/pom.xml Mon Jul 24 19:03:35 2006
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ *  Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, 
as applicable.
+ *
+ *  Licensed 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.
+ -->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.tuscany</groupId>
+    <artifactId>web</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+    <name>Tuscany Web-Tier Distribution</name>
+    <description>Tuscany Distribution for web-tier (servlet) 
environments.</description>
+
+    <properties>
+        <sca.version>1.0-SNAPSHOT</sca.version>
+    </properties>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany</groupId>
+            <artifactId>core</artifactId>
+            <version>${sca.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany</groupId>
+            <artifactId>launcher</artifactId>
+            <version>${sca.version}</version>
+        </dependency>
+    </dependencies>
+
+    <pluginRepositories>
+        <pluginRepository>
+            <id>apache-snapshot</id>
+            <name>Apache Snapshot Repository</name>
+            <url>http://people.apache.org/maven-snapshot-repository</url>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </pluginRepository>
+    </pluginRepositories>
+
+    <build>
+        <defaultGoal>install</defaultGoal>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <version>2.2-SNAPSHOT</version>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <descriptors>
+                        <descriptor>src/main/assembly/servlet.xml</descriptor>
+                    </descriptors>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Propchange: incubator/tuscany/java/distribution/sca/web/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/tuscany/java/distribution/sca/web/src/main/assembly/servlet.xml
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/distribution/sca/web/src/main/assembly/servlet.xml?rev=425257&view=auto
==============================================================================
--- incubator/tuscany/java/distribution/sca/web/src/main/assembly/servlet.xml 
(added)
+++ incubator/tuscany/java/distribution/sca/web/src/main/assembly/servlet.xml 
Mon Jul 24 19:03:35 2006
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ *  Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, 
as applicable.
+ *
+ *  Licensed 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.
+ -->
+<assembly>
+    <!-- id typically identifies the "type" (src vs bin etc) of the assembly 
-->
+    <id>bin</id>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <formats>
+        <format>zip</format>
+        <format>tar.gz</format>
+    </formats>
+
+    <fileSets>
+        <!-- include legal and other files -->
+        <fileSet>
+            <includes>
+                <include>LICENSE*</include>
+            </includes>
+        </fileSet>
+    </fileSets>
+
+    <dependencySets>
+        <!-- libraries needed to boot the runtime -->
+        <dependencySet>
+            <outputDirectory>lib</outputDirectory>
+            <includes>
+                <include>org.osoa:sca-api</include>
+                <include>org.apache.tuscany:launcher</include>
+                <include>org.apache.tuscany:core</include>
+            </includes>
+            <fileMode>644</fileMode>
+        </dependencySet>
+    </dependencySets>
+</assembly>
+

Propchange: 
incubator/tuscany/java/distribution/sca/web/src/main/assembly/servlet.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/tuscany/java/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/pom.xml?rev=425257&r1=425256&r2=425257&view=diff
==============================================================================
--- incubator/tuscany/java/pom.xml (original)
+++ incubator/tuscany/java/pom.xml Mon Jul 24 19:03:35 2006
@@ -38,6 +38,7 @@
         <module>sca</module>
         <module>samples/sca</module>
         <module>distribution/sca/standalone</module>
+        <module>distribution/sca/web</module>
     </modules>
 
     <build>

Modified: 
incubator/tuscany/java/sca/commands/launcher/src/main/resources/org/apache/tuscany/launcher/MainLauncher.properties
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/commands/launcher/src/main/resources/org/apache/tuscany/launcher/MainLauncher.properties?rev=425257&r1=425256&r2=425257&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/commands/launcher/src/main/resources/org/apache/tuscany/launcher/MainLauncher.properties
 (original)
+++ 
incubator/tuscany/java/sca/commands/launcher/src/main/resources/org/apache/tuscany/launcher/MainLauncher.properties
 Mon Jul 24 19:03:35 2006
@@ -14,7 +14,8 @@
 #
 #  $Rev: 411440 $ $Date: 2006-06-03 07:40:55 -0700 (Sat, 03 Jun 2006) $
 #
+# REVIEW: Move to core.launcher
 org.apache.tuscany.launcher.Usage=usage: java [jvm-options] -jar launcher.jar 
[options] arg...\n\
   where [options] are:\n\
-  \    --classpath <path>    set the classpath for loading application 
classes\n
-  \    --main <classname>    specify the classname to launch (overrides 
manifest entries on classpath param)\n
+      --classpath <path>    set the classpath for loading application classes 
(required)\n\
+      --main <classname>    specify the classname to launch (overrides 
manifest entries on classpath param)\n

Modified: 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/Launcher.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/Launcher.java?rev=425257&r1=425256&r2=425257&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/Launcher.java
 (original)
+++ 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/Launcher.java
 Mon Jul 24 19:03:35 2006
@@ -17,9 +17,7 @@
 package org.apache.tuscany.core.launcher;
 
 import java.io.File;
-import java.net.MalformedURLException;
 import java.net.URL;
-import java.net.URLClassLoader;
 import java.net.URI;
 
 import javax.xml.stream.XMLInputFactory;
@@ -43,30 +41,24 @@
  * @version $Rev: 417136 $ $Date: 2006-06-26 03:54:48 -0400 (Mon, 26 Jun 2006) 
$
  */
 public class Launcher {
+    private ClassLoader applicationLoader;
+    private RuntimeComponent runtime;
+    private Deployer deployer;
+
     /**
-     * A conventional META-INF based location for the system SCDL.  Refers to 
a location
-     * on the classloader used to load this class.
+     * A conventional META-INF based location for the system SCDL.
      *
-     * @see #bootRuntime(String)
+     * @see #bootRuntime(URL)
      */
-    public static final String METAINF_SYSTEM_SCDL_PATH = 
"/META-INF/tuscany/system.scdl";
+    public static final String METAINF_SYSTEM_SCDL_PATH = 
"META-INF/tuscany/system.scdl";
 
     /**
-     * A conventional META-INF based location for the application SCDL.  
Refers to a location
-     * on the application classloader.
+     * A conventional META-INF based location for the application SCDL.
      *
-     * @see #bootApplication(String)
+     * @see #bootApplication(URL)
      */
     public static final String METAINF_APPLICATION_SCDL_PATH = 
"META-INF/sca/default.scdl";
 
-    // REVIEW: ([EMAIL PROTECTED]) Perhaps this should be null / have no 
default?
-    // It seems to me it would very unusual (ie, uncommonly-simplistic) for 
the system classloader to be the desired
-    // application loader, and we might be better off requiring it to be 
injected.
-    private ClassLoader applicationLoader = ClassLoader.getSystemClassLoader();
-    private String className;
-    private RuntimeComponent runtime;
-    private Deployer deployer;
-
     /**
      * Returns the classloader for application classes.
      *
@@ -87,88 +79,17 @@
     }
 
     /**
-     * Create a classloader for the supplied classpath.
-     *
-     * @param path   a list of file/directory names separated by the platform 
path separator
-     * @param parent the parent for the new classloader
-     * @return a classloader that will load classes from the supplied path
-     */
-    protected static ClassLoader createClassLoader(ClassLoader parent, String 
path) {
-        String[] files = path.split(File.pathSeparator);
-        return createClassLoader(parent, files);
-    }
-
-    /**
-     * Create a classloader for a classpath supplied as individual file names.
-     *
-     * @param files  a list of file/directory names
-     * @param parent the parent for the new classloader
-     * @return a classloader that will load classes from the supplied path
-     */
-    protected static ClassLoader createClassLoader(ClassLoader parent, 
String[] files) {
-        URL[] urls = new URL[files.length];
-        for (int i = 0; i < files.length; i++) {
-            try {
-                File file = new File(files[i]);
-                urls[i] = file.toURI().toURL();
-            } catch (MalformedURLException e) {
-                // just ignore this value
-                continue;
-            }
-        }
-
-        return new URLClassLoader(urls, parent);
-    }
-
-    /**
-     * Create a classloader for a classpath supplied as a list of files.
-     *
-     * @param files  a list of files
-     * @param parent the parent for the new classloader
-     * @return a classloader that will load classes from the supplied path
-     */
-    protected ClassLoader createClassLoader(ClassLoader parent, File[] files) {
-        URL[] urls = new URL[files.length];
-        for (int i = 0; i < files.length; i++) {
-            try {
-                File file = files[i];
-                urls[i] = file.toURI().toURL();
-            } catch (MalformedURLException e) {
-
-                continue;
-            }
-        }
-        return new URLClassLoader(urls, parent);
-    }
-
-    /**
-     * Returns the name of the application class.
+     * Boots the runtime defined by the specified SCDL.
      *
-     * @return the name of the application class
-     */
-    protected String getClassName() {
-        return className;
-    }
-
-    /**
-     * Sets the name of the application class.
-     *
-     * @param className the name of the application class
-     */
-    protected void setClassName(String className) {
-        this.className = className;
-    }
-
-    /**
-     * Boots the runtime defined by the specified SCDL, which will be
-     * loaded using the classloader of this class.
-     *
-     * @see   METAINF_SYSTEM_SCDL_PATH
-     * @param systemScdlPath a resource path to the SCDL defining the system.
+     * @param systemScdl a resource path to the SCDL defining the system.
      * @return a CompositeComponent for the newly booted runtime system
      * @throws LoaderException
      */
-    public CompositeComponent<?> bootRuntime(String systemScdlPath) throws 
LoaderException {
+    public CompositeComponent<?> bootRuntime(URL systemScdl) throws 
LoaderException {
+        if (systemScdl == null) {
+            throw new LoaderException("Null system SCDL URL");
+        }
+
         ClassLoader systemClassLoader = getClass().getClassLoader();
         XMLInputFactory xmlFactory = 
XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", 
systemClassLoader);
         Bootstrapper bootstrapper = new DefaultBootstrapper(new 
NullMonitorFactory(), xmlFactory);
@@ -176,7 +97,7 @@
 
         // create and start the core runtime
         runtime = bootstrapper.createRuntime();
-        runtime.start();
+        runtime.start(); // REVIEW: is this redundant w/ the composite.start() 
call below?
 
         // initialize the runtime info
         SystemCompositeComponent parent = (SystemCompositeComponent) 
runtime.getSystemComponent();
@@ -185,11 +106,7 @@
 
         // create a ComponentDefinition to represent the component we are 
going to deploy
         SystemCompositeImplementation moduleImplementation = new 
SystemCompositeImplementation();
-        URL scdl = getClass().getResource(systemScdlPath);
-        if (scdl == null) {
-            throw new LoaderException("No system scdl found");
-        }
-        moduleImplementation.setScdlLocation(scdl);
+        moduleImplementation.setScdlLocation(systemScdl);
         moduleImplementation.setClassLoader(systemClassLoader);
         ComponentDefinition<SystemCompositeImplementation> moduleDefinition =
                 new 
ComponentDefinition<SystemCompositeImplementation>(ComponentNames.TUSCANY_SYSTEM,
@@ -206,24 +123,32 @@
     }
 
     /**
-     * Boots the application defined by the specified SCDL, which will be
-     * loaded using the application loader ((@link #getApplicationLoader}).
+     * Shuts down the active runtime being managed by this instance.
+     */
+    public void shutdownRuntime() {
+        if (runtime != null)
+            runtime.stop();
+
+        runtime = null;
+    }
+
+    /**
+     * Boots the application defined by the specified SCDL.
      *
      * @see   METAINF_APPLICATION_SCDL_PATH
-     * @param appScdlPath a resource path to the SCDL defining the application
+     * @param appScdl URL to the SCDL defining the application
      * @return a CompositeComponent for the newly booted application
      * @throws LoaderException
      */
-    public CompositeComponent<?> bootApplication(String appScdlPath) throws 
LoaderException {
+    public CompositeComponent<?> bootApplication(URL appScdl) throws 
LoaderException {
+        if (appScdl == null) {
+            throw new LoaderException("No application scdl found");
+        }
         ClassLoader applicationLoader = getApplicationLoader();
 
         // create a ComponentDefinition to represent the component we are 
going to deploy
         SystemCompositeImplementation impl = new 
SystemCompositeImplementation();
-        URL scdl = applicationLoader.getResource(appScdlPath);
-        if (scdl == null) {
-            throw new LoaderException("No application scdl found");
-        }
-        impl.setScdlLocation(scdl);
+        impl.setScdlLocation(appScdl);
         impl.setClassLoader(applicationLoader);
         ComponentDefinition<SystemCompositeImplementation> moduleDefinition =
                 new 
ComponentDefinition<SystemCompositeImplementation>(ComponentNames.TUSCANY_SYSTEM,
 impl);

Modified: 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/MainLauncher.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/MainLauncher.java?rev=425257&r1=425256&r2=425257&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/MainLauncher.java
 (original)
+++ 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/MainLauncher.java
 Mon Jul 24 19:03:35 2006
@@ -23,8 +23,10 @@
 import java.lang.reflect.Modifier;
 import java.util.ResourceBundle;
 import java.util.jar.JarFile;
+import java.net.URL;
 
 import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.core.util.ClassLoaderHelper;
 
 
 /**
@@ -33,6 +35,7 @@
  * @version $Rev: 412898 $ $Date: 2006-06-08 21:31:50 -0400 (Thu, 08 Jun 2006) 
$
  */
 public class MainLauncher extends Launcher {
+    private String className;
     private String[] args;
 
     /**
@@ -44,12 +47,12 @@
      */
     public void setClassPath(String path) {
         String[] files = path.split(File.pathSeparator);
-        
setApplicationLoader(createClassLoader(ClassLoader.getSystemClassLoader(), 
files));
+        
setApplicationLoader(ClassLoaderHelper.createClassLoader(ClassLoader.getSystemClassLoader(),
 files));
 
         // if we don't have a main class yet, see if we can extract one from 
the jars
-        for (int i = 0; getClassName() == null && i < files.length; i++) {
+        for (int i = 0; className == null && i < files.length; i++) {
             String file = files[i];
-            setClassName(getMainClassFromJar(file));
+            className = getMainClassFromJar(file);
         }
     }
 
@@ -94,15 +97,15 @@
         Thread.currentThread().setContextClassLoader(getApplicationLoader());
         context.start();
         try {
-            if (getClassName() == null) {
+            if (className == null) {
                 throw new InvalidMainException("Main-Class not specified");
             }
-            Class<?> mainClass = Class.forName(getClassName(), true, 
getApplicationLoader());
+            Class<?> mainClass = Class.forName(className, true, 
getApplicationLoader());
             Method main;
             try {
                 main = mainClass.getMethod("main", String[].class);
             } catch (NoSuchMethodException e) {
-                throw new InvalidMainException(getClassName());
+                throw new InvalidMainException(className);
             }
             if (!Modifier.isStatic(main.getModifiers())) {
                 throw new InvalidMainException(main.toString());
@@ -128,8 +131,10 @@
         // The classpath to load the launcher should not contain any of 
Tuscany jar files except the launcher.
         try {
             parseArguments(args);
-            bootRuntime(METAINF_SYSTEM_SCDL_PATH);
-            CompositeComponent application = 
bootApplication(METAINF_APPLICATION_SCDL_PATH);
+            URL scdl = getClass().getResource(METAINF_SYSTEM_SCDL_PATH);
+            bootRuntime(scdl);
+            URL appScdl = 
getApplicationLoader().getResource(METAINF_APPLICATION_SCDL_PATH);
+            CompositeComponent application = bootApplication(appScdl);
             application.start();
             try {
                 callApplication(application);
@@ -147,16 +152,21 @@
             e.getCause().printStackTrace(System.err);
             System.exit(2);
         }
+        finally {
+            shutdownRuntime();
+        }
     }
 
     protected void parseArguments(String... args) {
         String specifiedMain = null;
+        boolean specifiedClassPath = false;
         int i = 0;
         while (i < args.length) {
             int left = args.length - i;
             String arg = args[i];
             if ("--classpath".equals(arg) && left > 1) {
                 setClassPath(args[i + 1]);
+                specifiedClassPath = true;
                 i += 2;
             } else if ("--main".equals(arg) && left > 1) {
                 specifiedMain = args[i + 1];
@@ -170,7 +180,12 @@
 
         // Specified main-class overrides anything found on classpath
         if (specifiedMain != null) {
-            setClassName(specifiedMain);
+            className = specifiedMain;
+        }
+
+        // Exit if no classpath was specified
+        if (!specifiedClassPath) {
+            usage();
         }
 
         String[] mainArgs = new String[args.length - i];

Modified: 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/ServletLauncherListener.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/ServletLauncherListener.java?rev=425257&r1=425256&r2=425257&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/ServletLauncherListener.java
 (original)
+++ 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/launcher/ServletLauncherListener.java
 Mon Jul 24 19:03:35 2006
@@ -2,18 +2,24 @@
 
 import org.apache.tuscany.spi.loader.LoaderException;
 import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.bootstrap.ComponentNames;
 
 import javax.servlet.ServletContextListener;
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContext;
+import java.net.URL;
+import java.net.MalformedURLException;
 
 /**
  * Launcher for runtime environment that loads info from servlet context 
params.
- * This listener manages one top-level CompositeContext per servlet context; 
the
- * lifecycle of that CompositeContext corresponds to the the lifecycle of the
+ * This listener manages one top-level Launcher (and hence one Tuscany runtime 
context)
+ * per servlet context; the lifecycle of that runtime corresponds to the the 
lifecycle of the
  * associated servlet context.
  *
+ * Web application code may obtain the top-level CompositeContext via
+ * [EMAIL PROTECTED] org.osoa.sca.CurrentCompositeContext#getContext()}.  If 
that returns null,
+ * it is likely the runtime failed to boot: the context param [EMAIL 
PROTECTED] LAUNCHER_THROWABLE_ATTRIBUTE}
+ * will contain a [EMAIL PROTECTED] Throwable} with diagnostic information.
+ *
  * @version $$Rev: $$ $$Date: $$
  */
 
@@ -29,23 +35,20 @@
 
     /**
      * Default application SCDL path used if no "applicationScdlPath" param is 
specified
-     *
-     * REVIEW: this doesn't work as expected right now because we are using 
the webapp classloader
-     * directly, which doesn't include the root of the webapp.
      */
-    public static final String DEFAULT_APPLICATION_SCDL_PATH = 
"WEB-INF/default.scdl";
+    public static final String DEFAULT_APPLICATION_SCDL_PATH = 
"/WEB-INF/default.scdl";
 
     /**
-     * Context attribute to which application root component (of type 
CompositeComponent<?>)
-     * will be bound to on successful application initialization.  May be null 
on failure.
+     * Context attribute to which an Exception or Error object will be bound 
to if the
+     * launcher fails to initialize.
      */
-    public static final String APPLICATION_ROOT_COMPONENT_ATTRIBUTE = 
ComponentNames.TUSCANY_ROOT;
+    public static final String LAUNCHER_THROWABLE_ATTRIBUTE = 
"Tuscany.Launcher.Throwable";
 
     /**
-     * Context attribute to which application root context (of type 
CompositeContext)
-     * will be bound to on successful application initialization.  May be null 
on failure.
+     * Context attribute to which the active [EMAIL PROTECTED] Launcher} 
managing the runtime for this
+     * servlet context is stored.
      */
-    public static final String APPLICATION_ROOT_CONTEXT_ATTRIBUTE = 
APPLICATION_ROOT_COMPONENT_ATTRIBUTE + ".context";
+    private static final String LAUNCHER_ATTRIBUTE = "Tuscany.Launcher";
 
     public void contextInitialized(ServletContextEvent servletContextEvent) {
         ServletContext servletContext = 
servletContextEvent.getServletContext();
@@ -53,7 +56,7 @@
         // Read optional path to system SCDL from context-param
         String systemScdlPath = 
servletContext.getInitParameter(SYSTEM_SCDL_PATH_PARAM);
         if (systemScdlPath == null) {
-            systemScdlPath = Launcher.METAINF_SYSTEM_SCDL_PATH;
+            systemScdlPath = "/" + Launcher.METAINF_SYSTEM_SCDL_PATH;
         }
 
         // Read optional path to application SCDL from context-param
@@ -64,46 +67,51 @@
 
         Launcher launcher = new Launcher();
 
-        // REVIEW: Not sure how reliable it is to rely on the thread context 
classloader as having
-        // reasonable semantics across a variety of servlet containers.. if 
"not very", the thread
-        // context loader works for Tomcat, so perhaps this class needs to 
become container-specific.
+        // Current thread context classloader should be the webapp classloader
         
launcher.setApplicationLoader(Thread.currentThread().getContextClassLoader());
 
-        CompositeComponent<?> component = null;
-        CompositeContextImpl context = null;
+        CompositeComponent<?> component;
+        CompositeContextImpl context;
 
         try {
-            launcher.bootRuntime(systemScdlPath);
-            component = launcher.bootApplication(applicationScdlPath);
+            URL systemScdl = getClass().getResource(systemScdlPath);
+            launcher.bootRuntime(systemScdl);
+            servletContext.setAttribute(LAUNCHER_ATTRIBUTE, launcher);
+
+            URL appScdl;
+            if (applicationScdlPath.startsWith("/")) {
+                // Paths begining w/ "/" are treated as webapp resources
+                try {
+                    appScdl = servletContext.getResource(applicationScdlPath);
+                }
+                catch (MalformedURLException mue) {
+                    throw new LoaderException("Unable to find application 
SCDL: " + applicationScdlPath);
+                }
+            }
+            else {
+                // Other paths are searched using the application classloader
+                appScdl = 
launcher.getApplicationLoader().getResource(applicationScdlPath);
+                if (appScdl == null)
+                    throw new LoaderException("Unable to find application 
SCDL: " + applicationScdlPath);
+            }
+
+            component = launcher.bootApplication(appScdl);
             component.start();
             context = new CompositeContextImpl(component);
             context.start();
-        } catch (LoaderException le) {
-            // TODO: Need proper logging infrastructure here
-            // TODO: stash exception info in attributes?
-            le.printStackTrace();
         }
-
-        servletContext.setAttribute(APPLICATION_ROOT_COMPONENT_ATTRIBUTE, 
component);
-        servletContext.setAttribute(APPLICATION_ROOT_COMPONENT_ATTRIBUTE, 
context);
+        catch (Throwable t) {
+            servletContext.setAttribute(LAUNCHER_THROWABLE_ATTRIBUTE, t);
+            t.printStackTrace();
+        }
     }
 
     public void contextDestroyed(ServletContextEvent servletContextEvent) {
         ServletContext servletContext = 
servletContextEvent.getServletContext();
 
-        CompositeComponent<?> component =
-            (CompositeComponent<?>) 
servletContext.getAttribute(APPLICATION_ROOT_COMPONENT_ATTRIBUTE);
+        Launcher launcher = (Launcher) 
servletContext.getAttribute(LAUNCHER_ATTRIBUTE);
 
-        // REVIEW: may be ok to use CurrentCompositeContext.getContext(), but 
this feels safer.
-        CompositeContextImpl context =
-            (CompositeContextImpl) 
servletContext.getAttribute(APPLICATION_ROOT_CONTEXT_ATTRIBUTE);
-
-        if (component != null) {
-            component.stop();
-        }
-
-        if (context != null) {
-            context.stop();
-        }
+        if (launcher != null)
+            launcher.shutdownRuntime();
     }
 }

Modified: 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/IncludeLoader.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/IncludeLoader.java?rev=425257&r1=425256&r2=425257&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/IncludeLoader.java
 (original)
+++ 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/IncludeLoader.java
 Mon Jul 24 19:03:35 2006
@@ -72,6 +72,7 @@
                 throw mre;
             }
             URL location = include.getScdlLocation();
+            System.out.println("Included SCDL URL=" + location);
             DeploymentContext childContext = new 
ChildDeploymentContext(deploymentContext,
                                                                         
deploymentContext.getClassLoader(),
                                                                         
location);

Modified: 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/monitor/JavaLoggingMonitorFactory.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/monitor/JavaLoggingMonitorFactory.java?rev=425257&r1=425256&r2=425257&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/monitor/JavaLoggingMonitorFactory.java
 (original)
+++ 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/monitor/JavaLoggingMonitorFactory.java
 Mon Jul 24 19:03:35 2006
@@ -41,11 +41,11 @@
  * @see java.util.logging
  */
 public class JavaLoggingMonitorFactory implements MonitorFactory {
-    private final String bundleName;
-    private final Level defaultLevel;
-    private final Map<String, Level> levels;
+    private String bundleName;
+    private Level defaultLevel;
+    private Map<String, Level> levels;
 
-    private final Map<Class<?>, WeakReference<?>> proxies = new 
WeakHashMap<Class<?>, WeakReference<?>>();
+    private Map<Class<?>, WeakReference<?>> proxies = new 
WeakHashMap<Class<?>, WeakReference<?>>();
 
     /**
      * Construct a MonitorFactory that will monitor the specified methods at 
the specified levels and generate messages
@@ -61,17 +61,38 @@
      * @see java.util.logging.Logger
      */
     public JavaLoggingMonitorFactory(Properties levels, Level defaultLevel, 
String bundleName) {
-        this.defaultLevel = defaultLevel;
-        this.bundleName = bundleName;
-        this.levels = new HashMap<String, Level>(levels.size());
-        for (Map.Entry<Object, Object> entry : levels.entrySet()) {
-            String method = (String) entry.getKey();
-            String level = (String) entry.getValue();
-            try {
-                this.levels.put(method, Level.parse(level));
-            } catch (IllegalArgumentException e) {
-                throw new InvalidLevelException(method, level);
+        Map<String,Object> configProperties = new HashMap<String,Object>();
+        configProperties.put("levels", levels);
+        configProperties.put("defaultLevel", defaultLevel);
+        configProperties.put("bundleName", bundleName);
+        initialize(configProperties);
+    }
+
+    /**
+     * Constructs a MonitorFactory that needs to be subsequently configured 
via a call to [EMAIL PROTECTED] #initialize}.
+     */
+    public JavaLoggingMonitorFactory() {
+    }
+
+    public void initialize(Map<String,Object> configProperties) {
+        try {
+            this.defaultLevel = (Level) configProperties.get("defaultLevel");
+            this.bundleName = (String) configProperties.get("bundleName");
+            Properties levels = (Properties) configProperties.get("levels");
+
+            this.levels = new HashMap<String, Level>(levels.size());
+            for (Map.Entry<Object, Object> entry : levels.entrySet()) {
+                String method = (String) entry.getKey();
+                String level = (String) entry.getValue();
+                try {
+                    this.levels.put(method, Level.parse(level));
+                } catch (IllegalArgumentException e) {
+                    throw new InvalidLevelException(method, level);
+                }
             }
+        }
+        catch (ClassCastException cce) {
+            throw new IllegalArgumentException(cce.getLocalizedMessage());
         }
     }
 

Modified: 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/monitor/NullMonitorFactory.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/monitor/NullMonitorFactory.java?rev=425257&r1=425256&r2=425257&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/monitor/NullMonitorFactory.java
 (original)
+++ 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/monitor/NullMonitorFactory.java
 Mon Jul 24 19:03:35 2006
@@ -19,6 +19,7 @@
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
+import java.util.Map;
 
 import org.osoa.sca.annotations.Init;
 
@@ -43,6 +44,9 @@
     public void init() {
     }
 
+    public void initialize(Map<String,Object> configProperties) {
+    }
+
     public <T> T getMonitor(Class<T> monitorInterface) {
         /*
          * This uses a reflection proxy to implement the monitor interface 
which
@@ -52,5 +56,4 @@
         return monitorInterface.cast(
             Proxy.newProxyInstance(monitorInterface.getClassLoader(), new 
Class<?>[]{monitorInterface}, NULL_MONITOR));
     }
-
 }

Added: 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/util/ClassLoaderHelper.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/util/ClassLoaderHelper.java?rev=425257&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/util/ClassLoaderHelper.java
 (added)
+++ 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/util/ClassLoaderHelper.java
 Mon Jul 24 19:03:35 2006
@@ -0,0 +1,69 @@
+package org.apache.tuscany.core.util;
+
+import java.io.File;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.net.URLClassLoader;
+
+/**
+ * Functions to create & manipulate classloaders.
+ * 
+ * @version $$Rev: $$ $$Date: $$
+ */
+
+public class ClassLoaderHelper {
+    /**
+     * Create a classloader for the supplied classpath.
+     *
+     * @param path   a list of file/directory names separated by the platform 
path separator
+     * @param parent the parent for the new classloader
+     * @return a classloader that will load classes from the supplied path
+     */
+    public static ClassLoader createClassLoader(ClassLoader parent, String 
path) {
+        String[] files = path.split(File.pathSeparator);
+        return createClassLoader(parent, files);
+    }
+
+    /**
+     * Create a classloader for a classpath supplied as individual file names.
+     *
+     * @param files  a list of file/directory names
+     * @param parent the parent for the new classloader
+     * @return a classloader that will load classes from the supplied path
+     */
+    public static ClassLoader createClassLoader(ClassLoader parent, String[] 
files) {
+        URL[] urls = new URL[files.length];
+        for (int i = 0; i < files.length; i++) {
+            try {
+                File file = new File(files[i]);
+                urls[i] = file.toURI().toURL();
+            } catch (MalformedURLException e) {
+                // just ignore this value
+                continue;
+            }
+        }
+
+        return new URLClassLoader(urls, parent);
+    }
+
+    /**
+     * Create a classloader for a classpath supplied as a list of files.
+     *
+     * @param files  a list of files
+     * @param parent the parent for the new classloader
+     * @return a classloader that will load classes from the supplied path
+     */
+    public static ClassLoader createClassLoader(ClassLoader parent, File[] 
files) {
+        URL[] urls = new URL[files.length];
+        for (int i = 0; i < files.length; i++) {
+            try {
+                File file = files[i];
+                urls[i] = file.toURI().toURL();
+            } catch (MalformedURLException e) {
+
+                continue;
+            }
+        }
+        return new URLClassLoader(urls, parent);
+    }
+}

Propchange: 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/util/ClassLoaderHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/monitor/MonitorFactory.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/monitor/MonitorFactory.java?rev=425257&r1=425256&r2=425257&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/monitor/MonitorFactory.java
 (original)
+++ 
incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/monitor/MonitorFactory.java
 Mon Jul 24 19:03:35 2006
@@ -16,14 +16,27 @@
  */
 package org.apache.tuscany.spi.monitor;
 
+import java.util.Map;
+
 /**
  * A MonitorFactory creates implementations of components' monitor interfaces 
that interface with a its monitoring
  * scheme. For example, a implementation may create versions that emit 
appropriate logging events or which send
  * notifications to a management API.
  *
+ * MonitorFactory implementations must provide a no-arg constructor and 
implement the [EMAIL PROTECTED] #initialize} method
+ * to perform configuration of instances created using that constructor.  
Additional constructors may be defined;
+ * typically their implementations delegate to [EMAIL PROTECTED] #initialize}.
+ *
  * @version $Rev$ $Date$
  */
 public interface MonitorFactory {
+    /**
+     * Initializes MonitorFactory instances with implementation-specific 
configuration properties.
+     *
+     * @param configProperties a map of named configuration properties
+     * @throws IllegalArgumentException if the instance can't be configured 
using the supplied properties
+     */
+    void initialize(Map<String,Object> configProperties);
     /**
      * Return a monitor for a component's monitor interface.
      *

Modified: 
incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/SCATestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/SCATestCase.java?rev=425257&r1=425256&r2=425257&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/SCATestCase.java
 (original)
+++ 
incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/SCATestCase.java
 Mon Jul 24 19:03:35 2006
@@ -34,10 +34,11 @@
 
     protected void setUp() throws Exception {
         super.setUp();
+        ClassLoader cl = getClass().getClassLoader();
         launcher = new Launcher();
-        launcher.setApplicationLoader(getClass().getClassLoader());
-        launcher.bootRuntime(Launcher.METAINF_SYSTEM_SCDL_PATH);
-        component = 
launcher.bootApplication(Launcher.METAINF_APPLICATION_SCDL_PATH);
+        launcher.setApplicationLoader(cl);
+        
launcher.bootRuntime(cl.getResource(Launcher.METAINF_SYSTEM_SCDL_PATH));
+        component = 
launcher.bootApplication(cl.getResource(Launcher.METAINF_APPLICATION_SCDL_PATH));
         component.start();
         context = new CompositeContextImpl(component);
         context.start();



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to