1 | package clarin.cmdi.componentregistry; |
---|
2 | |
---|
3 | import clarin.cmdi.componentregistry.components.CMDComponentSpec; |
---|
4 | import clarin.cmdi.componentregistry.model.BaseDescription; |
---|
5 | import clarin.cmdi.componentregistry.model.Comment; |
---|
6 | import clarin.cmdi.componentregistry.model.ComponentDescription; |
---|
7 | import clarin.cmdi.componentregistry.model.ProfileDescription; |
---|
8 | import java.io.IOException; |
---|
9 | import java.io.OutputStream; |
---|
10 | import java.security.Principal; |
---|
11 | import java.util.List; |
---|
12 | |
---|
13 | /** |
---|
14 | * @author twagoo@mpi.nl |
---|
15 | * @author george.georgovassilis@mpi.nl |
---|
16 | * |
---|
17 | */ |
---|
18 | public interface ComponentRegistry { |
---|
19 | |
---|
20 | // Attention! REGISTRY_ID here and the client's Config.REGISTRY_ID must be the same |
---|
21 | // If you change REGISTRY_ID here, then change the client's Config.REGISTRY_ID |
---|
22 | public static final String REGISTRY_ID = "clarin.eu:cr1:"; |
---|
23 | public static final String PUBLIC_NAME = "Public Registry"; |
---|
24 | |
---|
25 | |
---|
26 | |
---|
27 | public Owner getRegistryOwner(); |
---|
28 | public void setRegistryOwner(Owner registryOwner); |
---|
29 | |
---|
30 | public RegistrySpace getRegistrySpace(); |
---|
31 | public void setRegistrySpace(RegistrySpace registrySpace); |
---|
32 | |
---|
33 | public Number getGroupId(); |
---|
34 | public void setGroupId(Number groupId); |
---|
35 | |
---|
36 | public Number getBaseDescriptionOwnerId(String cmdId); |
---|
37 | |
---|
38 | public List<Number> getItemGroups(String cmdId); |
---|
39 | /** |
---|
40 | * @return List of component descriptions ordered by name ascending |
---|
41 | * @throws ComponentRegistryException |
---|
42 | */ |
---|
43 | List<ComponentDescription> getComponentDescriptions() throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException; |
---|
44 | |
---|
45 | |
---|
46 | ComponentDescription getComponentDescriptionAccessControlled(String id) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException; |
---|
47 | |
---|
48 | |
---|
49 | /** |
---|
50 | * |
---|
51 | * @return List of profile descriptions ordered by name ascending |
---|
52 | * @throws ComponentRegistryException |
---|
53 | */ |
---|
54 | List<ProfileDescription> getProfileDescriptions() throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException; |
---|
55 | |
---|
56 | |
---|
57 | /** |
---|
58 | * |
---|
59 | * @return List of profile descriptions ordered by name ascending, only the ones marked for showing in metadata editor |
---|
60 | * @throws ComponentRegistryException |
---|
61 | */ |
---|
62 | List<ProfileDescription> getProfileDescriptionsForMetadaEditor() throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException; |
---|
63 | |
---|
64 | /** |
---|
65 | * @param groupId |
---|
66 | * @return List of profile descriptions ordered by name ascending, only the ones marked for showing in metadata editor |
---|
67 | * @throws ComponentRegistryException |
---|
68 | */ |
---|
69 | List<ProfileDescription> getProfileDescriptionsForMetadaEditor(Number groupId) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException; |
---|
70 | |
---|
71 | ProfileDescription getProfileDescriptionAccessControlled(String id) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException; |
---|
72 | |
---|
73 | CMDComponentSpec getMDProfileAccessControled(String id) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException; |
---|
74 | |
---|
75 | CMDComponentSpec getMDComponentAccessControlled(String id) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException; |
---|
76 | |
---|
77 | CMDComponentSpec getMDComponent(String id) throws ComponentRegistryException; |
---|
78 | /** |
---|
79 | * |
---|
80 | * @return -1 if profile could not be registered |
---|
81 | */ |
---|
82 | int register(BaseDescription desc, CMDComponentSpec spec); |
---|
83 | |
---|
84 | /** |
---|
85 | * |
---|
86 | * @param comment |
---|
87 | * @return -1 if comment could not be registered |
---|
88 | */ |
---|
89 | int registerComment(Comment comment, String userId) throws ComponentRegistryException, ItemNotFoundException, UserUnauthorizedException; |
---|
90 | |
---|
91 | /** |
---|
92 | * |
---|
93 | * @return -1 if component could not be updated |
---|
94 | */ |
---|
95 | int update(BaseDescription description, CMDComponentSpec spec, boolean forceUpdate) throws UserUnauthorizedException, ItemNotFoundException; |
---|
96 | |
---|
97 | /** |
---|
98 | * |
---|
99 | * @return -1 if component could not be published. Published means move from |
---|
100 | * current (private) workspace to public workspace. |
---|
101 | */ |
---|
102 | int publish(BaseDescription desc, CMDComponentSpec spec, Principal principal) throws UserUnauthorizedException, ItemNotFoundException; |
---|
103 | |
---|
104 | void getMDProfileAsXml(String profileId, OutputStream output) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException; |
---|
105 | |
---|
106 | void getMDProfileAsXsd(String profileId, OutputStream outputStream) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException; |
---|
107 | |
---|
108 | void getMDComponentAsXml(String componentId, OutputStream output) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException; |
---|
109 | |
---|
110 | void getMDComponentAsXsd(String componentId, OutputStream outputStream) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException; |
---|
111 | |
---|
112 | /** |
---|
113 | * |
---|
114 | * @param profileIds |
---|
115 | * @throws IOException |
---|
116 | * @throws UserUnauthorizedException |
---|
117 | * thrown when principal does not match creator of profile |
---|
118 | * @throws DeleteFailedException |
---|
119 | */ |
---|
120 | void deleteMDProfile(String profileId) throws IOException, UserUnauthorizedException, ComponentRegistryException, DeleteFailedException, ItemNotFoundException; |
---|
121 | |
---|
122 | /** |
---|
123 | * |
---|
124 | * @param componentId |
---|
125 | * @param principal |
---|
126 | * @param forceDelete |
---|
127 | * ignores the fact that the component is still in use by other |
---|
128 | * components and just deletes. |
---|
129 | * @throws IOException |
---|
130 | * @throws UserUnauthorizedException |
---|
131 | * thrown when principal does not match creator of component |
---|
132 | * @throws DeleteFailedException |
---|
133 | */ |
---|
134 | void deleteMDComponent(String componentId, boolean forceDelete) throws IOException, ComponentRegistryException, UserUnauthorizedException, |
---|
135 | DeleteFailedException, ItemNotFoundException; |
---|
136 | |
---|
137 | /** |
---|
138 | * |
---|
139 | * @param componentId |
---|
140 | * @return List of ComponentDescriptions of Components that use the given |
---|
141 | * Component. |
---|
142 | */ |
---|
143 | List<ComponentDescription> getUsageInComponents(String componentId) throws ComponentRegistryException; |
---|
144 | |
---|
145 | /** |
---|
146 | * |
---|
147 | * @param componentId |
---|
148 | * @return List of ProfileDescriptions of Profiles that use the given |
---|
149 | * Component. |
---|
150 | */ |
---|
151 | List<ProfileDescription> getUsageInProfiles(String componentId) throws ComponentRegistryException; |
---|
152 | |
---|
153 | |
---|
154 | |
---|
155 | /** |
---|
156 | * @return {@link ComponentRegistry.PUBLIC_NAME} or name of the user's workspace |
---|
157 | */ |
---|
158 | String getName(); |
---|
159 | |
---|
160 | /** |
---|
161 | * |
---|
162 | * @return List of profile descriptions ordered by name ascending |
---|
163 | */ |
---|
164 | List<ProfileDescription> getDeletedProfileDescriptions()throws ComponentRegistryException; |
---|
165 | |
---|
166 | /** |
---|
167 | * |
---|
168 | * @return List of component descriptions ordered by name ascending |
---|
169 | */ |
---|
170 | List<ComponentDescription> getDeletedComponentDescriptions() throws ComponentRegistryException; |
---|
171 | |
---|
172 | /** |
---|
173 | * |
---|
174 | * @param profileId |
---|
175 | * @return List of comments fro a specific profile |
---|
176 | * @throws ComponentRegistryException |
---|
177 | */ |
---|
178 | List<Comment> getCommentsInProfile(String profileId) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException; |
---|
179 | |
---|
180 | /** |
---|
181 | * |
---|
182 | * @param profileId Id of profile to retrieve comment from |
---|
183 | * @param commentId Id of comment to retrieve |
---|
184 | * @return a specific comment from a profile |
---|
185 | * @throws ComponentRegistryException |
---|
186 | */ |
---|
187 | Comment getSpecifiedCommentInProfile(String profileId, String commentId) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException; |
---|
188 | |
---|
189 | /** |
---|
190 | * |
---|
191 | * @param componentId |
---|
192 | * @return List of comments from a specific component |
---|
193 | * @throws ComponentRegistryException |
---|
194 | */ |
---|
195 | List<Comment> getCommentsInComponent(String componentId) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException; |
---|
196 | |
---|
197 | /** |
---|
198 | * |
---|
199 | * @param componentId Id of component to retrieve comment from |
---|
200 | * @param commentId Id of comment to retrieve |
---|
201 | * @return a specific comment from a component |
---|
202 | * @throws ComponentRegistryException |
---|
203 | */ |
---|
204 | Comment getSpecifiedCommentInComponent(String componentId, String commentId) throws ComponentRegistryException, UserUnauthorizedException, ItemNotFoundException; |
---|
205 | |
---|
206 | /** |
---|
207 | * |
---|
208 | * @param commentId Id of comment to delete |
---|
209 | * @param principal User principal |
---|
210 | * @throws IOException |
---|
211 | * @throws ComponentRegistryException When comment cannot be successfully retrieved from registry |
---|
212 | * @throws UserUnauthorizedException |
---|
213 | * @throws DeleteFailedException |
---|
214 | */ |
---|
215 | public void deleteComment(String commentId) throws IOException, UserUnauthorizedException, |
---|
216 | DeleteFailedException, ItemNotFoundException; |
---|
217 | |
---|
218 | /** |
---|
219 | * |
---|
220 | * @return a component specification expander for this registry |
---|
221 | */ |
---|
222 | public CMDComponentSpecExpander getExpander(); |
---|
223 | |
---|
224 | /** |
---|
225 | * Get a list of ids ({@link BaseDescription#getId()}) of all non-deleted profiles |
---|
226 | * @return |
---|
227 | */ |
---|
228 | List<String> getAllNonDeletedProfileIds(); |
---|
229 | |
---|
230 | /** |
---|
231 | * Get a list of ids ({@link BaseDescription#getId()}) of all non-deleted components |
---|
232 | * @return |
---|
233 | */ |
---|
234 | List<String> getAllNonDeletedComponentIds(); |
---|
235 | |
---|
236 | Boolean isItemPublic(String id) throws ItemNotFoundException; |
---|
237 | |
---|
238 | Number makeGroupMember(String principalName, String groupName) throws UserUnauthorizedException, ItemNotFoundException; |
---|
239 | |
---|
240 | //long removeGroupMember(String principalName, String groupName) throws UserUnauthorizedException, ItemNotFoundException; |
---|
241 | |
---|
242 | } |
---|