This project has retired. For details please refer to its Attic page.
DummyService xref

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   * http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.chemistry.opencmis.server.impl.dummy;
20  
21  import java.math.BigInteger;
22  import java.util.Collections;
23  import java.util.List;
24  
25  import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
26  import org.apache.chemistry.opencmis.commons.data.ObjectData;
27  import org.apache.chemistry.opencmis.commons.data.ObjectInFolderList;
28  import org.apache.chemistry.opencmis.commons.data.ObjectParentData;
29  import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
30  import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
31  import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
32  import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
33  import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
34  import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
35  import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl;
36  import org.apache.chemistry.opencmis.commons.impl.server.AbstractCmisService;
37  
38  /**
39   * Simplest Repository Service implementation.
40   */
41  public class DummyService extends AbstractCmisService {
42  
43      private final RepositoryInfoImpl fRepInfo;
44  
45      public DummyService(String id, String name) {
46          fRepInfo = new RepositoryInfoImpl();
47  
48          fRepInfo.setId(id);
49          fRepInfo.setName(name);
50          fRepInfo.setDescription(name);
51          fRepInfo.setCmisVersionSupported("1.0");
52          fRepInfo.setRootFolder("root");
53  
54          fRepInfo.setVendorName("OpenCMIS");
55          fRepInfo.setProductName("OpenCMIS Server");
56          fRepInfo.setProductVersion("1.0");
57      }
58  
59      @Override
60      public RepositoryInfo getRepositoryInfo(String repositoryId,
61              ExtensionsData extension) {
62          if (!fRepInfo.getId().equals(repositoryId)) {
63              throw new CmisObjectNotFoundException(
64                      "A repository with repository id '" + repositoryId
65                              + "' does not exist!");
66          }
67  
68          return fRepInfo;
69      }
70  
71      @Override
72      public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
73          return Collections.singletonList((RepositoryInfo) fRepInfo);
74      }
75  
76      @Override
77      public ObjectInFolderList getChildren(String repositoryId, String folderId,
78              String filter, String orderBy, Boolean includeAllowableActions,
79              IncludeRelationships includeRelationships, String renditionFilter,
80              Boolean includePathSegment, BigInteger maxItems,
81              BigInteger skipCount, ExtensionsData extension) {
82          throw new CmisNotSupportedException();
83      }
84  
85      @Override
86      public ObjectData getObject(String repositoryId, String objectId,
87              String filter, Boolean includeAllowableActions,
88              IncludeRelationships includeRelationships, String renditionFilter,
89              Boolean includePolicyIds, Boolean includeAcl,
90              ExtensionsData extension) {
91          throw new CmisNotSupportedException();
92      }
93  
94      @Override
95      public List<ObjectParentData> getObjectParents(String repositoryId,
96              String objectId, String filter, Boolean includeAllowableActions,
97              IncludeRelationships includeRelationships, String renditionFilter,
98              Boolean includeRelativePathSegment, ExtensionsData extension) {
99          throw new CmisNotSupportedException();
100     }
101 
102     @Override
103     public TypeDefinitionList getTypeChildren(String repositoryId,
104             String typeId, Boolean includePropertyDefinitions,
105             BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
106         throw new CmisNotSupportedException();
107     }
108 
109     @Override
110     public TypeDefinition getTypeDefinition(String repositoryId, String typeId,
111             ExtensionsData extension) {
112         throw new CmisNotSupportedException();
113     }
114 }