summaryrefslogtreecommitdiffstats
path: root/branches
diff options
context:
space:
mode:
Diffstat (limited to 'branches')
-rw-r--r--branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java33
-rw-r--r--branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java35
-rw-r--r--branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java55
-rw-r--r--branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java35
-rw-r--r--branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java37
-rw-r--r--branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java56
-rw-r--r--branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java46
-rw-r--r--branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java96
-rw-r--r--branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java57
-rw-r--r--branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java71
-rw-r--r--branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java71
-rw-r--r--branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java56
-rw-r--r--branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java56
-rw-r--r--branches/sca-equinox/modules/core-spi/src/test/java/org/apache/tuscany/sca/event/TrueFilterTestCase.java63
-rw-r--r--branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.java89
-rw-r--r--branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.java54
-rw-r--r--branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.java53
-rw-r--r--branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.java53
-rw-r--r--branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.java52
-rw-r--r--branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.java53
-rw-r--r--branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.java52
-rw-r--r--branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.java45
-rw-r--r--branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.java45
-rw-r--r--branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java4
-rw-r--r--branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java3
-rw-r--r--branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java7
-rw-r--r--branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/DefaultScopeRegistry.java4
-rw-r--r--branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java12
-rw-r--r--branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java10
-rw-r--r--branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java3
-rw-r--r--branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java195
-rw-r--r--branches/sca-equinox/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.java98
-rw-r--r--branches/sca-equinox/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.java69
-rw-r--r--branches/sca-equinox/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java165
34 files changed, 6 insertions, 1827 deletions
diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java
deleted file mode 100644
index 992c1188f7..0000000000
--- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.event;
-
-/**
- * The base interface for events that are propagated in the runtime
- *
- * @version $Rev$ $Date$
- */
-public interface Event {
-
- /**
- * Returns the source of the event
- */
- Object getSource();
-
-}
diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java
deleted file mode 100644
index d17aebd7e8..0000000000
--- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.event;
-
-/**
- * Evaluates whether a {@link RuntimeEventListener} is applicable to a given runtime event
- *
- * @version $Rev$ $Date$
- */
-public interface EventFilter {
-
- /**
- * Performs the actual evaluation on an event
- * @param event Returns true if the event matches implemented criteria
- * @return Match result
- */
- boolean match(Event event);
-
-}
diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java
deleted file mode 100644
index f209eb8936..0000000000
--- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.event;
-
-/**
- * Publishes events in the runtime by accepting {@link Event} objects and
- * forwarding them to all registered {@link RuntimeEventListener} objects.
- *
- * @version $Rev$ $Date$
- */
-public interface EventPublisher {
-
- /**
- * Publish an event to all registered listeners
- * @param object The event to publish
- */
- void publish(Event object);
-
- /**
- * Registers a listener to receive notifications for the context
- * @param listener The listener to add
- */
- void addListener(RuntimeEventListener listener);
-
- /**
- * Registers a listener to receive notifications for the context
- * @param filter The filter that will be applied before the lister is called
- * @param listener The lister to add
- */
- void addListener(EventFilter filter, RuntimeEventListener listener);
-
-
- /**
- * Removes a previously registered listener
- * @param listener The listener to remove
- */
- void removeListener(RuntimeEventListener listener);
-
-}
diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java
deleted file mode 100644
index b34dceee62..0000000000
--- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.event;
-
-import java.util.EventListener;
-
-/**
- * Listeners observe events fired in the SCA runtime.
- *
- * @version $Rev$ $Date$
- */
-public interface RuntimeEventListener extends EventListener {
-
- /**
- * Accepts and event and acts on it
- * @param event The event to act on
- */
- void onEvent(Event event);
-}
diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java
deleted file mode 100644
index f888908340..0000000000
--- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.event;
-
-/**
- * An event filter that always returns a true condition
- *
- * @version $Rev$ $Date$
- */
-public class TrueFilter implements EventFilter {
-
- /**
- * Performs the actual evaluation on an event. Always returns true
- * in this case
- * @param event The incoming event which is ignored
- * @return true
- */
- public boolean match(Event event) {
- return true;
- }
-}
diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java
deleted file mode 100644
index 7d5cd6c54b..0000000000
--- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.store;
-
-/**
- * thrown when a record already exists during an insert operation
- *
- * @version $Rev$ $Date$
- */
-public class DuplicateRecordException extends StoreWriteException {
- private static final long serialVersionUID = 3116253222569378447L;
-
- /**
- * {@inheritDoc}
- */
- public DuplicateRecordException() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- public DuplicateRecordException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * {@inheritDoc}
- */
- public DuplicateRecordException(String message) {
- super(message);
- }
-
- /**
- * {@inheritDoc}
- */
- public DuplicateRecordException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java
deleted file mode 100644
index 9d965a3369..0000000000
--- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.store;
-
-import java.util.UUID;
-
-/**
- * Implementations receive callback events during a store recovery operation
- *
- * @version $Rev$ $Date$
- */
-public interface RecoveryListener {
-
- /**
- * Signals the start of a recovery
- */
- void onBegin();
-
- /**
- * Received when a record is recovered
- *
- * @param id
- */
- void onRecord(UUID id);
-
- /**
- * Signals the end of recovery
- */
- void onEnd();
-}
diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java
deleted file mode 100644
index b15cde066a..0000000000
--- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.store;
-
-import org.apache.tuscany.sca.event.EventPublisher;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * Implementations provide a persistent store for runtime data such as conversational state. A persistent store could be
- * implemented in a durable fashion using JDBC or a journaling system, or using a non-durable mechanism such as an
- * in-memory map.
- *
- * @version $Rev$ $Date$
- */
-public interface Store extends EventPublisher {
-
- /* Used to indicate an the default expiration offset for records for the store */
- long DEFAULT_EXPIRATION_OFFSET = -1;
-
- /* Used to indicate an entry should not expire */
- long NEVER = -2;
-
- /**
- * Adds the given record to the store. Implementations may choose different strategies for writing data such as
- * write-through or write-behind.
- *
- * @param owner the instance owner
- * @param id the unique id of the record
- * @param object the object representing the data to write
- * @param expiration the time in milliseconds when the entry expires
- * @throws StoreWriteException if an error occurs during the write operation
- */
- void insertRecord(RuntimeComponent owner, String id, Object object, long expiration) throws StoreWriteException;
-
- /**
- * Updates a given record in the store, overwriting previous information.
- *
- * @param owner the instance owner
- * @param id the unique id of the record
- * @param object the object representing the data to write
- * @param expiration the time in milliseconds when the entry expires
- * @throws StoreWriteException
- */
- void updateRecord(RuntimeComponent owner, String id, Object object, long expiration) throws StoreWriteException;
-
- /**
- * Returns the deserialized object in the store corresponding to the given id
- *
- * @param owner the instance owner
- * @param id the unique id of the record
- * @return the deserialized object or null if one is not found
- * @throws StoreReadException
- */
- Object readRecord(RuntimeComponent owner, String id) throws StoreReadException;
-
- /**
- * Removes a record from the store
- *
- * @param owner the instance owner
- * @param id the unique id of the record
- * @throws StoreWriteException
- */
- void removeRecord(RuntimeComponent owner, String id) throws StoreWriteException;
-
- /**
- * Removes all records from the store
- *
- * @throws StoreWriteException
- */
- void removeRecords() throws StoreWriteException;
-
- /**
- * Initiates a recovery operation, for example during restart after a crash
- *
- * @param listener the listener to receive recovery callback events
- * @throws StoreReadException
- */
- void recover(RecoveryListener listener) throws StoreReadException;
-
-}
diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java
deleted file mode 100644
index 24eaddd3e0..0000000000
--- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.store;
-
-
-/**
- * Represents a generic exception thrown by a <code>Store</code>
- *
- * @version $Rev$ $Date$
- */
-public class StoreException extends Exception {
- private static final long serialVersionUID = -319152147419962709L;
-
- /**
- * {@inheritDoc}
- */
- public StoreException() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreException(String message) {
- super(message);
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java
deleted file mode 100644
index 5c1a3ca79d..0000000000
--- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.store;
-
-import org.apache.tuscany.sca.event.Event;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * Fired when a store implementation expires a resource
- *
- * @version $Rev$ $Date$
- */
-public class StoreExpirationEvent implements Event {
- private Object source;
- private RuntimeComponent owner;
- private Object instance;
-
- /**
- * Constructor.
- *
- * @param source the source of the event
- * @param owner the owner of the expiring object
- * @param instance the expiring object
- */
- public StoreExpirationEvent(Object source, RuntimeComponent owner, Object instance) {
- assert source != null;
- assert owner != null;
- assert instance != null;
- this.source = source;
- this.owner = owner;
- this.instance = instance;
- }
-
- public Object getSource() {
- return source;
- }
-
- /**
- * Returns the owner of the expiring object.
- *
- * @return the owner of the expiring object.
- */
- public RuntimeComponent getOwner() {
- return owner;
- }
-
- /**
- * Returns the expiring object.
- *
- * @return the expiring object.
- */
- public Object getInstance() {
- return instance;
- }
-}
diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java
deleted file mode 100644
index 4bc7facf39..0000000000
--- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.store;
-
-
-/**
- * A generic monitor interface for services to log events
- *
- * @version $Rev$ $Date$
- */
-public interface StoreMonitor {
-
- /**
- * Signals the service has started
- *
- * @param msg
- */
- void start(String msg);
-
- /**
- * Signals the service has been shutdown
- *
- * @param msg
- */
- void stop(String msg);
-
- /**
- * Fired when recovery is started
- */
-
- void beginRecover();
-
- /**
- * Fired when recovery is completed
- */
-
- void endRecover();
-
- /**
- * Fired when a record is processed during recovery
- *
- * @param recordId the id of the record being recovered
- */
-
- void recover(Object recordId);
-
- /**
- * Signals an error event
- *
- * @param e the error
- */
-
- void error(Throwable e);
-
-}
diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java
deleted file mode 100644
index c2346bddca..0000000000
--- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.store;
-
-/**
- * Thrown when an error occurs reading from persistent storage
- *
- * @version $Rev$ $Date$
- */
-public class StoreReadException extends StoreException {
- private static final long serialVersionUID = -8624542082121467271L;
-
- /**
- * {@inheritDoc}
- */
- public StoreReadException() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreReadException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreReadException(String message) {
- super(message);
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreReadException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java
deleted file mode 100644
index b37519b31c..0000000000
--- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.store;
-
-/**
- * Thrown when an error occurs writing to persistent storage
- *
- * @version $Rev$ $Date$
- */
-public class StoreWriteException extends StoreException {
- private static final long serialVersionUID = 5539070473942048555L;
-
- /**
- * {@inheritDoc}
- */
- public StoreWriteException() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreWriteException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreWriteException(String message) {
- super(message);
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreWriteException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-equinox/modules/core-spi/src/test/java/org/apache/tuscany/sca/event/TrueFilterTestCase.java b/branches/sca-equinox/modules/core-spi/src/test/java/org/apache/tuscany/sca/event/TrueFilterTestCase.java
deleted file mode 100644
index 2425133273..0000000000
--- a/branches/sca-equinox/modules/core-spi/src/test/java/org/apache/tuscany/sca/event/TrueFilterTestCase.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.event;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Test case for TrueFilter
- *
- * @version $Rev$ $Date$
- */
-public class TrueFilterTestCase {
-
- /**
- * Test TrueFilter matching an event
- */
- @Test
- public void testTrueFilterMatch() {
- EventFilter filter = new TrueFilter();
-
- Assert.assertTrue(filter.match(new DummyEvent()));
- }
-
- /**
- * Test TrueFilter matching null
- */
- @Test
- public void testTrueFilterMatchNull() {
- EventFilter filter = new TrueFilter();
-
- Assert.assertTrue(filter.match(null));
- }
-
- /**
- * Dummy Event implementation for testing
- */
- private class DummyEvent implements Event {
-
- /**
- * {@inheritDoc}
- */
- public Object getSource() {
- throw new UnsupportedOperationException();
- }
- }
-}
diff --git a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.java b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.java
deleted file mode 100644
index 517e5579a4..0000000000
--- a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.core.event;
-
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.apache.tuscany.sca.event.Event;
-import org.apache.tuscany.sca.event.EventFilter;
-import org.apache.tuscany.sca.event.EventPublisher;
-import org.apache.tuscany.sca.event.RuntimeEventListener;
-import org.apache.tuscany.sca.event.TrueFilter;
-
-/**
- * Base implementation of an <code>EventPublisher</code>
- *
- * @version $Rev$ $Date$
- */
-public abstract class BaseEventPublisher implements EventPublisher {
- protected static final EventFilter TRUE_FILTER = new TrueFilter();
- protected Map<EventFilter, List<RuntimeEventListener>> listeners;
-
- public void addListener(RuntimeEventListener listener) {
- addListener(TRUE_FILTER, listener);
- }
-
- public void removeListener(RuntimeEventListener listener) {
- assert listener != null : "Listener cannot be null";
- synchronized (getListeners()) {
- for (List<RuntimeEventListener> currentList : getListeners().values()) {
- for (RuntimeEventListener current : currentList) {
- if (current == listener) {
- currentList.remove(current);
- return;
- }
- }
- }
- }
- }
-
- public void addListener(EventFilter filter, RuntimeEventListener listener) {
- assert listener != null : "Listener cannot be null";
- synchronized (getListeners()) {
- List<RuntimeEventListener> list = getListeners().get(filter);
- if (list == null) {
- list = new CopyOnWriteArrayList<RuntimeEventListener>();
- listeners.put(filter, list);
- }
- list.add(listener);
- }
- }
-
- public void publish(Event event) {
- assert event != null : "Event object was null";
- for (Map.Entry<EventFilter, List<RuntimeEventListener>> entry : getListeners().entrySet()) {
- if (entry.getKey().match(event)) {
- for (RuntimeEventListener listener : entry.getValue()) {
- listener.onEvent(event);
- }
- }
- }
- }
-
- protected Map<EventFilter, List<RuntimeEventListener>> getListeners() {
- if (listeners == null) {
- listeners = new ConcurrentHashMap<EventFilter, List<RuntimeEventListener>>();
- }
- return listeners;
- }
-
-}
diff --git a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.java b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.java
deleted file mode 100644
index 45eab7da1b..0000000000
--- a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.core.event;
-
-import java.net.URI;
-
-import org.apache.tuscany.sca.event.Event;
-
-/**
- * Propagated when a component starts
- *
- * @version $Rev$ $Date$
- */
-public class ComponentStart implements Event {
-
- private Object source;
- private URI uri;
-
- /**
- * Creates a component start event
- *
- * @param source the source of the event
- * @param componentURI the URI of the component being started
- */
- public ComponentStart(Object source, URI componentURI) {
- this.source = source;
- this.uri = componentURI;
- }
-
- public URI getComponentURI() {
- return uri;
- }
-
- public Object getSource() {
- return source;
- }
-
-}
diff --git a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.java b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.java
deleted file mode 100644
index 4dc79c3844..0000000000
--- a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.core.event;
-
-import java.net.URI;
-
-import org.apache.tuscany.sca.event.Event;
-
-/**
- * Propagated when a component stops
- *
- * @version $Rev$ $Date$
- */
-public class ComponentStop implements Event {
-
- private Object source;
- private URI uri;
-
- /**
- * Creates a component stop event
- *
- * @param source the source of the event
- * @param componentUri the composite component associated the component being stopped
- */
- public ComponentStop(Object source, URI componentUri) {
- this.source = source;
- this.uri = componentUri;
- }
-
- public URI getComponentURI() {
- return uri;
- }
-
- public Object getSource() {
- return source;
- }
-}
diff --git a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.java b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.java
deleted file mode 100644
index d3106c7052..0000000000
--- a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.core.event;
-
-import org.apache.tuscany.sca.event.Event;
-
-
-
-/**
- * Propagated when a conversation is expired
- *
- * @version $Rev$ $Date$
- */
-public class ConversationEnd implements Event {
-
- private Object source;
- private Object id;
-
- /**
- * Creates a new event
- *
- * @param source the source of the event
- * @param id the id of the conversation being ended
- */
- public ConversationEnd(Object source, Object id) {
- this.source = source;
- this.id = id;
- }
-
- public Object getSource() {
- return source;
- }
-
- public Object getConversationID() {
- return id;
- }
-}
diff --git a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.java b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.java
deleted file mode 100644
index 123400fbdd..0000000000
--- a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.core.event;
-
-import org.apache.tuscany.sca.event.Event;
-
-
-/**
- * Propagated when a conversation has started
- *
- * @version $Rev$ $Date$
- */
-public class ConversationStart implements Event {
-
- private Object source;
- private Object id;
-
- /**
- * Creates a new event
- *
- * @param source the source of the event
- * @param id the id of the conversation being started
- */
- public ConversationStart(Object source, Object id) {
- this.source = source;
- this.id = id;
- }
-
- public Object getSource() {
- return source;
- }
-
- public Object getConversationID() {
- return id;
- }
-}
diff --git a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.java b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.java
deleted file mode 100644
index 68cb5c2966..0000000000
--- a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.core.event;
-
-import org.apache.tuscany.sca.event.Event;
-
-
-
-/**
- * Propagated when an HTTP-based session is expired
- *
- * @version $Rev$ $Date$
- */
-public class HttpSessionEnd implements Event {
-
- private Object source;
- private Object id;
-
- /**
- * Creates a new event
- *
- * @param source the source of the event
- * @param id the id of the HTTP session being ended
- */
- public HttpSessionEnd(Object source, Object id) {
- this.source = source;
- this.id = id;
- }
-
- public Object getSource() {
- return source;
- }
-
- public Object getSessionID() {
- return id;
- }
-}
diff --git a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.java b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.java
deleted file mode 100644
index 38a4fb10d6..0000000000
--- a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.core.event;
-
-import org.apache.tuscany.sca.event.Event;
-
-
-/**
- * Propagated when an HTTP-based session has started
- *
- * @version $Rev$ $Date$
- */
-public class HttpSessionStart implements Event {
-
- private Object source;
- private Object id;
-
- /**
- * Creates a new event
- *
- * @param source the source of the event
- * @param id the id of the HTTP session being started
- */
- public HttpSessionStart(Object source, Object id) {
- this.source = source;
- this.id = id;
- }
-
- public Object getSource() {
- return source;
- }
-
- public Object getSessionID() {
- return id;
- }
-}
diff --git a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.java b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.java
deleted file mode 100644
index d7e797bbb9..0000000000
--- a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.core.event;
-
-import org.apache.tuscany.sca.event.Event;
-
-/**
- * Propagated when a request completes or is ended
- *
- * @version $Rev$ $Date$
- */
-public class RequestEnd implements Event {
-
- private Object source;
-
- /**
- * Creates a new event
- *
- * @param source the source of the event
- */
- public RequestEnd(Object source) {
- this.source = source;
- }
-
- public Object getSource() {
- return source;
- }
-
-}
diff --git a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.java b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.java
deleted file mode 100644
index 7530156b11..0000000000
--- a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.core.event;
-
-import org.apache.tuscany.sca.event.Event;
-
-/**
- * Propagated when a request is started in the runtime
- *
- * @version $Rev$ $Date$
- */
-public class RequestStart implements Event {
-
- private Object source;
-
- /**
- * Creates a new event
- *
- * @param source the source of the event
- */
- public RequestStart(Object source) {
- this.source = source;
- }
-
- public Object getSource() {
- return source;
- }
-
-}
diff --git a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java
index 1168d1d0dd..ff92aa00a8 100644
--- a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java
+++ b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java
@@ -22,7 +22,6 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.event.Event;
import org.apache.tuscany.sca.provider.ImplementationProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
@@ -88,9 +87,6 @@ public abstract class AbstractScopeContainer<KEY> implements ScopeContainer<KEY>
// do nothing here. the conversational scope container implements this
}
- public void onEvent(Event event) {
- }
-
protected boolean isEagerInit() {
ImplementationProvider implementationProvider = ((RuntimeComponent)component).getImplementationProvider();
if (implementationProvider instanceof ScopedImplementationProvider) {
diff --git a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java
index 3ae1ca51c5..dc5d9ea8fe 100644
--- a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java
+++ b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java
@@ -32,7 +32,6 @@ import org.apache.tuscany.sca.core.conversation.ExtendedConversation;
import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.store.Store;
/**
* A scope context which manages atomic component instances keyed on ConversationID
@@ -44,7 +43,7 @@ public class ConversationalScopeContainer extends AbstractScopeContainer<Object>
private Map<Object, InstanceLifeCycleWrapper> instanceLifecycleCollection =
new ConcurrentHashMap<Object, InstanceLifeCycleWrapper>();
- public ConversationalScopeContainer(Store aStore, RuntimeComponent component) {
+ public ConversationalScopeContainer(RuntimeComponent component) {
super(Scope.CONVERSATION, component);
// Note: aStore is here to preserve the original factory interface. It is not currently used in this
diff --git a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java
index a6663aba09..6263cf6313 100644
--- a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java
+++ b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java
@@ -20,21 +20,18 @@
package org.apache.tuscany.sca.core.scope;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.store.Store;
/**
* @version $Rev$ $Date$
*/
public class ConversationalScopeContainerFactory implements ScopeContainerFactory {
- private Store store;
- public ConversationalScopeContainerFactory(Store store) {
+ public ConversationalScopeContainerFactory() {
super();
- this.store = store;
}
public ScopeContainer createScopeContainer(RuntimeComponent component) {
- return new ConversationalScopeContainer(store, component);
+ return new ConversationalScopeContainer(component);
}
public Scope getScope() {
diff --git a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/DefaultScopeRegistry.java b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/DefaultScopeRegistry.java
index 94f26845ed..4d4b324e05 100644
--- a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/DefaultScopeRegistry.java
+++ b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/DefaultScopeRegistry.java
@@ -22,7 +22,7 @@ package org.apache.tuscany.sca.core.scope;
/**
* A default scope registry implementation.
*
- * @version $Rev: $ $Date: $
+ * @version $Rev$ $Date$
*/
public class DefaultScopeRegistry extends ScopeRegistryImpl implements ScopeRegistry {
@@ -30,7 +30,7 @@ public class DefaultScopeRegistry extends ScopeRegistryImpl implements ScopeRegi
ScopeContainerFactory[] factories =
new ScopeContainerFactory[] {new CompositeScopeContainerFactory(), new StatelessScopeContainerFactory(),
new RequestScopeContainerFactory(),
- new ConversationalScopeContainerFactory(null),
+ new ConversationalScopeContainerFactory(),
// new HttpSessionScopeContainer(monitor)
};
for (ScopeContainerFactory f : factories) {
diff --git a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java
index 5ae8b94647..c359f04ae0 100644
--- a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java
+++ b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java
@@ -19,8 +19,6 @@
package org.apache.tuscany.sca.core.scope;
import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.core.event.HttpSessionEnd;
-import org.apache.tuscany.sca.event.Event;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
/**
@@ -36,16 +34,6 @@ public class HttpSessionScopeContainer extends AbstractScopeContainer<Object> {
}
@Override
- public void onEvent(Event event) {
- checkInit();
- if (event instanceof HttpSessionEnd) {
- //FIXME key is not used
- //Object key = ((HttpSessionEnd)event).getSessionID();
- // FIXME: Remove the session id
- }
- }
-
- @Override
public synchronized void start() {
if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]");
diff --git a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java
index f11a61e662..c6fd9ec067 100644
--- a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java
+++ b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java
@@ -22,8 +22,6 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.core.event.RequestEnd;
-import org.apache.tuscany.sca.event.Event;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
/**
@@ -41,14 +39,6 @@ public class RequestScopeContainer extends AbstractScopeContainer<Thread> {
}
@Override
- public void onEvent(Event event) {
- checkInit();
- if (event instanceof RequestEnd) {
- // shutdownInstances(Thread.currentThread());
- }
- }
-
- @Override
public synchronized void start() {
if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]");
diff --git a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java
index 6b2980b989..0f82e5e864 100644
--- a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java
+++ b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java
@@ -19,7 +19,6 @@
package org.apache.tuscany.sca.core.scope;
import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.event.RuntimeEventListener;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
@@ -31,7 +30,7 @@ import org.apache.tuscany.sca.runtime.RuntimeComponent;
* For example, for COMPOSITE scope this could be the URI of the composite component,
* or for HTTP Session scope it might be the HTTP session ID.
*/
-public interface ScopeContainer<KEY> extends RuntimeEventListener {
+public interface ScopeContainer<KEY> {
/**
* Returns the Scope that this container supports.
diff --git a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java b/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java
deleted file mode 100644
index 5b838116c5..0000000000
--- a/branches/sca-equinox/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * 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.core.store;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.tuscany.sca.core.event.BaseEventPublisher;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.store.DuplicateRecordException;
-import org.apache.tuscany.sca.store.RecoveryListener;
-import org.apache.tuscany.sca.store.Store;
-import org.apache.tuscany.sca.store.StoreExpirationEvent;
-import org.apache.tuscany.sca.store.StoreMonitor;
-import org.apache.tuscany.sca.store.StoreWriteException;
-import org.osoa.sca.annotations.Destroy;
-import org.osoa.sca.annotations.EagerInit;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Service;
-
-/**
- * Implements a non-durable, non-transactional store using a simple in-memory map
- *
- * @version $Rev$ $Date$
- */
-@Service(Store.class)
-@EagerInit
-public class MemoryStore extends BaseEventPublisher implements Store {
- private Map<RuntimeComponent, Map<String, Record>> store;
- // TODO integrate with a core threading scheme
- private ScheduledExecutorService scheduler;
- private long reaperInterval = 300000;
- private StoreMonitor monitor;
- private long defaultExpirationOffset = 600000; // 10 minutes
-
- public MemoryStore(StoreMonitor monitor) {
- this.monitor = monitor;
- this.store = new ConcurrentHashMap<RuntimeComponent, Map<String, Record>>();
- this.scheduler = Executors.newSingleThreadScheduledExecutor();
- }
-
- /**
- * Returns the maximum default expiration offset for records in the store
- *
- * @return the maximum default expiration offset for records in the store
- */
- public long getDefaultExpirationOffset() {
- return defaultExpirationOffset;
- }
-
- /**
- * Sets the maximum default expiration offset for records in the store
- */
- @Property
- public void setDefaultExpirationOffset(long defaultExpirationOffset) {
- this.defaultExpirationOffset = defaultExpirationOffset;
- }
-
- /**
- * Sets the interval for expired entry scanning to be performed
- */
- @Property
- public void setReaperInterval(long reaperInterval) {
- this.reaperInterval = reaperInterval;
- }
-
- public long getReaperInterval() {
- return reaperInterval;
- }
-
- @Init
- public void init() {
- scheduler.scheduleWithFixedDelay(new Reaper(), reaperInterval, reaperInterval, TimeUnit.MILLISECONDS);
- monitor.start("In-memory store started");
- }
-
- @Destroy
- public void destroy() {
- scheduler.shutdown();
- monitor.stop("In-memory store stopped");
- }
-
- public void insertRecord(RuntimeComponent owner, String id, Object object, long expiration) throws StoreWriteException {
- Map<String, Record> map = store.get(owner);
- if (map == null) {
- map = new ConcurrentHashMap<String, Record>();
- store.put(owner, map);
- }
- if (map.containsKey(id)) {
- throw new DuplicateRecordException("Duplicate record: " + owner.getURI() +" : " + id);
- }
- map.put(id, new Record(object, expiration));
- }
-
- public void updateRecord(RuntimeComponent owner, String id, Object object, long expiration) throws StoreWriteException {
- Map<String, Record> map = store.get(owner);
- if (map == null) {
- throw new StoreWriteException("Record not found: " + owner.getURI() +" : " + id);
- }
- Record record = map.get(id);
- if (record == null) {
- throw new StoreWriteException("Record not found: " + owner.getURI() +" : " + id);
- }
- record.data = object;
- }
-
- public Object readRecord(RuntimeComponent owner, String id) {
- Map<String, Record> map = store.get(owner);
- if (map == null) {
- return null;
- }
- Record record = map.get(id);
- if (record != null) {
- return record.data;
- }
- return null;
- }
-
- public void removeRecords() {
- store.clear();
- }
-
- public void removeRecord(RuntimeComponent owner, String id) throws StoreWriteException {
- Map<String, Record> map = store.get(owner);
- if (map == null) {
- throw new StoreWriteException("Owner not found: " + owner.getURI() +" : " + id);
- }
- if (map.remove(id) == null) {
- throw new StoreWriteException("Owner not found: " + owner.getURI() +" : " + id);
- }
- }
-
- public void recover(RecoveryListener listener) {
- throw new UnsupportedOperationException();
- }
-
- private class Record {
- private Object data;
- private long expiration = NEVER;
-
- public Record(Object data, long expiration) {
- this.data = data;
- this.expiration = expiration;
- }
-
- public Object getData() {
- return data;
- }
-
- public long getExpiration() {
- return expiration;
- }
- }
-
- private class Reaper implements Runnable {
-
- public void run() {
- long now = System.currentTimeMillis();
- for (Map.Entry<RuntimeComponent, Map<String, Record>> entries : store.entrySet()) {
- for (Map.Entry<String, Record> entry : entries.getValue().entrySet()) {
- final long expiration = entry.getValue().expiration;
- if (expiration != NEVER && now >= expiration) {
- RuntimeComponent owner = entries.getKey();
- Object instance = entry.getValue().getData();
- // notify listeners of the expiration
- StoreExpirationEvent event = new StoreExpirationEvent(this, owner, instance);
- publish(event);
- entries.getValue().remove(entry.getKey());
- }
- }
- }
- }
- }
-
-}
diff --git a/branches/sca-equinox/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.java b/branches/sca-equinox/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.java
deleted file mode 100644
index 2bc78c3d35..0000000000
--- a/branches/sca-equinox/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.core.event;
-
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.event.Event;
-import org.apache.tuscany.sca.event.EventFilter;
-import org.apache.tuscany.sca.event.EventPublisher;
-import org.apache.tuscany.sca.event.RuntimeEventListener;
-import org.apache.tuscany.sca.event.TrueFilter;
-import org.easymock.EasyMock;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BaseEventPublisherTestCase extends TestCase {
- EventPublisher publisher;
-
- public void testFireListener() {
- Event event = new TestEvent();
- RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
- listener.onEvent(EasyMock.same(event));
- EasyMock.expectLastCall();
- EasyMock.replay(listener);
- publisher.addListener(listener);
- publisher.publish(event);
- EasyMock.verify(listener);
- }
-
- public void testRemoveListener() {
- Event event = new TestEvent();
- RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
- EasyMock.replay(listener);
- publisher.addListener(listener);
- publisher.removeListener(listener);
- publisher.publish(event);
- EasyMock.verify(listener);
- }
-
- public void testFalseFilterListener() {
- Event event = new TestEvent();
- RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
- EasyMock.replay(listener);
- publisher.addListener(new FalseFilter(), listener);
- publisher.publish(event);
- EasyMock.verify(listener);
- }
-
- public void testTrueFilterListener() {
- Event event = new TestEvent();
- RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
- listener.onEvent(EasyMock.same(event));
- EasyMock.expectLastCall();
- EasyMock.replay(listener);
- publisher.addListener(new TrueFilter(), listener);
- publisher.publish(event);
- EasyMock.verify(listener);
- }
-
- @Override
- protected void setUp() throws Exception {
- publisher = new BaseEventPublisher() {
- };
- }
-
- private class TestEvent implements Event {
- public Object getSource() {
- return null;
- }
- }
-
- private class FalseFilter implements EventFilter {
-
- public boolean match(Event event) {
- return false;
- }
- }
-
-
-}
diff --git a/branches/sca-equinox/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.java b/branches/sca-equinox/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.java
deleted file mode 100644
index 48dcf8df07..0000000000
--- a/branches/sca-equinox/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.core.event;
-
-import java.net.URI;
-
-import junit.framework.TestCase;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EventTestCase extends TestCase {
- private URI uri = URI.create("foo");
-
- public void testCompositeStart() {
- ComponentStart event = new ComponentStart(this, uri);
- assertEquals(uri, event.getComponentURI());
- }
-
- public void testCompositeStop() {
- ComponentStop event = new ComponentStop(this, uri);
- assertEquals(uri, event.getComponentURI());
- }
-
- public void testHttpSessionStart() {
- Object id = new Object();
- HttpSessionStart event = new HttpSessionStart(this, id);
- assertEquals(this, event.getSource());
- assertEquals(id, event.getSessionID());
- }
-
- public void testHttpSessionEnd() {
- Object id = new Object();
- HttpSessionEnd event = new HttpSessionEnd(this, id);
- assertEquals(this, event.getSource());
- assertEquals(id, event.getSessionID());
- }
-
- public void testRequestStart() {
- RequestStart event = new RequestStart(this);
- assertEquals(this, event.getSource());
- }
-
- public void testReequestEnd() {
- RequestEnd event = new RequestEnd(this);
- assertEquals(this, event.getSource());
- }
-
-
- @Override
- protected void setUp() throws Exception {
- }
-}
diff --git a/branches/sca-equinox/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java b/branches/sca-equinox/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java
deleted file mode 100644
index d46d77b4b8..0000000000
--- a/branches/sca-equinox/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * 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.core.store;
-
-import java.util.UUID;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.event.RuntimeEventListener;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.store.DuplicateRecordException;
-import org.apache.tuscany.sca.store.Store;
-import org.apache.tuscany.sca.store.StoreExpirationEvent;
-import org.apache.tuscany.sca.store.StoreMonitor;
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-
-/**
- * @version $Rev$ $Date$
- */
-public class MemoryStoreTestCase extends TestCase {
- private StoreMonitor monitor;
-
- public void testEviction() throws Exception {
- MemoryStore store = new MemoryStore(monitor);
- store.setReaperInterval(10);
- store.init();
- RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
- EasyMock.replay(component);
- String id = UUID.randomUUID().toString();
- Object value = new Object();
- store.insertRecord(component, id, value, 1);
- Thread.sleep(200);
- assertNull(store.readRecord(component, id));
- store.destroy();
- }
-
- public void testNotifyOnEviction() throws Exception {
- final CountDownLatch latch = new CountDownLatch(1);
- RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
- listener.onEvent(EasyMock.isA(StoreExpirationEvent.class));
- EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
- public Object answer() throws Throwable {
- latch.countDown();
- return null;
- }
- });
- EasyMock.replay(listener);
- MemoryStore store = new MemoryStore(monitor);
- store.addListener(listener);
- store.setReaperInterval(10);
- store.init();
- RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
- EasyMock.replay(component);
- String id = UUID.randomUUID().toString();
- Object value = new Object();
- store.insertRecord(component, id, value, 1);
- if (!latch.await(1000, TimeUnit.MILLISECONDS)) {
- // failed to notify listener
- fail();
- }
- EasyMock.verify(listener);
- }
-
- public void testNoEviction() throws Exception {
- MemoryStore store = new MemoryStore(monitor);
- store.setReaperInterval(10);
- store.init();
- RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
- EasyMock.replay(component);
- String id = UUID.randomUUID().toString();
- Object value = new Object();
- store.insertRecord(component, id, value, Store.NEVER);
- Thread.sleep(100);
- assertNotNull(store.readRecord(component, id));
- store.destroy();
- }
-
- public void testInsertRecord() throws Exception {
- MemoryStore store = new MemoryStore(monitor);
- store.setReaperInterval(10);
- store.init();
- RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
- EasyMock.replay(component);
- String id = UUID.randomUUID().toString();
- Object value = new Object();
- store.insertRecord(component, id, value, Store.NEVER);
- store.destroy();
- }
-
- public void testInsertAlreadyExists() throws Exception {
- MemoryStore store = new MemoryStore(monitor);
- store.setReaperInterval(10);
- store.init();
- RuntimeComponent component = EasyMock.createMock(RuntimeComponent.class);
- EasyMock.expect(component.getURI()).andReturn("component");
- EasyMock.replay(component);
- String id = UUID.randomUUID().toString();
- Object value = new Object();
- store.insertRecord(component, id, value, Store.NEVER);
- try {
- store.insertRecord(component, id, value, Store.NEVER);
- fail();
- } catch (DuplicateRecordException e) {
- //expected
- }
- store.destroy();
- }
-
- public void testUpdateRecord() throws Exception {
- MemoryStore store = new MemoryStore(monitor);
- store.setReaperInterval(10);
- store.init();
- RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
- EasyMock.replay(component);
- String id = UUID.randomUUID().toString();
- Object value = new Object();
- Object newValue = new Object();
-
- store.insertRecord(component, id, value, Store.NEVER);
- store.updateRecord(component, id, newValue, 1L);
- assertEquals(newValue, store.readRecord(component, id));
- store.destroy();
- }
-
- public void testDeleteRecord() throws Exception {
- MemoryStore store = new MemoryStore(monitor);
- store.setReaperInterval(10);
- store.init();
- RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
- EasyMock.replay(component);
- String id = UUID.randomUUID().toString();
- Object value = new Object();
-
- store.insertRecord(component, id, value, Store.NEVER);
- store.removeRecord(component, id);
- assertNull(store.readRecord(component, id));
- store.destroy();
- }
-
- @Override
- protected void setUp() throws Exception {
- monitor = EasyMock.createNiceMock(StoreMonitor.class);
- EasyMock.replay(monitor);
- }
-
-}