public static File createContainerSchemaFile(String schemaPrefixFileName,String containerSchemaFilePath) throws RemoteException {
  File defaultSchemaFile=null;
  try {
    String schemaFilePath=Constants.Container.CONTAINER_CONFIG_DIRECTORY + "/" + Constants.Schemas.SCHEMAS_FOLDER+ "/"+ Constants.Schemas.DEFAULT_SCHEMA+ Constants.Schemas.CONTAINER_SCHEMA_FILE_SUFFIX;
    InputStream schemaInputStream=ResourceLoader.getResourceStream(schemaFilePath);
    String folderOwnerPath=containerSchemaFilePath.substring(0,containerSchemaFilePath.lastIndexOf(File.separator));
    File folderOwnerInstance=new File(folderOwnerPath);
    if (!folderOwnerInstance.exists()) {
      folderOwnerInstance.mkdirs();
    }
    defaultSchemaFile=new File(containerSchemaFilePath);
    FileOutputStream fos=new FileOutputStream(defaultSchemaFile);
    int read=1;
    while (read > 0) {
      byte[] readBytesArray=new byte[schemaInputStream.available()];
      read=schemaInputStream.read(readBytesArray);
      fos.write(readBytesArray);
    }
    fos.flush();
    fos.close();
    schemaInputStream.close();
    ReplaceInFileUtils file=new ReplaceInFileUtils(containerSchemaFilePath);
    file.replaceInFile("<" + Constants.Schemas.DEFAULT_SCHEMA + ">","<" + schemaPrefixFileName + ">");
    file.replaceInFile("</" + Constants.Schemas.DEFAULT_SCHEMA + ">","</" + schemaPrefixFileName + ">");
    file.close();
  }
 catch (  Exception ex) {
    throw new RemoteException("Fail to create schema file",ex);
  }
  return defaultSchemaFile;
}

public static File createContainerSchemaFile ( String schemaPrefixFileName , String containerSchemaFilePath ) throws RemoteException { File defaultSchemaFile = null ; try { String schemaFilePath = Constants . Container . CONTAINER_CONFIG_DIRECTORY + "/" + Constants . Schemas . SCHEMAS_FOLDER + "/" + Constants . Schemas . DEFAULT_SCHEMA + Constants . Schemas . CONTAINER_SCHEMA_FILE_SUFFIX ; InputStream schemaInputStream = ResourceLoader . getResourceStream ( schemaFilePath ) ; String folderOwnerPath = containerSchemaFilePath . substring ( 0 , containerSchemaFilePath . lastIndexOf ( File . separator ) ) ; File folderOwnerInstance = new File ( folderOwnerPath ) ; if ( ! folderOwnerInstance . exists ( ) ) { folderOwnerInstance . mkdirs ( ) ; } defaultSchemaFile = new File ( containerSchemaFilePath ) ; FileOutputStream fos = new FileOutputStream ( defaultSchemaFile ) ; int read = 1 ; while ( read > 0 ) { byte [ ] readBytesArray = new byte [ schemaInputStream . available ( ) ] ; read = schemaInputStream . read ( readBytesArray ) ; fos . write ( readBytesArray ) ; } fos . flush ( ) ; fos . close ( ) ; schemaInputStream . close ( ) ; ReplaceInFileUtils file = new ReplaceInFileUtils ( containerSchemaFilePath ) ; file . replaceInFile ( "<" + Constants . Schemas . DEFAULT_SCHEMA + ">" , "<" + schemaPrefixFileName + ">" ) ; file . replaceInFile ( "</" + Constants . Schemas . DEFAULT_SCHEMA + ">" , "</" + schemaPrefixFileName + ">" ) ; file . close ( ) ; } catch ( Exception ex ) { throw new RemoteException ( "Fail to create schema file" , ex ) ; } return defaultSchemaFile ; }
this method creates container schema . configuration file with default definitions .
