globus-build-service 使用手册

柴彬
2023-12-01
The globus-build-service script will help you build a GT4 service without having to write your own Ant file. The following documentation still has to be extended to make it less like a reference guide and more like a user guide.

Parameters

The parameters accepted by the script are listed in the table below (the BASH and Python script accept the same parameters). $BUILD_DIR denotes the directory from which the script is run. Also, you can see the list of parameters from the command line by running globus-build-service with the -h parameter

./globus-build-service.sh -h



 ParameterType
Description
-d, --dir SERVICE_DIR Required

SERVICE_DIR  is the directory that contains all our implementation and deployment files. The following directory structure is required (pay special attention at the names of the files and directories):

  • SERVICE_DIR/deploy-server.wsdd (Deployment file, required)

  • SERVICE_DIR/deploy-jndi-config.wsdd (JNDI deployment file, required)

  • SERVICE_DIR/impl/*.java (Java implementation files, required)

  • SERVICE_DIR/etc/*.xml (configuration files, optional)

  • SERVICE_DIR/lib/*.jar (JAR files to be included in the GAR file, and/or necessary to compile the service)

SERVICE_DIR must be relative to $BUILD_DIR.

-s, --schema SCHEMA_FILE Required

SCHEMA_FILE is the WSDL file with the service's interface description. It is generally a good idea to keep the WSDL file in a directory separate from

SCHEMA_FILE must be relative to $BUILD_DIR.

-fs, --factory-schema FACTORY_SCHEMA_FILE OptionalIf your service consists of a factory/instance pair of services, this parameter specifies the WSDL file of the factory service.
-t, --target TARGET Optional

Allows us to specify what exactly we want to build:

  • stubs: Generates the stubs files, but doesn't build them.

  • compileStubs: Generates and compiles the stubs files.

  • all: Builds everything and creates a deployable GAR file.

If no -t parameter is specified, then the all target is assumed.

-d, --debug OptionalProvides detailed information of what the build script is doing.

Shorthand notation

The script offers a convenient shorthand way of building services without having to type the service directory and schema file every time. You must have a build.mappings file in the same directory as the build script, with one line for each service using the following format:

SERVICE_ID,SERVICE_DIR,SCHEMA_FILE


SERVICE_ID must be a unique identifier (without whitespace). To use the shorthand notation, you simply have to run the script like this:

./globus-build-service

For example, if we use the following build.mappings file:

first,org/globus/examples/services/core/first,schema/examples/MathService_instance/Math.wsdl

We would run the script like so:

./globus-build-service first

You can optionally specify a target (as described in the table above). However, in the shorthand notation you do not need to use the -t parameter. Simply specify the target as a second parameter. For example:

./globus-build-service first compileStubs

Finally, if you need to include a factory WSDL file, then use the following format:

SERVICE_ID,SERVICE_DIR,SCHEMA_FILE,FACTORY_SCHEMA_FILE

The GAR file

The GAR file is generated in $BUILD_DIR/GAR_ID.gar. The GAR ID is generated from the SERVICE_DIR parameter by replacing the path separators (/ in UNIX, / in Windows) with underscores. For example, if our parameter is:

org/globus/examples/services/core/first   

Then, the GAR file will be generated in:

$BUILD_DIR/org_globus_examples_services_core_first.gar

Take into account that you will need to specify the GAR ID (not the GAR filename) when undeploying GAR files using the globus-undeploy-gar. For example:

globus-undeploy-gar org_globus_examples_services_core_first

The build directory

All the intermediate files generated by the build script are placed in $BUILD_DIR/build. Some times, the build script can produce unexpected results if you've performed a lot of different builds (and the build directory gets filled with the intermediate files of previous builds). Whenever you get an unexpected error, the first thing you should try is to erase the build directory, which will make sure that the build script starts from scratch.

Although there is usually no need to take a look at the contents of the build directory, you might occasionally want to check if the stub files are being generated correctly. The stub source files are generated in:

$BUILD_DIR/build/stubs-GAR_ID/src

The compiled stub files are placed in:

$BUILD_DIR/build/stubs-GAR_ID/classes
 类似资料: