public void create(SSOToken token,String objName,Map attrs) throws SMSException, SSOException {
  if ((objName == null) || (objName.length() == 0) || (attrs == null)) {
    throw new IllegalArgumentException("SMSEnhancedFlatFileObject.create: " + "One or more arguments is null or empty");
  }
  String attributeFileName=null;
  mRWLock.readRequest();
  try {
    if (root.isExists(mRootDir,objName)) {
      String errmsg="SMSEnhancedFlatFileObject.create: object " + objName;
      mDebug.error(errmsg);
      throw new ServiceAlreadyExistsException(errmsg);
    }
  }
  finally {
    mRWLock.readDone();
  }
  mRWLock.writeRequest();
  if (root.isExists(mRootDir,objName)) {
    String errmsg="SMSEnhancedFlatFileObject.create: object " + objName;
    mDebug.error(errmsg);
    throw new ServiceAlreadyExistsException(errmsg);
  }
  SMSFlatFileTreeNode node=new SMSFlatFileTreeNode(objName);
  String filepath=node.getAttributeFilename(mRootDir);
  try {
    Set sunserviceids=null;
    Set sunxmlkeyvals=null;
    Properties props=new Properties();
    Set keys=attrs.keySet();
    if (keys != null) {
      for (Iterator i=keys.iterator(); i.hasNext(); ) {
        String key=(String)i.next();
        Set vals=(Set)attrs.get(key);
        if (key.equalsIgnoreCase(SMSEntry.ATTR_SERVICE_ID)) {
          sunserviceids=vals;
        }
 else         if (key.equalsIgnoreCase(SMSEntry.ATTR_XML_KEYVAL)) {
          sunxmlkeyvals=vals;
        }
        props.put(key,toValString(vals));
      }
    }
    try {
      File attrFile=new File(filepath);
      try {
        if (!attrFile.createNewFile()) {
          String errmsg="SMSEnhancedFlatFileObject.create: object " + objName + ": Could not create file "+ filepath;
          mDebug.error(errmsg);
          throw new SMSException(errmsg);
        }
      }
 catch (      IOException e) {
        String errmsg="SMSEnhancedFlatFileObject.create: object " + objName + " IOException encountered when creating file "+ filepath+ ". Exception: "+ e.getMessage();
        mDebug.error("SMSEnhancedFlatFileObject.create",e);
        throw new SMSException(errmsg);
      }
      saveProperties(props,attrFile,objName);
      createSunServiceIdFiles(node,sunserviceids);
      createSunXmlKeyValFiles(node,sunxmlkeyvals);
      if (!root.addChild(node)) {
        throw new SMSException("parent not found for node name=" + objName);
      }
      saveDirectoryTree();
    }
 catch (    SMSException e) {
      File attrFile=new File(filepath);
      try {
        attrFile.delete();
      }
 catch (      SecurityException se) {
      }
      throw e;
    }
  }
  finally {
    mRWLock.writeDone();
  }
}

public void create ( SSOToken token , String objName , Map attrs ) throws SMSException , SSOException { if ( ( objName == null ) || ( objName . length ( ) == 0 ) || ( attrs == null ) ) { throw new IllegalArgumentException ( "SMSEnhancedFlatFileObject.create: " + "One or more arguments is null or empty" ) ; } String attributeFileName = null ; mRWLock . readRequest ( ) ; try { if ( root . isExists ( mRootDir , objName ) ) { String errmsg = "SMSEnhancedFlatFileObject.create: object " + objName ; mDebug . error ( errmsg ) ; throw new ServiceAlreadyExistsException ( errmsg ) ; } } finally { mRWLock . readDone ( ) ; } mRWLock . writeRequest ( ) ; if ( root . isExists ( mRootDir , objName ) ) { String errmsg = "SMSEnhancedFlatFileObject.create: object " + objName ; mDebug . error ( errmsg ) ; throw new ServiceAlreadyExistsException ( errmsg ) ; } SMSFlatFileTreeNode node = new SMSFlatFileTreeNode ( objName ) ; String filepath = node . getAttributeFilename ( mRootDir ) ; try { Set sunserviceids = null ; Set sunxmlkeyvals = null ; Properties props = new Properties ( ) ; Set keys = attrs . keySet ( ) ; if ( keys != null ) { for ( Iterator i = keys . iterator ( ) ; i . hasNext ( ) ; ) { String key = ( String ) i . next ( ) ; Set vals = ( Set ) attrs . get ( key ) ; if ( key . equalsIgnoreCase ( SMSEntry . ATTR_SERVICE_ID ) ) { sunserviceids = vals ; } else if ( key . equalsIgnoreCase ( SMSEntry . ATTR_XML_KEYVAL ) ) { sunxmlkeyvals = vals ; } props . put ( key , toValString ( vals ) ) ; } } try { File attrFile = new File ( filepath ) ; try { if ( ! attrFile . createNewFile ( ) ) { String errmsg = "SMSEnhancedFlatFileObject.create: object " + objName + ": Could not create file " + filepath ; mDebug . error ( errmsg ) ; throw new SMSException ( errmsg ) ; } } catch ( IOException e ) { String errmsg = "SMSEnhancedFlatFileObject.create: object " + objName + " IOException encountered when creating file " + filepath + ". Exception: " + e . getMessage ( ) ; mDebug . error ( "SMSEnhancedFlatFileObject.create" , e ) ; throw new SMSException ( errmsg ) ; } saveProperties ( props , attrFile , objName ) ; createSunServiceIdFiles ( node , sunserviceids ) ; createSunXmlKeyValFiles ( node , sunxmlkeyvals ) ; if ( ! root . addChild ( node ) ) { throw new SMSException ( "parent not found for node name=" + objName ) ; } saveDirectoryTree ( ) ; } catch ( SMSException e ) { File attrFile = new File ( filepath ) ; try { attrFile . delete ( ) ; } catch ( SecurityException se ) { } throw e ; } } finally { mRWLock . writeDone ( ) ; } }
creates the configuration object . creates the directory for the object and the attributes properties file with the given attributes .
