001/*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License").  You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
010 * or http://forgerock.org/license/CDDLv1.0.html.
011 * See the License for the specific language governing permissions
012 * and limitations under the License.
013 *
014 * When distributing Covered Code, include this CDDL HEADER in each
015 * file and include the License file at legal-notices/CDDLv1_0.txt.
016 * If applicable, add the following below this CDDL HEADER, with the
017 * fields enclosed by brackets "[]" replaced with your own identifying
018 * information:
019 *      Portions Copyright [yyyy] [name of copyright owner]
020 *
021 * CDDL HEADER END
022 *
023 *
024 *      Copyright 2008-2009 Sun Microsystems, Inc.
025 */
026
027package org.opends.server.admin;
028
029
030
031/**
032 * A visitor of relation definitions, in the style of the visitor
033 * design pattern. Classes implementing this interface can query
034 * relation definitions in a type-safe manner when the kind of
035 * relation definition is unknown at compile time. When a visitor is
036 * passed to a relation definition's accept method, the corresponding
037 * visit method most applicable to that relation definition is
038 * invoked.
039 *
040 * @param <R>
041 *          The return type of this visitor's methods. Use
042 *          {@link java.lang.Void} for visitors that do not need to
043 *          return results.
044 * @param <P>
045 *          The type of the additional parameter to this visitor's
046 *          methods. Use {@link java.lang.Void} for visitors that do
047 *          not need an additional parameter.
048 */
049public interface RelationDefinitionVisitor<R, P> {
050
051  /**
052   * Visit an instantiable relation definition.
053   *
054   * @param <C>
055   *          The type of client managed object configuration that the
056   *          relation definition refers to.
057   * @param <S>
058   *          The type of server managed object configuration that the
059   *          relation definition refers to.
060   * @param rd
061   *          The instantiable relation definition to visit.
062   * @param p
063   *          A visitor specified parameter.
064   * @return Returns a visitor specified result.
065   */
066  <C extends ConfigurationClient, S extends Configuration> R visitInstantiable(
067      InstantiableRelationDefinition<C, S> rd, P p);
068
069
070
071  /**
072   * Visit a set relation definition.
073   *
074   * @param <C>
075   *          The type of client managed object configuration that the
076   *          relation definition refers to.
077   * @param <S>
078   *          The type of server managed object configuration that the
079   *          relation definition refers to.
080   * @param rd
081   *          The set relation definition to visit.
082   * @param p
083   *          A visitor specified parameter.
084   * @return Returns a visitor specified result.
085   */
086  <C extends ConfigurationClient, S extends Configuration> R visitSet(
087      SetRelationDefinition<C, S> rd, P p);
088
089
090
091  /**
092   * Visit an optional relation definition.
093   *
094   * @param <C>
095   *          The type of client managed object configuration that the
096   *          relation definition refers to.
097   * @param <S>
098   *          The type of server managed object configuration that the
099   *          relation definition refers to.
100   * @param rd
101   *          The optional relation definition to visit.
102   * @param p
103   *          A visitor specified parameter.
104   * @return Returns a visitor specified result.
105   */
106  <C extends ConfigurationClient, S extends Configuration> R visitOptional(
107      OptionalRelationDefinition<C, S> rd, P p);
108
109
110
111  /**
112   * Visit a singleton relation definition.
113   *
114   * @param <C>
115   *          The type of client managed object configuration that the
116   *          relation definition refers to.
117   * @param <S>
118   *          The type of server managed object configuration that the
119   *          relation definition refers to.
120   * @param rd
121   *          The singleton relation definition to visit.
122   * @param p
123   *          A visitor specified parameter.
124   * @return Returns a visitor specified result.
125   */
126  <C extends ConfigurationClient, S extends Configuration> R visitSingleton(
127      SingletonRelationDefinition<C, S> rd, P p);
128
129}