PntAdm.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 (c) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
/**
* This class represents the entry point to the DHCP CLI network tables
* administration.
*/
public class PntAdm
extends DhcpCliProgram {
/**
* The program signature.
*/
/**
* The valid options for all PntAdm administration.
*/
public static final int ADD_CLIENT_ENTRY = 'A';
public static final int MODIFY_CLIENT_ENTRY = 'M';
public static final int DELETE_CLIENT_ENTRY = 'D';
public static final int CREATE_NETWORK_TABLE = 'C';
public static final int REMOVE_NETWORK_TABLE = 'R';
public static final int DISPLAY_NETWORK_TABLE = 'P';
public static final int LIST_NETWORK_TABLES = 'L';
public static final int BATCH_EXECUTION = 'B';
public static final int VERIFY_MACRO = 'y';
public static final int DELETE_HOST = 'y';
public static final int CONVERT_CLIENTID = 'a';
public static final int RAW = 'x';
public static final int VERBOSE = 'v';
public static final int RESOURCE = 'r';
public static final int RESOURCE_CONFIG = 'u';
public static final int PATH = 'p';
public static final int SERVER = 's';
public static final int CLIENTID = 'i';
public static final int FLAGS = 'f';
public static final int LEASE_EXPIRATION = 'e';
public static final int HOST_NAME = 'h';
public static final int MACRO_NAME = 'm';
public static final int COMMENT = 'c';
public static final int NEW_IP = 'n';
/**
* Constructs a pntadm command.
* @param args the options to the command.
*/
} // constructor
/**
* Resets a PntAdm 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 "pntadm(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(
}
throw new IllegalArgumentException(msg);
}
// Check the validity of the data store version.
//
if (!function.isVersionValid(false)) {
return (CRITICAL);
}
// Not all functions accept network arguments.
//
if (function instanceof ListNetworkTables ||
function instanceof PntAdmBatch) {
throw new IllegalArgumentException(msg);
}
} else {
throw new IllegalArgumentException(msg);
}
}
// Create a DHCP datastore object with the user specified objects.
//
} catch (IllegalArgumentException e) {
usage();
} catch (Throwable e) {
}
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_CLIENT_ENTRY:
break;
case MODIFY_CLIENT_ENTRY:
break;
case DELETE_CLIENT_ENTRY:
break;
case CREATE_NETWORK_TABLE:
setFunction(new CreateNetworkTable());
break;
case REMOVE_NETWORK_TABLE:
setFunction(new RemoveNetworkTable());
break;
case DISPLAY_NETWORK_TABLE:
setFunction(new DisplayNetworkTable());
break;
case LIST_NETWORK_TABLES:
setFunction(new ListNetworkTables());
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 (pntadm.isValidUser()) {
}
} // main
} // PntAdm