jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject svn commit: r729019 - in /jackrabbit/sandbox/jcr-cmis/server/ws/src: main/java/org/apache/jackrabbit/cmis/ws/repository/impl/ test/java/org/apache/jackrabbit/cmis/ws/repository/ test/resources/
Date Tue, 23 Dec 2008 16:14:01 GMT
Author: paolo
Date: Tue Dec 23 08:14:00 2008
New Revision: 729019

URL: http://svn.apache.org/viewvc?rev=729019&view=rev
Log:
repositoryInfo and repository capabilities in getRepositoryInfo method

Added:
    jackrabbit/sandbox/jcr-cmis/server/ws/src/test/resources/repository.xml
Modified:
    jackrabbit/sandbox/jcr-cmis/server/ws/src/main/java/org/apache/jackrabbit/cmis/ws/repository/impl/RepositoryServicePortImpl.java
    jackrabbit/sandbox/jcr-cmis/server/ws/src/test/java/org/apache/jackrabbit/cmis/ws/repository/RepositoryServiceTest.java

Modified: jackrabbit/sandbox/jcr-cmis/server/ws/src/main/java/org/apache/jackrabbit/cmis/ws/repository/impl/RepositoryServicePortImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcr-cmis/server/ws/src/main/java/org/apache/jackrabbit/cmis/ws/repository/impl/RepositoryServicePortImpl.java?rev=729019&r1=729018&r2=729019&view=diff
==============================================================================
--- jackrabbit/sandbox/jcr-cmis/server/ws/src/main/java/org/apache/jackrabbit/cmis/ws/repository/impl/RepositoryServicePortImpl.java
(original)
+++ jackrabbit/sandbox/jcr-cmis/server/ws/src/main/java/org/apache/jackrabbit/cmis/ws/repository/impl/RepositoryServicePortImpl.java
Tue Dec 23 08:14:00 2008
@@ -16,14 +16,21 @@
  */
 package org.apache.jackrabbit.cmis.ws.repository.impl;
 
+import java.io.IOException;
 import java.util.Collections;
 import java.util.List;
 
+import javax.jcr.Repository;
 import javax.jws.WebService;
 
+import org.apache.jackrabbit.cmis.ws.repository.CmisRepositoryCapabilitiesType;
 import org.apache.jackrabbit.cmis.ws.repository.CmisRepositoryEntryType;
 import org.apache.jackrabbit.cmis.ws.repository.CmisRepositoryInfoType;
 import org.apache.jackrabbit.cmis.ws.repository.ConstraintViolationException;
+import org.apache.jackrabbit.cmis.ws.repository.EnumCapabilityFullText;
+import org.apache.jackrabbit.cmis.ws.repository.EnumCapabilityJoin;
+import org.apache.jackrabbit.cmis.ws.repository.EnumCapabilityQuery;
+import org.apache.jackrabbit.cmis.ws.repository.EnumRepositoryRelationship;
 import org.apache.jackrabbit.cmis.ws.repository.GetRepositoryInfo;
 import org.apache.jackrabbit.cmis.ws.repository.GetTypeDefinition;
 import org.apache.jackrabbit.cmis.ws.repository.GetTypeDefinitionResponse;
@@ -37,6 +44,7 @@
 import org.apache.jackrabbit.cmis.ws.repository.RuntimeException;
 import org.apache.jackrabbit.cmis.ws.repository.TypeNotFoundException;
 import org.apache.jackrabbit.cmis.ws.repository.UpdateConflictException;
