Author: suat
Date: Fri Mar 23 09:59:31 2012
New Revision: 1304256

URL: http://svn.apache.org/viewvc?rev=1304256&view=rev
Log:
STANBOL-547: 
- Added support for specifying specific indexes while submitting/deleting 
documents to Contenthub, updated REST api, HTML view accordingly

Removed:
    
incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/static/
Modified:
    
incubator/stanbol/trunk/cmsadapter/cmis/src/main/java/org/apache/stanbol/cmsadapter/cmis/mapping/CMISContenthubFeeder.java
    
incubator/stanbol/trunk/cmsadapter/jcr/src/main/java/org/apache/stanbol/cmsadapter/jcr/mapping/JCRContenthubFeeder.java
    
incubator/stanbol/trunk/cmsadapter/servicesapi/src/main/java/org/apache/stanbol/cmsadapter/servicesapi/mapping/ContenthubFeeder.java
    
incubator/stanbol/trunk/cmsadapter/web/src/main/java/org/apache/stanbol/cmsadapter/web/resources/ContenthubFeedResource.java
    
incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/web/resources/ContenthubFeedResource/index.ftl

Modified: 
incubator/stanbol/trunk/cmsadapter/cmis/src/main/java/org/apache/stanbol/cmsadapter/cmis/mapping/CMISContenthubFeeder.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/cmsadapter/cmis/src/main/java/org/apache/stanbol/cmsadapter/cmis/mapping/CMISContenthubFeeder.java?rev=1304256&r1=1304255&r2=1304256&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/cmsadapter/cmis/src/main/java/org/apache/stanbol/cmsadapter/cmis/mapping/CMISContenthubFeeder.java
 (original)
+++ 
incubator/stanbol/trunk/cmsadapter/cmis/src/main/java/org/apache/stanbol/cmsadapter/cmis/mapping/CMISContenthubFeeder.java
 Fri Mar 23 09:59:31 2012
@@ -111,14 +111,24 @@ public class CMISContenthubFeeder implem
 
     @Override
     public void submitContentItemByCMSObject(Object o, String id) {
+        submitContentItemByCMSObject(o, id, null);
+    }
+
+    @Override
+    public void submitContentItemByCMSObject(Object o, String id, String 
indexName) {
         CmisObject cmisObject = (CmisObject) o;
         if (hasType(cmisObject, BaseTypeId.CMIS_DOCUMENT)) {
-            processDocumentAndSubmitToContenthub((Document) cmisObject, id);
+            processDocumentAndSubmitToContenthub((Document) cmisObject, id, 
indexName);
         }
     }
 
     @Override
     public void submitContentItemByID(String contentItemID) {
+        submitContentItemByID(contentItemID, null);
+    }
+
+    @Override
+    public void submitContentItemByID(String contentItemID, String indexName) {
         CmisObject o;
         try {
             o = session.getObject(CMISObjectId.getObjectId(contentItemID));
@@ -128,12 +138,17 @@ public class CMISContenthubFeeder implem
         }
 
         if (hasType(o, BaseTypeId.CMIS_DOCUMENT)) {
-            processDocumentAndSubmitToContenthub((Document) o);
+            processDocumentAndSubmitToContenthub((Document) o, indexName);
         }
     }
 
     @Override
     public void submitContentItemByPath(String contentItemPath) {
+        submitContentItemByPath(contentItemPath, null);
+    }
+
+    @Override
+    public void submitContentItemByPath(String contentItemPath, String 
indexName) {
         CmisObject o;
         try {
             o = session.getObjectByPath(contentItemPath);
@@ -143,12 +158,17 @@ public class CMISContenthubFeeder implem
         }
 
         if (hasType(o, BaseTypeId.CMIS_DOCUMENT)) {
-            processDocumentAndSubmitToContenthub((Document) o);
+            processDocumentAndSubmitToContenthub((Document) o, indexName);
         }
     }
 
     @Override
     public void submitContentItemsUnderPath(String rootPath) {
+        submitContentItemsUnderPath(rootPath, null);
+    }
+
+    @Override
+    public void submitContentItemsUnderPath(String rootPath, String indexName) 
{
         CmisObject o;
         try {
             o = session.getObjectByPath(rootPath);
@@ -158,12 +178,12 @@ public class CMISContenthubFeeder implem
         }
 
         if (hasType(o, BaseTypeId.CMIS_DOCUMENT)) {
-            processDocumentAndSubmitToContenthub((Document) o);
+            processDocumentAndSubmitToContenthub((Document) o, indexName);
         } else {
             List<Document> documents = new ArrayList<Document>();
             getDocumentsUnderFolder((Folder) o, documents);
             for (Document d : documents) {
-                processDocumentAndSubmitToContenthub(d);
+                processDocumentAndSubmitToContenthub(d, indexName);
             }
         }
     }
