AAA-159: Switch to using gson for JSON serialization
[aaa.git] / aaa-shiro / impl / src / main / java / org / opendaylight / aaa / shiro / idm / IdmLightApplication.java
1 /*
2  * Copyright (c) 2014, 2017 Hewlett-Packard Development Company, L.P. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.aaa.shiro.idm;
10
11 import java.util.Arrays;
12 import java.util.HashSet;
13 import java.util.Set;
14 import javax.ws.rs.core.Application;
15 import org.opendaylight.aaa.provider.GsonProvider;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18
19 /**
20  * A JAX-RS application for IdmLight. The REST endpoints delivered by this
21  * application are in the form: <code>http://{HOST}:{PORT}/auth/v1/</code>
22  *
23  * <p>
24  * For example, the users REST endpoint is:
25  * <code>http://{HOST}:{PORT}/auth/v1/users</code>
26  *
27  * <p>
28  * This application is responsible for interaction with the backing h2 database
29  * store.
30  *
31  * @author liemmn
32  * @see <code>org.opendaylight.aaa.shiro.idm.rest.DomainHandler</code>
33  * @see <code>org.opendaylight.aaa.shiro.idm.rest.UserHandler</code>
34  * @see <code>org.opendaylight.aaa.shiro.idm.rest.RoleHandler</code>
35  */
36 public class IdmLightApplication extends Application {
37
38     private static final Logger LOG = LoggerFactory.getLogger(IdmLightApplication.class);
39
40     // TODO create a bug to address the fact that the implementation assumes 128
41     // as the max length, even though this claims 256.
42     /**
43      * The maximum field length for identity fields.
44      */
45     public static final int MAX_FIELD_LEN = 256;
46
47     public IdmLightApplication() {
48     }
49
50     @Override
51     public Set<Class<?>> getClasses() {
52         return new HashSet<>(Arrays.asList(GsonProvider.class,
53                 DomainHandler.class, RoleHandler.class, UserHandler.class));
54     }
55 }