Search in sources :

Example 11 with WorkSecurityMap

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);
}
Also used : WorkSecurityMap(org.glassfish.connectors.config.WorkSecurityMap) ActionReport(org.glassfish.api.ActionReport)

Example 12 with WorkSecurityMap

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;
}
Also used : WorkSecurityMap(org.glassfish.connectors.config.WorkSecurityMap)

Aggregations

WorkSecurityMap (org.glassfish.connectors.config.WorkSecurityMap)12 ActionReport (org.glassfish.api.ActionReport)4 GroupMap (org.glassfish.connectors.config.GroupMap)4 PrincipalMap (org.glassfish.connectors.config.PrincipalMap)4 Resources (com.sun.enterprise.config.serverbeans.Resources)3 PropertyVetoException (java.beans.PropertyVetoException)3 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)3 BindableResource (com.sun.enterprise.config.serverbeans.BindableResource)2 Resource (com.sun.enterprise.config.serverbeans.Resource)2 ResourcePool (com.sun.enterprise.config.serverbeans.ResourcePool)2 Iterator (java.util.Iterator)2 Map (java.util.Map)2 AdminObjectResource (org.glassfish.connectors.config.AdminObjectResource)2 ConnectorResource (org.glassfish.connectors.config.ConnectorResource)2 ResourceAdapterConfig (org.glassfish.connectors.config.ResourceAdapterConfig)2 Module (com.sun.enterprise.config.serverbeans.Module)1 ConnectorApplication (com.sun.enterprise.connectors.module.ConnectorApplication)1 HashMap (java.util.HashMap)1 Group (org.glassfish.security.common.Group)1 PrincipalImpl (org.glassfish.security.common.PrincipalImpl)1