lookupConfiguration();
return OUTCOME_SUCCESS;
}
public String addResource() {
ImportResourceResponse response = null;
ImportResourceRequest request = new ImportResourceRequest(getType().getId(), EnterpriseFacesContextUtility
.getResource().getId(), getConfiguration());
try {
response = discoveryBoss.manuallyAddResource(EnterpriseFacesContextUtility.getSubject(), request);
} catch (InvalidPluginConfigurationClientException e) {
FacesContextUtility
.addMessage(
FacesMessage.SEVERITY_ERROR,
"The Agent was unable to connect to the "
+ getType()
+ " managed resource using the supplied connection properties. Please check that the connection properties are correct and that the managed resource on the agent machine is online. ",
e);
} catch (PluginContainerException e) {
FacesContextUtility
.addMessage(FacesMessage.SEVERITY_FATAL, "An unexpected error occurred in the Agent.", e);
} catch (RuntimeException e) {
FacesContextUtility.addMessage(FacesMessage.SEVERITY_FATAL, "Unable to connect to the Agent.", e);
}
String outcome;
if (response == null) {
outcome = OUTCOME_FAILURE;
} else {
Resource resource = LookupUtil.getResourceManager().getResourceById(
EnterpriseFacesContextUtility.getSubject(), response.getResource().getId());
if (response.isResourceAlreadyExisted()) {
FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN, "A " + getType().getName()
+ " with the specified connection properties was already in inventory.");
} else {
FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "A " + getType().getName()
+ " has been added to inventory with the name '" + resource.getName() + "'.");