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
010     * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011     * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Copyright 2008 Sun Microsystems, Inc.
026     */
027    
028    package org.opends.server.admin;
029    
030    
031    
032    /**
033     * A visitor of relation definitions, in the style of the visitor
034     * design pattern. Classes implementing this interface can query
035     * relation definitions in a type-safe manner when the kind of
036     * relation definition is unknown at compile time. When a visitor is
037     * passed to a relation definition's accept method, the corresponding
038     * visit method most applicable to that relation definition is
039     * invoked.
040     *
041     * @param <R>
042     *          The return type of this visitor's methods. Use
043     *          {@link java.lang.Void} for visitors that do not need to
044     *          return results.
045     * @param <P>
046     *          The type of the additional parameter to this visitor's
047     *          methods. Use {@link java.lang.Void} for visitors that do
048     *          not need an additional parameter.
049     */
050    public interface RelationDefinitionVisitor<R, P> {
051    
052      /**
053       * Visit an instantiable relation definition.
054       *
055       * @param <C>
056       *          The type of client managed object configuration that the
057       *          relation definition refers to.
058       * @param <S>
059       *          The type of server managed object configuration that the
060       *          relation definition refers to.
061       * @param rd
062       *          The instantiable relation definition to visit.
063       * @param p
064       *          A visitor specified parameter.
065       * @return Returns a visitor specified result.
066       */
067      <C extends ConfigurationClient, S extends Configuration> R visitInstantiable(
068          InstantiableRelationDefinition<C, S> rd, P p);
069    
070    
071    
072      /**
073       * Visit an optional relation definition.
074       *
075       * @param <C>
076       *          The type of client managed object configuration that the
077       *          relation definition refers to.
078       * @param <S>
079       *          The type of server managed object configuration that the
080       *          relation definition refers to.
081       * @param rd
082       *          The optional relation definition to visit.
083       * @param p
084       *          A visitor specified parameter.
085       * @return Returns a visitor specified result.
086       */
087      <C extends ConfigurationClient, S extends Configuration> R visitOptional(
088          OptionalRelationDefinition<C, S> rd, P p);
089    
090    
091    
092      /**
093       * Visit a singleton relation definition.
094       *
095       * @param <C>
096       *          The type of client managed object configuration that the
097       *          relation definition refers to.
098       * @param <S>
099       *          The type of server managed object configuration that the
100       *          relation definition refers to.
101       * @param rd
102       *          The singleton relation definition to visit.
103       * @param p
104       *          A visitor specified parameter.
105       * @return Returns a visitor specified result.
106       */
107      <C extends ConfigurationClient, S extends Configuration> R visitSingleton(
108          SingletonRelationDefinition<C, S> rd, P p);
109    
110    }