Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.6.0)

E13403-07

oracle.ide.model
Class XMLDataNode

java.lang.Object
  extended by oracle.ide.model.Node
      extended by oracle.ide.model.XMLDataNode
All Implemented Interfaces:
Displayable, Element, LazyLoadable, Locatable, Subject, Dirtyable
Direct Known Subclasses:
XMLDataContainer

public class XMLDataNode
extends Node

The XMLDataNode class is the Node wrapper for a JavaBean class that can be persisted to XML using the XML marshalling framework Object2Dom.

XMLDataNode is capable of wrapping any object. Persistence of the object's state will be mediated by the Object2Dom class.

If the wrapped object is an instance of Element, then calls to XMLDataNode's Element interface will be forwarded to the wrapped Element.

See Also:
Object2Dom

Nested Class Summary
protected static class XMLDataNode.DataCastPacket
          The DataCastPacket class is a data class that is helpful for reducing the number of type-cast operations that need to occur.
 
Field Summary
 
Fields inherited from class oracle.ide.model.Node
LOG_READONLY
 
Constructor Summary
XMLDataNode()
          Default constructor required for JavaBeans status.
XMLDataNode(java.lang.Object dataObject, java.net.URL url)
          Creates an XMLDataNode whose data comes from the given dataObject.
 
Method Summary
protected  void closeImpl()
          Subclasses should override this method to customize the close() behavior.
 Attributes getAttributes()
          This method returns an Attributes object that encodes the attributes of the Element.
 java.util.Iterator getChildren()
          This method is part of the Element interface to provide a convenient way of getting an Iterator over any contained child Elements without having to test the object's type with the instanceof operator or having to downcast to a more specific type.
 java.lang.Object getData()
          Part of the Element interface.
protected  XMLDataNode.DataCastPacket getDataCastPacketDirectly()
          Returns the XMLDataNode.DataCastPacket object directly.
protected  java.lang.Class getDefaultClass()
          The default class that is specified to Object2Dom during marshalling and unmarshalling.
 javax.swing.Icon getIcon()
          Part of the Element interface.
 java.lang.String getToolTipText()
          Part of the Element interface.
protected  java.lang.String getXMLRootElementName()
          Returns the XML root element name that is to be used when writing out the XML file.
 void markDirty(boolean dirty)
          Dirtyable interface method.
 boolean mayHaveChildren()
          This method is part of the Element interface to provide a convenient way of determining whether an object may have children without having to test the object's type with the instanceof operator or having to downcast to a more specific type.
protected  Object2Dom newObject2Dom()
          Returns an appropriately configured instance of Object2Dom which will be used to carry out the marshalling.
protected  void openImpl()
          Subclasses should override this method to customize the open() behavior.
protected  void saveImpl()
          Subclasses should override this method to customize the save() behavior.
 void setData(java.lang.Object object, boolean dirty)
          Binds the specified Object to the XMLDataNode instance as being its data object.
protected  void setDataCastPacketDirectly(XMLDataNode.DataCastPacket data)
          Sets the XMLDataNode.DataCastPacket object directly.
 void setNodeInfo(NodeInfo info)
          Binds the given info to the XMLDataNode instance as being its node information.
 void setURL(java.net.URL url)
          Sets the URL associated with this Node and recaches the Node in the NodeFactory with the new URL so that subsequent queries for the Node will return successfully.
 
Methods inherited from class oracle.ide.model.Node
addNodeListener, addNodeListenerForType, addNodeListenerForTypeHierarchy, attach, beginThreadNodeUsageCycle, callUnderReadLock, callUnderWriteLock, close, createSubject, delete, deleteImpl, detach, endThreadNodeUsage, endThreadNodeUsageCycle, ensureOpen, equalsImpl, getInputStream, getLongLabel, getShortLabel, getSubject, getTimestamp, getTimestampLoadedUnsafe, getTransientProperties, getUnmodifiedTimestamp, getURL, isDirty, isLoaded, isMigrating, isNew, isOpen, isReadLocked, isReadOnly, isReadOrWriteLocked, isTrackedInNodeCache, isWriteLocked, lockCount, markDirtyImpl, nodeLock, notifyObservers, open, readLock, readLockCount, readUnlock, refreshTimestamp, removeNodeListener, removeNodeListenerForType, removeNodeListenerForTypeHierarchy, rename, renameImpl, reportOpenException, revert, revertImpl, runUnderReadLock, runUnderWriteLock, save, setEventLog, setMigrating, setOpen, setReadOnly, setTimestampDirectly, toString, tryRunUnderReadLock, tryRunUnderWriteLock, unsetMigrating, upgradeLock, upgradeUnlock, urlReadOnlyChanged, writeLock, writeLockCount, writeUnlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLDataNode

