gate.creole
Class BootStrap

java.lang.Object
  extended by 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
protected static int BUFF_SIZE
          the size of the buffer
protected  char[] cbuffer
          a buffer in order to read an array of char
protected  Map fields
          the enumeration of the variables from main class
protected  List 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 static String nameProject
          the name of jar resource
protected  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 static String newLine
          new line for different platforms
protected  Map oldNames
           
protected static String oldResource
          the name of the resource of the template project from the gate resources
 
Constructor Summary
BootStrap()
           
 
Method Summary
 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 packageName, String resourceName, String className, String stringPackages, String interfacesAndClass)
          create the map with variants of the names...
 void createResource(String resourceName, String packageName, String typeResource, String className, Set interfacesList, String pathNewProject)
          Creates the resource and dumps out a project structure using the structure from gate/resource/creole/bootstrap/Template and the information provided by the user
 List determinePath(String packageName)
          determines the name of the packages and adds them to a list
 String determineTypePackage(String text)
          determines the package of the main class
 String displayMethodsAndFields(List methods, Map fields)
          write the methods and the fields in the right form
 void executableFile(String nameFile)
           
 List featuresClass(Class currentClass, List methodsList)
          go through all methods and determines return type, parameters, exceptions
 String getInterfacesAndClass(String typeResource, Set interfacesList)
          returns the string with the interfaces that implement the main class and the class that extends it
 void getMethodsAndFields(List methodsExtendList, List methodsInterfacesList)
          create the form for the methods from the class that create the resource
static void main(String[] args)
           
 String namesPackages(Set listPackages)
          determine all the packages
 void verifyInput(String className, String pathNewProject)
          verify if the class name contains only letters and digits the path of the new project is a directory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

oldResource

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

See Also:
Constant Field Values

nameProject

protected static final String nameProject
the name of jar resource

See Also:
Constant Field Values

newLine

protected static final String newLine
new line for different platforms


names

protected 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

listMethodsResource

protected List 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


cbuffer

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


BUFF_SIZE

protected static final int BUFF_SIZE
the size of the buffer

See Also:
Constant Field Values
Constructor Detail

BootStrap

public BootStrap()
Method Detail

changeKeyValue

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


determineTypePackage

public String determineTypePackage(String text)
determines the package of the main class


getInterfacesAndClass

public String getInterfacesAndClass(String typeResource,
                                    Set interfacesList)
                             throws ClassNotFoundException
returns the string with the interfaces that implement the main class and the class that extends it

Throws:
ClassNotFoundException

featuresClass

public List featuresClass(Class currentClass,
                          List methodsList)
go through all methods and determines return type, parameters, exceptions


getMethodsAndFields

public void getMethodsAndFields(List methodsExtendList,
                                List methodsInterfacesList)
create the form for the methods from the class that create the resource

Parameters:
methodsExtendList - is the list with all methods from the class that extends the resource
methodsInterfacesList - is the list with all methods from the interfaces that implement the resource

displayMethodsAndFields

public String displayMethodsAndFields(List methods,
                                      Map fields)
write the methods and the fields in the right form


createNames

public Map createNames(String packageName,
                       String resourceName,
                       String className,
                       String stringPackages,
                       String interfacesAndClass)
create the map with variants of the names...


namesPackages

public String namesPackages(Set listPackages)
determine all the packages


determinePath

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

Throws:
IOException

verifyInput

public void verifyInput(String className,
                        String pathNewProject)
                 throws GateException
verify if the class name contains only letters and digits the path of the new project is a directory

Throws:
GateException

executableFile

public void executableFile(String nameFile)
                    throws IOException,
                           InterruptedException
Throws:
IOException
InterruptedException

createResource

public void createResource(String resourceName,
                           String packageName,
                           String typeResource,
                           String className,
                           Set interfacesList,
                           String pathNewProject)
                    throws IOException,
                           ClassNotFoundException,
                           GateException,
                           InterruptedException
Creates the resource and dumps out a project structure using the structure from gate/resource/creole/bootstrap/Template and the information provided by the user

Parameters:
resourceName - is the name of the resource
packageName - is the name of the new resource
typeResource - is the type of the resource (e.g.ProcessingResource, LanguageResource or VisualResource)
className - is the name of the class which implements the resource
interfacesList - is the set of the interfaces that implements the resource
pathNewProject - is the path where it will be the new resource
Throws:
IOException
ClassNotFoundException
GateException
InterruptedException

main

public static void main(String[] args)