Author: suat
Date: Tue Sep 11 12:05:25 2012
New Revision: 1383369

URL: http://svn.apache.org/viewvc?rev=1383369&view=rev
Log:
STANBOL-730:
-The methods in the RevisionManager interface does not take a Store parameter 
anymore. Instead, the identifiers of Stores are passed.
-ChangeSet interface does not have a dependency to the IndexingInterface 
anymore. This dependency is removed to prevent passing the actual 
IndexingSource instances to ChangeSet implementations.

Modified:
    
incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/core/src/main/java/org/apache/stanbol/commons/semanticindex/core/store/ChangeSetImpl.java
    
incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/servicesapi/src/main/java/org/apache/stanbol/commons/semanticindex/store/ChangeSet.java
    
incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/servicesapi/src/main/java/org/apache/stanbol/commons/semanticindex/store/IndexingSource.java
    
incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/servicesapi/src/main/java/org/apache/stanbol/commons/semanticindex/store/revisionmanager/RevisionManager.java

Modified: 
incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/core/src/main/java/org/apache/stanbol/commons/semanticindex/core/store/ChangeSetImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/core/src/main/java/org/apache/stanbol/commons/semanticindex/core/store/ChangeSetImpl.java?rev=1383369&r1=1383368&r2=1383369&view=diff
==============================================================================
--- 
incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/core/src/main/java/org/apache/stanbol/commons/semanticindex/core/store/ChangeSetImpl.java
 (original)
+++ 
incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/core/src/main/java/org/apache/stanbol/commons/semanticindex/core/store/ChangeSetImpl.java
 Tue Sep 11 12:05:25 2012
@@ -20,36 +20,32 @@ import java.util.Collections;
 import java.util.Iterator;
 
 import org.apache.stanbol.commons.semanticindex.store.ChangeSet;
-import org.apache.stanbol.commons.semanticindex.store.IndexingSource;
 
