You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by su...@apache.org on 2011/09/09 08:56:08 UTC

svn commit: r1167019 - in /incubator/stanbol/trunk/cmsadapter/web: ./ src/main/java/org/apache/stanbol/cmsadapter/web/resources/ src/main/resources/org/apache/stanbol/cmsadapter/web/static/ src/main/resources/org/apache/stanbol/cmsadapter/web/templates...

Author: suat
Date: Fri Sep  9 06:56:07 2011
New Revision: 1167019

URL: http://svn.apache.org/viewvc?rev=1167019&view=rev
Log:
STANBOL-306:
-Added HTML interface for the bidirectional mapping implementation.
-Updated REST services so that they allow different kinds of RDF data source.

Added:
    incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/static/
    incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/
    incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/
    incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/
    incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/
    incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/web/
    incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/web/resources/
    incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/web/resources/RDFMapperResource/
    incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/web/resources/RDFMapperResource/index.ftl
    incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/web/resources/RootResource/
    incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/web/resources/RootResource/index.ftl
Modified:
    incubator/stanbol/trunk/cmsadapter/web/pom.xml
    incubator/stanbol/trunk/cmsadapter/web/src/main/java/org/apache/stanbol/cmsadapter/web/resources/RDFMapperResource.java
    incubator/stanbol/trunk/cmsadapter/web/src/main/java/org/apache/stanbol/cmsadapter/web/resources/RootResource.java

Modified: incubator/stanbol/trunk/cmsadapter/web/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/cmsadapter/web/pom.xml?rev=1167019&r1=1167018&r2=1167019&view=diff
==============================================================================
--- incubator/stanbol/trunk/cmsadapter/web/pom.xml (original)
+++ incubator/stanbol/trunk/cmsadapter/web/pom.xml Fri Sep  9 06:56:07 2011
@@ -66,10 +66,17 @@
 			<groupId>org.apache.stanbol</groupId>
 			<artifactId>org.apache.stanbol.cmsadapter.core</artifactId>
 		</dependency>
+
+		<dependency>
+			<groupId>commons-io</groupId>
+			<artifactId>commons-io</artifactId>
+		</dependency>
 		<dependency>
 			<groupId>org.slf4j</groupId>
 			<artifactId>slf4j-api</artifactId>
 		</dependency>
+
+		<!-- Jersey -->
 		<dependency>
 			<groupId>com.sun.jersey</groupId>
 			<artifactId>jersey-core</artifactId>
@@ -79,6 +86,11 @@
 			<artifactId>jersey-server</artifactId>
 		</dependency>
 		<dependency>
+			<groupId>com.sun.jersey.contribs</groupId>
+			<artifactId>jersey-multipart</artifactId>
+		</dependency>
+
+		<dependency>
 			<groupId>com.hp.hpl.jena</groupId>
 			<artifactId>jena</artifactId>
 		</dependency>

Modified: incubator/stanbol/trunk/cmsadapter/web/src/main/java/org/apache/stanbol/cmsadapter/web/resources/RDFMapperResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/cmsadapter/web/src/main/java/org/apache/stanbol/cmsadapter/web/resources/RDFMapperResource.java?rev=1167019&r1=1167018&r2=1167019&view=diff
==============================================================================
--- incubator/stanbol/trunk/cmsadapter/web/src/main/java/org/apache/stanbol/cmsadapter/web/resources/RDFMapperResource.java (original)
+++ incubator/stanbol/trunk/cmsadapter/web/src/main/java/org/apache/stanbol/cmsadapter/web/resources/RDFMapperResource.java Fri Sep  9 06:56:07 2011
@@ -1,13 +1,23 @@
 package org.apache.stanbol.cmsadapter.web.resources;
 
+import static javax.ws.rs.core.MediaType.TEXT_HTML;
+
 import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
 
 import javax.servlet.ServletContext;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.FormParam;
+import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
@@ -17,9 +27,11 @@ import org.apache.clerezza.rdf.core.Grap
 import org.apache.clerezza.rdf.core.MGraph;
 import org.apache.clerezza.rdf.core.serializedform.Parser;
 import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+import org.apache.commons.io.FileUtils;
 import org.apache.stanbol.cmsadapter.core.mapping.RDFBridgeManager;
 import org.apache.stanbol.cmsadapter.servicesapi.mapping.RDFBridge;
 import org.apache.stanbol.cmsadapter.servicesapi.mapping.RDFBridgeException;
+import org.apache.stanbol.cmsadapter.servicesapi.mapping.RDFMapper;
 import org.apache.stanbol.cmsadapter.servicesapi.model.web.ConnectionInfo;
 import org.apache.stanbol.cmsadapter.servicesapi.repository.RepositoryAccessException;
 import org.apache.stanbol.commons.web.base.ContextHelper;
