Extension SDK

oracle.jdeveloper.cm.dt
Class ConnectionNode

java.lang.Object
  extended byoracle.ide.IdeSubject
      extended byoracle.jdeveloper.cm.dt.ConnectionNode
All Implemented Interfaces:
Category, java.lang.Comparable, ConnectionBrowsable, Data, Dirtyable, Displayable, Document, Element, Folder, LazyLoadable, Locatable, Node, oracle.jdeveloper.cm.dt.browser.Refreshable, Subject
Direct Known Subclasses:
DatabaseConnectionNode, Oc4jConnectionNode

public class ConnectionNode
extends IdeSubject
implements Folder, ConnectionBrowsable, Node, java.lang.Comparable, oracle.jdeveloper.cm.dt.browser.Refreshable

The ConnectionNode class is the base class for all representations of Database Connections

This class extends DefaultNode to handle support for file-based nodes.

The URL format for the Connections system is: ide:connections//[Catalog]/[User]@[ConnectionName]:[ObjectType]:[ObjectName]

So a connection node by itself is ide:connections//[ConnectionName]

<

See Also:
oracle.jdeveloper.model.Node,


Field Summary
 
Fields inherited from interface oracle.ide.addin.Subject
OBJECT_MODIFIED
 
Fields inherited from interface oracle.ide.model.Category
UNDEFINED
 
Constructor Summary
ConnectionNode()
          Constructor.
ConnectionNode(java.net.URL url)
          Constructor.
 
Method Summary
 boolean add(Element element)
          Appends a child Element to the end of the Folder.
 boolean canAdd(Element element)
          Other classes can call this method to determine whether the given Element can be added to the Folder.
 boolean canRemove(Element element)
          Other classes can call this method to determine whether the specified Element can be removed from this Folder.
 void close()
          Closes the ConnectionBrowsable interface.
 int compareTo(java.lang.Object o)
           
 boolean containsChild(Element child)
          Returns true if the folder contains the specified child Element; returns false otherwise.
 void ensureOpen()
           
 Attributes getAttributes()
          This method returns an Attributes object that encodes the attributes of the Element.
 int getCategory()
          Get the bit field identifying the different categories this data node falls under.
 java.util.Iterator getChildren()
          Return the list of children, delegate to the active browser if one is available, creating it if necessary.
 java.lang.Object getClientProperty(java.lang.Object key)
          Client Properties Support.
 oracle.jdeveloper.cm.dt.browser.ConnectionBrowser getConnectionBrowser()
          Returns the currently in use ConnectionBrowser
 ConnectionDescriptor getConnectionDescriptor()
           
 java.lang.String getConnectionName()
          Returns the name of this connection
 java.lang.Object getData()
          Returns the data element associated with this Data.
 javax.swing.Icon getIcon()
          Returns the Icon for this node instance
 java.io.InputStream getInputStream()
          Gets an InputStream that can be used to read the contents of this object.
 java.lang.String getLongLabel()
          Returns a long label that can be displayed to the user.
 java.lang.String getShortLabel()
          Gets a short label for display purpose.
 long getTimestamp()
          Returns the timestamp associated with the Document, which indicates the time at which the document was last modified.
 java.lang.String getToolTipText()
          Returns the text of the tooltip for this node instance
 java.net.URL getURL()
          Returns the URL that identifies this Locatable.
 boolean isConnected()
          Is this ConnectionBrowsable connected by a ConnectionBrowser
 boolean isDirty()
          Finds out if the node has pending changes that have not been saved to persistent store.
 boolean isNew()
          Returns true if the document's data has never been saved.
 boolean isOpen()
          Returns true if the object's data has already been loaded.
protected  boolean isOpenThreaded()
          Indicates whether open() should be performed on another thread (with a dialog shown allowing the user to cancel).
 boolean isReadOnly()
          Returns true if the document is read-only.
 void markDirty(boolean dirty)
          Marks the data with the specified dirty state.
 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.
 void open()
          Open the connection (connect via the ConnectionBrowser)
 void putClientProperty(java.lang.Object key, java.lang.Object value)
          Client Properties Support.
 void refresh()
           
 boolean remove(Element element)
          Removes the specified child Element.
 void removeAll()
          Removes all children from the folder.
 void reopen()
           
 void save(boolean shallow)
          Saves the contents of the document.
 void setConnected(boolean state)
          Sets the flag stating this ConnectionBrowsable is currently connected via a ConnectionBrowser
 void setConnectionBrowser(oracle.jdeveloper.cm.dt.browser.ConnectionBrowser newConnectionBrowser)
          Sets the currently used ConnectionBrowser instance for this ConnectionBrowsable interface.
 void setConnectionDescriptor(ConnectionDescriptor desc)
           
 void setConnectionName(java.lang.String connectionName)
          Sets the name of the ConnectionManager connection name
 void setURL(java.net.URL url)
          Sets the URL associated with this Locatable.
 int size()
          Returns the current number of children in the folder.
 
