com.bowstreet.builders.webapp.methods
Class SqlBuilderComm

java.lang.Object
  extended by com.bowstreet.builders.webapp.methods.SqlBuilderComm

public class SqlBuilderComm
extends java.lang.Object

Implementation of methods used by the Sql builders to communicate amongst themselves during design-time, regen, and runtime. Any non-Sql builders that need to interract with the Sql builders at regen or runtime should use the methods and constants defined here.

Version:
1.0 6/19/03
Author:
David Gawron

Nested Class Summary
static class SqlBuilderComm.Constants
          Class defining all of the constants used in Sql builder communication.
 
Field Summary
static com.bowstreet.builders.webapp.methods.SqlBuilderComm.SqlVariableLocator cachingTransformLocator
          Class used to locate webApp variables that are defined to contain cachable Sql Transform helpers at runtime.
static com.bowstreet.builders.webapp.methods.SqlBuilderComm.SqlVariableLocator dataSourceLocator
          Class used to locate webApp variables that are defined to contain Sql DataSource helpers at runtime.
static com.bowstreet.builders.webapp.methods.SqlBuilderComm.SqlVariableLocator statementLocator
          Class used to locate webApp variables that are defined to contain Sql Statement helpers at runtime.
static com.bowstreet.builders.webapp.methods.SqlBuilderComm.SqlVariableLocator transactionLocator
          Class used to locate webApp variables that are defined to contain Sql Transaction helpers at runtime.
static com.bowstreet.builders.webapp.methods.SqlBuilderComm.SqlVariableLocator transformLocator
          Class used to locate webApp variables that are defined to contain Sql Transform helpers at runtime.
 
Constructor Summary
SqlBuilderComm()
           
 
Method Summary
static boolean artifactIsShared(WebAppObject artifact)
          Determine if a webApp artifact is shared by more than one Sql builder.
static IXml export(IXml xmlToUpdate, java.lang.String path, java.util.List children)
          This method updates an XML structure with a list of new values for some arbitrary path.
static IXml export(IXml xmlToUpdate, java.lang.String path, java.lang.Object value)
          This method updates an XML structure with a new value for some arbitrary path.
static IXml export(WebApp webApp, java.lang.String builderName, BuilderInputs builderInputs)
          This method takes a set of builder inputs and exports them to the webApp so they can be referenced by other (possibly higher-level) builders during regen and runtime.
static java.util.List getDataSourceVariableNames(WebApp webApp)
          Get the names of all webApp variables that are defined to contain a Sql DataSource helper class at runtime.
static IXml getExportedInput(WebApp webApp, java.lang.String builderName, java.lang.String xPath)
          Method used to retrieve an XML element from some builder's exported inputs.
static java.lang.String getExportedInputText(WebApp webApp, java.lang.String builderName, java.lang.String xPath)
          Method used to retrieve a string from some builder's exported inputs.
static java.util.List getStatementVariableNames(WebApp webApp)
          List the names of all webApp variables that are defined to contain a Sql Statement helper class at runtime.
static java.util.List getTransactionVariableNames(WebApp webApp)
          List the names of all webApp variables that are defined to contain a Sql Transform helper class (regular or caching) at runtime.
static java.util.List getTransformMethodNames(WebApp webApp)
          Get the names of all webApp methods that qualify to be used as a custom transform selection for transaction steps defined in the Sql Transaction builders.
static java.util.List getTransformVariableNames(WebApp webApp)
          List the names of all webApp variables that are defined to contain a Sql Transform helper class (regular or caching) at runtime.
static java.util.List getXmlResultVariableNames(WebApp webApp)
          Get the names of all webApp variables that are defined to contain XML data transformed from JDBC ResultSets.
static boolean isCachableTransformHelperVariable(Variable variable)
          Check a webApp variable to see if it has been defined as containing a caching Sql Transform helper LJO at runtime.
static boolean isDataSourceHelperVariable(Variable variable)
          Check a webApp variable to see if it has been defined as containing a Sql DataSource helper LJO at runtime.
static boolean isStatementHelperVariable(Variable variable)
          Check a webApp variable to see if it has been defined as containing a Sql Statement helper LJO at runtime.
