| | |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | |
| | | import org.opends.server.workflowelement.localbackend.*; |
| | | import org.opends.server.admin.ClassPropertyDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class provides a mechanism for interacting with all groups defined in |
| | | * the Directory Server. It will handle all necessary processing at server |
| | |
| | | |
| | | |
| | | |
| | | |
| | | // A mapping between the DNs of the config entries and the associated |
| | | // group implementations. |
| | | private ConcurrentHashMap<DN,Group> groupImplementations; |
| | |
| | | String className = groupConfiguration.getGroupClass(); |
| | | try |
| | | { |
| | | Group group = loadGroup(className, groupConfiguration); |
| | | Group group = loadGroup(className, groupConfiguration, true); |
| | | groupImplementations.put(groupConfiguration.dn(), group); |
| | | } |
| | | catch (InitializationException ie) |
| | |
| | | String className = configuration.getGroupClass(); |
| | | try |
| | | { |
| | | loadGroup(className, null); |
| | | loadGroup(className, configuration, false); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | |
| | | String className = configuration.getGroupClass(); |
| | | try |
| | | { |
| | | group = loadGroup(className, configuration); |
| | | group = loadGroup(className, configuration, true); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | |
| | | String className = configuration.getGroupClass(); |
| | | try |
| | | { |
| | | loadGroup(className, null); |
| | | loadGroup(className, configuration, false); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | |
| | | Group group = null; |
| | | try |
| | | { |
| | | group = loadGroup(className, configuration); |
| | | group = loadGroup(className, configuration, true); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | |
| | | * @param className The fully-qualified name of the group implementation |
| | | * class to load, instantiate, and initialize. |
| | | * @param configuration The configuration to use to initialize the group |
| | | * implementation, or {@code null} if the group |
| | | * implementation should not be initialized. |
| | | * implementation. It must not be {@code null}. |
| | | * @param initialize Indicates whether the key manager provider instance |
| | | * should be initialized. |
| | | * |
| | | * @return The possibly initialized group implementation. |
| | | * |
| | |
| | | * initialize the group implementation. |
| | | */ |
| | | private Group loadGroup(String className, |
| | | GroupImplementationCfg configuration) |
| | | GroupImplementationCfg configuration, |
| | | boolean initialize) |
| | | throws InitializationException |
| | | { |
| | | try |
| | |
| | | propertyDefinition.loadClass(className, Group.class); |
| | | Group group = groupClass.newInstance(); |
| | | |
| | | if (configuration != null) |
| | | if (initialize) |
| | | { |
| | | Method method = |
| | | group.getClass().getMethod("initializeGroupImplementation", |
| | | configuration.definition().getServerConfigurationClass()); |
| | | method.invoke(group, configuration); |
| | | } |
| | | else |
| | | { |
| | | Method method = group.getClass().getMethod("isConfigurationAcceptable", |
| | | GroupImplementationCfg.class, |
| | | List.class); |
| | | |
| | | List<String> unacceptableReasons = new ArrayList<String>(); |
| | | Boolean acceptable = (Boolean) method.invoke(group, configuration, |
| | | unacceptableReasons); |
| | | if (! acceptable) |
| | | { |
| | | StringBuilder buffer = new StringBuilder(); |
| | | if (! unacceptableReasons.isEmpty()) |
| | | { |
| | | Iterator<String> iterator = unacceptableReasons.iterator(); |
| | | buffer.append(iterator.next()); |
| | | while (iterator.hasNext()) |
| | | { |
| | | buffer.append(". "); |
| | | buffer.append(iterator.next()); |
| | | } |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_CONFIG_NOT_ACCEPTABLE; |
| | | String message = getMessage(msgID, String.valueOf(configuration.dn()), |
| | | buffer.toString()); |
| | | throw new InitializationException(msgID, message); |
| | | } |
| | | } |
| | | |
| | | return group; |
| | | } |