Author: jmarino
Date: Wed Apr 12 11:28:58 2006
New Revision: 393567
URL: http://svn.apache.org/viewcvs?rev=393567&view=rev
Log:
more eventing refactors
Modified:
incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/CompositeScopeTestCase.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventContext.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractEvent.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractRequestEvent.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ContextCreatedEvent.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/Event.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionBoundEvent.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEndEvent.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEvent.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/InstanceCreatedEvent.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleEvent.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStartEvent.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStopEvent.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEndEvent.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEvent.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestStartEvent.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionBoundEvent.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEndEvent.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEvent.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractCompositeContext.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EventContextImpl.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/CompositeScopeContext.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/RequestScopeContext.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/SessionScopeContext.java
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemCompositeContextImpl.java
Modified:
incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/CompositeScopeTestCase.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/CompositeScopeTestCase.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/CompositeScopeTestCase.java
(original)
+++
incubator/tuscany/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/CompositeScopeTestCase.java
Wed Apr 12 11:28:58 2006
@@ -41,7 +41,7 @@
import org.apache.tuscany.model.assembly.SimpleComponent;
/**
- * Tests component nesting. This test need to be in the container.java
progject since it relies on Java POJOs for scope
+ * Tests component nesting. This test needs to be in the container.java
progject since it relies on Java POJOs for scope
* testing.
*
* @version $Rev$ $Date$
@@ -55,6 +55,7 @@
EventContext ctx = new EventContextImpl();
CompositeContext moduleComponentCtx = new CompositeContextImpl();
moduleComponentCtx.setName("testMC");
+ moduleComponentCtx.start();
CompositeScopeContext scopeContainer = new CompositeScopeContext(ctx);
scopeContainer.registerFactory(MockFactory.createCompositeConfiguration("CompositeComponent"));
scopeContainer.start();
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventContext.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventContext.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventContext.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventContext.java
Wed Apr 12 11:28:58 2006
@@ -24,18 +24,23 @@
public interface EventContext {
/**
- * Returns the unique key for the given identifier, e.g a session
+ * Returns the unique key for the given identifier associated with the
current request
*/
public Object getIdentifier(Object type);
/**
- * Sets the unique key for the given identifier, e.g a session
+ * Sets the unique key for the given identifier associated with the
current request
*/
public void setIdentifier(Object type, Object identifier);
/**
- * Clears the unique key for the given identifier, e.g a session
+ * Clears the unique key for the given identifier associated with the
current request
*/
public void clearIdentifier(Object type);
+
+ /**
+ * Clears all identifiers associated with the current request
+ */
+ public void clearIdentifiers();
}
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractEvent.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractEvent.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractEvent.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractEvent.java
Wed Apr 12 11:28:58 2006
@@ -1,7 +1,20 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
package org.apache.tuscany.core.context.event;
/**
- * Represents an abstract event
+ * A basic implementation of a runtime event
*
* @version $$Rev$$ $$Date$$
*/
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractRequestEvent.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractRequestEvent.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractRequestEvent.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractRequestEvent.java
Wed Apr 12 11:28:58 2006
@@ -1,7 +1,7 @@
package org.apache.tuscany.core.context.event;
/**
- * Represents a general request event in the runtime
+ * Base implementation of a request event
*
* @version $$Rev$$ $$Date$$
*/
@@ -9,15 +9,17 @@
private Object id;
+ /**
+ * Creates a new event
+ * @param source the source of the event
+ * @param id the id of the request associated with the event
+ */
public AbstractRequestEvent(Object source, Object id) {
super(source);
assert (id !=null): "Request id was null";
this.id = id;
}
- /**
- * Returns the session id associated with the request
- */
public Object getId(){
return id;
}
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ContextCreatedEvent.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ContextCreatedEvent.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ContextCreatedEvent.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ContextCreatedEvent.java
Wed Apr 12 11:28:58 2006
@@ -1,7 +1,21 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
package org.apache.tuscany.core.context.event;
/**
- * Represents the creation of a [EMAIL PROTECTED]
org.apache.tuscany.core.context.Context} in the runtime
+ * An event propagated upon the creation of a [EMAIL PROTECTED]
org.apache.tuscany.core.context.Context} in the runtime
+ *
* @version $$Rev$$ $$Date$$
*/
public class ContextCreatedEvent extends AbstractEvent {
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/Event.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/Event.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/Event.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/Event.java
Wed Apr 12 11:28:58 2006
@@ -1,10 +1,28 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
package org.apache.tuscany.core.context.event;
/**
+ * Represents an event that is propagated in the runtime
+ *
* @version $$Rev$$ $$Date$$
*/
public interface Event {
+ /**
+ * Returns the source of the event
+ */
public Object getSource();
}
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionBoundEvent.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionBoundEvent.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionBoundEvent.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionBoundEvent.java
Wed Apr 12 11:28:58 2006
@@ -1,12 +1,31 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
package org.apache.tuscany.core.context.event;
/**
- * Represents the start of a session
+ * An event propagated when an HTTP session is bound to the current request
+ *
* @version $$Rev$$ $$Date$$
*/
-public class HttpSessionBoundEvent extends HttpSessionEvent {
+public class HttpSessionBoundEvent extends HttpSessionEvent implements
SessionBoundEvent {
+ /**
+ * Creates a new event
+ * @param source the source of the event
+ * @param id the id of the HTTP session associated with the event or
possibly a lazy wrapper
+ */
public HttpSessionBoundEvent(Object source, Object id) {
super(source,id);
}
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEndEvent.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEndEvent.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEndEvent.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEndEvent.java
Wed Apr 12 11:28:58 2006
@@ -1,13 +1,31 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
package org.apache.tuscany.core.context.event;
/**
- * Represents the expiration of an HTTP-based session
+ * Propagated when an HTTP-based session is expired
*
* @version $$Rev$$ $$Date$$
*/
-public class HttpSessionEndEvent extends HttpSessionEvent {
+public class HttpSessionEndEvent extends HttpSessionEvent implements
SessionEndEvent{
- public HttpSessionEndEvent(Object source, Object id) {
+ /**
+ * Creates a new event
+ * @param source the source of the event
+ * @param id the id of the HTTP session being ended
+ */
+ public HttpSessionEndEvent(Object source, Object id) {
super(source,id);
}
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEvent.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEvent.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEvent.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEvent.java
Wed Apr 12 11:28:58 2006
@@ -1,7 +1,20 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
package org.apache.tuscany.core.context.event;
/**
- * Represents a generic HTTP-based session event in the runtime
+ * A base implementation of HTTP-based session events in the runtime
*
* @version $$Rev$$ $$Date$$
*/
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/InstanceCreatedEvent.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/InstanceCreatedEvent.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/InstanceCreatedEvent.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/InstanceCreatedEvent.java
Wed Apr 12 11:28:58 2006
@@ -1,9 +1,22 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
package org.apache.tuscany.core.context.event;
import org.apache.tuscany.core.context.Context;
/**
- * Denotes a component instance being created in the runtime
+ * Propagated when a component implementation instance is created
*
* @version $$Rev$$ $$Date$$
*/
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleEvent.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleEvent.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleEvent.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleEvent.java
Wed Apr 12 11:28:58 2006
@@ -1,6 +1,21 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
package org.apache.tuscany.core.context.event;
/**
+ * Implemented by runtime events associated with a module, e.g. lifecycle
events
+ *
* @version $$Rev$$ $$Date$$
*/
public interface ModuleEvent extends Event{
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStartEvent.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStartEvent.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStartEvent.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStartEvent.java
Wed Apr 12 11:28:58 2006
@@ -14,7 +14,7 @@
package org.apache.tuscany.core.context.event;
/**
- * Represents the a module start event
+ * Propagated when a module starts
*
* @version $$Rev$$ $$Date$$
*/
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStopEvent.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStopEvent.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStopEvent.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStopEvent.java
Wed Apr 12 11:28:58 2006
@@ -1,7 +1,7 @@
package org.apache.tuscany.core.context.event;
/**
- * Represents the a module end event
+ * Propagated when a module stops
*
* @version $$Rev$$ $$Date$$
*/
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEndEvent.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEndEvent.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEndEvent.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEndEvent.java
Wed Apr 12 11:28:58 2006
@@ -1,12 +1,30 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
package org.apache.tuscany.core.context.event;
/**
- * Represents the end of a request in the runtime
+ * Propagated when a request completes or is ended
*
* @version $$Rev$$ $$Date$$
*/
public class RequestEndEvent extends AbstractRequestEvent{
+ /**
+ * Creates a new event
+ * @param source the source of the event
+ * @param id the id of the completed/ended request
+ */
public RequestEndEvent(Object source, Object id) {
super(source,id);
}
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEvent.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEvent.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEvent.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEvent.java
Wed Apr 12 11:28:58 2006
@@ -1,10 +1,26 @@
-package org.apache.tuscany.core.context.event;
+/**
+ *
+ * Copyright 2005 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.
+ */package org.apache.tuscany.core.context.event;
/**
+ * Implemented by runtime events associated request
* @version $$Rev$$ $$Date$$
*/
public interface RequestEvent {
+ /**
+ * Returns the id of the request the event is associated with
+ */
public Object getId();
}
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestStartEvent.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestStartEvent.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestStartEvent.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestStartEvent.java
Wed Apr 12 11:28:58 2006
@@ -1,12 +1,30 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
package org.apache.tuscany.core.context.event;
/**
- * Represents the start of a request in the runtime
+ * Propagated when a request is started in the runtime
*
* @version $$Rev$$ $$Date$$
*/
public class RequestStartEvent extends AbstractRequestEvent {
+ /**
+ * Creates a new event
+ * @param source the source of the event
+ * @param id the id of the request being started
+ */
public RequestStartEvent(Object source, Object id) {
super(source,id);
}
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionBoundEvent.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionBoundEvent.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionBoundEvent.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionBoundEvent.java
Wed Apr 12 11:28:58 2006
@@ -1,7 +1,21 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
package org.apache.tuscany.core.context.event;
/**
- * Represents the start of a generic session
+ * Propagated when a generic session is associated with the current request.
+ *
* @version $$Rev$$ $$Date$$
*/
public interface SessionBoundEvent extends SessionEvent {
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEndEvent.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEndEvent.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEndEvent.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEndEvent.java
Wed Apr 12 11:28:58 2006
@@ -1,6 +1,21 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
package org.apache.tuscany.core.context.event;
/**
+ * Propagated when a session ended or expired
+ *
* @version $$Rev$$ $$Date$$
*/
public interface SessionEndEvent extends SessionEvent{
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEvent.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEvent.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEvent.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEvent.java
Wed Apr 12 11:28:58 2006
@@ -1,10 +1,30 @@
+/**
+ *
+ * Copyright 2005 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.
+ */
package org.apache.tuscany.core.context.event;
/**
+ * Implemented by runtime events associated with a session. There may be
multiple session types in the runtime such as
+ * HTTP-based or conversational.
+ *
* @version $$Rev$$ $$Date$$
*/
public interface SessionEvent extends Event {
+ /**
+ * Returns the unique key identifying the session type the event is
associated with, e.g. an HTTP-based or conversational
+ * session
+ */
public Object getSessionTypeIdentifier();
/**
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractCompositeContext.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractCompositeContext.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractCompositeContext.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractCompositeContext.java
Wed Apr 12 11:28:58 2006
@@ -27,6 +27,8 @@
import org.apache.tuscany.core.context.event.RequestEndEvent;
import org.apache.tuscany.core.context.event.Event;
import org.apache.tuscany.core.context.event.HttpSessionEvent;
+import org.apache.tuscany.core.context.event.SessionBoundEvent;
+import org.apache.tuscany.core.context.event.SessionEvent;
import org.apache.tuscany.core.context.scope.DefaultScopeStrategy;
import org.apache.tuscany.core.invocation.InvocationConfiguration;
import org.apache.tuscany.core.invocation.ProxyConfiguration;
@@ -441,12 +443,13 @@
public void publish(Event event){
checkInit();
- if (event instanceof HttpSessionBoundEvent) {
+ if (event instanceof SessionBoundEvent) {
+ SessionEvent sessionEvent = ((SessionBoundEvent) event);
// update context
-
eventContext.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER,((HttpSessionBoundEvent)
event).getId());
+ eventContext.setIdentifier(sessionEvent.getSessionTypeIdentifier()
,sessionEvent.getId());
} else if (event instanceof RequestEndEvent) {
// be very careful with pooled threads, ensuring threadlocals are
cleaned up
- eventContext.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER);
+ eventContext.clearIdentifiers();
}
super.publish(event);
}
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EventContextImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EventContextImpl.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EventContextImpl.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EventContextImpl.java
Wed Apr 12 11:28:58 2006
@@ -25,7 +25,7 @@
/**
* An implementation of an [EMAIL PROTECTED]
org.apache.tuscany.core.context.EventContext} that handles event-to-thread
associations using an
* <code>InheritableThreadLocal</code>
- *
+ *
* @version $Rev$ $Date$
*/
public class EventContextImpl implements EventContext {
@@ -68,6 +68,10 @@
if (map != null) {
map.remove(type);
}
+ }
+
+ public void clearIdentifiers() {
+ eventContext.remove();
}
public EventContextImpl() {
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/CompositeScopeContext.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/CompositeScopeContext.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/CompositeScopeContext.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/CompositeScopeContext.java
Wed Apr 12 11:28:58 2006
@@ -143,6 +143,7 @@
}
// propagate events to child contexts
for (CompositeContext context : contexts.values()) {
+ System.out.println("context"+context);
context.publish(event);
}
}
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/RequestScopeContext.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/RequestScopeContext.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/RequestScopeContext.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/RequestScopeContext.java
Wed Apr 12 11:28:58 2006
@@ -81,7 +81,7 @@
/* clean up current context for pooled threads */
if (event instanceof RequestEndEvent){
checkInit();
-
getEventContext().clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER);
+ getEventContext().clearIdentifiers();
notifyInstanceShutdown(Thread.currentThread());
destroyContext();
}else if (event instanceof ContextCreatedEvent){
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/SessionScopeContext.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/SessionScopeContext.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/SessionScopeContext.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/SessionScopeContext.java
Wed Apr 12 11:28:58 2006
@@ -23,10 +23,10 @@
import org.apache.tuscany.core.context.EventContext;
import org.apache.tuscany.core.context.RuntimeEventListener;
import org.apache.tuscany.core.context.ScopeRuntimeException;
-import org.apache.tuscany.core.context.event.HttpSessionEndEvent;
import org.apache.tuscany.core.context.event.ContextCreatedEvent;
import org.apache.tuscany.core.context.event.Event;
import org.apache.tuscany.core.context.event.HttpSessionEvent;
+import org.apache.tuscany.core.context.event.SessionEndEvent;
import java.util.Map;
import java.util.Queue;
@@ -34,7 +34,9 @@
import java.util.concurrent.ConcurrentLinkedQueue;
/**
- * An implementation of an session-scoped component container where each HTTP
session is mapped to a context in the scope
+ * An implementation of an session-scoped component container
+ * TODO this implementation needs to be made generic so that it supports a
range of session types, i.e. not tied to HTTP
+ * session scope
*
* @version $Rev$ $Date$
*/
@@ -71,27 +73,27 @@
}
public void onEvent(Event event) {
- if (event instanceof HttpSessionEndEvent){
- checkInit();
- Object key = ((HttpSessionEndEvent)event).getId();
- notifyInstanceShutdown(key);
- destroyComponentContext(key);
+ if (event instanceof SessionEndEvent){
+ checkInit();
+ Object key = ((SessionEndEvent)event).getId();
+ notifyInstanceShutdown(key);
+ destroyComponentContext(key);
}else if(event instanceof ContextCreatedEvent){
- checkInit();
- if (event.getSource() instanceof AtomicContext) {
- AtomicContext simpleCtx =
(AtomicContext)event.getSource();
- // if destroyable, queue the context to have its
component implementation instance released
- if (simpleCtx.isDestroyable()) {
- Object sessionKey =
getEventContext().getIdentifier(HttpSessionEvent.HTTP_IDENTIFIER);
- Queue<AtomicContext> comps =
destroyableContexts.get(sessionKey);
- if (comps == null) {
- ScopeRuntimeException e = new
ScopeRuntimeException("Shutdown queue not found for key");
- e.setIdentifier(sessionKey.toString());
- throw e;
- }
- comps.add(simpleCtx);
+ checkInit();
+ if (event.getSource() instanceof AtomicContext) {
+ AtomicContext simpleCtx = (AtomicContext)event.getSource();
+ // if destroyable, queue the context to have its component
implementation instance released
+ if (simpleCtx.isDestroyable()) {
+ Object sessionKey =
getEventContext().getIdentifier(HttpSessionEvent.HTTP_IDENTIFIER);
+ Queue<AtomicContext> comps =
destroyableContexts.get(sessionKey);
+ if (comps == null) {
+ ScopeRuntimeException e = new
ScopeRuntimeException("Shutdown queue not found for key");
+ e.setIdentifier(sessionKey.toString());
+ throw e;
}
- }
+ comps.add(simpleCtx);
+ }
+ }
}
}
Modified:
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemCompositeContextImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemCompositeContextImpl.java?rev=393567&r1=393566&r2=393567&view=diff
==============================================================================
---
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemCompositeContextImpl.java
(original)
+++
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemCompositeContextImpl.java
Wed Apr 12 11:28:58 2006
@@ -49,7 +49,6 @@
import org.apache.tuscany.core.context.event.RequestEndEvent;
import org.apache.tuscany.core.context.event.Event;
import org.apache.tuscany.core.context.event.SessionBoundEvent;
-import org.apache.tuscany.core.context.event.HttpSessionEvent;
import org.apache.tuscany.core.context.impl.AbstractContext;
import org.apache.tuscany.core.context.impl.EventContextImpl;
import org.apache.tuscany.core.invocation.jdk.JDKProxyFactoryFactory;
@@ -413,7 +412,7 @@
eventContext.setIdentifier(sessionEvent.getSessionTypeIdentifier(),
sessionEvent.getId());
} else if (event instanceof RequestEndEvent) {
// be very careful with pooled threads, ensuring threadlocals are
cleaned up
- eventContext.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER);
+ eventContext.clearIdentifiers();
}
super.publish(event);
}