static boolean isTransactionHelperVariable(Variable variable)
          Check a webApp variable to see if it has been defined as containing a Sql Transaction helper LJO at runtime.
static boolean isTransformHelperVariable(Variable variable)
          Check a webApp variable to see if it has been defined as containing a Sql Transform helper LJO at runtime.
static boolean isTransformMethod(Method method)
          Method to verify that a webApp method has the proper signature to be a custom transform for a Sql Transaction step.
static void markAsDependent(java.lang.String builderName, WebAppObject artifact)
          Register the Sql builder as being dependent upon the given webApp artifact.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cachingTransformLocator

public static final com.bowstreet.builders.webapp.methods.SqlBuilderComm.SqlVariableLocator cachingTransformLocator
Class used to locate webApp variables that are defined to contain cachable Sql Transform helpers at runtime.


dataSourceLocator

public static final com.bowstreet.builders.webapp.methods.SqlBuilderComm.SqlVariableLocator dataSourceLocator
Class used to locate webApp variables that are defined to contain Sql DataSource helpers at runtime.


statementLocator

public static final com.bowstreet.builders.webapp.methods.SqlBuilderComm.SqlVariableLocator statementLocator
Class used to locate webApp variables that are defined to contain Sql Statement helpers at runtime.


transactionLocator

public static final com.bowstreet.builders.webapp.methods.SqlBuilderComm.SqlVariableLocator transactionLocator
Class used to locate webApp variables that are defined to contain Sql Transaction helpers at runtime.


transformLocator

public static final com.bowstreet.builders.webapp.methods.SqlBuilderComm.SqlVariableLocator transformLocator
Class used to locate webApp variables that are defined to contain Sql Transform helpers at runtime.

Constructor Detail

SqlBuilderComm

public SqlBuilderComm()
Method Detail

artifactIsShared

public static boolean artifactIsShared(WebAppObject artifact)
Determine if a webApp artifact is shared by more than one Sql builder. Note that only a few webApp artifacts are currently marked as being shared. Thus , this method is only meaningful to the Sql builders and their support code.

Parameters:
artifact - The webApp artifact to be inspected.
Returns:
Returns true if the artifact is shared by 2 or more Sql builders. Returns false otherwise and when artifact is null.

export

public static IXml export(IXml xmlToUpdate,
                          java.lang.String path,
                          java.util.List children)
This method updates an XML structure with a list of new values for some arbitrary path. If the path ideitifies to an existing element, then the old content of that element will be replaced by the new content. Otherwise the path is added to the XML structure and it's content is set to the values of the children. Note: the path is relaitve to the top-level element of xmlToUpdate.

Parameters:
xmlToUpdate - The XML structure to be updated.
path - The path that identifies the element to be added/updated.
children - The content to be assigned to the identified element.
Returns:
Returns the updated XML structure. Note: the structure will not be updated if xmlToUpdate or path is null. If children is null or empty and the path is found, then all the content of the identified element will be removed. Children values that are null will be omitted.

export

public static IXml export(IXml xmlToUpdate,
                          java.lang.String path,
                          java.lang.Object value)
This method updates an XML structure with a new value for some arbitrary path. If the path ideitifies to an existing element, then the old content of that element will be replaced by the new value. Otherwise the path is added to the XML structure and it's content is set to the value. Note: the path is relative to the top-level element of xmlToUpdate.

Parameters:
xmlToUpdate - The XML structure to be updated.
path - The path that identifies the element to be added/updated.
value - The content to be assigned to the identified element.
Returns:
Returns the updated XML structure. Note: the structure will not be updated if xmlToUpdate or path is null. If value is null and the path is found, then all the content of the identified element will be removed.

export

public static IXml export(WebApp webApp,
                          java.lang.String builderName,
                          BuilderInputs builderInputs)
This method takes a set of builder inputs and exports them to the webApp so they can be referenced by other (possibly higher-level) builders during regen and runtime.

Parameters:
webApp - The webApp into which the builder inputs will be exported.
builderName - The name of the builder whose inputs are being exported.
builderInputs - The builder inputs to be exported.
Returns:
An XML structure containing the builder inputs exported. null will be returned if webApp or builderName are null. If builderInputs is null, then a skeletal XML structure is retured; this skeleton can be used as a wrapper for manually exporting a subset of a builder's inputs. Note: a copy of this structure should be made before the XML is modified unless you want the modifications to be visible to others.

