@Test(enabled = false) public void testExecuteQuery() { EqualsFilter filter = new EqualsFilter(AttributeBuilder.build(Name.NAME, "AAB0001")); OperationOptions oo = null; List<ConnectorObject> results = TestHelpers.searchToList(facade, ObjectClass.GROUP, filter, oo); Assert.assertFalse(results.isEmpty(), "result is empty"); }
public void executeQuery(ObjectClass objClass, String query, ResultsHandler handler, OperationOptions options) { final String method = "executeQuery"; LOG.info("Entry {0}", method); Set<String> attributesToGet = null; if (options != null && options.getAttributesToGet() != null) { attributesToGet = CollectionUtil.newReadOnlySet(options.getAttributesToGet()); } else { ObjectClassInfo oci = schema().findObjectClassInfo(objClass.getObjectClassValue()); if (oci != null) { attributesToGet = new HashSet<String>(); for (AttributeInfo a : oci.getAttributeInfo()) { attributesToGet.add(a.getName()); } } else { throw new ConnectorException("Object class " + objClass.getObjectClassValue() + "is not supported"); } } if (objClass.is(ObjectClass.ACCOUNT_NAME)) { try { if (StringUtil.isBlank(query)) { query = PDUser.PDUSER_ALLPATTERN; } PDMessages msgs = new PDMessages(); ArrayList userList = PDUser.listUsers(ctxt, query, PDUser.PDUSER_MAXRETURN, false, msgs); if (LOG.isInfo()) { LOG.info("PDUser.listUsers(ctxt,{0},{1},false,msgs)", query, PDUser.PDUSER_MAXRETURN); } if (userList == null || userList.isEmpty()) { LOG.info("User Not Found for query={0}", query); return; } if (getNamesOnly(attributesToGet)) { for (Object o : userList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setUid(name); bld.setName(name); handler.handle(bld.build()); } } else { for (Object o : userList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); PDUser pdUser = new PDUser(ctxt, name, msgs); processMessages(method, msgs); if (LOG.isInfo()) { LOG.info("Process PDUser: {0} \n" + "RegistryName={1}\n" + "FirstName={2}\n" + "LastName={3}\n" + "Descr={4}\n" + "Groups={5}\n" + "SSOUser={6}\n", name, pdUser.getRgyName(), pdUser.getFirstName(), pdUser.getLastName(), pdUser .getDescription(), pdUser.getGroups(), pdUser .isSSOUser()); } bld.setUid(pdUser.getId()); bld.setName(pdUser.getId()); bld.addAttribute(ATTR_REGISTRY_NAME, pdUser.getRgyName()); Map<String, List<String>> gsoCreds = null; for (String attrName : attributesToGet) { if (ATTR_FIRST_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_FIRST_NAME, pdUser.getFirstName()); continue; } if (ATTR_LAST_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_LAST_NAME, pdUser.getLastName()); continue; } if (PredefinedAttributes.DESCRIPTION.equalsIgnoreCase(attrName)) { bld.addAttribute(PredefinedAttributes.DESCRIPTION, pdUser .getDescription()); continue; } if (PredefinedAttributes.GROUPS_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(PredefinedAttributes.GROUPS_NAME, pdUser .getGroups()); continue; } if (ATTR_SSO_USER.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_SSO_USER, Boolean.valueOf(pdUser.isSSOUser())); continue; } if (ATTR_GSO_WEB_CREDENTIALS.equalsIgnoreCase(attrName)) { if (gsoCreds == null) { gsoCreds = getUserGSOCredentials(name, msgs); } bld.addAttribute(ATTR_GSO_WEB_CREDENTIALS, gsoCreds .get(PDSSOCred.PDSSOCRED_SSORESOURCE)); continue; } if (ATTR_GSO_GROUP_CREDENTIALS.equalsIgnoreCase(attrName)) { if (gsoCreds == null) { gsoCreds = getUserGSOCredentials(name, msgs); } bld.addAttribute(ATTR_GSO_GROUP_CREDENTIALS, gsoCreds .get(PDSSOCred.PDSSOCRED_SSORESOURCEGROUP)); continue; } if (ATTR_EXPIRE_PASSWORD.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_EXPIRE_PASSWORD, pdUser.isPasswordValid()); continue; } if (OperationalAttributes.ENABLE_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(OperationalAttributes.ENABLE_NAME, pdUser .isAccountValid()); continue; } } handler.handle(bld.build()); } } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(ObjectClass.GROUP_NAME)) { try { if (StringUtil.isBlank(query)) { query = PDGroup.PDGROUP_ALLPATTERN; } PDMessages msgs = new PDMessages(); boolean listByRegistryName = false; ArrayList objectList = PDGroup.listGroups(ctxt, query, PDGroup.PDGROUP_MAXRETURN, listByRegistryName, msgs); if (getNamesOnly(attributesToGet)) { for (Object o : objectList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setObjectClass(objClass); bld.setUid(name); bld.setName(name); handler.handle(bld.build()); } } else { for (Object o : objectList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setObjectClass(objClass); PDGroup pdGroup = new PDGroup(ctxt, name, msgs); bld.setUid(pdGroup.getId()); bld.setName(pdGroup.getId()); for (String attrName : attributesToGet) { if (ATTR_REGISTRY_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_REGISTRY_NAME, pdGroup.getRgyName()); continue; } if (ATTR_GROUP_MEMBERS.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_GROUP_MEMBERS, pdGroup.getMembers()); continue; } if (PredefinedAttributes.DESCRIPTION.equalsIgnoreCase(attrName)) { bld.addAttribute(PredefinedAttributes.DESCRIPTION, pdGroup .getDescription()); continue; } } handler.handle(bld.build()); } } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(TYPE_GSO_RESOURCE)) { try { PDMessages msgs = new PDMessages(); ArrayList objectList = PDSSOResource.listSSOResources(ctxt, msgs); for (Object o : objectList) { ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setUid((String) o); bld.setName((String) o); handler.handle(bld.build()); } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(TYPE_GSO_GROUP_RESOURCE)) { try { PDMessages msgs = new PDMessages(); ArrayList objectList = PDSSOResourceGroup.listSSOResourceGroups(ctxt, msgs); for (Object o : objectList) { ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setUid((String) o); bld.setName((String) o); handler.handle(bld.build()); } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } LOG.info("Exit {0}", method); }
TAMConnector implements PoolableConnector, AuthenticateOp, CreateOp, SchemaOp, TestOp,
        DeleteOp, UpdateOp, SearchOp<String> { public void executeQuery(ObjectClass objClass, String query, ResultsHandler handler, OperationOptions options) { final String method = "executeQuery"; LOG.info("Entry {0}", method); Set<String> attributesToGet = null; if (options != null && options.getAttributesToGet() != null) { attributesToGet = CollectionUtil.newReadOnlySet(options.getAttributesToGet()); } else { ObjectClassInfo oci = schema().findObjectClassInfo(objClass.getObjectClassValue()); if (oci != null) { attributesToGet = new HashSet<String>(); for (AttributeInfo a : oci.getAttributeInfo()) { attributesToGet.add(a.getName()); } } else { throw new ConnectorException("Object class " + objClass.getObjectClassValue() + "is not supported"); } } if (objClass.is(ObjectClass.ACCOUNT_NAME)) { try { if (StringUtil.isBlank(query)) { query = PDUser.PDUSER_ALLPATTERN; } PDMessages msgs = new PDMessages(); ArrayList userList = PDUser.listUsers(ctxt, query, PDUser.PDUSER_MAXRETURN, false, msgs); if (LOG.isInfo()) { LOG.info("PDUser.listUsers(ctxt,{0},{1},false,msgs)", query, PDUser.PDUSER_MAXRETURN); } if (userList == null || userList.isEmpty()) { LOG.info("User Not Found for query={0}", query); return; } if (getNamesOnly(attributesToGet)) { for (Object o : userList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setUid(name); bld.setName(name); handler.handle(bld.build()); } } else { for (Object o : userList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); PDUser pdUser = new PDUser(ctxt, name, msgs); processMessages(method, msgs); if (LOG.isInfo()) { LOG.info("Process PDUser: {0} \n" + "RegistryName={1}\n" + "FirstName={2}\n" + "LastName={3}\n" + "Descr={4}\n" + "Groups={5}\n" + "SSOUser={6}\n", name, pdUser.getRgyName(), pdUser.getFirstName(), pdUser.getLastName(), pdUser .getDescription(), pdUser.getGroups(), pdUser .isSSOUser()); } bld.setUid(pdUser.getId()); bld.setName(pdUser.getId()); bld.addAttribute(ATTR_REGISTRY_NAME, pdUser.getRgyName()); Map<String, List<String>> gsoCreds = null; for (String attrName : attributesToGet) { if (ATTR_FIRST_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_FIRST_NAME, pdUser.getFirstName()); continue; } if (ATTR_LAST_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_LAST_NAME, pdUser.getLastName()); continue; } if (PredefinedAttributes.DESCRIPTION.equalsIgnoreCase(attrName)) { bld.addAttribute(PredefinedAttributes.DESCRIPTION, pdUser .getDescription()); continue; } if (PredefinedAttributes.GROUPS_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(PredefinedAttributes.GROUPS_NAME, pdUser .getGroups()); continue; } if (ATTR_SSO_USER.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_SSO_USER, Boolean.valueOf(pdUser.isSSOUser())); continue; } if (ATTR_GSO_WEB_CREDENTIALS.equalsIgnoreCase(attrName)) { if (gsoCreds == null) { gsoCreds = getUserGSOCredentials(name, msgs); } bld.addAttribute(ATTR_GSO_WEB_CREDENTIALS, gsoCreds .get(PDSSOCred.PDSSOCRED_SSORESOURCE)); continue; } if (ATTR_GSO_GROUP_CREDENTIALS.equalsIgnoreCase(attrName)) { if (gsoCreds == null) { gsoCreds = getUserGSOCredentials(name, msgs); } bld.addAttribute(ATTR_GSO_GROUP_CREDENTIALS, gsoCreds .get(PDSSOCred.PDSSOCRED_SSORESOURCEGROUP)); continue; } if (ATTR_EXPIRE_PASSWORD.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_EXPIRE_PASSWORD, pdUser.isPasswordValid()); continue; } if (OperationalAttributes.ENABLE_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(OperationalAttributes.ENABLE_NAME, pdUser .isAccountValid()); continue; } } handler.handle(bld.build()); } } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(ObjectClass.GROUP_NAME)) { try { if (StringUtil.isBlank(query)) { query = PDGroup.PDGROUP_ALLPATTERN; } PDMessages msgs = new PDMessages(); boolean listByRegistryName = false; ArrayList objectList = PDGroup.listGroups(ctxt, query, PDGroup.PDGROUP_MAXRETURN, listByRegistryName, msgs); if (getNamesOnly(attributesToGet)) { for (Object o : objectList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setObjectClass(objClass); bld.setUid(name); bld.setName(name); handler.handle(bld.build()); } } else { for (Object o : objectList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setObjectClass(objClass); PDGroup pdGroup = new PDGroup(ctxt, name, msgs); bld.setUid(pdGroup.getId()); bld.setName(pdGroup.getId()); for (String attrName : attributesToGet) { if (ATTR_REGISTRY_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_REGISTRY_NAME, pdGroup.getRgyName()); continue; } if (ATTR_GROUP_MEMBERS.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_GROUP_MEMBERS, pdGroup.getMembers()); continue; } if (PredefinedAttributes.DESCRIPTION.equalsIgnoreCase(attrName)) { bld.addAttribute(PredefinedAttributes.DESCRIPTION, pdGroup .getDescription()); continue; } } handler.handle(bld.build()); } } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(TYPE_GSO_RESOURCE)) { try { PDMessages msgs = new PDMessages(); ArrayList objectList = PDSSOResource.listSSOResources(ctxt, msgs); for (Object o : objectList) { ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setUid((String) o); bld.setName((String) o); handler.handle(bld.build()); } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(TYPE_GSO_GROUP_RESOURCE)) { try { PDMessages msgs = new PDMessages(); ArrayList objectList = PDSSOResourceGroup.listSSOResourceGroups(ctxt, msgs); for (Object o : objectList) { ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setUid((String) o); bld.setName((String) o); handler.handle(bld.build()); } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } LOG.info("Exit {0}", method); } }