Methods inherited from class oracle.ide.IdeSubject
attach, copy, detach, getObservers, notifyObservers, setObservers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.ide.model.Displayable
toString
 
Methods inherited from interface oracle.ide.addin.Subject
attach, detach, notifyObservers
 

Constructor Detail

ConnectionNode

public ConnectionNode(java.net.URL url)
Constructor.

Parameters:
url - unique url identifying this document.

ConnectionNode

public ConnectionNode()
Constructor.

Method Detail

getIcon

public javax.swing.Icon getIcon()
Returns the Icon for this node instance

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

getShortLabel

public java.lang.String getShortLabel()
Gets a short label for display purpose.

Specified by:
getShortLabel in interface Displayable
Returns:
a short descriptive label. Usually just the file name.

getToolTipText

public java.lang.String getToolTipText()
Returns the text of the tooltip for this node instance

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

getConnectionName

public java.lang.String getConnectionName()
Description copied from interface: ConnectionBrowsable
Returns the name of this connection

Specified by:
getConnectionName in interface ConnectionBrowsable

setConnectionName

public void setConnectionName(java.lang.String connectionName)
Description copied from interface: ConnectionBrowsable
Sets the name of the ConnectionManager connection name

Specified by:
setConnectionName in interface ConnectionBrowsable

setConnectionDescriptor

public void setConnectionDescriptor(ConnectionDescriptor desc)

getConnectionDescriptor

public ConnectionDescriptor getConnectionDescriptor()

isDirty

public boolean isDirty()
Finds out if the node has pending changes that have not been saved to persistent store.

Specified by:
isDirty in interface Dirtyable
Returns:
true if the node has been recently modified.

getConnectionBrowser

public oracle.jdeveloper.cm.dt.browser.ConnectionBrowser getConnectionBrowser()
Description copied from interface: ConnectionBrowsable
Returns the currently in use ConnectionBrowser

Specified by:
getConnectionBrowser in interface ConnectionBrowsable
Returns:
oracle.jdeveloper.cm.dt.browser.ConnectionBrowser

setConnectionBrowser

public void setConnectionBrowser(oracle.jdeveloper.cm.dt.browser.ConnectionBrowser newConnectionBrowser)
Description copied from interface: ConnectionBrowsable
Sets the currently used ConnectionBrowser instance for this ConnectionBrowsable interface.

Specified by:
setConnectionBrowser in interface ConnectionBrowsable
See Also:
ConnectionBrowser, ConnectionBrowsable

isConnected

public boolean isConnected()
Description copied from interface: ConnectionBrowsable
Is this ConnectionBrowsable connected by a ConnectionBrowser

Specified by:
isConnected in interface ConnectionBrowsable

setConnected

public void setConnected(boolean state)
Description copied from interface: ConnectionBrowsable
Sets the flag stating this ConnectionBrowsable is currently connected via a ConnectionBrowser

Specified by:
setConnected in interface ConnectionBrowsable

open

public void open()
Open the connection (connect via the ConnectionBrowser)

Specified by:
open in interface Document

close

public void close()
Description copied from interface: ConnectionBrowsable
Closes the ConnectionBrowsable interface.

Specified by:
close in interface ConnectionBrowsable

refresh

public void refresh()
Specified by:
refresh in interface oracle.jdeveloper.cm.dt.browser.Refreshable

reopen

public void reopen()

add

public boolean add(Element element)
Description copied from interface: Folder
Appends a child Element to the end of the Folder.

Specified by:
add in interface Folder

remove

public boolean remove(Element element)
Description copied from interface: Folder
Removes the specified child Element. If the child object appears more than once, only the first instance is removed.

Specified by:
remove in interface Folder
Parameters:
element - The child object to remove.

canRemove

public boolean canRemove(Element element)
Description copied from interface: Folder
Other classes can call this method to determine whether the specified Element can be removed from this Folder.

Specified by:
canRemove in interface Folder
Parameters:
element - the Element that is about to be removed from this Folder.
Returns:
true if the specified Element can be removed from this Folder; false if the Element cannot be removed.

canAdd

public boolean canAdd(Element element)
Description copied from interface: Folder
Other classes can call this method to determine whether the given Element can be added to the Folder.

Specified by:
canAdd in interface Folder
Parameters:
element - the Element that is about to be added to this Folder.
Returns:
true if the specified Element can be added to this Folder; false if the Element cannot be added.

