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 2006-2008 Sun Microsystems, Inc. 026 */ 027 package org.opends.server.types; 028 029 import org.opends.messages.Message; 030 031 import java.util.List; 032 033 034 /** 035 * This class defines a data structure that holds information about 036 * the result of processing by a synchronization provider. 037 */ 038 @org.opends.server.types.PublicAPI( 039 stability=org.opends.server.types.StabilityLevel.VOLATILE, 040 mayInstantiate=false, 041 mayExtend=false, 042 mayInvoke=true) 043 public interface SynchronizationProviderResult 044 { 045 /** 046 * Indicates whether processing on the associated operation should 047 * continue. 048 * 049 * @return <CODE>true</CODE> if processing on the associated 050 * operation should continue, or <CODE>false</CODE> if it 051 * should stop. 052 */ 053 public boolean continueProcessing(); 054 055 /** 056 * Retrieves the error message if <code>continueProcessing</code> 057 * returned <code>false</code>. 058 * 059 * @return An error message explaining why processing should 060 * stop or <code>null</code> if none is provided. 061 */ 062 public Message getErrorMessage(); 063 064 /** 065 * Retrieves the result code for the operation 066 * if <code>continueProcessing</code> returned <code>false</code>. 067 * 068 * @return the result code for the operation or <code>null</code> 069 * if none is provided. 070 */ 071 public ResultCode getResultCode(); 072 073 /** 074 * Retrieves the matched DN for the operation 075 * if <code>continueProcessing</code> returned <code>false</code>. 076 * 077 * @return the matched DN for the operation or <code>null</code> 078 * if none is provided. 079 */ 080 public DN getMatchedDN(); 081 082 /** 083 * Retrieves the referral URLs for the operation 084 * if <code>continueProcessing</code> returned <code>false</code>. 085 * 086 * @return the refferal URLs for the operation or 087 * <code>null</code> if none is provided. 088 */ 089 public List<String> getReferralURLs(); 090 091 /** 092 * Defines a continue processing synchronization provider result. 093 */ 094 public class ContinueProcessing 095 implements SynchronizationProviderResult 096 { 097 /** 098 * {@inheritDoc} 099 */ 100 public ResultCode getResultCode() 101 { 102 return null; 103 } 104 105 /** 106 * {@inheritDoc} 107 */ 108 public DN getMatchedDN() 109 { 110 return null; 111 } 112 113 /** 114 * {@inheritDoc} 115 */ 116 public List<String> getReferralURLs() 117 { 118 return null; 119 } 120 121 /** 122 * {@inheritDoc} 123 */ 124 public boolean continueProcessing() 125 { 126 return true; 127 } 128 129 /** 130 * {@inheritDoc} 131 */ 132 public Message getErrorMessage() 133 { 134 return null; 135 } 136 } 137 138 /** 139 * Defines a stop processing synchronization provider result. 140 */ 141 public class StopProcessing 142 implements SynchronizationProviderResult 143 { 144 // The matched DN for this result. 145 private final DN matchedDN; 146 147 // The set of referral URLs for this result. 148 private final List<String> referralURLs; 149 150 // The result code for this result. 151 private final ResultCode resultCode; 152 153 private final Message errorMessage; 154 155 /** 156 * Contrust a new stop processing synchronization provider 157 * result. 158 * 159 * @param resultCode The result code for this result. 160 * @param errorMessage An message explaining why processing 161 * should stop. 162 * @param matchedDN The matched DN for this result. 163 * @param referralURLs The set of referral URLs for this result. 164 */ 165 public StopProcessing(ResultCode resultCode, Message errorMessage, 166 DN matchedDN, List<String> referralURLs) 167 { 168 this.errorMessage = errorMessage; 169 this.matchedDN = matchedDN; 170 this.resultCode = resultCode; 171 this.referralURLs = referralURLs; 172 } 173 174 /** 175 * Contrust a new stop processing synchronization provider 176 * result. 177 * 178 * @param resultCode The result code for this result. 179 * @param errorMessage An message explaining why processing 180 * should stop. 181 */ 182 public StopProcessing(ResultCode resultCode, Message errorMessage) 183 { 184 this.errorMessage = errorMessage; 185 this.resultCode = resultCode; 186 this.matchedDN = null; 187 this.referralURLs = null; 188 } 189 190 /** 191 * {@inheritDoc} 192 */ 193 public ResultCode getResultCode() 194 { 195 return resultCode; 196 } 197 198 /** 199 * {@inheritDoc} 200 */ 201 public DN getMatchedDN() 202 { 203 return matchedDN; 204 } 205 206 /** 207 * {@inheritDoc} 208 */ 209 public List<String> getReferralURLs() 210 { 211 return referralURLs; 212 } 213 214 /** 215 * {@inheritDoc} 216 */ 217 public boolean continueProcessing() 218 { 219 return false; 220 } 221 222 /** 223 * {@inheritDoc} 224 */ 225 public Message getErrorMessage() 226 { 227 return errorMessage; 228 } 229 } 230 } 231