6d2d4d982bbd703083a7a60f59b0994aa9cf13d6
[utils] / security / src / main / java / org / wamblee / usermgt / hibernate / UserAdministrationLightComponent.java
1 /*
2  * Copyright 2008 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.wamblee.usermgt.hibernate;
17
18 import org.wamblee.system.core.DefaultProvidedInterface;
19 import org.wamblee.system.core.DefaultRequiredInterface;
20 import org.wamblee.system.core.ProvidedInterface;
21 import org.wamblee.system.core.RequiredInterface;
22 import org.wamblee.system.spring.SpringComponent;
23
24 import org.wamblee.usermgt.GroupSet;
25 import org.wamblee.usermgt.UserAdministration;
26 import org.wamblee.usermgt.UserSet;
27
28 import java.util.HashMap;
29 import java.util.Map;
30
31
32 /**
33  * Light version of the user administration component that requires
34  * external datasource, and userset and group set components, as well as an
35  * external hibernate session factory.
36  *
37  * @author Erik Brakkee
38  */
39 public class UserAdministrationLightComponent extends SpringComponent {
40 /**
41      * Creates a new UserAdministrationLightComponent object.
42      *
43      * @param aName DOCUMENT ME!
44      */
45     public UserAdministrationLightComponent(String aName) {
46         super(aName,
47             new String[] { "spring/org.wamblee.security.usermgt.xml" },
48             createProvided(), createRequired());
49     }
50
51     /**
52      * DOCUMENT ME!
53      *
54      * @return DOCUMENT ME!
55      */
56     private static Map<RequiredInterface, String> createRequired() {
57         Map<RequiredInterface, String> required = new HashMap<RequiredInterface, String>();
58         required.put(new DefaultRequiredInterface("userSet", UserSet.class),
59             UserSet.class.getName());
60         required.put(new DefaultRequiredInterface("groupSet", GroupSet.class),
61             GroupSet.class.getName());
62
63         return required;
64     }
65
66     /**
67      * DOCUMENT ME!
68      *
69      * @return DOCUMENT ME!
70      */
71     private static Map<String, ProvidedInterface> createProvided() {
72         Map<String, ProvidedInterface> provided = new HashMap<String, ProvidedInterface>();
73         provided.put(UserAdministration.class.getName(),
74             new DefaultProvidedInterface(
75                 "org.wamblee.usermgt.UserAdministration",
76                 UserAdministration.class));
77
78         return provided;
79     }
80 }