View Javadoc

1   /**
2    * Copyright 2009 OPS4J
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   *
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.ops4j.pax.useradmin.service.spi;
19  
20  import java.util.Map;
21  import java.util.Set;
22  
23  import org.osgi.service.useradmin.Group;
24  import org.osgi.service.useradmin.Role;
25  import org.osgi.service.useradmin.User;
26  
27  /**
28   * An interface which provides methods to create implementation objects. This
29   * interface is intended to be used only by implementations of the
30   * <code>StorageProvider</code> interface.
31   * 
32   * @author Matthias Kuespert
33   * @since 02.07.2009
34   */
35  public interface UserAdminFactory {
36  
37      /**
38       * Create a <code>User</code> instance.
39       * 
40       * @param name
41       *            The name of the user.
42       * @param properties
43       *            The properties of the user.
44       * @param credentials
45       *            The credentials of the user.
46       * @return A new <code>User</code> instance.
47       */
48      User createUser(String name, Map<String, Object> properties, Set<String> initialCredentialKeys);
49  
50      /**
51       * Create a <code>Group</code> instance.
52       * 
53       * @param name
54       *            The name of the group.
55       * @param properties
56       *            The properties of the group.
57       * @param credentials
58       *            The credentials of the group.
59       * @return A new <code>Group</code> instance.
60       */
61      Group createGroup(String name, Map<String, Object> properties, Set<String> initialCredentialKeys);
62  
63      /**
64       * Publish an event of the given type related to the role specified.
65       * 
66       * @param type
67       *            The type of event - see <code>UserAdminEvent</code>.
68       * @param role
69       *            The role which is related to the event.
70       */
71      void fireEvent(int type, Role role);
72  }