use of com.sun.messaging.jmq.admin.objstore.ObjStoreAttrs in project openmq by eclipse-ee4j.
the class CmdPreviewer method previewListCommand.
/*
* Preview list command
*/
private void previewListCommand(ObjMgrProperties objMgrProps) {
/*
* Get object type, props object, and lookup name
*/
String type = objMgrProps.getObjType();
ObjStoreAttrs osa = objMgrProps.getObjStoreAttrs();
// String lookupName = objMgrProps.getLookupName();
String typeString = Utils.getObjTypeString(type);
if (typeString != null) {
Globals.stdOutPrintln(ar.getString(ar.I_PREVIEW_LIST_TYPE, typeString));
} else {
Globals.stdOutPrintln(ar.getString(ar.I_PREVIEW_LIST));
}
Globals.stdOutPrintln("");
ObjMgrPrinter omp = new ObjMgrPrinter(osa, 2, 4);
omp.print();
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_OBJ_NOT_LISTED));
}
use of com.sun.messaging.jmq.admin.objstore.ObjStoreAttrs in project openmq by eclipse-ee4j.
the class CmdPreviewer method previewUpdateCommand.
/*
* Preview update command
*/
private void previewUpdateCommand(ObjMgrProperties objMgrProps) {
/*
* Get object type, props object, and lookup name
*/
String type = objMgrProps.getObjType();
Properties objProps = objMgrProps.getObjProperties();
ObjStoreAttrs osa = objMgrProps.getObjStoreAttrs();
String lookupName = objMgrProps.getLookupName();
/*
* Check if -f (force) was specified on cmd line.
*/
boolean force = objMgrProps.forceModeSet();
String typeString = Utils.getObjTypeString(type);
if (force)
Globals.stdOutPrintln(ar.getString(ar.I_PROMPT_OFF));
else
Globals.stdOutPrintln(ar.getString(ar.I_PROMPT_ON));
Globals.stdOutPrintln("");
if (typeString != null) {
/*
* Create JMS Object with the specified properties. We don't really need to print all the object's attributes since we
* only want to show the attributes that will be updated. These attributes are stored in 'objProps'. The JMS Object is
* created here so we can get a hold of the attribute/property labels.
*/
try {
if (type.equals(OBJMGR_TYPE_QUEUE)) {
JMSObjFactory.createQueue(objProps);
} else if (type.equals(OBJMGR_TYPE_TOPIC)) {
JMSObjFactory.createTopic(objProps);
} else if (type.equals(OBJMGR_TYPE_XQCF)) {
JMSObjFactory.createXAQueueConnectionFactory(objProps);
} else if (type.equals(OBJMGR_TYPE_XTCF)) {
JMSObjFactory.createXATopicConnectionFactory(objProps);
} else if (type.equals(OBJMGR_TYPE_XCF)) {
JMSObjFactory.createXAConnectionFactory(objProps);
} else if (type.equals(OBJMGR_TYPE_QCF)) {
JMSObjFactory.createQueueConnectionFactory(objProps);
} else if (type.equals(OBJMGR_TYPE_TCF)) {
JMSObjFactory.createTopicConnectionFactory(objProps);
} else if (type.equals(OBJMGR_TYPE_CF)) {
JMSObjFactory.createConnectionFactory(objProps);
}
} catch (Exception e) {
handleRunCommandExceptions(e, lookupName);
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_OBJ_PREV_UPDATE_FAILED));
return;
}
Globals.stdOutPrintln(ar.getString(ar.I_PREVIEW_UPDATE_TYPE, typeString));
Globals.stdOutPrintln("");
ObjMgrPrinter omp = new ObjMgrPrinter(objProps, 2, 4);
omp.print();
} else {
Globals.stdOutPrintln(ar.getString(ar.I_PREVIEW_UPDATE));
Globals.stdOutPrintln("");
ObjMgrPrinter omp = new ObjMgrPrinter(objProps, 2, 4);
omp.print();
}
Globals.stdOutPrintln("");
ObjMgrPrinter.printReadOnly(objMgrProps.readOnlyValue());
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_WITH_LOOKUP_NAME));
Globals.stdOutPrintln("");
Globals.stdOutPrintln(lookupName);
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_UPDATE_CMD_DESC_STORE));
Globals.stdOutPrintln("");
ObjMgrPrinter omp = new ObjMgrPrinter(osa, 2, 4);
omp.print();
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_OBJ_NOT_UPDATED));
}
use of com.sun.messaging.jmq.admin.objstore.ObjStoreAttrs in project openmq by eclipse-ee4j.
the class CmdPreviewer method previewAddCommand.
/*
* Preview add command
*/
private void previewAddCommand(ObjMgrProperties objMgrProps) {
/*
* Get object type, props object, and lookup name
*/
String type = objMgrProps.getObjType();
Properties objProps = objMgrProps.getObjProperties();
ObjStoreAttrs osa = objMgrProps.getObjStoreAttrs();
String lookupName = objMgrProps.getLookupName();
/*
* Check if -f (force) was specified on cmd line.
*/
boolean force = objMgrProps.forceModeSet();
/*
* Create JMS Object with the specified properties.
*/
Object newObj = null;
try {
if (type.equals(OBJMGR_TYPE_QUEUE)) {
newObj = JMSObjFactory.createQueue(objProps);
} else if (type.equals(OBJMGR_TYPE_TOPIC)) {
newObj = JMSObjFactory.createTopic(objProps);
} else if (type.equals(OBJMGR_TYPE_XQCF)) {
newObj = JMSObjFactory.createXAQueueConnectionFactory(objProps);
} else if (type.equals(OBJMGR_TYPE_XTCF)) {
newObj = JMSObjFactory.createXATopicConnectionFactory(objProps);
} else if (type.equals(OBJMGR_TYPE_XCF)) {
newObj = JMSObjFactory.createXAConnectionFactory(objProps);
} else if (type.equals(OBJMGR_TYPE_QCF)) {
newObj = JMSObjFactory.createQueueConnectionFactory(objProps);
} else if (type.equals(OBJMGR_TYPE_TCF)) {
newObj = JMSObjFactory.createTopicConnectionFactory(objProps);
} else if (type.equals(OBJMGR_TYPE_CF)) {
newObj = JMSObjFactory.createConnectionFactory(objProps);
}
} catch (Exception e) {
handleRunCommandExceptions(e, lookupName);
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_OBJ_PREV_ADD_FAILED));
return;
}
if (force)
Globals.stdOutPrintln(ar.getString(ar.I_PROMPT_OFF));
else
Globals.stdOutPrintln(ar.getString(ar.I_PROMPT_ON));
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_PREVIEW_ADD, Utils.getObjTypeString(type)));
Globals.stdOutPrintln("");
ObjMgrPrinter omp = new ObjMgrPrinter(2, 4);
omp.printObjPropertiesFromObj((AdministeredObject) newObj);
Globals.stdOutPrintln("");
ObjMgrPrinter.printReadOnly(objMgrProps.readOnlyValue());
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_ADD_CMD_DESC_LOOKUP));
Globals.stdOutPrintln("");
Globals.stdOutPrintln(lookupName);
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_ADD_CMD_DESC_STORE));
Globals.stdOutPrintln("");
ObjMgrPrinter omp2 = new ObjMgrPrinter(osa, 2, 4);
omp2.print();
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_OBJ_NOT_ADDED));
}
use of com.sun.messaging.jmq.admin.objstore.ObjStoreAttrs in project openmq by eclipse-ee4j.
the class ObjMgrProperties method getObjStoreAttrs.
/**
* Returns a ObjStoreAttrs object containing the attributes that are relevant for creating an object store. These
* attributes are also normalized e.g. the preceding <EM>objstore.attrs.</EM> is stripped.
*
* @param commandIndex Index for specifyng which command (for the case where multiple commands exist in the same
* ObjMgrProperties object).
*
* @return A ObjStoreAttrs object containing attributes needed for creation of an object store.
*/
public ObjStoreAttrs getObjStoreAttrs(int commandIndex) {
ObjStoreAttrs osa = new ObjStoreAttrs();
String objstoreAttrsStr = OBJMGR_OBJSTORE_ATTRS_PROP_NAME + ".";
int objstoreAttrsStrLen = objstoreAttrsStr.length();
if (commandIndex == -1) {
for (Enumeration e = propertyNames(); e.hasMoreElements(); ) {
String propName = (String) e.nextElement();
if (propName.startsWith(objstoreAttrsStr)) {
String newPropName, value;
newPropName = propName.substring(objstoreAttrsStrLen);
value = getProperty(propName);
osa.put(newPropName, value);
}
}
return (osa);
}
return (null);
}
use of com.sun.messaging.jmq.admin.objstore.ObjStoreAttrs in project openmq by eclipse-ee4j.
the class CmdRunner method runListCommand.
private int runListCommand(ObjMgrProperties objMgrProps) {
int exitcode = 0;
/*
* Check if a type was specified otherwise just list all jms objs.
*/
ObjStore os;
String type = objMgrProps.getObjType();
ObjStoreAttrs osa = objMgrProps.getObjStoreAttrs();
/*
* Check for any mandatory bind attrs and display warning, if necessary.
*/
checkObjStoreAttrs(osa);
/*
* Check if -f (force) was specified on cmd line.
*/
boolean force = objMgrProps.forceModeSet();
printListCmdDescription(type, osa);
os = createStore(osa);
if (os == null) {
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_OBJ_LIST_FAILED));
return (1);
}
/*
* Prompt for missing authentication info BEFORE opening the store.
*/
if (!force) {
// Update ObjStoreAttrs in ths ObjStore if some security
// info was missing.
os = promptForAuthentication(os);
}
/*
* Open/Initialize the object store.
*/
try {
openStore(os);
} catch (Exception e) {
handleRunCommandExceptions(e);
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_OBJ_LIST_FAILED));
return (1);
}
if (type != null) {
exitcode = listByType(os, type);
} else {
exitcode = listAll(os);
}
if (exitcode == 0) {
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_OBJ_LISTED));
} else {
Globals.stdOutPrintln("");
Globals.stdErrPrintln(ar.getString(ar.I_OBJ_LIST_FAILED));
}
return (exitcode);
}
Aggregations