1008N/A/*
1008N/A * CDDL HEADER START
1008N/A *
1008N/A * The contents of this file are subject to the terms of the
1008N/A * Common Development and Distribution License, Version 1.0 only
1008N/A * (the "License"). You may not use this file except in compliance
1008N/A * with the License.
1008N/A *
1008N/A * You can obtain a copy of the license at
1008N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE
1008N/A * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
1008N/A * See the License for the specific language governing permissions
1008N/A * and limitations under the License.
1008N/A *
1008N/A * When distributing Covered Code, include this CDDL HEADER in each
1008N/A * file and include the License file at
1008N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
1008N/A * add the following below this CDDL HEADER, with the fields enclosed
1008N/A * by brackets "[]" replaced with your own identifying information:
1008N/A * Portions Copyright [yyyy] [name of copyright owner]
1008N/A *
1008N/A * CDDL HEADER END
1008N/A *
1008N/A *
3215N/A * Copyright 2008 Sun Microsystems, Inc.
1008N/A */
1008N/Apackage org.opends.server.admin;
1008N/A
1008N/A
1008N/A
1008N/A/**
1418N/A * A default behavior provider which retrieves default values from a
2501N/A * managed object in an absolute location. It should be used by
1418N/A * properties which inherit their default value(s) from properties
1418N/A * held in an other managed object.
1008N/A *
1008N/A * @param <T>
1008N/A * The type of values represented by this provider.
1008N/A */
2501N/Apublic final class AbsoluteInheritedDefaultBehaviorProvider<T> extends
1008N/A DefaultBehaviorProvider<T> {
1008N/A
1008N/A // The absolute path to the managed object containing the property.
2501N/A private ManagedObjectPath<?, ?> path = null;
2501N/A
2501N/A // The string representation of the managed object path specifying
2501N/A // the absolute location of the managed object.
2501N/A private final String pathString;
1008N/A
1008N/A // The name of the property containing the inherited default values.
1008N/A private final String propertyName;
1008N/A
1008N/A
1008N/A
1008N/A /**
1418N/A * Create an absolute inherited default behavior provider associated
1418N/A * with the managed object at the specified absolute location.
1008N/A *
2501N/A * @param pathString
2501N/A * The string representation of the managed object path
2501N/A * specifying the absolute location of the managed object.
1008N/A * @param propertyName
1418N/A * The name of the property containing the inherited
1418N/A * default values.
1008N/A */
2501N/A public AbsoluteInheritedDefaultBehaviorProvider(String pathString,
2501N/A String propertyName) {
2501N/A this.pathString = pathString;
1008N/A this.propertyName = propertyName;
1008N/A }
1008N/A
1008N/A
1008N/A
1008N/A /**
1008N/A * {@inheritDoc}
1008N/A */
1008N/A public <R, P> R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p) {
1008N/A return v.visitAbsoluteInherited(this, p);
1008N/A }
1008N/A
1008N/A
1008N/A
1008N/A /**
1418N/A * Get the definition of the parent managed object containing the
1418N/A * inherited default values.
1008N/A *
1418N/A * @return Returns the definition of the parent managed object
1418N/A * containing the inherited default values.
1418N/A */
1418N/A public AbstractManagedObjectDefinition<?, ?> getManagedObjectDefinition() {
1418N/A return path.getManagedObjectDefinition();
1418N/A }
1418N/A
1418N/A
1418N/A
1418N/A /**
1418N/A * Get the absolute path of the managed object containing the
1418N/A * property which has the default values.
1418N/A *
1418N/A * @return Returns the absolute path of the managed object
1418N/A * containing the property which has the default values.
1008N/A */
1929N/A public ManagedObjectPath<?, ?> getManagedObjectPath() {
1008N/A return path;
1008N/A }
1008N/A
1008N/A
1008N/A
1008N/A /**
2501N/A * Gets the name of the property containing the inherited default
1418N/A * values.
1008N/A *
1418N/A * @return Returns the name of the property containing the inherited
1418N/A * default values.
1008N/A */
1008N/A public String getPropertyName() {
1008N/A return propertyName;
1008N/A }
1008N/A
2501N/A
2501N/A
2501N/A /**
2501N/A * {@inheritDoc}
2501N/A */
2501N/A @Override
2501N/A protected void initialize() throws Exception {
2501N/A // Decode the path.
2501N/A path = ManagedObjectPath.valueOf(pathString);
2501N/A }
2501N/A
1008N/A}