uk.ac.ucl.sse.omii.bpel.abr.generation.util
Class DeploymentDataProvider

java.lang.Object
  extended by uk.ac.ucl.sse.omii.bpel.abr.generation.util.DeploymentDataProvider

public class DeploymentDataProvider
extends java.lang.Object

Makes available a bunch of utility classes that provide any data required data about a process for generation of PDDs. Most of the methods of this class work on IModuleArtifacts. TODO this is in desperate need of refactoring Put all WSDL related methods in a WsdlUtil class or where they get used the most Put all XSD related methods in a XsdUtil class or where they get used the most Put all ModuleArtifact related methods in a ModuleArtifact util class

Author:
Bruno Wassermann, written Aug 21, 2006

Constructor Summary
DeploymentDataProvider()
           
 
Method Summary
static java.lang.String extractFileName(java.lang.String resourceLocation)
          Given a string representing a platform resource location, removes all elements in that string preceeding the file name and returns only the file name.
static org.eclipse.xsd.XSDSchema findAndLoadSchemaFromImport(org.eclipse.xsd.XSDImport imp)
          TODO had to copy this from WSDLImportResolver as was protected there.
static org.eclipse.wst.wsdl.Definition findAndLoadWSDLFromImport(org.eclipse.bpel.model.Import imp)
          TODO had to copy this from WSDLImportResolver as was protected there.
static org.eclipse.bpel.model.partnerlinktype.PartnerLinkType findPartnerLinkType(PartnerLink bpelPartnerLink, org.eclipse.emf.common.util.EList wsdlImports)
          Given a bpws:partnerLink (org.eclipse.bpel.model.PartnerLink) and a bunch of corresponding imports of type wsdl, tries to find a plnk:partnerLinkType definition (org.eclipse.bpel.model.partnerlinktype.PartnerLinkType).
static org.eclipse.wst.wsdl.Binding findWsdlBinding(PartnerLink bpelPartnerLink, org.eclipse.emf.common.util.EList wsdlImports)
           A wsdl:binding always has as its type attribute a single wsdl:portType.
static org.eclipse.wst.wsdl.Binding findWsdlBindingFromWsdlImports(org.eclipse.wst.wsdl.Definition wsdlDef, javax.xml.namespace.QName plnkPortTypeNameFromRole1, javax.xml.namespace.QName plnkPortTypeNameFromRole2)
           
static org.eclipse.wst.wsdl.Service findWsdlService(PartnerLink bpelPartnerLink, org.eclipse.emf.common.util.EList wsdlImports)
          Given a bpws:partnerLink (org.eclipse.bpel.model.PartnerLink) tries to find the wsdl:service (org.eclipse.wst.wsdl.Service) that is associated with the corresponding plnk:partnerLinkType (org.eclipse.bpel.model.partnerlinktype.PartnerLinkType).
static org.eclipse.wst.wsdl.Service findWsdlServiceFromWsdlImports(org.eclipse.wst.wsdl.Definition wsdlDef, javax.xml.namespace.QName bindingQName)
          Given a WSDL definition recursively search all imports (and imports of imports, etc.) for a Service
static org.eclipse.core.resources.IFile getBPELFile(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact)
          Extracts the bpel file from a BPELModuleArtifact.
static org.eclipse.emf.common.util.EList getImports(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact)
          Returns all imports defined in the bpel file of the correspoding module artifact.
