use of com.sun.identity.plugin.datastore.DataStoreProvider in project OpenAM by OpenRock.
the class FSDefaultAttributePlugin method getAttributeValue.
private String getAttributeValue(Object token, String attrName) {
if (attrName == null) {
FSUtils.debug.error("FSDefaultAttributePlugin.getAttribute" + "Value: attribute Name is null. Check the attribute map");
return null;
}
try {
SessionProvider sessionProvider = SessionManager.getProvider();
String userID = sessionProvider.getPrincipalName(token);
DataStoreProvider dsProvider = DataStoreProviderManager.getInstance().getDataStoreProvider(IFSConstants.IDFF);
Set attrValues = dsProvider.getAttribute(userID, attrName);
if (attrValues == null || attrValues.isEmpty()) {
if (FSUtils.debug.messageEnabled()) {
FSUtils.debug.message("FSDefaultAttributePlugin.getAttribute" + "Value: values not found for : " + attrName);
}
return null;
}
return (String) attrValues.iterator().next();
} catch (SessionException se) {
FSUtils.debug.error("FSDefaultAttributePlugin.getAttributeValue: exception:", se);
} catch (DataStoreProviderException dspe) {
FSUtils.debug.error("FSDefaultAttributePlugin.getAttributeValue: exception: ", dspe);
}
return null;
}
use of com.sun.identity.plugin.datastore.DataStoreProvider in project OpenAM by OpenRock.
the class UserDiscoEntryHandler method getDiscoEntries.
/**
* Finds discovery entries for a user under user entry.
* @param userID The user whose discovery entries will be returned.
* @param reqServiceTypes List of
* <code>com.sun.identity.liberty.ws.disco.jaxb.RequestedServiceType</code>
* objects from discovery query.
* @return Map of <code>entryId</code> and
* <code>com.sun.identity.liberty.ws.disco.plugins.jaxb.DiscoEntryElement
* </code> for this user. For each <code>DiscoEntry</code> element in the
* List, the <code>entryId</code> attribute of ResourceOffering need to
* be set.
*/
public Map getDiscoEntries(String userID, List reqServiceTypes) {
DiscoEntryHandlerImplUtils.debug.message("in UserDiscoEntryHandler.getDiscoEntries");
Map results = new HashMap();
try {
DataStoreProvider store = DataStoreProviderManager.getInstance().getDataStoreProvider(DISCO);
if (DiscoEntryHandlerImplUtils.getUserDiscoEntries(store, userID, USER_ATTR_NAME, results)) {
// or amadmin, and entryID was not set
if (!DiscoEntryHandlerImplUtils.setUserDiscoEntries(store, userID, USER_ATTR_NAME, results.values())) {
DiscoEntryHandlerImplUtils.debug.error("UserDiscoEntryHandler.getDiscoEntries: " + "couldn't set missing entryID to entry.");
}
}
results = DiscoEntryHandlerImplUtils.getQueryResults(results, reqServiceTypes);
} catch (Exception e) {
DiscoEntryHandlerImplUtils.debug.error("UserDiscoEntryHandler.getDiscoEntries:", e);
}
return results;
}
use of com.sun.identity.plugin.datastore.DataStoreProvider in project OpenAM by OpenRock.
the class FSDefaultRealmAttributePlugin method getAttributeValue.
private String getAttributeValue(Object token, String attrName) {
if (attrName == null) {
FSUtils.debug.error("FSDefaultAttributePlugin.getAttribute" + "Value: attribute Name is null. Check the attribute map");
return null;
}
try {
SessionProvider sessionProvider = SessionManager.getProvider();
String userID = sessionProvider.getPrincipalName(token);
DataStoreProvider dsProvider = DataStoreProviderManager.getInstance().getDataStoreProvider(IFSConstants.IDFF);
Set attrValues = dsProvider.getAttribute(userID, attrName);
if (attrValues == null || attrValues.isEmpty()) {
if (FSUtils.debug.messageEnabled()) {
FSUtils.debug.message("FSDefaultAttributePlugin.getAttribute" + "Value: values not found for : " + attrName);
}
return null;
}
return (String) attrValues.iterator().next();
} catch (SessionException se) {
FSUtils.debug.error("FSDefaultAttributePlugin.getAttributeValue: exception:", se);
} catch (DataStoreProviderException dspe) {
FSUtils.debug.error("FSDefaultAttributePlugin.getAttributeValue: exception: ", dspe);
}
return null;
}
Aggregations