示例#1
0
  /**
   * Deletes only the schema for the given service name. This is provided only for backward
   * compatibility for DSAME 5.0 and will be deprecated in the future release. Alternative is to use
   * <code>ServiceSchemaManager.replaceSchema()</code>.
   *
   * @param serviceName Name of service to be deleted.
   * @throws SMSException if an error occurred while performing the operation
   * @throws SSOException if the user's single sign on token is invalid or expired
   */
  public void deleteService(String serviceName) throws SMSException, SSOException {
    if (serviceName.equalsIgnoreCase(IdConstants.REPO_SERVICE)
        || serviceName.equalsIgnoreCase(ISAuthConstants.AUTH_SERVICE_NAME)) {
      Object args[] = {serviceName};
      throw (new SMSException(
          IUMSConstants.UMS_BUNDLE_NAME, "sms-SERVICE_CORE_CANNOT_DELETE", args));
    }

    Iterator versions = getServiceVersions(serviceName).iterator();
    while (versions.hasNext()) {
      String version = (String) versions.next();
      CachedSMSEntry ce = CachedSMSEntry.getInstance(token, getServiceNameDN(serviceName, version));
      if (ce.isDirty()) {
        ce.refresh();
      }
      SMSEntry e = ce.getClonedSMSEntry();
      String[] values = {SMSSchema.getDummyXML(serviceName, version)};
      e.setAttribute(SMSEntry.ATTR_SCHEMA, values);
      e.save(token);
      ce.refresh(e);
    }
  }