use of com.sun.identity.sm.SchemaType in project OpenAM by OpenRock.
the class IdRepoJAXRPCObjectImpl method assignService_idrepo.
public void assignService_idrepo(String token, String type, String name, String serviceName, String stype, Map attrMap, String amOrgName, String amsdkDN) throws RemoteException, IdRepoException, SSOException {
SSOToken ssoToken = getSSOToken(token);
IdType idtype = IdUtils.getType(type);
SchemaType schemaType = new SchemaType(stype);
idServices.assignService(ssoToken, idtype, name, serviceName, schemaType, attrMap, amOrgName, amsdkDN);
}
use of com.sun.identity.sm.SchemaType in project OpenAM by OpenRock.
the class PropertyXMLBuilder method getSectionsForType.
private void getSectionsForType() {
sectionForType = new HashMap<SchemaType, List<String>>();
for (SchemaType schemaType : schemaTypes) {
String name = "sections." + serviceName + "." + schemaType.getType();
String section = model.getLocalizedString(name);
if (section.equals(name)) {
continue;
}
StringTokenizer st = new StringTokenizer(section, " ");
List<String> sections = new ArrayList<String>();
while (st.hasMoreTokens()) {
sections.add(st.nextToken());
}
sectionForType.put(schemaType, sections);
}
if (debug.messageEnabled()) {
debug.message("getSectionsForType: " + sectionForType);
}
}
use of com.sun.identity.sm.SchemaType in project OpenAM by OpenRock.
the class PropertyXMLBuilder method getXML.
/**
* Returns a XML for displaying attribute in property sheet.
*
* @param readonly Set of readonly attributes.
* @param bPropertySheetElementNode true to include
* <code><propertysheet></code> tag.
* @throws SMSException if attribute schema cannot obtained.
* @throws SSOException if single sign on token is invalid.
* @throws AMConsoleException if there are no attribute to display.
* @return XML for displaying attribute in property sheet.
*/
public String getXML(Set readonly, boolean bPropertySheetElementNode) throws SMSException, SSOException, AMConsoleException {
StringBuffer xml = new StringBuffer(1000);
onBeforeBuildingXML(mapTypeToAttributeSchema);
if (bPropertySheetElementNode) {
xml.append(getXMLDefinitionHeader()).append(START_TAG);
}
if (supportSubConfig) {
String configTable = SUB_CONFIG_TABLE_XML;
configTable = tagSwap(configTable, SUB_CONFIG_TABLE_VIEW_BEAN, viewBeanName);
xml.append(configTable);
}
if (!supportSubConfig && hasNoAttributes()) {
throw new AMConsoleException(model.getLocalizedString("propertysheet.no.attributes.message"));
}
Set attributeSchema = (Set) mapTypeToAttributeSchema.get(NULL_TYPE);
if ((attributeSchema != null) && !attributeSchema.isEmpty()) {
String display = "blank.header";
SchemaType type = null;
if ((schemaTypes != null) && (schemaTypes.size() == 1)) {
Iterator<SchemaType> it = schemaTypes.iterator();
type = it.next();
}
if (getSectionsForType(type) == null) {
buildSchemaTypeXML(display, attributeSchema, xml, model, serviceBundle, readonly);
} else {
String label = "lbl" + display.replace('.', '_');
Object[] params = { label, display };
xml.append(MessageFormat.format(SECTION_START_TAG, params));
for (String section : sectionForType.get(type)) {
String sectionName = model.getLocalizedString("section.label." + serviceName + "." + type.getType() + "." + section);
buildSchemaTypeXML(sectionName, attributeSchema, xml, model, serviceBundle, readonly, sectionOrder.get(section));
}
xml.append(SECTION_END_TAG);
}
}
for (Iterator iter = orderDisplaySchemaType.iterator(); iter.hasNext(); ) {
SchemaType type = (SchemaType) iter.next();
attributeSchema = (Set) mapTypeToAttributeSchema.get(type);
if ((attributeSchema != null) && !attributeSchema.isEmpty()) {
String display = model.getLocalizedString((String) mapSchemaTypeToName.get(type));
if (getSectionsForType(type) == null) {
buildSchemaTypeXML(display, attributeSchema, xml, model, serviceBundle, readonly);
} else {
String label = "lbl" + display.replace('.', '_');
Object[] params = { label, display };
xml.append(MessageFormat.format(SECTION_START_TAG, params));
for (String section : sectionForType.get(type)) {
String sectionName = model.getLocalizedString("section.label." + serviceName + "." + type.getType() + "." + section);
buildSchemaTypeXML(sectionName, attributeSchema, xml, model, serviceBundle, readonly, sectionOrder.get(section));
}
xml.append(SECTION_END_TAG);
}
}
}
if (bPropertySheetElementNode) {
xml.append(END_TAG);
}
return xml.toString();
}
use of com.sun.identity.sm.SchemaType in project OpenAM by OpenRock.
the class FSSAMLServiceModelImpl method init.
private void init() {
String curSchemaType = "*";
try {
serviceSchemaManager = new ServiceSchemaManager(SAML_SERVICE_NAME, getUserSSOToken());
String i18nFileName = serviceSchemaManager.getI18NFileName();
if ((i18nFileName != null) && (i18nFileName.trim().length() > 0)) {
resBundle = AMResBundleCacher.getBundle(i18nFileName, getUserLocale());
}
String[] params = new String[3];
params[0] = SAML_SERVICE_NAME;
params[2] = "*";
Set schemaTypes = serviceSchemaManager.getSchemaTypes();
for (Iterator iter = schemaTypes.iterator(); iter.hasNext(); ) {
SchemaType type = (SchemaType) iter.next();
ServiceSchema schema = serviceSchemaManager.getSchema(type);
if (schema != null) {
curSchemaType = type.getType();
params[1] = curSchemaType;
logEvent("ATTEMPT_GET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", params);
Set aschemas = schema.getAttributeSchemas();
for (Iterator i = aschemas.iterator(); i.hasNext(); ) {
AttributeSchema as = (AttributeSchema) i.next();
String i18n = as.getI18NKey();
if ((i18n != null) && (i18n.trim().length() > 0)) {
attributeSchemas.put(as.getName(), as);
}
}
logEvent("SUCCEED_GET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", params);
}
}
} catch (SSOException e) {
String[] paramsEx = { SAML_SERVICE_NAME, "*", curSchemaType, getErrorString(e) };
logEvent("SSO_EXCEPTION_GET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", paramsEx);
debug.error("FSSAMLServiceModelImpl.init", e);
} catch (SMSException e) {
String[] paramsEx = { SAML_SERVICE_NAME, "*", curSchemaType, getErrorString(e) };
logEvent("SMS_EXCEPTION_GET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", paramsEx);
debug.error("FSSAMLServiceModelImpl.init", e);
}
}
use of com.sun.identity.sm.SchemaType in project OpenAM by OpenRock.
the class AMModelBase method getLocalizedServiceName.
/**
* Returns the localized service name.
*
* @param service Name of service.
* @param defaultValue Default value of service name if localized service
* name cannot be determine.
* @return the localized service name.
*/
public String getLocalizedServiceName(String service, String defaultValue) {
String i18nName = defaultValue;
try {
ServiceSchemaManager mgr = new ServiceSchemaManager(service, ssoToken);
String rbName = mgr.getI18NFileName();
if ((rbName != null) && (rbName.trim().length() > 0)) {
ResourceBundle rb = AMResBundleCacher.getBundle(rbName, locale);
String i18nKey = null;
Set types = mgr.getSchemaTypes();
if (!types.isEmpty()) {
SchemaType type = (SchemaType) types.iterator().next();
ServiceSchema schema = mgr.getSchema(type);
if (schema != null) {
i18nKey = schema.getI18NKey();
}
}
if ((i18nKey != null) && (i18nKey.length() > 0)) {
i18nName = Locale.getString(rb, i18nKey, debug);
}
}
} catch (SSOException e) {
debug.warning("AMModelBase.getLocalizedServiceName", e);
} catch (SMSException e) {
debug.warning("AMModelBase.getLocalizedServiceName", e);
} catch (MissingResourceException e) {
debug.warning("AMModelBase.getLocalizedServiceName", e);
}
return i18nName;
}
Aggregations