use of org.glassfish.connectors.config.WorkSecurityMap in project Payara by payara.
the class ListConnectorWorkSecurityMaps method execute.
/**
* Executes the command with the command parameters passed as Properties
* where the keys are the paramter names and the values the parameter values
*
* @param context information
*/
public void execute(AdminCommandContext context) {
final ActionReport report = context.getActionReport();
final ActionReport.MessagePart mp = report.getTopMessagePart();
try {
boolean foundWSM = false;
Collection<WorkSecurityMap> workSecurityMaps = domain.getResources().getResources(WorkSecurityMap.class);
for (WorkSecurityMap wsm : workSecurityMaps) {
if (wsm.getResourceAdapterName().equals(raName)) {
if (securityMap == null) {
listWorkSecurityMap(wsm, mp);
foundWSM = true;
} else if (wsm.getName().equals(securityMap)) {
listWorkSecurityMap(wsm, mp);
foundWSM = true;
break;
}
}
}
if (!foundWSM) {
report.setMessage(localStrings.getLocalString("list.connector.work.security.maps.workSecurityMapNotFound", "Nothing to list. Either the resource adapter {0} does not exist or the" + "resource adapter {0} is not associated with any work security map.", raName));
}
} catch (Exception e) {
Logger.getLogger(ListConnectorWorkSecurityMaps.class.getName()).log(Level.SEVERE, "list-connector-work-security-maps failed", e);
report.setMessage(localStrings.getLocalString("" + "list.connector.work.security.maps.fail", "Unable to list connector work security map {0} for resource adapter {1}", securityMap, raName) + " " + e.getLocalizedMessage());
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setFailureCause(e);
return;
}
report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
use of org.glassfish.connectors.config.WorkSecurityMap in project Payara by payara.
the class WorkSecurityMapHelper method doesMapNameExist.
static boolean doesMapNameExist(String raName, String mapname, Resources resources) {
// check if the mapname exists for the given resource adapter name..
List<WorkSecurityMap> maps = ConnectorsUtil.getWorkSecurityMaps(raName, resources);
boolean doesMapNameExist = false;
if (maps != null) {
for (WorkSecurityMap wsm : maps) {
String name = wsm.getName();
if (name.equals(mapname)) {
doesMapNameExist = true;
break;
}
}
}
return doesMapNameExist;
}
Aggregations