/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2008 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: FedletConfigurationImpl.java,v 1.5 2010/01/26 21:31:59 madan_ranganath Exp $
*
*/
/**
* The <code>FedletConfigurationImpl</code> class is the implementation for
*/
// Name of attribute in COT file to contains the COT name
// Suffix for extended metadata file name.
// Suffix for COT file name.
// fedlet home directory which contains metadata/COT/configuration files
// property name to point to the fedlet home
"com.sun.identity.fedlet.home";
// Map to store COT information
// Map to store metadata information
/**
* Initializer.
* @param componentName Name of the components, e.g. SAML1, SAML2, ID-FF
* @param session FM Session object.
* @exception ConfigurationException if could not initialize the instance.
*/
throws ConfigurationException {
if (debug.messageEnabled()) {
}
this.componentName = componentName;
}
if (debug.messageEnabled()) {
}
// initialize SAML2 metadata and COT from fedlet home directory
if (debug.messageEnabled()) {
}
}
/**
* Returns Configurations.
* @param realm the name of organization at which the configuration resides.
* @param configName configuration instance name. e.g. "/sp".
* The configName could be null or empty string, which means the default
* configuration for this components.
* a Set of attribute values or null if service configuration doesn't
* doesn't exist.
* @exception ConfigurationException if an error occurred while getting
* service configuration.
*/
throws ConfigurationException {
if (debug.messageEnabled()) {
", configName = " + configName);
}
} else {
return null;
}
}
/**
* Initializes SAMLv2 metadata and COT from flat files under Fedlet
* home directory.
* The metadata information will be stored in a Map, key is the entity ID,
* Standard metadata is stored in a file named <fileName>.xml
* Extended metadata is stored in a file named <fileName>-extended.xml
*
* The COT information will be stored in a Map, key is the COT name,
* value is a Map whose key is the attribute name, value is a Set of
* values for the attribute.
* COT is stored in a file named <filename>.cot
*
*/
private void initializeMetadataAndCOT() {
try {
return;
}
if (debug.messageEnabled()) {
}
// processing metadata entry
} else {
continue;
}
}
} catch (NullPointerException npe) {
} catch (SecurityException se) {
}
}
/**
* Gets SAML2 metadata from flat files and stores in entityMap.
*/
// get standard metadata
if (debug.messageEnabled()) {
"metaFile=" + metaFile);
}
return;
}
return;
}
// get extended metadata files
return;
}
// add to entity Map
if (debug.messageEnabled()) {
"done processing entity " + entityId);
}
}
for (int i = 0; i < length; i++) {
"type");
"");
"xsi:type=\"query:AttributeQueryDescriptorType\"",
"");
+ ":" +
"</" +
+ ":" +
}
}
}
return metaXML;
}
try {
if (obj instanceof EntityDescriptorElement) {
}
} catch (JAXBException jaxbe) {
}
return null;
}
/**
* Gets COT information from flat file and stores in cotMap.
* The COT is stored in a flat file named "<fileName>.cot" which contains
* list of properties, format like this :
* <attribute_name>=<value1>,<value2>,<value3>,...
* for example:
* cot-name=sample
* sun-fm-cot-status=Active
* sun-fm-trusted-providers=idp,sp
* Note : Value which contains "%" and "," need to be escaped to
* "%25" and "%2c" before saving to the file.
*/
if (debug.messageEnabled()) {
"cotFile=" + cotFile);
}
try {
// convert each value string to a Set.
while (keys.hasMoreElements()) {
}
}
}
+ cotFile);
} else {
if (debug.messageEnabled()) {
"done processing cot " + cotName);
}
}
} catch (FileNotFoundException fnf) {
} catch (IOException ioe) {
} finally {
try {
} catch (IOException ioe) {
}
}
}
}
/**
* Converts a string of values from the attributes properties file
* to a Set, decoding special characters in each value.
*/
int i, j;
char c = valchars[j];
if (c == ',') {
if (i == j) {
i = j +1;
} else { // separator found
}
i = j +1;
}
}
}
}
}
return valset;
}
/**
* Decodes a value, %2C to comma and %25 to percent.
*/
char[] chars = v.toCharArray();
if (lastIdx != i) {
}
}
}
else {
}
i += 2;
lastIdx = i+1;
}
}
if (lastIdx != i) {
}
}
/**
* Returns the content of a file as String.
* Returns null if error occurs.
*/
try {
}
} catch (FileNotFoundException fnf) {
return null;
} catch (IOException ioe) {
return null;
} finally {
try {
} catch (IOException ioe) {
}
}
}
}
/**
* Sets Configurations.
* @param realm the name of organization at which the configuration resides.
* @param configName configuration instance name. e.g. "/sp"
* The configName could be null or empty string, which means the default
* configuration for this components.
* configuration, key is the attribute name, value is
* a Set of attribute values.
* @exception ConfigurationException if could not set service configuration
* or service configuration doesn't exist.
*/
throws ConfigurationException {
if (debug.messageEnabled()) {
}
throw new ConfigurationException(RESOURCE_BUNDLE,
"failedSetConfig", data);
}
/**
* Creates Configurations.
* @param realm the name of organization at which the configuration resides.
* @param configName service configuration name. e.g. "/sp"
* The configName could be null or empty string, which means the
* default configuration for this components.
* configuration, key is the attribute name, value is
* a Set of attribute values.
* @exception ConfigurationException if could not create service
* configuration.
*/
throws ConfigurationException {
if (debug.messageEnabled()) {
}
throw new ConfigurationException(RESOURCE_BUNDLE,
"failedCreateConfig", data);
}
/**
* Deletes Configuration.
* @param realm the name of organization at which the configuration resides.
* @param configName service configuration name. e.g. "/sp"
* The configName could be null or empty string, which means the default
* configuration for this components.
* @param attributes A set of attributes to be deleted from the Service
* configuration. If the value is null or empty, deletes all service
* configuration.
* @exception ConfigurationException if could not delete service
* configuration.
*/
throws ConfigurationException {
if (debug.messageEnabled()) {
}
throw new ConfigurationException(RESOURCE_BUNDLE,
"failedDeleteConfig", data);
}
/**
* Returns all service config name for this components.
* @param realm the name of organization at which the configuration resides.
* @return Set of service configuration names. Return null if there
* is no service configuration for this component, return empty set
* if there is only default configuration instance.
* @exception ConfigurationException if could not get all service
* configuration names.
*/
throws ConfigurationException {
if (debug.messageEnabled()) {
}
} else {
return Collections.EMPTY_SET;
}
}
/**
* Registers for changes to the component's configuration. The object will
* be called when configuration for this component is changed.
* @return the registered id for this listener instance.
* @exception ConfigurationException if could not register the listener.
*/
throws ConfigurationException {
return "NO_OP";
}
/**
* Unregisters the listener from the component for the given
* listener ID. The ID was issued when the listener was registered.
* @param listenerID the returned id when the listener was registered.
* @exception ConfigurationException if could not register the listener.
*/
throws ConfigurationException {
}
}