chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dcaru...@apache.org
Subject svn commit: r910572 [8/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-a...
Date Tue, 16 Feb 2010 16:04:07 GMT
Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/PolicyServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/PolicyServiceImpl.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/PolicyServiceImpl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/PolicyServiceImpl.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,211 @@
+/*
+ * 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.provider.spi.atompub;
+
+import static org.apache.opencmis.commons.impl.Converter.convert;
+
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.opencmis.client.provider.spi.Session;
+import org.apache.opencmis.client.provider.spi.atompub.objects.AtomElement;
+import org.apache.opencmis.client.provider.spi.atompub.objects.AtomEntry;
+import org.apache.opencmis.client.provider.spi.atompub.objects.AtomFeed;
+import org.apache.opencmis.client.provider.spi.atompub.objects.AtomLink;
+import org.apache.opencmis.commons.PropertyIds;
+import org.apache.opencmis.commons.api.ExtensionsData;
+import org.apache.opencmis.commons.exceptions.CmisInvalidArgumentException;
+import org.apache.opencmis.commons.exceptions.CmisObjectNotFoundException;
+import org.apache.opencmis.commons.impl.Constants;
+import org.apache.opencmis.commons.impl.UrlBuilder;
+import org.apache.opencmis.commons.impl.jaxb.CmisObjectType;
+import org.apache.opencmis.commons.impl.jaxb.CmisProperty;
+import org.apache.opencmis.commons.impl.jaxb.CmisPropertyId;
+import org.apache.opencmis.commons.provider.ObjectData;
+import org.apache.opencmis.commons.provider.PolicyService;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class PolicyServiceImpl extends AbstractAtomPubService implements PolicyService {
+
+  /**
+   * Constructor.
+   */
+  public PolicyServiceImpl(Session session) {
+    setSession(session);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.PolicyService#applyPolicy(java.lang.String, java.lang.String,
+   * java.lang.String, org.apache.opencmis.client.provider.ExtensionsData)
+   */
+  public void applyPolicy(String repositoryId, String policyId, String objectId,
+      ExtensionsData extension) {
+    // find the link
+    String link = loadLink(repositoryId, objectId, Constants.REL_POLICIES, Constants.MEDIATYPE_FEED);
+
+    if (link == null) {
+      throw new CmisObjectNotFoundException("Unknown repository or object!");
+    }
+
+    UrlBuilder url = new UrlBuilder(link);
+
+    // set up object and writer
+    final AtomEntryWriter entryWriter = new AtomEntryWriter(createIdObject(objectId));
+
+    // post applyPolicy request
+    post(url, Constants.MEDIATYPE_ENTRY, new HttpUtils.Output() {
+      public void write(OutputStream out) throws Exception {
+        entryWriter.write(out);
+      }
+    });
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.PolicyService#getAppliedPolicies(java.lang.String,
+   * java.lang.String, java.lang.String, org.apache.opencmis.client.provider.ExtensionsData)
+   */
+  public List<ObjectData> getAppliedPolicies(String repositoryId, String objectId, String filter,
+      ExtensionsData extension) {
+    List<ObjectData> result = new ArrayList<ObjectData>();
+
+    // find the link
+    String link = loadLink(repositoryId, objectId, Constants.REL_POLICIES, Constants.MEDIATYPE_FEED);
+
+    if (link == null) {
+      throw new CmisObjectNotFoundException("Unknown repository or object!");
+    }
+
+    UrlBuilder url = new UrlBuilder(link);
+    url.addParameter(Constants.PARAM_FILTER, filter);
+
+    // read and parse
+    HttpUtils.Response resp = read(url);
+    AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
+
+    // get the policies
+    if (!feed.getEntries().isEmpty()) {
+      for (AtomEntry entry : feed.getEntries()) {
+        ObjectData policy = null;
+
+        // walk through the entry
+        for (AtomElement element : entry.getElements()) {
+          if (element.getObject() instanceof CmisObjectType) {
+            policy = convert((CmisObjectType) element.getObject());
+          }
+        }
+
+        if (policy != null) {
+          result.add(policy);
+        }
+      }
+    }
+
+    return result;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.PolicyService#removePolicy(java.lang.String,
+   * java.lang.String, java.lang.String, org.apache.opencmis.client.provider.ExtensionsData)
+   */
+  public void removePolicy(String repositoryId, String policyId, String objectId,
+      ExtensionsData extension) {
+    // we need a policy id
+    if (policyId == null) {
+      throw new CmisInvalidArgumentException("Policy id must be set!");
+    }
+
+    // find the link
+    String link = loadLink(repositoryId, objectId, Constants.REL_POLICIES, Constants.MEDIATYPE_FEED);
+
+    if (link == null) {
+      throw new CmisObjectNotFoundException("Unknown repository or object!");
+    }
+
+    UrlBuilder url = new UrlBuilder(link);
+    url.addParameter(Constants.PARAM_FILTER, PropertyIds.CMIS_OBJECT_ID);
+
+    // read and parse
+    HttpUtils.Response resp = read(url);
+    AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
+
+    // find the policy
+    String policyLink = null;
+    boolean found = false;
+
+    if (!feed.getEntries().isEmpty()) {
+      for (AtomEntry entry : feed.getEntries()) {
+        // walk through the entry
+        for (AtomElement element : entry.getElements()) {
+          if (element.getObject() instanceof AtomLink) {
+            AtomLink atomLink = (AtomLink) element.getObject();
+            if (Constants.REL_SELF.equals(atomLink.getRel())) {
+              policyLink = atomLink.getHref();
+            }
+          }
+          else if (element.getObject() instanceof CmisObjectType) {
+            String id = findIdProperty((CmisObjectType) element.getObject());
+            if (policyId.equals(id)) {
+              found = true;
+            }
+          }
+        }
+
+        if (found) {
+          break;
+        }
+      }
+    }
+
+    // if found, delete it
+    if (found && (policyLink != null)) {
+      delete(new UrlBuilder(policyLink));
+    }
+  }
+
+  /**
+   * Finds the id property within a CMIS object.
+   */
+  private String findIdProperty(CmisObjectType object) {
+    if ((object == null) || (object.getProperties() == null)) {
+      return null;
+    }
+
+    for (CmisProperty property : object.getProperties().getProperty()) {
+      if (PropertyIds.CMIS_OBJECT_ID.equals(property.getPropertyDefinitionId())
+          && (property instanceof CmisPropertyId)) {
+        List<String> values = ((CmisPropertyId) property).getValue();
+        if (values.size() == 1) {
+          return values.get(0);
+        }
+      }
+    }
+
+    return null;
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/PolicyServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/RelationshipServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/RelationshipServiceImpl.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/RelationshipServiceImpl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/RelationshipServiceImpl.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,130 @@
+/*
+ * 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.provider.spi.atompub;
+
+import static org.apache.opencmis.commons.impl.Converter.convert;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+
+import org.apache.opencmis.client.provider.spi.Session;
+import org.apache.opencmis.client.provider.spi.atompub.objects.AtomElement;
+import org.apache.opencmis.client.provider.spi.atompub.objects.AtomEntry;
+import org.apache.opencmis.client.provider.spi.atompub.objects.AtomFeed;
+import org.apache.opencmis.client.provider.spi.atompub.objects.AtomLink;
+import org.apache.opencmis.commons.api.ExtensionsData;
+import org.apache.opencmis.commons.enums.RelationshipDirection;
+import org.apache.opencmis.commons.exceptions.CmisObjectNotFoundException;
+import org.apache.opencmis.commons.impl.Constants;
+import org.apache.opencmis.commons.impl.UrlBuilder;
+import org.apache.opencmis.commons.impl.dataobjects.ObjectListImpl;
+import org.apache.opencmis.commons.impl.jaxb.CmisObjectType;
+import org.apache.opencmis.commons.provider.ObjectData;
+import org.apache.opencmis.commons.provider.ObjectList;
+import org.apache.opencmis.commons.provider.RelationshipService;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class RelationshipServiceImpl extends AbstractAtomPubService implements RelationshipService {
+
+  /**
+   * Constructor.
+   */
+  public RelationshipServiceImpl(Session session) {
+    setSession(session);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.RelationshipService#getObjectRelationships(java.lang.String,
+   * java.lang.String, java.lang.Boolean, org.apache.opencmis.commons.enums.RelationshipDirection,
+   * java.lang.String, java.lang.String, java.lang.Boolean, java.math.BigInteger,
+   * java.math.BigInteger, org.apache.opencmis.client.provider.ExtensionsData)
+   */
+  public ObjectList getObjectRelationships(String repositoryId, String objectId,
+      Boolean includeSubRelationshipTypes, RelationshipDirection relationshipDirection,
+      String typeId, String filter, Boolean includeAllowableActions, BigInteger maxItems,
+      BigInteger skipCount, ExtensionsData extension) {
+    ObjectListImpl result = new ObjectListImpl();
+
+    // find the link
+    String link = loadLink(repositoryId, objectId, Constants.REL_RELATIONSHIPS,
+        Constants.MEDIATYPE_FEED);
+
+    if (link == null) {
+      throw new CmisObjectNotFoundException("Unknown repository or source object!");
+    }
+
+    UrlBuilder url = new UrlBuilder(link);
+    url.addParameter(Constants.PARAM_SUB_RELATIONSHIP_TYPES, includeSubRelationshipTypes);
+    url.addParameter(Constants.PARAM_RELATIONSHIP_DIRECTION, relationshipDirection);
+    url.addParameter(Constants.PARAM_TYPE_ID, typeId);
+    url.addParameter(Constants.PARAM_FILTER, filter);
+    url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
+    url.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
+    url.addParameter(Constants.PARAM_SKIP_COUNT, skipCount);
+
+    // read and parse
+    HttpUtils.Response resp = read(url);
+    AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
+
+    // handle top level
+    for (AtomElement element : feed.getElements()) {
+      if (element.getObject() instanceof AtomLink) {
+        if (isNextLink(element)) {
+          result.setHasMoreItems(Boolean.TRUE);
+        }
+      }
+      else if (isInt(NAME_NUM_ITEMS, element)) {
+        result.setNumItems((BigInteger) element.getObject());
+      }
+    }
+
+    // get the children
+    if (!feed.getEntries().isEmpty()) {
+      result.setObjects(new ArrayList<ObjectData>(feed.getEntries().size()));
+
+      for (AtomEntry entry : feed.getEntries()) {
+        ObjectData relationship = null;
+
+        // clean up cache
+        removeLinks(repositoryId, entry.getId());
+
+        // walk through the entry
+        for (AtomElement element : entry.getElements()) {
+          if (element.getObject() instanceof AtomLink) {
+            addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
+          }
+          else if (element.getObject() instanceof CmisObjectType) {
+            relationship = convert((CmisObjectType) element.getObject());
+          }
+        }
+
+        if (relationship != null) {
+          result.getObjects().add(relationship);
+        }
+      }
+    }
+
+    return result;
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/RelationshipServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/RepositoryServiceImpl.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/RepositoryServiceImpl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/RepositoryServiceImpl.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,249 @@
+/*
+ * 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.provider.spi.atompub;
+
+import static org.apache.opencmis.commons.impl.Converter.convert;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.opencmis.client.provider.spi.Session;
+import org.apache.opencmis.client.provider.spi.atompub.objects.AtomElement;
+import org.apache.opencmis.client.provider.spi.atompub.objects.AtomEntry;
+import org.apache.opencmis.client.provider.spi.atompub.objects.AtomFeed;
+import org.apache.opencmis.client.provider.spi.atompub.objects.AtomLink;
+import org.apache.opencmis.commons.api.ExtensionsData;
+import org.apache.opencmis.commons.api.TypeDefinitionContainer;
+import org.apache.opencmis.commons.api.TypeDefinition;
+import org.apache.opencmis.commons.api.TypeDefinitionList;
+import org.apache.opencmis.commons.exceptions.CmisObjectNotFoundException;
+import org.apache.opencmis.commons.impl.Constants;
+import org.apache.opencmis.commons.impl.UrlBuilder;
+import org.apache.opencmis.commons.impl.dataobjects.TypeDefinitionContainerImpl;
+import org.apache.opencmis.commons.impl.dataobjects.TypeDefinitionListImpl;
+import org.apache.opencmis.commons.impl.jaxb.CmisTypeDefinitionType;
+import org.apache.opencmis.commons.provider.RepositoryInfoData;
+import org.apache.opencmis.commons.provider.RepositoryService;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class RepositoryServiceImpl extends AbstractAtomPubService implements RepositoryService {
+
+  /**
+   * Constructor.
+   */
+  public RepositoryServiceImpl(Session session) {
+    setSession(session);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.client.provider.RepositoryService#getRepositoryInfos(org.apache.opencmis.client.provider
+   * .ExtensionsData)
+   */
+  public List<RepositoryInfoData> getRepositoryInfos(ExtensionsData extension) {
+    return getRepositoriesInternal(null);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.RepositoryService#getRepositoryInfo(java.lang.String,
+   * org.apache.opencmis.client.provider.ExtensionsData)
+   */
+  public RepositoryInfoData getRepositoryInfo(String repositoryId, ExtensionsData extension) {
+    List<RepositoryInfoData> repositoryInfos = getRepositoriesInternal(repositoryId);
+
+    // find the repository
+    for (RepositoryInfoData info : repositoryInfos) {
+      if (info.getRepositoryId() == null) {
+        continue;
+      }
+
+      if (info.getRepositoryId().equals(repositoryId)) {
+        return info;
+      }
+    }
+
+    throw new CmisObjectNotFoundException("Repository not found!");
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.RepositoryService#getTypeDefinition(java.lang.String,
+   * java.lang.String, org.apache.opencmis.client.provider.ExtensionsData)
+   */
+  public TypeDefinition getTypeDefinition(String repositoryId, String typeId,
+      ExtensionsData extension) {
+    return getTypeDefinitionInternal(repositoryId, typeId);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.RepositoryService#getTypeChildren(java.lang.String,
+   * java.lang.String, java.lang.Boolean, java.math.BigInteger, java.math.BigInteger,
+   * org.apache.opencmis.client.provider.ExtensionsData)
+   */
+  public TypeDefinitionList getTypeChildren(String repositoryId, String typeId,
+      Boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount,
+      ExtensionsData extension) {
+    TypeDefinitionListImpl result = new TypeDefinitionListImpl();
+
+    // find the link
+    String link = null;
+    if (typeId == null) {
+      link = loadCollection(repositoryId, Constants.COLLECTION_TYPES);
+    }
+    else {
+      link = loadTypeLink(repositoryId, typeId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
+    }
+
+    if (link == null) {
+      throw new CmisObjectNotFoundException("Unknown repository or type!");
+    }
+
+    UrlBuilder url = new UrlBuilder(link);
+    url.addParameter(Constants.PARAM_TYPE_ID, typeId);
+    url.addParameter(Constants.PARAM_PROPERTY_DEFINITIONS, includePropertyDefinitions);
+    url.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
+    url.addParameter(Constants.PARAM_SKIP_COUNT, skipCount);
+
+    // read and parse
+    HttpUtils.Response resp = read(url);
+    AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
+
+    // handle top level
+    for (AtomElement element : feed.getElements()) {
+      if (element.getObject() instanceof AtomLink) {
+        if (isNextLink(element)) {
+          result.setHasMoreItems(Boolean.TRUE);
+        }
+      }
+      else if (isInt(NAME_NUM_ITEMS, element)) {
+        result.setNumItems((BigInteger) element.getObject());
+      }
+    }
+
+    // get the children
+    if (!feed.getEntries().isEmpty()) {
+      result.setList(new ArrayList<TypeDefinition>(feed.getEntries().size()));
+
+      for (AtomEntry entry : feed.getEntries()) {
+        TypeDefinition child = null;
+
+        // walk through the entry
+        for (AtomElement element : entry.getElements()) {
+          if (element.getObject() instanceof AtomLink) {
+            addTypeLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
+          }
+          else if (element.getObject() instanceof CmisTypeDefinitionType) {
+            child = convert((CmisTypeDefinitionType) element.getObject());
+          }
+        }
+
+        if (child != null) {
+          result.getList().add(child);
+        }
+      }
+    }
+
+    return result;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.RepositoryService#getTypeDescendants(java.lang.String,
+   * java.lang.String, java.math.BigInteger, java.lang.Boolean,
+   * org.apache.opencmis.client.provider.ExtensionsData)
+   */
+  public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId,
+      BigInteger depth, Boolean includePropertyDefinitions, ExtensionsData extension) {
+    List<TypeDefinitionContainer> result = new ArrayList<TypeDefinitionContainer>();
+
+    // find the link
+    String link = null;
+    if (typeId == null) {
+      link = loadRepositoryLink(repositoryId, Constants.REP_REL_TYPEDESC);
+    }
+    else {
+      link = loadTypeLink(repositoryId, typeId, Constants.REL_DOWN, Constants.MEDIATYPE_DESCENDANTS);
+    }
+
+    if (link == null) {
+      throw new CmisObjectNotFoundException("Unknown repository or type!");
+    }
+
+    UrlBuilder url = new UrlBuilder(link);
+    url.addParameter(Constants.PARAM_TYPE_ID, typeId);
+    url.addParameter(Constants.PARAM_DEPTH, depth);
+    url.addParameter(Constants.PARAM_PROPERTY_DEFINITIONS, includePropertyDefinitions);
+
+    // read and parse
+    HttpUtils.Response resp = read(url);
+    AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
+
+    // process tree
+    addTypeDescendantsLevel(repositoryId, feed, result);
+
+    return result;
+  }
+
+  /**
+   * Adds type descendants level recursively.
+   */
+  private void addTypeDescendantsLevel(String repositoryId, AtomFeed feed,
+      List<TypeDefinitionContainer> containerList) {
+    if ((feed == null) || (feed.getEntries().isEmpty())) {
+      return;
+    }
+
+    // walk through the feed
+    for (AtomEntry entry : feed.getEntries()) {
+      TypeDefinitionContainerImpl childContainer = null;
+      List<TypeDefinitionContainer> childContainerList = new ArrayList<TypeDefinitionContainer>();
+
+      // walk through the entry
+      for (AtomElement element : entry.getElements()) {
+        if (element.getObject() instanceof AtomLink) {
+          addTypeLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
+        }
+        else if (element.getObject() instanceof CmisTypeDefinitionType) {
+          childContainer = new TypeDefinitionContainerImpl(convert((CmisTypeDefinitionType) element
+              .getObject()));
+        }
+        else if (element.getObject() instanceof AtomFeed) {
+          addTypeDescendantsLevel(repositoryId, (AtomFeed) element.getObject(), childContainerList);
+        }
+      }
+
+      if (childContainer != null) {
+        childContainer.setChildren(childContainerList);
+        containerList.add(childContainer);
+      }
+    }
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/RepositoryServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/SpiSessionParameter.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/SpiSessionParameter.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/SpiSessionParameter.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/SpiSessionParameter.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,31 @@
+/*
+ * 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.provider.spi.atompub;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public final class SpiSessionParameter {
+
+  public static final String LINK_CACHE = "org.apache.opencmis.provider.atompub.linkcache";
+
+  private SpiSessionParameter() {
+  }
+}
\ No newline at end of file

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/SpiSessionParameter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/VersioningServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/VersioningServiceImpl.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/VersioningServiceImpl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/VersioningServiceImpl.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,323 @@
+/*
+ * 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.provider.spi.atompub;
+
+import static org.apache.opencmis.commons.impl.Converter.convert;
+import static org.apache.opencmis.commons.impl.Converter.convertPolicyIds;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.opencmis.client.provider.spi.Session;
+import org.apache.opencmis.client.provider.spi.atompub.objects.AtomElement;
+import org.apache.opencmis.client.provider.spi.atompub.objects.AtomEntry;
+import org.apache.opencmis.client.provider.spi.atompub.objects.AtomFeed;
+import org.apache.opencmis.client.provider.spi.atompub.objects.AtomLink;
+import org.apache.opencmis.commons.api.ExtensionsData;
+import org.apache.opencmis.commons.enums.IncludeRelationships;
+import org.apache.opencmis.commons.exceptions.CmisConnectionException;
+import org.apache.opencmis.commons.exceptions.CmisInvalidArgumentException;
+import org.apache.opencmis.commons.exceptions.CmisObjectNotFoundException;
+import org.apache.opencmis.commons.impl.Constants;
+import org.apache.opencmis.commons.impl.ReturnVersion;
+import org.apache.opencmis.commons.impl.UrlBuilder;
+import org.apache.opencmis.commons.impl.jaxb.CmisObjectType;
+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.commons.provider.VersioningService;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class VersioningServiceImpl extends AbstractAtomPubService implements VersioningService {
+
+  /**
+   * Constructor.
+   */
+  public VersioningServiceImpl(Session session) {
+    setSession(session);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.VersioningService#checkOut(java.lang.String,
+   * org.apache.opencmis.client.provider.Holder, org.apache.opencmis.client.provider.ExtensionsData,
+   * org.apache.opencmis.client.provider.Holder)
+   */
+  public void checkOut(String repositoryId, Holder<String> objectId, ExtensionsData extension,
+      Holder<Boolean> contentCopied) {
+    if ((objectId == null) || (objectId.getValue() == null) || (objectId.getValue().length() == 0)) {
+      throw new CmisInvalidArgumentException("Object id must be set!");
+    }
+
+    // find the link
+    String link = loadCollection(repositoryId, Constants.COLLECTION_CHECKEDOUT);
+
+    if (link == null) {
+      throw new CmisObjectNotFoundException(
+          "Unknown repository or checkedout collection not supported!");
+    }
+
+    UrlBuilder url = new UrlBuilder(link);
+
+    // set up object and writer
+    final AtomEntryWriter entryWriter = new AtomEntryWriter(createIdObject(objectId.getValue()));
+
+    // post move request
+    HttpUtils.Response resp = post(url, Constants.MEDIATYPE_ENTRY, new HttpUtils.Output() {
+      public void write(OutputStream out) throws Exception {
+        entryWriter.write(out);
+      }
+    });
+
+    // parse the response
+    AtomEntry entry = parse(resp.getStream(), AtomEntry.class);
+
+    objectId.setValue(entry.getId());
+
+    // clean up cache
+    removeLinks(repositoryId, entry.getId());
+
+    // walk through the entry
+    for (AtomElement element : entry.getElements()) {
+      if (element.getObject() instanceof AtomLink) {
+        addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
+      }
+    }
+
+    if (contentCopied != null) {
+      contentCopied.setValue(null);
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.VersioningService#cancelCheckOut(java.lang.String,
+   * java.lang.String, org.apache.opencmis.client.provider.ExtensionsData)
+   */
+  public void cancelCheckOut(String repositoryId, String objectId, ExtensionsData extension) {
+    // find the link
+    String link = loadLink(repositoryId, objectId, Constants.REL_SELF, Constants.MEDIATYPE_ENTRY);
+
+    if (link == null) {
+      throw new CmisObjectNotFoundException("Unknown repository or object!");
+    }
+
+    delete(new UrlBuilder(link));
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.VersioningService#checkIn(java.lang.String,
+   * org.apache.opencmis.client.provider.Holder, java.lang.Boolean,
+   * org.apache.opencmis.client.provider.PropertiesData, org.apache.opencmis.client.provider.ContentStreamData,
+   * java.lang.String, java.util.List, org.apache.opencmis.client.provider.AccessControlList,
+   * org.apache.opencmis.client.provider.AccessControlList, org.apache.opencmis.client.provider.ExtensionsData)
+   */
+  public void checkIn(String repositoryId, Holder<String> objectId, Boolean major,
+      PropertiesData properties, ContentStreamData contentStream, String checkinComment,
+      List<String> policies, AccessControlList addAces, AccessControlList removeAces,
+      ExtensionsData extension) {
+    // we need an object id
+    if ((objectId == null) || (objectId.getValue() == null) || (objectId.getValue().length() == 0)) {
+      throw new CmisInvalidArgumentException("Object id must be set!");
+    }
+
+    // find the link
+    String link = loadLink(repositoryId, objectId.getValue(), Constants.REL_SELF,
+        Constants.MEDIATYPE_ENTRY);
+
+    if (link == null) {
+      throw new CmisObjectNotFoundException("Unknown repository or object!");
+    }
+
+    UrlBuilder url = new UrlBuilder(link);
+    url.addParameter(Constants.PARAM_CHECKIN_COMMENT, checkinComment);
+    url.addParameter(Constants.PARAM_MAJOR, major);
+    url.addParameter(Constants.PARAM_CHECK_IN, "true");
+
+    // set up object and writer
+    CmisObjectType object = new CmisObjectType();
+    object.setProperties(convert(properties));
+    object.setPolicyIds(convertPolicyIds(policies));
+
+    String mediaType = null;
+    InputStream stream = null;
+
+    if (contentStream != null) {
+      mediaType = contentStream.getMimeType();
+      stream = contentStream.getStream();
+    }
+
+    final AtomEntryWriter entryWriter = new AtomEntryWriter(object, mediaType, stream);
+
+    // update
+    HttpUtils.Response resp = put(url, Constants.MEDIATYPE_ENTRY, new HttpUtils.Output() {
+      public void write(OutputStream out) throws Exception {
+        entryWriter.write(out);
+      }
+    });
+
+    // parse new entry
+    AtomEntry entry = parse(resp.getStream(), AtomEntry.class);
+
+    // we expect a CMIS entry
+    if (entry.getId() == null) {
+      throw new CmisConnectionException("Received Atom entry is not a CMIS entry!");
+    }
+
+    // set object id
+    objectId.setValue(entry.getId());
+
+    // clean up cache
+    removeLinks(repositoryId, entry.getId());
+
+    // walk through the entry
+    AccessControlList originalAces = null;
+    for (AtomElement element : entry.getElements()) {
+      if (element.getObject() instanceof AtomLink) {
+        addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
+      }
+      else if (element.getObject() instanceof CmisObjectType) {
+        // extract current ACL
+        object = (CmisObjectType) element.getObject();
+        originalAces = convert(object.getAcl(), object.isExactACL());
+      }
+    }
+
+    // handle ACL modifications
+    if ((originalAces != null) && (isAclMergeRequired(addAces, removeAces))) {
+      // merge and update ACL
+      AccessControlList newACL = mergeAcls(originalAces, addAces, removeAces);
+      if (newACL != null) {
+        updateAcl(repositoryId, entry.getId(), newACL, null);
+      }
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.VersioningService#getAllVersions(java.lang.String,
+   * java.lang.String, java.lang.String, java.lang.Boolean,
+   * org.apache.opencmis.client.provider.ExtensionsData)
+   */
+  public List<ObjectData> getAllVersions(String repositoryId, String versionSeriesId,
+      String filter, Boolean includeAllowableActions, ExtensionsData extension) {
+    List<ObjectData> result = new ArrayList<ObjectData>();
+
+    // find the link
+    String link = loadLink(repositoryId, versionSeriesId, Constants.REL_VERSIONHISTORY,
+        Constants.MEDIATYPE_FEED);
+
+    if (link == null) {
+      throw new CmisObjectNotFoundException("Unknown repository or folder!");
+    }
+
+    UrlBuilder url = new UrlBuilder(link);
+    url.addParameter(Constants.PARAM_FILTER, filter);
+    url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
+
+    // read and parse
+    HttpUtils.Response resp = read(url);
+    AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
+
+    // get the versions
+    if (!feed.getEntries().isEmpty()) {
+      for (AtomEntry entry : feed.getEntries()) {
+        ObjectData version = null;
+
+        // clean up cache
+        removeLinks(repositoryId, entry.getId());
+
+        // walk through the entry
+        for (AtomElement element : entry.getElements()) {
+          if (element.getObject() instanceof AtomLink) {
+            addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
+          }
+          else if (element.getObject() instanceof CmisObjectType) {
+            version = convert((CmisObjectType) element.getObject());
+          }
+        }
+
+        if (version != null) {
+          result.add(version);
+        }
+      }
+    }
+
+    return result;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.VersioningService#getObjectOfLatestVersion(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.client.provider.ExtensionsData)
+   */
+  public ObjectData getObjectOfLatestVersion(String repositoryId, String versionSeriesId,
+      Boolean major, String filter, Boolean includeAllowableActions,
+      IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
+      Boolean includeACL, ExtensionsData extension) {
+
+    ReturnVersion returnVersion = ReturnVersion.LATEST;
+    if ((major != null) && (major.booleanValue())) {
+      returnVersion = ReturnVersion.LASTESTMAJOR;
+    }
+
+    return getObjectInternal(repositoryId, IdentifierType.ID, versionSeriesId, returnVersion,
+        filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds,
+        includeACL, extension);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.client.provider.VersioningService#getPropertiesOfLatestVersion(java.lang.String,
+   * java.lang.String, java.lang.Boolean, java.lang.String,
+   * org.apache.opencmis.client.provider.ExtensionsData)
+   */
+  public PropertiesData getPropertiesOfLatestVersion(String repositoryId, String versionSeriesId,
+      Boolean major, String filter, ExtensionsData extension) {
+
+    ReturnVersion returnVersion = ReturnVersion.LATEST;
+    if ((major != null) && (major.booleanValue())) {
+      returnVersion = ReturnVersion.LASTESTMAJOR;
+    }
+
+    ObjectData object = getObjectInternal(repositoryId, IdentifierType.ID, versionSeriesId,
+        returnVersion, filter, Boolean.FALSE, IncludeRelationships.NONE, "cmis:none",
+        Boolean.FALSE, Boolean.FALSE, extension);
+
+    return object.getProperties();
+  }
+
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/VersioningServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/Acl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/Acl.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/Acl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/Acl.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,59 @@
+/*
+ * 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.provider.spi.atompub.objects;
+
+import org.apache.opencmis.commons.impl.jaxb.CmisAccessControlListType;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class Acl extends AtomBase {
+
+  private static final long serialVersionUID = 1L;
+
+  private CmisAccessControlListType fACL;
+
+  public Acl() {
+    super();
+  }
+
+  public Acl(CmisAccessControlListType acl) {
+    this();
+    setACL(acl);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.spi.atompub.objects.AtomBase#getType()
+   */
+  @Override
+  public String getType() {
+    return "ACL";
+  }
+
+  public CmisAccessControlListType getACL() {
+    return fACL;
+  }
+
+  public void setACL(CmisAccessControlListType acl) {
+    fACL = acl;
+  }
+}
\ No newline at end of file

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/Acl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AllowableActions.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AllowableActions.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AllowableActions.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AllowableActions.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,59 @@
+/*
+ * 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.provider.spi.atompub.objects;
+
+import org.apache.opencmis.commons.impl.jaxb.CmisAllowableActionsType;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class AllowableActions extends AtomBase {
+
+  private static final long serialVersionUID = 1L;
+
+  private CmisAllowableActionsType fAllowableActions;
+
+  public AllowableActions() {
+    super();
+  }
+
+  public AllowableActions(CmisAllowableActionsType allowableActions) {
+    this();
+    setAllowableActions(allowableActions);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.spi.atompub.objects.AtomBase#getType()
+   */
+  @Override
+  public String getType() {
+    return "Allowable Actions";
+  }
+
+  public CmisAllowableActionsType getAllowableActions() {
+    return fAllowableActions;
+  }
+
+  public void setAllowableActions(CmisAllowableActionsType allowableActions) {
+    fAllowableActions = allowableActions;
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AllowableActions.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomBase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomBase.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomBase.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomBase.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,49 @@
+/*
+ * 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.provider.spi.atompub.objects;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public abstract class AtomBase implements Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  private List<AtomElement> fElements = new ArrayList<AtomElement>();
+
+  public AtomBase() {
+  }
+
+  public abstract String getType();
+
+  public List<AtomElement> getElements() {
+    return fElements;
+  }
+
+  public void addElement(AtomElement element) {
+    if (element != null) {
+      fElements.add(element);
+    }
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomElement.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomElement.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomElement.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomElement.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,53 @@
+/*
+ * 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.provider.spi.atompub.objects;
+
+import java.io.Serializable;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class AtomElement implements Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  private QName fName;
+  private Object fObject;
+
+  public AtomElement(QName name, Object object) {
+    fName = name;
+    fObject = object;
+  }
+
+  public QName getName() {
+    return fName;
+  }
+
+  public Object getObject() {
+    return fObject;
+  }
+
+  @Override
+  public String toString() {
+    return fName + ": " + fObject;
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomEntry.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomEntry.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomEntry.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomEntry.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,57 @@
+/*
+ * 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.provider.spi.atompub.objects;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class AtomEntry extends AtomBase {
+
+  private static final long serialVersionUID = 1L;
+
+  private String fId;
+
+  public AtomEntry() {
+    super();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.spi.atompub.objects.AtomBase#getType()
+   */
+  @Override
+  public String getType() {
+    return "Atom Entry";
+  }
+
+  public String getId() {
+    return fId;
+  }
+
+  public void setId(String id) {
+    fId = id;
+  }
+
+  @Override
+  public String toString() {
+    return "Entry \"" + fId + "\": " + getElements();
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomFeed.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomFeed.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomFeed.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomFeed.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,61 @@
+/*
+ * 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.provider.spi.atompub.objects;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class AtomFeed extends AtomBase {
+
+  private static final long serialVersionUID = 1L;
+
+  private List<AtomEntry> fEntries = new ArrayList<AtomEntry>();
+
+  public AtomFeed() {
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.spi.atompub.objects.AtomBase#getType()
+   */
+  @Override
+  public String getType() {
+    return "Atom Feed";
+  }
+
+  public List<AtomEntry> getEntries() {
+    return fEntries;
+  }
+
+  public void addEntry(AtomEntry entry) {
+    if (entry != null) {
+      fEntries.add(entry);
+    }
+  }
+
+  @Override
+  public String toString() {
+    return "Feed : " + getElements() + " " + fEntries;
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomFeed.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomLink.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomLink.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomLink.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomLink.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,66 @@
+/*
+ * 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.provider.spi.atompub.objects;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class AtomLink implements Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  private String fRel;
+  private String fType;
+  private String fHref;
+
+  public AtomLink() {
+  }
+
+  public String getRel() {
+    return fRel;
+  }
+
+  public void setRel(String rel) {
+    fRel = rel;
+  }
+
+  public String getType() {
+    return fType;
+  }
+
+  public void setType(String type) {
+    fType = type;
+  }
+
+  public String getHref() {
+    return fHref;
+  }
+
+  public void setHref(String href) {
+    fHref = href;
+  }
+
+  @Override
+  public String toString() {
+    return "Link: rel=\"" + fRel + "\" type=\"" + fType + "\" href=\"" + fHref + "\"";
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/AtomLink.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/RepositoryWorkspace.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/RepositoryWorkspace.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/RepositoryWorkspace.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/RepositoryWorkspace.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,57 @@
+/*
+ * 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.provider.spi.atompub.objects;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class RepositoryWorkspace extends AtomBase {
+
+  private static final long serialVersionUID = 1L;
+
+  private String fId;
+
+  public RepositoryWorkspace() {
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.spi.atompub.objects.AtomBase#getType()
+   */
+  @Override
+  public String getType() {
+    return "Repository Workspace";
+  }
+
+  
+  public String getId() {
+    return fId;
+  }
+
+  public void setId(String id) {
+    fId = id;
+  }
+
+  @Override
+  public String toString() {
+    return "Workspace \"" + fId + "\": " + getElements();
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/RepositoryWorkspace.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/ServiceDoc.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/ServiceDoc.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/ServiceDoc.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/ServiceDoc.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,61 @@
+/*
+ * 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.provider.spi.atompub.objects;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class ServiceDoc extends AtomBase {
+
+  private static final long serialVersionUID = 1L;
+
+  private List<RepositoryWorkspace> fWorkspaces = new ArrayList<RepositoryWorkspace>();
+
+  public ServiceDoc() {
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.spi.atompub.objects.AtomBase#getType()
+   */
+  @Override
+  public String getType() {
+    return "Service Document";
+  }
+
+  public List<RepositoryWorkspace> getWorkspaces() {
+    return fWorkspaces;
+  }
+
+  public void addWorkspace(RepositoryWorkspace ws) {
+    if (ws != null) {
+      fWorkspaces.add(ws);
+    }
+  }
+
+  @Override
+  public String toString() {
+    return "Service Doc: " + fWorkspaces;
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/objects/ServiceDoc.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/AbstractWebServicesService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/AbstractWebServicesService.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/AbstractWebServicesService.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/AbstractWebServicesService.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,105 @@
+/*
+ * 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.provider.spi.webservices;
+
+import java.math.BigInteger;
+
+import org.apache.opencmis.client.provider.spi.Session;
+import org.apache.opencmis.commons.exceptions.CmisBaseException;
+import org.apache.opencmis.commons.exceptions.CmisConstraintException;
+import org.apache.opencmis.commons.exceptions.CmisContentAlreadyExistsException;
+import org.apache.opencmis.commons.exceptions.CmisFilterNotValidException;
+import org.apache.opencmis.commons.exceptions.CmisInvalidArgumentException;
+import org.apache.opencmis.commons.exceptions.CmisNameConstraintViolationException;
+import org.apache.opencmis.commons.exceptions.CmisNotSupportedException;
+import org.apache.opencmis.commons.exceptions.CmisObjectNotFoundException;
+import org.apache.opencmis.commons.exceptions.CmisPermissionDeniedException;
+import org.apache.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.opencmis.commons.exceptions.CmisStorageException;
+import org.apache.opencmis.commons.exceptions.CmisStreamNotSupportedException;
+import org.apache.opencmis.commons.exceptions.CmisUpdateConflictException;
+import org.apache.opencmis.commons.exceptions.CmisVersioningException;
+import org.apache.opencmis.commons.impl.jaxb.CmisException;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public abstract class AbstractWebServicesService {
+
+  private Session fSession;
+
+  /**
+   * Sets the current session.
+   */
+  protected void setSession(Session session) {
+    fSession = session;
+  }
+
+  /**
+   * Gets the current session.
+   */
+  protected Session getSession() {
+    return fSession;
+  }
+
+  /**
+   * Converts a Web Services Exception into a CMIS Client exception.
+   */
+  protected CmisBaseException convertException(CmisException ex) {
+    if ((ex == null) || (ex.getFaultInfo() == null)) {
+      return new CmisRuntimeException("CmisException has no fault!");
+    }
+
+    String msg = ex.getFaultInfo().getMessage();
+    BigInteger code = ex.getFaultInfo().getCode();
+
+    switch (ex.getFaultInfo().getType()) {
+    case CONSTRAINT:
+      return new CmisConstraintException(msg, code);
+    case CONTENT_ALREADY_EXISTS:
+      return new CmisContentAlreadyExistsException(msg, code);
+    case FILTER_NOT_VALID:
+      return new CmisFilterNotValidException(msg, code);
+    case INVALID_ARGUMENT:
+      return new CmisInvalidArgumentException(msg, code);
+    case NAME_CONSTRAINT_VIOLATION:
+      return new CmisNameConstraintViolationException(msg, code);
+    case NOT_SUPPORTED:
+      return new CmisNotSupportedException(msg, code);
+    case OBJECT_NOT_FOUND:
+      return new CmisObjectNotFoundException(msg, code);
+    case PERMISSION_DENIED:
+      return new CmisPermissionDeniedException(msg, code);
+    case RUNTIME:
+      return new CmisRuntimeException(msg, code);
+    case STORAGE:
+      return new CmisStorageException(msg, code);
+    case STREAM_NOT_SUPPORTED:
+      return new CmisStreamNotSupportedException(msg, code);
+    case UPDATE_CONFLICT:
+      return new CmisUpdateConflictException(msg, code);
+    case VERSIONING:
+      return new CmisVersioningException(msg, code);
+    }
+
+    return new CmisRuntimeException("Unknown exception[" + ex.getFaultInfo().getType().value()
+        + "]: " + msg);
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/AbstractWebServicesService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/AclServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/AclServiceImpl.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/AclServiceImpl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/AclServiceImpl.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,93 @@
+/*
+ * 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.provider.spi.webservices;
+
+import static org.apache.opencmis.commons.impl.Converter.convert;
+
+import org.apache.opencmis.client.provider.spi.Session;
+import org.apache.opencmis.commons.api.ExtensionsData;
+import org.apache.opencmis.commons.enums.AclPropagation;
+import org.apache.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.opencmis.commons.impl.jaxb.ACLServicePort;
+import org.apache.opencmis.commons.impl.jaxb.CmisException;
+import org.apache.opencmis.commons.impl.jaxb.EnumACLPropagation;
+import org.apache.opencmis.commons.provider.AccessControlList;
+import org.apache.opencmis.commons.provider.AclService;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class AclServiceImpl extends AbstractWebServicesService implements AclService {
+
+  private PortProvider fPortProvider;
+
+  /**
+   * Constructor.
+   */
+  public AclServiceImpl(Session session, PortProvider portProvider) {
+    setSession(session);
+    fPortProvider = portProvider;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.ACLService#applyACL(java.lang.String, java.lang.String,
+   * org.apache.opencmis.client.provider.AccessControlList, org.apache.opencmis.client.provider.AccessControlList,
+   * org.apache.opencmis.commons.enums.ACLPropagation, org.apache.opencmis.client.provider.ExtensionsData)
+   */
+  public AccessControlList applyAcl(String repositoryId, String objectId,
+      AccessControlList addACEs, AccessControlList removeACEs, AclPropagation aclPropagation,
+      ExtensionsData extension) {
+    ACLServicePort port = fPortProvider.getACLServicePort();
+
+    try {
+      return convert(port.applyACL(repositoryId, objectId, convert(addACEs), convert(removeACEs),
+          convert(EnumACLPropagation.class, aclPropagation), convert(extension)));
+    }
+    catch (CmisException e) {
+      throw convertException(e);
+    }
+    catch (Exception e) {
+      throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.ACLService#getACL(java.lang.String, java.lang.String,
+   * java.lang.Boolean, org.apache.opencmis.client.provider.ExtensionsData)
+   */
+  public AccessControlList getAcl(String repositoryId, String objectId,
+      Boolean onlyBasicPermissions, ExtensionsData extension) {
+    ACLServicePort port = fPortProvider.getACLServicePort();
+
+    try {
+      return convert(port.getACL(repositoryId, objectId, onlyBasicPermissions, convert(extension)));
+    }
+    catch (CmisException e) {
+      throw convertException(e);
+    }
+    catch (Exception e) {
+      throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+    }
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/AclServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/CmisWebServicesSpi.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/CmisWebServicesSpi.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/CmisWebServicesSpi.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/CmisWebServicesSpi.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,216 @@
+/*
+ * 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.provider.spi.webservices;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.opencmis.client.provider.spi.CmisSpi;
+import org.apache.opencmis.client.provider.spi.CmisSpiFactory;
+import org.apache.opencmis.client.provider.spi.Session;
+import org.apache.opencmis.commons.provider.AclService;
+import org.apache.opencmis.commons.provider.DiscoveryService;
+import org.apache.opencmis.commons.provider.MultiFilingService;
+import org.apache.opencmis.commons.provider.NavigationService;
+import org.apache.opencmis.commons.provider.ObjectService;
+import org.apache.opencmis.commons.provider.PolicyService;
+import org.apache.opencmis.commons.provider.RelationshipService;
+import org.apache.opencmis.commons.provider.RepositoryService;
+import org.apache.opencmis.commons.provider.VersioningService;
+
+/**
+ * CMIS Web Services SPI implementation.
+ * 
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class CmisWebServicesSpi implements CmisSpiFactory, CmisSpi {
+
+  private static Log log = LogFactory.getLog(CmisWebServicesSpi.class);
+
+  private Session fSession;
+  private PortProvider fPortProvider;
+
+  private RepositoryService fRepositoryService;
+  private NavigationService fNavigationService;
+  private ObjectService fObjectService;
+  private VersioningService fVersioningService;
+  private DiscoveryService fDiscoveryService;
+  private MultiFilingService fMultiFilingService;
+  private RelationshipService fRelationshipService;
+  private PolicyService fPolicyService;
+  private AclService fACLService;
+
+  /**
+   * Constructor.
+   */
+  public CmisWebServicesSpi() {
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.opencmis.client.provider.spi.CMISSPIFactory#getSPIInstance(org.apache.opencmis.client.provider
+   * .spi.Session)
+   */
+  public CmisSpi getSpiInstance(Session session) {
+    if (log.isDebugEnabled()) {
+      log.debug("Initializing Web Services SPI...");
+    }
+
+    fSession = session;
+    fPortProvider = new PortProvider(fSession);
+
+    return this;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.spi.CMISSPI#getRepositoryService()
+   */
+  public RepositoryService getRepositoryService() {
+    if (fRepositoryService == null) {
+      fRepositoryService = new RepositoryServiceImpl(fSession, fPortProvider);
+    }
+
+    return fRepositoryService;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.spi.CMISSPI#getNavigationService()
+   */
+  public NavigationService getNavigationService() {
+    if (fNavigationService == null) {
+      fNavigationService = new NavigationServiceImpl(fSession, fPortProvider);
+    }
+
+    return fNavigationService;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.spi.CMISSPI#getObjectService()
+   */
+  public ObjectService getObjectService() {
+    if (fObjectService == null) {
+      fObjectService = new ObjectServiceImpl(fSession, fPortProvider);
+    }
+
+    return fObjectService;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.spi.CMISSPI#getDiscoveryService()
+   */
+  public DiscoveryService getDiscoveryService() {
+    if (fDiscoveryService == null) {
+      fDiscoveryService = new DiscoveryServiceImpl(fSession, fPortProvider);
+    }
+
+    return fDiscoveryService;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.spi.CMISSPI#getVersioningService()
+   */
+  public VersioningService getVersioningService() {
+    if (fVersioningService == null) {
+      fVersioningService = new VersioningServiceImpl(fSession, fPortProvider);
+    }
+
+    return fVersioningService;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.spi.CMISSPI#getMultiFilingService()
+   */
+  public MultiFilingService getMultiFilingService() {
+    if (fMultiFilingService == null) {
+      fMultiFilingService = new MultiFilingServiceImpl(fSession, fPortProvider);
+    }
+
+    return fMultiFilingService;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.spi.CMISSPI#getRelationshipService()
+   */
+  public RelationshipService getRelationshipService() {
+    if (fRelationshipService == null) {
+      fRelationshipService = new RelationshipServiceImpl(fSession, fPortProvider);
+    }
+
+    return fRelationshipService;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.spi.CMISSPI#getPolicyService()
+   */
+  public PolicyService getPolicyService() {
+    if (fPolicyService == null) {
+      fPolicyService = new PolicyServiceImpl(fSession, fPortProvider);
+    }
+
+    return fPolicyService;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.spi.CMISSPI#getACLService()
+   */
+  public AclService getAclService() {
+    if (fACLService == null) {
+      fACLService = new AclServiceImpl(fSession, fPortProvider);
+    }
+
+    return fACLService;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.spi.CMISSPI#clearAllCaches()
+   */
+  public void clearAllCaches() {
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.spi.CMISSPI#clearRepositoryCache(java.lang.String)
+   */
+  public void clearRepositoryCache(String repositoryId) {
+  }
+
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/CmisWebServicesSpi.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/DiscoveryServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/DiscoveryServiceImpl.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/DiscoveryServiceImpl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/DiscoveryServiceImpl.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,112 @@
+/*
+ * 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.provider.spi.webservices;
+
+import static org.apache.opencmis.commons.impl.Converter.convert;
+import static org.apache.opencmis.commons.impl.Converter.convertHolder;
+import static org.apache.opencmis.commons.impl.Converter.setHolderValue;
+
+import java.math.BigInteger;
+
+import org.apache.opencmis.client.provider.spi.Session;
+import org.apache.opencmis.commons.api.ExtensionsData;
+import org.apache.opencmis.commons.enums.IncludeRelationships;
+import org.apache.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.opencmis.commons.impl.jaxb.CmisException;
+import org.apache.opencmis.commons.impl.jaxb.CmisObjectListType;
+import org.apache.opencmis.commons.impl.jaxb.DiscoveryServicePort;
+import org.apache.opencmis.commons.impl.jaxb.EnumIncludeRelationships;
+import org.apache.opencmis.commons.provider.DiscoveryService;
+import org.apache.opencmis.commons.provider.Holder;
+import org.apache.opencmis.commons.provider.ObjectList;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
+ * 
+ */
+public class DiscoveryServiceImpl extends AbstractWebServicesService implements DiscoveryService {
+
+  private PortProvider fPortProvider;
+
+  /**
+   * Constructor.
+   */
+  public DiscoveryServiceImpl(Session session, PortProvider portProvider) {
+    setSession(session);
+    fPortProvider = portProvider;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.DiscoveryService#getContentChanges(java.lang.String,
+   * org.apache.opencmis.client.provider.Holder, java.lang.Boolean, java.lang.String, java.lang.Boolean,
+   * java.lang.Boolean, java.math.BigInteger, org.apache.opencmis.client.provider.ExtensionsData)
+   */
+  public ObjectList getContentChanges(String repositoryId, Holder<String> changeLogToken,
+      Boolean includeProperties, String filter, Boolean includePolicyIds, Boolean includeACL,
+      BigInteger maxItems, ExtensionsData extension) {
+    DiscoveryServicePort port = fPortProvider.getDiscoveryServicePort();
+
+    try {
+      javax.xml.ws.Holder<String> portChangeLokToken = convertHolder(changeLogToken);
+      javax.xml.ws.Holder<CmisObjectListType> portObjects = new javax.xml.ws.Holder<CmisObjectListType>();
+
+      port.getContentChanges(repositoryId, portChangeLokToken, includeProperties, filter,
+          includePolicyIds, includeACL, maxItems, convert(extension), portObjects);
+
+      setHolderValue(portChangeLokToken, changeLogToken);
+
+      return convert(portObjects.value);
+    }
+    catch (CmisException e) {
+      throw convertException(e);
+    }
+    catch (Exception e) {
+      throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.DiscoveryService#query(java.lang.String, java.lang.String,
+   * java.lang.Boolean, java.lang.Boolean, org.apache.opencmis.commons.enums.IncludeRelationships,
+   * java.lang.String, java.math.BigInteger, java.math.BigInteger,
+   * org.apache.opencmis.client.provider.ExtensionsData)
+   */
+  public ObjectList query(String repositoryId, String statement, Boolean searchAllVersions,
+      Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+      String renditionFilter, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+    DiscoveryServicePort port = fPortProvider.getDiscoveryServicePort();
+
+    try {
+      return convert(port.query(repositoryId, statement, searchAllVersions,
+          includeAllowableActions, convert(EnumIncludeRelationships.class, includeRelationships),
+          renditionFilter, maxItems, skipCount, convert(extension)));
+    }
+    catch (CmisException e) {
+      throw convertException(e);
+    }
+    catch (Exception e) {
+      throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+    }
+  }
+
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/DiscoveryServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message