chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dcaru...@apache.org
Subject svn commit: r910572 [22/36] - in /incubator/chemistry/trunk/opencmis: ./ _dev/ opencmis-client/ opencmis-client/opencmis-client-api/ opencmis-client/opencmis-client-api/src/ opencmis-client/opencmis-client-api/src/main/ opencmis-client/opencmis-client-...
Date Tue, 16 Feb 2010 16:04:07 GMT
Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/NavigationService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/NavigationService.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/NavigationService.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/NavigationService.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,167 @@
+/*
+ * 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.fileshare;
+
+import java.math.BigInteger;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.opencmis.commons.api.ExtensionsData;
+import org.apache.opencmis.commons.enums.IncludeRelationships;
+import org.apache.opencmis.commons.impl.dataobjects.ObjectListImpl;
+import org.apache.opencmis.commons.provider.ObjectData;
+import org.apache.opencmis.commons.provider.ObjectInFolderContainer;
+import org.apache.opencmis.commons.provider.ObjectInFolderList;
+import org.apache.opencmis.commons.provider.ObjectList;
+import org.apache.opencmis.commons.provider.ObjectParentData;
+import org.apache.opencmis.server.spi.CallContext;
+import org.apache.opencmis.server.spi.CmisNavigationService;
+import org.apache.opencmis.server.spi.ObjectInfoHolder;
+
+/**
+ * Navigation Service.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class NavigationService implements CmisNavigationService {
+
+  private RepositoryMap fRepositoryMap;
+
+  /**
+   * Constructor.
+   */
+  public NavigationService(RepositoryMap repositoryMap) {
+    fRepositoryMap = repositoryMap;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisNavigationService#getCheckedOutDocs(org.apache.opencmis.server.spi.CallContext
+   * , java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
+   * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.math.BigInteger,
+   * java.math.BigInteger, org.apache.opencmis.commons.api.ExtensionsData,
+   * org.apache.opencmis.server.spi.ObjectInfoHolder)
+   */
+  public ObjectList getCheckedOutDocs(CallContext context, String repositoryId, String folderId,
+      String filter, String orderBy, Boolean includeAllowableActions,
+      IncludeRelationships includeRelationships, String renditionFilter, BigInteger maxItems,
+      BigInteger skipCount, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+    fRepositoryMap.getAuthenticatedRepository(context, repositoryId);
+
+    ObjectListImpl result = new ObjectListImpl();
+    result.setHasMoreItems(false);
+    result.setNumItems(BigInteger.ZERO);
+    List<ObjectData> emptyList = Collections.emptyList();
+    result.setObjects(emptyList);
+
+    return result;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisNavigationService#getChildren(org.apache.opencmis.server.spi.CallContext,
+   * java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
+   * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean,
+   * java.math.BigInteger, java.math.BigInteger, org.apache.opencmis.commons.api.ExtensionsData,
+   * org.apache.opencmis.server.spi.ObjectInfoHolder)
+   */
+  public ObjectInFolderList getChildren(CallContext context, String repositoryId, String folderId,
+      String filter, String orderBy, Boolean includeAllowableActions,
+      IncludeRelationships includeRelationships, String renditionFilter,
+      Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount,
+      ExtensionsData extension, ObjectInfoHolder objectInfos) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getChildren(context,
+        folderId, renditionFilter, includeAllowableActions, includePathSegment, maxItems,
+        skipCount, objectInfos);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisNavigationService#getDescendants(org.apache.opencmis.server.spi.CallContext
+   * , java.lang.String, java.lang.String, java.math.BigInteger, java.lang.String,
+   * java.lang.Boolean, org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+   * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
+   * org.apache.opencmis.server.spi.ObjectInfoHolder)
+   */
+  public List<ObjectInFolderContainer> getDescendants(CallContext context, String repositoryId,
+      String folderId, BigInteger depth, String filter, Boolean includeAllowableActions,
+      IncludeRelationships includeRelationships, String renditionFilter,
+      Boolean includePathSegment, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getDescendants(context,
+        folderId, depth, filter, includeAllowableActions, includePathSegment, objectInfos, false);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisNavigationService#getFolderParent(org.apache.opencmis.server.spi.CallContext
+   * , java.lang.String, java.lang.String, java.lang.String,
+   * org.apache.opencmis.commons.api.ExtensionsData, org.apache.opencmis.server.spi.ObjectInfoHolder)
+   */
+  public ObjectData getFolderParent(CallContext context, String repositoryId, String folderId,
+      String filter, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getFolderParent(
+        context, folderId, filter, objectInfos);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisNavigationService#getFolderTree(org.apache.opencmis.server.spi.CallContext
+   * , java.lang.String, java.lang.String, java.math.BigInteger, java.lang.String,
+   * java.lang.Boolean, org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+   * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
+   * org.apache.opencmis.server.spi.ObjectInfoHolder)
+   */
+  public List<ObjectInFolderContainer> getFolderTree(CallContext context, String repositoryId,
+      String folderId, BigInteger depth, String filter, Boolean includeAllowableActions,
+      IncludeRelationships includeRelationships, String renditionFilter,
+      Boolean includePathSegment, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getDescendants(context,
+        folderId, depth, filter, includeAllowableActions, includePathSegment, objectInfos, true);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisNavigationService#getObjectParents(org.apache.opencmis.server.spi.CallContext
+   * , java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
+   * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean,
+   * org.apache.opencmis.commons.api.ExtensionsData, org.apache.opencmis.server.spi.ObjectInfoHolder)
+   */
+  public List<ObjectParentData> getObjectParents(CallContext context, String repositoryId,
+      String objectId, String filter, Boolean includeAllowableActions,
+      IncludeRelationships includeRelationships, String renditionFilter,
+      Boolean includeRelativePathSegment, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId)
+        .getObjectParents(context, objectId, filter, includeAllowableActions,
+            includeRelativePathSegment, objectInfos);
+  }
+
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/NavigationService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/ObjectService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/ObjectService.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/ObjectService.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/ObjectService.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,341 @@
+/*
+ * 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.fileshare;
+
+import java.math.BigInteger;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.opencmis.commons.api.ExtensionsData;
+import org.apache.opencmis.commons.enums.IncludeRelationships;
+import org.apache.opencmis.commons.enums.UnfileObjects;
+import org.apache.opencmis.commons.enums.VersioningState;
+import org.apache.opencmis.commons.exceptions.CmisNotSupportedException;
+import org.apache.opencmis.commons.provider.AccessControlList;
+import org.apache.opencmis.commons.provider.AllowableActionsData;
+import org.apache.opencmis.commons.provider.ContentStreamData;
+import org.apache.opencmis.commons.provider.FailedToDeleteData;
+import org.apache.opencmis.commons.provider.Holder;
+import org.apache.opencmis.commons.provider.ObjectData;
+import org.apache.opencmis.commons.provider.PropertiesData;
+import org.apache.opencmis.commons.provider.RenditionData;
+import org.apache.opencmis.server.spi.CallContext;
+import org.apache.opencmis.server.spi.CmisObjectService;
+import org.apache.opencmis.server.spi.ObjectInfoHolder;
+
+/**
+ * Object Service.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class ObjectService implements CmisObjectService {
+
+  private RepositoryMap fRepositoryMap;
+
+  /**
+   * Constructor.
+   */
+  public ObjectService(RepositoryMap repositoryMap) {
+    fRepositoryMap = repositoryMap;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.server.spi.CmisObjectService#create(org.apache.opencmis.server.spi.CallContext,
+   * java.lang.String, org.apache.opencmis.commons.provider.PropertiesData, java.lang.String,
+   * org.apache.opencmis.commons.provider.ContentStreamData, org.apache.opencmis.commons.enums.VersioningState,
+   * java.util.List, org.apache.opencmis.commons.api.ExtensionsData,
+   * org.apache.opencmis.server.spi.ObjectInfoHolder)
+   */
+  public ObjectData create(CallContext context, String repositoryId, PropertiesData properties,
+      String folderId, ContentStreamData contentStream, VersioningState versioningState,
+      List<String> policies, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).create(context,
+        properties, folderId, contentStream, versioningState, objectInfos);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisObjectService#createDocument(org.apache.opencmis.server.spi.CallContext,
+   * java.lang.String, org.apache.opencmis.commons.provider.PropertiesData, java.lang.String,
+   * org.apache.opencmis.commons.provider.ContentStreamData, org.apache.opencmis.commons.enums.VersioningState,
+   * java.util.List, org.apache.opencmis.commons.provider.AccessControlList,
+   * org.apache.opencmis.commons.provider.AccessControlList, org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public String createDocument(CallContext context, String repositoryId, PropertiesData properties,
+      String folderId, ContentStreamData contentStream, VersioningState versioningState,
+      List<String> policies, AccessControlList addAces, AccessControlList removeAces,
+      ExtensionsData extension) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).createDocument(context,
+        properties, folderId, contentStream, versioningState);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisObjectService#createDocumentFromSource(org.apache.opencmis.server.spi.
+   * CallContext, java.lang.String, java.lang.String, org.apache.opencmis.commons.provider.PropertiesData,
+   * java.lang.String, org.apache.opencmis.commons.enums.VersioningState, java.util.List,
+   * org.apache.opencmis.commons.provider.AccessControlList,
+   * org.apache.opencmis.commons.provider.AccessControlList, org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public String createDocumentFromSource(CallContext context, String repositoryId, String sourceId,
+      PropertiesData properties, String folderId, VersioningState versioningState,
+      List<String> policies, AccessControlList addAces, AccessControlList removeAces,
+      ExtensionsData extension) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId)
+        .createDocumentFromSource(context, sourceId, properties, folderId, versioningState);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisObjectService#createFolder(org.apache.opencmis.server.spi.CallContext,
+   * java.lang.String, org.apache.opencmis.commons.provider.PropertiesData, java.lang.String,
+   * java.util.List, org.apache.opencmis.commons.provider.AccessControlList,
+   * org.apache.opencmis.commons.provider.AccessControlList, org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public String createFolder(CallContext context, String repositoryId, PropertiesData properties,
+      String folderId, List<String> policies, AccessControlList addAces,
+      AccessControlList removeAces, ExtensionsData extension) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).createFolder(context,
+        properties, folderId);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisObjectService#createPolicy(org.apache.opencmis.server.spi.CallContext,
+   * java.lang.String, org.apache.opencmis.commons.provider.PropertiesData, java.lang.String,
+   * java.util.List, org.apache.opencmis.commons.provider.AccessControlList,
+   * org.apache.opencmis.commons.provider.AccessControlList, org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public String createPolicy(CallContext context, String repositoryId, PropertiesData properties,
+      String folderId, List<String> policies, AccessControlList addAces,
+      AccessControlList removeAces, ExtensionsData extension) {
+    fRepositoryMap.getAuthenticatedRepository(context, repositoryId);
+    throw new CmisNotSupportedException("createPolicy not supported!");
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisObjectService#createRelationship(org.apache.opencmis.server.spi.CallContext
+   * , java.lang.String, org.apache.opencmis.commons.provider.PropertiesData, java.util.List,
+   * org.apache.opencmis.commons.provider.AccessControlList,
+   * org.apache.opencmis.commons.provider.AccessControlList, org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public String createRelationship(CallContext context, String repositoryId,
+      PropertiesData properties, List<String> policies, AccessControlList addAces,
+      AccessControlList removeAces, ExtensionsData extension) {
+    fRepositoryMap.getAuthenticatedRepository(context, repositoryId);
+    throw new CmisNotSupportedException("createRelationship not supported!");
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisObjectService#deleteContentStream(org.apache.opencmis.server.spi.CallContext
+   * , java.lang.String, org.apache.opencmis.commons.provider.Holder, org.apache.opencmis.commons.provider.Holder,
+   * org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public void deleteContentStream(CallContext context, String repositoryId,
+      Holder<String> objectId, Holder<String> changeToken, ExtensionsData extension) {
+    fRepositoryMap.getAuthenticatedRepository(context, repositoryId).setContentStream(context,
+        objectId, true, null);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisObjectService#deleteObjectOrCancelCheckOut(org.apache.opencmis.server.
+   * spi.CallContext, java.lang.String, java.lang.String, java.lang.Boolean,
+   * org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public void deleteObjectOrCancelCheckOut(CallContext context, String repositoryId,
+      String objectId, Boolean allVersions, ExtensionsData extension) {
+    fRepositoryMap.getAuthenticatedRepository(context, repositoryId)
+        .deleteObject(context, objectId);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.server.spi.CmisObjectService#deleteTree(org.apache.opencmis.server.spi.CallContext,
+   * java.lang.String, java.lang.String, java.lang.Boolean,
+   * org.apache.opencmis.commons.enums.UnfileObjects, java.lang.Boolean,
+   * org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public FailedToDeleteData deleteTree(CallContext context, String repositoryId, String folderId,
+      Boolean allVersions, UnfileObjects unfileObjects, Boolean continueOnFailure,
+      ExtensionsData extension) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).deleteTree(context,
+        folderId, continueOnFailure);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisObjectService#getAllowableActions(org.apache.opencmis.server.spi.CallContext
+   * , java.lang.String, java.lang.String, org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public AllowableActionsData getAllowableActions(CallContext context, String repositoryId,
+      String objectId, ExtensionsData extension) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getAllowableActions(
+        context, objectId);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisObjectService#getContentStream(org.apache.opencmis.server.spi.CallContext,
+   * java.lang.String, java.lang.String, java.lang.String, java.math.BigInteger,
+   * java.math.BigInteger, org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public ContentStreamData getContentStream(CallContext context, String repositoryId,
+      String objectId, String streamId, BigInteger offset, BigInteger length,
+      ExtensionsData extension) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getContentStream(
+        context, objectId, offset, length);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.server.spi.CmisObjectService#getObject(org.apache.opencmis.server.spi.CallContext,
+   * java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
+   * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean,
+   * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
+   * org.apache.opencmis.server.spi.ObjectInfoHolder)
+   */
+  public ObjectData getObject(CallContext context, String repositoryId, String objectId,
+      String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+      String renditionFilter, Boolean includePolicyIds, Boolean includeAcl,
+      ExtensionsData extension, ObjectInfoHolder objectInfos) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getObject(context,
+        objectId, filter, includeAllowableActions, includeAcl, objectInfos);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisObjectService#getObjectByPath(org.apache.opencmis.server.spi.CallContext,
+   * java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
+   * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean,
+   * java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
+   * org.apache.opencmis.server.spi.ObjectInfoHolder)
+   */
+  public ObjectData getObjectByPath(CallContext context, String repositoryId, String path,
+      String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+      String renditionFilter, Boolean includePolicyIds, Boolean includeAcl,
+      ExtensionsData extension, ObjectInfoHolder objectInfos) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getObjectByPath(
+        context, path, filter, includeAllowableActions, includeAcl, objectInfos);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisObjectService#getProperties(org.apache.opencmis.server.spi.CallContext,
+   * java.lang.String, java.lang.String, java.lang.String, org.apache.opencmis.commons.api.ExtensionsData,
+   * org.apache.opencmis.server.spi.ObjectInfoHolder)
+   */
+  public PropertiesData getProperties(CallContext context, String repositoryId, String objectId,
+      String filter, ExtensionsData extension) {
+    ObjectData object = fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getObject(
+        context, objectId, filter, false, false, null);
+    return object.getProperties();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisObjectService#getRenditions(org.apache.opencmis.server.spi.CallContext,
+   * java.lang.String, java.lang.String, java.lang.String, java.math.BigInteger,
+   * java.math.BigInteger, org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public List<RenditionData> getRenditions(CallContext context, String repositoryId,
+      String objectId, String renditionFilter, BigInteger maxItems, BigInteger skipCount,
+      ExtensionsData extension) {
+    fRepositoryMap.getAuthenticatedRepository(context, repositoryId);
+    return Collections.emptyList();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.server.spi.CmisObjectService#moveObject(org.apache.opencmis.server.spi.CallContext,
+   * java.lang.String, org.apache.opencmis.commons.provider.Holder, java.lang.String, java.lang.String,
+   * org.apache.opencmis.commons.api.ExtensionsData, org.apache.opencmis.server.spi.ObjectInfoHolder)
+   */
+  public ObjectData moveObject(CallContext context, String repositoryId, Holder<String> objectId,
+      String targetFolderId, String sourceFolderId, ExtensionsData extension,
+      ObjectInfoHolder objectInfos) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).moveObject(context,
+        objectId, targetFolderId, objectInfos);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisObjectService#setContentStream(org.apache.opencmis.server.spi.CallContext,
+   * java.lang.String, org.apache.opencmis.commons.provider.Holder, java.lang.Boolean,
+   * org.apache.opencmis.commons.provider.Holder, org.apache.opencmis.commons.provider.ContentStreamData,
+   * org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public void setContentStream(CallContext context, String repositoryId, Holder<String> objectId,
+      Boolean overwriteFlag, Holder<String> changeToken, ContentStreamData contentStream,
+      ExtensionsData extension) {
+    fRepositoryMap.getAuthenticatedRepository(context, repositoryId).setContentStream(context,
+        objectId, overwriteFlag, contentStream);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisObjectService#updateProperties(org.apache.opencmis.server.spi.CallContext,
+   * java.lang.String, org.apache.opencmis.commons.provider.Holder, org.apache.opencmis.commons.provider.Holder,
+   * org.apache.opencmis.commons.provider.PropertiesData, org.apache.opencmis.commons.provider.AccessControlList,
+   * org.apache.opencmis.commons.api.ExtensionsData, org.apache.opencmis.server.spi.ObjectInfoHolder)
+   */
+  public ObjectData updateProperties(CallContext context, String repositoryId,
+      Holder<String> objectId, Holder<String> changeToken, PropertiesData properties,
+      AccessControlList acl, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).updateProperties(
+        context, objectId, properties, objectInfos);
+  }
+
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/ObjectService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/RepositoryMap.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/RepositoryMap.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/RepositoryMap.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/RepositoryMap.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,111 @@
+/*
+ * 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.fileshare;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.opencmis.commons.exceptions.CmisObjectNotFoundException;
+import org.apache.opencmis.commons.exceptions.CmisPermissionDeniedException;
+import org.apache.opencmis.server.spi.CallContext;
+
+/**
+ * Repository map.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class RepositoryMap {
+
+  private Map<String, FileShareRepository> fMap;
+  private Map<String, String> fLogins;
+
+  public RepositoryMap() {
+    fMap = new HashMap<String, FileShareRepository>();
+    fLogins = new HashMap<String, String>();
+  }
+
+  /**
+   * Adds a repository object.
+   */
+  public void addRepository(FileShareRepository fsr) {
+    if ((fsr == null) || (fsr.getRepositoryId() == null)) {
+      return;
+    }
+
+    fMap.put(fsr.getRepositoryId(), fsr);
+  }
+
+  /**
+   * Gets a repository object by id.
+   */
+  public FileShareRepository getRepository(String repositoryId) {
+    // get repository object
+    FileShareRepository result = fMap.get(repositoryId);
+    if (result == null) {
+      throw new CmisObjectNotFoundException("Unknown repository '" + repositoryId + "'!");
+    }
+
+    return result;
+  }
+
+  /**
+   * Gets a repository object by id.
+   */
+  public FileShareRepository getAuthenticatedRepository(CallContext context, String repositoryId) {
+    // check user and password first
+    if (!authenticate(context.getUsername(), context.getPassword())) {
+      throw new CmisPermissionDeniedException();
+    }
+
+    // get repository object
+    return getRepository(repositoryId);
+  }
+
+  /**
+   * Returns all repository objects.
+   */
+  public Collection<FileShareRepository> getRepositories() {
+    return fMap.values();
+  }
+
+  /**
+   * Adds a login.
+   */
+  public void addLogin(String username, String password) {
+    if ((username == null) || (password == null)) {
+      return;
+    }
+
+    fLogins.put(username.trim(), password);
+  }
+
+  /**
+   * Authenticates a user against the configured logins.
+   */
+  private boolean authenticate(String username, String password) {
+    String pwd = fLogins.get(username);
+    if (pwd == null) {
+      return false;
+    }
+
+    return pwd.equals(password);
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/RepositoryMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/RepositoryService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/RepositoryService.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/RepositoryService.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/RepositoryService.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,119 @@
+/*
+ * 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.fileshare;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.opencmis.commons.api.ExtensionsData;
+import org.apache.opencmis.commons.api.TypeDefinition;
+import org.apache.opencmis.commons.api.TypeDefinitionContainer;
+import org.apache.opencmis.commons.api.TypeDefinitionList;
+import org.apache.opencmis.commons.provider.RepositoryInfoData;
+import org.apache.opencmis.server.spi.CallContext;
+import org.apache.opencmis.server.spi.CmisRepositoryService;
+
+/**
+ * Repository Service.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class RepositoryService implements CmisRepositoryService {
+
+  private RepositoryMap fRepositoryMap;
+
+  /**
+   * Constructor.
+   */
+  public RepositoryService(RepositoryMap repositoryMap) {
+    fRepositoryMap = repositoryMap;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisRepositoryService#getRepositoryInfo(org.apache.opencmis.server.spi.CallContext
+   * , java.lang.String, org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public RepositoryInfoData getRepositoryInfo(CallContext context, String repositoryId,
+      ExtensionsData extension) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getRepositoryInfo(
+        context);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @seeorg.apache.opencmis.server.spi.CmisRepositoryService#getRepositoryInfos(org.apache.opencmis.server.spi.
+   * CallContext, org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public List<RepositoryInfoData> getRepositoryInfos(CallContext context, ExtensionsData extension) {
+    List<RepositoryInfoData> result = new ArrayList<RepositoryInfoData>();
+
+    for (FileShareRepository fsr : fRepositoryMap.getRepositories()) {
+      result.add(fsr.getRepositoryInfo(context));
+    }
+
+    return result;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisRepositoryService#getTypeChildren(org.apache.opencmis.server.spi.CallContext
+   * , java.lang.String, java.lang.String, java.lang.Boolean, java.math.BigInteger,
+   * java.math.BigInteger, org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public TypeDefinitionList getTypeChildren(CallContext context, String repositoryId,
+      String typeId, Boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount,
+      ExtensionsData extension) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getTypesChildren(
+        context, typeId, includePropertyDefinitions, maxItems, skipCount);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisRepositoryService#getTypeDefinition(org.apache.opencmis.server.spi.CallContext
+   * , java.lang.String, java.lang.String, org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public TypeDefinition getTypeDefinition(CallContext context, String repositoryId, String typeId,
+      ExtensionsData extension) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getTypeDefinition(
+        context, typeId);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @seeorg.apache.opencmis.server.spi.CmisRepositoryService#getTypeDescendants(org.apache.opencmis.server.spi.
+   * CallContext, java.lang.String, java.lang.String, java.math.BigInteger, java.lang.Boolean,
+   * org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public List<TypeDefinitionContainer> getTypeDescendants(CallContext context, String repositoryId,
+      String typeId, BigInteger depth, Boolean includePropertyDefinitions, ExtensionsData extension) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getTypesDescendants(
+        context, typeId, depth, includePropertyDefinitions);
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/RepositoryService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/ServicesFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/ServicesFactory.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/ServicesFactory.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/ServicesFactory.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,250 @@
+/*
+ * 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.fileshare;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.opencmis.commons.api.TypeDefinition;
+import org.apache.opencmis.commons.impl.Converter;
+import org.apache.opencmis.commons.impl.JaxBHelper;
+import org.apache.opencmis.commons.impl.jaxb.CmisTypeDefinitionType;
+import org.apache.opencmis.server.spi.AbstractServicesFactory;
+import org.apache.opencmis.server.spi.CmisAclService;
+import org.apache.opencmis.server.spi.CmisNavigationService;
+import org.apache.opencmis.server.spi.CmisObjectService;
+import org.apache.opencmis.server.spi.CmisRepositoryService;
+import org.apache.opencmis.server.spi.CmisVersioningService;
+
+/**
+ * Services Factory for file share back-end.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class ServicesFactory extends AbstractServicesFactory {
+
+  private static final String PREFIX_LOGIN = "login.";
+  private static final String PREFIX_REPOSITORY = "repository.";
+  private static final String PREFIX_TYPE = "type.";
+  private static final String SUFFIX_READWRITE = ".readwrite";
+  private static final String SUFFIX_READONLY = ".readonly";
+
+  private static final Log log = LogFactory.getLog(AbstractServicesFactory.class);
+
+  private RepositoryMap fRepositoryMap;
+  private TypeManager fTypeManager;
+
+  private RepositoryService fRepositoryService;
+  private NavigationService fNavigationService;
+  private ObjectService fObjectService;
+  private VersioningService fVersioningService;
+  private AclService fAclService;
+
+  public ServicesFactory() {
+  }
+
+  @Override
+  public void init(Map<String, String> parameters) {
+    fRepositoryMap = new RepositoryMap();
+    fTypeManager = new TypeManager();
+
+    readConfiguration(parameters);
+
+    fRepositoryService = new RepositoryService(fRepositoryMap);
+    fNavigationService = new NavigationService(fRepositoryMap);
+    fObjectService = new ObjectService(fRepositoryMap);
+    fVersioningService = new VersioningService(fRepositoryMap);
+    fAclService = new AclService(fRepositoryMap);
+  }
+
+  @Override
+  public CmisRepositoryService getRepositoryService() {
+    return fRepositoryService;
+  }
+
+  @Override
+  public CmisNavigationService getNavigationService() {
+    return fNavigationService;
+  }
+
+  @Override
+  public CmisObjectService getObjectService() {
+    return fObjectService;
+  }
+
+  @Override
+  public CmisVersioningService getVersioningService() {
+    return fVersioningService;
+  }
+
+  @Override
+  public CmisAclService getAclService() {
+    return fAclService;
+  }
+
+  // ---- helpers ----
+
+  private void readConfiguration(Map<String, String> parameters) {
+    List<String> keys = new ArrayList<String>(parameters.keySet());
+    Collections.sort(keys);
+
+    for (String key : keys) {
+      if (key.startsWith(PREFIX_LOGIN)) {
+        // get logins
+        String usernameAndPassword = replaceSystemProperties(parameters.get(key));
+        if (usernameAndPassword == null) {
+          continue;
+        }
+
+        String username = usernameAndPassword;
+        String password = "";
+
+        int x = usernameAndPassword.indexOf(':');
+        if (x > -1) {
+          username = usernameAndPassword.substring(0, x);
+          password = usernameAndPassword.substring(x + 1);
+        }
+
+        fRepositoryMap.addLogin(username, password);
+
+        log.info("Added login '" + username + "'.");
+      }
+      else if (key.startsWith(PREFIX_TYPE)) {
+        // load type definition
+        TypeDefinition type = loadType(replaceSystemProperties(parameters.get(key)));
+        if (type != null) {
+          fTypeManager.addType(type);
+        }
+      }
+      else if (key.startsWith(PREFIX_REPOSITORY)) {
+        // configure repositories
+        String repositoryId = key.substring(PREFIX_REPOSITORY.length()).trim();
+        int x = repositoryId.lastIndexOf('.');
+        if (x > 0) {
+          repositoryId = repositoryId.substring(0, x);
+        }
+
+        if (repositoryId.length() == 0) {
+          throw new IllegalArgumentException("No repository id!");
+        }
+
+        if (key.endsWith(SUFFIX_READWRITE)) {
+          // read-write users
+          FileShareRepository fsr = fRepositoryMap.getRepository(repositoryId);
+          for (String user : split(parameters.get(key))) {
+            fsr.addUser(replaceSystemProperties(user), false);
+          }
+        }
+        else if (key.endsWith(SUFFIX_READONLY)) {
+          // read-only users
+          FileShareRepository fsr = fRepositoryMap.getRepository(repositoryId);
+          for (String user : split(parameters.get(key))) {
+            fsr.addUser(replaceSystemProperties(user), true);
+          }
+        }
+        else {
+          // new repository
+          String root = replaceSystemProperties(parameters.get(key));
+          FileShareRepository fsr = new FileShareRepository(repositoryId, root, fTypeManager);
+
+          fRepositoryMap.addRepository(fsr);
+
+          log.info("Added repository '" + fsr.getRepositoryId() + "': " + root);
+        }
+      }
+    }
+  }
+
+  private List<String> split(String csl) {
+    if (csl == null) {
+      return Collections.emptyList();
+    }
+
+    List<String> result = new ArrayList<String>();
+    for (String s : csl.split(",")) {
+      result.add(s.trim());
+    }
+
+    return result;
+  }
+
+  private String replaceSystemProperties(String s) {
+    if (s == null) {
+      return null;
+    }
+
+    StringBuilder result = new StringBuilder();
+    StringBuilder property = null;
+    boolean inProperty = false;
+
+    for (int i = 0; i < s.length(); i++) {
+      char c = s.charAt(i);
+
+      if (inProperty) {
+        if (c == '}') {
+          String value = System.getProperty(property.toString());
+          if (value != null) {
+            result.append(value);
+          }
+          inProperty = false;
+        }
+        else {
+          property.append(c);
+        }
+      }
+      else {
+        if (c == '{') {
+          property = new StringBuilder();
+          inProperty = true;
+        }
+        else {
+          result.append(c);
+        }
+      }
+    }
+
+    return result.toString();
+  }
+
+  @SuppressWarnings("unchecked")
+  private TypeDefinition loadType(String filename) {
+    TypeDefinition result = null;
+
+    try {
+      Unmarshaller u = JaxBHelper.createUnmarshaller();
+      JAXBElement<CmisTypeDefinitionType> type = (JAXBElement<CmisTypeDefinitionType>) u
+          .unmarshal(new File(filename));
+      result = Converter.convert(type.getValue());
+    }
+    catch (Exception e) {
+      log.info("Could not load type: '" + filename + "'", e);
+    }
+
+    return result;
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/ServicesFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/TypeManager.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/TypeManager.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/TypeManager.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/TypeManager.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,562 @@
+/*
+ * 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.fileshare;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.opencmis.commons.PropertyIds;
+import org.apache.opencmis.commons.api.PropertyDefinition;
+import org.apache.opencmis.commons.api.TypeDefinition;
+import org.apache.opencmis.commons.api.TypeDefinitionContainer;
+import org.apache.opencmis.commons.api.TypeDefinitionList;
+import org.apache.opencmis.commons.enums.BaseObjectTypeIds;
+import org.apache.opencmis.commons.enums.Cardinality;
+import org.apache.opencmis.commons.enums.ContentStreamAllowed;
+import org.apache.opencmis.commons.enums.PropertyType;
+import org.apache.opencmis.commons.enums.Updatability;
+import org.apache.opencmis.commons.exceptions.CmisInvalidArgumentException;
+import org.apache.opencmis.commons.exceptions.CmisObjectNotFoundException;
+import org.apache.opencmis.commons.impl.Converter;
+import org.apache.opencmis.commons.impl.dataobjects.AbstractPropertyDefinition;
+import org.apache.opencmis.commons.impl.dataobjects.AbstractTypeDefinition;
+import org.apache.opencmis.commons.impl.dataobjects.DocumentTypeDefinitionImpl;
+import org.apache.opencmis.commons.impl.dataobjects.FolderTypeDefinitionImpl;
+import org.apache.opencmis.commons.impl.dataobjects.PolicyTypeDefinitionImpl;
+import org.apache.opencmis.commons.impl.dataobjects.PropertyBooleanDefinitionImpl;
+import org.apache.opencmis.commons.impl.dataobjects.PropertyDateTimeDefinitionImpl;
+import org.apache.opencmis.commons.impl.dataobjects.PropertyDecimalDefinitionImpl;
+import org.apache.opencmis.commons.impl.dataobjects.PropertyHtmlDefinitionImpl;
+import org.apache.opencmis.commons.impl.dataobjects.PropertyIdDefinitionImpl;
+import org.apache.opencmis.commons.impl.dataobjects.PropertyIntegerDefinitionImpl;
+import org.apache.opencmis.commons.impl.dataobjects.PropertyStringDefinitionImpl;
+import org.apache.opencmis.commons.impl.dataobjects.PropertyUriDefinitionImpl;
+import org.apache.opencmis.commons.impl.dataobjects.RelationshipTypeDefinitionImpl;
+import org.apache.opencmis.commons.impl.dataobjects.TypeDefinitionContainerImpl;
+import org.apache.opencmis.commons.impl.dataobjects.TypeDefinitionListImpl;
+import org.apache.opencmis.server.spi.CallContext;
+
+/**
+ * Type Manager.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class TypeManager {
+  public final static String DOCUMENT_TYPE_ID = "cmis:document";
+  public final static String FOLDER_TYPE_ID = "cmis:folder";
+  public final static String RELATIONSHIP_TYPE_ID = "cmis:relationship";
+  public final static String POLICY_TYPE_ID = "cmis:policy";
+
+  private static final String NAMESPACE = "http://opencmis.org/fileshare";
+
+  private static final Log log = LogFactory.getLog(TypeManager.class);
+
+  private Map<String, TypeDefinitionContainerImpl> fTypes;
+  private List<TypeDefinitionContainer> fTypesList;
+
+  public TypeManager() {
+    setup();
+  }
+
+  /**
+   * Creates the base types.
+   */
+  private void setup() {
+    fTypes = new HashMap<String, TypeDefinitionContainerImpl>();
+    fTypesList = new ArrayList<TypeDefinitionContainer>();
+
+    // folder type
+    FolderTypeDefinitionImpl folderType = new FolderTypeDefinitionImpl();
+    folderType.setBaseId(BaseObjectTypeIds.CMIS_FOLDER);
+    folderType.setIsControllableAcl(false);
+    folderType.setIsControllablePolicy(false);
+    folderType.setIsCreatable(true);
+    folderType.setDescription("Folder");
+    folderType.setDisplayName("Folder");
+    folderType.setIsFileable(true);
+    folderType.setIsFulltextIndexed(false);
+    folderType.setIsIncludedInSupertypeQuery(true);
+    folderType.setLocalName("Folder");
+    folderType.setLocalNamespace(NAMESPACE);
+    folderType.setIsQueryable(false);
+    folderType.setQueryName("cmis:folder");
+    folderType.setId(FOLDER_TYPE_ID);
+
+    addBasePropertyDefinitions(folderType);
+    addFolderPropertyDefinitions(folderType);
+
+    addTypeInteral(folderType);
+
+    // document type
+    DocumentTypeDefinitionImpl documentType = new DocumentTypeDefinitionImpl();
+    documentType.setBaseId(BaseObjectTypeIds.CMIS_DOCUMENT);
+    documentType.setIsControllableAcl(false);
+    documentType.setIsControllablePolicy(false);
+    documentType.setIsCreatable(true);
+    documentType.setDescription("Document");
+    documentType.setDisplayName("Document");
+    documentType.setIsFileable(true);
+    documentType.setIsFulltextIndexed(false);
+    documentType.setIsIncludedInSupertypeQuery(true);
+    documentType.setLocalName("Document");
+    documentType.setLocalNamespace(NAMESPACE);
+    documentType.setIsQueryable(false);
+    documentType.setQueryName("cmis:document");
+    documentType.setId(DOCUMENT_TYPE_ID);
+
+    documentType.setIsVersionable(false);
+    documentType.setContentStreamAllowed(ContentStreamAllowed.ALLOWED);
+
+    addBasePropertyDefinitions(documentType);
+    addDocumentPropertyDefinitions(documentType);
+
+    addTypeInteral(documentType);
+
+    // relationship types
+    RelationshipTypeDefinitionImpl relationshipType = new RelationshipTypeDefinitionImpl();
+    relationshipType.setBaseId(BaseObjectTypeIds.CMIS_RELATIONSHIP);
+    relationshipType.setIsControllableAcl(false);
+    relationshipType.setIsControllablePolicy(false);
+    relationshipType.setIsCreatable(false);
+    relationshipType.setDescription("Relationship");
+    relationshipType.setDisplayName("Relationship");
+    relationshipType.setIsFileable(false);
+    relationshipType.setIsIncludedInSupertypeQuery(true);
+    relationshipType.setLocalName("Relationship");
+    relationshipType.setLocalNamespace(NAMESPACE);
+    relationshipType.setIsQueryable(false);
+    relationshipType.setQueryName("cmis:relationship");
+    relationshipType.setId(RELATIONSHIP_TYPE_ID);
+
+    addBasePropertyDefinitions(relationshipType);
+
+    // not supported - don't expose it
+    // addTypeInteral(relationshipType);
+
+    // policy type
+    PolicyTypeDefinitionImpl policyType = new PolicyTypeDefinitionImpl();
+    policyType.setBaseId(BaseObjectTypeIds.CMIS_POLICY);
+    policyType.setIsControllableAcl(false);
+    policyType.setIsControllablePolicy(false);
+    policyType.setIsCreatable(false);
+    policyType.setDescription("Policy");
+    policyType.setDisplayName("Policy");
+    policyType.setIsFileable(false);
+    policyType.setIsIncludedInSupertypeQuery(true);
+    policyType.setLocalName("Policy");
+    policyType.setLocalNamespace(NAMESPACE);
+    policyType.setIsQueryable(false);
+    policyType.setQueryName("cmis:policy");
+    policyType.setId(POLICY_TYPE_ID);
+
+    addBasePropertyDefinitions(policyType);
+
+    // not supported - don't expose it
+    // addTypeInteral(policyType);
+  }
+
+  private void addBasePropertyDefinitions(AbstractTypeDefinition type) {
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_BASE_TYPE_ID, "Base Type Id",
+        "Base Type Id", PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, false, true));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_OBJECT_ID, "Object Id", "Object Id",
+        PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, false, true));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_OBJECT_TYPE_ID, "Type Id", "Type Id",
+        PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, false, true));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_NAME, "Name", "Name",
+        PropertyType.STRING, Cardinality.SINGLE, Updatability.READWRITE, false, true));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_CREATED_BY, "Created By",
+        "Created By", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, true));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_CREATION_DATE, "Creation Date",
+        "Creation Date", PropertyType.DATETIME, Cardinality.SINGLE, Updatability.READONLY, false,
+        true));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_LAST_MODIFIED_BY, "Last Modified By",
+        "Last Modified By", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false,
+        true));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_LAST_MODIFICATION_DATE,
+        "Last Modification Date", "Last Modification Date", PropertyType.DATETIME,
+        Cardinality.SINGLE, Updatability.READONLY, false, true));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_CHANGE_TOKEN, "Change Token",
+        "Change Token", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false,
+        false));
+  }
+
+  private void addFolderPropertyDefinitions(FolderTypeDefinitionImpl type) {
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_PARENT_ID, "Parent Id", "Parent Id",
+        PropertyType.ID, Cardinality.SINGLE, Updatability.READONLY, false, false));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_ALLOWED_CHILD_OBJECT_TYPE_IDS,
+        "Allowed Child Object Type Ids", "Allowed Child Object Type Ids", PropertyType.ID,
+        Cardinality.MULTI, Updatability.READONLY, false, false));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_PATH, "Path", "Path",
+        PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, false));
+  }
+
+  private void addDocumentPropertyDefinitions(DocumentTypeDefinitionImpl type) {
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_IS_IMMUTABLE, "Is Immutable",
+        "Is Immutable", PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, false,
+        false));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_IS_LATEST_VERSION,
+        "Is Latest Version", "Is Latest Version", PropertyType.BOOLEAN, Cardinality.SINGLE,
+        Updatability.READONLY, false, false));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_IS_MAJOR_VERSION, "Is Major Version",
+        "Is Major Version", PropertyType.BOOLEAN, Cardinality.SINGLE, Updatability.READONLY, false,
+        false));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_IS_LATEST_MAJOR_VERSION,
+        "Is Latest Major Version", "Is Latest Major Version", PropertyType.BOOLEAN,
+        Cardinality.SINGLE, Updatability.READONLY, false, false));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_VERSION_LABEL, "Version Label",
+        "Version Label", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false,
+        true));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_VERSION_SERIES_ID,
+        "Version Series Id", "Version Series Id", PropertyType.ID, Cardinality.SINGLE,
+        Updatability.READONLY, false, true));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_IS_VERSION_SERIES_CHECKED_OUT,
+        "Is Verison Series Checked Out", "Is Verison Series Checked Out", PropertyType.BOOLEAN,
+        Cardinality.SINGLE, Updatability.READONLY, false, true));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_VERSION_SERIES_CHECKED_OUT_ID,
+        "Version Series Checked Out Id", "Version Series Checked Out Id", PropertyType.ID,
+        Cardinality.SINGLE, Updatability.READONLY, false, false));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_CHECKIN_COMMENT, "Checkin Comment",
+        "Checkin Comment", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false,
+        false));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_CONTENT_STREAM_LENGTH,
+        "Content Stream Length", "Content Stream Length", PropertyType.INTEGER, Cardinality.SINGLE,
+        Updatability.READONLY, false, false));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_CONTENT_STREAM_MIME_TYPE,
+        "MIME Type", "MIME Type", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY,
+        false, false));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_CONTENT_STREAM_FILE_NAME, "Filename",
+        "Filename", PropertyType.STRING, Cardinality.SINGLE, Updatability.READONLY, false, false));
+
+    type.addPropertyDefinition(createPropDef(PropertyIds.CMIS_CONTENT_STREAM_ID,
+        "Content Stream Id", "Content Stream Id", PropertyType.ID, Cardinality.SINGLE,
+        Updatability.READONLY, false, false));
+  }
+
+  /**
+   * Creates a property definition object.
+   */
+  private PropertyDefinition<?> createPropDef(String id, String displayName, String description,
+      PropertyType datatype, Cardinality cardinality, Updatability updateability,
+      boolean inherited, boolean required) {
+    AbstractPropertyDefinition<?> result = null;
+
+    switch (datatype) {
+    case BOOLEAN:
+      result = new PropertyBooleanDefinitionImpl();
+      break;
+    case DATETIME:
+      result = new PropertyDateTimeDefinitionImpl();
+      break;
+    case DECIMAL:
+      result = new PropertyDecimalDefinitionImpl();
+      break;
+    case HTML:
+      result = new PropertyHtmlDefinitionImpl();
+      break;
+    case ID:
+      result = new PropertyIdDefinitionImpl();
+      break;
+    case INTEGER:
+      result = new PropertyIntegerDefinitionImpl();
+      break;
+    case STRING:
+      result = new PropertyStringDefinitionImpl();
+      break;
+    case URI:
+      result = new PropertyUriDefinitionImpl();
+      break;
+    default:
+      throw new RuntimeException("Unknown datatype! Spec change?");
+    }
+
+    result.setId(id);
+    result.setLocalName(id);
+    result.setDisplayName(displayName);
+    result.setDescription(description);
+    result.setPropertyType(datatype);
+    result.setCardinality(cardinality);
+    result.setUpdatability(updateability);
+    result.setIsInherited(inherited);
+    result.setIsRequired(required);
+    result.setIsQueryable(false);
+    result.setQueryName(id);
+
+    return result;
+  }
+
+  /**
+   * Adds a type to collection with inheriting base type properties.
+   */
+  public boolean addType(TypeDefinition type) {
+    if (type == null) {
+      return false;
+    }
+
+    if (type.getBaseId() == null) {
+      return false;
+    }
+
+    // find base type
+    TypeDefinition baseType = null;
+    if (type.getBaseId() == BaseObjectTypeIds.CMIS_DOCUMENT) {
+      baseType = copyTypeDefintion(fTypes.get(DOCUMENT_TYPE_ID).getTypeDefinition());
+    }
+    else if (type.getBaseId() == BaseObjectTypeIds.CMIS_FOLDER) {
+      baseType = copyTypeDefintion(fTypes.get(FOLDER_TYPE_ID).getTypeDefinition());
+    }
+    else if (type.getBaseId() == BaseObjectTypeIds.CMIS_RELATIONSHIP) {
+      baseType = copyTypeDefintion(fTypes.get(RELATIONSHIP_TYPE_ID).getTypeDefinition());
+    }
+    else if (type.getBaseId() == BaseObjectTypeIds.CMIS_POLICY) {
+      baseType = copyTypeDefintion(fTypes.get(POLICY_TYPE_ID).getTypeDefinition());
+    }
+    else {
+      return false;
+    }
+
+    AbstractTypeDefinition newType = (AbstractTypeDefinition) copyTypeDefintion(type);
+
+    // copy property definition
+    for (PropertyDefinition<?> propDef : baseType.getPropertyDefinitions().values()) {
+      ((AbstractPropertyDefinition<?>) propDef).setIsInherited(true);
+      newType.addPropertyDefinition(propDef);
+    }
+
+    // add it
+    addTypeInteral(newType);
+
+    log.info("Added type '" + newType.getId() + "'.");
+
+    return true;
+  }
+
+  /**
+   * Adds a type to collection.
+   */
+  private void addTypeInteral(AbstractTypeDefinition type) {
+    if (type == null) {
+      return;
+    }
+
+    if (fTypes.containsKey(type.getId())) {
+      // can't overwrite a type
+      return;
+    }
+
+    TypeDefinitionContainerImpl tc = new TypeDefinitionContainerImpl();
+    tc.setTypeDefinition(type);
+
+    // add to parent
+    if (type.getParentId() != null) {
+      TypeDefinitionContainerImpl tdc = fTypes.get(type.getParentId());
+      if (tdc != null) {
+        if (tdc.getChildren() == null) {
+          tdc.setChildren(new ArrayList<TypeDefinitionContainer>());
+        }
+        tdc.getChildren().add(tc);
+      }
+    }
+
+    fTypes.put(type.getId(), tc);
+    fTypesList.add(tc);
+  }
+
+  /**
+   * CMIS getTypesChildren.
+   */
+  public TypeDefinitionList getTypesChildren(CallContext context, String typeId,
+      boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount) {
+    TypeDefinitionListImpl result = new TypeDefinitionListImpl();
+    result.setList(new ArrayList<TypeDefinition>());
+    result.setHasMoreItems(false);
+    result.setNumItems(BigInteger.valueOf(0));
+
+    int skip = (skipCount == null ? 0 : skipCount.intValue());
+    if (skip < 0) {
+      skip = 0;
+    }
+
+    int max = (maxItems == null ? Integer.MAX_VALUE : maxItems.intValue());
+    if (max < 1) {
+      return result;
+    }
+
+    if (typeId == null) {
+      if (skip < 1) {
+        result.getList().add(copyTypeDefintion(fTypes.get(FOLDER_TYPE_ID).getTypeDefinition()));
+        max--;
+      }
+      if ((skip < 2) && (max > 0)) {
+        result.getList().add(copyTypeDefintion(fTypes.get(DOCUMENT_TYPE_ID).getTypeDefinition()));
+        max--;
+      }
+
+      result.setHasMoreItems((result.getList().size() + skip) < 2);
+      result.setNumItems(BigInteger.valueOf(2));
+    }
+    else {
+      TypeDefinitionContainer tc = fTypes.get(typeId);
+      if ((tc == null) || (tc.getChildren() == null)) {
+        return result;
+      }
+
+      for (TypeDefinitionContainer child : tc.getChildren()) {
+        if (skip > 0) {
+          skip--;
+          continue;
+        }
+
+        result.getList().add(copyTypeDefintion(child.getTypeDefinition()));
+
+        max--;
+        if (max == 0) {
+          break;
+        }
+      }
+
+      result.setHasMoreItems((result.getList().size() + skip) < tc.getChildren().size());
+      result.setNumItems(BigInteger.valueOf(tc.getChildren().size()));
+    }
+
+    if (!includePropertyDefinitions) {
+      for (TypeDefinition type : result.getList()) {
+        type.getPropertyDefinitions().clear();
+      }
+    }
+
+    return result;
+  }
+
+  /**
+   * CMIS getTypesDescendants.
+   */
+  public List<TypeDefinitionContainer> getTypesDescendants(CallContext context, String typeId,
+      BigInteger depth, Boolean includePropertyDefinitions) {
+    List<TypeDefinitionContainer> result = new ArrayList<TypeDefinitionContainer>();
+
+    // check depth
+    int d = (depth == null ? -1 : depth.intValue());
+    if (d == 0) {
+      throw new CmisInvalidArgumentException("Depth must not be 0!");
+    }
+
+    // set property definition flag to default value if not set
+    boolean ipd = (includePropertyDefinitions == null ? false : includePropertyDefinitions
+        .booleanValue());
+
+    if (typeId == null) {
+      result.add(getTypesDescendants(d, fTypes.get(FOLDER_TYPE_ID), ipd));
+      result.add(getTypesDescendants(d, fTypes.get(DOCUMENT_TYPE_ID), ipd));
+      // result.add(getTypesDescendants(depth,
+      // fTypes.get(RELATIONSHIP_TYPE_ID), includePropertyDefinitions));
+      // result.add(getTypesDescendants(depth, fTypes.get(POLICY_TYPE_ID),
+      // includePropertyDefinitions));
+    }
+    else {
+      TypeDefinitionContainer tc = fTypes.get(typeId);
+      if (tc != null) {
+        result.add(getTypesDescendants(d, tc, ipd));
+      }
+    }
+
+    return result;
+  }
+
+  /**
+   * Gathers the type descendants tree.
+   */
+  private TypeDefinitionContainer getTypesDescendants(int depth, TypeDefinitionContainer tc,
+      boolean includePropertyDefinitions) {
+    TypeDefinitionContainerImpl result = new TypeDefinitionContainerImpl();
+
+    TypeDefinition type = copyTypeDefintion(tc.getTypeDefinition());
+    if (!includePropertyDefinitions) {
+      type.getPropertyDefinitions().clear();
+    }
+
+    result.setTypeDefinition(type);
+
+    if (depth != 0) {
+      if (tc.getChildren() != null) {
+        result.setChildren(new ArrayList<TypeDefinitionContainer>());
+        for (TypeDefinitionContainer tdc : tc.getChildren()) {
+          result.getChildren().add(
+              getTypesDescendants(depth < 0 ? -1 : depth - 1, tdc, includePropertyDefinitions));
+        }
+      }
+    }
+
+    return result;
+  }
+
+  /**
+   * For internal use.
+   */
+  public TypeDefinition getType(String typeId) {
+    TypeDefinitionContainer tc = fTypes.get(typeId);
+    if (tc == null) {
+      return null;
+    }
+
+    return tc.getTypeDefinition();
+  }
+
+  /**
+   * CMIS getTypeDefinition.
+   */
+  public TypeDefinition getTypeDefinition(CallContext context, String typeId) {
+    TypeDefinitionContainer tc = fTypes.get(typeId);
+    if (tc == null) {
+      throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!");
+    }
+
+    return copyTypeDefintion(tc.getTypeDefinition());
+  }
+
+  private TypeDefinition copyTypeDefintion(TypeDefinition type) {
+    return Converter.convert(Converter.convert(type));
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/TypeManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/VersioningService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/VersioningService.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/VersioningService.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/VersioningService.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,146 @@
+/*
+ * 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.fileshare;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.opencmis.commons.api.ExtensionsData;
+import org.apache.opencmis.commons.enums.IncludeRelationships;
+import org.apache.opencmis.commons.exceptions.CmisNotSupportedException;
+import org.apache.opencmis.commons.provider.AccessControlList;
+import org.apache.opencmis.commons.provider.ContentStreamData;
+import org.apache.opencmis.commons.provider.Holder;
+import org.apache.opencmis.commons.provider.ObjectData;
+import org.apache.opencmis.commons.provider.PropertiesData;
+import org.apache.opencmis.server.spi.CallContext;
+import org.apache.opencmis.server.spi.CmisVersioningService;
+import org.apache.opencmis.server.spi.ObjectInfoHolder;
+
+/**
+ * Versioning Service.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class VersioningService implements CmisVersioningService {
+
+  private RepositoryMap fRepositoryMap;
+
+  /**
+   * Constructor.
+   */
+  public VersioningService(RepositoryMap repositoryMap) {
+    fRepositoryMap = repositoryMap;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisVersioningService#cancelCheckOut(org.apache.opencmis.server.spi.CallContext
+   * , java.lang.String, java.lang.String, org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public void cancelCheckOut(CallContext context, String repositoryId, String objectId,
+      ExtensionsData extension) {
+    throw new CmisNotSupportedException("cancelCheckOut not supported!");
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.server.spi.CmisVersioningService#checkIn(org.apache.opencmis.server.spi.CallContext,
+   * java.lang.String, org.apache.opencmis.commons.provider.Holder, java.lang.Boolean,
+   * org.apache.opencmis.commons.provider.PropertiesData, org.apache.opencmis.commons.provider.ContentStreamData,
+   * java.lang.String, java.util.List, org.apache.opencmis.commons.provider.AccessControlList,
+   * org.apache.opencmis.commons.provider.AccessControlList, org.apache.opencmis.commons.api.ExtensionsData,
+   * org.apache.opencmis.server.spi.ObjectInfoHolder)
+   */
+  public ObjectData checkIn(CallContext context, String repositoryId, Holder<String> objectId,
+      Boolean major, PropertiesData properties, ContentStreamData contentStream,
+      String checkinComment, List<String> policies, AccessControlList addAces,
+      AccessControlList removeAces, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+    throw new CmisNotSupportedException("checkIn not supported!");
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisVersioningService#checkOut(org.apache.opencmis.server.spi.CallContext,
+   * java.lang.String, org.apache.opencmis.commons.provider.Holder,
+   * org.apache.opencmis.commons.api.ExtensionsData, org.apache.opencmis.commons.provider.Holder,
+   * org.apache.opencmis.server.spi.ObjectInfoHolder)
+   */
+  public ObjectData checkOut(CallContext context, String repositoryId, Holder<String> objectId,
+      ExtensionsData extension, Holder<Boolean> contentCopied, ObjectInfoHolder objectInfos) {
+    throw new CmisNotSupportedException("checkOut not supported!");
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisVersioningService#getAllVersions(org.apache.opencmis.server.spi.CallContext
+   * , java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
+   * org.apache.opencmis.commons.api.ExtensionsData, org.apache.opencmis.server.spi.ObjectInfoHolder)
+   */
+  public List<ObjectData> getAllVersions(CallContext context, String repositoryId,
+      String versionSeriesId, String filter, Boolean includeAllowableActions,
+      ExtensionsData extension, ObjectInfoHolder objectInfos) {
+    ObjectData theVersion = fRepositoryMap.getAuthenticatedRepository(context, repositoryId)
+        .getObject(context, versionSeriesId, filter, includeAllowableActions, false, objectInfos);
+
+    return Collections.singletonList(theVersion);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisVersioningService#getObjectOfLatestVersion(org.apache.opencmis.server.
+   * spi.CallContext, java.lang.String, java.lang.String, java.lang.Boolean, java.lang.String,
+   * java.lang.Boolean, org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+   * java.lang.Boolean, java.lang.Boolean, org.apache.opencmis.commons.api.ExtensionsData,
+   * org.apache.opencmis.server.spi.ObjectInfoHolder)
+   */
+  public ObjectData getObjectOfLatestVersion(CallContext context, String repositoryId,
+      String versionSeriesId, Boolean major, String filter, Boolean includeAllowableActions,
+      IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
+      Boolean includeAcl, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+    return fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getObject(context,
+        versionSeriesId, filter, includeAllowableActions, includeAcl, objectInfos);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.server.spi.CmisVersioningService#getPropertiesOfLatestVersion(org.apache.opencmis.server
+   * .spi.CallContext, java.lang.String, java.lang.String, java.lang.Boolean, java.lang.String,
+   * org.apache.opencmis.commons.api.ExtensionsData, org.apache.opencmis.server.spi.ObjectInfoHolder)
+   */
+  public PropertiesData getPropertiesOfLatestVersion(CallContext context, String repositoryId,
+      String versionSeriesId, Boolean major, String filter, ExtensionsData extension) {
+    ObjectData object = fRepositoryMap.getAuthenticatedRepository(context, repositoryId).getObject(
+        context, versionSeriesId, filter, false, false, null);
+
+    return object.getProperties();
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/VersioningService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/resources/example-type.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/resources/example-type.xml?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/resources/example-type.xml (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/resources/example-type.xml Tue Feb 16 16:03:38 2010
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<cmisra:type xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/"
+	xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	xsi:type="cmis:cmisTypeDocumentDefinitionType">
+	<cmis:id>myTestDocumentType</cmis:id>
+	<cmis:localName>myTestDocumentType</cmis:localName>
+	<cmis:localNamespace>http://opencmis.org/demo/</cmis:localNamespace>
+	<cmis:parentId>cmis:document</cmis:parentId>
+	<cmis:displayName>My Test Document Type</cmis:displayName>
+	<cmis:queryName>TESTDOCTYPE</cmis:queryName>
+	<cmis:description>My Test Document Type</cmis:description>
+	<cmis:baseId>cmis:document</cmis:baseId>
+	<cmis:creatable>true</cmis:creatable>
+	<cmis:fileable>true</cmis:fileable>
+	<cmis:queryable>false</cmis:queryable>
+	<cmis:fulltextindexed>false</cmis:fulltextindexed>
+	<cmis:includedInSupertypeQuery>true</cmis:includedInSupertypeQuery>
+	<cmis:controllablePolicy>false</cmis:controllablePolicy>
+	<cmis:controllableACL>false</cmis:controllableACL>
+	<cmis:versionable>false</cmis:versionable>
+	<cmis:contentStreamAllowed>required</cmis:contentStreamAllowed>
+	<cmis:propertyStringDefinition>
+		<cmis:id>testProperty</cmis:id>
+		<cmis:localName>testProperty</cmis:localName>
+		<cmis:displayName>A test property</cmis:displayName>
+		<cmis:queryName>testProperty</cmis:queryName>
+		<cmis:description>Just a string</cmis:description>
+		<cmis:propertyType>string</cmis:propertyType>
+		<cmis:cardinality>single</cmis:cardinality>
+		<cmis:updatability>readwrite</cmis:updatability>
+		<cmis:inherited>false</cmis:inherited>
+		<cmis:required>false</cmis:required>
+		<cmis:queryable>false</cmis:queryable>
+		<cmis:orderable>false</cmis:orderable>
+	</cmis:propertyStringDefinition>
+	<cmis:propertyStringDefinition>
+		<cmis:id>testProperty2</cmis:id>
+		<cmis:localName>testProperty2</cmis:localName>
+		<cmis:displayName>Another test property</cmis:displayName>
+		<cmis:queryName>testProperty2</cmis:queryName>
+		<cmis:description>Another string</cmis:description>
+		<cmis:propertyType>string</cmis:propertyType>
+		<cmis:cardinality>single</cmis:cardinality>
+		<cmis:updatability>readwrite</cmis:updatability>
+		<cmis:inherited>false</cmis:inherited>
+		<cmis:required>true</cmis:required>
+		<cmis:queryable>false</cmis:queryable>
+		<cmis:orderable>false</cmis:orderable>
+		<cmis:defaultValue>
+			<cmis:value>default value</cmis:value>
+		</cmis:defaultValue>
+	</cmis:propertyStringDefinition>			
+</cmisra:type>

Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/resources/example-type.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/webapp/WEB-INF/classes/repository.properties
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/webapp/WEB-INF/classes/repository.properties?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/webapp/WEB-INF/classes/repository.properties (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/webapp/WEB-INF/classes/repository.properties Tue Feb 16 16:03:38 2010
@@ -0,0 +1,12 @@
+class=org.apache.opencmis.fileshare.ServicesFactory
+
+login.1 = test:test
+login.2 = cmisuser:password
+login.3 = reader:reader
+
+#type.1 = {user.home}{file.separator}type1.xml
+#type.2 = {user.home}{file.separator}type2.xml
+
+repository.test = {user.home}
+repository.test.readwrite = test, cmisuser
+repository.test.readonly = reader

Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/webapp/WEB-INF/classes/repository.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Feb 16 16:03:38 2010
@@ -0,0 +1,6 @@
+bin
+target
+*.iws
+*.ipr
+*.iml
+.*

Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/pom.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/pom.xml?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/pom.xml (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/pom.xml Tue Feb 16 16:03:38 2010
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+                             
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.opencmis</groupId>
+    <artifactId>opencmis</artifactId>
+    <version>0.1-SNAPSHOT</version>
+	<relativePath>../../pom.xml</relativePath>		
+  </parent>
+  
+  <artifactId>opencmis-server-impl</artifactId>
+  <name>OpenCMIS Server Implementation</name>
+  <packaging>war</packaging>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+		  <execution>
+            <id>unpack</id>
+            <phase>initialize</phase>
+            <goals>
+				<goal>unpack</goal>
+            </goals>
+            <configuration>
+				<artifactItems>
+					<artifactItem>
+						<groupId>org.opencmis</groupId>
+						<artifactId>opencmis-commons-impl</artifactId>
+						<version>${version}</version>
+						<type>jar</type>
+						<overWrite>true</overWrite>
+						<includes>wsdl/*.xsd, wsdl/*.wsdl</includes>
+					</artifactItem>
+				</artifactItems>
+				<outputDirectory>${project.basedir}/src/main/webapp/WEB-INF</outputDirectory>
+				<overWriteReleases>true</overWriteReleases>
+				<overWriteSnapshots>true</overWriteSnapshots>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.opencmis</groupId>
+      <artifactId>opencmis-commons-api</artifactId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opencmis</groupId>
+      <artifactId>opencmis-commons-impl</artifactId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opencmis</groupId>
+      <artifactId>opencmis-server-spi</artifactId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.4</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.xml.ws</groupId>
+      <artifactId>jaxws-rt</artifactId>
+      <version>2.1.7</version>
+      <scope>compile</scope>
+    </dependency>	
+  </dependencies>
+
+  <repositories>
+    <repository>
+      <id>maven-repository.dev.java.net</id>
+      <name>Java.net Repository for Maven 1</name>
+      <url>http://download.java.net/maven/1/</url>
+      <layout>legacy</layout>
+    </repository>
+    <repository>
+      <id>maven2-repository.dev.java.net</id>
+      <name>Java.net Repository for Maven 2</name>
+      <url>http://download.java.net/maven/2/</url>
+    </repository>
+  </repositories>
+  
+  <pluginRepositories>
+    <pluginRepository>
+      <id>maven2-repository.dev.java.net</id>
+      <url>http://download.java.net/maven/2/</url>
+    </pluginRepository>
+  </pluginRepositories>  
+</project>

Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/CallContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/CallContextImpl.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/CallContextImpl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/CallContextImpl.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,99 @@
+/*
+ * 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.server.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.opencmis.server.spi.CallContext;
+
+/**
+ * Implementation of the {@link CallContext} interface.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class CallContextImpl implements CallContext {
+
+  private String fBinding;
+  private Map<String, String> fParameter = new HashMap<String, String>();
+
+  public CallContextImpl(String binding) {
+    fBinding = binding;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.server.spi.CallContext#getBinding()
+   */
+  public String getBinding() {
+    return fBinding;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.server.spi.CallContext#get(java.lang.String)
+   */
+  public String get(String key) {
+    return fParameter.get(key);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.server.spi.CallContext#getUsername()
+   */
+  public String getUsername() {
+    return get(USERNAME);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.server.spi.CallContext#getPassword()
+   */
+  public String getPassword() {
+    return get(PASSWORD);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.server.spi.CallContext#getLocale()
+   */
+  public String getLocale() {
+    return get(LOCALE);
+  }
+
+  /**
+   * Adds a parameter.
+   */
+  public void put(String key, String value) {
+    fParameter.put(key, value);
+  }
+
+  /**
+   * Removes a parameter.
+   */
+  public String remove(String key) {
+    return fParameter.remove(key);
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/CallContextImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message