You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2006/10/27 01:58:13 UTC

svn commit: r468198 [2/2] - in /incubator/tuscany/java/sca/services/persistence: store.jdbc/ store.jdbc/src/ store.jdbc/src/main/ store.jdbc/src/main/java/ store.jdbc/src/main/java/org/ store.jdbc/src/main/java/org/apache/ store.jdbc/src/main/java/org/...

Added: incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/Store.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/Store.java?view=auto&rev=468198
==============================================================================
--- incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/Store.java (added)
+++ incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/Store.java Thu Oct 26 16:58:11 2006
@@ -0,0 +1,92 @@
+/*
+ * 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.service.persistence.store;
+
+/**
+ * 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 {
+
+    /* Used to indicate an entry should not expire */
+    static final long NEVER = -1;
+
+    /**
+     * Writes the given record to the store. Implementations may choose different strategies for writing data such as
+     * write-through or write-behind.
+     *
+     * @param id     the unique id of the record
+     * @param record the data to persist
+     * @throws StoreWriteException if an error occurs during the write operation
+     */
+    void writeRecord(Object id, Object record) throws StoreWriteException;
+
+    /**
+     * Writes the given record to the store. Implementations may choose different strategies for writing data such as
+     * write-through or write-behind.
+     *
+     * @param id         the unique id of the record
+     * @param record     the data to persist
+     * @param expiration the time in milliseconds when the entry expires
+     * @throws StoreWriteException if an error occurs during the write operation
+     */
+    void writeRecord(Object id, Object record, long expiration) throws StoreWriteException;
+
+    /**
+     * Writes the given record to the store. If force is true, the data must be written in synchronously
+     *
+     * @param id     the unique id of the record
+     * @param record the data to persist
+     * @param force  if true writes the data synchronously
+     * @throws StoreWriteException if an error occurs during the write operation
+     */
+    void writeRecord(Object id, Object record, boolean force) throws StoreWriteException;
+
+    /**
+     * Writes the given record to the store. If force is true, the data must be written in synchronously
+     *
+     * @param id         the unique id of the record
+     * @param record     the data to persist
+     * @param force      if true writes the data synchronously
+     * @param expiration the time in milliseconds when the entry expires
+     * @throws StoreWriteException if an error occurs during the write operation
+     */
+    void writeRecord(Object id, Object record, long expiration, boolean force) throws StoreWriteException;
+
+    /**
+     * Returns a record in the store corresponding to the given id
+     */
+    Object readRecord(Object id);
+
+    /**
+     * Removes all records from the store
+     */
+    void removeRecords();
+
+    /**
+     * Initiates a recovery operation, for example during restart after a crash
+     *
+     * @param listener the listener to receive recovery callback events
+     */
+    void recover(RecoveryListener listener);
+
+}

Propchange: incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/Store.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/Store.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreException.java?view=auto&rev=468198
==============================================================================
--- incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreException.java (added)
+++ incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreException.java Thu Oct 26 16:58:11 2006
@@ -0,0 +1,44 @@
+/*
+ * 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.service.persistence.store;
+
+import org.apache.tuscany.api.TuscanyException;
+
+/**
+ * Represents a generic exception thrown by a <code>Store</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreException extends TuscanyException {
+
+    public StoreException() {
+    }
+
+    public StoreException(String message) {
+        super(message);
+    }
+
+    public StoreException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public StoreException(Throwable cause) {
+        super(cause);
+    }
+}

Propchange: incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreMonitor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreMonitor.java?view=auto&rev=468198
==============================================================================
--- incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreMonitor.java (added)
+++ incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreMonitor.java Thu Oct 26 16:58:11 2006
@@ -0,0 +1,74 @@
+/*
+ * 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.service.persistence.store;
+
+import org.apache.tuscany.api.annotation.LogLevel;
+
+/**
+ * A generic monintor interface for services to log events
+ *
+ * @version $Rev$ $Date$
+ */
+public interface StoreMonitor {
+
+    /**
+     * Signals the service has started
+     *
+     * @param msg
+     */
+    @LogLevel("DEBUG")
+    void start(String msg);
+
+    /**
+     * Signals the service has been shutdown
+     *
+     * @param msg
+     */
+    @LogLevel("DEBUG")
+    void stop(String msg);
+
+    /**
+     * Fired when recovery is started
+     */
+    @LogLevel("DEBUG")
+    void beginRecover();
+
+    /**
+     * Fired when recovery is completed
+     */
+    @LogLevel("DEBUG")
+    void endRecover();
+
+    /**
+     * Fired when a record is processed during recovery
+     *
+     * @param recordId the id of the record being recovered
+     */
+    @LogLevel("DEBUG")
+    void recover(Object recordId);
+
+    /**
+     * Signals an error event
+     *
+     * @param e the error
+     */
+    @LogLevel("ERROR")
+    void error(Throwable e);
+
+}

Propchange: incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreMonitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreMonitor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreReadException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreReadException.java?view=auto&rev=468198
==============================================================================
--- incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreReadException.java (added)
+++ incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreReadException.java Thu Oct 26 16:58:11 2006
@@ -0,0 +1,42 @@
+/*
+ * 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.service.persistence.store;
+
+/**
+ * Thrown when an error occurs reading from persistent storage
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreReadException extends StoreException {
+
+    public StoreReadException() {
+    }
+
+    public StoreReadException(String message) {
+        super(message);
+    }
+
+    public StoreReadException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public StoreReadException(Throwable cause) {
+        super(cause);
+    }
+}

Propchange: incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreReadException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreReadException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreWriteException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreWriteException.java?view=auto&rev=468198
==============================================================================
--- incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreWriteException.java (added)
+++ incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreWriteException.java Thu Oct 26 16:58:11 2006
@@ -0,0 +1,42 @@
+/*
+ * 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.service.persistence.store;
+
+/**
+ * Thrown when an error occurs writing to persistent storage
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreWriteException extends StoreException {
+
+    public StoreWriteException() {
+    }
+
+    public StoreWriteException(String message) {
+        super(message);
+    }
+
+    public StoreWriteException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public StoreWriteException(Throwable cause) {
+        super(cause);
+    }
+}

Propchange: incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreWriteException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/StoreWriteException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org