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.inmemory.storedobj.api;
20
21 import java.math.BigInteger;
22 import java.util.Collection;
23 import java.util.List;
24
25 import org.apache.chemistry.opencmis.commons.data.ObjectList;
26 import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
27 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
28 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
29 import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
30
31 /**
32 * interface to a repository implementation. This interface is the entry point
33 * to a repository that can persist CMIS objects. Using this interface the type
34 * information can be retrieved or set, a repository can be created or for a
35 * given repository the store can be retrieved.
36 *
37 * @author Jens
38 */
39 public interface StoreManager {
40
41 /**
42 * return a list of all available repositories
43 *
44 * @return
45 */
46 List<String> getAllRepositoryIds();
47
48 /**
49 * Initialize the store for the given repository. Only called for
50 * repositories that exist on startup (i.e. for each repository id returned
51 * in a previous getAllRepositoryIds() call.
52 *
53 * @param repositoryId
54 * id of repository to initialize
55 * @param isCreated
56 * true if the repository was just created and is initialized for
57 * the first time false if it existed before and is reloaded
58 */
59 void initRepository(String repositoryId);
60
61 /**
62 * get the object store for the given repository id.
63 *
64 * @param repositoryId
65 * @return the object store in which objects for this repository are stored.
66 */
67 ObjectStore getObjectStore(String repositoryId);
68
69 /**
70 * get a permission and parameter validating instance
71 *
72 * @return
73 * validator and permission checker
74 */
75 CmisServiceValidator getServiceValidator();
76
77 /**
78 * create a new repository with the given id. Create the repository,
79 * initiate the type system and initialize it so that it is ready for use
80 *
81 * @param repositoryId
82 * id of repository
83 * @param typeCreatorClassName
84 * class implementing the type creation, the class must implement
85 * the interface TypeCreator
86 */
87 void createAndInitRepository(String repositoryId, String typeCreatorClassName);
88
89 /**
90 * retrieve a list with all type definitions.
91 *
92 * @param repositoryId
93 * id of repository
94 * @param includePropertyDefinitions
95 * indicates whether to include property definitions in returned
96 * type
97 * @return map with type definition
98 */
99 Collection<TypeDefinitionContainer> getTypeDefinitionList(String repositoryId, boolean includePropertyDefinitions);
100
101 /**
102 * Retrieve a type definition for a give repository and type id
103 *
104 * @param repositoryId
105 * id of repository
106 * @param typeId
107 * id of type definition
108 * @return type definition
109 */
110 TypeDefinitionContainer getTypeById(String repositoryId, String typeId);
111
112 /**
113 * Retrieve a type definition for a give repository and type id with or
114 * without property definitions and limited to depth in hierarchy
115 *
116 * @param repositoryId
117 * id of repository
118 * @param typeId
119 * id of type definition
120 * @param includePropertyDefinitions
121 * indicates whether to include property definitions in returned
122 * type
123 * @param depth
124 * limit depth of type hierarchy in return (-1 means unlimited)
125 * @return type definition
126 */
127 TypeDefinitionContainer getTypeById(String repositoryId, String typeId, boolean includePropertyDefinitions,
128 int depth);
129
130 /**
131 * Retrieve a factory to create CMIS data structures used as containers
132 *
133 * @return factory object
134 */
135 BindingsObjectFactory getObjectFactory();
136
137 /**
138 * Retrieve a list of root types in the repositories. Root types are
139 * available by definition and need to to be created by a client. CMIS
140 * supports documents, folders, relations and policies as root types
141 *
142 * @param repositoryId
143 * id of repository
144 * @return list of root types
145 */
146 List<TypeDefinitionContainer> getRootTypes(String repositoryId);
147
148 /**
149 * Retrieve the repository information for a repository
150 *
151 * @param repositoryId
152 * id of repository
153 * @return repository information
154 */
155 RepositoryInfo getRepositoryInfo(String repositoryId);
156
157 /**
158 * retrieve the type manager for a given repository
159 * @param repositoryId
160 * id of repository
161 * @return
162 * type manager for this repository or null if repository is unknown
163 */
164 TypeManagerCreatable getTypeManager(String repositoryId);
165
166 /**
167 * Execute a query against the repository (same parameter as the discovery service
168 * query method
169 *
170 * @param user
171 * @param repositoryId
172 * @param statement
173 * @param searchAllVersions
174 * @param includeAllowableActions
175 * @param includeRelationships
176 * @param renditionFilter
177 * @param maxItems
178 * @param skipCount
179 * @return
180 */
181 ObjectList query(String user, String repositoryId, String statement, Boolean searchAllVersions,
182 Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
183 BigInteger maxItems, BigInteger skipCount);
184
185 }