Author: rfeng
Date: Tue Feb 12 17:19:03 2008
New Revision: 627211

URL: http://svn.apache.org/viewvc?rev=627211&view=rev
Log:
Add the injection support of SCADomain into itests

Added:
    
incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebSCADomain.java
   (with props)
Modified:
    
incubator/tuscany/java/sca/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/JUnitServletFilter.java
    
incubator/tuscany/java/sca/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/XMLFormatter.java
    
incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java

Modified: 
incubator/tuscany/java/sca/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/JUnitServletFilter.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/JUnitServletFilter.java?rev=627211&r1=627210&r2=627211&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/JUnitServletFilter.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/JUnitServletFilter.java
 Tue Feb 12 17:19:03 2008
@@ -23,13 +23,18 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 import java.util.jar.JarEntry;
 import java.util.jar.JarInputStream;
+import java.util.logging.Logger;
 import java.util.regex.Pattern;
 
 import javax.servlet.Filter;
@@ -42,14 +47,19 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import junit.framework.JUnit4TestAdapter;
-import junit.framework.TestResult;
-import junit.textui.TestRunner;
+import junit.framework.AssertionFailedError;
+
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Request;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
 
 /**
  * @version $Rev$ $Date$
  */
 public class JUnitServletFilter implements Filter {
+    private static final Logger logger = 
Logger.getLogger(JUnitServletFilter.class.getName());
+
     private static final String JUNIT_TESTS_PATTERN = "junit.tests.pattern";
     private static final String JUNIT_TESTS_PATH = "junit.tests.path";
     private static final String JUNIT_ENABLED = "junit.enabled";
@@ -136,6 +146,9 @@
                 testClassLoader = new URLClassLoader(new URL[] {url}, 
testClassLoader);
             }
         }
