/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
* add the following below this CDDL HEADER, with the fields enclosed
* by brackets "[]" replaced with your own identifying information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2009 Sun Microsystems, Inc.
*/
/**
* A sub-command handler which is used to delete existing managed
* objects.
* <p>
* This sub-command implements the various delete-xxx sub-commands.
*/
/**
* The value for the long option force.
*/
/**
* The value for the short option force.
*/
/**
* Creates a new delete-xxx sub-command for an instantiable
* relation.
*
* @param parser
* The sub-command argument parser.
* @param p
* The parent managed object path.
* @param r
* The instantiable relation.
* @return Returns the new delete-xxx sub-command.
* @throws ArgumentException
* If the sub-command could not be created successfully.
*/
InstantiableRelationDefinition<?, ?> r) throws ArgumentException {
}
/**
* Creates a new delete-xxx sub-command for an optional relation.
*
* @param parser
* The sub-command argument parser.
* @param p
* The parent managed object path.
* @param r
* The optional relation.
* @return Returns the new delete-xxx sub-command.
* @throws ArgumentException
* If the sub-command could not be created successfully.
*/
OptionalRelationDefinition<?, ?> r) throws ArgumentException {
}
/**
* Creates a new delete-xxx sub-command for a set relation.
*
* @param parser
* The sub-command argument parser.
* @param p
* The parent managed object path.
* @param r
* The set relation.
* @return Returns the new delete-xxx sub-command.
* @throws ArgumentException
* If the sub-command could not be created successfully.
*/
SetRelationDefinition<?, ?> r) throws ArgumentException {
}
// The argument which should be used to force deletion.
// The sub-commands naming arguments.
// The path of the managed object.
// The relation which references the managed
// object to be deleted.
// The sub-command associated with this handler.
// Private constructor.
private DeleteSubCommandHandler(
RelationDefinition<?, ?> r, ManagedObjectPath<?, ?> c)
throws ArgumentException {
this.path = p;
this.relation = r;
// Create the sub-command.
// Create the naming arguments.
// Create the --force argument which is used to force deletion.
// Register the tags associated with the child managed objects.
}
/**
* Gets the relation definition associated with the type of
* component that this sub-command handles.
*
* @return Returns the relation definition associated with the type
* of component that this sub-command handles.
*/
return relation;
}
/**
* {@inheritDoc}
*/
return subCommand;
}
/**
* {@inheritDoc}
*/
// Get the naming argument values.
// Reset the command builder
setCommandBuilderUseful(false);
// Delete the child managed object.
try {
} catch (AuthorizationException e) {
} catch (DefinitionDecodingException e) {
} catch (ManagedObjectDecodingException e) {
} catch (CommunicationException e) {
} catch (ConcurrentModificationException e) {
} catch (ManagedObjectNotFoundException e) {
// Ignore the error if the deletion is being forced.
if (!forceArgument.isPresent()) {
if (app.isInteractive()) {
return MenuResult.cancel();
} else {
}
} else {
}
}
if (!app.isMenuDrivenMode()) {
// User chose to cancel deletion.
}
return MenuResult.quit();
// Must be menu driven, so no need for error message.
return MenuResult.cancel();
}
try {
if (relation instanceof InstantiableRelationDefinition
|| relation instanceof SetRelationDefinition) {
if (!app.isMenuDrivenMode()) {
// User chose to cancel deletion.
}
return MenuResult.quit();
// Must be menu driven, so no need for error message.
return MenuResult.cancel();
} else {
}
} else if (relation instanceof SetRelationDefinition) {
// The provided type short name needs mapping to the full name.
// The name must be invalid.
throw new ArgumentException(msg);
} else {
}
}
if (confirmDeletion(app)) {
setCommandBuilderUseful(true);
if (relation instanceof InstantiableRelationDefinition) {
} else {
}
} else {
return MenuResult.cancel();
}
} else if (relation instanceof OptionalRelationDefinition) {
OptionalRelationDefinition<?, ?> orelation =
(OptionalRelationDefinition<?, ?>) relation;
if (confirmDeletion(app)) {
setCommandBuilderUseful(true);
} else {
return MenuResult.cancel();
}
}
} catch (AuthorizationException e) {
} catch (OperationRejectedException e) {
} else {
}
if (app.isInteractive()) {
// If interactive, let the user go back to the main menu.
}
printer.setDisplayHeadings(false);
return MenuResult.cancel();
} else {
msg, e);
}
} catch (ManagedObjectNotFoundException e) {
// Ignore the error if the deletion is being forced.
if (!forceArgument.isPresent()) {
}
} catch (ConcurrentModificationException e) {
} catch (CommunicationException e) {
}
// Add the naming arguments if they were provided.
{
{
}
}
// Output success message.
}
// Confirm deletion.
if (app.isInteractive()) {
.getUserFriendlyName());
// Output failure message.
.getUserFriendlyName());
return false;
}
}
return true;
}
}