/* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt * or http://forgerock.org/license/CDDLv1.0.html. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at legal-notices/CDDLv1_0.txt. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: * Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END * * * Copyright 2007-2008 Sun Microsystems, Inc. */ package org.opends.server.admin; import java.util.Collection; import java.util.SortedSet; import org.forgerock.opendj.admin.client.ConnectionHandlerCfgClient; import org.forgerock.opendj.admin.server.ConnectionHandlerCfg; import org.forgerock.opendj.ldap.DN; import org.forgerock.opendj.ldap.ErrorResultException; import org.forgerock.opendj.ldap.schema.AttributeType; import org.opends.server.admin.client.ConcurrentModificationException; import org.opends.server.admin.client.ManagedObject; import org.opends.server.admin.client.MissingMandatoryPropertiesException; import org.opends.server.admin.client.OperationRejectedException; import org.opends.server.admin.server.ConfigurationChangeListener; import org.opends.server.admin.server.ServerManagedObject; /** * An interface for querying the Test Child managed object definition meta * information. *

* A configuration for testing components that are subordinate to a parent * component. It re-uses the virtual-attribute configuration LDAP profile. */ public final class TestChildCfgDefn extends ManagedObjectDefinition { // The singleton configuration definition instance. private static final TestChildCfgDefn INSTANCE = new TestChildCfgDefn(); // The "aggregation-property" property definition. // @Checkstyle:off private static final AggregationPropertyDefinition PROPDEF_AGGREGATION_PROPERTY; // @Checkstyle:on // The "mandatory-boolean-property" property definition. private static final BooleanPropertyDefinition PROPDEF_MANDATORY_BOOLEAN_PROPERTY; // The "mandatory-class-property" property definition. private static final ClassPropertyDefinition PROPDEF_MANDATORY_CLASS_PROPERTY; // The "mandatory-read-only-attribute-type-property" property definition. private static final AttributeTypePropertyDefinition PROPDEF_MANDATORY_READ_ONLY_ATTRIBUTE_TYPE_PROPERTY; // The "optional-multi-valued-dn-property1" property definition. private static final DNPropertyDefinition PROPDEF_OPTIONAL_MULTI_VALUED_DN_PROPERTY1; // The "optional-multi-valued-dn-property2" property definition. private static final DNPropertyDefinition PROPDEF_OPTIONAL_MULTI_VALUED_DN_PROPERTY2; // Build the "aggregation-property" property definition. static { AggregationPropertyDefinition.Builder builder = AggregationPropertyDefinition.createBuilder(INSTANCE, "aggregation-property"); builder.setOption(PropertyOption.MULTI_VALUED); builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "aggregation-property")); builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider()); builder.setParentPath("/"); builder.setRelationDefinition("connection-handler"); PROPDEF_AGGREGATION_PROPERTY = builder.getInstance(); INSTANCE.registerPropertyDefinition(PROPDEF_AGGREGATION_PROPERTY); INSTANCE.registerConstraint(PROPDEF_AGGREGATION_PROPERTY.getSourceConstraint()); } // Build the "mandatory-boolean-property" property definition. static { BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "mandatory-boolean-property"); builder.setOption(PropertyOption.MANDATORY); builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "mandatory-boolean-property")); builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider()); PROPDEF_MANDATORY_BOOLEAN_PROPERTY = builder.getInstance(); INSTANCE.registerPropertyDefinition(PROPDEF_MANDATORY_BOOLEAN_PROPERTY); } // Build the "mandatory-class-property" property definition. static { ClassPropertyDefinition.Builder builder = ClassPropertyDefinition.createBuilder(INSTANCE, "mandatory-class-property"); builder.setOption(PropertyOption.MANDATORY); builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "mandatory-class-property")); DefaultBehaviorProvider provider = new DefinedDefaultBehaviorProvider( "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); builder.setDefaultBehaviorProvider(provider); builder.addInstanceOf("org.opends.server.api.VirtualAttributeProvider"); PROPDEF_MANDATORY_CLASS_PROPERTY = builder.getInstance(); INSTANCE.registerPropertyDefinition(PROPDEF_MANDATORY_CLASS_PROPERTY); } // Build the "mandatory-read-only-attribute-type-property" property // definition. static { AttributeTypePropertyDefinition.Builder builder = AttributeTypePropertyDefinition.createBuilder(INSTANCE, "mandatory-read-only-attribute-type-property"); builder.setOption(PropertyOption.READ_ONLY); builder.setOption(PropertyOption.MANDATORY); builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "mandatory-read-only-attribute-type-property")); builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider()); PROPDEF_MANDATORY_READ_ONLY_ATTRIBUTE_TYPE_PROPERTY = builder.getInstance(); INSTANCE.registerPropertyDefinition(PROPDEF_MANDATORY_READ_ONLY_ATTRIBUTE_TYPE_PROPERTY); } // Build the "optional-multi-valued-dn-property1" property definition. static { DNPropertyDefinition.Builder builder = DNPropertyDefinition.createBuilder(INSTANCE, "optional-multi-valued-dn-property1"); builder.setOption(PropertyOption.MULTI_VALUED); builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "optional-multi-valued-dn-property1")); DefaultBehaviorProvider provider = new RelativeInheritedDefaultBehaviorProvider( TestParentCfgDefn.getInstance(), "optional-multi-valued-dn-property", 1); builder.setDefaultBehaviorProvider(provider); PROPDEF_OPTIONAL_MULTI_VALUED_DN_PROPERTY1 = builder.getInstance(); INSTANCE.registerPropertyDefinition(PROPDEF_OPTIONAL_MULTI_VALUED_DN_PROPERTY1); } // Build the "optional-multi-valued-dn-property2" property definition. static { DNPropertyDefinition.Builder builder = DNPropertyDefinition.createBuilder(INSTANCE, "optional-multi-valued-dn-property2"); builder.setOption(PropertyOption.MULTI_VALUED); builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "optional-multi-valued-dn-property2")); DefaultBehaviorProvider provider = new RelativeInheritedDefaultBehaviorProvider( TestChildCfgDefn.getInstance(), "optional-multi-valued-dn-property1", 0); builder.setDefaultBehaviorProvider(provider); PROPDEF_OPTIONAL_MULTI_VALUED_DN_PROPERTY2 = builder.getInstance(); INSTANCE.registerPropertyDefinition(PROPDEF_OPTIONAL_MULTI_VALUED_DN_PROPERTY2); } /** * Get the Test Child configuration definition singleton. * * @return Returns the Test Child configuration definition singleton. */ public static TestChildCfgDefn getInstance() { return INSTANCE; } /** * Private constructor. */ private TestChildCfgDefn() { super("test-child", null); } /** * {@inheritDoc} */ public TestChildCfgClient createClientConfiguration(ManagedObject impl) { return new TestChildCfgClientImpl(impl); } /** * {@inheritDoc} */ public TestChildCfg createServerConfiguration(ServerManagedObject impl) { return new TestChildCfgServerImpl(impl); } /** * {@inheritDoc} */ public Class getServerConfigurationClass() { return TestChildCfg.class; } /** * Get the "aggregation-property" property definition. *

* An aggregation property which references connection handlers. * * @return Returns the "aggregation-property" property definition. */ // @Checkstyle:off public AggregationPropertyDefinition getAggregationPropertyPropertyDefinition() { return PROPDEF_AGGREGATION_PROPERTY; } // @Checkstyle:on /** * Get the "mandatory-boolean-property" property definition. *

* A mandatory boolean property. * * @return Returns the "mandatory-boolean-property" property definition. */ public BooleanPropertyDefinition getMandatoryBooleanPropertyPropertyDefinition() { return PROPDEF_MANDATORY_BOOLEAN_PROPERTY; } /** * Get the "mandatory-class-property" property definition. *

* A mandatory Java-class property requiring a component restart. * * @return Returns the "mandatory-class-property" property definition. */ public ClassPropertyDefinition getMandatoryClassPropertyPropertyDefinition() { return PROPDEF_MANDATORY_CLASS_PROPERTY; } /** * Get the "mandatory-read-only-attribute-type-property" property * definition. *

* A mandatory read-only attribute type property. * * @return Returns the "mandatory-read-only-attribute-type-property" * property definition. */ public AttributeTypePropertyDefinition getMandatoryReadOnlyAttributeTypePropertyPropertyDefinition() { return PROPDEF_MANDATORY_READ_ONLY_ATTRIBUTE_TYPE_PROPERTY; } /** * Get the "optional-multi-valued-dn-property1" property definition. *

* An optional multi-valued DN property which inherits its values from * optional-multi-valued-dn-property in the parent. * * @return Returns the "optional-multi-valued-dn-property1" property * definition. */ public DNPropertyDefinition getOptionalMultiValuedDNProperty1PropertyDefinition() { return PROPDEF_OPTIONAL_MULTI_VALUED_DN_PROPERTY1; } /** * Get the "optional-multi-valued-dn-property2" property definition. *

* An optional multi-valued DN property which inherits its values from * optional-multi-valued-dn-property1. * * @return Returns the "optional-multi-valued-dn-property2" property * definition. */ public DNPropertyDefinition getOptionalMultiValuedDNProperty2PropertyDefinition() { return PROPDEF_OPTIONAL_MULTI_VALUED_DN_PROPERTY2; } /** * Managed object client implementation. */ private static class TestChildCfgClientImpl implements TestChildCfgClient { // Private implementation. private ManagedObject impl; // Private constructor. private TestChildCfgClientImpl(ManagedObject impl) { this.impl = impl; } /** * {@inheritDoc} */ public SortedSet getAggregationProperty() { return impl.getPropertyValues(INSTANCE.getAggregationPropertyPropertyDefinition()); } /** * {@inheritDoc} */ public void setAggregationProperty(Collection values) { impl.setPropertyValues(INSTANCE.getAggregationPropertyPropertyDefinition(), values); } /** * {@inheritDoc} */ public Boolean isMandatoryBooleanProperty() { return impl.getPropertyValue(INSTANCE.getMandatoryBooleanPropertyPropertyDefinition()); } /** * {@inheritDoc} */ public void setMandatoryBooleanProperty(boolean value) { impl.setPropertyValue(INSTANCE.getMandatoryBooleanPropertyPropertyDefinition(), value); } /** * {@inheritDoc} */ public String getMandatoryClassProperty() { return impl.getPropertyValue(INSTANCE.getMandatoryClassPropertyPropertyDefinition()); } /** * {@inheritDoc} */ public void setMandatoryClassProperty(String value) { impl.setPropertyValue(INSTANCE.getMandatoryClassPropertyPropertyDefinition(), value); } /** * {@inheritDoc} */ public AttributeType getMandatoryReadOnlyAttributeTypeProperty() { return impl.getPropertyValue(INSTANCE.getMandatoryReadOnlyAttributeTypePropertyPropertyDefinition()); } /** * {@inheritDoc} */ public void setMandatoryReadOnlyAttributeTypeProperty(AttributeType value) throws PropertyIsReadOnlyException { impl.setPropertyValue(INSTANCE.getMandatoryReadOnlyAttributeTypePropertyPropertyDefinition(), value); } /** * {@inheritDoc} */ public SortedSet getOptionalMultiValuedDNProperty1() { return impl.getPropertyValues(INSTANCE.getOptionalMultiValuedDNProperty1PropertyDefinition()); } /** * {@inheritDoc} */ public void setOptionalMultiValuedDNProperty1(Collection values) { impl.setPropertyValues(INSTANCE.getOptionalMultiValuedDNProperty1PropertyDefinition(), values); } /** * {@inheritDoc} */ public SortedSet getOptionalMultiValuedDNProperty2() { return impl.getPropertyValues(INSTANCE.getOptionalMultiValuedDNProperty2PropertyDefinition()); } /** * {@inheritDoc} */ public void setOptionalMultiValuedDNProperty2(Collection values) { impl.setPropertyValues(INSTANCE.getOptionalMultiValuedDNProperty2PropertyDefinition(), values); } /** * {@inheritDoc} */ public ManagedObjectDefinition definition() { return INSTANCE; } /** * {@inheritDoc} */ public PropertyProvider properties() { return impl; } /** * {@inheritDoc} */ public void commit() throws ManagedObjectAlreadyExistsException, MissingMandatoryPropertiesException, ConcurrentModificationException, OperationRejectedException, ErrorResultException { impl.commit(); } } /** * Managed object server implementation. */ private static class TestChildCfgServerImpl implements TestChildCfg { // Private implementation. private ServerManagedObject impl; // Private constructor. private TestChildCfgServerImpl(ServerManagedObject impl) { this.impl = impl; } /** * {@inheritDoc} */ public void addChangeListener(ConfigurationChangeListener listener) { impl.registerChangeListener(listener); } /** * {@inheritDoc} */ public void removeChangeListener(ConfigurationChangeListener listener) { impl.deregisterChangeListener(listener); } /** * {@inheritDoc} */ public SortedSet getAggregationProperty() { return impl.getPropertyValues(INSTANCE.getAggregationPropertyPropertyDefinition()); } /** * {@inheritDoc} */ public boolean isMandatoryBooleanProperty() { return impl.getPropertyValue(INSTANCE.getMandatoryBooleanPropertyPropertyDefinition()); } /** * {@inheritDoc} */ public String getMandatoryClassProperty() { return impl.getPropertyValue(INSTANCE.getMandatoryClassPropertyPropertyDefinition()); } /** * {@inheritDoc} */ public AttributeType getMandatoryReadOnlyAttributeTypeProperty() { return impl.getPropertyValue(INSTANCE.getMandatoryReadOnlyAttributeTypePropertyPropertyDefinition()); } /** * {@inheritDoc} */ public SortedSet getOptionalMultiValuedDNProperty1() { return impl.getPropertyValues(INSTANCE.getOptionalMultiValuedDNProperty1PropertyDefinition()); } /** * {@inheritDoc} */ public SortedSet getOptionalMultiValuedDNProperty2() { return impl.getPropertyValues(INSTANCE.getOptionalMultiValuedDNProperty2PropertyDefinition()); } /** * {@inheritDoc} */ public Class configurationClass() { return TestChildCfg.class; } /** * {@inheritDoc} */ public DN dn() { return impl.getDN(); } } }