public XMLDataNode()
Default constructor required for JavaBeans status. By having JavaBean status, an instance of XMLDataNode can itself be persisted and loaded by the XML marshalling framework.

The default constructor performs no intialization. That is, the XMLDataNode is initially marked as unopened, and there is no URL associated with it.

Generally, use of the default constructor should be reserved for the XML marshalling framework. If other application code does make use of the default constructor, however, there must be a call to either setURL(URL) or setData(Object, boolean) before any of the other methods in XMLDataNode will produce valid results.


XMLDataNode

public XMLDataNode(java.lang.Object dataObject,
                   java.net.URL url)
Creates an XMLDataNode whose data comes from the given dataObject. Because a data object is specified, the XMLDataNode is marked as opened and the data object is marked as dirty, if it implements Dirtyable.

The specified URL is used as the output location where the marshalled XML data will be written to when the #save(boolean) method is called.

Method Detail

setURL

public void setURL(java.net.URL url)
Description copied from class: Node
Sets the URL associated with this Node and recaches the Node in the NodeFactory with the new URL so that subsequent queries for the Node will return successfully.

Specified by:
setURL in interface Locatable
Overrides:
setURL in class Node
Parameters:
url - The URL to set.
See Also:
Locatable.setURL(URL)

getIcon

public javax.swing.Icon getIcon()
Part of the Element interface. This method attempts first to delegate to the underlying JavaBean to determine the Icon. If there is no associated JavaBean or if the JavaBean does not implement Element, then the determination of the Icon is delegated to the superclass.

Specified by:
getIcon in interface Displayable
Overrides:
getIcon in class Node
Returns:
the Icon to be displayed for the Displayable.

getToolTipText

public java.lang.String getToolTipText()
Part of the Element interface. This method attempts first to delegate to the underlying JavaBean to determine the tooltip text. If there is no associated JavaBean or if the JavaBean does not implement Element, then the determination of the tooltip text is left to the superclass.

Specified by:
getToolTipText in interface Displayable
Overrides:
getToolTipText in class Node
Returns:
the tooltip to show when the mouse pointer pauses over a UI component that represents this Displayable.

getData

public java.lang.Object getData()
Part of the Element interface. If necessary, this method will first load the data from the location returned by Node.getURL() and unmarshal it with Object2Dom. Once loaded and unmarshalled, if the wrapped object is an Element then the value of its Element.getData() method is returned; otherwise the data object itself will be returned. In any case, the returned object is a JavaBean.

Specified by:
getData in interface Element
Overrides:
getData in class Node
Returns:
the JavaBean object corresponding to the XML content stored at the location specified by Node.getURL().
See Also:
Node.open()

mayHaveChildren

public boolean mayHaveChildren()
Description copied from interface: Element
This method is part of the Element interface to provide a convenient way of determining whether an object may have children without having to test the object's type with the instanceof operator or having to downcast to a more specific type.

An implementation of Element that represents a leaf in a tree structure should return false from this method. An implementation of Element that could represent a non-leaf in a tree structure should return true from this method, even if it does not currently contain any children.

Specified by:
mayHaveChildren in interface Element
Overrides:
mayHaveChildren in class Node
Returns:
true if this Element may contain child Elements.

getChildren

public java.util.Iterator getChildren()
Description copied from interface: Element
This method is part of the Element interface to provide a convenient way of getting an Iterator over any contained child Elements without having to test the object's type with the instanceof operator or having to downcast to a more specific type.