TAMConnector implements PoolableConnector, AuthenticateOp, CreateOp, SchemaOp, TestOp,
        DeleteOp, UpdateOp, SearchOp<String> { public void executeQuery(ObjectClass objClass, String query, ResultsHandler handler, OperationOptions options) { final String method = "executeQuery"; LOG.info("Entry {0}", method); Set<String> attributesToGet = null; if (options != null && options.getAttributesToGet() != null) { attributesToGet = CollectionUtil.newReadOnlySet(options.getAttributesToGet()); } else { ObjectClassInfo oci = schema().findObjectClassInfo(objClass.getObjectClassValue()); if (oci != null) { attributesToGet = new HashSet<String>(); for (AttributeInfo a : oci.getAttributeInfo()) { attributesToGet.add(a.getName()); } } else { throw new ConnectorException("Object class " + objClass.getObjectClassValue() + "is not supported"); } } if (objClass.is(ObjectClass.ACCOUNT_NAME)) { try { if (StringUtil.isBlank(query)) { query = PDUser.PDUSER_ALLPATTERN; } PDMessages msgs = new PDMessages(); ArrayList userList = PDUser.listUsers(ctxt, query, PDUser.PDUSER_MAXRETURN, false, msgs); if (LOG.isInfo()) { LOG.info("PDUser.listUsers(ctxt,{0},{1},false,msgs)", query, PDUser.PDUSER_MAXRETURN); } if (userList == null || userList.isEmpty()) { LOG.info("User Not Found for query={0}", query); return; } if (getNamesOnly(attributesToGet)) { for (Object o : userList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setUid(name); bld.setName(name); handler.handle(bld.build()); } } else { for (Object o : userList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); PDUser pdUser = new PDUser(ctxt, name, msgs); processMessages(method, msgs); if (LOG.isInfo()) { LOG.info("Process PDUser: {0} \n" + "RegistryName={1}\n" + "FirstName={2}\n" + "LastName={3}\n" + "Descr={4}\n" + "Groups={5}\n" + "SSOUser={6}\n", name, pdUser.getRgyName(), pdUser.getFirstName(), pdUser.getLastName(), pdUser .getDescription(), pdUser.getGroups(), pdUser .isSSOUser()); } bld.setUid(pdUser.getId()); bld.setName(pdUser.getId()); bld.addAttribute(ATTR_REGISTRY_NAME, pdUser.getRgyName()); Map<String, List<String>> gsoCreds = null; for (String attrName : attributesToGet) { if (ATTR_FIRST_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_FIRST_NAME, pdUser.getFirstName()); continue; } if (ATTR_LAST_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_LAST_NAME, pdUser.getLastName()); continue; } if (PredefinedAttributes.DESCRIPTION.equalsIgnoreCase(attrName)) { bld.addAttribute(PredefinedAttributes.DESCRIPTION, pdUser .getDescription()); continue; } if (PredefinedAttributes.GROUPS_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(PredefinedAttributes.GROUPS_NAME, pdUser .getGroups()); continue; } if (ATTR_SSO_USER.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_SSO_USER, Boolean.valueOf(pdUser.isSSOUser())); continue; } if (ATTR_GSO_WEB_CREDENTIALS.equalsIgnoreCase(attrName)) { if (gsoCreds == null) { gsoCreds = getUserGSOCredentials(name, msgs); } bld.addAttribute(ATTR_GSO_WEB_CREDENTIALS, gsoCreds .get(PDSSOCred.PDSSOCRED_SSORESOURCE)); continue; } if (ATTR_GSO_GROUP_CREDENTIALS.equalsIgnoreCase(attrName)) { if (gsoCreds == null) { gsoCreds = getUserGSOCredentials(name, msgs); } bld.addAttribute(ATTR_GSO_GROUP_CREDENTIALS, gsoCreds .get(PDSSOCred.PDSSOCRED_SSORESOURCEGROUP)); continue; } if (ATTR_EXPIRE_PASSWORD.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_EXPIRE_PASSWORD, pdUser.isPasswordValid()); continue; } if (OperationalAttributes.ENABLE_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(OperationalAttributes.ENABLE_NAME, pdUser .isAccountValid()); continue; } } handler.handle(bld.build()); } } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(ObjectClass.GROUP_NAME)) { try { if (StringUtil.isBlank(query)) { query = PDGroup.PDGROUP_ALLPATTERN; } PDMessages msgs = new PDMessages(); boolean listByRegistryName = false; ArrayList objectList = PDGroup.listGroups(ctxt, query, PDGroup.PDGROUP_MAXRETURN, listByRegistryName, msgs); if (getNamesOnly(attributesToGet)) { for (Object o : objectList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setObjectClass(objClass); bld.setUid(name); bld.setName(name); handler.handle(bld.build()); } } else { for (Object o : objectList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setObjectClass(objClass); PDGroup pdGroup = new PDGroup(ctxt, name, msgs); bld.setUid(pdGroup.getId()); bld.setName(pdGroup.getId()); for (String attrName : attributesToGet) { if (ATTR_REGISTRY_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_REGISTRY_NAME, pdGroup.getRgyName()); continue; } if (ATTR_GROUP_MEMBERS.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_GROUP_MEMBERS, pdGroup.getMembers()); continue; } if (PredefinedAttributes.DESCRIPTION.equalsIgnoreCase(attrName)) { bld.addAttribute(PredefinedAttributes.DESCRIPTION, pdGroup .getDescription()); continue; } } handler.handle(bld.build()); } } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(TYPE_GSO_RESOURCE)) { try { PDMessages msgs = new PDMessages(); ArrayList objectList = PDSSOResource.listSSOResources(ctxt, msgs); for (Object o : objectList) { ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setUid((String) o); bld.setName((String) o); handler.handle(bld.build()); } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(TYPE_GSO_GROUP_RESOURCE)) { try { PDMessages msgs = new PDMessages(); ArrayList objectList = PDSSOResourceGroup.listSSOResourceGroups(ctxt, msgs); for (Object o : objectList) { ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setUid((String) o); bld.setName((String) o); handler.handle(bld.build()); } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } LOG.info("Exit {0}", method); }  }