@@ -174,16 +194,31 @@ public class CMISContenthubFeeder implem
     }
 
     @Override
+    public void submitContentItemsByCustomFilter(ContentItemFilter 
customContentItemFilter, String indexName) {
+        throw new UnsupportedOperationException("This operation is not 
supported in this implementation");
+    }
+
+    @Override
     public void deleteContentItemByID(String contentItemID) {
+        deleteContentItemByID(contentItemID, null);
+    }
+
+    @Override
+    public void deleteContentItemByID(String contentItemID, String indexName) {
         try {
-                       solrStore.deleteById(contentItemID);
-               } catch (StoreException e) {
-                       log.error(e.getMessage(), e);
-               }
+            solrStore.deleteById(contentItemID, indexName);
+        } catch (StoreException e) {
+            log.error(e.getMessage(), e);
+        }
     }
 
     @Override
     public void deleteContentItemByPath(String contentItemPath) {
+        deleteContentItemByPath(contentItemPath, null);
+    }
+
+    @Override
+    public void deleteContentItemByPath(String contentItemPath, String 
indexName) {
         CmisObject o;
         try {
             o = session.getObjectByPath(contentItemPath);
@@ -193,14 +228,19 @@ public class CMISContenthubFeeder implem
         }
 
         try {
-                       solrStore.deleteById(o.getId());
-               } catch (StoreException e) {
-                       log.error(e.getMessage(), e);
-               }
+            solrStore.deleteById(o.getId(), indexName);
+        } catch (StoreException e) {
+            log.error(e.getMessage(), e);
+        }
     }
 
     @Override
     public void deleteContentItemsUnderPath(String rootPath) {
+        deleteContentItemsUnderPath(rootPath, null);
+    }
+
+    @Override
+    public void deleteContentItemsUnderPath(String rootPath, String indexName) 
{
         CmisObject o;
         try {
             o = session.getObjectByPath(rootPath);
@@ -217,10 +257,10 @@ public class CMISContenthubFeeder implem
         }
         for (Document d : documents) {
             try {
-                               solrStore.deleteById(d.getId());
-                       } catch (StoreException e) {
-                               log.error(e.getMessage(), e);
-                       }
+                solrStore.deleteById(d.getId(), indexName);
+            } catch (StoreException e) {
+                log.error(e.getMessage(), e);
+            }
         }
     }
 
@@ -230,6 +270,11 @@ public class CMISContenthubFeeder implem
     }
 
     @Override
+    public void deleteContentItemsByCustomFilter(ContentItemFilter 
customContentItemFilter, String indexName) {
+        throw new UnsupportedOperationException("This operation is not 
supported in this implementation");
+    }
+
+    @Override
     public boolean canFeedWith(Object session) {
         return session instanceof Session;
     }
@@ -262,11 +307,11 @@ public class CMISContenthubFeeder implem
         }
     }
 
