DhtAdm.java revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 usr/src/OPENSOLARIS.LICENSE
* 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 usr/src/OPENSOLARIS.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
*/
/*
* ident "%Z%%M% %I% %E% SMI"
*
* Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/**
* This class represents the entry point to the DHCP CLI dhcptab
* administration.
*/
public class DhtAdm
extends DhcpCliProgram {
/**
* The program signature.
*/
/**
* The valid options for all DhtAdm administration.
*/
public static final int ADD_ENTRY = 'A';
public static final int MODIFY_ENTRY = 'M';
public static final int DELETE_ENTRY = 'D';
public static final int CREATE_TABLE = 'C';
public static final int REMOVE_TABLE = 'R';
public static final int DISPLAY_TABLE = 'P';
public static final int BATCH_EXECUTION = 'B';
public static final int MACRONAME = 'm';
public static final int SYMBOLNAME = 's';
public static final int NEWNAME = 'n';
public static final int DEFINITION = 'd';
public static final int EDITSYMBOL = 'e';
public static final int RESOURCE = 'r';
public static final int RESOURCE_CONFIG = 'u';
public static final int PATH = 'p';
public static final int VERBOSE = 'v';
public static final int SIGHUP = 'g';
/**
* Constructs a dhtadm command.
* @param args the options to the command.
*/
// Set the options.
//
options = new DhcpCliOptions();
} // constructor
/**
* Resets a DhtAdm for reuse. Used by DhcpBatch program.
* @param args the options to the command.
*/
options = new DhcpCliOptions();
}
/**
* Returns the manpage signature for the program.
* @return the manpage signature for the program.
*/
public String getManPage() {
return "dhtadm(1M)";
}
/**
* Displays program usage.
*/
public void usage() {
} // usage
/**
* Executes the program function.
* @return SUCCESS, EXISTS, ENOENT, WARNING, or CRITICAL
*/
public int execute() {
int returnCode = SUCCESS;
// Get the options and go exec the correct function.
//
try {
int option;
}
}
throw new IllegalArgumentException(msg);
}
// Check the validity of the data store version.
//
if (!function.isVersionValid(false)) {
return (CRITICAL);
}
// Create a DHCP datastore object with the user specified objects.
//
} catch (IllegalArgumentException e) {
usage();
} catch (Throwable e) {
}
// Signal server if requested by user and main operation successful
try {
} catch (Throwable e) {
// Display warning
}
}
return (returnCode);
} // execute
/**
* Processes one program argument.
* @param option the option flag
* @param value the option value(if any)
* @exception IllegalArgumentException if an invalid argument was entered
*/
throws IllegalArgumentException {
switch (option) {
case ADD_ENTRY:
setFunction(new AddEntry());
break;
case MODIFY_ENTRY:
setFunction(new ModifyEntry());
break;
case DELETE_ENTRY:
setFunction(new DeleteEntry());
break;
case CREATE_TABLE:
setFunction(new CreateTable());
break;
case REMOVE_TABLE:
setFunction(new RemoveTable());
break;
case DISPLAY_TABLE:
setFunction(new DisplayTable());
break;
case BATCH_EXECUTION:
break;
default:
}
} // processArg
/**
* Returns a localized string for this function
* @param key the resource bundle string identifier
* @return string from resource bundle.
*/
} // getString
/**
* The entry point for the program.
* @param args the program arguments
*/
if (dhtadm.isValidUser()) {
}
} // main
} // DhtAdm