TAMConnector implements PoolableConnector, AuthenticateOp, CreateOp, SchemaOp, TestOp,
        DeleteOp, UpdateOp, SearchOp<String> { public void executeQuery(ObjectClass objClass, String query, ResultsHandler handler, OperationOptions options) { final String method = "executeQuery"; LOG.info("Entry {0}", method); Set<String> attributesToGet = null; if (options != null && options.getAttributesToGet() != null) { attributesToGet = CollectionUtil.newReadOnlySet(options.getAttributesToGet()); } else { ObjectClassInfo oci = schema().findObjectClassInfo(objClass.getObjectClassValue()); if (oci != null) { attributesToGet = new HashSet<String>(); for (AttributeInfo a : oci.getAttributeInfo()) { attributesToGet.add(a.getName()); } } else { throw new ConnectorException("Object class " + objClass.getObjectClassValue() + "is not supported"); } } if (objClass.is(ObjectClass.ACCOUNT_NAME)) { try { if (StringUtil.isBlank(query)) { query = PDUser.PDUSER_ALLPATTERN; } PDMessages msgs = new PDMessages(); ArrayList userList = PDUser.listUsers(ctxt, query, PDUser.PDUSER_MAXRETURN, false, msgs); if (LOG.isInfo()) { LOG.info("PDUser.listUsers(ctxt,{0},{1},false,msgs)", query, PDUser.PDUSER_MAXRETURN); } if (userList == null || userList.isEmpty()) { LOG.info("User Not Found for query={0}", query); return; } if (getNamesOnly(attributesToGet)) { for (Object o : userList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setUid(name); bld.setName(name); handler.handle(bld.build()); } } else { for (Object o : userList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); PDUser pdUser = new PDUser(ctxt, name, msgs); processMessages(method, msgs); if (LOG.isInfo()) { LOG.info("Process PDUser: {0} \n" + "RegistryName={1}\n" + "FirstName={2}\n" + "LastName={3}\n" + "Descr={4}\n" + "Groups={5}\n" + "SSOUser={6}\n", name, pdUser.getRgyName(), pdUser.getFirstName(), pdUser.getLastName(), pdUser .getDescription(), pdUser.getGroups(), pdUser .isSSOUser()); } bld.setUid(pdUser.getId()); bld.setName(pdUser.getId()); bld.addAttribute(ATTR_REGISTRY_NAME, pdUser.getRgyName()); Map<String, List<String>> gsoCreds = null; for (String attrName : attributesToGet) { if (ATTR_FIRST_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_FIRST_NAME, pdUser.getFirstName()); continue; } if (ATTR_LAST_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_LAST_NAME, pdUser.getLastName()); continue; } if (PredefinedAttributes.DESCRIPTION.equalsIgnoreCase(attrName)) { bld.addAttribute(PredefinedAttributes.DESCRIPTION, pdUser .getDescription()); continue; } if (PredefinedAttributes.GROUPS_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(PredefinedAttributes.GROUPS_NAME, pdUser .getGroups()); continue; } if (ATTR_SSO_USER.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_SSO_USER, Boolean.valueOf(pdUser.isSSOUser())); continue; } if (ATTR_GSO_WEB_CREDENTIALS.equalsIgnoreCase(attrName)) { if (gsoCreds == null) { gsoCreds = getUserGSOCredentials(name, msgs); } bld.addAttribute(ATTR_GSO_WEB_CREDENTIALS, gsoCreds .get(PDSSOCred.PDSSOCRED_SSORESOURCE)); continue; } if (ATTR_GSO_GROUP_CREDENTIALS.equalsIgnoreCase(attrName)) { if (gsoCreds == null) { gsoCreds = getUserGSOCredentials(name, msgs); } bld.addAttribute(ATTR_GSO_GROUP_CREDENTIALS, gsoCreds .get(PDSSOCred.PDSSOCRED_SSORESOURCEGROUP)); continue; } if (ATTR_EXPIRE_PASSWORD.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_EXPIRE_PASSWORD, pdUser.isPasswordValid()); continue; } if (OperationalAttributes.ENABLE_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(OperationalAttributes.ENABLE_NAME, pdUser .isAccountValid()); continue; } } handler.handle(bld.build()); } } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(ObjectClass.GROUP_NAME)) { try { if (StringUtil.isBlank(query)) { query = PDGroup.PDGROUP_ALLPATTERN; } PDMessages msgs = new PDMessages(); boolean listByRegistryName = false; ArrayList objectList = PDGroup.listGroups(ctxt, query, PDGroup.PDGROUP_MAXRETURN, listByRegistryName, msgs); if (getNamesOnly(attributesToGet)) { for (Object o : objectList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setObjectClass(objClass); bld.setUid(name); bld.setName(name); handler.handle(bld.build()); } } else { for (Object o : objectList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setObjectClass(objClass); PDGroup pdGroup = new PDGroup(ctxt, name, msgs); bld.setUid(pdGroup.getId()); bld.setName(pdGroup.getId()); for (String attrName : attributesToGet) { if (ATTR_REGISTRY_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_REGISTRY_NAME, pdGroup.getRgyName()); continue; } if (ATTR_GROUP_MEMBERS.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_GROUP_MEMBERS, pdGroup.getMembers()); continue; } if (PredefinedAttributes.DESCRIPTION.equalsIgnoreCase(attrName)) { bld.addAttribute(PredefinedAttributes.DESCRIPTION, pdGroup .getDescription()); continue; } } handler.handle(bld.build()); } } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(TYPE_GSO_RESOURCE)) { try { PDMessages msgs = new PDMessages(); ArrayList objectList = PDSSOResource.listSSOResources(ctxt, msgs); for (Object o : objectList) { ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setUid((String) o); bld.setName((String) o); handler.handle(bld.build()); } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(TYPE_GSO_GROUP_RESOURCE)) { try { PDMessages msgs = new PDMessages(); ArrayList objectList = PDSSOResourceGroup.listSSOResourceGroups(ctxt, msgs); for (Object o : objectList) { ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setUid((String) o); bld.setName((String) o); handler.handle(bld.build()); } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } LOG.info("Exit {0}", method); }  Configuration getConfiguration(); void init(Configuration config); void dispose(); void checkAlive(); Uid create(final ObjectClass objClass, final Set<Attribute> attributes,
            final OperationOptions options); FilterTranslator<String> createFilterTranslator(ObjectClass objClass,
            OperationOptions options); void executeQuery(ObjectClass objClass, String query, ResultsHandler handler,
            OperationOptions options); void test(); Uid update(ObjectClass objClass, Uid uid, Set<Attribute> replaceAttributes,
            OperationOptions options); void delete(final ObjectClass objClass, final Uid uid, final OperationOptions options); Schema schema(); Uid authenticate(ObjectClass oc, String user, GuardedString gs, OperationOptions oo); }
