Mercurial > hg > AnnotationManagerN4J
annotate src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationsUiRestlet.java @ 50:64aa756c60cc
annotations ui can show and delete annotations now.
author | casties |
---|---|
date | Thu, 27 Sep 2012 17:12:08 +0200 |
parents | f30f42080711 |
children | fc4c23247bb5 |
rev | line source |
---|---|
18 | 1 /** |
2 * | |
3 */ | |
23
d22d01ba953a
reorganised code for annotations and groups ui. work in progress.
casties
parents:
22
diff
changeset
|
4 package de.mpiwg.itgroup.annotations.restlet.annotations_ui; |
18 | 5 |
6 import org.apache.log4j.Logger; | |
7 import org.restlet.Context; | |
8 import org.restlet.Restlet; | |
49 | 9 import org.restlet.data.ChallengeScheme; |
18 | 10 import org.restlet.routing.Router; |
49 | 11 import org.restlet.security.ChallengeAuthenticator; |
12 import org.restlet.security.MapVerifier; | |
18 | 13 |
23
d22d01ba953a
reorganised code for annotations and groups ui. work in progress.
casties
parents:
22
diff
changeset
|
14 import de.mpiwg.itgroup.annotations.restlet.BaseRestlet; |
d22d01ba953a
reorganised code for annotations and groups ui. work in progress.
casties
parents:
22
diff
changeset
|
15 |
18 | 16 /** |
17 * @author casties | |
18 * | |
19 */ | |
23
d22d01ba953a
reorganised code for annotations and groups ui. work in progress.
casties
parents:
22
diff
changeset
|
20 public class AnnotationsUiRestlet extends BaseRestlet { |
18 | 21 |
50 | 22 public final String version = "AnnotationManagerN4J/AnnotationsUI 0.3"; |
18 | 23 |
23
d22d01ba953a
reorganised code for annotations and groups ui. work in progress.
casties
parents:
22
diff
changeset
|
24 public static Logger logger = Logger.getLogger(AnnotationsUiRestlet.class); |
18 | 25 |
23
d22d01ba953a
reorganised code for annotations and groups ui. work in progress.
casties
parents:
22
diff
changeset
|
26 public AnnotationsUiRestlet(Context context) { |
18 | 27 super(context); |
50 | 28 logger.info(version); |
18 | 29 } |
30 | |
31 /* | |
32 * (non-Javadoc) | |
33 * | |
34 * @see org.restlet.Application#createInboundRoot() | |
35 */ | |
36 @Override | |
37 public Restlet createInboundRoot() { | |
38 // this.authenticator = createAuthenticator(); | |
39 | |
40 Router router = new Router(getContext()); | |
41 | |
23
d22d01ba953a
reorganised code for annotations and groups ui. work in progress.
casties
parents:
22
diff
changeset
|
42 router.attach("/groups", GroupsResource.class); |
d22d01ba953a
reorganised code for annotations and groups ui. work in progress.
casties
parents:
22
diff
changeset
|
43 router.attach("/groups/", GroupsResource.class); |
d22d01ba953a
reorganised code for annotations and groups ui. work in progress.
casties
parents:
22
diff
changeset
|
44 router.attach("/groups/{id}", GroupResource.class); |
d22d01ba953a
reorganised code for annotations and groups ui. work in progress.
casties
parents:
22
diff
changeset
|
45 router.attach("/groups/{id}/", GroupResource.class); |
d22d01ba953a
reorganised code for annotations and groups ui. work in progress.
casties
parents:
22
diff
changeset
|
46 router.attach("/groups/{id}/members", GroupMembersResource.class); |
32
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
23
diff
changeset
|
47 router.attach("/persons", PersonsResource.class); |
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
23
diff
changeset
|
48 router.attach("/persons/", PersonsResource.class); |
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
23
diff
changeset
|
49 router.attach("/persons/{id}", PersonResource.class); |
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
23
diff
changeset
|
50 router.attach("/persons/{id}/", PersonResource.class); |
50 | 51 router.attach("/annotations", AnnotationsResource.class); |
52 router.attach("/annotations/", AnnotationsResource.class); | |
53 router.attach("/annotations/{id}", AnnotationResource.class); | |
54 router.attach("/annotations/{id}/", AnnotationResource.class); | |
18 | 55 |
23
d22d01ba953a
reorganised code for annotations and groups ui. work in progress.
casties
parents:
22
diff
changeset
|
56 router.attach("/", InfoResource.class); |
18 | 57 |
50 | 58 // use simple password verifier |
49 | 59 MapVerifier verifier = new MapVerifier(); |
50 | 60 // get user name and password |
61 String user = serverConfig.getProperty(BaseRestlet.ADMIN_USER_KEY); | |
62 String pw = serverConfig.getProperty(BaseRestlet.ADMIN_PASSWORD_KEY); | |
63 verifier.getLocalSecrets().put(user, pw.toCharArray()); | |
49 | 64 // Create a Guard |
65 ChallengeAuthenticator guard = new ChallengeAuthenticator(getContext(), ChallengeScheme.HTTP_BASIC, "Tutorial"); | |
66 guard.setVerifier(verifier); | |
67 // put everything through guard | |
68 guard.setNext(router); | |
69 return guard; | |
18 | 70 } |
71 | |
72 @Override | |
73 public String getVersion() { | |
74 return version; | |
75 } | |
76 | |
77 } |