View Javadoc
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 org.apache.chemistry.opencmis.commons.data.ExtensionsData;
22  import org.apache.chemistry.opencmis.commons.data.ObjectData;
23  import org.apache.chemistry.opencmis.commons.data.ObjectInFolderList;
24  import org.apache.chemistry.opencmis.commons.data.ObjectParentData;
25  import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
26  import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
27  import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
28  import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
29  import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
30  import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
31  import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl;
32  import org.apache.chemistry.opencmis.commons.impl.server.AbstractCmisService;
33  
34  import java.math.BigInteger;
35  
36  import java.util.Collections;
37  import java.util.List;
38  
39  
40  /**
41   * Simplest Repository Service implementation.
42   */
43  public class DummyService extends AbstractCmisService
44  {
45      private final RepositoryInfoImpl fRepInfo;
46  
47      public DummyService( String id, String name )
48      {
49          fRepInfo = new RepositoryInfoImpl(  );
50  
51          fRepInfo.setId( id );
52          fRepInfo.setName( name );
53          fRepInfo.setDescription( name );
54          fRepInfo.setCmisVersionSupported( "1.0" );
55          fRepInfo.setRootFolder( "root" );
56  
57          fRepInfo.setVendorName( "OpenCMIS" );
58          fRepInfo.setProductName( "OpenCMIS Server" );
59          fRepInfo.setProductVersion( "1.0" );
60      }
61  
62      @Override
63      public RepositoryInfo getRepositoryInfo( String repositoryId, ExtensionsData extension )
64      {
65          if ( !fRepInfo.getId(  ).equals( repositoryId ) )
66          {
67              throw new CmisObjectNotFoundException( "A repository with repository id '" + repositoryId +
68                  "' does not exist!" );
69          }
70  
71          return fRepInfo;
72      }
73  
74      @Override
75      public List<RepositoryInfo> getRepositoryInfos( ExtensionsData extension )
76      {
77          return Collections.singletonList( (RepositoryInfo) fRepInfo );
78      }
79  
80      @Override
81      public ObjectInFolderList getChildren( String repositoryId, String folderId, String filter, String orderBy,
82          Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
83          Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension )
84      {
85          throw new CmisNotSupportedException(  );
86      }
87  
88      @Override
89      public ObjectData getObject( String repositoryId, String objectId, String filter, Boolean includeAllowableActions,
90          IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
91          Boolean includeAcl, ExtensionsData extension )
92      {
93          throw new CmisNotSupportedException(  );
94      }
95  
96      @Override
97      public List<ObjectParentData> getObjectParents( String repositoryId, String objectId, String filter,
98          Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
99          Boolean includeRelativePathSegment, ExtensionsData extension )
100     {
101         throw new CmisNotSupportedException(  );
102     }
103 
104     @Override
105     public TypeDefinitionList getTypeChildren( String repositoryId, String typeId, Boolean includePropertyDefinitions,
106         BigInteger maxItems, BigInteger skipCount, ExtensionsData extension )
107     {
108         throw new CmisNotSupportedException(  );
109     }
110 
111     @Override
112     public TypeDefinition getTypeDefinition( String repositoryId, String typeId, ExtensionsData extension )
113     {
114         throw new CmisNotSupportedException(  );
115     }
116 }