if(resourceType == null){
try{
//list all JMS resources
for (Object r : adminObjectResources) {
AdminObjectResource adminObject = (AdminObjectResource) r;
if (JMSRA.equalsIgnoreCase(adminObject.getResAdapter()))
//if(QUEUE.equals(r.getResType()) || TOPIC.equals(r.getResType()))
list.add(adminObject.getJndiName());
}
for (Object c: connectorResources) {
ConnectorResource cr = (ConnectorResource) c;
ConnectorConnectionPool cp = (ConnectorConnectionPool) ConnectorsUtil.getResourceByName(
domain.getResources(), ConnectorConnectionPool.class, cr.getPoolName());
if (cp != null && JMSRA.equalsIgnoreCase(cp.getResourceAdapterName())){
list.add(cr.getJndiName());
}
//if(QUEUE_CF.equals(cp.getConnectionDefinitionName()) || TOPIC_CF.equals(cp.getConnectionDefinitionName())
// || UNIFIED_CF.equals(cp.getConnectionDefinitionName()))
}
if (list.isEmpty()) {
final ActionReport.MessagePart part = report.getTopMessagePart().addChild();
part.setMessage(localStrings.getLocalString("nothingToList",
"Nothing to list."));
extraProperties.put("jmsResources", list);
} else {
List <String> resourceList = null;
if(CommandTarget.DOMAIN.isValid(habitat, target))
resourceList = list;
else
resourceList = filterListForTarget(list);
//if(resourceList == null)
// resourceList = list;
for (String jndiName : resourceList) {
final ActionReport.MessagePart part = report.getTopMessagePart().addChild();
part.setMessage(jndiName);
}
extraProperties.put("jmsResources", resourceList);
}
report.setExtraProperties(extraProperties);
} catch (Exception e) {
report.setMessage(localStrings.getLocalString("list.jms.resources.fail",
"Unable to list JMS Resources") + " " + e.getLocalizedMessage());
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setFailureCause(e);
return;
}
} else {
if(resourceType.equals(TOPIC_CF) || resourceType.equals(QUEUE_CF) || resourceType.equals(UNIFIED_CF)){
for (Object c : connectorResources) {
ConnectorResource cr = (ConnectorResource)c;
ConnectorConnectionPool cp = (ConnectorConnectionPool)
ConnectorsUtil.getResourceByName(domain.getResources(), ConnectorConnectionPool.class, cr.getPoolName());
if(cp != null && resourceType.equals(cp.getConnectionDefinitionName()) && JMSRA.equalsIgnoreCase(cp.getResourceAdapterName()))
list.add(cp.getName());
}
} else if (resourceType.equals(TOPIC) || resourceType.equals(QUEUE))
{
for (Object r : adminObjectResources) {
AdminObjectResource res = (AdminObjectResource)r;
if(resourceType.equals(res.getResType()))
list.add(res.getJndiName());
}
}