+        
+        // Configure the SCADomain implementation class
+        config.getServletContext().setAttribute("SCADomain.Implementation", 
"org.apache.tuscany.sca.host.webapp.WebSCADomain");
     }
 
     /**
@@ -152,6 +165,7 @@
         return tests;
     }
 
+    @SuppressWarnings("unchecked")
     private void findResources(ServletContext context, Pattern pattern, 
Set<String> tests, String root, String dir) {
         Set<String> paths = context.getResourcePaths(dir);
         if (paths != null) {
@@ -178,9 +192,10 @@
         }
 
         HttpServletRequest req = (HttpServletRequest)request;
-        String path = req.getServletPath();
+        HttpServletResponse resp = (HttpServletResponse)response;
 
-        if (!"/junit".equals(path)) {
+        if (!req.getRequestURI().equals(req.getContextPath() + "/junit")) {
+            // Intercept the /junit call
             chain.doFilter(request, response);
             return;
         }
@@ -193,6 +208,7 @@
         String op = req.getParameter("op");
         if (query == null || op == null || "list".equalsIgnoreCase(op)) {
             response.setContentType("text/html");
+            resp.setStatus(HttpServletResponse.SC_OK);
             ps.println("<html><body>");
             ps.println("<h2>Available Test Cases</h2><p>");
             ps.println("<form method=\"get\" action=\"junit\">");
@@ -211,6 +227,7 @@
             ps.println("<p><input type=\"submit\" name=\"op\" 
value=\"RunSelected\"/>");
             ps.println("<input type=\"submit\" name=\"op\" 
value=\"RunAll\"/>");
             ps.println("</form></body></html>");
+            resp.flushBuffer();
             return;
         } else {
             if ("runAll".equalsIgnoreCase(op)) {
@@ -224,16 +241,28 @@
             }
         }
 
+        response.setContentType("application/xml");
+        ps.println("<?xml version=\"1.0\" encoding=\"" + "UTF-8" + "\"?>");
+
+        ServletContext context = config.getServletContext();
+        Object domain = 
context.getAttribute("org.apache.tuscany.sca.SCADomain");
+        URL contribution = 
context.getResource("/META-INF/sca-contribution.xml");
+
+        long duration = 0L;
         int errors = 0;
         int failures = 0;
         int runs = 0;
-        response.setContentType("application/xml");
-        ps.println("<?xml version=\"1.0\" encoding=\"" + "UTF-8" + "\"?>");
-        ps.println("<" + XMLFormatter.TESTSUITES + ">");
+        List<Class<?>> testClasses = new ArrayList<Class<?>>();
+        List<Result> results = new ArrayList<Result>();
         for (String testClass : testCases) {
             Class<?> test = null;
             try {
                 test = Class.forName(testClass, false, testClassLoader);
+                if (domain != null && contribution != null) {
+                    // Inject the SCADomain
+                    inject(test, domain);
+                }
+                testClasses.add(test);
             } catch (ClassNotFoundException e) {
                 String st = XMLFormatter.exceptionToString(e);
                 st = XMLFormatter.escape(st);
@@ -241,28 +270,69 @@
                 // ps.close();
                 throw new ServletException(e);
             }
-            final XMLFormatter formatter = new XMLFormatter();
-            TestRunner runner = new TestRunner() {
-                protected TestResult createTestResult() {
-                    TestResult result = new TestResult();
-                    result.addListener(formatter);
-                    return result;
-                }
-            };
-            long startTime = System.currentTimeMillis();
-            TestResult result = runner.doRun(new JUnit4TestAdapter(test));
-            runs += result.runCount();
-            failures += result.failureCount();
-            errors += result.errorCount();
-            long endTime = System.currentTimeMillis();
-            formatter.setTotalDuration(endTime - startTime);
-            ps.println(formatter.toXML(result));
-        }
-        ps.println("</" + XMLFormatter.TESTSUITES + ">");
-        ((HttpServletResponse)response).addIntHeader("junit.errors", errors);
-        ((HttpServletResponse)response).addIntHeader("junit.failures", 
failures);
-        ((HttpServletResponse)response).addIntHeader("junit.runs", runs);
+
+            JUnitCore core = new JUnitCore();
+            Result result = core.run(Request.aClass(test));
+            results.add(result);
+
+            duration += result.getRunTime();
+            runs += result.getRunCount();
+
+            for (Failure f : result.getFailures()) {
+                if (f.getException() instanceof AssertionFailedError) {
+                    failures++;
+                } else {
+                    errors++;
+                }
+            }
+        }
+
+        ps.println("<" + XMLFormatter.TESTSUITE
+            + " "
+            + XMLFormatter.ATTR_TESTS
+            + "=\""
+            + runs
+            + "\" "
+            + XMLFormatter.ATTR_FAILURES
+            + "=\""
+            + failures
+            + "\" "
+            + XMLFormatter.ATTR_ERRORS
+            + "=\""
+            + errors
+            + "\" "
+            + XMLFormatter.ATTR_TIME
+            + "=\""
+            + XMLFormatter.getDurationAsString(duration)
+            + "\">");
+        for (int i = 0; i < testClasses.size(); i++) {
+            ps.println(XMLFormatter.toXML(results.get(i), testClasses.get(i)));
+        }
+        ps.println("</" + XMLFormatter.TESTSUITE + ">");
+
+        resp.addIntHeader("junit.errors", errors);
+        resp.addIntHeader("junit.failures", failures);
+        resp.addIntHeader("junit.runs", runs);
+        resp.setStatus(HttpServletResponse.SC_OK);
+        resp.flushBuffer();
         // ps.close();    
+    }
+
+    private boolean inject(Class<?> cls, Object target) {
+        for (Field f : cls.getDeclaredFields()) {
+            if (Modifier.isStatic(f.getModifiers()) && 
f.getType().isInstance(target)) {
+                f.setAccessible(true);
+                try {
+                    f.set(null, target);
+                    return true;
+                } catch (IllegalArgumentException e) {
+                    return false;
+                } catch (IllegalAccessException e) {
+                    return false;
+                }
+            }
+        }
+        return false;
     }
 
     public void init(FilterConfig config) throws ServletException {

Modified: 
incubator/tuscany/java/sca/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/XMLFormatter.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/XMLFormatter.java?rev=627211&r1=627210&r2=627211&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/XMLFormatter.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/host-webapp-junit/src/main/java/org/apache/tuscany/sca/host/webapp/junit/XMLFormatter.java
 Tue Feb 12 17:19:03 2008
@@ -28,17 +28,16 @@
 import java.util.Locale;
 
 import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestFailure;
-import junit.framework.TestListener;
-import junit.framework.TestResult;
+
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
 
 /**
  * Format the test results in XML.
  *
  * @version $Id: XMLFormatter.java 239169 2005-05-05 09:21:54Z vmassol $
  */
