com.ibm.websphere.wim.util
Class XSDHelper

java.lang.Object
  extended by com.ibm.websphere.wim.util.XSDHelper

public class XSDHelper
extends java.lang.Object

Helper class for XSD related operations


Constructor Summary
XSDHelper()
           
 
Method Summary
static org.eclipse.emf.ecore.EClass getClass(java.lang.String uri, java.lang.String typeName)
          Returns the EClass object from the given name space URI and type name.
static org.eclipse.emf.ecore.EStructuralFeature getGlobalFeature(java.lang.String qualifiedName)
          Returns the EStructuralFeature objct from the given qualified property name.
static org.eclipse.emf.ecore.EStructuralFeature getGlobalFeature(java.lang.String uri, java.lang.String featureName)
          Returns the global EStructuralFeature object from the given name space URI and feature name.
static commonj.sdo.Property getGlobalProperty(java.lang.String uri, java.lang.String propertyName)
          Returns the global Property object from the given name space URI and property name.
static org.eclipse.emf.ecore.EStructuralFeature getLocalFeature(java.lang.String typeUri, java.lang.String typeName, java.lang.String featureUri, java.lang.String featureName)
          Returns the local EStructuralFeature object from the given type name and its name space URI, as well as the feature name and its name space URI.
static commonj.sdo.Property getLocalProperty(java.lang.String typeUri, java.lang.String typeName, java.lang.String propertyUri, java.lang.String propertyName)
          Returns the local Property object from the the given type name and its name space URI, as well as the property name and its name space URI.
static java.lang.String getNsURIFromQualifiedName(java.lang.String qualifiedName)
          Returns the name space URI from the given qualified name.
static org.eclipse.emf.ecore.EPackage getPackage(java.lang.String uri)
          Returns the EPackage object from the given name space URI
static java.lang.String getPackageNsPrefix(java.lang.String nsURI)
          Returns the name space prefix of the package from the given name space URI.
static java.lang.String getPackageNsURI(java.lang.String nsPrefix)
          Returns the name space URI of the package from the given name space prefix.
static java.lang.String getQualifiedPropertyName(org.eclipse.emf.ecore.EStructuralFeature feature)
          Returns the qualified property name from the given feature.
static java.lang.String getQualifiedPropertyName(commonj.sdo.Property property)
          Returns the qualified property name from the given property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSDHelper

public XSDHelper()
Method Detail

getClass

public static org.eclipse.emf.ecore.EClass getClass(java.lang.String uri,
                                                    java.lang.String typeName)
Returns the EClass object from the given name space URI and type name. For example, specifing uri="http://www.ibm.com/websphere/wim" and typeName="Person" will return EClass of the virtual member manager entity type Person in virtual member manager name space. Specifing uri="http://www.yourco.com/wim/yourext" and typeName="Person" will return EClass of the extension entity type "Person" in extension name space.

Parameters:
uri - the name space URI of the type. If it is null or empty, default is virtual member manager name space URI ("http://www.ibm.com/websphere/wim").
typeName - the name of the type.
Return:
EClass object of the given name space URI and type name.

getGlobalFeature

public static org.eclipse.emf.ecore.EStructuralFeature getGlobalFeature(java.lang.String uri,
                                                                        java.lang.String featureName)
Returns the global EStructuralFeature object from the given name space URI and feature name. For example, specifing uri="http://www.ibm.com/websphere/wim" and featureName="displayName" will return the global EStructuralFeature of the virtual member manager property "displayName" in virtual member manager name space. Specifing uri="http://www.yourco.com/wim/yourext" and featureName="displayName" will return the global EStructuralFeature of extension property "displayName" in extension name space.

Parameters:
uri - the name space URI of the feature. If it is null or empty, default is virtual member manager name space URI ("http://www.ibm.com/websphere/wim").
featureName - the name of the feature.
Return:
EStructuralFeature object of the given name space URI and feature name.

getPackageNsURI

public static java.lang.String getPackageNsURI(java.lang.String nsPrefix)
Returns the name space URI of the package from the given name space prefix.

Parameters:
nsPrefix - The name space prefix.
Return:
The name space URI of the package.

getNsURIFromQualifiedName

public static java.lang.String getNsURIFromQualifiedName(java.lang.String qualifiedName)
Returns the name space URI from the given qualified name.

Parameters:
qualifiedName - The qualified name
Return:
The name space URI.

getPackageNsPrefix

public static java.lang.String getPackageNsPrefix(java.lang.String nsURI)
Returns the name space prefix of the package from the given name space URI.

Parameters:
nsURI - The name space URI.
Return:
The name space prefix of the package.

getGlobalFeature

public static org.eclipse.emf.ecore.EStructuralFeature getGlobalFeature(java.lang.String qualifiedName)
Returns the EStructuralFeature objct from the given qualified property name.

Parameters:
qualifiedName - The qualified property name.
Return:
The EStructuralFeature object

getGlobalProperty

public static commonj.sdo.Property getGlobalProperty(java.lang.String uri,
                                                     java.lang.String propertyName)
