public void createEntityConfig(String realm,FederationConfigElement config) throws WSFederationMetaException {
  String federationId=config.getFederationID();
  if (federationId == null) {
    debug.error("WSFederationMetaManager.createEntityConfig: " + "entity ID is null");
    String[] data={realm};
    LogUtil.error(Level.INFO,LogUtil.NO_ENTITY_ID_CREATE_ENTITY_CONFIG,data,null);
    throw new WSFederationMetaException("empty_entityid",null);
  }
  if (realm == null) {
    realm="/";
  }
  String[] objs={federationId,realm};
  try {
    Map attrs=WSFederationMetaUtils.convertJAXBToAttrMap(ATTR_ENTITY_CONFIG,config);
    Map oldAttrs=configInst.getConfiguration(realm,federationId);
    if (oldAttrs == null) {
      LogUtil.error(Level.INFO,LogUtil.NO_ENTITY_DESCRIPTOR_CREATE_ENTITY_CONFIG,objs,null);
      throw new WSFederationMetaException("entity_descriptor_not_exist",objs);
    }
    Set oldValues=(Set)oldAttrs.get(ATTR_ENTITY_CONFIG);
    if (oldValues != null && !oldValues.isEmpty()) {
      LogUtil.error(Level.INFO,LogUtil.ENTITY_CONFIG_EXISTS,objs,null);
      throw new WSFederationMetaException("entity_config_exists",objs);
    }
    configInst.setConfiguration(realm,federationId,attrs);
    LogUtil.access(Level.INFO,LogUtil.ENTITY_CONFIG_CREATED,objs,null);
    SPSSOConfigElement spconfig=getSPSSOConfig(realm,federationId);
    if (spconfig != null) {
      addToCircleOfTrust(spconfig,realm,federationId);
    }
    IDPSSOConfigElement idpconfig=getIDPSSOConfig(realm,federationId);
    if (idpconfig != null) {
      addToCircleOfTrust(idpconfig,realm,federationId);
    }
  }
 catch (  ConfigurationException e) {
    debug.error("WSFederationMetaManager.createEntityConfig:",e);
    String[] data={e.getMessage(),federationId,realm};
    LogUtil.error(Level.INFO,LogUtil.CONFIG_ERROR_CREATE_ENTITY_CONFIG,data,null);
    throw new WSFederationMetaException(e);
  }
catch (  JAXBException jaxbe) {
    debug.error("WSFederationMetaManager.createEntityConfig:",jaxbe);
    LogUtil.error(Level.INFO,LogUtil.CREATE_INVALID_ENTITY_CONFIG,objs,null);
    throw new WSFederationMetaException("invalid_config",objs);
  }
}

public void createEntityConfig ( String realm , FederationConfigElement config ) throws WSFederationMetaException { String federationId = config . getFederationID ( ) ; if ( federationId == null ) { debug . error ( "WSFederationMetaManager.createEntityConfig: " + "entity ID is null" ) ; String [ ] data = { realm } ; LogUtil . error ( Level . INFO , LogUtil . NO_ENTITY_ID_CREATE_ENTITY_CONFIG , data , null ) ; throw new WSFederationMetaException ( "empty_entityid" , null ) ; } if ( realm == null ) { realm = "/" ; } String [ ] objs = { federationId , realm } ; try { Map attrs = WSFederationMetaUtils . convertJAXBToAttrMap ( ATTR_ENTITY_CONFIG , config ) ; Map oldAttrs = configInst . getConfiguration ( realm , federationId ) ; if ( oldAttrs == null ) { LogUtil . error ( Level . INFO , LogUtil . NO_ENTITY_DESCRIPTOR_CREATE_ENTITY_CONFIG , objs , null ) ; throw new WSFederationMetaException ( "entity_descriptor_not_exist" , objs ) ; } Set oldValues = ( Set ) oldAttrs . get ( ATTR_ENTITY_CONFIG ) ; if ( oldValues != null && ! oldValues . isEmpty ( ) ) { LogUtil . error ( Level . INFO , LogUtil . ENTITY_CONFIG_EXISTS , objs , null ) ; throw new WSFederationMetaException ( "entity_config_exists" , objs ) ; } configInst . setConfiguration ( realm , federationId , attrs ) ; LogUtil . access ( Level . INFO , LogUtil . ENTITY_CONFIG_CREATED , objs , null ) ; SPSSOConfigElement spconfig = getSPSSOConfig ( realm , federationId ) ; if ( spconfig != null ) { addToCircleOfTrust ( spconfig , realm , federationId ) ; } IDPSSOConfigElement idpconfig = getIDPSSOConfig ( realm , federationId ) ; if ( idpconfig != null ) { addToCircleOfTrust ( idpconfig , realm , federationId ) ; } } catch ( ConfigurationException e ) { debug . error ( "WSFederationMetaManager.createEntityConfig:" , e ) ; String [ ] data = { e . getMessage ( ) , federationId , realm } ; LogUtil . error ( Level . INFO , LogUtil . CONFIG_ERROR_CREATE_ENTITY_CONFIG , data , null ) ; throw new WSFederationMetaException ( e ) ; } catch ( JAXBException jaxbe ) { debug . error ( "WSFederationMetaManager.createEntityConfig:" , jaxbe ) ; LogUtil . error ( Level . INFO , LogUtil . CREATE_INVALID_ENTITY_CONFIG , objs , null ) ; throw new WSFederationMetaException ( "invalid_config" , objs ) ; } }
creates the extended entity configuration under the realm .
