gate.creole
Class BootStrap

java.lang.Object
  |
  +--gate.creole.BootStrap

public class BootStrap
extends Object

This class creates a resource (e.g.ProcessingResource, VisualResource or Language Resource) with the information from the user and generates a project in the directory provided by the user


Field Summary
protected  Set allPackages
          the packages used by the class which creates the resources
private static int BUFF_SIZE
          the size of the buffer
private  byte[] buffer
          a buffer in order to read an array of bytes
private  char[] cbuffer
          a buffer in order to read an array of char
protected  Map fields
          the enumeration of the variables from main class
protected  ArrayList listMethodsResource
          the methods from the class that implements the resource
protected  List listPackages
          the list with the packages name where the main class can be find
protected  String nameProject
          the name of jar resource
protected static Map names
          a map from the variants of the names of the files and the directories of the empty project to the variants of the names of the files and the directories the new project
protected  Map oldNames
           
protected  String oldResource
          the name of the resource of the template project from the gate resources
protected static String resourcePath
          Where on the classpath the gate resources are to be found
 
Constructor Summary
BootStrap()
           
 
Method Summary
 String addContent(String content, String expr, String interfaces)
          Modifies the content of the file from gate/resources/pathResourceFile using the information (e.g.name of the resource, name of the class which implements the resource)provided by the user and copies it in currentFile.
 String changeKeyValue(String text, Map map)
          Determines all the keys from the map "names" in the text and replaces them with their values
 Map createNames(String namePackage, String nameClass, String stringPackages)
          create the map with variants of the names...
 void createResource(String namePackage, String typeResource, String nameClass, Set listInterfaces, String pathNewProject)
          Creates the resource and dumps out a project structure using the structure from gate/resource/creole/templateproject/Template and the information provided by the user
 List determinePath(String namePackage)
          determines the name of the packages and adds them to a list
 String determineTypePackage(String text)
          return the text between the last dot and the end of input
 String getInterfacesAndClass(String typeResource, Set listInterfaces)
          returns all the interfaces that it implements and the class that it extends as a string
 String namesPackages(Set listPackages)
          determine all the packages
 String regularExpressions(String text, String replacement, String regEx)
          replace with replacement in the text using regEx as a regular expression
 void shapeMethod(List listMethodExtend, List listInterfacesMethod)
          create the form for the methods from the class that create the resource
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

resourcePath

protected static String resourcePath
Where on the classpath the gate resources are to be found

oldResource

protected String oldResource
the name of the resource of the template project from the gate resources

nameProject

protected String nameProject
the name of jar resource

names

protected static Map names
a map from the variants of the names of the files and the directories of the empty project to the variants of the names of the files and the directories the new project

oldNames

protected Map oldNames

BUFF_SIZE

private static final int BUFF_SIZE
the size of the buffer

buffer

private byte[] buffer
a buffer in order to read an array of bytes

cbuffer

private char[] cbuffer
a buffer in order to read an array of char

listMethodsResource

protected ArrayList listMethodsResource
the methods from the class that implements the resource

listPackages

protected List listPackages
the list with the packages name where the main class can be find

allPackages

protected Set allPackages
the packages used by the class which creates the resources

fields

protected Map fields
the enumeration of the variables from main class
Constructor Detail

BootStrap

public BootStrap()
Method Detail

regularExpressions

public String regularExpressions(String text,
                                 String replacement,
                                 String regEx)
                          throws gnu.regexp.REException
replace with replacement in the text using regEx as a regular expression

changeKeyValue

public String changeKeyValue(String text,
                             Map map)
                      throws gnu.regexp.REException
Determines all the keys from the map "names" in the text and replaces them with their values

determineTypePackage

public String determineTypePackage(String text)
return the text between the last dot and the end of input

getInterfacesAndClass

public String getInterfacesAndClass(String typeResource,
                                    Set listInterfaces)
                             throws ClassNotFoundException
returns all the interfaces that it implements and the class that it extends as a string

shapeMethod

public void shapeMethod(List listMethodExtend,
                        List listInterfacesMethod)
create the form for the methods from the class that create the resource

addContent

public String addContent(String content,
                         String expr,
                         String interfaces)
                  throws gnu.regexp.REException
Modifies the content of the file from gate/resources/pathResourceFile using the information (e.g.name of the resource, name of the class which implements the resource)provided by the user and copies it in currentFile. This procedure also adds the interfaces that it implements and the class that it extends in the class which creates the resource

createNames

public Map createNames(String namePackage,
                       String nameClass,
                       String stringPackages)
create the map with variants of the names...

namesPackages

public String namesPackages(Set listPackages)
determine all the packages

determinePath

public List determinePath(String namePackage)
                   throws IOException
determines the name of the packages and adds them to a list

createResource

public void createResource(String namePackage,
                           String typeResource,
                           String nameClass,
                           Set listInterfaces,
                           String pathNewProject)
                    throws IOException,
                           ClassNotFoundException,
                           gnu.regexp.REException,
                           GateException
Creates the resource and dumps out a project structure using the structure from gate/resource/creole/templateproject/Template and the information provided by the user