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