-public class XMLFormatter implements TestListener {
+public class XMLFormatter {
     /**
      * Errors attribute for testsuite elements
      */
@@ -83,6 +82,13 @@
                       "java.lang.reflect.Method.invoke("};
 
     /**
+     * The number format used to convert durations into strings. Don't use the
+     * default locale for that, because the resulting string needs to use 
+     * dotted decimal notation for an XSLT transformation to work correctly.
+     */
+    private static NumberFormat durationFormat = 
NumberFormat.getInstance(Locale.US);
+
+    /**
      * The error element (for a test case)
      */
     public static final String ERROR = "error";
@@ -103,9 +109,24 @@
     public static final String TESTSUITE = "testsuite";
 
     /**
-     * Root element for all test suites.
+     * Escapes reserved XML characters.
+     *
+     * @param theString the string to escape
+     * @return the escaped string
      */
-    public static final String TESTSUITES = "testsuites";
+    public static String escape(String theString) {
+        String newString;
+
+        // It is important to replace the "&" first as the other replacements
+        // also introduces "&" chars ...
+        newString = theString.replace("&", "&amp;");
+
+        newString = newString.replace("<", "&lt;");
+        newString = newString.replace(">", "&gt;");
+        newString = newString.replace("\"", "&quot;");
+
+        return newString;
+    }
 
     /**
      * Returns the stack trace of an exception as String.
@@ -131,7 +152,7 @@
     public static String exceptionToString(Throwable theThrowable, String[] 
theFilterPatterns) {
         StringWriter sw = new StringWriter();
         PrintWriter pw = new PrintWriter(sw);
-    
+
         theThrowable.printStackTrace(pw);
         String stackTrace = sw.toString();
         return filterStackTrace(stackTrace, theFilterPatterns);
@@ -165,12 +186,12 @@
         if ((theFilterPatterns == null) || (theFilterPatterns.length == 0) || 
(theStackTrace == null)) {
             return theStackTrace;
         }
-    
+
         StringWriter stringWriter = new StringWriter();
         PrintWriter printWriter = new PrintWriter(stringWriter);
         StringReader stringReader = new StringReader(theStackTrace);
         BufferedReader bufferedReader = new BufferedReader(stringReader);
-    
+
         String line;
         try {
             while ((line = bufferedReader.readLine()) != null) {
@@ -185,257 +206,80 @@
     }
 
     /**
-     * Replaces a character in a string by a substring.
-     *
-     * @param theBaseString the base string in which to perform replacements
-     * @param theChar the char to look for
-     * @param theNewString the string with which to replace the char
-     * @return the string with replacements done or null if the input string
-     *          was null
-     */
-    public static String replace(String theBaseString, char theChar, String 
theNewString) {
-        if (theBaseString == null) {
-            return null;
-        }
-    
-        int pos = theBaseString.indexOf(theChar);
-        if (pos < 0) {
-            return theBaseString;
-        }
-    
-        int lastPos = 0;
-        StringBuffer result = new StringBuffer();
-        while (pos > -1) {
-            result.append(theBaseString.substring(lastPos, pos));
-            result.append(theNewString);
-    
-            lastPos = pos + 1;
-            pos = theBaseString.indexOf(theChar, lastPos);
-        }
-    
-        if (lastPos < theBaseString.length()) {
-            result.append(theBaseString.substring(lastPos));
-        }
-    
-        return result.toString();
-    }
-
-    /**
-     * Escapes reserved XML characters.
-     *
-     * @param theString the string to escape
-     * @return the escaped string
-     */
-    public static String escape(String theString) {
-        String newString;
-
-        // It is important to replace the "&" first as the other replacements
-        // also introduces "&" chars ...
-        newString = replace(theString, '&', "&amp;");
-
-        newString = replace(newString, '<', "&lt;");
-        newString = replace(newString, '>', "&gt;");
-        newString = replace(newString, '\"', "&quot;");
-
-        return newString;
-    }
-
-    /**
-     * XML string containing executed test case results
-     */
-    private StringBuffer currentTestCaseResults = new StringBuffer();
-
-    /**
-     * Current test failure (XML string) : failure or error.
-     */
-    private String currentTestFailure;
-
-    /**
-     * Time current test was started
-     */
-    private long currentTestStartTime;
-
-    /**
-     * The number format used to convert durations into strings. Don't use the
-     * default locale for that, because the resulting string needs to use 
-     * dotted decimal notation for an XSLT transformation to work correctly.
-     */
-    private NumberFormat durationFormat = NumberFormat.getInstance(Locale.US);
-
-    /**
-     * The name of the test suite class.
-     */
-    private String suiteClassName;
-
-    /**
-     * Duration it took to execute all the tests.
-     */
-    private long totalDuration;
-
-    /**
-     * Event called by the base test runner when the test fails with an error.
+     * Comvert a duration expressed as a long into a string.
      *
-     * @param theTest the test object that failed
-     * @param theThrowable the exception that was thrown
+     * @param theDuration the duration to convert to string
+     * @return the total duration as a string
      */
-    public void addError(Test theTest, Throwable theThrowable) {
-        TestFailure failure = new TestFailure(theTest, theThrowable);
-        StringBuffer xml = new StringBuffer();
-
-        xml.append("<" + XMLFormatter.ERROR
-            + " "
-            + XMLFormatter.ATTR_MESSAGE
-            + "=\""
-            + escape(failure.thrownException().getMessage())
-            + "\" "
-            + XMLFormatter.ATTR_TYPE
-            + "=\""
-            + failure.thrownException().getClass().getName()
-            + "\">");
-        
xml.append(escape(XMLFormatter.exceptionToString(failure.thrownException(), 
DEFAULT_STACK_FILTER_PATTERNS)));
-        xml.append("</" + XMLFormatter.ERROR + ">");
-
-        this.currentTestFailure = xml.toString();
+    public static String getDurationAsString(long theDuration) {
+        return durationFormat.format((double)theDuration / 1000);
     }
 
-    /**
-     * Event called by the base test runner when the test fails with a failure.
-     *
-     * @param theTest the test object that failed
-     * @param theError the exception that was thrown
-     */
-    public void addFailure(Test theTest, AssertionFailedError theError) {
-        TestFailure failure = new TestFailure(theTest, theError);
+    public static String toXML(Failure failure) {
         StringBuffer xml = new StringBuffer();
-
-        xml.append("<" + XMLFormatter.FAILURE
+        Throwable ex = failure.getException();
+        String tag = (ex instanceof AssertionFailedError) ? FAILURE : ERROR;
+        xml.append("<" + tag
             + " "
-            + XMLFormatter.ATTR_MESSAGE
+            + ATTR_MESSAGE
             + "=\""
-            + escape(failure.thrownException().getMessage())
+            + escape(ex.getMessage())
             + "\" "
-            + XMLFormatter.ATTR_TYPE
+            + ATTR_TYPE
             + "=\""
-            + failure.thrownException().getClass().getName()
+            + ex.getClass().getName()
             + "\">");
-        
xml.append(escape(XMLFormatter.exceptionToString(failure.thrownException(), 
DEFAULT_STACK_FILTER_PATTERNS)));
-        xml.append("</" + XMLFormatter.FAILURE + ">");
-
-        this.currentTestFailure = xml.toString();
-    }
-
-    /**
-     * Event called by the base test runner when the test ends.
-     *
-     * @param theTest the test object being executed
-     */
-    public void endTest(Test theTest) {
-        StringBuffer xml = new StringBuffer();
-        String duration = getDurationAsString(System.currentTimeMillis() - 
this.currentTestStartTime);
-
-        xml.append("<" + XMLFormatter.TESTCASE + " " + XMLFormatter.ATTR_NAME 
+ "=\"" + theTest + "\" " + XMLFormatter.ATTR_TIME + "=\"" + duration + "\">");
-
-        if (this.currentTestFailure != null) {
-            xml.append(this.currentTestFailure);
-        }
-
-        xml.append("</" + XMLFormatter.TESTCASE + ">");
-
-        this.currentTestCaseResults.append(xml.toString());
-    }
-
-    /**
-     * Comvert a duration expressed as a long into a string.
-     *
-     * @param theDuration the duration to convert to string
-     * @return the total duration as a string
-     */
-    private String getDurationAsString(long theDuration) {
-        return durationFormat.format((double)theDuration / 1000);
-    }
+        xml.append(escape(exceptionToString(ex, 
DEFAULT_STACK_FILTER_PATTERNS)));
+        xml.append("</" + tag + ">");
 
-    /**
-     * @return the suite class name
-     */
-    public String getSuiteClassName() {
-        return this.suiteClassName;
-    }
-
-    /**
-     * @return the total duration as a string
-     */
-    public String getTotalDurationAsString() {
-        return getDurationAsString(this.totalDuration);
-    }
-
-    /**
-     * Sets the suite class name that was executed.
-     *
-     * @param theSuiteClassName the suite class name
-     */
-    public void setSuiteClassName(String theSuiteClassName) {
-        this.suiteClassName = theSuiteClassName;
-    }
-
-    /**
-     * Sets the duration it took to execute all the tests.
-     *
-     * @param theDuration the time it took
-     */
-    public void setTotalDuration(long theDuration) {
-        this.totalDuration = theDuration;
-    }
-
-    /**
-     * Event called by the base test runner when the test starts.
-     *
-     * @param theTest the test object being executed
-     */
-    public void startTest(Test theTest) {
-        this.currentTestStartTime = System.currentTimeMillis();
-        this.currentTestFailure = null;
+        return xml.toString();
     }
 
     /**
      * Formats the test result as an XML string.
      *
-     * @param theResult the test result object
+     * @param result the test result object
      * @return the XML string representation of the test results
      */
-    public String toXML(TestResult theResult) {
+    public static String toXML(Result result, Class<?> cls) {
+        int failures = 0, errors = 0;
+        for (Failure f : result.getFailures()) {
+            if (f.getException() instanceof AssertionFailedError) {
+                failures++;
+            } else {
+                errors++;
+            }
+        }
         StringBuffer xml = new StringBuffer();
 
-        // xml.append("<?xml version=\"1.0\" encoding=\"" + getEncoding() + 
"\"?>");
-
-        // xml.append("<" + TESTSUITES + ">");
-
-        xml.append("<" + XMLFormatter.TESTSUITE
+        xml.append("<" + TESTCASE
             + " "
-            + XMLFormatter.ATTR_NAME
+            + ATTR_NAME
             + "=\""
-            + getSuiteClassName()
+            + cls.getName()
             + "\" "
-            + XMLFormatter.ATTR_TESTS
+            + ATTR_TESTS
             + "=\""
-            + theResult.runCount()
+            + result.getRunCount()
             + "\" "
-            + XMLFormatter.ATTR_FAILURES
+            + ATTR_FAILURES
             + "=\""
-            + theResult.failureCount()
+            + failures
             + "\" "
-            + XMLFormatter.ATTR_ERRORS
+            + ATTR_ERRORS
             + "=\""
-            + theResult.errorCount()
+            + errors
             + "\" "
-            + XMLFormatter.ATTR_TIME
+            + ATTR_TIME
             + "=\""
-            + getTotalDurationAsString()
+            + getDurationAsString(result.getRunTime())
             + "\">");
 
-        xml.append(this.currentTestCaseResults.toString());
+        for (Failure f : result.getFailures()) {
+            xml.append(toXML(f));
+        }
 
-        xml.append("</" + XMLFormatter.TESTSUITE + ">");
-        // xml.append("</" + TESTSUITES + ">");
+        xml.append("</" + TESTCASE + ">");
 
         return xml.toString();
     }

Modified: 
incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java?rev=627211&r1=627210&r2=627211&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
 Tue Feb 12 17:19:03 2008
@@ -209,6 +209,11 @@
         if (servletContext.getAttribute(SCA_DOMAIN_ATTRIBUTE) == null) {
             String domainURI = "http://localhost/"; + contextPath;
             String contributionRoot = getContributionLocation(servletContext);
+            // logger.info("Contribution: " + contributionRoot);
+            String implClass = (String) 
servletContext.getAttribute("SCADomain.Implementation");
+            if(implClass!=null) {
+                System.setProperty(SCADomain.class.getName(), 
WebSCADomain.class.getName());
+            }
             this.scaDomain = SCADomain.newInstance(domainURI, 
contributionRoot);
             servletContext.setAttribute(SCA_DOMAIN_ATTRIBUTE, scaDomain);
         }
@@ -224,7 +229,7 @@
         try {
 
             InitialContext ic = new InitialContext();
-            URL repoURL = (URL) ic.lookup("java:comp/env/url/contributions");
+            URL repoURL = (URL)ic.lookup("java:comp/env/url/contributions");
 
             contributionRoot = repoURL.toString();
 
@@ -233,11 +238,12 @@
             // ignore exception and use default location
 
             try {
-                URL rootURL = servletContext.getResource("/");
+                String root = "/";
+                URL rootURL = servletContext.getResource(root);
                 if (rootURL.getProtocol().equals("jndi")) {
                     //this is tomcat case, we should use getRealPath
-                    File warRootFile = new 
File(servletContext.getRealPath("/"));
-                    contributionRoot  = warRootFile.toURL().toString();
+                    File warRootFile = new 
File(servletContext.getRealPath(root));
+                    contributionRoot = warRootFile.toURL().toString();
                 } else {
                     //this is jetty case
                     contributionRoot = rootURL.toString();
@@ -285,6 +291,9 @@
         // Close the SCA domain
         if (scaDomain != null) {
             scaDomain.close();
+            if (scaDomain instanceof WebSCADomain) {
+                ((WebSCADomain)scaDomain).destroy();
+            }
         }
     }
 

Added: 
incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebSCADomain.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebSCADomain.java?rev=627211&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebSCADomain.java
 (added)
+++ 
incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebSCADomain.java
 Tue Feb 12 17:19:03 2008
@@ -0,0 +1,53 @@
+/*
+ * 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.tuscany.sca.host.webapp;
+
+import org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebSCADomain extends DefaultSCADomain {
+
+    /**
+     * @param runtimeClassLoader
+     * @param applicationClassLoader
+     * @param domainURI
+     * @param contributionLocation
+     * @param composites
+     */
+    public WebSCADomain(ClassLoader runtimeClassLoader,
+                        ClassLoader applicationClassLoader,
+                        String domainURI,
+                        String contributionLocation,
+                        String... composites) {
+        super(runtimeClassLoader, applicationClassLoader, domainURI, 
contributionLocation, composites);
+    }
+
+    @Override
+    public void close() {
+        // Disable the close() as a hack to keep the WebSCADomain open
+    }
+
+    public void destroy() {
+        super.close();
+    }
+
+}

Propchange: 
incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebSCADomain.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebSCADomain.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



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

Reply via email to