-    private void processDocumentAndSubmitToContenthub(Document d) {
-        processDocumentAndSubmitToContenthub(d, null);
+    private void processDocumentAndSubmitToContenthub(Document d, String 
indexName) {
+        processDocumentAndSubmitToContenthub(d, null, indexName);
     }
 
-    private void processDocumentAndSubmitToContenthub(Document d, String id) {
+    private void processDocumentAndSubmitToContenthub(Document d, String id, 
String indexName) {
         byte[] content;
         try {
             content = IOUtils.toByteArray(d.getContentStream().getStream());
@@ -283,10 +328,10 @@ public class CMISContenthubFeeder implem
         id = (id == null || id.equals("")) ? d.getId() : id;
         SolrContentItem sci = solrStore.create(content, d.getId(), 
d.getName(), mimeType, constraints);
         try {
-                       solrStore.enhanceAndPut(sci);
-               } catch (StoreException e) {
-                       log.error(e.getMessage(), e);
-               }
+            solrStore.enhanceAndPut(sci, indexName);
+        } catch (StoreException e) {
+            log.error(e.getMessage(), e);
+        }
         log.info("Document submitted to Contenthub.");
         log.info("Id: {}", sci.getUri().getUnicodeString());
         log.info("Mime type: {}", sci.getMimeType());

Modified: 
incubator/stanbol/trunk/cmsadapter/jcr/src/main/java/org/apache/stanbol/cmsadapter/jcr/mapping/JCRContenthubFeeder.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/cmsadapter/jcr/src/main/java/org/apache/stanbol/cmsadapter/jcr/mapping/JCRContenthubFeeder.java?rev=1304256&r1=1304255&r2=1304256&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/cmsadapter/jcr/src/main/java/org/apache/stanbol/cmsadapter/jcr/mapping/JCRContenthubFeeder.java
 (original)
+++ 
incubator/stanbol/trunk/cmsadapter/jcr/src/main/java/org/apache/stanbol/cmsadapter/jcr/mapping/JCRContenthubFeeder.java
 Fri Mar 23 09:59:31 2012
@@ -115,12 +115,17 @@ public class JCRContenthubFeeder impleme
 
     @Override
     public void submitContentItemByCMSObject(Object o, String id) {
+        submitContentItemByCMSObject(o, id, null);
+    }
+
+    @Override
+    public void submitContentItemByCMSObject(Object o, String id, String 
indexName) {
         Node n = (Node) o;
         String actualNodeId = "";
         try {
             actualNodeId = n.getIdentifier();
             ContentContext contentContext = getContentContextWithBasicInfo(n, 
id);
-            processContextAndSubmitToContenthub(contentContext);
+            processContextAndSubmitToContenthub(contentContext, indexName);
         } catch (RepositoryException e) {
             log.warn("Failed to get basic information of node having id: {}", 
actualNodeId);
         }
@@ -128,6 +133,11 @@ public class JCRContenthubFeeder impleme
 
     @Override
     public void submitContentItemByID(String contentItemID) {
+        submitContentItemByID(contentItemID, null);
+    }
+
+    @Override
+    public void submitContentItemByID(String contentItemID, String indexName) {
         Node n;
         try {
             n = getNodeByID(contentItemID);
@@ -138,7 +148,7 @@ public class JCRContenthubFeeder impleme
 
         try {
             ContentContext contentContext = getContentContextWithBasicInfo(n);
-            processContextAndSubmitToContenthub(contentContext);
+            processContextAndSubmitToContenthub(contentContext, indexName);
         } catch (RepositoryException e) {
             log.warn("Failed to get basic information of node having id: {}", 
contentItemID);
         }
@@ -146,6 +156,11 @@ public class JCRContenthubFeeder impleme
 
     @Override
     public void submitContentItemByPath(String contentItemPath) {
+        submitContentItemByPath(contentItemPath, null);
+    }
+
+    @Override
+    public void submitContentItemByPath(String contentItemPath, String 
indexName) {
         Node n;
         try {
             n = getNodeByPath(contentItemPath);
@@ -156,7 +171,7 @@ public class JCRContenthubFeeder impleme
 
         try {
             ContentContext contentContext = getContentContextWithBasicInfo(n);
-            processContextAndSubmitToContenthub(contentContext);
+            processContextAndSubmitToContenthub(contentContext, indexName);
         } catch (RepositoryException e) {
             log.warn("Failed to get basic information of node having path: 
{}", contentItemPath);
         }
@@ -164,6 +179,11 @@ public class JCRContenthubFeeder impleme
 
     @Override
     public void submitContentItemsUnderPath(String rootPath) {
+        submitContentItemsUnderPath(rootPath, null);
+    }
+
+    @Override
+    public void submitContentItemsUnderPath(String rootPath, String indexName) 
{
         List<Node> nodes;
         try {
             nodes = getNodesUnderPath(rootPath);
@@ -183,7 +203,7 @@ public class JCRContenthubFeeder impleme
 
             try {
                 ContentContext contentContext = 
getContentContextWithBasicInfo(n);
-                processContextAndSubmitToContenthub(contentContext);
+                processContextAndSubmitToContenthub(contentContext, indexName);
             } catch (RepositoryException e) {
                 log.warn("Failed to get basic information of node having path: 
{}", path);
             }
@@ -196,9 +216,19 @@ public class JCRContenthubFeeder impleme
     }
 
     @Override
+    public void submitContentItemsByCustomFilter(ContentItemFilter 
customContentItemFilter, String indexName) {
+        throw new UnsupportedOperationException("This operation is not 
supported in this implementation");
+    }
+
+    @Override
     public void deleteContentItemByID(String contentItemID) {
+        deleteContentItemByID(contentItemID, null);
+    }
+
+    @Override
+    public void deleteContentItemByID(String contentItemID, String indexName) {
         try {
-            solrStore.deleteById(contentItemID);
+            solrStore.deleteById(contentItemID, indexName);
         } catch (StoreException e) {
             log.error(e.getMessage(), e);
         }
@@ -206,11 +236,16 @@ public class JCRContenthubFeeder impleme
 
     @Override
     public void deleteContentItemByPath(String contentItemPath) {
+        deleteContentItemByPath(contentItemPath, null);
+    }
+
+    @Override
+    public void deleteContentItemByPath(String contentItemPath, String 
indexName) {
         Node n;
         try {
             n = getNodeByPath(contentItemPath);
             try {
-                solrStore.deleteById(n.getIdentifier());
+                solrStore.deleteById(n.getIdentifier(), indexName);
             } catch (StoreException e) {
                 log.error(e.getMessage(), e);
             }
@@ -221,12 +256,17 @@ public class JCRContenthubFeeder impleme
 
     @Override
     public void deleteContentItemsUnderPath(String rootPath) {
+        deleteContentItemsUnderPath(rootPath, null);
+    }
+
+    @Override
+    public void deleteContentItemsUnderPath(String rootPath, String indexName) 
{
         List<Node> nodes;
         try {
             nodes = getNodesUnderPath(rootPath);
             for (Node n : nodes) {
                 try {
-                    solrStore.deleteById(n.getIdentifier());
+                    solrStore.deleteById(n.getIdentifier(), indexName);
                 } catch (StoreException e) {
                     log.error(e.getMessage(), e);
                 }
@@ -243,11 +283,16 @@ public class JCRContenthubFeeder impleme
     }
 
     @Override
+    public void deleteContentItemsByCustomFilter(ContentItemFilter 
customContentItemFilter, String indexName) {
+        throw new UnsupportedOperationException("This operation is not 
supported in this implementation");
+    }
+
+    @Override
     public boolean canFeedWith(Object session) {
         return session instanceof Session;
     }
 
-    private void processContextAndSubmitToContenthub(ContentContext 
contentContext) {
+    private void processContextAndSubmitToContenthub(ContentContext 
contentContext, String indexName) {
         String id = contentContext.getIdentifier();
         populateContentContext(contentContext);
         if (contentContext.getContent() == null || 
contentContext.getContent().length == 0) {
@@ -263,7 +308,7 @@ public class JCRContenthubFeeder impleme
         SolrContentItem sci = solrStore.create(contentContext.getContent(), 
id, contentContext.getNodeName(),
             contentContext.getContentType(), constraints);
         try {
-            solrStore.enhanceAndPut(sci);
+            solrStore.enhanceAndPut(sci, indexName);
         } catch (StoreException e) {
             log.error(e.getMessage(), e);
         }

Modified: 
incubator/stanbol/trunk/cmsadapter/servicesapi/src/main/java/org/apache/stanbol/cmsadapter/servicesapi/mapping/ContenthubFeeder.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/cmsadapter/servicesapi/src/main/java/org/apache/stanbol/cmsadapter/servicesapi/mapping/ContenthubFeeder.java?rev=1304256&r1=1304255&r2=1304256&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/cmsadapter/servicesapi/src/main/java/org/apache/stanbol/cmsadapter/servicesapi/mapping/ContenthubFeeder.java
 (original)
+++ 
incubator/stanbol/trunk/cmsadapter/servicesapi/src/main/java/org/apache/stanbol/cmsadapter/servicesapi/mapping/ContenthubFeeder.java
 Fri Mar 23 09:59:31 2012
@@ -61,6 +61,23 @@ public interface ContenthubFeeder {
     void submitContentItemByCMSObject(Object o, String id);
 
     /**
+     * Creates a content item in Contenthub by leveraging the content 
repository object itself e.g <b>Node</b>
+     * in JCR, <b>Document</b> in CMIS. If there is an already existing 
content item in the Contenthub with
+     * the same id, the existing content item should be deleted first.
+     * 
+     * @param o
+     *            Content repository object to be transformed into a content 
item in Contenthub
+     * @param id
+     *            Optional ID for the content item in Contenthub. If this 
parameter is specified, it will be
+     *            used as the ID of the content item in Contenthub. Otherwise, 
the object's own ID in the
+     *            content repository will be used.
+     * @param indexName
+     *            Name of the Solr index managed by Contenthub. Specified 
index will be used to store the
+     *            submitted content item
+     */
+    void submitContentItemByCMSObject(Object o, String id, String indexName);
+
+    /**
      * Submits content item by its ID to the Contenthub. If there is an 
already existing content item in the
      * Contenthub with the same id, the existing content item should be 
deleted first.
      * 
@@ -70,6 +87,18 @@ public interface ContenthubFeeder {
     void submitContentItemByID(String contentItemID);
 
     /**
+     * Submits content item by its ID to the Contenthub. If there is an 
already existing content item in the
+     * Contenthub with the same id, the existing content item should be 
deleted first.
+     * 
+     * @param contentItemID
+     *            ID of the content item in the repository
+     * @param indexName
+     *            Name of the Solr index managed by Contenthub. Specified 
index will be used to store the
+     *            submitted content item
+     */
+    void submitContentItemByID(String contentItemID, String indexName);
+
+    /**
      * Submits content item by its path to the Contenthub. If there is an 
already existing content item in the
      * Contenthub with the same id, the existing content item should be 
deleted first.
      * 
@@ -79,6 +108,18 @@ public interface ContenthubFeeder {
     void submitContentItemByPath(String contentItemPath);
 
     /**
+     * Submits content item by its path to the Contenthub. If there is an 
already existing content item in the
+     * Contenthub with the same id, the existing content item should be 
deleted first.
+     * 
+     * @param contentItemPath
+     *            path of the content item in the repository
+     * @param indexName
+     *            Name of the Solr index managed by Contenthub. Specified 
index will be used to store the
+     *            submitted content item
+     */
+    void submitContentItemByPath(String contentItemPath, String indexName);
+
+    /**
      * Submits all of the content items under the specified path to the 
Contenthub. If there are already
      * existing content items in the Contenthub with same ids of submitted 
content items, the existing content
      * items should be deleted first.
@@ -89,6 +130,19 @@ public interface ContenthubFeeder {
     void submitContentItemsUnderPath(String rootPath);
 
     /**
+     * Submits all of the content items under the specified path to the 
Contenthub. If there are already
+     * existing content items in the Contenthub with same ids of submitted 
content items, the existing content
+     * items should be deleted first.
+     * 
+     * @param rootPath
+     *            root path in the content repository
+     * @param indexName
+     *            Name of the Solr index managed by Contenthub. Specified 
index will be used to store the
+     *            submitted content items
+     */
+    void submitContentItemsUnderPath(String rootPath, String indexName);
+
+    /**
      * Filters content items from content repository via the specific {@link 
ContentItemFilter} implementation
      * passed as a parameter and submits the filtered content items to the 
Contenthub. If there are already
      * existing content items in the Contenthub with same ids of submitted 
content items, the existing content
@@ -100,6 +154,20 @@ public interface ContenthubFeeder {
     void submitContentItemsByCustomFilter(ContentItemFilter 
customContentItemFilter);
 
     /**
+     * Filters content items from content repository via the specific {@link 
ContentItemFilter} implementation
+     * passed as a parameter and submits the filtered content items to the 
Contenthub. If there are already
+     * existing content items in the Contenthub with same ids of submitted 
content items, the existing content
+     * items should be deleted first.
+     * 
+     * @param customContentItemFilter
+     *            custom {@link ContentItemFilter} implementation
+     * @param indexName
+     *            Name of the Solr index managed by Contenthub. Specified 
index will be used to store the
+     *            submitted content items
+     */
+    void submitContentItemsByCustomFilter(ContentItemFilter 
customContentItemFilter, String indexName);
+
+    /**
      * Deletes content item by its ID from the Contenthub. Please note that 
specified identifier should be the
      * one that identifying the content item in Contenthub.
      * 
@@ -109,6 +177,18 @@ public interface ContenthubFeeder {
     void deleteContentItemByID(String contentItemID);
 
     /**
+     * Deletes content item by its ID from the Contenthub. Please note that 
specified identifier should be the
+     * one that identifying the content item in Contenthub.
+     * 
+     * @param contentItemID
+     *            ID of the content item in the <b>Contenthub</b>
+     * @param indexName
+     *            Name of the Solr index managed by Contenthub. Specified 
index will be used to delete the
+     *            submitted content item from.
+     */
+    void deleteContentItemByID(String contentItemID, String indexName);
+
+    /**
      * Deletes content item by its path from the Contenthub
      * 
      * @param contentItemPath
@@ -117,6 +197,17 @@ public interface ContenthubFeeder {
     void deleteContentItemByPath(String contentItemPath);
 
     /**
+     * Deletes content item by its path from the Contenthub
+     * 
+     * @param contentItemPath
+     *            path of the content item in the repository
+     * @param indexName
+     *            Name of the Solr index managed by Contenthub. Specified 
index will be used to delete the
+     *            submitted content item from.
+     */
+    void deleteContentItemByPath(String contentItemPath, String indexName);
+
+    /**
      * Deletes all of the content items under the specified path to Contenthub
      * 
      * @param rootPath
@@ -125,6 +216,17 @@ public interface ContenthubFeeder {
     void deleteContentItemsUnderPath(String rootPath);
 
     /**
+     * Deletes all of the content items under the specified path to Contenthub
+     * 
+     * @param rootPath
+     *            root path in the content repository
+     * @param indexName
+     *            Name of the Solr index managed by Contenthub. Specified 
index will be used to delete the
+     *            submitted content items from.
+     */
+    void deleteContentItemsUnderPath(String rootPath, String indexName);
+
+    /**
      * Filters content items from content repository via the specific {@link 
ContentItemFilter} implementation
      * passed as a parameter and deletes the filtered content items from the 
Contenthub
      * 
@@ -134,6 +236,18 @@ public interface ContenthubFeeder {
     void deleteContentItemsByCustomFilter(ContentItemFilter 
customContentItemFilter);
 
     /**
+     * Filters content items from content repository via the specific {@link 
ContentItemFilter} implementation
+     * passed as a parameter and deletes the filtered content items from the 
Contenthub
+     * 
+     * @param customContentItemFilter
+     *            custom {@link ContentItemFilter} implementation
+     * @param indexName
+     *            Name of the Solr index managed by Contenthub. Specified 
index will be used to delete the
+     *            submitted content items from.
+     */
+    void deleteContentItemsByCustomFilter(ContentItemFilter 
customContentItemFilter, String indexName);
+
+    /**
      * This method is used for identification of {@link ContenthubFeeder}s 
based on the specified
      * <code>session</code> object. If the specified instance can be used in 
certain implementation, it
      * returns <code>true</code>, otherwise <code>false</code>.

Modified: 
incubator/stanbol/trunk/cmsadapter/web/src/main/java/org/apache/stanbol/cmsadapter/web/resources/ContenthubFeedResource.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/cmsadapter/web/src/main/java/org/apache/stanbol/cmsadapter/web/resources/ContenthubFeedResource.java?rev=1304256&r1=1304255&r2=1304256&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/cmsadapter/web/src/main/java/org/apache/stanbol/cmsadapter/web/resources/ContenthubFeedResource.java
 (original)
+++ 
incubator/stanbol/trunk/cmsadapter/web/src/main/java/org/apache/stanbol/cmsadapter/web/resources/ContenthubFeedResource.java
 Fri Mar 23 09:59:31 2012
@@ -114,6 +114,9 @@ public class ContenthubFeedResource exte
      *            this parameter is used together with <code>path</code> 
parameter. Its default value is
      *            <code>false</code>. If it is set as <code>true</code>. All 
content repository objects under
      *            the specified path are processed.
+     * @param indexName
+     *            Name of the Solr index managed by Contenthub. Specified 
index will be used to store the
+     *            submitte content items
      * @param contentProperties
      *            this parameter indicates the list of properties that are 
possibly holding the actual
      *            content. Possible values are passed as comma separated. Its 
default value is <b>content,
@@ -129,6 +132,7 @@ public class ContenthubFeedResource exte
                                               @FormParam("id") String id,
                                               @FormParam("path") String path,
                                               @FormParam("recursive") 
@DefaultValue("false") boolean recursive,
+                                              @FormParam("indexName") String 
indexName,
                                               @FormParam("contentProperties") 
@DefaultValue("skos:definition,content") String contentProperties,
                                               @Context HttpHeaders headers) 
throws RepositoryAccessException,
                                                                            
ContenthubFeederException {
@@ -147,12 +151,12 @@ public class ContenthubFeedResource exte
         ContenthubFeeder feeder = 
feederManager.getContenthubFeeder(sessionKey, contentFieldList);
 
         if (id != null) {
-            feeder.submitContentItemByID(id);
+            feeder.submitContentItemByID(id, indexName);
         } else if (path != null) {
             if (!recursive) {
-                feeder.submitContentItemByPath(path);
+                feeder.submitContentItemByPath(path, indexName);
             } else {
-                feeder.submitContentItemsUnderPath(path);
+                feeder.submitContentItemsUnderPath(path, indexName);
             }
         } else {
             return Response.status(Status.BAD_REQUEST)
@@ -187,6 +191,9 @@ public class ContenthubFeedResource exte
      *            this parameter is used together with <code>path</code> 
parameter. Its default value is
      *            <code>false</code>. If it is set as <code>true</code>. All 
content repository objects under
      *            the specified path are processed.
+     * @param indexName
+     *            Name of the Solr index managed by Contenthub. Specified 
index will be used to delete the
+     *            content items from
      * @return
      * @throws RepositoryAccessException
      * @throws ContenthubFeederException
@@ -197,6 +204,7 @@ public class ContenthubFeedResource exte
                                                 @FormParam("id") String id,
                                                 @FormParam("path") String path,
                                                 @FormParam("recursive") 
@DefaultValue("false") boolean recursive,
+                                                @FormParam("indexName") String 
indexName,
                                                 @Context HttpHeaders headers) 
throws RepositoryAccessException,
                                                                              
ContenthubFeederException {
 
@@ -211,12 +219,12 @@ public class ContenthubFeedResource exte
         ContenthubFeeder feeder = 
feederManager.getContenthubFeeder(sessionKey, null);
 
         if (id != null) {
-            feeder.deleteContentItemByID(id);
+            feeder.deleteContentItemByID(id, indexName);
         } else if (path != null) {
             if (!recursive) {
-                feeder.deleteContentItemByPath(path);
+                feeder.deleteContentItemByPath(path, indexName);
             } else {
-                feeder.deleteContentItemsUnderPath(path);
+                feeder.deleteContentItemsUnderPath(path, indexName);
             }
         } else {
             return Response.status(Status.BAD_REQUEST)

Modified: 
incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/web/resources/ContenthubFeedResource/index.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/web/resources/ContenthubFeedResource/index.ftl?rev=1304256&r1=1304255&r2=1304256&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/web/resources/ContenthubFeedResource/index.ftl
 (original)
+++ 
incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/web/resources/ContenthubFeedResource/index.ftl
 Fri Mar 23 09:59:31 2012
@@ -76,6 +76,13 @@
                        </table>
                </fieldset>
        </p>
+       <p>
+               The following index will be used to store content items or 
delete contents items from.  
+               <fieldset>
+                   <legend>Select an index</legend>
+                   <div id="indexDiv"><#--this div will be populated by 
ajax--></div>
+               </fieldset>
+       </p>
        
        <a name="Submit_content_items" id="Submit_content_items"></a>
        <h4>Submit content items</h4>
@@ -161,6 +168,7 @@
                                        <li>@FormParam path: Content repository 
path of the content item to be submitted</li>
                                        <li>@FormParam recursive: This 
parameter is used together with <code>path</code> parameter. Its default value 
is 
                                        <code>false</code>. If it is set as 
<code>true</code>. All content repository objects under the specified path are 
processed.</li>
+                                       <li>@FormParam indexName: Name of the 
Solr index managed by Contenthub. Specified index will be used to submit the 
content items.</li>
                                        <li>@FormParam contentProperties: This 
parameter indicates the list of properties that are possibly holding the actual
                                        content. Possible values are passed as 
comma separated. Its default value is <b>content, skos:definition</b>.</li>
                                </ul>
@@ -207,6 +215,8 @@
                                        <li>@FormParam path: Content repository 
path of the content item to be submitted</li>
                                        <li>@FormParam recursive: This 
parameter is used together with <code>path</code> parameter. Its default value 
is 
                                        <code>false</code>. If it is set as 
<code>true</code>. All content repository objects under the specified path are 
processed.</li>
+                                       <li>@FormParam indexName: Name of the 
Solr index managed by Contenthub. Specified index will be used to delete the 
content items
+                                       from</li>
                                </ul>
                            </td>
                        </tr>
@@ -227,6 +237,19 @@
 </#escape>
 
 <script language="javascript">
+       function init() {
+        $.get("${it.publicBaseUri}contenthub/ldpath", function(indexes) {
+            innerStr = "<select id='indexSelect'>" + "<option 
value='contenthub'>contenthub</option>";
+            for(var index in indexes) {
+                innerStr += "<option value=" + index + ">" + index + 
"</option>";
+            }
+            innerStr += "</select>";
+            $("#indexDiv").html(innerStr);
+        });
+    }
+    
+    $(document).ready(init);
+
 //click handlers
 $(function() {
        $("#submitContentItemsLink").click(function(e) {
@@ -249,6 +272,7 @@ function submitContentItemsToContenthub(
        data.id = $("#contentID").val();
        data.path = $("#contentPath").val();
        data.recursive = $("#recursiveCheck").is(':checked') ? "true" : "false";
+       data.indexName = $("#indexSelect").val();
        data.contentProperties = $("#contentProperties").val();
        $("#submitContentItemsResultText").text("Content items are being 
submitted...");
        $("#submitContentItemsResult").show();
@@ -273,6 +297,7 @@ function deleteContentItemsFromContenthu
        data.id = $("#contentID").val();
        data.path = $("#contentPath").val();
        data.recursive = $("#recursiveCheck").is(':checked') ? "true" : "false";
+       data.indexName = $("#indexSelect").val();
        $("#deleteContentItemsResultText").text("Content items are being 
deleted...");
        $("#deleteContentItemsResult").show();
        $.ajax({


Reply via email to