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/11/13 05:38:53 UTC

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

Modified: 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=diff&rev=474138&r1=474137&r2=474138
==============================================================================
--- incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/Store.java (original)
+++ incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/Store.java Sun Nov 12 20:38:52 2006
@@ -18,6 +18,8 @@
  */
 package org.apache.tuscany.service.persistence.store;
 
+import java.util.UUID;
+
 /**
  * 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
@@ -28,65 +30,50 @@
 public interface Store {
 
     /* Used to indicate an entry should not expire */
-    static final long NEVER = -1;
+    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
+     * Adds 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 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 writeRecord(Object id, Object record, long expiration) throws StoreWriteException;
+    void appendRecord(UUID id, Object object, long expiration) throws StoreWriteException;
 
     /**
-     * Writes the given record to the store. If force is true, the data must be written in synchronously
+     * Adds the given record to the store using synchronous operation
      *
      * @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 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 writeRecord(Object id, Object record, long expiration, boolean force) throws StoreWriteException;
+    void forcedAppendRecord(UUID id, Object object, long expiration) throws StoreWriteException;
+
+    void updateRecord(UUID id, Object object) throws StoreWriteException;
+
+    void forcedUpdateRecord(UUID id, Object object) throws StoreWriteException;
 
     /**
-     * Returns a record in the store corresponding to the given id
+     * Returns the deserialized object in the store corresponding to the given id
+     *
+     * @return the deserialized object or null if one is not found
      */
-    Object readRecord(Object id);
+    Object readRecord(UUID id) throws StoreReadException;
 
     /**
      * Removes all records from the store
      */
-    void removeRecords();
+    void removeRecords() throws StoreWriteException;
 
     /**
      * Initiates a recovery operation, for example during restart after a crash
      *
      * @param listener the listener to receive recovery callback events
      */
-    void recover(RecoveryListener listener);
+    void recover(RecoveryListener listener) throws StoreReadException;
 
 }

Added: incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/VersionException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/VersionException.java?view=auto&rev=474138
==============================================================================
--- incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/VersionException.java (added)
+++ incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/VersionException.java Sun Nov 12 20:38:52 2006
@@ -0,0 +1,41 @@
+/*
+ * 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;
+
+/**
+ * Denotes an attempt to write a record to the store that is of a lesser version than the persistent version
+ *
+ * @version $Rev$ $Date$
+ */
+public class VersionException extends StoreWriteException {
+    public VersionException() {
+    }
+
+    public VersionException(String message) {
+        super(message);
+    }
+
+    public VersionException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public VersionException(Throwable cause) {
+        super(cause);
+    }
+}

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

Propchange: incubator/tuscany/java/sca/services/persistence/store/src/main/java/org/apache/tuscany/service/persistence/store/VersionException.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