Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
IOService | 36 | 0 | - | 0 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.annotation.io; | |
21 | ||
22 | import java.util.Collection; | |
23 | ||
24 | import org.xwiki.annotation.Annotation; | |
25 | import org.xwiki.component.annotation.Role; | |
26 | ||
27 | /** | |
28 | * This component provides services related to annotations storage and retrieval. It operates with string serialized | |
29 | * references for the targets of annotations. This interface does not restrict the implementation of the annotation | |
30 | * targets, they can be anything referencable through a string. | |
31 | * | |
32 | * @version $Id: 0079a74b20818ebd002d99741481988d406ec805 $ | |
33 | * @since 2.3M1 | |
34 | */ | |
35 | @Role | |
36 | public interface IOService | |
37 | { | |
38 | /** | |
39 | * Returns all the annotations on the passed content. | |
40 | * | |
41 | * @param target the string serialized reference to the content for which to get the annotations | |
42 | * @return all annotations which target the specified content | |
43 | * @throws IOServiceException if any exception occurs while manipulating annotations store | |
44 | */ | |
45 | Collection<Annotation> getAnnotations(String target) throws IOServiceException; | |
46 | ||
47 | /** | |
48 | * @param target the string serialized reference to the content for which the annotation is added | |
49 | * @param annotationID the identifier of the annotation | |
50 | * @return the annotation with the given id on the passed target | |
51 | * @throws IOServiceException if any exception occurs while manipulating annotations store | |
52 | */ | |
53 | Annotation getAnnotation(String target, String annotationID) throws IOServiceException; | |
54 | ||
55 | /** | |
56 | * Adds annotation on the specified target. | |
57 | * | |
58 | * @param target serialized reference of the target of the annotation | |
59 | * @param annotation annotation to add on the target | |
60 | * @throws IOServiceException can be thrown if any exception occurs while manipulating annotations store | |
61 | */ | |
62 | void addAnnotation(String target, Annotation annotation) throws IOServiceException; | |
63 | ||
64 | /** | |
65 | * Removes an annotation given by its identifier, which should be unique among all annotations on the same target. | |
66 | * | |
67 | * @param target serialized reference of the target of the annotation | |
68 | * @param annotationID annotation identifier | |
69 | * @throws IOServiceException can be thrown if any exception occurs while manipulating annotations store | |
70 | */ | |
71 | void removeAnnotation(String target, String annotationID) throws IOServiceException; | |
72 | ||
73 | /** | |
74 | * Updates the set of annotations in the annotations store. They will be identified by their identifiers as returned | |
75 | * by {@link Annotation#getId()}, and updated each to match the fields in the Annotation objects. | |
76 | * | |
77 | * @param target serialized reference of the target of the annotation | |
78 | * @param annotations collection of annotations to update | |
79 | * @throws IOServiceException can be thrown if any exception occurs while manipulating annotations store | |
80 | */ | |
81 | void updateAnnotations(String target, Collection<Annotation> annotations) throws IOServiceException; | |
82 | } |