Returns the global Property object from the given name space URI and property name. For example, specifing uri="http://www.ibm.com/websphere/wim" and propertyName="displayName" will return the global Property of the virtual member manager property "displayName" in virtual member manager name space. Specifing uri="http://www.yourco.com/wim/yourext" and propertyName="displayName" will return the global Property of the extension property "displayName" in extension name space.

Parameters:
uri - the name space URI of the property. If it is null or empty, default is virtual member manager name space URI ("http://www.ibm.com/websphere/wim").
propertyName - the name of the property
Return:
The gloabl Property object of the given name space URI and property name.

getLocalFeature

public static org.eclipse.emf.ecore.EStructuralFeature getLocalFeature(java.lang.String typeUri,
                                                                       java.lang.String typeName,
                                                                       java.lang.String featureUri,
                                                                       java.lang.String featureName)
Returns the local EStructuralFeature object from the given type name and its name space URI, as well as the feature name and its name space URI. For example, specifing the following: typeUri="http://www.ibm.com/websphere/wim" typeName="Person" feaureUri=""http://www.ibm.com/websphere/wim" featureName="displayName" will return the local EStructuralFeature of the virtual member manager property "displayName" for virtual member manager entity "Person". The following: typeUri="http://www.ibm.com/websphere/wim" typeName="Person" feaureUri=""http://www.yourco.com/wim/yourext" featureName="displayName" will return the local EStructuralFeature of the extension property "displayName" for virtual member manager entity "Person".

Parameters:
typeUri - the name space URI of the type. If it is null or empty, default is virtual member manager name space URI ("http://www.ibm.com/websphere/wim").
typeName - the name of the type.
featureUri - the name space URI of the feature. If it is null or empty, default is virtual member manager name space URI ("http://www.ibm.com/websphere/wim").
featureName - the name of the feature.
Return:
EStructuralFeature object of the given type and feature.

getLocalProperty

public static commonj.sdo.Property getLocalProperty(java.lang.String typeUri,
                                                    java.lang.String typeName,
                                                    java.lang.String propertyUri,
                                                    java.lang.String propertyName)
Returns the local Property object from the the given type name and its name space URI, as well as the property name and its name space URI. For example, specifing the following: typeUri="http://www.ibm.com/websphere/wim" typeName="Person" propertyUri=""http://www.ibm.com/websphere/wim" propertyName="displayName" will return the local Property of the virtual member manager property "displayName" for virtual member manager entity "Person". The following: typeUri="http://www.ibm.com/websphere/wim" typeName="Person" propertyUri=""http://www.yourco.com/wim/yourext" propertyName="displayName" will return the local Property of the extension property "displayName" for virtual member manager entity "Person". The returned Property object can be used to set and get properties in data object. The following code sample use this method to get and set properties with same name but different name spaces (virtual member manager property "displayName" is multi-value, extension property "displayName" is single-valued): DataObject person = root.createDataObject("http://www.ibm.com/websphere/wim", "Person"); Property wimProp = XSDHelper.getLocalProperty("http://www.ibm.com/websphere/wim", "Person", "http://www.ibm.com/websphere/wim", "displayName"); person.getList(wimProp).add("wimDisplayName1"); person.getList(wimProp).add("wimDisplayName2"); System.out.println("wim:displayName " + person.getList(wimProp)); Property extProp = WIMXSDHelper.getLocalProperty("http://www.ibm.com/websphere/wim", "Person", "http://www.yourco.com/wim/yourext", "displayName"); person.setString(extProp, "extDisplayName"); System.out.println("ext:displayName " + person.getString(extProp));

Parameters:
typeUri - the name space URI of the type. If it is null or empty, default is virtual member manager name space URI ("http://www.ibm.com/websphere/wim").
typeName - the name of the type.
propertyUri - the name space URI of the property. If it is null or empty, default is virtual member manager name space URI ("http://www.ibm.com/websphere/wim").
propertyName - the name of the property.
Return:
Property object of the given type and property.

getPackage

public static org.eclipse.emf.ecore.EPackage getPackage(java.lang.String uri)
Returns the EPackage object from the given name space URI

Parameters:
uri - the name space URI of the package. If it is null or empty, default is virtual member manager name space URI ("http://www.ibm.com/websphere/wim").
Return:
the EPackage object.

getQualifiedPropertyName

public static java.lang.String getQualifiedPropertyName(commonj.sdo.Property property)
Returns the qualified property name from the given property. The returned qualfied type name has the format ":". For example, "wimext:EPerson", "yourco:MyPerson".

Parameters:
property - The property object
Return:
the qualified property name.

getQualifiedPropertyName

public static java.lang.String getQualifiedPropertyName(org.eclipse.emf.ecore.EStructuralFeature feature)
Returns the qualified property name from the given feature. The returned qualfied type name has the format ":". For example, "wimext:EPerson", "yourco:MyPerson".

Parameters:
property - The EStructuralFeature object
Return:
the qualified property name.