@@ -27,6 +39,10 @@ import org.apache.stanbol.commons.web.ba
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.sun.jersey.api.view.Viewable;
+import com.sun.jersey.core.header.FormDataContentDisposition;
+import com.sun.jersey.multipart.FormDataParam;
+
 /**
  * This resource is currently used to pass RDF data to CMS Adapter so that RDF data will be annotated with
  * "CMS vocabulary" annotations according to {@link RDFBridge}s. Afterwards, this annotated RDF is transformed
@@ -44,52 +60,146 @@ public class RDFMapperResource extends B
         bridgeManager = ContextHelper.getServiceFromContext(RDFBridgeManager.class, context);
     }
 
+    @GET
+    @Produces(TEXT_HTML)
+    public Response get() {
+        return Response.ok(new Viewable("index", this), TEXT_HTML).build();
+    }
+
     /**
-     * This service takes credentials as {@link ConnectionInfo} object to access repository and an RDF data
-     * first to be annotated and then stored in repository based on the annotations.
-     * 
-     * @param connectionInfo
-     *            is the object that holds all necessary information to connect repository. Example connection
-     *            info XML:
+     * Allows clients to map specified RDF to the content repository. In the first step the RDF data is
+     * annotated according to RDF Bridges loaded in the OSGI environment. Additional annotations provide
+     * selection of certain resources from RDF data and creation/update of related content repository object.
+     * Either a raw RDF can be given in <code>serializedGraph</code> parameter or URL of an external RDF data
+     * can given in <code>url</code> parameter. However, <code>serializedGraph</code> has a higher priority.
      * 
-     *            <pre>
-     * <font size="3">
-     * &lt;?xml version="1.0" encoding="UTF-8"?>
-     * &lt;connectionInfo
-     *     xmlns="web.model.servicesapi.cmsadapter.stanbol.apache.org">
-     *     &lt;repositoryURL>rmi://localhost:1099/crx&lt;/repositoryURL>
-     *     &lt;workspaceName>demo&lt;/workspaceName>
-     *     &lt;username>admin&lt;/username>
-     *     &lt;password>admin&lt;/password>
-     *     &lt;connectionType>JCR&lt;/connectionType>
-     * &lt;/connectionInfo>
-     * </font>
-     * </pre>
+     * @param repositoryURL
+     *            URL of the content repository. For JCR repositories <b>RMI protocol</b>, for CMIS
+     *            repositories <b>AtomPub Binding</b> is used. This parameter should be set according to these
+     *            connection methods.
+     * @param workspaceName
+     *            For JCR repositories this parameter determines the workspace to be connected. On the other
+     *            hand for CMIS repositories <b>repository ID</b> should be set to this parameter. In case of
+     *            not setting this parameter, for JCR <b>default workspace</b> is selected, for CMIS the
+     *            <b>first repository</b> obtained through the session object is selected.
+     * @param username
+     *            Username to connect to content repository
+     * @param password
+     *            Password to connect to content repository
+     * @param connectionType
+     *            Connection type; either <b>JCR</b> or <b>CMIS</b>
      * @param serializedGraph
-     *            is the serialized RDF graph that is desired to transformed into repository objects
-     */
-    /*
-     * TODO: It would be wise to get as MGraph in request data. Before that connection info should be get in a
-     * different way.
+     *            is the serialized RDF graph that is desired to be transformed into repository objects
+     * @param url
+     *            URL of the external RDF data.
+     * @return
+     * @throws MalformedURLException
+     * @throws IOException
      */
     @Path("/rdf")
     @POST
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
-    public Response mapRDF(@FormParam("connectionInfo") ConnectionInfo connectionInfo,
-                           @FormParam("serializedGraph") String serializedGraph) {
+    public Response mapRawRDF(@FormParam("repositoryURL") String repositoryURL,
+                              @FormParam("workspaceName") String workspaceName,
+                              @FormParam("username") String username,
+                              @FormParam("password") String password,
+                              @FormParam("connectionType") String connectionType,
+                              @FormParam("serializedGraph") String serializedGraph,
+                              @FormParam("url") String url) throws MalformedURLException, IOException {
+
+        if (repositoryURL == null || username == null || password == null || connectionType == null) {
+            logger.warn("Repository URL, username, password and connection type parameters should not be null");
+            return Response
+                    .status(Status.BAD_REQUEST)
+                    .entity(
+                        "Repository URL, username, password and connection type parameters should not be null")
+                    .build();
+        }
+        ConnectionInfo connectionInfo = formConnectionInfo(repositoryURL, workspaceName, username, password,
+            connectionType);
+
+        Graph g;
+        if (serializedGraph != null && !serializedGraph.trim().isEmpty()) {
+            g = clerezzaParser.parse(new ByteArrayInputStream(serializedGraph.getBytes()),
+                SupportedFormat.RDF_XML);
+        } else if (url != null && !url.trim().isEmpty()) {
+            URLConnection uc = (new URL(url)).openConnection();
+            g = clerezzaParser.parse(uc.getInputStream(), SupportedFormat.RDF_XML);
+        } else {
+            logger.warn("There is no RDF data source specified");
+            return Response.status(Status.BAD_REQUEST).entity("There is no RDF data source specified")
+                    .build();
+        }
+
+        return mapRDF(g, connectionInfo);
+    }
 
-        if (connectionInfo == null) {
-            logger.warn("There is no valid connection info specified");
-            return Response.status(Status.BAD_REQUEST).entity("There is no valid connection info specified")
+    /**
+     * Same with {@link #mapRawRDF(String, String, String, String, String, String, String)}. But this service
+     * allows clients to submit external RDF data through a {@link File} specified in <code>rdfFile</code>
+     * parameter.
+     * 
+     * @param repositoryURL
+     *            URL of the content repository. For JCR repositories <b>RMI protocol</b>, for CMIS
+     *            repositories <b>AtomPub Binding</b> is used. This parameter should be set according to these
+     *            connection methods.
+     * @param workspaceName
+     *            For JCR repositories this parameter determines the workspace to be connected. On the other
+     *            hand for CMIS repositories <b>repository ID</b> should be set to this parameter. In case of
+     *            not setting this parameter, for JCR <b>default workspace</b> is selected, for CMIS the
+     *            <b>first repository</b> obtained through the session object is selected.
+     * @param username
+     *            Username to connect to content repository
+     * @param password
+     *            Password to connect to content repository
+     * @param connectionType
+     *            Connection type; either <b>JCR</b> or <b>CMIS</b>
+     * @param rdfFile
+     *            {@link File} containing the RDF to be mapped to the content repository
+     * @param rdfFileInfo
+     *            Information related with RDF file
+     * @return
+     * @throws IOException
+     */
+    @Path("/rdf")
+    @POST
+    @Consumes(MediaType.MULTIPART_FORM_DATA)
+    public Response mapRDFFromFile(@QueryParam("repositoryURL") String repositoryURL,
+                                   @QueryParam("workspaceName") String workspaceName,
+                                   @QueryParam("username") String username,
+                                   @QueryParam("password") String password,
+                                   @QueryParam("connectionType") String connectionType,
+                                   @FormDataParam("rdfFile") File rdfFile,
+                                   @FormDataParam("rdfFile") FormDataContentDisposition rdfFileInfo) throws IOException {
+
+        if (repositoryURL == null || username == null || password == null || connectionType == null) {
+            logger.warn("Repository URL, username, password and connection type parameters should not be null");
+            return Response
+                    .status(Status.BAD_REQUEST)
+                    .entity(
+                        "Repository URL, username, password and connection type parameters should not be null")
                     .build();
         }
-        if (serializedGraph == null) {
-            logger.warn("There is no valid RDF data specified");
-            return Response.status(Status.BAD_REQUEST).entity("There is no valid RDF data specified").build();
+        ConnectionInfo connectionInfo = formConnectionInfo(repositoryURL, workspaceName, username, password,
+            connectionType);
+
+        Graph g;
+        if (rdfFile != null) {
+            InputStream is = new ByteArrayInputStream(FileUtils.readFileToByteArray(rdfFile));
+            g = clerezzaParser.parse(is, SupportedFormat.RDF_XML);
+        } else {
+            logger.warn("There is RDF file specified");
+            return Response.status(Status.BAD_REQUEST).entity("There is no RDF file specified").build();
+        }
+        Response r = mapRDF(g, connectionInfo);
+        if (r.getStatus() == Response.Status.OK.getStatusCode()) {
+            return get();
+        } else {
+            return r;
         }
+    }
 
-        Graph g = clerezzaParser.parse(new ByteArrayInputStream(serializedGraph.getBytes()),
-            SupportedFormat.RDF_XML);
+    private Response mapRDF(Graph g, ConnectionInfo connectionInfo) {
         try {
             bridgeManager.storeRDFToRepository(connectionInfo, g);
         } catch (RepositoryAccessException e) {
@@ -100,43 +210,42 @@ public class RDFMapperResource extends B
             logger.warn(e.getMessage());
             return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
         }
-        return Response.ok().build();
+
+        return Response.ok().entity("RDF data has been mapped to the content repository").build();
     }
 
     /**
      * This service provides obtaining an RDF from the content repository based on the {@link RDFBridge}
-     * instances in the environment. Target content repository parts are determined according to path
-     * configurations of RDF Bridges.
+     * instances in the environment. Target content content repository objects are determined according to
+     * path configurations of RDF Bridges. In the first step, content repository objects are converted into an
+     * RDF. This process is realized by {@link RDFMapper}. For JCR and CMIS repositories there are two
+     * implementations of this interface namely, <code>JCRRDFMapper</code> and <code>CMISRDFMapper</code>. At
+     * the end of first step, generated RDF contains only <b>CMS Vocabulary</b> annotations. Afterwards,
+     * additional assertions are added based on RDF Bridges.
      * 
-     * @param connectionInfo
-     *            is the object that holds all necessary information to connect repository. Example connection
-     *            info XML:
      * 
-     *            <pre>
-     * <font size="3">
-     * &lt;?xml version="1.0" encoding="UTF-8"?>
-     * &lt;connectionInfo
-     *     xmlns="web.model.servicesapi.cmsadapter.stanbol.apache.org">
-     *     &lt;repositoryURL>rmi://localhost:1099/crx&lt;/repositoryURL>
-     *     &lt;workspaceName>demo&lt;/workspaceName>
-     *     &lt;username>admin&lt;/username>
-     *     &lt;password>admin&lt;/password>
-     *     &lt;connectionType>JCR&lt;/connectionType>
-     * &lt;/connectionInfo>
-     * </font>
-     * </pre>
      * @return generated {@link MGraph} wrapped in a {@link Response} in "application/rdf+xml" format
      */
     @Path("/cms")
     @POST
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
     @Produces(SupportedFormat.RDF_XML)
-    public Response mapCMS(@FormParam("connectionInfo") ConnectionInfo connectionInfo) {
-        if (connectionInfo == null) {
-            logger.warn("There is no valid connection info specified");
-            return Response.status(Status.BAD_REQUEST).entity("There is no valid connection info specified")
+    public Response mapCMS(@FormParam("repositoryURL") String repositoryURL,
+                           @FormParam("workspaceName") String workspaceName,
+                           @FormParam("username") String username,
+                           @FormParam("password") String password,
+                           @FormParam("connectionType") String connectionType) {
+
+        if (repositoryURL == null || username == null || password == null || connectionType == null) {
+            logger.warn("Repository URL, username, password and connection type parameters should not be null");
+            return Response
+                    .status(Status.BAD_REQUEST)
+                    .entity(
+                        "Repository URL, username, password and connection type parameters should not be null")
                     .build();
         }
+        ConnectionInfo connectionInfo = formConnectionInfo(repositoryURL, workspaceName, username, password,
+            connectionType);
 
         try {
             MGraph generatedGraph = bridgeManager.generateRDFFromRepository(connectionInfo);
@@ -151,4 +260,18 @@ public class RDFMapperResource extends B
                     .entity("Error while generating RDF from repository").build();
         }
     }
+
+    private ConnectionInfo formConnectionInfo(String repositoryURL,
+                                              String workspaceName,
+                                              String username,
+                                              String password,
+                                              String connectionType) {
+        ConnectionInfo cInfo = new ConnectionInfo();
+        cInfo.setConnectionType(connectionType);
+        cInfo.setPassword(password);
+        cInfo.setRepositoryURL(repositoryURL);
+        cInfo.setUsername(username);
+        cInfo.setWorkspaceName(workspaceName);
+        return cInfo;
+    }
 }

Modified: incubator/stanbol/trunk/cmsadapter/web/src/main/java/org/apache/stanbol/cmsadapter/web/resources/RootResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/cmsadapter/web/src/main/java/org/apache/stanbol/cmsadapter/web/resources/RootResource.java?rev=1167019&r1=1167018&r2=1167019&view=diff
==============================================================================
--- incubator/stanbol/trunk/cmsadapter/web/src/main/java/org/apache/stanbol/cmsadapter/web/resources/RootResource.java (original)
+++ incubator/stanbol/trunk/cmsadapter/web/src/main/java/org/apache/stanbol/cmsadapter/web/resources/RootResource.java Fri Sep  9 06:56:07 2011
@@ -16,31 +16,24 @@
  */
 package org.apache.stanbol.cmsadapter.web.resources;
 
-import java.net.URI;
-import java.net.URISyntaxException;
+import static javax.ws.rs.core.MediaType.TEXT_HTML;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
-import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.Produces;
 import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
 
 import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
 
+import com.sun.jersey.api.view.Viewable;
+
 @Path("/cmsadapter")
 public class RootResource extends BaseStanbolResource {
 
-    /**
-     * Simply redirects user to CMS Adapter's wiki page at IKS Wiki.
-     * 
-     * @return
-     */
     @GET
-    public Response notifyChange() {
-        try {
-            return Response.seeOther(new URI("http://wiki.iks-project.eu/index.php/CMSAdapterRest")).build();
-        } catch (URISyntaxException e) {
-            throw new WebApplicationException(e, Response.status(Status.BAD_REQUEST).build());
-        }
+    @Produces(TEXT_HTML)
+    public Response get() {
+        return Response.ok(new Viewable("index", this), TEXT_HTML).build();
     }
+
 }

Added: incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/web/resources/RDFMapperResource/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/RDFMapperResource/index.ftl?rev=1167019&view=auto
==============================================================================
--- incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/web/resources/RDFMapperResource/index.ftl (added)
+++ incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/web/resources/RDFMapperResource/index.ftl Fri Sep  9 06:56:07 2011
@@ -0,0 +1,346 @@
+<#--
+  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.
+-->
+<#import "/imports/common.ftl" as common>
+<#escape x as x?html>
+<@common.page title="CMS Adapter" hasrestapi=true> 
+
+<div class="panel" id="webview">
+	<h3>Service Endpoint <a href="${it.publicBaseUri}cmsadapter/map">/cmsadapter/map</a></h3>
+	<p>This endpoint provides a bidirectional mapping between external RDF data and JCR/CMIS 
+	   	content repositories based on <a href="http://svn.apache.org/repos/asf/incubator/stanbol/trunk/cmsadapter/servicesapi/src/main/java/org/apache/stanbol/cmsadapter/servicesapi/mapping/RDFBridge.java">RDFBridge</a>s.
+		<b>Default RDF Bridge</b> implementation can be configured through the <b>Apache Stanbol CMS Adapter Default RDF Bridge Configurations</b> 
+		entry in the <a href="${it.publicBaseUri}system/console/configMgr">Apache Felix Web Console Configuration Panel</a>. 
+	</p>
+	
+	<p>Following services are available for this endpoint:<br>
+		<ul>
+			<li><a href="#Map_RDF_to_repository">Map RDF to repository</a></li>
+			<li><a href="#Map_repository_to_RDF">Map repository to RDF</a></li>
+		</ul>
+		Interaction with the content repository is provided through the following properties. They are required all services provided by this endpoint.
+		Please note that while connecting JCR repositories <b>RMI protocol</b> is used, on the other hand for CMIS repositories <b>AtomPub Binding</b> 
+		is used. So, it is necessary to set <b>repositoryURL</b> parameter based on these connection methods. 
+		<fieldset>
+			<legend>Connection parameters</legend>
+			<table>
+				<tbody>
+					<tr>
+						<th>Repository URL</th>
+						<td><input type="text" id="repositoryURL" value=""></td>
+					</tr>
+					<tr>
+						<th>Workspace Name</th>
+						<td><input type="text" id="workspaceName" value=""></td>
+					</tr>
+					<tr>
+						<th>Username</th>
+						<td><input type="text" id="username" value=""></td>
+					</tr>
+					<tr>
+						<th>Password</th>
+						<td><input type="password" id="password" value=""></td>
+					</tr>
+					<tr>
+						<th>Connection type</th>
+						<td>
+							<select id="connectionType">
+							  <option value="JCR">JCR</option>
+							  <option value="CMIS">CMIS</option>
+							</select>
+						</td>
+					</tr>
+				</tbody>
+			</table>
+		</fieldset>
+	</p>
+
+	<a name="Map_RDF_to_repository" id="Map_RDF_to_repository"></a>
+	<h4>Map RDF to repository</h4>
+	<p>
+		This service allows clients to map specified RDF to the content repository. In the first step the RDF data is annotated according to
+		RDF Bridges loaded in the OSGI environment. Additional annotations provide selection of certain resources from RDF data and 
+		creation/update of related content repository object. 
+	</p>
+	<h5>Test</h5>
+	<fieldset>
+		<legend>Submit raw RDF data</legend>
+		<p><textarea rows="15" id="rawRDF"></textarea></p>
+		<p><input type="button" value="Submit RDF" onclick="postRawRDF()"/></p>
+	</fieldset>
+	<div id="rawRDFpostResult" style="display: none; ">
+		</p><pre id="rawRDFpostResultText"></pre>
+	</div>
+	
+	<fieldset>
+	  	<legend>Submit a remote public RDF by URL</legend>
+	  	<p><input id="urlInput" type="text" class="url">
+	   	  <input type="button" value="Submit URL" onclick="postRDFFromURL()"></p>
+  	</fieldset>
+	<div id="postRDFFromURLResult" style="display: none; ">
+		</p><pre id="postRDFFromURLResultText"></pre>
+	</div>
+	
+	<form id="localRDFFileForm" method="POST" accept-charset="utf-8" enctype="multipart/form-data">
+	  	<fieldset>
+			<legend>Upload a local RDF file</legend>
+		 	<p><input name="rdfFile" type="file">
+		  	   <input type="button" value="Submit file" onclick="postLocalRDFFileMapping()"></p>
+	  	</fieldset>
+	</form>
+		
+	<a name="Map_repository_to_RDF" id="Map_repository_to_RDF"></a>
+	<h4>Map repository to RDF</h4>
+	<p>
+		This service allows clients to map content repository to RDF. In the first step, structure of the content repository is converted into an RDF. 
+		For this process detailed documentation can be found in javadoc of <a href="http://svn.apache.org/repos/asf/incubator/stanbol/trunk/cmsadapter/servicesapi/src/main/java/org/apache/stanbol/cmsadapter/servicesapi/mapping/RDFMapper.java">RDFMapper</a> interface. 
+		There are two implementations of this interface for JCR and CMIS protocols respectively, <a href="http://svn.apache.org/repos/asf/incubator/stanbol/trunk/cmsadapter/jcr/src/main/java/org/apache/stanbol/cmsadapter/jcr/repository/JCRRDFMapper.java">JCRRDFMapper</a> 
+		and <a href="http://svn.apache.org/repos/asf/incubator/stanbol/trunk/cmsadapter/cmis/src/main/java/org/apache/stanbol/cmsadapter/cmis/repository/CMISRDFMapper.java">CMISRDFMapper</a>. 
+		At the end of first step, generated RDF contains only <b>CMS Vocabulary</b> annotations. Afterwards, additional assertions are added based on RDF 
+		Bridges loaded in the OSGI environment.  
+	</p>
+	<h5>Test</h5>
+	<a onclick="javascript:postMapRepositoryToRDF()" href="javascript:void(0);">Map content repository to RDF</a>
+	<div id="postMapRepositoryToRDFResult" style="display: none; ">
+		<p><a href="#" onclick="$('#postMapRepositoryToRDFResult').hide(); return false;">Hide results</a>
+		</p><pre id="postMapRepositoryToRDFResultText"></pre>
+	</div>
+</div>
+
+<div class="panel" id="restapi" style="display: none;">
+	<h3>Service Endpoint <a href="${it.publicBaseUri}cmsadapter/map">/cmsadapter/map</a></h3>
+	<p>Following services are available for this endpoint:<br>
+	<ul>
+		<li><a href="#Map_RDF_to_repository">Map RDF to repository</a></li>
+		<li><a href="#Map_repository_to_RDF">Map repository to RDF</a></li>
+	</ul>
+		
+	<a name="Map_RDF_to_repository" id="Map_RDF_to_repository"></a>
+	<h4>Map RDF to repository</h4>
+	<table>
+		<tbody>
+			<tr>
+				<th>Description</th>
+				<td>Allows clients to map specified RDF to the content repository. In the first step the RDF data is annotated according to
+					RDF Bridges loaded in the OSGI environment. Additional annotations provide selection of certain resources from RDF data and 
+					creation/update of related content repository object. Either a raw RDF can be given in <code>serializedGraph</code> parameter
+					or URL of an external RDF data can given in <code>url</code> parameter. However, <code>serializedGraph</code> has a higher
+					priority. 
+				</td>
+			</tr>
+			<tr>
+				<th>Request</th>
+				<td>POST /cmsadapter/map/rdf</td>
+			</tr>
+			<tr>
+				<th>Parameters</th>
+				<td>
+					<ul>
+						<li>@FormParam repositoryURL: URL of the content repository. For JCR repositories <b>RMI protocol</b>, for CMIS repositories
+							<b>AtomPub Binding</b> is used. This parameter should be set according to these connection methods.</li>
+			            <li>@FormParam workspaceName: For JCR repositories this parameter determines the workspace to be connected. On the other hand
+			            	for CMIS repositories <b>repository ID</b> should be set to this parameter. In case of not setting this parameter,
+			            	for JCR <b>default workspace</b> is selected, for CMIS the <b>first repository</b> obtained through the session object 
+			            	is selected.</li>
+			    		<li>@FormParam username: Username to connect to content repository</li>
+			    		<li>@FormParam password: Password to connect to content repository</li>
+			    		<li>@FormParam connectionType: Connection type; either <b>JCR</b> or <b>CMIS</b></li>
+			    		<li>@FormParam serializedGraph: External RDF in <b>application/rdf+xml</b> format</li>
+			    		<li>@FormParam url: URL of the external RDF data.</li>
+			    	</ul>
+			    </td>
+			</tr>
+			<tr>
+				<th>Produces</th>
+				<td>HTTP 200 in case of successful execution.</td>
+			</tr>
+			<tr>
+				<th>Example</th>
+				<td><pre>curl -i -X POST -d "repositoryURL=rmi://localhost:1099/crx&workspaceName=test&username=admin&password=admin&connectionType=JCR&url=http://www.externalrdf.data" http://localhost:8080/cmsadapter/map/rdf</pre></td>
+			</tr>
+		</tbody>
+	</table>
+	<br><hr>
+	<table>
+		<tbody>
+			<tr>
+				<th>Description</th>
+				<td>This is service does the same job with the previous one except that this service provides users to submit an RDF file from his local
+					file system. So it takes connection parameters as query parameters in the service URL.
+				</td>
+			</tr>
+			<tr>
+				<th>Request</th>
+				<td>POST /cmsadapter/map/rdf?repositoryURL={repositoryURL}&workspaceName={workspaceName}&username={username}&password={password}"&connectionType={connectionType}</td>
+			</tr>
+			<tr>
+				<th>Parameters</th>
+				<td>
+					<ul>
+						<li>@QueryParam repositoryURL: URL of the content repository</li>
+			            <li>@QueryParam workspaceName: For JCR repositories this parameter determines the workspace to be connected. On the other hand
+			            	for CMIS repositories <b>repository ID</b> should be set to this parameter. In case of not setting this parameter,
+			            	for JCR <b>default workspace</b> is selected, for CMIS the <b>first repository</b> obtained through the session object 
+			            	is selected.</li>
+			    		<li>@QueryParam username: Username to connect to content repository</li>
+			    		<li>@QueryParam password: Password to connect to content repository</li>
+			    		<li>@QueryParam connectionType: Connection type; either <b>JCR</b> or <b>CMIS</b></li>
+			    		<li>@FormDataParam rdfFile: Local RDF file to be submitted</li>
+			    		<li>@FormDataParam rdfFileInfo: Information about submitted RDF file</li>
+			    	</ul>
+			    </td>
+			</tr>
+			<tr>
+				<th>Produces</th>
+				<td>HTTP 200 together with entry page of <b>/cmsadapter/map</b> endpoint, in case of successful execution.</td>
+			</tr>
+			<tr>
+				<th>Example</th>
+				<td><pre>curl -i -X POST -F "rdfFile=@localRDFFile" "http://localhost:8080/cmsadapter/map/rdf?repositoryURL=http://localhost:8083/nuxeo/atom/cmis&workspaceName=test&username=admin&password=admin&connectionType=CMIS"</pre></td>
+			</tr>
+		</tbody>
+	</table>
+	
+	<a name="Map_repository_to_RDF" id="Map_repository_to_RDF"></a>
+	<h4>Map repository to RDF</h4>
+	<table>
+		<tbody>
+			<tr>
+				<th>Description</th>
+				<td>
+					This service allows clients to map content repository to RDF. In the first step, structure of the content repository is converted into an RDF. 
+					For this process detailed documentation can be found in javadoc of <a href="http://svn.apache.org/repos/asf/incubator/stanbol/trunk/cmsadapter/servicesapi/src/main/java/org/apache/stanbol/cmsadapter/servicesapi/mapping/RDFMapper.java">RDFMapper</a> interface. 
+					There are two implementations of this interface for JCR and CMIS protocols respectively, <a href="http://svn.apache.org/repos/asf/incubator/stanbol/trunk/cmsadapter/jcr/src/main/java/org/apache/stanbol/cmsadapter/jcr/repository/JCRRDFMapper.java">JCRRDFMapper</a> 
+					and <a href="http://svn.apache.org/repos/asf/incubator/stanbol/trunk/cmsadapter/cmis/src/main/java/org/apache/stanbol/cmsadapter/cmis/repository/CMISRDFMapper.java">CMISRDFMapper</a>. 
+					At the end of first step, generated RDF contains only <b>CMS Vocabulary</b> annotations. Afterwards, additional assertions are added based on RDF 
+					Bridges loaded in the OSGI environment.  
+				</td>
+			</tr>
+			<tr>
+				<th>Request</th>
+				<td>POST /cmsadapter/map/cms</td>
+			</tr>
+			<tr>
+				<th>Parameters</th>
+				<td>
+					<ul>
+						<li>@FormParam repositoryURL: URL of the content repository</li>
+			            <li>@FormParam workspaceName: For JCR repositories this parameter determines the workspace to be connected. On the other hand
+			            	for CMIS repositories <b>repository ID</b> should be set to this parameter. In case of not setting this parameter,
+			            	for JCR <b>default workspace</b> is selected, for CMIS the <b>first repository</b> obtained through the session object 
+			            	is selected.</li>
+			    		<li>@FormParam username: Username to connect to content repository</li>
+			    		<li>@FormParam password: Password to connect to content repository</li>
+			    		<li>@FormParam connectionType: Connection type; either <b>JCR</b> or <b>CMIS</b></li>
+			    	</ul>
+			    </td>
+			</tr>
+			<tr>
+				<th>Produces</th>
+				<td>Mapped RDF from content repository in <b>application/rdf+xml</b> format</td>.
+			</tr>
+			<tr>
+				<th>Example</th>
+				<td><pre>curl -i -X POST -d "repositoryURL=rmi://localhost:1099/crx&workspaceName=test&username=admin&password=admin&connectionType=JCR" http://localhost:8080/cmsadapter/map/cms</pre></td>
+			</tr>
+		</tbody>
+	</table>
+</div>
+
+</...@common.page>
+</#escape>
+
+<script language="javascript">
+function postRawRDF() {
+	var data = new Object();
+	data.repositoryURL = $("#repositoryURL").val();
+	data.workspaceName = $("#workspaceName").val();
+	data.username = $("#username").val();
+	data.password = $("#password").val();
+	data.connectionType = $("#connectionType").val();
+	data.serializedGraph = $("#rawRDF").val();
+	$.post("${it.publicBaseUri}cmsadapter/map/rdf", data);
+	$.ajax({
+	  	type: 'POST',
+	  	url: '${it.publicBaseUri}cmsadapter/map/rdf',
+	  	data: data,
+   		success: function(data, textStatus, jqXHR) {
+     		$("#rawRDFpostResultText").text(jqXHR.responseText);
+     		$("#rawRDFpostResult").show();
+   		},
+   		error: function(jqXHR, textStatus, errorThrown) {
+     		$("#rawRDFpostResultText").text(jqXHR.statusText + " - " + jqXHR.responseText);
+     		$("#rawRDFpostResult").show();
+   		}
+	});
+}
+
+function postRDFFromURL() {
+	var data = new Object();
+	data.repositoryURL = $("#repositoryURL").val();
+	data.workspaceName = $("#workspaceName").val();
+	data.username = $("#username").val();
+	data.password = $("#password").val();
+	data.connectionType = $("#connectionType").val();
+	data.url = $("#urlInput").val();
+	$.ajax({
+	  	type: 'POST',
+	  	url: '${it.publicBaseUri}cmsadapter/map/rdf',
+	  	data: data,
+   		success: function(data, textStatus, jqXHR) {
+     		$("#postRDFFromURLResultText").text(jqXHR.responseText);
+     		$("#postRDFFromURLResult").show();
+   		},
+   		error: function(jqXHR, textStatus, errorThrown) {
+     		$("#postRDFFromURLResultText").text(jqXHR.statusText + " - " + jqXHR.responseText);
+     		$("#postRDFFromURLResult").show();
+   		}
+	});
+}
+
+function postLocalRDFFileMapping() {
+	var url = "?repositoryURL=" + $("#repositoryURL").val() + 
+				"&workspaceName=" + $("#workspaceName").val() + 
+				"&username=" + $("#username").val() +
+				"&password=" + $("#password").val() +
+				"&connectionType=" + $("#connectionType").val();
+	url = "${it.publicBaseUri}cmsadapter/map/rdf" + url;
+	$('#localRDFFileForm').attr('action', url);
+	$('#localRDFFileForm').submit();
+}
+
+function postMapRepositoryToRDF(){
+	var data = new Object();
+	data.repositoryURL = $("#repositoryURL").val();
+	data.workspaceName = $("#workspaceName").val();
+	data.username = $("#username").val();
+	data.password = $("#password").val();
+	data.connectionType = $("#connectionType").val();
+	$.ajax({
+	  	type: 'POST',
+	  	url: '${it.publicBaseUri}cmsadapter/map/cms',
+	  	data: data,
+   		success: function(data, textStatus, jqXHR) {
+     		$("#postMapRepositoryToRDFResultText").text(jqXHR.responseText);
+     		$("#postMapRepositoryToRDFResult").show();
+   		},
+   		error: function(jqXHR, textStatus, errorThrown) {
+     		$("#postMapRepositoryToRDFResultText").text(jqXHR.statusText + " - " + jqXHR.responseText);
+     		$("#postMapRepositoryToRDFResult").show();
+   		}
+	});	
+}
+</script>

Added: incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/web/resources/RootResource/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/RootResource/index.ftl?rev=1167019&view=auto
==============================================================================
--- incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/web/resources/RootResource/index.ftl (added)
+++ incubator/stanbol/trunk/cmsadapter/web/src/main/resources/org/apache/stanbol/cmsadapter/web/templates/org/apache/stanbol/cmsadapter/web/resources/RootResource/index.ftl Fri Sep  9 06:56:07 2011
@@ -0,0 +1,35 @@
+<#--
+  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.
+-->
+<#import "/imports/common.ftl" as common>
+<#escape x as x?html>
+<@common.page title="CMS Adapter" hasrestapi=true> 
+
+<div class="panel" id="webview">
+<p>This is the start page of the CMS Adapter.
+</p>
+</div>
+
+<div class="panel" id="restapi" style="display: none;">
+<h3>Service Endpoints</h3>
+<p>The CMS Adapter supports the following service end points:</p>
+<ul>
+	<li>RDF Map @ <a href="${it.publicBaseUri}cmsadapter/map">/cmsadapter/map</a></li>
+</ul>
+</div>
+
+</...@common.page>
+</#escape>