Package org.apache.uima.tools.jcasgen
Class Jg
java.lang.Object
org.apache.uima.tools.jcasgen.Jg
Class holds type plugin-wide collections and static methods. Also implements the runnable that is
called to do the processing
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe Class ErrorExit.static interfaceInterface implemented by JCAS code generation's templates. -
Field Summary
FieldsModifier and TypeFieldDescriptionThe imports.The built in types.(package private) static TypeSystemThe built in type system.(package private) CASThe cas.static final PropertiesThe Constant casCreateProperties.private TypeThe cas string type.(package private) StringThe class path.(package private) static final FeatureDescription[]The Constant emptyFds.The error.(package private) static final Map<String, FeatureDescription[]> The Constant extendableBuiltInTypes.(package private) static final FeatureDescription[]The Constant featureDescriptionArray0.(package private) GUIThe gui.The imports.private static final boolean(package private) static final StringThe Constant jControlModel.private booleanThe limit J cas gen to project scope.The merged types adding features.(package private) IMergeThe merger.Set of types not generated from the CAS type set because they're already in existence as builtins in the JCas impl.The non importable java names.(package private) StringThe package name.(package private) IProgressMonitorThe progress monitor.private StringThe project path dir.(package private) static final Collection<String> The Constant reservedFeatureNames.private static ResourceBundleThe resource bundle.(package private) StringThe simple class name.private TypeThe tcas annotation type.private TypeSystemThe type system.(package private) WaiterThe waiter.(package private) StringThe xml source file name. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidaddBuiltInTypeInfo(String casName, String javaName) Adds the built in type info.private static voidaddBuiltInTypeInfo(String casName, String javaName, String casElementName) Adds the built in type info.(package private) StringArray core.(package private) StringarrayLLCore(String get_set, String range, String fname) Array LL core.(package private) StringarrayLLCoreChk(String get_set, String range, String fname) Array LL core chk.(package private) StringcastResult(String resultType, String core) Cast result.(package private) voidcollectImport(String casName, boolean _Type) Collect import.(package private) Collection<String> collectImports(TypeDescription td, boolean _Type) Collect imports.Creates the resource manager.voiddriveGui()Drive gui.private voidgenerateAllTypesFromTemplates(String outputDirectory, TypeDescription[] tds, CASImpl aCas, Class<JCasTypeTemplate> jcasTypeClass) Generate all types from templates.private voidgenerateClass(IProgressMonitor progressMonitorGenerateClass, String outputDirectory, TypeDescription td, String sourceContents, String className, IMerge mergerGenerateClass) Generate class.private voidgenerateClassesFromTemplate(TypeDescription td, String outputDirectory, Jg.IJCasTypeTemplate jcasTypeInstance) Generate type classes from the specified templates.(package private) StringGets the array feature value.private StringgetCheckSuffix(String get_set, String range) Gets the check suffix.(package private) StringgetDate()Gets the date.(package private) StringGets the feature value.(package private) StringGets the gets the set array name part.(package private) StringGets the gets the set name part.(package private) StringgetJavaName(String name) Gets the java name.(package private) StringGets the java name.(package private) StringGets the java name type.(package private) StringgetJavaNameWithPkg(String casTypeName) Gets the java name with pkg.(package private) StringGets the java pkg.(package private) StringGets the java range array element type.(package private) StringGets the java range array element type, with generic type or ? in invalid input: '<'> as needed(package private) StringGets the java range type.(package private) StringGets the java range type, with generic types in invalid input: '<'> as required.(package private) StringGets the pkg.(package private) StringGets the pkg.Returns the plugin's resource bundle,.getResourceString(String key) Returns the string from the plugin's resource bundle, or 'key' if not found.Gets the string.(package private) booleanChecks for array range.(package private) booleanhasPkgPrefix(String name) Checks for pkg prefix.(package private) booleanprivate booleanisOutOfScope(TypeDescription td, String projectDirPath) return true if td is not defined in this project, or it is defined, but is also in merged and any of the other merged urls are not defined in this project.(package private) booleanChecks if is possible index key.(package private) booleanprivate booleanChecks if is same feature description.(package private) booleanChecks if is string subtype.(package private) booleanChecks if is sub type of annotation.static voidThe main method.intmain0(String[] args, IMerge aMerger, IProgressMonitor aProgressMonitor, IError aError) Main 0.intArguments are: -jcasgeninput xxxx -jcasgenoutput xxxx -jcasgenclasspath xxxxvoidmainForCde(IMerge aMerger, IProgressMonitor aProgressMonitor, IError aError, String inputFile, String outputDirectory, TypeDescription[] tds, CASImpl aCas) Main for cde.voidmainForCde(IMerge aMerger, IProgressMonitor aProgressMonitor, IError aError, String inputFile, String outputDirectory, TypeDescription[] tds, CASImpl aCas, String pProjectPathDir, boolean limitToProjectScope, Map<String, Set<String>> pMergedTypesAddingFeatures) Main for cde.voidmainGenerateAllTypesFromTemplates(IMerge aMerger, IProgressMonitor aProgressMonitor, IError aError, String inputFile, String outputDirectory, TypeDescription[] tds, CASImpl aCas, Class<JCasTypeTemplate> jcasTypeClass, Class<JCasTypeTemplate> jcas_TypeClass) Main generate all types from templates.voidmainGenerateAllTypesFromTemplates(IMerge aMerger, IProgressMonitor aProgressMonitor, IError aError, String inputFile, String outputDirectory, TypeDescription[] tds, CASImpl aCas, Class<JCasTypeTemplate> jcasTypeClass, String pProjectPathDir, boolean limitToProjectScope, Map<String, Set<String>> pMergedTypesAddingFeatures) Main generate all types from templates.private StringmakeMergeMessage(Map<String, Set<String>> m) Make merge message.private TypeSystemDescriptionMerge type system imports.(package private) StringNull blank.static StringRemoves the pkg.(package private) StringSc.(package private) StringSets the array feature value.(package private) List<FeatureDescription> setDifference(FeatureDescription[] newFeatures, FeatureDescription[] alreadyDefinedFeatures) Sets the difference.(package private) StringSets the feature value.(package private) StringsimpleCore(String get_set, String range, String fname) Simple core.(package private) StringsimpleLLCore(String get_set, String range, String fname) Simple LL core.(package private) StringUc 1.(package private) StringwrapToGetFS(String core, String range) Wrap to get FS.
-
Field Details
-
IS_TRACE_LIMITED
private static final boolean IS_TRACE_LIMITED- See Also:
-
jControlModel
The Constant jControlModel.- See Also:
-
featureDescriptionArray0
The Constant featureDescriptionArray0. -
reservedFeatureNames
The Constant reservedFeatureNames. -
noGenTypes
Set of types not generated from the CAS type set because they're already in existence as builtins in the JCas impl. and if they're generated, the generated forms are wrong. -
casCreateProperties
The Constant casCreateProperties. -
extendableBuiltInTypes
The Constant extendableBuiltInTypes. -
emptyFds
The Constant emptyFds. -
builtInTypeSystem
The built in type system. -
builtInTypes
The built in types. -
genericFeatureDescriptorTypes
-
resourceBundle
The resource bundle. -
imports
The imports. -
_imports
The imports. -
classPath
String classPathThe class path. -
xmlSourceFileName
String xmlSourceFileNameThe xml source file name. -
cas
CAS casThe cas. -
gui
GUI guiThe gui. -
merger
IMerge mergerThe merger. -
progressMonitor
IProgressMonitor progressMonitorThe progress monitor. -
error
The error. -
waiter
Waiter waiterThe waiter. -
packageName
String packageNameThe package name. -
simpleClassName
String simpleClassNameThe simple class name. -
typeSystem
The type system. -
casStringType
The cas string type. -
tcasAnnotationType
The tcas annotation type. -
mergedTypesAddingFeatures
The merged types adding features. -
projectPathDir
The project path dir. -
limitJCasGenToProjectScope
private boolean limitJCasGenToProjectScopeThe limit J cas gen to project scope. -
nonImportableJavaNames
The non importable java names.
-
-
Constructor Details
-
Jg
public Jg()Instantiates a new jg.
-
-
Method Details
-
addBuiltInTypeInfo
Adds the built in type info.- Parameters:
casName- the cas namejavaName- the java namecasElementName- the cas element name
-
addBuiltInTypeInfo
Adds the built in type info.- Parameters:
casName- the cas namejavaName- the java name
-
getResourceString
Returns the string from the plugin's resource bundle, or 'key' if not found.- Parameters:
key- the key- Returns:
- the resource string
-
getString
Gets the string.- Parameters:
key- the keysubstitutions- the substitutions- Returns:
- the string
-
getResourceBundle
Returns the plugin's resource bundle,.- Returns:
- the resource bundle
-
driveGui
public void driveGui()Drive gui. -
main
The main method.- Parameters:
args- the arguments
-
mainForCde
public void mainForCde(IMerge aMerger, IProgressMonitor aProgressMonitor, IError aError, String inputFile, String outputDirectory, TypeDescription[] tds, CASImpl aCas) throws IOException Main for cde.- Parameters:
aMerger- the a mergeraProgressMonitor- the a progress monitoraError- the a errorinputFile- the input fileoutputDirectory- the output directorytds- the tdsaCas- the a cas- Throws:
IOException- Signals that an I/O exception has occurred.
-
mainForCde
public void mainForCde(IMerge aMerger, IProgressMonitor aProgressMonitor, IError aError, String inputFile, String outputDirectory, TypeDescription[] tds, CASImpl aCas, String pProjectPathDir, boolean limitToProjectScope, Map<String, Set<String>> pMergedTypesAddingFeatures) throws IOExceptionMain for cde.- Parameters:
aMerger- the a mergeraProgressMonitor- the a progress monitoraError- the a errorinputFile- the input fileoutputDirectory- the output directorytds- the tdsaCas- the a caspProjectPathDir- the project path dirlimitToProjectScope- the limit J cas gen to project scopepMergedTypesAddingFeatures- the merged types adding features- Throws:
IOException- Signals that an I/O exception has occurred.
-
mainGenerateAllTypesFromTemplates
public void mainGenerateAllTypesFromTemplates(IMerge aMerger, IProgressMonitor aProgressMonitor, IError aError, String inputFile, String outputDirectory, TypeDescription[] tds, CASImpl aCas, Class<JCasTypeTemplate> jcasTypeClass, Class<JCasTypeTemplate> jcas_TypeClass) throws IOException, InstantiationException, IllegalAccessException Main generate all types from templates.- Parameters:
aMerger- the a mergeraProgressMonitor- the a progress monitoraError- the a errorinputFile- the input fileoutputDirectory- the output directorytds- the tdsaCas- the a casjcasTypeClass- the jcas type classjcas_TypeClass- the jcas type class- Throws:
IOException- Signals that an I/O exception has occurred.InstantiationException- the instantiation exceptionIllegalAccessException- the illegal access exception
-
mainGenerateAllTypesFromTemplates
public void mainGenerateAllTypesFromTemplates(IMerge aMerger, IProgressMonitor aProgressMonitor, IError aError, String inputFile, String outputDirectory, TypeDescription[] tds, CASImpl aCas, Class<JCasTypeTemplate> jcasTypeClass, String pProjectPathDir, boolean limitToProjectScope, Map<String, Set<String>> pMergedTypesAddingFeatures) throws IOException, InstantiationException, IllegalAccessExceptionMain generate all types from templates.- Parameters:
aMerger- the a mergeraProgressMonitor- the a progress monitoraError- the a errorinputFile- the input fileoutputDirectory- the output directorytds- the tdsaCas- the a casjcasTypeClass- the jcas type classpProjectPathDir- the project path dirlimitToProjectScope- the limit J cas gen to project scopepMergedTypesAddingFeatures- the merged types adding features- Throws:
IOException- Signals that an I/O exception has occurred.InstantiationException- the instantiation exceptionIllegalAccessException- the illegal access exception
-
main0
Main 0.- Parameters:
args- the argsaMerger- the a mergeraProgressMonitor- the a progress monitoraError- the a error- Returns:
- the int
-
main1
Arguments are: -jcasgeninput xxxx -jcasgenoutput xxxx -jcasgenclasspath xxxx- Parameters:
arguments- the arguments- Returns:
- the int
-
makeMergeMessage
Make merge message.- Parameters:
m- the m- Returns:
- the string
-
generateAllTypesFromTemplates
private void generateAllTypesFromTemplates(String outputDirectory, TypeDescription[] tds, CASImpl aCas, Class<JCasTypeTemplate> jcasTypeClass) throws IOException, InstantiationException, IllegalAccessException Generate all types from templates.- Parameters:
outputDirectory- the output directorytds- the tdsaCas- the a casjcasTypeClass- the jcas type class- Throws:
IOException- Signals that an I/O exception has occurred.InstantiationException- the instantiation exceptionIllegalAccessException- the illegal access exception
-
isOutOfScope
return true if td is not defined in this project, or it is defined, but is also in merged and any of the other merged urls are not defined in this project.- Parameters:
td- the tdprojectDirPath- the project dir path- Returns:
- true, if is out of scope
-
generateClassesFromTemplate
private void generateClassesFromTemplate(TypeDescription td, String outputDirectory, Jg.IJCasTypeTemplate jcasTypeInstance) throws IOException Generate type classes from the specified templates.- Parameters:
td- TypeDescription objectoutputDirectory- output directoryjcasTypeInstance- Template instance used to generate class- Throws:
IOException- -
-
getPkg
Gets the pkg.- Parameters:
td- the td- Returns:
- the pkg
-
getPkg
Gets the pkg.- Parameters:
nameWithPkg- the name with pkg- Returns:
- the pkg
-
generateClass
private void generateClass(IProgressMonitor progressMonitorGenerateClass, String outputDirectory, TypeDescription td, String sourceContents, String className, IMerge mergerGenerateClass) throws IOException Generate class.- Parameters:
progressMonitorGenerateClass- the progress monitor generate classoutputDirectory- the output directorytd- the tdsourceContents- the source contentsclassName- the class namemergerGenerateClass- the merger generate class- Throws:
IOException- Signals that an I/O exception has occurred.
-
removePkg
Removes the pkg.- Parameters:
name- the name- Returns:
- the string
-
sc
Sc.- Parameters:
v- the v- Returns:
- the string
-
getJavaPkg
Gets the java pkg.- Parameters:
td- the td- Returns:
- the java pkg
-
getJavaNameWithPkg
Gets the java name with pkg.- Parameters:
casTypeName- the cas type name- Returns:
- the java name with pkg
-
hasPkgPrefix
Checks for pkg prefix.- Parameters:
name- the name- Returns:
- true, if successful
-
getJavaName
Gets the java name.- Parameters:
td- the td- Returns:
- the java name
-
getJavaName_Type
Gets the java name type.- Parameters:
td- the td- Returns:
- the java name type
-
getJavaName
Gets the java name.- Parameters:
name- the name- Returns:
- the java name
-
collectImport
Collect import.- Parameters:
casName- the cas name_Type- the type
-
collectImports
Collect imports.- Parameters:
td- the td_Type- the type- Returns:
- the collection
-
getJavaRangeType
Gets the java range type.- Parameters:
fd- the fd- Returns:
- the java range type
-
getJavaRangeType2
Gets the java range type, with generic types in invalid input: '<'> as required.- Parameters:
fd- the fd- Returns:
- the java range type
-
isSubTypeOfAnnotation
Checks if is sub type of annotation.- Parameters:
td- the td- Returns:
- true, if is sub type of annotation
-
hasArrayRange
Checks for array range.- Parameters:
fd- the fd- Returns:
- true, if successful
-
isPossibleIndexKey
Checks if is possible index key.- Parameters:
fd- the fd- Returns:
- true, if is possible index key
-
isStringSubtype
Checks if is string subtype.- Parameters:
fd- the fd- Returns:
- true, if is string subtype
-
getJavaRangeArrayElementType
Gets the java range array element type.- Parameters:
fd- the fd- Returns:
- the java range array element type
-
getJavaRangeArrayElementType2
Gets the java range array element type, with generic type or ? in invalid input: '<'> as needed- Parameters:
fd- the fd- Returns:
- the java range array element type
-
uc1
Uc 1.- Parameters:
name- the name- Returns:
- the string
-
getDate
String getDate()Gets the date.- Returns:
- the date
-
castResult
Cast result.- Parameters:
resultType- the result typecore- the core- Returns:
- the string
-
wrapToGetFS
Wrap to get FS.- Parameters:
core- string representing the get or set coderange- Boolean, Byte, Short, Int, Long, Float, Double, String, or Feature- Returns:
- -
-
simpleCore
Simple core.- Parameters:
get_set- get or setrange- Boolean, Byte, Short, Int, Long, Float, Double, String, or Featurefname- feature name (e.g. "begin"- Returns:
- the string
-
simpleLLCore
Simple LL core.- Parameters:
get_set- the get setrange- the rangefname- the fname- Returns:
- the string
-
arrayCore
Array core.- Parameters:
get_set- get or setrange- the component range: Boolean, Byte, Short, Int, Long, Float, Double, String, FeaturearrayRange- the array rangefname- the fname- Returns:
- the string
-
arrayLLCore
Array LL core.- Parameters:
get_set- the get setrange- the rangefname- the fname- Returns:
- the string
-
arrayLLCoreChk
Array LL core chk.- Parameters:
get_set- the get setrange- the rangefname- the fname- Returns:
- the string
-
getFeatureValue
Gets the feature value.- Parameters:
fd- the fdtd- the td- Returns:
- the feature value
-
setFeatureValue
Sets the feature value.- Parameters:
fd- the fdtd- the td- Returns:
- the string
-
getArrayFeatureValue
Gets the array feature value.- Parameters:
fd- the fdtd- the td- Returns:
- the array feature value
-
setArrayFeatureValue
Sets the array feature value.- Parameters:
fd- the fdtd- the td- Returns:
- the string
-
getGetSetNamePart
Gets the gets the set name part.- Parameters:
fd- the fd- Returns:
- the gets the set name part
-
getGetSetArrayNamePart
Gets the gets the set array name part.- Parameters:
fd- the fd- Returns:
- the gets the set array name part
-
nullBlank
Null blank.- Parameters:
s- the s- Returns:
- the string
-
createResourceManager
Creates the resource manager.- Returns:
- the resource manager
-
mergeTypeSystemImports
private TypeSystemDescription mergeTypeSystemImports(TypeSystemDescription tsd) throws ResourceInitializationException Merge type system imports.- Parameters:
tsd- the tsd- Returns:
- the type system description
- Throws:
ResourceInitializationException- the resource initialization exception
-
setDifference
List<FeatureDescription> setDifference(FeatureDescription[] newFeatures, FeatureDescription[] alreadyDefinedFeatures) Sets the difference.- Parameters:
newFeatures- the new featuresalreadyDefinedFeatures- the already defined features- Returns:
- the list
-
isSameFeatureDescription
Checks if is same feature description.- Parameters:
f1- the f 1f2- the f 2- Returns:
- true, if is same feature description
-
getCheckSuffix
Gets the check suffix.- Parameters:
get_set- the get setrange- the range- Returns:
- the check suffix
-
isRangeTypeGeneric
-
isElementTypeGeneric
-