-public class ChangeSetImpl<Item> implements ChangeSet<Item> {
+public class ChangeSetImpl implements ChangeSet {
     private final long from;
     private final long to;
     private final long epoch;
     private final Iterable<String> changedUris;
-    private final IndexingSource<Item> source;
 
-    public ChangeSetImpl(IndexingSource<Item> source,long epoch,long from, 
long to, Iterable<String> changed) {
-       if(source == null){
-               throw new IllegalArgumentException("The parsed IndexingSource 
MUST NOT be NULL!");
-       }
-       if(from > to){
-               throw new IllegalArgumentException("The pared from revision 
MUST NOT be bigger as the to revision!");
-       }
-       if(changed == null){
-               if(to != from){
-                       throw new IllegalArgumentException("For empty 
ChangeSets from and to revisions MUST BE the same!");
-               }
-               this.changedUris = Collections.emptyList();
-       } else {
-               this.changedUris = changed;
-       }
-       this.epoch = epoch;
-       this.from = from;
-       this.to = to;
-       this.source = source;
-       }
-    
+    public ChangeSetImpl(long epoch, long from, long to, Iterable<String> 
changed) {
+        if (from > to) {
+            throw new IllegalArgumentException(
+                    "The pared from revision MUST NOT be bigger as the to 
revision!");
+        }
+        if (changed == null) {
+            if (to != from) {
+                throw new IllegalArgumentException(
+                        "For empty ChangeSets from and to revisions MUST BE 
the same!");
+            }
+            this.changedUris = Collections.emptyList();
+        } else {
+            this.changedUris = changed;
+        }
+        this.epoch = epoch;
+        this.from = from;
+        this.to = to;
+    }
+
     @Override
     public long fromRevision() {
         return from;
@@ -61,17 +57,12 @@ public class ChangeSetImpl<Item> impleme
     }
 
     @Override
-    public IndexingSource<Item> getIndexingSource() {
-        return source;
+    public long getEpoch() {
+        return epoch;
     }
 
-       @Override
-       public long getEpoch() {
-               return epoch;
-       }
-
-       @Override
-       public Iterator<String> iterator() {
-               return changedUris.iterator();
-       }
+    @Override
+    public Iterator<String> iterator() {
+        return changedUris.iterator();
+    }
 }

Modified: 
incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/servicesapi/src/main/java/org/apache/stanbol/commons/semanticindex/store/ChangeSet.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/servicesapi/src/main/java/org/apache/stanbol/commons/semanticindex/store/ChangeSet.java?rev=1383369&r1=1383368&r2=1383369&view=diff
==============================================================================
--- 
incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/servicesapi/src/main/java/org/apache/stanbol/commons/semanticindex/store/ChangeSet.java
 (original)
+++ 
incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/servicesapi/src/main/java/org/apache/stanbol/commons/semanticindex/store/ChangeSet.java
 Tue Sep 11 12:05:25 2012
@@ -43,7 +43,7 @@ import java.util.Iterator;
  *     index.persist(cs.fromRevision());
  * </pre></code>
  */
-public interface ChangeSet<Item> extends Iterable<String> {
+public interface ChangeSet extends Iterable<String> {
     /**
      * The lowest revision number included in this ChangeSet
      * 
@@ -71,12 +71,4 @@ public interface ChangeSet<Item> extends
      * @return the URIs of the changed contentItems included in this ChangeSet
      */
     public Iterator<String> iterator();
-
-    /**
-     * The reference to the {@link Store} of this {@link ChangeSet}. This 
{@link IndexingSource} can be used
-     * to iterate on the changes.
-     * 
-     * @return the IndexingSource of this {@link ChangeSet}
-     */
-    IndexingSource<Item> getIndexingSource();
 }

Modified: 
incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/servicesapi/src/main/java/org/apache/stanbol/commons/semanticindex/store/IndexingSource.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/servicesapi/src/main/java/org/apache/stanbol/commons/semanticindex/store/IndexingSource.java?rev=1383369&r1=1383368&r2=1383369&view=diff
==============================================================================
--- 
incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/servicesapi/src/main/java/org/apache/stanbol/commons/semanticindex/store/IndexingSource.java
 (original)
+++ 
incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/servicesapi/src/main/java/org/apache/stanbol/commons/semanticindex/store/IndexingSource.java
 Tue Sep 11 12:05:25 2012
@@ -120,5 +120,5 @@ public interface IndexingSource<Item> {
      *             If the Epoch used by this IndexingSource is different of 
the epoch parsed in the request
      * @see ChangeSet
      */
-    ChangeSet<Item> changes(long epoch, long revision, int batchSize) throws 
StoreException, EpochException;
+    ChangeSet changes(long epoch, long revision, int batchSize) throws 
StoreException, EpochException;
 }

Modified: 
incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/servicesapi/src/main/java/org/apache/stanbol/commons/semanticindex/store/revisionmanager/RevisionManager.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/servicesapi/src/main/java/org/apache/stanbol/commons/semanticindex/store/revisionmanager/RevisionManager.java?rev=1383369&r1=1383368&r2=1383369&view=diff
==============================================================================
--- 
incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/servicesapi/src/main/java/org/apache/stanbol/commons/semanticindex/store/revisionmanager/RevisionManager.java
 (original)
+++ 
incubator/stanbol/branches/contenthub-two-layered-structure/commons/semanticindex/servicesapi/src/main/java/org/apache/stanbol/commons/semanticindex/store/revisionmanager/RevisionManager.java
 Tue Sep 11 12:05:25 2012
@@ -4,89 +4,86 @@ import org.apache.stanbol.commons.semant
 import org.apache.stanbol.commons.semanticindex.store.Store;
 
 /**
+ * <p>
  * This interface aims to provide functionalities to manage revisions of items 
managed by {@link Store}s and
  * the epochs of Stores.
+ * </p>
+ * <p>
+ * All of the methods of this interface take a {@code storeID} identifying the 
Store instance. In OSGi based
+ * Store implementations, it is suggested to use <b>service.pid</b> property 
of the Store.
  * 
  * @author suat
  * 
  */
-public interface RevisionManager<Item> {
+public interface RevisionManager {
 
     /**
-     * <p>
-     * This methods allows to create new revisions for the already existing 
items managed in the scope of the
-     * given {@link Store} instance. This is situation is expected to occur 
when initializing the Store. For
-     * instance, when a Store is initialized with an initial set of items 
which may be obtained from various
-     * sources such as an RDF graph or a content management system, new 
revisions for those items should be
-     * created in this method.
-     * </p>
-     * <p>
-     * So, this method is expected to be called during initialization of 
{@link Store} instances e.g in @Activate
-     * methods of OSGi based Store implementations.
+     * Initialize the revision management infrastructure for the {@link Store} 
specified by the
+     * {@code storeID}
      * 
-     * @param store
-     *            revisions will be created for the initial items of this 
{@link Store} instance
+     * @param storeID
+     *            the identifier of the {@link Store}
      * @throws RevisionManagerException
      */
-    void initializeRevisions(Store<Item> store) throws 
RevisionManagerException;
+    void registerStore(String storeID) throws RevisionManagerException;
 
     /**
-     * Clears all resources from the given {@link Store} from the {@link 
RevisionManager} e.g revisions
-     * regarding the items in the Store and epoch records of the Store.
+     * Clears all resources related with the {@link Store} instance specified 
by the {@code storeID} from the
+     * {@link RevisionManager} e.g revisions regarding the items in the Store 
and epoch records of the Store.
      * 
-     * @param store
-     *            the {@link Store} instance for which the resource will be 
deleted from the
-     *            {@link RevisionManager}
+     * @param storeID
+     *            the identifier of the {@link Store}
      * @throws RevisionManagerException
      */
-    void clearRevisions(Store<Item> store) throws RevisionManagerException;
+    void unregisterStore(String storeID) throws RevisionManagerException;
 
     /**
      * Updates the revision of the item represented by {@code itemID} which is 
managed by the given
      * {@link Store}. If there does not exist a revision for the given item a 
new is created.
      * 
-     * @param store
-     *            the keeper {@link Store} instance for the given item
+     * @param storeID
+     *            the identifier of the keeper {@link Store} instance for the 
given item
      * @param itemID
      *            identifier of the item of which revision will be 
update/created.
      * @throws RevisionManagerException
      */
-    void updateRevision(Store<Item> store, String itemID) throws 
RevisionManagerException;
+    long updateRevision(String storeID, String itemID) throws 
RevisionManagerException;
 
     /**
      * Gets changes from the given store according to specified {@code 
revision} and {@code batchSize}.
      * 
-     * @param store
-     *            the store from which the changes will be obtained
+     * @param storeID
+     *            the identifier of the {@link Store}from which the changes 
will be obtained
      * @param revision
      *            the <b>exclusive</b> bottom border for the revisions to be 
obtained. Obtained revisions will
      *            be higher than this value.
      * @param batchSize
      *            the maximum number of changes to be obtained. However, this 
is not a strict value. Different
-     *            implementations may return more values than the number 
specified with this parameter
+     *            implementations may return more values than the number 
specified with this parameter. It is
+     *            suggested to read the implementation specific documentation.
      * @return a {@link ChangeSet} object if there is any changes, otherwise 
{@code null}
      * @throws RevisionManagerException
      */
-    ChangeSet<Item> getChanges(Store<Item> store, long revision, int 
batchSize) throws RevisionManagerException;
+    ChangeSet getChanges(String storeID, long revision, int batchSize) throws 
RevisionManagerException;
 
     /**
      * Gets the epoch of the given {@link Store}
      * 
-     * @param store
-     *            {@link Store} instance of which epoch value will be returned
+     * @param storeID
+     *            the identifier of the {@link Store} instance of which epoch 
value will be returned
      * @return
      * @throws RevisionManagerException
      */
-    long getEpoch(Store<Item> store) throws RevisionManagerException;
+    long getEpoch(String storeID) throws RevisionManagerException;
 
     /**
-     * Updates the epoch for the given {@link Store}. If there does not exist 
an epoch for the specified
-     * {@link Store}, a new one is created.
+     * Updates the epoch for {@link Store} instance speficied by the {@code 
storeID}. If there does not exist
+     * an epoch for the specified {@link Store}, a new one is created.
      * 
-     * @param store
+     * @param storeID
      *            {@link Store} instance for which the epoch will be 
updated/created.
      * @return the updated epoch
      * @throws RevisionManagerException
      */
-    long updateEpoch(Store<Item> store) throws RevisionManagerException;
+    long updateEpoch(String storeID) throws RevisionManagerException;
 }


Reply via email to