1 | /** |
---|
2 | * |
---|
3 | */ |
---|
4 | package de.mpiwg.itgroup.annotations.restlet; |
---|
5 | |
---|
6 | /* |
---|
7 | * #%L |
---|
8 | * AnnotationManager |
---|
9 | * %% |
---|
10 | * Copyright (C) 2012 - 2014 MPIWG Berlin |
---|
11 | * %% |
---|
12 | * This program is free software: you can redistribute it and/or modify |
---|
13 | * it under the terms of the GNU Lesser General Public License as |
---|
14 | * published by the Free Software Foundation, either version 3 of the |
---|
15 | * License, or (at your option) any later version. |
---|
16 | * |
---|
17 | * This program is distributed in the hope that it will be useful, |
---|
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
20 | * GNU General Lesser Public License for more details. |
---|
21 | * |
---|
22 | * You should have received a copy of the GNU General Lesser Public |
---|
23 | * License along with this program. If not, see |
---|
24 | * <http://www.gnu.org/licenses/lgpl-3.0.html>. |
---|
25 | * #L% |
---|
26 | */ |
---|
27 | |
---|
28 | import org.apache.log4j.Logger; |
---|
29 | import org.restlet.Context; |
---|
30 | import org.restlet.Restlet; |
---|
31 | import org.restlet.routing.Router; |
---|
32 | |
---|
33 | /** |
---|
34 | * @author casties |
---|
35 | * |
---|
36 | */ |
---|
37 | public class AnnotatorRestlet extends BaseRestlet { |
---|
38 | |
---|
39 | public final String version = "AnnotationManagerN4J/Annotator 0.3.2"; |
---|
40 | |
---|
41 | public static Logger logger = Logger.getLogger(AnnotatorRestlet.class); |
---|
42 | |
---|
43 | /** |
---|
44 | * @param context |
---|
45 | */ |
---|
46 | public AnnotatorRestlet(Context context) { |
---|
47 | super(context); |
---|
48 | logger.debug("AnnotatorRestlet!"); |
---|
49 | } |
---|
50 | |
---|
51 | /* |
---|
52 | * (non-Javadoc) |
---|
53 | * |
---|
54 | * @see org.restlet.Application#createInboundRoot() |
---|
55 | */ |
---|
56 | @Override |
---|
57 | public Restlet createInboundRoot() { |
---|
58 | // this.authenticator = createAuthenticator(); |
---|
59 | |
---|
60 | Router router = new Router(getContext()); |
---|
61 | |
---|
62 | router.attach("/annotations", AnnotatorAnnotations.class); |
---|
63 | router.attach("/annotations/{id}", AnnotatorAnnotations.class); |
---|
64 | router.attach("/search", AnnotatorSearch.class); |
---|
65 | router.attach("/groups", AnnotatorGroups.class); |
---|
66 | router.attach("/tags", AnnotatorTags.class); |
---|
67 | router.attach("/tags/{id}", AnnotatorTags.class); |
---|
68 | router.attach("/tags/{id}/annotations", AnnotatorAnnotationsByTags.class); |
---|
69 | router.attach("/resources", AnnotatorResources.class); |
---|
70 | router.attach("/resources/{id}", AnnotatorResources.class); |
---|
71 | router.attach("/resources/{id}/annotations", AnnotatorAnnotationsByResources.class); |
---|
72 | router.attach("/", AnnotatorInfo.class); |
---|
73 | // authenticator.setNext(router); |
---|
74 | // return authenticator; |
---|
75 | |
---|
76 | return router; |
---|
77 | } |
---|
78 | |
---|
79 | /* (non-Javadoc) |
---|
80 | * @see de.mpiwg.itgroup.annotations.restlet.RestletImpl#getVersion() |
---|
81 | */ |
---|
82 | @Override |
---|
83 | public String getVersion() { |
---|
84 | return version; |
---|
85 | } |
---|
86 | |
---|
87 | } |
---|