containsChild

public boolean containsChild(Element child)
Description copied from interface: Folder
Returns true if the folder contains the specified child Element; returns false otherwise.

Specified by:
containsChild in interface Folder

size

public int size()
Description copied from interface: Folder
Returns the current number of children in the folder.

Specified by:
size in interface Folder

removeAll

public void removeAll()
Description copied from interface: Folder
Removes all children from the folder.

Specified by:
removeAll in interface Folder

getLongLabel

public java.lang.String getLongLabel()
Description copied from interface: Displayable
Returns a long label that can be displayed to the user. Generally, the value of the returned String is considered translatable and should therefore be placed in an appropriate resource file. The long label differs from the short label essentially on length. Usually the long label will only be shown on-demand and in places where horizontal space is more available. Examples are the status bar and tooltips.

Specified by:
getLongLabel in interface Displayable
Returns:
a long descriptive label of the Displayable that can be shown to the user.

getURL

public java.net.URL getURL()
Description copied from interface: Locatable
Returns the URL that identifies this Locatable. Parts of the IDE will use the value of this URL as a hash key for caching UI components for this Locatable. Therefore, URL uniqueness is important.

Specified by:
getURL in interface Locatable
Returns:
The URL identifying this Locatable.

setURL

public void setURL(java.net.URL url)
Description copied from interface: Locatable
Sets the URL associated with this Locatable. It is important that the URL only be changed when the Locatable has just been created or when all caches keyed on the previous URL can also be updated.

Specified by:
setURL in interface Locatable
Parameters:
url - The URL to set.

getData

public java.lang.Object getData()
Description copied from interface: Data
Returns the data element associated with this Data. The getData() method provides a standard means for getting the data element whether or not it is same object as its Element object.

Specified by:
getData in interface Data
Returns:
the data object associated with this Data instance.

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
Returns:
true if this Element may contain child Elements.

getChildren

public java.util.Iterator getChildren()
Return the list of children, delegate to the active browser if one is available, creating it if necessary.

Specified by:
getChildren in interface Element
Returns:
java.util.Iterator

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

save

public void save(boolean shallow)
Description copied from interface: Document
Saves the contents of the document.

Specified by:
save in interface Document
Parameters:
shallow - The value of this parameter only matters if the Document is also a Container. If shallow is true, children should not be saved; if shallow is false, children should also be saved.

isNew

public boolean isNew()
Description copied from interface: Document
Returns true if the document's data has never been saved.

Specified by:
isNew in interface Document
Returns:
true if the document's data has never been saved.

isOpen

public boolean isOpen()
Description copied from interface: LazyLoadable
Returns true if the object's data has already been loaded.

Specified by:
isOpen in interface LazyLoadable

isReadOnly

public boolean isReadOnly()
Description copied from interface: Document
Returns true if the document is read-only.

Specified by:
isReadOnly in interface Document

getTimestamp

public long getTimestamp()
Description copied from interface: Document
Returns the timestamp associated with the Document, which indicates the time at which the document was last modified. The returned long is expressed in milliseconds since 00:00:00 GMT Jan 1, 1970.

Specified by:
getTimestamp in interface Document
Returns:
the Document's time stamp.

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Description copied from interface: Document
Gets an InputStream that can be used to read the contents of this object.

Specified by:
getInputStream in interface Document
Returns:
an InputStream, or null if the document has no contents.
Throws:
java.io.IOException - if a security manager exists and its checkRead method denies read access.

markDirty

public void markDirty(boolean dirty)
Description copied from interface: Dirtyable
Marks the data with the specified dirty state. This method is called markDirty(...) instead of setDirty(...) so that the JavaBeans Introspector will not mistakenly identify "dirty" as a JavaBean property.

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

getCategory

public int getCategory()
Description copied from interface: Category
Get the bit field identifying the different categories this data node falls under.

Specified by:
getCategory in interface Category
Returns:
the category types.

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

ensureOpen

public void ensureOpen()

getClientProperty

public java.lang.Object getClientProperty(java.lang.Object key)
Client Properties Support. Gets a client property already assigned to this connection node.


putClientProperty

public void putClientProperty(java.lang.Object key,
                              java.lang.Object value)
Client Properties Support. Sets a client property already assigned to this connection node.

Parameters:
key - The key or name of the property
value - The value of the property

isOpenThreaded

protected boolean isOpenThreaded()
Indicates whether open() should be performed on another thread (with a dialog shown allowing the user to cancel). By default, Connection Nodes are not opened on another thread, but subclasses can override this method if the open() operation could potentially be a lengthy operation.


Extension SDK

 

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