registerServerSubCmd = new SubCommand(argParser,
SubCommandNameEnum.REGISTER_SERVER.toString(),
INFO_ADMIN_SUBCMD_REGISTER_SERVER_DESCRIPTION.get());
subCommands.add(registerServerSubCmd);
registerServerServerIdArg = new StringArgument("serverID", null,
OPTION_LONG_SERVERID, false, true, INFO_SERVERID_PLACEHOLDER.get(),
INFO_ADMIN_ARG_SERVERID_DESCRIPTION.get());
registerServerSubCmd.addArgument(registerServerServerIdArg);
registerServerSetArg = new StringArgument(OPTION_LONG_SET,
OPTION_SHORT_SET, OPTION_LONG_SET, false, true, true,
INFO_VALUE_SET_PLACEHOLDER.get(), null, null,
INFO_DSCFG_DESCRIPTION_PROP_VAL.get());
registerServerSubCmd.addArgument(registerServerSetArg);
// unregister-server subcommand
unregisterServerSubCmd = new SubCommand(argParser,
SubCommandNameEnum.UNREGISTER_SERVER.toString(),
INFO_ADMIN_SUBCMD_UNREGISTER_SERVER_DESCRIPTION.get());
subCommands.add(unregisterServerSubCmd);
unregisterServerServerIDArg = new StringArgument("serverID", null,
OPTION_LONG_SERVERID, false, true, INFO_SERVERID_PLACEHOLDER.get(),
INFO_ADMIN_ARG_SERVERID_DESCRIPTION.get());
unregisterServerSubCmd.addArgument(unregisterServerServerIDArg);
// list-servers subcommand
listServersSubCmd = new SubCommand(argParser,
SubCommandNameEnum.LIST_SERVERS.toString(),
INFO_ADMIN_SUBCMD_LIST_SERVERS_DESCRIPTION.get());
subCommands.add(listServersSubCmd);
// get-server-properties subcommand
getServerPropertiesSubCmd = new SubCommand(argParser,
SubCommandNameEnum.GET_SERVER_PROPERTIES.toString(),
INFO_ADMIN_SUBCMD_GET_SERVER_PROPERTIES_DESCRIPTION.get());
subCommands.add(getServerPropertiesSubCmd);
getServerPropertiesServerIdArg = new StringArgument("serverID", null,
OPTION_LONG_SERVERID, false, true, INFO_SERVERID_PLACEHOLDER.get(),
INFO_ADMIN_ARG_SERVERID_DESCRIPTION.get());
getServerPropertiesServerIdArg.setMultiValued(true);
getServerPropertiesSubCmd.addArgument(getServerPropertiesServerIdArg);
// set-server-properties subcommand
setServerPropertiesSubCmd = new SubCommand(argParser,
SubCommandNameEnum.SET_SERVER_PROPERTIES.toString(),
INFO_ADMIN_SUBCMD_SET_SERVER_PROPERTIES_DESCRIPTION.get());
subCommands.add(setServerPropertiesSubCmd);
setServerPropertiesServerIdArg = new StringArgument("serverID", null,
OPTION_LONG_SERVERID, true, true, INFO_SERVERID_PLACEHOLDER.get(),
INFO_ADMIN_ARG_SERVERID_DESCRIPTION.get());
setServerPropertiesSubCmd.addArgument(setServerPropertiesServerIdArg);
setServerPropertiesSetArg = new StringArgument(OPTION_LONG_SET,
OPTION_SHORT_SET, OPTION_LONG_SET, false, true, true,
INFO_VALUE_SET_PLACEHOLDER.get(), null, null,
INFO_DSCFG_DESCRIPTION_PROP_VAL.get());
setServerPropertiesSubCmd.addArgument(setServerPropertiesSetArg);
// Create association between ADSContext enum and server
// properties
// Server properties are mapped to Argument.
serverProperties = new HashMap<ServerProperty, Argument>();
readonlyServerProperties = new HashSet<ServerProperty>();
/**
* The ID used to identify the server.
*/
{
ServerProperty prop = ServerProperty.ID;
String attName = prop.getAttributeName();
StringArgument arg = new StringArgument(attName, null,
prop.getAttributeName(), false, false, true, Message.raw(""), null,
null, null);
serverProperties.put(prop, arg);
}
/**
* The host name of the server.
*/
{
ServerProperty prop = ServerProperty.HOST_NAME;
String attName = prop.getAttributeName();
readonlyServerProperties.add(prop);
StringArgument arg = new StringArgument(attName, null, attName, true,
false, true, Message.raw(""), "localhost", null, null);
serverProperties.put(prop, arg);
}
/**
* The LDAP port of the server.
*/
{
ServerProperty prop = ServerProperty.LDAP_PORT;
String attName = prop.getAttributeName();
IntegerArgument arg = new IntegerArgument(attName, null, attName, true,
true, true, Message.raw(attName), 389, null, null);
serverProperties.put(prop, arg);
}
/**
* The JMX port of the server.
*/
{
ServerProperty prop = ServerProperty.JMX_PORT;
String attName = prop.getAttributeName();
IntegerArgument arg = new IntegerArgument(attName, null, attName,
false, true, Message.raw(attName), null);
arg.setMultiValued(true);
serverProperties.put(prop, arg);
}
/**
* The JMX secure port of the server.
*/
{
ServerProperty prop = ServerProperty.JMXS_PORT;
String attName = prop.getAttributeName();
IntegerArgument arg = new IntegerArgument(attName, null, attName,
false, true, Message.raw(attName), null);
arg.setMultiValued(true);
serverProperties.put(prop, arg);
}
/**
* The LDAPS port of the server.
*/
{
ServerProperty prop = ServerProperty.LDAPS_PORT;
String attName = prop.getAttributeName();
IntegerArgument arg = new IntegerArgument(attName, null, attName,
false, true, Message.raw(attName), null);
arg.setMultiValued(true);
serverProperties.put(prop, arg);
}
/**
* The certificate used by the server.
*/
{
ServerProperty prop = ServerProperty.CERTIFICATE;
String attName = prop.getAttributeName();
StringArgument arg = new StringArgument(attName, null, attName, false,
false, true, Message.raw(attName), null, null, null);
serverProperties.put(prop, arg);
}
/**
* The path where the server is installed.
*/
{
ServerProperty prop = ServerProperty.INSTANCE_PATH;
String attName = prop.getAttributeName();
StringArgument arg = new StringArgument(attName, null, attName, false,
false, true, Message.raw(attName), null, null, null);
serverProperties.put(prop, arg);
}
/**
* The description of the server.
*/
{
ServerProperty prop = ServerProperty.DESCRIPTION;
String attName = prop.getAttributeName();
StringArgument arg = new StringArgument(attName, null, attName, false,
false, true, Message.raw(attName), null, null, null);
serverProperties.put(prop, arg);
}
/**
* The OS of the machine where the server is installed.
*/
{
ServerProperty prop = ServerProperty.HOST_OS;
String attName = prop.getAttributeName();
StringArgument arg = new StringArgument(attName, null, attName, false,
false, true, Message.raw(attName), null, null, null);
serverProperties.put(prop, arg);
}
/**
* Whether LDAP is enabled or not.
*/
{
ServerProperty prop = ServerProperty.LDAP_ENABLED;
String attName = prop.getAttributeName();
BooleanArgument arg = new BooleanArgument(attName, null, attName, null);
arg.setDefaultValue("false");
serverProperties.put(prop, arg);
}
/**
* Whether LDAPS is enabled or not.
*/
{
ServerProperty prop = ServerProperty.LDAPS_ENABLED;
String attName = prop.getAttributeName();
BooleanArgument arg = new BooleanArgument(attName, null, attName, null);
arg.setDefaultValue("false");
serverProperties.put(prop, arg);
}
/**
* Whether StartTLS is enabled or not.
*/
{
ServerProperty prop = ServerProperty.STARTTLS_ENABLED;
String attName = prop.getAttributeName();
BooleanArgument arg = new BooleanArgument(attName, null, attName, null);
arg.setDefaultValue("false");
serverProperties.put(prop, arg);
}
/**
* Whether JMX is enabled or not.
*/
{
ServerProperty prop = ServerProperty.JMX_ENABLED;
String attName = prop.getAttributeName();
BooleanArgument arg = new BooleanArgument(attName, null, attName, null);
arg.setDefaultValue("false");
serverProperties.put(prop, arg);
}
/**
* Whether JMXS is enabled or not.
*/
{
ServerProperty prop = ServerProperty.JMXS_ENABLED;
String attName = prop.getAttributeName();
BooleanArgument arg = new BooleanArgument(attName, null, attName, null);
arg.setDefaultValue("false");
serverProperties.put(prop, arg);
}
/**
* The location of the server.
*/
{
ServerProperty prop = ServerProperty.LOCATION;
String attName = prop.getAttributeName();
StringArgument arg = new StringArgument(attName, null, attName, false,
false, true, Message.raw(attName), null, null, null);
serverProperties.put(prop, arg);
}
/**
* The list of groups in which the server is registered.
*/
{
ServerProperty prop = ServerProperty.GROUPS;
String attName = prop.getAttributeName();
StringArgument arg = new StringArgument(attName, null, attName, false,
true, true, Message.raw(attName), null, null, null);
arg.setHidden(true);
serverProperties.put(prop, arg);
}
/**
* The INSTANCE_KEY_ID used to identify the server key ID.
*/
{
ServerProperty prop = ServerProperty.INSTANCE_KEY_ID;
String attName = prop.getAttributeName();
StringArgument arg = new StringArgument(attName, null, prop
.getAttributeName(), false, false, true, Message.raw(""), null, null,
null);
serverProperties.put(prop, arg);
}
/**
* The INSTANCE_PUBLIC_KEY_CERTIFICATE associated to the server.
*/
{
ServerProperty prop = ServerProperty.INSTANCE_PUBLIC_KEY_CERTIFICATE;
String attName = prop.getAttributeName();
StringArgument arg = new StringArgument(attName, null, prop
.getAttributeName(), false, false, true, Message.raw(""), null, null,
null);
serverProperties.put(prop, arg);
}
}