An implementation of Element that represents a leaf in a tree structure should return null from this method. An implementation of Element that could represent a non-leaf in a tree structure should return either an Iterator over the child Elements or null if there are no children.

Specified by:
getChildren in interface Element
Overrides:
getChildren in class Node
Returns:
an Iterator over any child Elements contained by this Element. If there are no children, null is returned.

getAttributes

public Attributes getAttributes()
Description copied from interface: Element
This method returns an Attributes object that encodes the attributes of the Element. Changing the attribute settings on the return object changes the element attributes. Subclasses should use their super class attributes object to define their own attributes. This allows subclasses to inherit their super class attributes. If a subclass does not wish to inherit attributes, they should first call getAttributes().clear() and define new attributes.

Specified by:
getAttributes in interface Element
Overrides:
getAttributes in class Node

markDirty

public void markDirty(boolean dirty)
Dirtyable interface method. If the wrapped object is an instance of Dirtyable, then this implementation delegates the setting of the dirty flag to the wrapped object. Otherwise, the determination of the return value is delegated to the superclass.

Specified by:
markDirty in interface Dirtyable
Overrides:
markDirty in class Node
Parameters:
dirty - If true, sets the object as being dirty; if false, sets the object as being up-to-date.

openImpl

protected void openImpl()
                 throws java.io.IOException
Description copied from class: Node
Subclasses should override this method to customize the open() behavior. Node.open() invokes this only if the node is not open, under write lock. The Node implementation does nothing.

Overrides:
openImpl in class Node
Throws:
java.io.IOException - if an I/O error occurred while opening

closeImpl

protected void closeImpl()
                  throws java.io.IOException
Description copied from class: Node
Subclasses should override this method to customize the close() behavior. Node.close() invokes this only if the node is open, under write lock. The Node implementation does nothing.

Overrides:
closeImpl in class Node
Throws:
java.io.IOException - if an I/O error occurred while closing

saveImpl

protected void saveImpl()
                 throws java.io.IOException
Description copied from class: Node
Subclasses should override this method to customize the save() behavior. Node.save() invokes this only if the node is dirty, under write lock. The Node implementation does nothing.

Overrides:
saveImpl in class Node
Throws:
java.io.IOException - if an I/O error occurred while saving

setNodeInfo

public void setNodeInfo(NodeInfo info)
Binds the given info to the XMLDataNode instance as being its node information.


setData

public void setData(java.lang.Object object,
                    boolean dirty)
Binds the specified Object to the XMLDataNode instance as being its data object. If this method succeeds, the XMLDataNode will be marked as opened and the wrapped data object will have its dirty state set according to the dirty parameter.


getDataCastPacketDirectly

protected XMLDataNode.DataCastPacket getDataCastPacketDirectly()
Returns the XMLDataNode.DataCastPacket object directly. This method is primarily intended for subclass customization. In this method, it is important that the underlying content is not opened if it is currently closed. It is also important that this method never return null and instead return an instance of XMLDataNode.DataCastPacket whose wrapped object is null.


setDataCastPacketDirectly

protected void setDataCastPacketDirectly(XMLDataNode.DataCastPacket data)
Sets the XMLDataNode.DataCastPacket object directly. This method is primarily intended for subclass customization.


getXMLRootElementName

protected java.lang.String getXMLRootElementName()
Returns the XML root element name that is to be used when writing out the XML file. If a subclass needs to use a different XML root element name than the default value provided here, then the subclass sould override this method to return its XML root element name. The #save(boolean) method will use the subclass's return value for this method when writing out the XML file.

When this method is overridden in a subclass, it is generally also desirable to have the IDE be able to recognize the XML root element name so that the IDE will instantiate the correct Node class for the XML file. Refer to the javadoc for XMLRecognizer for details.

See Also:
XMLRecognizer

newObject2Dom

protected Object2Dom newObject2Dom()
Returns an appropriately configured instance of Object2Dom which will be used to carry out the marshalling.


getDefaultClass

protected java.lang.Class getDefaultClass()
The default class that is specified to Object2Dom during marshalling and unmarshalling. Returns null if there is no default class.


Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.6.0)

E13403-07

Copyright © 1997, 2011, Oracle. All rights reserved.