public void removePolicy(String policyName) throws SSOException, NoPermissionException, PolicyException {
  if (policyName == null) {
    if (debug.warningEnabled()) {
      debug.warning("In PolicyManager::removePolicy(), name is null");
    }
    throw (new InvalidNameException(ResBundleUtils.rbName,"null_name",null,"null",PolicyException.POLICY));
  }
  try {
    PolicyManager.initAdminSubject();
    ServiceConfig oConfig=scm.getOrganizationConfig(org,null);
    ServiceConfig namedPolicy=(oConfig == null) ? null : oConfig.getSubConfig(NAMED_POLICY);
    if (namedPolicy != null) {
      Policy policy=getPolicy(policyName);
      namedPolicy.removeSubConfig(policyName);
      if (policy != null) {
        PrivilegeIndexStore pis=PrivilegeIndexStore.getInstance(SubjectUtils.createSuperAdminSubject(),getOrganizationDN());
        if (policy.isReferralPolicy()) {
          pis.deleteReferral((policyName));
        }
 else {
          pis.delete(PrivilegeUtils.policyToPrivileges(policy));
        }
        policyCache.sendPolicyChangeNotification(null,policy,ServiceListener.REMOVED);
      }
    }
  }
 catch (  EntitlementException e) {
    debug.error("Error while removing policy : " + e.getMessage());
  }
catch (  ServiceNotFoundException snfe) {
    debug.error("Error while removing policy : " + snfe.getMessage());
  }
catch (  SMSException smse) {
    String objs[]={policyName,org};
    if (PolicyUtils.logStatus) {
      PolicyUtils.logErrorMessage("UNABLE_TO_REMOVE_POLICY",objs,token);
    }
    debug.error("SMS error in deleting policy: " + policyName + " for org: "+ org,smse);
    if (smse.getExceptionCode() == SMSException.STATUS_NO_PERMISSION) {
      throw (new NoPermissionException(ResBundleUtils.rbName,"insufficient_access_rights",null));
    }
 else {
      throw (new PolicyException(ResBundleUtils.rbName,"unable_to_remove_policy",objs,smse));
    }
  }
  String objs[]={policyName,org};
  if (PolicyUtils.logStatus) {
    PolicyUtils.logAccessMessage("POLICY_REMOVE_SUCCESS",objs,token);
  }
}

public void removePolicy ( String policyName ) throws SSOException , NoPermissionException , PolicyException { if ( policyName == null ) { if ( debug . warningEnabled ( ) ) { debug . warning ( "In PolicyManager::removePolicy(), name is null" ) ; } throw ( new InvalidNameException ( ResBundleUtils . rbName , "null_name" , null , "null" , PolicyException . POLICY ) ) ; } try { PolicyManager . initAdminSubject ( ) ; ServiceConfig oConfig = scm . getOrganizationConfig ( org , null ) ; ServiceConfig namedPolicy = ( oConfig == null ) ? null : oConfig . getSubConfig ( NAMED_POLICY ) ; if ( namedPolicy != null ) { Policy policy = getPolicy ( policyName ) ; namedPolicy . removeSubConfig ( policyName ) ; if ( policy != null ) { PrivilegeIndexStore pis = PrivilegeIndexStore . getInstance ( SubjectUtils . createSuperAdminSubject ( ) , getOrganizationDN ( ) ) ; if ( policy . isReferralPolicy ( ) ) { pis . deleteReferral ( ( policyName ) ) ; } else { pis . delete ( PrivilegeUtils . policyToPrivileges ( policy ) ) ; } policyCache . sendPolicyChangeNotification ( null , policy , ServiceListener . REMOVED ) ; } } } catch ( EntitlementException e ) { debug . error ( "Error while removing policy : " + e . getMessage ( ) ) ; } catch ( ServiceNotFoundException snfe ) { debug . error ( "Error while removing policy : " + snfe . getMessage ( ) ) ; } catch ( SMSException smse ) { String objs [ ] = { policyName , org } ; if ( PolicyUtils . logStatus ) { PolicyUtils . logErrorMessage ( "UNABLE_TO_REMOVE_POLICY" , objs , token ) ; } debug . error ( "SMS error in deleting policy: " + policyName + " for org: " + org , smse ) ; if ( smse . getExceptionCode ( ) == SMSException . STATUS_NO_PERMISSION ) { throw ( new NoPermissionException ( ResBundleUtils . rbName , "insufficient_access_rights" , null ) ) ; } else { throw ( new PolicyException ( ResBundleUtils . rbName , "unable_to_remove_policy" , objs , smse ) ) ; } } String objs [ ] = { policyName , org } ; if ( PolicyUtils . logStatus ) { PolicyUtils . logAccessMessage ( "POLICY_REMOVE_SUCCESS" , objs , token ) ; } }
deletes a policy in the organization with the given name .
