How To Create Data Service Styles
Creating a data service style is a straightforward process, similar to writing an extension to the Introduce toolkit. New styles may be created by building up a few components and placing them in the appropriate subdirectories of the Introduce toolkit (as described here).
Components
The caGrid Data Service styles infrastructure requires style implementations to conform to a specific format, and requires that the classes which compose the style's implementation inherit from certain classes.
Style Description Document
A single XML document describes the style to the data services infrastructure. This document must be named style.xml, and placed in a unique directory under the <introduce>/extensions/data/styles directory. This style description document must conform to the schema provided with the data services infrastructure with the namespace http://gov.nih.nci.cagrid.data/Style
, which can be found at the end of this guide.
The following is an example of the style description document:
<DataServiceStyle xmlns="http://gov.nih.nci.cagrid.data/Style" name="caCORE SDK v 3.2(.1)" version="1.1"> <CompatibleCaGridVersions> <Version>1.1</Version> </CompatibleCaGridVersions> <StyleDescription>Configures the data service to utilize a data source generated by the caCORE SDK, versions 3.2 and 3.2.1</StyleDescription> <CreationWizardPanels> <CreationWizardPanel classname="gov.nih.nci.cagrid.data.style.cacore32.wizard.SDK32InitializationPanel"/> <CreationWizardPanel classname="gov.nih.nci.cagrid.data.style.cacore32.wizard.SDKClientSelectionPanel"/> <CreationWizardPanel classname="gov.nih.nci.cagrid.data.style.cacore32.wizard.AppserviceConfigPanel"/> <CreationWizardPanel classname="gov.nih.nci.cagrid.data.style.sdkstyle.wizard.DomainModelPanel"/> <CreationWizardPanel classname="gov.nih.nci.cagrid.data.style.sdkstyle.wizard.SchemaTypesPanel"/> </CreationWizardPanls> <CodegenHelpers postCodegenClassname="gov.nih.nci.cagrid.data.style.sdkstyle.helpers.PostCodegenHelper"/> <ModificationUiPanel classname="gov.nih.nci.cagrid.data.style.cacore32.modification.CaCoreVersionPanel"/> </DataServiceStyle>
Each part of this document influences the behavior or appearance of the style as the data service infrastructure executes it.
Name and Version
The root element of the style document attributes which define the name of this style, along with the version of the style. The name is displayed to the service developer at service creation time, allowing selection of a style. The name and version uniquely identify a style to the data service extension framework at runtime.
Compatible Versions
The style document allows for defining which versions of the caGrid Introduce toolkit and data service extension the style is compatible with. The document may define multiple <Version> elements indicating compatibility with multiple versions.
Style Description
The document allows for a brief description of the style to accompany the style itself. This information is displayed at data service creation time when the user is given a chance to select a style to use with their data service.
Creation Wizard Panels
This optional element defines a sequence of panels which will be loaded as part of the pre code generation process of creating a new caGrid Data Service. The panels are displayed in the order in which they are defined here, and can be used to configure aspects of the service style, or customize the underlying data service extension.
Each wizard panel's Java class must extend from the base class gov.nih.nci.cagrid.data.ui.wizard.AbstractWizardPanel. This class is essentially a JPanel with accessor methods for the Introduce service model and the data service extension data. The class also provides access to wizard functionality, such as enabling and disabling navigation buttons, and indicating that the wizard has been completed. Additionally, the base class has three abstract methods which must be implemented:
- update()
- This method is called by the wizard when the panel is to be displayed. This provides a callback to update the UI and reflect changes to the model which may impact the appearance of the wizard panel.
- movingNext()
- This method is new for caGrid 1.2
- This method is called by the wizard itself when the user clicks the 'next' or 'finish' button to move to the next wizard panel or finish the wizard. This method gives the panel a chance to synchronize its state with that of the service model (ie. copying schemas and libraries, storing service properties).
- getPanelTitle() -> String
- This method should return the title you wish to be displayed by the wizard when the panel is visible on the screen.
- getPanelShortName() -> String
- This method should return a very short name to be displayed in the navigation buttons of the wizard. It should generally be one or two words long.
Creation Process Helpers
The data service creation process can be extended by the service style. The post-creation process helper is defined by the CreationHelper element. This element has an attribute called postCreationClassname, which defines the class name of the post-creation processor class. This class must implement the interface gov.nih.nci.cagrid.data.style.StyleCreationPostProcessor.
Code Generation Process Helpers
The data service code generation process can be extended by the service style. The pre code generation process, defined by the preCodegenClassname attribute, is executed after the data service pre code generation options have been completed, but before any other extensions have run. The post code generation process, defined by the postCodegenClassname is executed similarly.
The pre-codegen class must implement the interface gov.nih.nci.cagrid.data.style.StyleCodegenPreProcessor, and the post-codegen class must implement the interface gov.nih.nci.cagrid.data.style.StyleCodegenPostProcessor.
Service Modification Panel
The style can optionally include a panel to be loaded into the data service modification UI. This panel can provide information on configuration options specific to the style (as in the case of the caCORE SDK styles), manage configuration, or present any other information the style developer may choose.
This class must extend from the base class gov.nih.nci.cagrid.data.ui.DataServiceModificationSubPanel. This class is essentially a JPanel with additional methods for accessing the underlying Introduce service model and the data service specific extension data.
Style Library Directory
Each style must provide any jar files it depends on for Java classes and resources in a directory named lib within the style directory itself. At runtime, classes referenced from the style document are loaded from the jars provided here. The classes contained in these jars may safely depend on other caGrid and Globus libraries, as the runtime classpath of the Introduce toolkit is appended to the library directory's contents.
Schema
http://gov.nih.nci.cagrid.data/Style![]()
The style description document.
<xsd:schema xmlns:tns="http://gov.nih.nci.cagrid.data/Style" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://gov.nih.nci.cagrid.data/Style" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:element name="DataServiceStyle" type="tns:DataServiceStyle"/> <xsd:complexType name="DataServiceStyle"> <xsd:sequence> <xsd:element ref="tns:CompatibleCaGridVersions"/> <xsd:element name="StyleDescription" type="xsd:string" minOccurs="0"/> <xsd:element name="CreationWizardPanels" minOccurs="0"> <xsd:complexType> <xsd:sequence> <xsd:element ref="tns:CreationWizardPanel" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element ref="tns:ModificationUiPanel" minOccurs="0"/> <xsd:element ref="tns:CodegenHelpers" minOccurs="0"/> <xsd:element ref="tns:CreationHelper" minOccurs="0"/> <xsd:element ref="tns:VersionUpgrade" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required"/> <xsd:attribute name="version" type="xsd:string" use="required"/> </xsd:complexType> <xsd:element name="CompatibleCaGridVersions" type="tns:CompatibleCaGridVersions"/> <xsd:complexType name="CompatibleCaGridVersions"> <xsd:sequence> <xsd:element name="Version" maxOccurs="unbounded"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="xsd:string"/> </xsd:simpleContent> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> <xsd:element name="CreationWizardPanel" type="tns:CreationWizardPanel"/> <xsd:complexType name="CreationWizardPanel"> <xsd:annotation> <xsd:documentation>Must extend from gov.nih.nci.cagrid.data.ui.wizard.AbstractWizardPanel</xsd:documentation> </xsd:annotation> <xsd:attribute name="classname" type="xsd:string" use="required"/> </xsd:complexType> <xsd:element name="ModificationUiPanel" type="tns:ModificationUiPanel"/> <xsd:complexType name="ModificationUiPanel"> <xsd:annotation> <xsd:documentation>Must extend from gov.nih.nci.cagrid.data.ui.DataServiceModificationSubPanel</xsd:documentation> </xsd:annotation> <xsd:attribute name="classname" type="xsd:string" use="required"/> </xsd:complexType> <xsd:element name="VersionUpgrade" type="tns:VersionUpgrade"/> <xsd:complexType name="VersionUpgrade"> <xsd:attribute name="fromVersion" type="xsd:string" use="required"/> <xsd:attribute name="toVersion" type="xsd:string" use="required"/> <xsd:attribute name="classname" type="xsd:string" use="required"/> </xsd:complexType> <xsd:element name="CodegenHelpers" type="tns:CodegenHelpers"/> <xsd:complexType name="CodegenHelpers"> <xsd:annotation> <xsd:documentation>Pre codegen must implement Must implement interface gov.nih.nci.cagrid.data.style.StyleCodegenPreProcessor, post codegen must implement Must implement interface gov.nih.nci.cagrid.data.style.StyleCodegenPostProcessor</xsd:documentation> </xsd:annotation> <xsd:attribute name="preCodegenClassname" type="xsd:string" use="optional"/> <xsd:attribute name="postCodegenClassname" type="xsd:string" use="optional"/> </xsd:complexType> <xsd:element name="CreationHelper" type="tns:CreationHelper"/> <xsd:complexType name="CreationHelper"> <xsd:annotation> <xsd:documentation>Must implement interface gov.nih.nci.cagrid.data.style.StyleCreationPostProcessor</xsd:documentation> </xsd:annotation> <xsd:attribute name="postCreationClassname" type="xsd:string" use="required"/> </xsd:complexType> </xsd:schema>





