|
![]() Quark Platform Documentation Version 1.7.0_0 Business Objects |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openquark.cal.services.BasicCALServices
public final class BasicCALServices
This is a helper class to assist CAL clients with creating and using some of the basic CAL services. It handles initialization and compilation of a workspace, provision of some basic CAL service objects, and contains some helper methods for filtering gems and running code.
| Nested Class Summary | |
|---|---|
static class |
BasicCALServices.Config
This class is used to encapsulate BasicCALServices configuration properties. |
| Method Summary | |
|---|---|
CompilerMessage.Severity |
addNewModule(ModuleSourceDefinition sourceDefinition,
CompilerMessageLogger logger)
Compile the source definition for a module and add it to the program |
EntryPointSpec |
addNewModuleWithFunction(ModuleName newModuleName,
SourceModel.FunctionDefn functionDefintion)
Add a new module containing the specified function to the program. |
EntryPointSpec |
addNewModuleWithFunction(ModuleName newModuleName,
SourceModel.Import[] imports,
SourceModel.FunctionDefn functionDefinition,
SourceModel.FunctionTypeDeclaration functionTypeDeclaration)
Add a new module containing the specified function, type declaration and imports to the program. |
boolean |
compileWorkspace(StatusListener programStatusListener,
CompilerMessageLogger logger)
Compile the workspace. |
Set<GemEntity> |
findGemsByReturnType(ModuleName scopeModule,
String returnTypeName,
boolean sortGems)
Returns a set containing the public gems in the workspace which have the specified return type. |
Set<GemEntity> |
findGemsOfType(ModuleName scopeModule,
String typeName,
boolean sortGems)
Returns a Set containing the public gems in the workspace which have the specified type signature. |
CALWorkspace |
getCALWorkspace()
|
ProgramModelManager.CompilationOptions |
getCompilationOptions()
Get compiler options |
Compiler |
getCompiler()
|
GemEntity |
getGemEntity(QualifiedName gemName)
Returns the entity corresponding to the specified qualified name. |
Set<GemEntity> |
getMatchingGems(GemFilter filter)
Returns public gems in the workspace that match the given filter |
Set<GemEntity> |
getMatchingGems(GemFilter filter,
boolean sortGems)
Returns public gems in the workspace that match the given filter. |
ModuleTypeInfo |
getModuleTypeInfo(ModuleName moduleName)
Get the type info for a module |
PreludeTypeConstants |
getPreludeTypeConstants()
Note: must have a compiled workspace in hand before these will be available. |
TypeChecker |
getTypeChecker()
|
TypeChecker.TypeCheckInfo |
getTypeCheckInfo(ModuleName moduleName)
Get the type checker info for a module |
TypeExpr |
getTypeFromQualifiedName(QualifiedName name)
This returns a type expression for the type represented by the qualified name the type expression is evaluated within the scope of the type's defining module |
TypeExpr |
getTypeFromString(ModuleName module,
String typeString)
Returns the type expression corresponding to the specified string. |
WorkspaceManager |
getWorkspaceManager()
|
static BasicCALServices |
make(String workspaceFileName)
The simplest factory method to create a BasicCALServices instance. |
static BasicCALServices |
make(String workspaceFileProperty,
String defaultWorkspaceFileName,
String defaultWorkspaceClientID)
Factory method for this class. |
static BasicCALServices |
make(String workspaceFileProperty,
String defaultWorkspaceFileName,
String defaultWorkspaceClientID,
BasicCALServices.Config config)
Factory method for this class. |
static BasicCALServices |
makeCompiled(String workspaceFileName,
CompilerMessageLogger messageLogger)
The simplest factory method to create a BasicCALServices instance. |
static BasicCALServices.Config |
makeConfig()
makes a new BasicCALServices configuarion with default properties |
void |
prepareFunctions(List<EntryPointSpec> entryPointSpecs)
This method pre-caches a list of entryPointSpecs for invocation with runFunction. |
boolean |
recompileWorkspace(CompilerMessageLogger logger)
Recompile the workspace. |
Object |
runFunction(EntryPointSpec entryPointSpec,
ExecutionContext executionContext,
Object[] args)
runs an existing function and returns the result. |
Object |
runFunction(EntryPointSpec entryPointSpec,
Object[] args)
Runs an existing CAL function and returns the result. |
void |
setCompilationOptions(ProgramModelManager.CompilationOptions options)
set the compilation options - if they are not set default compilation options will be used |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static BasicCALServices make(String workspaceFileName)
workspaceFileName - name of the workspace from the StandardVault e.g. "cal.platform.test.cws"
public static BasicCALServices makeCompiled(String workspaceFileName,
CompilerMessageLogger messageLogger)
workspaceFileName - messageLogger - all messages created during the compilation of the workspace are appended to the messageLogger
public static BasicCALServices make(String workspaceFileProperty,
String defaultWorkspaceFileName,
String defaultWorkspaceClientID)
workspaceFileProperty - If non-null, the value of this system property represents the file system pathname of the workspace file
to be used to instantiate the workspace.
If null, defaultWorkspaceFileName will be used.defaultWorkspaceFileName - This workspace file from the StandardVault will be used if the workspaceFileProperty
system property is not set.defaultWorkspaceClientID - a string identifying the default client for this workspace.
Client id's are used to refer to specific workspaces. This id will be used, unless the property
indicated by CALWorkspace.WORKSPACE_PROP_CLIENT_ID is set, in which case the property value will be used.
If the client id is null, the workspace is nullary.
public static BasicCALServices make(String workspaceFileProperty,
String defaultWorkspaceFileName,
String defaultWorkspaceClientID,
BasicCALServices.Config config)
workspaceFileProperty - If non-null, the value of this system property represents the file system pathname of the workspace file
to be used to instantiate the workspace.
If null, defaultWorkspaceFileName will be used.defaultWorkspaceFileName - This workspace file from the StandardVault will be used if the workspaceFileProperty
system property is not set.defaultWorkspaceClientID - a string identifying the default client for this workspace.
Client id's are used to refer to specific workspaces. This id will be used, unless the property
indicated by CALWorkspace.WORKSPACE_PROP_CLIENT_ID is set, in which case the property value will be used.
If the client id is null, the workspace is nullary.config - this parameter controls the configuration of the BasicCALServices that is created
public static BasicCALServices.Config makeConfig()
public WorkspaceManager getWorkspaceManager()
public PreludeTypeConstants getPreludeTypeConstants()
public boolean compileWorkspace(StatusListener programStatusListener,
CompilerMessageLogger logger)
programStatusListener - if non-null, the listener on the status of the compilation.logger - the logger used to log error messages during compilation.
public boolean recompileWorkspace(CompilerMessageLogger logger)
public CALWorkspace getCALWorkspace()
public Compiler getCompiler()
public TypeChecker getTypeChecker()
public ModuleTypeInfo getModuleTypeInfo(ModuleName moduleName)
moduleName - the name of the module
public TypeChecker.TypeCheckInfo getTypeCheckInfo(ModuleName moduleName)
public GemEntity getGemEntity(QualifiedName gemName)
gemName - the name of the entity to retrieve.
public TypeExpr getTypeFromQualifiedName(QualifiedName name)
name - the types qualified name
public TypeExpr getTypeFromString(ModuleName module,
String typeString)
module - the type string is compiled w.r.t to this moduletypeString - a string representation a CAL type.
public Set<GemEntity> getMatchingGems(GemFilter filter)
filter - a gem filter.
public Set<GemEntity> getMatchingGems(GemFilter filter,
boolean sortGems)
filter - a gem filter.sortGems - If true, then the gems will be sorted alphabetically.
public Set<GemEntity> findGemsOfType(ModuleName scopeModule,
String typeName,
boolean sortGems)
scopeModule - this is the module that is used for scopetypeName - the type signature of the gems to be foundsortGems - If true, then the gems will be sorted alphabetically.
public Set<GemEntity> findGemsByReturnType(ModuleName scopeModule,
String returnTypeName,
boolean sortGems)
scopeModule - this is the module that is used for compiling the typereturnTypeName - the type name of the return type for the gems to be foundsortGems - If true, then the gems will be sorted alphabetically.
public CompilerMessage.Severity addNewModule(ModuleSourceDefinition sourceDefinition,
CompilerMessageLogger logger)
sourceDefinition - the module's source definition.logger - the logger used to log error messages during compilation.
public EntryPointSpec addNewModuleWithFunction(ModuleName newModuleName,
SourceModel.FunctionDefn functionDefintion)
throws GemCompilationException
newModuleName - functionDefintion -
GemCompilationException
public EntryPointSpec addNewModuleWithFunction(ModuleName newModuleName,
SourceModel.Import[] imports,
SourceModel.FunctionDefn functionDefinition,
SourceModel.FunctionTypeDeclaration functionTypeDeclaration)
throws GemCompilationException
newModuleName - imports - - if this is null the imports are computed based on the function definitionfunctionDefinition - functionTypeDeclaration - the type declaration for the function, this may be null
GemCompilationException
public Object runFunction(EntryPointSpec entryPointSpec,
Object[] args)
throws CALExecutorException,
GemCompilationException
entryPointSpec - defines the function to run and the input and output policies to use.args - the arguments to pass to the function - may be null if there are no arguments
CALExecutorException
GemCompilationExceptionrunFunction(EntryPointSpec, ExecutionContext, Object[])
public Object runFunction(EntryPointSpec entryPointSpec,
ExecutionContext executionContext,
Object[] args)
throws CALExecutorException,
GemCompilationException
entryPointSpec - defines the function to run and the input and output policies to use.args - the arguments to pass to the function - may be null if there are no arguments.
CALExecutorException
GemCompilationException
public void prepareFunctions(List<EntryPointSpec> entryPointSpecs)
throws GemCompilationException
entryPointSpecs - a list of entry point specs that will be used later by runFunction.
GemCompilationExceptionpublic ProgramModelManager.CompilationOptions getCompilationOptions()
public void setCompilationOptions(ProgramModelManager.CompilationOptions options)
options - the compilation options to use when running code.
|
![]() Quark Platform Documentation Version 1.7.0_0 Business Objects |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||