static org.eclipse.emf.common.util.EList getLocalImports(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact)
          Returns all bpws:imports from the given module artifact that have relative location URIs (i.e.
static org.eclipse.emf.common.util.EList getLocalWsdlImports(org.eclipse.wst.wsdl.Definition wsdlDef)
          Given a wsdl definition returns any wsdl:imports that have a relative locationURI (i.e.
static org.eclipse.emf.common.util.EList getLocalWsdlImports(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact)
          Returns all local WSDL imports in the bpel file referenced in the module artifact.
static org.eclipse.emf.common.util.EList getLocalXsdImports(org.eclipse.wst.wsdl.Definition wsdlDef)
          Given a wsdl definition returns all xsd:imports from the element that has a relative schemaLocation (i.e.
static org.eclipse.emf.common.util.EList getLocalXsdImports(org.eclipse.xsd.XSDSchema schema)
          Given an xsd schema returns any xsd:imports that have a relative schemaLocation (i.e.
static java.lang.String getModuleName(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact)
           
static java.lang.String getNsFromPartnerLink(PartnerLink bpelPartnerLink)
          Returns the namespace value of the partnerLinkType in the given bpws:partnerLink or null.
static org.eclipse.wst.wsdl.Port getPort(PartnerLink bpelPartnerLink, org.eclipse.emf.common.util.EList wsdlImports)
          Given a bpws:partnerLink (org.eclipse.bpel.model.PartnerLink) and a bunch of corresponding imports tries to find the port (org.eclipse.wst.wsdl.Port) defined in the corrsponding wsdl:service (org.eclipse.wst.wsdl.Service).
static java.lang.Process getProcess(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact)
          Obtain the Process from an IModuleArtifact.
static org.eclipse.emf.common.util.EList getRemoteWsdlImports(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact)
          Returns all remote WSDL imports (ones that have 'http://' in their location attribute) in the bpel file referenced in the module artifact.
static java.lang.String getSOAPLocationURI(PartnerLink bpelPartnerLink, org.eclipse.emf.common.util.EList wsdlImports)
          Given a bpws:partnerLink and a bunch of corresponding wsdl imports tries to return the soap:address location attribute value of the correct wsdl:service element.
static org.eclipse.emf.common.util.EList getWsdlImports(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact)
          Returns all WSDL imports defined in the bpel file of the corresponding module artifact.
static org.eclipse.emf.common.util.EList getWsdlImportsForPartnerLinkType(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact, PartnerLink bpelPartnerLink)
          Returns all WSDL imports that have the same namespace value as the partnerLinkType in the bpws:partnerLink.
static org.eclipse.emf.common.util.EList getXsdImports(org.eclipse.wst.wsdl.Definition wsdlDef)
          Given a wsdl definition returns any xsd:imports that it defines in its element.
static org.eclipse.emf.common.util.EList getXsdImports(org.eclipse.xsd.XSDSchema schema)
          Given an xsd schema returns any xsd:imports that are contained.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeploymentDataProvider

public DeploymentDataProvider()
Method Detail

getProcess

public static java.lang.Process getProcess(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact)
Obtain the Process from an IModuleArtifact.

Parameters:
moduleArtifact - BPELModuleArtifact
Returns:
Process or null

Note that null is returned when the module artifact has a null bpel file TODO make returned process immutable


getBPELFile

public static org.eclipse.core.resources.IFile getBPELFile(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact)
Extracts the bpel file from a BPELModuleArtifact.

Parameters:
moduleArtifact -
Returns:
IFile representing bpel file of a BPELModuleArtifact TODO make returned file immutable

getImports

public static org.eclipse.emf.common.util.EList getImports(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact)
Returns all imports defined in the bpel file of the correspoding module artifact.

Parameters:
moduleArtifact - IModuleArtifact
Returns:
list of imports TODO make returned result immutable

getLocalImports

public static org.eclipse.emf.common.util.EList getLocalImports(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact)
Returns all bpws:imports from the given module artifact that have relative location URIs (i.e. not http://...).

Parameters:
moduleArtifact - IModuleArtifact
Returns:
EList containing all org.eclipse.bpel.model.Imports with relative location URI

getWsdlImports

public static org.eclipse.emf.common.util.EList getWsdlImports(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact)
Returns all WSDL imports defined in the bpel file of the corresponding module artifact.

Parameters:
moduleArtifact - IModuleArtifact
Returns:
EList of all WSDL imports

getLocalWsdlImports

public static org.eclipse.emf.common.util.EList getLocalWsdlImports(org.eclipse.wst.wsdl.Definition wsdlDef)
Given a wsdl definition returns any wsdl:imports that have a relative locationURI (i.e. not http://...).

Parameters:
wsdlDef - org.eclipse.wst.wsdl.Definition
Returns:
EList containing all local org.eclipse.wst.wsdl.Imports

getLocalWsdlImports

public static org.eclipse.emf.common.util.EList getLocalWsdlImports(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact)
Returns all local WSDL imports in the bpel file referenced in the module artifact.

Parameters:
moduleArtifact - IModuleArtifact expected to be a BPELModuleArtifact
Returns:
EList TODO makre returned results immutable TODO think about returning empty list instead of null

getRemoteWsdlImports

public static org.eclipse.emf.common.util.EList getRemoteWsdlImports(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact)
Returns all remote WSDL imports (ones that have 'http://' in their location attribute) in the bpel file referenced in the module artifact.

Parameters:
moduleArtifact - IModuleArtifact expected to be a BPELModuleArtifact
Returns:
EList TODO make returned results immutable TODO think about returning empty list instead of null

getWsdlImportsForPartnerLinkType

public static org.eclipse.emf.common.util.EList getWsdlImportsForPartnerLinkType(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact,
                                                                                 PartnerLink bpelPartnerLink)
Returns all WSDL imports that have the same namespace value as the partnerLinkType in the bpws:partnerLink.

Parameters:
moduleArtifact - IModuleArtifact expected to be a BPELModuleArtifact
bpelPartnerLink - PartnerLink whose WSDL we want
Returns:
EList containing corresponding Imports

getXsdImports

public static org.eclipse.emf.common.util.EList getXsdImports(org.eclipse.xsd.XSDSchema schema)
Given an xsd schema returns any xsd:imports that are contained.

Parameters:
schema - XSDSchema
Returns:
EList containing XSDImports

getXsdImports

public static org.eclipse.emf.common.util.EList getXsdImports(org.eclipse.wst.wsdl.Definition wsdlDef)
Given a wsdl definition returns any xsd:imports that it defines in its element.

Parameters:
wsdlDef - org.eclipse.wst.wsdl.Definition
Returns:
EList containing XSDImports

getLocalXsdImports

public static org.eclipse.emf.common.util.EList getLocalXsdImports(org.eclipse.xsd.XSDSchema schema)
Given an xsd schema returns any xsd:imports that have a relative schemaLocation (i.e. not http://...).

Parameters:
schema - XSDSchema
Returns:
EList containing XSDImports

getLocalXsdImports

public static org.eclipse.emf.common.util.EList getLocalXsdImports(org.eclipse.wst.wsdl.Definition wsdlDef)
Given a wsdl definition returns all xsd:imports from the element that has a relative schemaLocation (i.e. not http://...).

Parameters:
wsdlDef - org.eclipse.wst.wsdl.Definition
Returns:
EList containing XSDImports

getNsFromPartnerLink

public static java.lang.String getNsFromPartnerLink(PartnerLink bpelPartnerLink)
Returns the namespace value of the partnerLinkType in the given bpws:partnerLink or null.

Parameters:
bpelPartnerLink -
Returns:
Srting representing ns of partnerLinkType or null

findAndLoadWSDLFromImport

public static org.eclipse.wst.wsdl.Definition findAndLoadWSDLFromImport(org.eclipse.bpel.model.Import imp)
TODO had to copy this from WSDLImportResolver as was protected there. TODO Should ask whether it would make sense to make this one public in its original class. Given a bpws:import will try to find and load the corresponding WSDL definition.

Parameters:
imp - org.eclipse.bpel.model.Import
Returns:
org.eclipse.wst.wsdl.Definition or null

findAndLoadSchemaFromImport

public static org.eclipse.xsd.XSDSchema findAndLoadSchemaFromImport(org.eclipse.xsd.XSDImport imp)
TODO had to copy this from WSDLImportResolver as was protected there. TODO Should ask whether it would make sense to make this one public in its original class. Find and load the schema based on the import statement

Parameters:
imp - XSdImport
Returns:
the schema that it references XSDSchema

findPartnerLinkType

public static org.eclipse.bpel.model.partnerlinktype.PartnerLinkType findPartnerLinkType(PartnerLink bpelPartnerLink,
                                                                                         org.eclipse.emf.common.util.EList wsdlImports)
Given a bpws:partnerLink (org.eclipse.bpel.model.PartnerLink) and a bunch of corresponding imports of type wsdl, tries to find a plnk:partnerLinkType definition (org.eclipse.bpel.model.partnerlinktype.PartnerLinkType).

Parameters:
bpelPartnerLink -
wsdlImports - EList of Imports of type wsdl
Returns:
org.eclipse.bpel.model.partnerlinktype.PartnerLinkType or null if none can be found

findWsdlBinding

public static org.eclipse.wst.wsdl.Binding findWsdlBinding(PartnerLink bpelPartnerLink,
                                                           org.eclipse.emf.common.util.EList wsdlImports)

A wsdl:binding always has as its type attribute a single wsdl:portType. A bpws:partnerLinkType can define two roles. Each role can specify another portType. Therefore, we check whether there are two roles defined and if so get both their portType QNames.

Parameters:
bpelPartnerLink -
wsdlImports -
Returns:

findWsdlBindingFromWsdlImports

public static org.eclipse.wst.wsdl.Binding findWsdlBindingFromWsdlImports(org.eclipse.wst.wsdl.Definition wsdlDef,
                                                                          javax.xml.namespace.QName plnkPortTypeNameFromRole1,
                                                                          javax.xml.namespace.QName plnkPortTypeNameFromRole2)

findWsdlServiceFromWsdlImports

public static org.eclipse.wst.wsdl.Service findWsdlServiceFromWsdlImports(org.eclipse.wst.wsdl.Definition wsdlDef,
                                                                          javax.xml.namespace.QName bindingQName)
Given a WSDL definition recursively search all imports (and imports of imports, etc.) for a Service


findWsdlService

public static org.eclipse.wst.wsdl.Service findWsdlService(PartnerLink bpelPartnerLink,
                                                           org.eclipse.emf.common.util.EList wsdlImports)
Given a bpws:partnerLink (org.eclipse.bpel.model.PartnerLink) tries to find the wsdl:service (org.eclipse.wst.wsdl.Service) that is associated with the corresponding plnk:partnerLinkType (org.eclipse.bpel.model.partnerlinktype.PartnerLinkType).

Parameters:
moduleArtifact -
bpelPartnerLink -
Returns:
org.eclipse.wst.wsdl.Service corresponding to given partnerLink or null indicating that no corresponding org.eclipse.wst.wsdl.Service could be found

getPort

public static org.eclipse.wst.wsdl.Port getPort(PartnerLink bpelPartnerLink,
                                                org.eclipse.emf.common.util.EList wsdlImports)
Given a bpws:partnerLink (org.eclipse.bpel.model.PartnerLink) and a bunch of corresponding imports tries to find the port (org.eclipse.wst.wsdl.Port) defined in the corrsponding wsdl:service (org.eclipse.wst.wsdl.Service).

Parameters:
bpelPartnerLink -
wsdlImports -
Returns:
org.eclipse.wst.wsdl.Port

getSOAPLocationURI

public static java.lang.String getSOAPLocationURI(PartnerLink bpelPartnerLink,
                                                  org.eclipse.emf.common.util.EList wsdlImports)
Given a bpws:partnerLink and a bunch of corresponding wsdl imports tries to return the soap:address location attribute value of the correct wsdl:service element.

Parameters:
bpelPartnerLink -
wsdlImports -
Returns:
String representing soap:address location value

getModuleName

public static java.lang.String getModuleName(org.eclipse.wst.server.core.IModuleArtifact moduleArtifact)

extractFileName

public static java.lang.String extractFileName(java.lang.String resourceLocation)
Given a string representing a platform resource location, removes all elements in that string preceeding the file name and returns only the file name.

E.g.: platform:/resource/TestProject/jsdl.xsd returns jsdl.xsd

Parameters:
resourceLocation - String representing platform resource location
Returns:
String representing file name plus extension ending in a wsdl file, removes all elements preceeding the file name and returns only the file name plus extension.