+import org.apache.jackrabbit.core.TransientRepository;
 
 
 @WebService(name = "RepositoryServicePort", serviceName = "RepositoryService", portName =
"RepositoryServicePort", targetNamespace = "http://www.cmis.org/ns/1.0", endpointInterface
= "org.apache.jackrabbit.cmis.ws.repository.RepositoryServicePort")
@@ -58,14 +66,36 @@
 			InvalidArgumentException, RuntimeException,
 			ConstraintViolationException {
 		CmisRepositoryInfoType repositoryInfo = new CmisRepositoryInfoType();
-
-        repositoryInfo.setRepositoryName("Jackrabbit");
-        repositoryInfo.setRepositoryRelationship("self");
-        repositoryInfo.setRepositoryDescription("");
-        repositoryInfo.setVendorName("Apache");
-        repositoryInfo.setProductName("Apache Jackrabbit");
-		repositoryInfo.setProductVersion("1.6-SNAPSHOT");
+		CmisRepositoryCapabilitiesType capabilities = new CmisRepositoryCapabilitiesType();
+		repositoryInfo.setCapabilities(capabilities);
+		
+		/** FIXME remove this Repository instantiation; get the repository from parameters info
**/
+		Repository repository = null;
+		try {
+			 repository = new TransientRepository();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+        repositoryInfo.setRepositoryName(repository.getDescriptor(Repository.REP_NAME_DESC));
+        repositoryInfo.setRepositoryRelationship(EnumRepositoryRelationship.SELF.toString());
+        repositoryInfo.setRepositoryDescription(repository.getDescriptor(Repository.REP_NAME_DESC));
+        repositoryInfo.setVendorName(repository.getDescriptor(Repository.REP_VENDOR_DESC));
+        repositoryInfo.setProductName(repository.getDescriptor(Repository.REP_NAME_DESC));
+        repositoryInfo.setProductVersion(repository.getDescriptor(Repository.REP_VERSION_DESC));
         repositoryInfo.setCmisVersionsSupported("0.5");
+        
+        capabilities.setCapabilityMultifiling(true);
+        capabilities.setCapabilityUnfiling(true);
+        /** FIXME validate this **/
+        capabilities.setCapabilityVersionSpecificFiling(false);
+        /** FIXME validate this **/
+        capabilities.setCapabilityPWCUpdateable(false);
+        /** FIXME validate this **/
+        capabilities.setCapabilityPWCSearchable(false);
+        capabilities.setCapabilityQuery(EnumCapabilityQuery.BOTH);
+        capabilities.setCapabilityJoin(EnumCapabilityJoin.NOJOIN);
+        capabilities.setCapabilityFullText(EnumCapabilityFullText.FULLTEXTANDSTRUCTURED);
 
         return repositoryInfo;
 	}

Modified: jackrabbit/sandbox/jcr-cmis/server/ws/src/test/java/org/apache/jackrabbit/cmis/ws/repository/RepositoryServiceTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcr-cmis/server/ws/src/test/java/org/apache/jackrabbit/cmis/ws/repository/RepositoryServiceTest.java?rev=729019&r1=729018&r2=729019&view=diff
==============================================================================
--- jackrabbit/sandbox/jcr-cmis/server/ws/src/test/java/org/apache/jackrabbit/cmis/ws/repository/RepositoryServiceTest.java
(original)
+++ jackrabbit/sandbox/jcr-cmis/server/ws/src/test/java/org/apache/jackrabbit/cmis/ws/repository/RepositoryServiceTest.java
Tue Dec 23 08:14:00 2008
@@ -16,11 +16,11 @@
  */
 package org.apache.jackrabbit.cmis.ws.repository;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.List;
 
-import javax.jcr.LoginException;
-import javax.jcr.RepositoryException;
+import javax.jcr.Repository;
 import javax.xml.ws.Endpoint;
 
 import junit.framework.TestCase;
@@ -29,15 +29,16 @@
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.jackrabbit.cmis.ws.repository.impl.RepositoryServicePortImpl;
+import org.apache.jackrabbit.core.TransientRepository;
 
 public class RepositoryServiceTest extends TestCase {
 	
 	private RepositoryServicePort client;
+	private Repository repository;
 	private GetRepositoryInfo parameters;
 	
 	protected void setUp() {
-
-        // Starting Server
+        // Starting a Server
         RepositoryServicePortImpl implementor = new RepositoryServicePortImpl();
         String address = "http://localhost:9000/repositoryService";
         Endpoint.publish(address, implementor);
@@ -50,20 +51,56 @@
     	factory.setAddress
     	("http://localhost:9000/repositoryService");
     	client = (RepositoryServicePort) factory.create();
+
+    	// Instantiate a Repository
+		try {
+			repository = new TransientRepository("target/test-classes/repository.xml", "target/test-classes/repository");
+		} catch (IOException e) {
+			this.fail("Some exception occurred instantiating a TransientRepository object");
+			e.printStackTrace();
+		}
     	
     	// init a GetRepositoryInfo object
     	parameters = new GetRepositoryInfo();
     	parameters.setRepositoryId("ID");
 	}
+	
+	protected void tearDown() {
+		// Drop the Repository created in setUp
+		File repositoryRoot = new File("target/test-classes/repository");
+		repositoryRoot.delete();
+	}
 
-	public void testGetRepositories() throws IOException, LoginException, RepositoryException,
PermissionDeniedException, UpdateConflictException, OperationNotSupportedException, InvalidArgumentException,
RuntimeException {
-    	List repositories = client.getRepositories();
+	public void testGetRepositories() {
+    	List repositories = null;
+		try {
+			repositories = client.getRepositories();
+		} catch (Exception e) {
+			this.fail("Some exception occurred getting repositories");
+			e.printStackTrace();
+		}
     	assertEquals(1, repositories.size());
 	}
 	
-	public void testGetRepositoryInfo() throws PermissionDeniedException, UpdateConflictException,
ObjectNotFoundException, OperationNotSupportedException, InvalidArgumentException, RuntimeException,
ConstraintViolationException {
-		CmisRepositoryInfoType repositoryInfo = client.getRepositoryInfo(parameters);
-		assertEquals("Apache Jackrabbit", repositoryInfo.getProductName());
+	public void testGetRepositoryInfo() {
+		CmisRepositoryInfoType repositoryInfo = null;
+		try {
+			repositoryInfo = client.getRepositoryInfo(parameters);
+		} catch (Exception e) {
+			this.fail("Some exception occurred getting repositoryInfo");
+			e.printStackTrace();
+		}
+		assertEquals("Jackrabbit", repositoryInfo.getRepositoryName());
+		assertEquals("SELF", repositoryInfo.getRepositoryRelationship());
+		assertEquals("Jackrabbit", repositoryInfo.getRepositoryDescription());
+		assertEquals("Apache Software Foundation", repositoryInfo.getVendorName());
+		assertEquals("Jackrabbit", repositoryInfo.getProductName());
+		assertEquals("1.6-SNAPSHOT", repositoryInfo.getProductVersion());
+		assertEquals(true, repositoryInfo.getCapabilities().isCapabilityMultifiling());
+		assertEquals(true, repositoryInfo.getCapabilities().isCapabilityUnfiling());
+		assertEquals(EnumCapabilityQuery.BOTH, repositoryInfo.getCapabilities().getCapabilityQuery());
+		assertEquals(EnumCapabilityJoin.NOJOIN, repositoryInfo.getCapabilities().getCapabilityJoin());
+		assertEquals(EnumCapabilityFullText.FULLTEXTANDSTRUCTURED, repositoryInfo.getCapabilities().getCapabilityFullText());
 	}
 
 }

Added: jackrabbit/sandbox/jcr-cmis/server/ws/src/test/resources/repository.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcr-cmis/server/ws/src/test/resources/repository.xml?rev=729019&view=auto
==============================================================================
--- jackrabbit/sandbox/jcr-cmis/server/ws/src/test/resources/repository.xml (added)
+++ jackrabbit/sandbox/jcr-cmis/server/ws/src/test/resources/repository.xml Tue Dec 23 08:14:00
2008
@@ -0,0 +1,123 @@
+<?xml version="1.0"?>
+<!--
+   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.
+-->
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.4//EN"
+                            "http://jackrabbit.apache.org/dtd/repository-1.4.dtd">
+<!-- Example Repository Configuration File -->
+<Repository>
+    <!--
+        virtual file system where the repository stores global state
+        (e.g. registered namespaces, custom node types, etc.)
+    -->
+    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+        <param name="path" value="${rep.home}/repository"/>
+    </FileSystem>
+
+    <!--
+        security configuration
+    -->
+    <Security appName="Jackrabbit">
+        <!--
+            access manager:
+            class: FQN of class implementing the AccessManager interface
+        -->
+        <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager">
+            <!-- <param name="config" value="${rep.home}/access.xml"/> -->
+        </AccessManager>
+
+        <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
+           <!-- anonymous user name ('anonymous' is the default value) -->
+           <param name="anonymousId" value="anonymous"/>
+           <!--
+              default user name to be used instead of the anonymous user
+              when no login credentials are provided (unset by default)
+           -->
+           <!-- <param name="defaultUserId" value="superuser"/> -->
+        </LoginModule>
+    </Security>
+
+    <!--
+        location of workspaces root directory and name of default workspace
+    -->
+    <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
+    <!--
+        workspace configuration template:
+        used to create the initial workspace if there's no workspace yet
+    -->
+    <Workspace name="${wsp.name}">
+        <!--
+            virtual file system of the workspace:
+            class: FQN of class implementing the FileSystem interface
+        -->
+        <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+            <param name="path" value="${wsp.home}"/>
+        </FileSystem>
+        <!--
+            persistence manager of the workspace:
+            class: FQN of class implementing the PersistenceManager interface
+        -->
+        <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.DerbyPersistenceManager">
+          <param name="url" value="jdbc:derby:${wsp.home}/db;create=true"/>
+          <param name="schemaObjectPrefix" value="${wsp.name}_"/>
+        </PersistenceManager>
+        <!--
+            Search index and the file system it uses.
+            class: FQN of class implementing the QueryHandler interface
+        -->
+        <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+            <param name="path" value="${wsp.home}/index"/>
+            <param name="textFilterClasses" value="org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
+            <param name="extractorPoolSize " value="2"/>
+            <param name="supportHighlighting" value="true"/>
+        </SearchIndex>
+    </Workspace>
+
+    <!--
+        Configures the versioning
+    -->
+    <Versioning rootPath="${rep.home}/version">
+        <!--
+            Configures the filesystem to use for versioning for the respective
+            persistence manager
+        -->
+        <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+            <param name="path" value="${rep.home}/version" />
+        </FileSystem>
+
+        <!--
+            Configures the persistence manager to be used for persisting version state.
+            Please note that the current versioning implementation is based on
+            a 'normal' persistence manager, but this could change in future
+            implementations.
+        -->
+        <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.DerbyPersistenceManager">
+          <param name="url" value="jdbc:derby:${rep.home}/version/db;create=true"/>
+          <param name="schemaObjectPrefix" value="version_"/>
+        </PersistenceManager>
+    </Versioning>
+
+    <!--
+        Search index for content that is shared repository wide
+        (/jcr:system tree, contains mainly versions)
+    -->
+    <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+        <param name="path" value="${rep.home}/repository/index"/>
+        <param name="textFilterClasses" value="org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
+        <param name="extractorPoolSize " value="2"/>
+        <param name="supportHighlighting" value="true"/>
+    </SearchIndex>
+</Repository>



Mime
View raw message