Difference between revisions of "The Development Cycle"

From GCube System
Jump to: navigation, search
(A Tiny Profile)
Line 3: Line 3:
 
== A Tiny Profile ==
 
== A Tiny Profile ==
  
A good starting point with service development is its [[Configuration Management|configuration]]. And a good starting point when configuring a service is the definition of its profile. The role and structure of gCube service profiles is described in detail [[Configuration Management#Profiles, Properties & Descriptors|elsewhere]]. Here we just show one of the smallest and yet perfectly well-formed profile a service may have:
+
A good starting point with service development is its [[Configuration Management|configuration]]. And a good starting point when configuring a service is the definition of its profile. The role and structure of gCube service profiles is described in detail [[Configuration Management#Profiles, JNDIs & Descriptors|elsewhere]]. Here we just show one of the smallest and yet perfectly well-formed profile a service may have:
  
 
<pre>
 
<pre>
Line 44: Line 44:
 
* ''SampleService'' is physically comprised of ''Packages''. A ''Main'' package identifies the main artefact to emerge from the build of the service, a ''GARArchive'', and provides information about the service port-types, including their ''WSDL''s' (here omitted for mercy). The profile unveils our initial plans for a single stateless port-type, which we name by identifying the relative part of the URI at which it will be accessible on the gHN  (more on this soon). Another ''Software'' component identifies the secondary build artefact of the service, its own stubs. If the notion of build artefact is not obvious to you, bide your time for a little longer or [[Building & Deploying |jump ahead]].
 
* ''SampleService'' is physically comprised of ''Packages''. A ''Main'' package identifies the main artefact to emerge from the build of the service, a ''GARArchive'', and provides information about the service port-types, including their ''WSDL''s' (here omitted for mercy). The profile unveils our initial plans for a single stateless port-type, which we name by identifying the relative part of the URI at which it will be accessible on the gHN  (more on this soon). Another ''Software'' component identifies the secondary build artefact of the service, its own stubs. If the notion of build artefact is not obvious to you, bide your time for a little longer or [[Building & Deploying |jump ahead]].
  
Save the profile in a file called ''profile.xml'' and place it in the ''etc'' folder of the service implementation:
+
Save the profile in a file called '''profile.xml''' and place it in the ''etc'' folder of the service implementation:
  
 
<pre>
 
<pre>
Line 58: Line 58:
  
 
== My First JNDI ==
 
== My First JNDI ==
 +
 +
Next we move to the configuration of the code itself, for which we use JNDI technology. Again, the details and granularity of JNDI configuration are discussed [[Configuration Management#Profiles, JNDIs & Descriptors|elsewhere]]. Here we simply notice that, while the JNDI configuration might contain any information which the code needs to consult at runtime, the gCF raises precise requirements against the existence and shape of some of that information. In particular, the configuration should at least contain the following information:
 +
 +
<pre>
 +
<?xml version="1.0" encoding="UTF-8"?>
 +
<jndiConfig xmlns="http://wsrf.globus.org/jndi/config">
 +
 +
<service name="acme/sample">
 +
<environment  name="configDir" value="@config.dir@"  type="java.lang.String" override="false" />
 +
</service>
 +
 +
</jndiConfig>
 +
</pre>
 +
 +
Essentially, the configuration must have a ''service'' section dedicated to information conceptually associated with the entire implementation, rather than more specific components yet to come. Furthermore, the ''service section'' must:
 +
 +
* specify the ''name'' of the service. This is not particularly constrained but must distinguish ''SampleService'' from any other which may be deployed on the same gHN. As we already do with Java and URI namespaces, we can approach uniqueness through a hierarchical structure, here of  ''/''-separated strings. In our case, the name ''acme/sample'' will suffice as a unique identifier.
 +
 +
* include an ''environment'' element which specifies the absolute path to the configuration folder of ''SampleService''. Contrary to expectations, this is not our ''etc'' folder under the service location. It is in fact another configuration folder allocated to ''SampleService'' at the point of service deployment. This will become clearer [[The Development Cycle#Building & Deploying|later]]. For the time being, we use the wildcard ''@config.dir@'' to abstract over the precise location of this yet-to-be folder, and leave to gCore the task of resolving it at the point of deployment.
 +
 +
'''Note:''' The wildcard ''@config.dir'' is surely convenient at this stage. It is in fact necessary for any real gCube service.  This is because the service may be dynamically deployed on any gHN and the absolute path of the configuration folder depends on the file system of that gHN. During service development, that location is an absolute unknown.
 +
 +
So far, there is little in our configuration which is specific to ''SampleService''. Indeed, the JNDI above can be considered as boilerplate for any gCube service. We will see shortly how to inject more information into the JNDI configuration, but until that moment this minimal configuration will suffice.
 +
 +
Save the configuration in a file called '''deploy-jndi-config.xml''' and place it in the ''etc'' folder of the service implementation:
 +
 +
<pre>
 +
|-SampleService
 +
|--etc
 +
|---profile.xml
 +
|---deploy-jndi-config.xml
 +
|--src
 +
|--schema
 +
|
 +
|-Dependencies
 +
|--SampleService
 +
</pre>
 +
 +
 
== A PortType Interface ==
 
== A PortType Interface ==
 
== Moving to the Implementation ==
 
== Moving to the Implementation ==

Revision as of 15:12, 11 April 2008

Let us go through a quick tour of development with SampleService.

A Tiny Profile

A good starting point with service development is its configuration. And a good starting point when configuring a service is the definition of its profile. The role and structure of gCube service profiles is described in detail elsewhere. Here we just show one of the smallest and yet perfectly well-formed profile a service may have:

<?xml version="1.0" encoding="UTF-8"?>
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<ID></ID>
	<Type>Service</Type>
	<Profile>
		<Description>A very simple gCube Service</Description>
		<Class>Samples</Class>
		<Name>SampleService</Name>
		<Version>1.0</Version>
		<Packages>
			<Main>
				<Name>Main</Name>
				<Version>1.0</Version>
				<GARArchive>org.acme.sample.gar</GARArchive>
				<PortType>
					<Name>acme/sample/stateless</Name>
					<WSDL>...</WSDL>
				</PortType>
			</Main>
			<Software>
				<Description>Describes port-type stubs</Description>
				<Name>Stubs</Name>
				<Version>1.0</Version>
				<Files><File>org.acme.sample.stubs.jar</File></Files>
			</Software>
		</Packages>
	</Profile>
</Resource>

By necessity, this profile reveals things yet to come. For the time being, be happy with a conceptual summary:

  • SampleService is a a particular type of gCube Resource, one of type Service. Like all gCube Resources has an ID, which it receives when it is formally registered with the infrastructure. Until then, SampleService does not have a proper identifier. No worries though, a temporary one will be generated by gCF at runtime.
  • The profile of SampleService specifies its Name and specifies its membership to a Class of functionally related gCube services. Classes are not pre-defined, and here we settle on Samples. A free-form Description and a Version complement the preliminary description of SampleService.
  • SampleService is physically comprised of Packages. A Main package identifies the main artefact to emerge from the build of the service, a GARArchive, and provides information about the service port-types, including their WSDLs' (here omitted for mercy). The profile unveils our initial plans for a single stateless port-type, which we name by identifying the relative part of the URI at which it will be accessible on the gHN (more on this soon). Another Software component identifies the secondary build artefact of the service, its own stubs. If the notion of build artefact is not obvious to you, bide your time for a little longer or jump ahead.

Save the profile in a file called profile.xml and place it in the etc folder of the service implementation:

|-SampleService
|--etc
|---profile.xml
|--src
|--schema
|
|-Dependencies
|--SampleService

My First JNDI

Next we move to the configuration of the code itself, for which we use JNDI technology. Again, the details and granularity of JNDI configuration are discussed elsewhere. Here we simply notice that, while the JNDI configuration might contain any information which the code needs to consult at runtime, the gCF raises precise requirements against the existence and shape of some of that information. In particular, the configuration should at least contain the following information:

<?xml version="1.0" encoding="UTF-8"?>
<jndiConfig xmlns="http://wsrf.globus.org/jndi/config">

	<service name="acme/sample">
		<environment  name="configDir" value="@config.dir@"  type="java.lang.String" override="false" />
	</service>

</jndiConfig>

Essentially, the configuration must have a service section dedicated to information conceptually associated with the entire implementation, rather than more specific components yet to come. Furthermore, the service section must:

  • specify the name of the service. This is not particularly constrained but must distinguish SampleService from any other which may be deployed on the same gHN. As we already do with Java and URI namespaces, we can approach uniqueness through a hierarchical structure, here of /-separated strings. In our case, the name acme/sample will suffice as a unique identifier.
  • include an environment element which specifies the absolute path to the configuration folder of SampleService. Contrary to expectations, this is not our etc folder under the service location. It is in fact another configuration folder allocated to SampleService at the point of service deployment. This will become clearer later. For the time being, we use the wildcard @config.dir@ to abstract over the precise location of this yet-to-be folder, and leave to gCore the task of resolving it at the point of deployment.

Note: The wildcard @config.dir is surely convenient at this stage. It is in fact necessary for any real gCube service. This is because the service may be dynamically deployed on any gHN and the absolute path of the configuration folder depends on the file system of that gHN. During service development, that location is an absolute unknown.

So far, there is little in our configuration which is specific to SampleService. Indeed, the JNDI above can be considered as boilerplate for any gCube service. We will see shortly how to inject more information into the JNDI configuration, but until that moment this minimal configuration will suffice.

Save the configuration in a file called deploy-jndi-config.xml and place it in the etc folder of the service implementation:

|-SampleService
|--etc
|---profile.xml
|---deploy-jndi-config.xml
|--src
|--schema
|
|-Dependencies
|--SampleService


A PortType Interface

Moving to the Implementation

Building & Deploying

Logging it

A Test Client