1 | package clarin.cmdi.componentregistry; |
---|
2 | |
---|
3 | import java.io.IOException; |
---|
4 | import java.io.OutputStream; |
---|
5 | import java.security.Principal; |
---|
6 | import java.util.List; |
---|
7 | |
---|
8 | import clarin.cmdi.componentregistry.components.CMDComponentSpec; |
---|
9 | import clarin.cmdi.componentregistry.model.AbstractDescription; |
---|
10 | import clarin.cmdi.componentregistry.model.Comment; |
---|
11 | import clarin.cmdi.componentregistry.model.ComponentDescription; |
---|
12 | import clarin.cmdi.componentregistry.model.ProfileDescription; |
---|
13 | |
---|
14 | public interface ComponentRegistry { |
---|
15 | |
---|
16 | public static final String REGISTRY_ID = "clarin.eu:cr1:"; |
---|
17 | public static final String PUBLIC_NAME = "Public Registry"; |
---|
18 | |
---|
19 | /** |
---|
20 | * |
---|
21 | * @return List of component descriptions ordered by name ascending |
---|
22 | * @throws ComponentRegistryException |
---|
23 | */ |
---|
24 | List<ComponentDescription> getComponentDescriptions() throws ComponentRegistryException; |
---|
25 | |
---|
26 | ComponentDescription getComponentDescription(String id) throws ComponentRegistryException; |
---|
27 | |
---|
28 | /** |
---|
29 | * |
---|
30 | * @return List of profile descriptions ordered by name ascending |
---|
31 | * @throws ComponentRegistryException |
---|
32 | */ |
---|
33 | List<ProfileDescription> getProfileDescriptions() throws ComponentRegistryException; |
---|
34 | |
---|
35 | |
---|
36 | //List<Comment> getComments() throws ComponentRegistryException; |
---|
37 | |
---|
38 | /** |
---|
39 | * |
---|
40 | * @return List of profile descriptions ordered by name ascending, only the ones marked for showing in metadata editor |
---|
41 | * @throws ComponentRegistryException |
---|
42 | */ |
---|
43 | List<ProfileDescription> getProfileDescriptionsForMetadaEditor() throws ComponentRegistryException; |
---|
44 | |
---|
45 | ProfileDescription getProfileDescription(String id) throws ComponentRegistryException; |
---|
46 | |
---|
47 | CMDComponentSpec getMDProfile(String id) throws ComponentRegistryException; |
---|
48 | |
---|
49 | CMDComponentSpec getMDComponent(String id) throws ComponentRegistryException; |
---|
50 | //CMDComponentSpec getMDComment(String id) throws ComponentRegistryException; |
---|
51 | |
---|
52 | /** |
---|
53 | * |
---|
54 | * @return -1 if profile could not be registered |
---|
55 | */ |
---|
56 | int register(AbstractDescription desc, CMDComponentSpec spec); |
---|
57 | |
---|
58 | |
---|
59 | int registerComment(Comment comment, Comment spec); |
---|
60 | /** |
---|
61 | * |
---|
62 | * @return -1 if component could not be updated |
---|
63 | */ |
---|
64 | int update(AbstractDescription description, CMDComponentSpec spec, Principal principal, boolean forceUpdate); |
---|
65 | |
---|
66 | /** |
---|
67 | * |
---|
68 | * @return -1 if component could not be published. Published means move from |
---|
69 | * current (private) workspace to public workspace. |
---|
70 | */ |
---|
71 | int publish(AbstractDescription desc, CMDComponentSpec spec, Principal principal); |
---|
72 | |
---|
73 | void getMDProfileAsXml(String profileId, OutputStream output) throws ComponentRegistryException; |
---|
74 | |
---|
75 | void getMDProfileAsXsd(String profileId, OutputStream outputStream) throws ComponentRegistryException; |
---|
76 | |
---|
77 | void getMDComponentAsXml(String componentId, OutputStream output) throws ComponentRegistryException; |
---|
78 | |
---|
79 | void getMDComponentAsXsd(String componentId, OutputStream outputStream) throws ComponentRegistryException; |
---|
80 | |
---|
81 | /** |
---|
82 | * |
---|
83 | * @param profileId |
---|
84 | * @param principal |
---|
85 | * @throws IOException |
---|
86 | * @throws UserUnauthorizedException |
---|
87 | * thrown when principal does not match creator of profile |
---|
88 | * @throws DeleteFailedException |
---|
89 | */ |
---|
90 | void deleteMDProfile(String profileId, Principal principal) throws IOException, UserUnauthorizedException, ComponentRegistryException, DeleteFailedException; |
---|
91 | |
---|
92 | /** |
---|
93 | * |
---|
94 | * @param componentId |
---|
95 | * @param principal |
---|
96 | * @param forceDelete |
---|
97 | * ignores the fact that the component is still in use by other |
---|
98 | * components and just deletes. |
---|
99 | * @throws IOException |
---|
100 | * @throws UserUnauthorizedException |
---|
101 | * thrown when principal does not match creator of component |
---|
102 | * @throws DeleteFailedException |
---|
103 | */ |
---|
104 | void deleteMDComponent(String componentId, Principal principal, boolean forceDelete) throws IOException, ComponentRegistryException, UserUnauthorizedException, |
---|
105 | DeleteFailedException; |
---|
106 | |
---|
107 | |
---|
108 | //void deleteMDComment(String commentId, Principal principal)throws IOException, UserUnauthorizedException, ComponentRegistryException, DeleteFailedException; |
---|
109 | /** |
---|
110 | * |
---|
111 | * @param componentId |
---|
112 | * @return List of ComponentDescriptions of Components that use the given |
---|
113 | * Component. |
---|
114 | */ |
---|
115 | List<ComponentDescription> getUsageInComponents(String componentId) throws ComponentRegistryException; |
---|
116 | |
---|
117 | /** |
---|
118 | * |
---|
119 | * @param componentId |
---|
120 | * @return List of ProfileDescriptions of Profiles that use the given |
---|
121 | * Component. |
---|
122 | */ |
---|
123 | List<ProfileDescription> getUsageInProfiles(String componentId) throws ComponentRegistryException; |
---|
124 | |
---|
125 | /** |
---|
126 | * Return true if this registry is the public registry as opposed to a |
---|
127 | * registry used for the user privately. |
---|
128 | **/ |
---|
129 | boolean isPublic(); |
---|
130 | |
---|
131 | /** |
---|
132 | * @return {@link ComponentRegistry.PUBLIC_NAME} or name of the user's workspace |
---|
133 | */ |
---|
134 | String getName(); |
---|
135 | |
---|
136 | /** |
---|
137 | * |
---|
138 | * @return List of profile descriptions ordered by name ascending |
---|
139 | */ |
---|
140 | List<ProfileDescription> getDeletedProfileDescriptions(); |
---|
141 | |
---|
142 | /** |
---|
143 | * |
---|
144 | * @return List of component descriptions ordered by name ascending |
---|
145 | */ |
---|
146 | List<ComponentDescription> getDeletedComponentDescriptions(); |
---|
147 | |
---|
148 | |
---|
149 | List<Comment> getCommentsInProfile(String profileId) throws ComponentRegistryException; |
---|
150 | |
---|
151 | |
---|
152 | |
---|
153 | Comment getSpecifiedCommentInProfile(String commentId) throws ComponentRegistryException; |
---|
154 | |
---|
155 | List<Comment> getCommentsInComponent(String componentId) throws ComponentRegistryException; |
---|
156 | Comment getSpecifiedCommentInComponent(String commentId) throws ComponentRegistryException; |
---|
157 | |
---|
158 | public void deleteComment(String commentId, Principal principal)throws IOException, ComponentRegistryException, UserUnauthorizedException, |
---|
159 | DeleteFailedException;; |
---|
160 | |
---|
161 | |
---|
162 | |
---|
163 | |
---|
164 | } |
---|