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 Sun Microsystems, Inc. 025 */ 026package org.opends.server.admin.std.meta; 027 028 029 030import java.util.Collection; 031import java.util.SortedSet; 032import org.opends.server.admin.BooleanPropertyDefinition; 033import org.opends.server.admin.ClassPropertyDefinition; 034import org.opends.server.admin.client.AuthorizationException; 035import org.opends.server.admin.client.CommunicationException; 036import org.opends.server.admin.client.ConcurrentModificationException; 037import org.opends.server.admin.client.ManagedObject; 038import org.opends.server.admin.client.MissingMandatoryPropertiesException; 039import org.opends.server.admin.client.OperationRejectedException; 040import org.opends.server.admin.EnumPropertyDefinition; 041import org.opends.server.admin.ManagedObjectAlreadyExistsException; 042import org.opends.server.admin.ManagedObjectDefinition; 043import org.opends.server.admin.PropertyProvider; 044import org.opends.server.admin.server.ConfigurationChangeListener; 045import org.opends.server.admin.server.ServerManagedObject; 046import org.opends.server.admin.std.client.FractionalLDIFImportPluginCfgClient; 047import org.opends.server.admin.std.meta.PluginCfgDefn.PluginType; 048import org.opends.server.admin.std.server.FractionalLDIFImportPluginCfg; 049import org.opends.server.admin.std.server.PluginCfg; 050import org.opends.server.admin.Tag; 051import org.opends.server.types.DN; 052 053 054 055/** 056 * An interface for querying the Fractional LDIF Import Plugin managed 057 * object definition meta information. 058 * <p> 059 * The Fractional LDIF Import Plugin is used internally by the 060 * replication plugin to support fractional replication. 061 */ 062public final class FractionalLDIFImportPluginCfgDefn extends ManagedObjectDefinition<FractionalLDIFImportPluginCfgClient, FractionalLDIFImportPluginCfg> { 063 064 // The singleton configuration definition instance. 065 private static final FractionalLDIFImportPluginCfgDefn INSTANCE = new FractionalLDIFImportPluginCfgDefn(); 066 067 068 069 // Register the tags associated with this managed object definition. 070 static { 071 INSTANCE.registerTag(Tag.valueOf("core-server")); 072 } 073 074 075 076 /** 077 * Get the Fractional LDIF Import Plugin configuration definition 078 * singleton. 079 * 080 * @return Returns the Fractional LDIF Import Plugin configuration 081 * definition singleton. 082 */ 083 public static FractionalLDIFImportPluginCfgDefn getInstance() { 084 return INSTANCE; 085 } 086 087 088 089 /** 090 * Private constructor. 091 */ 092 private FractionalLDIFImportPluginCfgDefn() { 093 super("fractional-ldif-import-plugin", PluginCfgDefn.getInstance()); 094 } 095 096 097 098 /** 099 * {@inheritDoc} 100 */ 101 public FractionalLDIFImportPluginCfgClient createClientConfiguration( 102 ManagedObject<? extends FractionalLDIFImportPluginCfgClient> impl) { 103 return new FractionalLDIFImportPluginCfgClientImpl(impl); 104 } 105 106 107 108 /** 109 * {@inheritDoc} 110 */ 111 public FractionalLDIFImportPluginCfg createServerConfiguration( 112 ServerManagedObject<? extends FractionalLDIFImportPluginCfg> impl) { 113 return new FractionalLDIFImportPluginCfgServerImpl(impl); 114 } 115 116 117 118 /** 119 * {@inheritDoc} 120 */ 121 public Class<FractionalLDIFImportPluginCfg> getServerConfigurationClass() { 122 return FractionalLDIFImportPluginCfg.class; 123 } 124 125 126 127 /** 128 * Get the "enabled" property definition. 129 * <p> 130 * Indicates whether the plug-in is enabled for use. 131 * 132 * @return Returns the "enabled" property definition. 133 */ 134 public BooleanPropertyDefinition getEnabledPropertyDefinition() { 135 return PluginCfgDefn.getInstance().getEnabledPropertyDefinition(); 136 } 137 138 139 140 /** 141 * Get the "invoke-for-internal-operations" property definition. 142 * <p> 143 * Indicates whether the plug-in should be invoked for internal 144 * operations. 145 * <p> 146 * Any plug-in that can be invoked for internal operations must 147 * ensure that it does not create any new internal operatons that can 148 * cause the same plug-in to be re-invoked. 149 * 150 * @return Returns the "invoke-for-internal-operations" property definition. 151 */ 152 public BooleanPropertyDefinition getInvokeForInternalOperationsPropertyDefinition() { 153 return PluginCfgDefn.getInstance().getInvokeForInternalOperationsPropertyDefinition(); 154 } 155 156 157 158 /** 159 * Get the "java-class" property definition. 160 * <p> 161 * Specifies the fully-qualified name of the Java class that 162 * provides the plug-in implementation. 163 * 164 * @return Returns the "java-class" property definition. 165 */ 166 public ClassPropertyDefinition getJavaClassPropertyDefinition() { 167 return PluginCfgDefn.getInstance().getJavaClassPropertyDefinition(); 168 } 169 170 171 172 /** 173 * Get the "plugin-type" property definition. 174 * <p> 175 * Specifies the set of plug-in types for the plug-in, which 176 * specifies the times at which the plug-in is invoked. 177 * 178 * @return Returns the "plugin-type" property definition. 179 */ 180 public EnumPropertyDefinition<PluginType> getPluginTypePropertyDefinition() { 181 return PluginCfgDefn.getInstance().getPluginTypePropertyDefinition(); 182 } 183 184 185 186 /** 187 * Managed object client implementation. 188 */ 189 private static class FractionalLDIFImportPluginCfgClientImpl implements 190 FractionalLDIFImportPluginCfgClient { 191 192 // Private implementation. 193 private ManagedObject<? extends FractionalLDIFImportPluginCfgClient> impl; 194 195 196 197 // Private constructor. 198 private FractionalLDIFImportPluginCfgClientImpl( 199 ManagedObject<? extends FractionalLDIFImportPluginCfgClient> impl) { 200 this.impl = impl; 201 } 202 203 204 205 /** 206 * {@inheritDoc} 207 */ 208 public Boolean isEnabled() { 209 return impl.getPropertyValue(INSTANCE.getEnabledPropertyDefinition()); 210 } 211 212 213 214 /** 215 * {@inheritDoc} 216 */ 217 public void setEnabled(boolean value) { 218 impl.setPropertyValue(INSTANCE.getEnabledPropertyDefinition(), value); 219 } 220 221 222 223 /** 224 * {@inheritDoc} 225 */ 226 public boolean isInvokeForInternalOperations() { 227 return impl.getPropertyValue(INSTANCE.getInvokeForInternalOperationsPropertyDefinition()); 228 } 229 230 231 232 /** 233 * {@inheritDoc} 234 */ 235 public void setInvokeForInternalOperations(Boolean value) { 236 impl.setPropertyValue(INSTANCE.getInvokeForInternalOperationsPropertyDefinition(), value); 237 } 238 239 240 241 /** 242 * {@inheritDoc} 243 */ 244 public String getJavaClass() { 245 return impl.getPropertyValue(INSTANCE.getJavaClassPropertyDefinition()); 246 } 247 248 249 250 /** 251 * {@inheritDoc} 252 */ 253 public void setJavaClass(String value) { 254 impl.setPropertyValue(INSTANCE.getJavaClassPropertyDefinition(), value); 255 } 256 257 258 259 /** 260 * {@inheritDoc} 261 */ 262 public SortedSet<PluginType> getPluginType() { 263 return impl.getPropertyValues(INSTANCE.getPluginTypePropertyDefinition()); 264 } 265 266 267 268 /** 269 * {@inheritDoc} 270 */ 271 public void setPluginType(Collection<PluginType> values) { 272 impl.setPropertyValues(INSTANCE.getPluginTypePropertyDefinition(), values); 273 } 274 275 276 277 /** 278 * {@inheritDoc} 279 */ 280 public ManagedObjectDefinition<? extends FractionalLDIFImportPluginCfgClient, ? extends FractionalLDIFImportPluginCfg> definition() { 281 return INSTANCE; 282 } 283 284 285 286 /** 287 * {@inheritDoc} 288 */ 289 public PropertyProvider properties() { 290 return impl; 291 } 292 293 294 295 /** 296 * {@inheritDoc} 297 */ 298 public void commit() throws ManagedObjectAlreadyExistsException, 299 MissingMandatoryPropertiesException, ConcurrentModificationException, 300 OperationRejectedException, AuthorizationException, 301 CommunicationException { 302 impl.commit(); 303 } 304 305 } 306 307 308 309 /** 310 * Managed object server implementation. 311 */ 312 private static class FractionalLDIFImportPluginCfgServerImpl implements 313 FractionalLDIFImportPluginCfg { 314 315 // Private implementation. 316 private ServerManagedObject<? extends FractionalLDIFImportPluginCfg> impl; 317 318 // The value of the "enabled" property. 319 private final boolean pEnabled; 320 321 // The value of the "invoke-for-internal-operations" property. 322 private final boolean pInvokeForInternalOperations; 323 324 // The value of the "java-class" property. 325 private final String pJavaClass; 326 327 // The value of the "plugin-type" property. 328 private final SortedSet<PluginType> pPluginType; 329 330 331 332 // Private constructor. 333 private FractionalLDIFImportPluginCfgServerImpl(ServerManagedObject<? extends FractionalLDIFImportPluginCfg> impl) { 334 this.impl = impl; 335 this.pEnabled = impl.getPropertyValue(INSTANCE.getEnabledPropertyDefinition()); 336 this.pInvokeForInternalOperations = impl.getPropertyValue(INSTANCE.getInvokeForInternalOperationsPropertyDefinition()); 337 this.pJavaClass = impl.getPropertyValue(INSTANCE.getJavaClassPropertyDefinition()); 338 this.pPluginType = impl.getPropertyValues(INSTANCE.getPluginTypePropertyDefinition()); 339 } 340 341 342 343 /** 344 * {@inheritDoc} 345 */ 346 public void addFractionalLDIFImportChangeListener( 347 ConfigurationChangeListener<FractionalLDIFImportPluginCfg> listener) { 348 impl.registerChangeListener(listener); 349 } 350 351 352 353 /** 354 * {@inheritDoc} 355 */ 356 public void removeFractionalLDIFImportChangeListener( 357 ConfigurationChangeListener<FractionalLDIFImportPluginCfg> listener) { 358 impl.deregisterChangeListener(listener); 359 } 360 /** 361 * {@inheritDoc} 362 */ 363 public void addChangeListener( 364 ConfigurationChangeListener<PluginCfg> listener) { 365 impl.registerChangeListener(listener); 366 } 367 368 369 370 /** 371 * {@inheritDoc} 372 */ 373 public void removeChangeListener( 374 ConfigurationChangeListener<PluginCfg> listener) { 375 impl.deregisterChangeListener(listener); 376 } 377 378 379 380 /** 381 * {@inheritDoc} 382 */ 383 public boolean isEnabled() { 384 return pEnabled; 385 } 386 387 388 389 /** 390 * {@inheritDoc} 391 */ 392 public boolean isInvokeForInternalOperations() { 393 return pInvokeForInternalOperations; 394 } 395 396 397 398 /** 399 * {@inheritDoc} 400 */ 401 public String getJavaClass() { 402 return pJavaClass; 403 } 404 405 406 407 /** 408 * {@inheritDoc} 409 */ 410 public SortedSet<PluginType> getPluginType() { 411 return pPluginType; 412 } 413 414 415 416 /** 417 * {@inheritDoc} 418 */ 419 public Class<? extends FractionalLDIFImportPluginCfg> configurationClass() { 420 return FractionalLDIFImportPluginCfg.class; 421 } 422 423 424 425 /** 426 * {@inheritDoc} 427 */ 428 public DN dn() { 429 return impl.getDN(); 430 } 431 432 } 433}