TAMConnector implements PoolableConnector, AuthenticateOp, CreateOp, SchemaOp, TestOp,
        DeleteOp, UpdateOp, SearchOp<String> { public void executeQuery(ObjectClass objClass, String query, ResultsHandler handler, OperationOptions options) { final String method = "executeQuery"; LOG.info("Entry {0}", method); Set<String> attributesToGet = null; if (options != null && options.getAttributesToGet() != null) { attributesToGet = CollectionUtil.newReadOnlySet(options.getAttributesToGet()); } else { ObjectClassInfo oci = schema().findObjectClassInfo(objClass.getObjectClassValue()); if (oci != null) { attributesToGet = new HashSet<String>(); for (AttributeInfo a : oci.getAttributeInfo()) { attributesToGet.add(a.getName()); } } else { throw new ConnectorException("Object class " + objClass.getObjectClassValue() + "is not supported"); } } if (objClass.is(ObjectClass.ACCOUNT_NAME)) { try { if (StringUtil.isBlank(query)) { query = PDUser.PDUSER_ALLPATTERN; } PDMessages msgs = new PDMessages(); ArrayList userList = PDUser.listUsers(ctxt, query, PDUser.PDUSER_MAXRETURN, false, msgs); if (LOG.isInfo()) { LOG.info("PDUser.listUsers(ctxt,{0},{1},false,msgs)", query, PDUser.PDUSER_MAXRETURN); } if (userList == null || userList.isEmpty()) { LOG.info("User Not Found for query={0}", query); return; } if (getNamesOnly(attributesToGet)) { for (Object o : userList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setUid(name); bld.setName(name); handler.handle(bld.build()); } } else { for (Object o : userList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); PDUser pdUser = new PDUser(ctxt, name, msgs); processMessages(method, msgs); if (LOG.isInfo()) { LOG.info("Process PDUser: {0} \n" + "RegistryName={1}\n" + "FirstName={2}\n" + "LastName={3}\n" + "Descr={4}\n" + "Groups={5}\n" + "SSOUser={6}\n", name, pdUser.getRgyName(), pdUser.getFirstName(), pdUser.getLastName(), pdUser .getDescription(), pdUser.getGroups(), pdUser .isSSOUser()); } bld.setUid(pdUser.getId()); bld.setName(pdUser.getId()); bld.addAttribute(ATTR_REGISTRY_NAME, pdUser.getRgyName()); Map<String, List<String>> gsoCreds = null; for (String attrName : attributesToGet) { if (ATTR_FIRST_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_FIRST_NAME, pdUser.getFirstName()); continue; } if (ATTR_LAST_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_LAST_NAME, pdUser.getLastName()); continue; } if (PredefinedAttributes.DESCRIPTION.equalsIgnoreCase(attrName)) { bld.addAttribute(PredefinedAttributes.DESCRIPTION, pdUser .getDescription()); continue; } if (PredefinedAttributes.GROUPS_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(PredefinedAttributes.GROUPS_NAME, pdUser .getGroups()); continue; } if (ATTR_SSO_USER.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_SSO_USER, Boolean.valueOf(pdUser.isSSOUser())); continue; } if (ATTR_GSO_WEB_CREDENTIALS.equalsIgnoreCase(attrName)) { if (gsoCreds == null) { gsoCreds = getUserGSOCredentials(name, msgs); } bld.addAttribute(ATTR_GSO_WEB_CREDENTIALS, gsoCreds .get(PDSSOCred.PDSSOCRED_SSORESOURCE)); continue; } if (ATTR_GSO_GROUP_CREDENTIALS.equalsIgnoreCase(attrName)) { if (gsoCreds == null) { gsoCreds = getUserGSOCredentials(name, msgs); } bld.addAttribute(ATTR_GSO_GROUP_CREDENTIALS, gsoCreds .get(PDSSOCred.PDSSOCRED_SSORESOURCEGROUP)); continue; } if (ATTR_EXPIRE_PASSWORD.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_EXPIRE_PASSWORD, pdUser.isPasswordValid()); continue; } if (OperationalAttributes.ENABLE_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(OperationalAttributes.ENABLE_NAME, pdUser .isAccountValid()); continue; } } handler.handle(bld.build()); } } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(ObjectClass.GROUP_NAME)) { try { if (StringUtil.isBlank(query)) { query = PDGroup.PDGROUP_ALLPATTERN; } PDMessages msgs = new PDMessages(); boolean listByRegistryName = false; ArrayList objectList = PDGroup.listGroups(ctxt, query, PDGroup.PDGROUP_MAXRETURN, listByRegistryName, msgs); if (getNamesOnly(attributesToGet)) { for (Object o : objectList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setObjectClass(objClass); bld.setUid(name); bld.setName(name); handler.handle(bld.build()); } } else { for (Object o : objectList) { String name = (String) o; ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setObjectClass(objClass); PDGroup pdGroup = new PDGroup(ctxt, name, msgs); bld.setUid(pdGroup.getId()); bld.setName(pdGroup.getId()); for (String attrName : attributesToGet) { if (ATTR_REGISTRY_NAME.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_REGISTRY_NAME, pdGroup.getRgyName()); continue; } if (ATTR_GROUP_MEMBERS.equalsIgnoreCase(attrName)) { bld.addAttribute(ATTR_GROUP_MEMBERS, pdGroup.getMembers()); continue; } if (PredefinedAttributes.DESCRIPTION.equalsIgnoreCase(attrName)) { bld.addAttribute(PredefinedAttributes.DESCRIPTION, pdGroup .getDescription()); continue; } } handler.handle(bld.build()); } } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(TYPE_GSO_RESOURCE)) { try { PDMessages msgs = new PDMessages(); ArrayList objectList = PDSSOResource.listSSOResources(ctxt, msgs); for (Object o : objectList) { ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setUid((String) o); bld.setName((String) o); handler.handle(bld.build()); } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } else if (objClass.is(TYPE_GSO_GROUP_RESOURCE)) { try { PDMessages msgs = new PDMessages(); ArrayList objectList = PDSSOResourceGroup.listSSOResourceGroups(ctxt, msgs); for (Object o : objectList) { ConnectorObjectBuilder bld = new ConnectorObjectBuilder(); bld.setUid((String) o); bld.setName((String) o); handler.handle(bld.build()); } } catch (PDException e) { convertPDExceptionToConnectorException(e); } catch (Exception e) { throw new ConnectorException(e); } } LOG.info("Exit {0}", method); }  Configuration getConfiguration(); void init(Configuration config); void dispose(); void checkAlive(); Uid create(final ObjectClass objClass, final Set<Attribute> attributes,
            final OperationOptions options); FilterTranslator<String> createFilterTranslator(ObjectClass objClass,
            OperationOptions options); void executeQuery(ObjectClass objClass, String query, ResultsHandler handler,
            OperationOptions options); void test(); Uid update(ObjectClass objClass, Uid uid, Set<Attribute> replaceAttributes,
            OperationOptions options); void delete(final ObjectClass objClass, final Uid uid, final OperationOptions options); Schema schema(); Uid authenticate(ObjectClass oc, String user, GuardedString gs, OperationOptions oo); static final String ATTR_REGISTRY_NAME; static final String ATTR_FIRST_NAME; static final String ATTR_LAST_NAME; static final String ATTR_SSO_USER; static final String ATTR_PASSWORD_POLICY; static final String ATTR_EXPIRE_PASSWORD; static final String ATTR_DELETE_FROM_REGISTRY; static final String ATTR_SYNC_GSO_CREDENTIALS; static final String ATTR_IMPORT_FROM_REGISTRY; static final String ATTR_GROUP_MEMBERS; static final String ATTR_GSO_WEB_CREDENTIALS; static final String ATTR_GSO_GROUP_CREDENTIALS; static final String TYPE_GSO_GROUP_RESOURCE; static final String TYPE_GSO_RESOURCE; static final String TOKEN_GSO_RESOURCE; }