com.ibm.designer.domino.xsp.api.published
Class AbstractDataPublishedProvider

java.lang.Object
  extended by com.ibm.designer.domino.xsp.api.published.AbstractDataPublishedProvider
All Implemented Interfaces:
PublishedObjectProvider
Direct Known Subclasses:
DataContextPublishedProvider

public abstract class AbstractDataPublishedProvider
extends java.lang.Object
implements PublishedObjectProvider

An abstract Published Object provider used by data sources to contribute to the Domino Designer data tooling. A subclass should be created for any data source or data context that wishes to contribute to the Domino Designer Data Tooling model, e.g. data sources wishing to appear in the Data Palette, and in the data panel for controls must implement the com.ibm.designer.domino.scripting.api.published.PublishedObjectProvider interface or preferrably extend this abstract class.


Field Summary
static java.lang.String DESIGNER_NAMESPACEURI
          The namespace URI used by the XPages runtime; "http://www.ibm.com/xsp/core"
 
Fields inherited from interface com.ibm.designer.domino.scripting.api.published.PublishedObjectProvider
CURRENT_DOC_VAR
 
Constructor Summary
AbstractDataPublishedProvider()
           
 
Method Summary
protected  DesignerPublishedObject createPublishedObject(java.lang.String var)
          Create a new published object.
abstract  java.lang.String getLocalName()
          Returns the localName of this tag.
protected  java.lang.String getNameSpaceURI()
          Returns the XML namespace URI for the tag returned in getLocalName().
 void getPublishedObject(java.util.Map<java.lang.String,IScriptData.PublishedObject> map, org.w3c.dom.Node node, DesignerProject project, boolean addCurrentDocument)
          Gets called by the XPage Editor data tooling framework.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DESIGNER_NAMESPACEURI

public static final java.lang.String DESIGNER_NAMESPACEURI
The namespace URI used by the XPages runtime; "http://www.ibm.com/xsp/core"

See Also:
Constant Field Values
Constructor Detail

AbstractDataPublishedProvider

public AbstractDataPublishedProvider()
Method Detail

getLocalName

public abstract java.lang.String getLocalName()
Returns the localName of this tag. e.g. in the case of xp:myTag, this method will return 'myTag'. The value returned should be the same as the DOM operation node.getLocalName() on the same tag.

Returns:
returns the XML local name for the container tag that this provider represents

getPublishedObject

public void getPublishedObject(java.util.Map<java.lang.String,IScriptData.PublishedObject> map,
                               org.w3c.dom.Node node,
                               DesignerProject project,
                               boolean addCurrentDocument)
                        throws com.ibm.designer.prj.resources.commons.DesignerProjectException
Description copied from interface: PublishedObjectProvider
Gets called by the XPage Editor data tooling framework. Each time selection changes in the XPage editor this method will be called. It is the responsibility of this method to ensure that a PublishedObject is added to the map as is appropriate based on the selection parameter. The selection parameter is the currently selected tag in the XPages Editor.

Example:
Using the following XPage xml markup as an example we can see how the data tooling examines the XPage DOM:
<xp:view>
     <xp:this.data>
          <my:myRelationalDataSource var="db2" server="mydb2serverB" db="mydb" ...../>
     </xp:this.data>
     <xp:panel>
         <xp:this.data>
              <my:myRelationalDataSource var="db1" server="mydb2serverA" db="mydb" ...../>
         </xp:this.data>
         ........
         
         <xp:inputText id="inputText1"></xp:inputText>
     </xp:panel>
</xp:view> 
 
As a use case we will assume that the user has selected the inputText tag in the XPage above. At this point the Domino Designer data tooling framework must find out what data is available to the inputText tag.
The data tooling framework recursively walks 'up' through the XPage's DOM hierarchy. In this example <xp:panel> is the first parent tag of <xp:inputText>. <xp:panel> is defined in the runtime as a data container tag, meaning it can have a <xp:this.data> tag as a child. As a result of this the <xp:panel> tag provides a concrete implementation of com.ibm.designer.domino.xsp.api.published.AbstractDataContainerPublishedProvider using the com.ibm.designer.domino.scripting.publishedProvider extension point. This concrete implementation searches through the children of <xp:panel> for instances of the this.data tag.
In this case a this.data tag is found. The <xp:panel> implementation next searches through the children of the this.data tag. It finds a tag called myRelationalDataSource.

It is the responsibility of myRelationalDataSource to provide an implementation of com.ibm.designer.domino.scripting.api.published.PublishedObjectProvider using the com.ibm.designer.domino.scripting.publishedProvider extension point so that the Domino Designer data tooling code can interpret the data being contributed by the myRelationalDataSource tag. In this case myRelationalDataSource has contributed a concrete implementation of com.ibm.designer.domino.xsp.api.published.AbstractDataPublishedProvider. This implementation reads the relational database that is defined in its attributes and provides a schema representation of the database to the Domino Designer data tooling framework via its PublishedObject.
Once all children of this.data have contributed their PublishedObjects to the map the data tooling will once again walk upwards through the DOM hierarchy.

The next parent is the <xp:view>. Once again this tag is a data container, and similar to what happened when the <xp:panel> tag was encountered the children of the view will be examined for instances of the this.data tag.
Again the myRelationalDataSource tag is encountered and it PublishedObjectProvider is queried to add a PublishedObject to the map via the getPublishedObject(Map, Node, ICommonDesignerProject, boolean) method.
Once the Domino Designer data tooling framework code has walked through the XPage's DOM hierarchy it uses the information collected to populate the XPages tooling with information from the PublishedObject map. The string that corresponds to the PublishedObject in the map is assumed to be the PublishedObject's name. The name is shown in the list of Data Sources in both the properties panels and also in the Data Palette view. Once the user selects that name in the data panel or in the data palette view the PublishedObject is queried for information that is required to further populate the tooling. Specifically the PublishedObject is queried for objects that correspond to the properties defined in IScriptData

Specified by:
getPublishedObject in interface PublishedObjectProvider
Parameters:
map - a map of PublishedObjects. Items are contributed to the map on a key - value pair basis where the key is typically the string returned by IScriptData.PublishedObject.getName() and the value is an instance of IScriptData.PublishedObject.
The keys of the map are typically used for data binding and represent the data source names. The values in the map resolve to PublishedObects which are in turn queried for further information about the data source.
node - the currently selected DOM node on the XPage.
project - an interface used to describe the currently selected IBM Lotus Notes application.
Throws:
com.ibm.designer.prj.resources.commons.DesignerProjectException - an error was encountered when accessing the db.
See Also:
IScriptData, IScriptData.PublishedObject, DesignerPublishedObject, IScriptData.PublishedObject.getProperty(String)

createPublishedObject

protected DesignerPublishedObject createPublishedObject(java.lang.String var)
Create a new published object. Subclasses may override this to create there own type of published object. By default this method will create a published object of type com.ibm.designer.domino.scripting.api.published.DesignerPublishedObject

Parameters:
var - - string from "var" attribute of the element.
Returns:
PublishedObject

getNameSpaceURI

protected java.lang.String getNameSpaceURI()
Returns the XML namespace URI for the tag returned in getLocalName().

Returns:
the default implementation returns "http://www.ibm.com/xsp/core"