You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jb...@apache.org on 2007/02/15 23:57:36 UTC
svn commit: r508227 - in /incubator/tuscany/java/sca/runtime:
itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/
webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/
webapp/webapp-host/src/main/java/org/apache/tuscany/runtime...
Author: jboynes
Date: Thu Feb 15 14:57:35 2007
New Revision: 508227
URL: http://svn.apache.org/viewvc?view=rev&rev=508227
Log:
add temp hack for deploying scdl from a webapp
this should be removed when the contrbution service is available
Modified:
incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenEmbeddedRuntime.java
incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/TuscanyITestMojo.java
incubator/tuscany/java/sca/runtime/webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntime.java
incubator/tuscany/java/sca/runtime/webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java
Modified: incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenEmbeddedRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenEmbeddedRuntime.java?view=diff&rev=508227&r1=508226&r2=508227
==============================================================================
--- incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenEmbeddedRuntime.java (original)
+++ incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/MavenEmbeddedRuntime.java Thu Feb 15 14:57:35 2007
@@ -22,10 +22,8 @@
import org.apache.tuscany.core.runtime.AbstractRuntime;
import org.apache.tuscany.host.runtime.InitializationException;
-import org.apache.tuscany.spi.component.AtomicComponent;
import org.apache.tuscany.spi.component.Component;
import org.apache.tuscany.spi.component.RegistrationException;
-import org.apache.tuscany.spi.component.TargetResolutionException;
import org.apache.tuscany.spi.deployer.Deployer;
import org.apache.tuscany.spi.model.ComponentDefinition;
import org.apache.tuscany.spi.model.CompositeImplementation;
@@ -67,15 +65,5 @@
Component testComponent = getComponentManager().getComponent(componentId);
TargetInvoker targetInvoker = testComponent.createTargetInvoker("testService", operation, null);
targetInvoker.invokeTarget(null, TargetInvoker.NONE);
- }
-
- protected Deployer getDeployer() {
- try {
- URI uri = URI.create("sca://root.system/main/deployer");
- AtomicComponent component = (AtomicComponent) getComponentManager().getComponent(uri);
- return (Deployer) component.getTargetInstance();
- } catch (TargetResolutionException e) {
- throw new AssertionError(e);
- }
}
}
Modified: incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/TuscanyITestMojo.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/TuscanyITestMojo.java?view=diff&rev=508227&r1=508226&r2=508227
==============================================================================
--- incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/TuscanyITestMojo.java (original)
+++ incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/TuscanyITestMojo.java Thu Feb 15 14:57:35 2007
@@ -199,7 +199,7 @@
harnessComponentName = harnessComponentName + '/';
}
name = name.resolve(harnessComponentName);
-
+
CompositeImplementation impl = new CompositeImplementation();
impl.setScdlLocation(testScdl.toURI().toURL());
impl.setClassLoader(testClassLoader);
Modified: incubator/tuscany/java/sca/runtime/webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntime.java?view=diff&rev=508227&r1=508226&r2=508227
==============================================================================
--- incubator/tuscany/java/sca/runtime/webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntime.java (original)
+++ incubator/tuscany/java/sca/runtime/webapp/webapp-api/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntime.java Thu Feb 15 14:57:35 2007
@@ -19,11 +19,13 @@
package org.apache.tuscany.runtime.webapp;
import java.net.URI;
+import java.net.URL;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSessionListener;
import org.apache.tuscany.host.runtime.TuscanyRuntime;
+import org.apache.tuscany.host.runtime.InitializationException;
import org.apache.tuscany.host.servlet.ServletRequestInjector;
/**
@@ -81,5 +83,13 @@
* Request has been ended with the given session id
*/
void httpRequestEnded(Object id);
-
+
+ /**
+ * Temporary method for deploying SCDL supplied with an application to the runtime.
+ *
+ * @param componentID the id of the component that the supplied SCDL should implement
+ * @param applicationScdl the location of an application composite
+ */
+ @Deprecated
+ void deploy(URI componentID, URL applicationScdl) throws InitializationException;
}
Modified: incubator/tuscany/java/sca/runtime/webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java?view=diff&rev=508227&r1=508226&r2=508227
==============================================================================
--- incubator/tuscany/java/sca/runtime/webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java (original)
+++ incubator/tuscany/java/sca/runtime/webapp/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java Thu Feb 15 14:57:35 2007
@@ -19,26 +19,25 @@
package org.apache.tuscany.runtime.webapp;
import java.net.URI;
+import java.net.URL;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import org.osoa.sca.ComponentContext;
-import org.apache.tuscany.spi.component.Component;
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.component.RegistrationException;
-import org.apache.tuscany.spi.event.EventPublisher;
-
-import org.apache.tuscany.core.component.event.HttpRequestEnded;
-import org.apache.tuscany.core.component.event.HttpRequestStart;
-import org.apache.tuscany.core.component.event.HttpSessionEnd;
-import org.apache.tuscany.core.component.event.HttpSessionStart;
import org.apache.tuscany.core.runtime.AbstractRuntime;
import org.apache.tuscany.host.runtime.InitializationException;
import org.apache.tuscany.host.servlet.ServletRequestInjector;
import static org.apache.tuscany.runtime.webapp.Constants.CONTEXT_ATTRIBUTE;
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.ComponentException;
+import org.apache.tuscany.spi.component.RegistrationException;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.CompositeImplementation;
+import org.apache.tuscany.spi.resolver.ResolutionException;
/**
* Bootstrapper for the Tuscany runtime in a web application host. This listener manages one runtime per servlet
@@ -56,9 +55,7 @@
public class WebappRuntimeImpl extends AbstractRuntime implements WebappRuntime {
private ServletContext servletContext;
-
private ServletRequestInjector requestInjector;
- private CompositeComponent application;
public ServletContext getServletContext() {
return servletContext;
@@ -120,12 +117,26 @@
}
*/
- public void destroy() {
- if (application != null) {
- application.stop();
- application = null;
+ @Deprecated
+ public void deploy(URI componentID, URL applicationScdl) throws InitializationException {
+ CompositeImplementation impl = new CompositeImplementation();
+ impl.setScdlLocation(applicationScdl);
+ impl.setClassLoader(getHostClassLoader());
+
+ ComponentDefinition<CompositeImplementation> definition =
+ new ComponentDefinition<CompositeImplementation>(componentID, impl);
+ try {
+ Component component = getDeployer().deploy(null, definition);
+ component.start();
+ } catch (LoaderException e) {
+ throw new InitializationException(e);
+ } catch (BuilderException e) {
+ throw new InitializationException(e);
+ } catch (ComponentException e) {
+ throw new InitializationException(e);
+ } catch (ResolutionException e) {
+ throw new InitializationException(e);
}
- super.destroy();
}
public void bindComponent(URI componentId) {
@@ -142,33 +153,37 @@
}
public void sessionCreated(HttpSessionEvent event) {
+/*
HttpSessionStart startSession = new HttpSessionStart(this, event.getSession().getId());
application.publish(startSession);
((EventPublisher) requestInjector).publish(startSession);
+*/
}
public void sessionDestroyed(HttpSessionEvent event) {
+/*
HttpSessionEnd endSession = new HttpSessionEnd(this, event.getSession().getId());
application.publish(endSession);
((EventPublisher) requestInjector).publish(endSession);
+*/
}
public void httpRequestStarted(HttpServletRequest request) {
+/*
HttpSession session = request.getSession(false);
Object sessionId = session == null ? new LazyHTTPSessionId(request) : session.getId();
HttpRequestStart httpRequestStart = new HttpRequestStart(this, sessionId);
-/*
application.publish(httpRequestStart);
-*/
((EventPublisher) requestInjector).publish(httpRequestStart);
+*/
}
public void httpRequestEnded(Object sessionid) {
- HttpRequestEnded httpRequestEnded = new HttpRequestEnded(this, sessionid);
/*
+ HttpRequestEnded httpRequestEnded = new HttpRequestEnded(this, sessionid);
application.publish(httpRequestEnded);
-*/
((EventPublisher) requestInjector).publish(httpRequestEnded);
+*/
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org