use of com.iplanet.services.cdm.Client in project OpenAM by OpenRock.
the class MAPModelBase method getAdditionalPropertyValues.
protected Set getAdditionalPropertyValues(String clientType) {
Set values = Collections.EMPTY_SET;
Client client = clientTypesManager.getClientInstance(clientType);
if (client != null) {
values = client.getAdditionalProperties();
}
return values;
}
use of com.iplanet.services.cdm.Client in project OpenAM by OpenRock.
the class AMI18NUtils method getContentType.
/**
* Returns content type from client service API.
*
* @param clientType Client type.
* @return content type.
*/
public static String getContentType(String clientType) {
String contentType;
if (clientDt.isDetectionEnabled()) {
try {
Client client = ClientsManager.getInstance(clientType);
contentType = (client != null) ? client.getProperty(AMAdminConstants.CDM_CONTENT_TYPE_PROPERTY_NAME) : Client.CDM_DEFAULT_CLIENT_TYPE;
} catch (ClientException ce) {
debug.warning("AMI18NUtils.getContentType - " + "couldn't retrieve the content type, reverting to default.");
contentType = Client.CDM_DEFAULT_CLIENT_TYPE;
}
} else {
contentType = Client.CDM_DEFAULT_CLIENT_TYPE;
}
return contentType;
}
use of com.iplanet.services.cdm.Client in project OpenAM by OpenRock.
the class AMI18NUtils method getCharset.
/**
* Returns charset type from client service API
*
* @param clientType Client type.
* @param loc Locale of request.
* @return charset.
*/
public static String getCharset(String clientType, java.util.Locale loc) {
String charset;
if (clientDt.isDetectionEnabled()) {
try {
Client client = ClientsManager.getInstance(clientType);
charset = (client != null) ? client.getCharset(loc) : Client.CDM_DEFAULT_CHARSET;
} catch (ClientException ce) {
debug.warning("AMI18NUtils.getCharset - " + "couldn't retrieve the client charset, reverting to default.");
charset = Client.CDM_DEFAULT_CHARSET;
}
} else {
charset = Client.CDM_DEFAULT_CHARSET;
}
return charset;
}
use of com.iplanet.services.cdm.Client in project OpenAM by OpenRock.
the class MAPDeviceProfileModelImpl method getAttributeValues.
/**
* Returns attribute values of a device.
*
* @param clientType Client Type.
* @param classification Profile attribute classification.
* @return attribute values of a device.
*/
public Map getAttributeValues(String clientType, String classification) {
String[] params = { clientType, classification };
logEvent("ATTEMPT_CLIENT_DETECTION_GET_CLIENT_PROFILE", params);
Set attributeNames = getAttributeNames(clientType, classification);
Map attributeValues = new HashMap(attributeNames.size() * 2);
if (classification.equals(ADDITIONAL_PROPERTIES_CLASSIFICAIION)) {
Set values = getAdditionalPropertyValues(clientType);
if ((values == null) || values.isEmpty()) {
values = new HashSet(1);
values.add("");
}
String attrName = (String) attributeNames.iterator().next();
attributeValues = new HashMap(2);
attributeValues.put(attrName, values);
} else {
Client client = clientTypesManager.getClientInstance(clientType);
if (client != null) {
for (Iterator i = attributeNames.iterator(); i.hasNext(); ) {
String name = (String) i.next();
Set values = client.getProperties(name);
if ((values == null) || values.isEmpty()) {
values = Collections.EMPTY_SET;
AttributeSchema as = getDeviceAttributeSchema(name);
if (as.getSyntax().equals(AttributeSchema.Syntax.BOOLEAN)) {
values = new HashSet(2);
values.add(AMAdminConstants.STRING_FALSE);
}
}
attributeValues.put(name, values);
}
}
}
logEvent("SUCCEED_CLIENT_DETECTION_GET_CLIENT_PROFILE", params);
return (attributeValues != null) ? attributeValues : Collections.EMPTY_MAP;
}
use of com.iplanet.services.cdm.Client in project OpenAM by OpenRock.
the class BasicClientTypesManager method populateClient.
/**
* Simple utility method that parsed the properties file for the different
* clients.
*
* @param clientName The name of the client to populate
* @param props The incoming properties file
* @throws InvalidPropertiesFormatException
*/
protected void populateClient(String clientName, Properties props) throws InvalidPropertiesFormatException {
String name = props.getProperty(clientName + NAME_SUFFIX);
String attrList = props.getProperty(clientName + ATTRIBUTE_SUFFIX);
//Get Attributes List
StringTokenizer st = new StringTokenizer(attrList, COMMA);
Map attributes = new HashMap();
Set attributeValues = null;
while (st.hasMoreTokens()) {
attributeValues = new HashSet();
String entry = st.nextToken();
String attrName = entry.substring(0, entry.indexOf(EQUALS));
String attrValue = entry.substring(entry.indexOf(EQUALS) + 1);
attributeValues.add(attrValue);
attributes.put(attrName, attributeValues);
}
clients.put(name, new Client(name, attributes));
clientsData.put(name, attributes);
}
Aggregations