1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
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  
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 }