public void performMapping(Map<String, Object> contextMap, RoleGroup mappedObject) { if (contextMap == null || contextMap.isEmpty()) throw PicketBoxMessages.MESSAGES.invalidNullArgument("contextMap"); //Obtain the principal to roles mapping Principal principal = getCallerPrincipal(contextMap); if (principal != null && rolesQuery != null) { String username = principal.getName(); Util.addRolesToGroup(username, mappedObject, dsJndiName, rolesQuery, suspendResume, tm); result.setMappedObject(mappedObject); } }
public void init(Map<String, Object> options) { if (options != null) { dsJndiName = (String) options.get("dsJndiName"); if (dsJndiName == null) throw PicketBoxMessages.MESSAGES.invalidNullProperty("dsJndiName"); rolesQuery = (String) options.get("rolesQuery"); if (rolesQuery == null) throw PicketBoxMessages.MESSAGES.invalidNullProperty("rolesQuery"); String option = (String) options.get("suspendResume"); if (option != null) suspendResume = Boolean.valueOf(option.toString()).booleanValue(); // Get the Transaction Manager JNDI Name option = (String) options.get("transactionManagerJndiName"); if (option != null) TX_MGR_JNDI_NAME = option; try { if (suspendResume) tm = getTransactionManager(); } catch (NamingException e) { throw PicketBoxMessages.MESSAGES.failedToGetTransactionManager(e); } } }