getDataSourceVariableNames

public static java.util.List getDataSourceVariableNames(WebApp webApp)
Get the names of all webApp variables that are defined to contain a Sql DataSource helper class at runtime. Note: there is no guarantee that the listed variables will actually contain that type of helper LJO at runtime.

Parameters:
webApp - The webApp in which to seach for DataSource helpers.
Returns:
A list of webApp variables names. The list may be empty, but it will never be null. If webApp is null, then an empty list is returned.

getExportedInput

public static IXml getExportedInput(WebApp webApp,
                                    java.lang.String builderName,
                                    java.lang.String xPath)
Method used to retrieve an XML element from some builder's exported inputs. Typically the xPath parameter will be the name of some builder input that was exported by the builder at regen. Most of these names are defined in the builder API classes. For example, SqlTransformToXml.BuilderStaticValues.XmlVariableName defines the builder input used to identify the webApp variable that will contain XML transformed from a JDBC ResultSet.

Parameters:
webApp - The webApp into which the builder inputs were exported.
builderName - The name of the builder whose inputs were exported.
xPath - The XPath that identifies the element to be returned.
Returns:
Returns the exported input XML element identified by the given XPath. If xPath is null, then the whole XML structure of the exported builder inputs is returned. If either webApp or builderName is null, then null is returned. Note: a copy of the returned XML structure should be made before the XML is modified unless you want the modifications to be visible to others.
See Also:
getExportedInputText( WebApp, String, String ), export( WebApp, String, BuilderInputs )

getExportedInputText

public static java.lang.String getExportedInputText(WebApp webApp,
                                                    java.lang.String builderName,
                                                    java.lang.String xPath)
Method used to retrieve a string from some builder's exported inputs. Typically the xPath parameter will be the name of some string-values builder input that was exported by the builder at regen. Most of these names are defined in the builder API classes. For example, SqlTransformToXml.BuilderStaticValues.XmlVariableName defines the builder input used to identify the webApp variable that will contain XML transformed from a JDBC ResultSet.

Parameters:
webApp - The webApp into which the builder inputs were exported.
builderName - The name of the builder whose inputs were exported.
xPath - The XPath that identifies the element whose text is to be returned.
Returns:
Returns the exported string input identified by the given XPath. If xPath is null, then null is returned. If webApp, builderName, or xPath is null, then null is returned.
See Also:
getExportedInput( WebApp, String, String ), export( WebApp, String, BuilderInputs )

getStatementVariableNames

public static java.util.List getStatementVariableNames(WebApp webApp)
List the names of all webApp variables that are defined to contain a Sql Statement helper class at runtime. Note: there is no guarantee that the listed variables will actually contain that type of helper LJO at runtime.

Parameters:
webApp - The webApp in which to seach for Statement helpers.
Returns:
A list of webApp variables names. The list may be empty, but it will never be null. If webApp is null, then an empty list is returned.

getTransactionVariableNames

public static java.util.List getTransactionVariableNames(WebApp webApp)
List the names of all webApp variables that are defined to contain a Sql Transform helper class (regular or caching) at runtime. Note: there is no guarantee that the listed variables will actually contain that type of helper LJO at runtime.

Parameters:
webApp - The webApp in which to seach for Transform helpers.
Returns:
A list of webApp variables names. The list may be empty, but it will never be null. If webApp is null, then an empty list is returned.

getTransformMethodNames

public static java.util.List getTransformMethodNames(WebApp webApp)
Get the names of all webApp methods that qualify to be used as a custom transform selection for transaction steps defined in the Sql Transaction builders.

Parameters:
webApp - The webApp in which to seach for transform methods.
Returns:
A list of webApp method names. The list may be empty, but it will never be null. If webApp is null, then an empty list is returned.

getTransformVariableNames

public static java.util.List getTransformVariableNames(WebApp webApp)
List the names of all webApp variables that are defined to contain a Sql Transform helper class (regular or caching) at runtime. Note: there is no guarantee that the listed variables will actually contain that type of helper LJO at runtime.

