Author: sklevenz
Date: Fri Feb 26 11:58:40 2010
New Revision: 916652
URL: http://svn.apache.org/viewvc?rev=916652&view=rev
Log:
client runtime implementation
- repository info supported
https://issues.apache.org/jira/browse/CMIS-124
Added:
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryCapabilitiesImpl.java
(with props)
Modified:
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/RepositoryInfoImpl.java
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyRepositoryInfoTest.java
Modified:
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java?rev=916652&r1=916651&r2=916652&view=diff
==============================================================================
---
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java
(original)
+++
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java
Fri Feb 26 11:58:40 2010
@@ -48,7 +48,6 @@
import org.apache.opencmis.client.runtime.repository.PropertyFactoryImpl;
import org.apache.opencmis.commons.SessionParameter;
import org.apache.opencmis.commons.api.ExtensionsData;
-import org.apache.opencmis.commons.enums.BaseObjectTypeIds;
import org.apache.opencmis.commons.enums.BindingType;
import org.apache.opencmis.commons.enums.CmisProperties;
import org.apache.opencmis.commons.enums.IncludeRelationships;
@@ -56,7 +55,6 @@
import org.apache.opencmis.commons.exceptions.CmisRuntimeException;
import org.apache.opencmis.commons.provider.CmisProvider;
import org.apache.opencmis.commons.provider.ObjectData;
-import org.apache.opencmis.commons.provider.RepositoryInfoData;
import org.apache.opencmis.util.repository.ObjectGenerator;
public class PersistentSessionImpl implements PersistentSession, Testable,
@@ -90,12 +88,6 @@
private Locale locale = null;
/*
- * If not set explicitly then the repository id is returned by the
- * repository (serializable)
- */
- private String repositoryId;
-
- /*
* helper factory (non serializable)
*/
private transient PropertyFactory propertyFactory = PropertyFactoryImpl
@@ -107,9 +99,10 @@
private Cache cache = null;
/*
- * Lazy loaded repository info (serializable)
+ * Lazy loaded repository info. Will be invalid after clear(). Access by
+ * getter always. (serializable)
*/
- private RepositoryInfo repositoryInfo;
+ private RepositoryInfoImpl repositoryInfo;
/*
* helper factory (non serializable)
@@ -130,10 +123,6 @@
PersistentSessionImpl.log.info("Session Locale: "
+ this.locale.toString());
- this.repositoryId = this.determineRepositoryId(parameters);
- PersistentSessionImpl.log.info("Session Repository Id: "
- + this.repositoryId);
-
int cacheSize = this.determineCacheSize(parameters);
if (cacheSize == -1) {
@@ -187,8 +176,11 @@
}
public void clear() {
- int cacheSize = this.determineCacheSize(this.parameters);
+ /*
+ * clear cache
+ */
+ int cacheSize = this.determineCacheSize(this.parameters);
if (cacheSize == -1) {
this.cache = CacheImpl.newInstance();
} else {
@@ -196,6 +188,12 @@
}
PersistentSessionImpl.log.info("Session Cache Size: "
+ this.cache.size());
+
+ /*
+ * clear repository info
+ */
+
+ this.repositoryInfo.clear();
}
public PagingList<Document> getCheckedOutDocs(Folder folder,
@@ -233,10 +231,11 @@
ExtensionsData extension = null;
/* ask backend */
+ String repositoryId = this.getRepositoryId();
ObjectData od =
this.provider.getObjectService().getObject(
- this.repositoryId, objectId, filter,
- includeAllowableActions,
includeRelationships,
- renditionFilter, includePolicyIds,
includeAcl, extension);
+ repositoryId, objectId, filter,
includeAllowableActions,
+ includeRelationships, renditionFilter,
includePolicyIds,
+ includeAcl, extension);
/* determine type */
switch (od.getBaseTypeId()) {
@@ -274,9 +273,10 @@
public RepositoryInfo getRepositoryInfo() {
if (this.repositoryInfo == null) {
- RepositoryInfoData riData =
this.provider.getRepositoryService()
- .getRepositoryInfo(this.repositoryId,
null);
- this.repositoryInfo = new RepositoryInfoImpl(this,
riData);
+ /* get initial repository id from session parameter */
+ String repositoryId =
this.determineRepositoryId(this.parameters);
+ RepositoryInfoImpl rii = new RepositoryInfoImpl(this,
repositoryId);
+ this.repositoryInfo = rii;
}
return this.repositoryInfo;
}
@@ -288,8 +288,9 @@
rootFolder = (Folder) this.cache.getByPath("/");
} else {
String rootFolderId =
this.getRepositoryInfo().getRootFolderId();
+ String repositoryId = this.getRepositoryId();
ObjectData od =
this.provider.getObjectService().getObject(
- this.repositoryId, rootFolderId, null,
false,
+ repositoryId, rootFolderId, null, false,
IncludeRelationships.NONE, null, false,
false, null);
rootFolder = new PersistentFolderImpl(this, od);
this.cache.put(rootFolder);
@@ -331,9 +332,10 @@
}
public void generateTestData(Map<String, String> parameter) {
+ String repositoryId = this.getRepositoryId();
ObjectGenerator og = new ObjectGenerator(this.provider
.getObjectFactory(),
this.provider.getNavigationService(),
- this.provider.getObjectService(),
this.repositoryId);
+ this.provider.getObjectService(), repositoryId);
Folder rootFolder = null;
String documentTypeId = null;
String folderTypeId = null;
@@ -456,4 +458,8 @@
return this.cache;
}
+ public String getRepositoryId() {
+ return this.getRepositoryInfo().getId();
+ }
+
}
Modified:
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/RepositoryInfoImpl.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/RepositoryInfoImpl.java?rev=916652&r1=916651&r2=916652&view=diff
==============================================================================
---
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/RepositoryInfoImpl.java
(original)
+++
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/RepositoryInfoImpl.java
Fri Feb 26 11:58:40 2010
@@ -25,8 +25,9 @@
import org.apache.opencmis.client.api.repository.RepositoryCapabilities;
import org.apache.opencmis.client.api.repository.RepositoryInfo;
import
org.apache.opencmis.client.runtime.repository.RepositoryAclCapabilitiesImpl;
+import
org.apache.opencmis.client.runtime.repository.RepositoryCapabilitiesImpl;
import org.apache.opencmis.commons.enums.BaseObjectTypeIds;
-import org.apache.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.opencmis.commons.provider.RepositoryCapabilitiesData;
import org.apache.opencmis.commons.provider.RepositoryInfoData;
public class RepositoryInfoImpl implements RepositoryInfo, Serializable {
@@ -44,7 +45,7 @@
/*
* session (serializable)
*/
- private PersistentSessionImpl session;
+ private PersistentSessionImpl session; // TODO is this required?
/*
* acl capabilities (serializable)
@@ -52,9 +53,21 @@
private RepositoryAclCapabilities aclCapabilites = null;
public RepositoryInfoImpl(PersistentSessionImpl session,
- RepositoryInfoData riData) {
- this.riData = riData;
+ String repositoryIdFromSession) {
this.session = session;
+ this.read(repositoryIdFromSession);
+ }
+
+ public void clear() {
+ String repositoryId = this.riData.getRepositoryId();
+ this.riData = null;
+ this.read(repositoryId);
+ }
+
+ private void read(String repositoryIdFromSession) {
+ this.riData = this.session.getProvider().getRepositoryService()
+ .getRepositoryInfo(repositoryIdFromSession,
null);
+
}
public boolean changesIncomplete() {
@@ -70,7 +83,9 @@
}
public RepositoryCapabilities getCapabilities() {
- throw new CmisRuntimeException("not implemented");
+ RepositoryCapabilitiesData rcd = this.riData
+ .getRepositoryCapabilities();
+ return new RepositoryCapabilitiesImpl(rcd);
}
public List<BaseObjectTypeIds> getChangesOnType() {
@@ -118,7 +133,7 @@
}
public String getThinClientUri() {
- return this.riData.getThinClientUri();
+ return this.riData.getThinClientUri();
}
public String getVendorName() {
Added:
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryCapabilitiesImpl.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryCapabilitiesImpl.java?rev=916652&view=auto
==============================================================================
---
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryCapabilitiesImpl.java
(added)
+++
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryCapabilitiesImpl.java
Fri Feb 26 11:58:40 2010
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.opencmis.client.runtime.repository;
+
+import org.apache.opencmis.client.api.repository.RepositoryCapabilities;
+import org.apache.opencmis.commons.enums.CapabilityAcl;
+import org.apache.opencmis.commons.enums.CapabilityChanges;
+import org.apache.opencmis.commons.enums.CapabilityContentStreamUpdates;
+import org.apache.opencmis.commons.enums.CapabilityJoin;
+import org.apache.opencmis.commons.enums.CapabilityQuery;
+import org.apache.opencmis.commons.enums.CapabilityRendition;
+import org.apache.opencmis.commons.provider.RepositoryCapabilitiesData;
+
+public class RepositoryCapabilitiesImpl implements RepositoryCapabilities {
+
+ private RepositoryCapabilitiesData capabilities = null;
+
+ public RepositoryCapabilitiesImpl(RepositoryCapabilitiesData rcd) {
+ this.capabilities = rcd;
+ }
+
+ public CapabilityAcl getAclSupport() {
+ return this.capabilities.getCapabilityAcl();
+ }
+
+ public CapabilityChanges getChangesSupport() {
+ return this.capabilities.getCapabilityChanges();
+ }
+
+ public CapabilityContentStreamUpdates
getContentStreamUpdatabilitySupport() {
+ return
this.capabilities.getCapabilityContentStreamUpdatability();
+ }
+
+ public CapabilityJoin getJoinSupport() {
+ return this.capabilities.getCapabilityJoin();
+ }
+
+ public CapabilityQuery getQuerySupport() {
+ return this.capabilities.getCapabilityQuery();
+ }
+
+ public CapabilityRendition getRenditionsSupport() {
+ return this.capabilities.getCapabilityRenditions();
+ }
+
+ public boolean isAllVersionsSearchableSupported() {
+ return this.capabilities.allVersionsSearchable();
+ }
+
+ public boolean isGetDescendantsSupported() {
+ return this.capabilities.supportsGetDescendants();
+ }
+
+ public boolean isGetFolderTreeSupported() {
+ return this.capabilities.supportsGetFolderTree();
+ }
+
+ public boolean isMultifilingSupported() {
+ return this.capabilities.supportsMultifiling();
+ }
+
+ public boolean isPwcSearchableSupported() {
+ return this.capabilities.isPwcSearchable();
+ }
+
+ public boolean isPwcUpdatableSupported() {
+ return this.capabilities.isPwcUpdatable();
+ }
+
+ public boolean isUnfilingSupported() {
+ return this.capabilities.supportsUnfiling();
+ }
+
+ public boolean isVersionSpecificFilingSupported() {
+ return this.capabilities.supportsVersionSpecificFiling();
+ }
+
+}
Propchange:
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryCapabilitiesImpl.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified:
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyRepositoryInfoTest.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyRepositoryInfoTest.java?rev=916652&r1=916651&r2=916652&view=diff
==============================================================================
---
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyRepositoryInfoTest.java
(original)
+++
incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyRepositoryInfoTest.java
Fri Feb 26 11:58:40 2010
@@ -116,8 +116,8 @@
public void thinClientUri() {
RepositoryInfo r = this.session.getRepositoryInfo();
Assert.assertNotNull(r);
- Assert.assertNotNull(r.getThinClientUri());
- this.log.info("getThinClientUri = " + r.getThinClientUri());
+ String uri = r.getThinClientUri();
+ this.log.info("getThinClientUri = " + uri);
}
@Test
@@ -164,28 +164,6 @@
case ALL:
case OBJECTIDSONLY:
case PROPERTIES:
- PagingList<ChangeEvent> cep = this.session.getContentChanges(null, -1);
- Assert.assertNotNull(cep);
- for (List<ChangeEvent> le : cep) {
- for (ChangeEvent ce : le) {
- TypeOfChanges toc = ce.getChangeType();
- Assert.assertNotNull(toc);
- switch (toc) {
- case CREATED:
- case DELETED:
- case SECURITY:
- case UPDATED:
- break;
- default:
- Assert.fail("change type not supported: " + toc);
- }
- List<Property<?>> pl = ce.getNewProperties();
- Assert.assertNotNull(pl);
- String id = ce.getObjectId();
- Assert.assertNotNull(id);
- }
- }
- break;
case NONE:
break;
default:
@@ -254,11 +232,8 @@
case BOTHSEPARATE:
case FULLTEXTONLY:
case METADATAONLY:
- PagingList<CmisObject> resultSet = this.session.query(Fixture.QUERY,
false, -1);
- Assert.assertNotNull(resultSet);
- Assert.assertFalse(resultSet.isEmpty());
- break;
case NONE:
+ break;
default:
Assert.fail("enumeration not supported: " + capq);
}