Parameters:
webApp - The webApp in which to seach for Transform helpers.
Returns:
A list of webApp variables names. The list may be empty, but it will never be null. If webApp is null, then an empty list is returned.

getXmlResultVariableNames

public static java.util.List getXmlResultVariableNames(WebApp webApp)
Get the names of all webApp variables that are defined to contain XML data transformed from JDBC ResultSets. Note: there is no guarantee that any of the named variables will contain transformed XML when they are referenced at runtime.

Parameters:
webApp - The webApp in which to seach for XML result variables.
Returns:
A list of webApp variable names. The list may be empty, but it will never be null. If webApp is null, then an empty list is returned.

isCachableTransformHelperVariable

public static boolean isCachableTransformHelperVariable(Variable variable)
Check a webApp variable to see if it has been defined as containing a caching Sql Transform helper LJO at runtime. Note: this does not guarantee that the variable will actually contain that type of LJO at runtime.

Parameters:
variable - The webApp variable to be inspected.
Returns:
Returns true if the variable has an object class as defined by SqlTransformToXmlBuilder.cachableHelperInterfaceClass. Returns false otherwise and when variable is null.
See Also:
isTransformHelperVariable( Variable )

isDataSourceHelperVariable

public static boolean isDataSourceHelperVariable(Variable variable)
Check a webApp variable to see if it has been defined as containing a Sql DataSource helper LJO at runtime. Note: this does not guarantee that the variable will actually contain that type of LJO at runtime.

Parameters:
variable - The webApp variable to be inspected.
Returns:
Returns true if the variable has an object class as defined by SqlDataSourceBuilder.helperInterfaceClass. Returns false otherwise and when variable is null.

isStatementHelperVariable

public static boolean isStatementHelperVariable(Variable variable)
Check a webApp variable to see if it has been defined as containing a Sql Statement helper LJO at runtime. Note: this does not guarantee that the variable will actually contain that type of LJO at runtime.

Parameters:
variable - The webApp variable to be inspected.
Returns:
Returns true if the variable has an object class as defined by SqlStatementBuilder.helperInterfaceClass. Returns false otherwise and when variable is null.

isTransactionHelperVariable

public static boolean isTransactionHelperVariable(Variable variable)
Check a webApp variable to see if it has been defined as containing a Sql Transaction helper LJO at runtime. Note: this does not guarantee that the variable will actually contain that type of LJO at runtime.

Parameters:
variable - The webApp variable to be inspected.
Returns:
Returns true if the variable has an object class as defined by SqlTransactionBuilder.helperInterfaceClass. Returns false otherwise and when variable is null.

isTransformHelperVariable

public static boolean isTransformHelperVariable(Variable variable)
Check a webApp variable to see if it has been defined as containing a Sql Transform helper LJO at runtime. Note: this does not guarantee that the variable will actually contain that type of LJO at runtime.

Parameters:
variable - The webApp variable to be inspected.
Returns:
Returns true if the variable has an object class as defined by SqlTransformToXmlBuilder.helperInterfaceClass. Returns false otherwise and when variable is null.
See Also:
isCachableTransformHelperVariable( Variable )

isTransformMethod

public static boolean isTransformMethod(Method method)
Method to verify that a webApp method has the proper signature to be a custom transform for a Sql Transaction step. Note: this method only checks that the signature of the webApp method matches the signature expected by Sql Transaction. It makes no gurantee whether or not the method body actually implements a custom transform.

Parameters:
method - A webApp method definiton to be checked for conformance to the Sql Transaction custom transform method signature.
Returns:
Returns true if the method signature matches what's expected for a custom tranform. Otherwise false is returned.

markAsDependent

public static void markAsDependent(java.lang.String builderName,
                                   WebAppObject artifact)
Register the Sql builder as being dependent upon the given webApp artifact. Note that only a few webApp artifacts are currently marked in this way. Thus, this method is only meaningful to the Sql builders and their support code.

Parameters:
builderName - The Sql builder that has a dependency.
artifact - The webApp artifact the builder is dependent upon.


Copyright © 2009 IBM. All Rights Reserved.