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

E13403-05

oracle.ide.model
Class NodeUtil

java.lang.Object
  extended by oracle.ide.model.NodeUtil

public final class NodeUtil
extends java.lang.Object

Utilities involving Nodes.


Nested Class Summary
static interface NodeUtil.NodeFilter
          A NodeFilter can be passed to the storeTimestamps(java.util.Map, java.util.Collection) method to control which timestamps are stored.
static class NodeUtil.ReloadMode
          Tailors the level of user interaction while reloading a Node.
 
Field Summary
static int RELOAD_PROMPTED
          Deprecated. 
static int RELOAD_PROMPTED_IF_DIRTY
          Deprecated. 
static int RELOAD_SILENTLY
          Deprecated. 
 
Method Summary
static java.util.WeakHashMap<Node,java.lang.Long> getTimeStampMap()
           
static void reloadBuffers(java.util.Collection<Node> nodes, boolean silentReload)
          Identical to reloadBuffers(java.util.Map, boolean) but reloads the node independently of the timestamp.
static void reloadBuffers(java.util.Collection<Node> nodes, java.util.Map<Node,java.lang.Long> timestampMap, int reloadMode, boolean manualReload)
          Deprecated. 
static void reloadBuffers(java.util.Map<Node,java.lang.Long> timestampMap)
          A convenience method for doing a silent reload.
static void reloadBuffers(java.util.Map<Node,java.lang.Long> timestampMap, boolean silentReload)
          This method reloads Node buffers by comparing timestamps stored in the map, Node, and on disk.
static void reloadBuffers(java.util.Map<Node,java.lang.Long> timestampMap, boolean silentReload, boolean manualReload)
          Deprecated. 
static void reloadBuffers(java.util.Map<Node,java.lang.Long> node2timestampMap, java.util.Set<NodeUtil.ReloadMode> reloadFlags)
          This method reloads Node buffers by comparing timestamps stored in the map, Node, and on disk.
static void reloadNodes(java.util.Collection<Node> nodesToBeReloaded, java.util.Set<NodeUtil.ReloadMode> reloadFlags)
          Reloads all Node buffers passed in.
static void runUnderReadLock(java.util.Collection<? extends Node> nodes, java.lang.Runnable r)
          Executes a Runnable while holding the read lock on the given nodes.
static void runUnderWriteLock(java.util.Collection<? extends Node> nodes, java.lang.Runnable r)
          Executes a Runnable while holding the write lock on the given nodes.
static void startReloading(boolean silentReload, boolean manualReload, boolean checkTimeStamp)
           
static void startReloading(java.util.Set<NodeUtil.ReloadMode> reloadFlags, boolean checkTimeStamp)
           
static void stopReloading()
           
static void storeAllTimestamps(java.util.Map<Node,java.lang.Long> timestampMap)
          Stores the timestamps for all Nodes in the NodeFactory's cache that are currently open.
static void storeAllTimestamps(java.util.Map<Node,java.lang.Long> timestampMap, NodeUtil.NodeFilter nodeFilter)
          Stores the timestamps for all Nodes in the NodeFactory's cache that are currently open.
static void storeTimestamps(java.util.Map<Node,java.lang.Long> timestampMap, java.util.Collection<Node> nodes)
           
static void storeTimestamps(java.util.Map<Node,java.lang.Long> timestampMap, java.util.Collection<Node> nodes, NodeUtil.NodeFilter nodeFilter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RELOAD_PROMPTED

@Deprecated
public static final int RELOAD_PROMPTED
Deprecated. 
Reload mode constant for reloading all nodes with a user prompt. Replaced with toggling off NodeUtil.ReloadMode.SILENT_RELOAD.

See Also:
ReloadMode}, Constant Field Values

RELOAD_PROMPTED_IF_DIRTY

@Deprecated
public static final int RELOAD_PROMPTED_IF_DIRTY
Deprecated. 
Reload mode constant for reloading nodes which are dirty with a user prompt, others silently.

See Also:
NodeUtil.ReloadMode.RELOAD_PROMPTED_IF_DIRTY, Constant Field Values

RELOAD_SILENTLY

@Deprecated
public static final int RELOAD_SILENTLY
Deprecated. 
Reload mode constant for reloading all nodes silently.

See Also:
NodeUtil.ReloadMode.SILENT_RELOAD, Constant Field Values
Method Detail

runUnderReadLock

public static void runUnderReadLock(java.util.Collection<? extends Node> nodes,
                                    java.lang.Runnable r)
Executes a Runnable while holding the read lock on the given nodes. To prevent deadlock, this method always acquires the locks in the same relative order.

The calling thread must not already hold the read or write lock on any of the Node instances, or it must hold the read or write lock on all of the Node instances. In other words, re-entrant locking of the same set of nodes is allowed.

The nodes being locked must all be instances of the same Node subclass. This is to prevent deadlock due to additional ordering constraints between different Node subclasses.

Parameters:
nodes - the Node instances to lock
r - the Runnable to be run while the locks are held
Throws:
java.lang.IllegalArgumentException - if the Collection contains null, the Runnable is null, or the Node instances are not all instances of the same Node subclass
java.lang.IllegalMonitorStateException - if the Node instances are in an invalid lock state on the calling thread

runUnderWriteLock

public static void runUnderWriteLock(java.util.Collection<? extends Node> nodes,
                                     java.lang.Runnable r)
Executes a Runnable while holding the write lock on the given nodes. To prevent deadlock, this method always acquires the locks in the same relative order.

The calling thread must not already hold the read or write lock on any of the Node instances, or it must hold the write lock on all of the Node instances. In other words, re-entrant locking of the same set of nodes is allowed.

The nodes being locked must all be instances of the same Node subclass. This is to prevent deadlock due to additional ordering constraints between different Node subclasses.

Parameters:
nodes - the Node instances to lock
r - the Runnable to be run while the locks are held
Throws:
java.lang.IllegalArgumentException - if the Collection contains null, the Runnable is null, or the Node instances are not all instances of the same Node subclass
java.lang.IllegalMonitorStateException - if the Node instances are in an invalid lock state on the calling thread

storeAllTimestamps

public static void storeAllTimestamps(java.util.Map<Node,java.lang.Long> timestampMap)
Stores the timestamps for all Nodes in the NodeFactory's cache that are currently open.

Parameters:
timestampMap - A Map of Node->Long. This method will fill in the Map. The Long represents the current value returned by URLFileSystem.lastModified(java.net.URL) for the Node's URL.
Throws:
java.lang.NullPointerException - if the specified timestampMap is null.

storeAllTimestamps

public static void storeAllTimestamps(java.util.Map<Node,java.lang.Long> timestampMap,
                                      NodeUtil.NodeFilter nodeFilter)
Stores the timestamps for all Nodes in the NodeFactory's cache that are currently open.

Parameters:
timestampMap - A Map of Node->Long. This method will fill in the Map. The Long represents the current value returned by URLFileSystem.lastModified(java.net.URL) for the Node's URL.
nodeFilter - A node filter controlling which timestamps are stored. Any nodes which do not pass this filter will be excluded from the resulting timestamp map.
Throws:
java.lang.NullPointerException - if the specified timestampMap is null.

storeTimestamps

public static void storeTimestamps(java.util.Map<Node,java.lang.Long> timestampMap,
                                   java.util.Collection<Node> nodes)
Parameters:
timestampMap - A Map of Node->Long. This method will fill in the Map. The Long represents the current value returned by URLFileSystem.lastModified(java.net.URL) for the Node's URL.
nodes - A Collection of Node objects whose timestamps will be stored in the timestampMap. Only Nodes whose Node.isOpen() method returns true will have their timestamp stored in the timestampMap; otherwise, if the Node is not open, its timestamp will be removed from the Map. Any timestamp in the map not corresponding to any Node in the Collection will remain. This allows multiple calls to storeTimestamps with different Collections of Nodes.
Throws:
java.lang.NullPointerException - if any of the parameters are null.

storeTimestamps

public static void storeTimestamps(java.util.Map<Node,java.lang.Long> timestampMap,
                                   java.util.Collection<Node> nodes,
                                   NodeUtil.NodeFilter nodeFilter)
Parameters:
timestampMap - A Map of Node->Long. This method will fill in the Map. The Long represents the current value returned by URLFileSystem.lastModified(java.net.URL) for the Node's URL.
nodes - A Collection of Node objects whose timestamps will be stored in the timestampMap. Only Nodes which pass the given node filter will have their timestamp stored in the timestampMap; otherwise, if the Node is not accepted, its timestamp will be removed from the Map. Any timestamp in the map not corresponding to any Node in the Collection will remain. This allows multiple calls to storeTimestamps with different Collections of Nodes.
nodeFilter - A node filter controlling which timestamps are stored. Any nodes which do not pass this filter will be excluded from the resulting timestamp map.
Throws:
java.lang.NullPointerException - if any of the parameters are null.

reloadBuffers

public static void reloadBuffers(java.util.Map<Node,java.lang.Long> timestampMap)
A convenience method for doing a silent reload.

See Also:
#reloadBuffers(Map, Set)}

reloadBuffers

public static void reloadBuffers(java.util.Map<Node,java.lang.Long> timestampMap,
                                 boolean silentReload)
This method reloads Node buffers by comparing timestamps stored in the map, Node, and on disk. This method is synchronous -- i.e. it blocks until all reloading is finished.

Parameters:
timestampMap - A Map of Node->Long. This must be the same map that was passed to storeTimestamps(java.util.Map, java.util.Collection). This method will reload the buffers of all the Nodes in the timestampMap that are open and have currently have a different on-disk timestamp than what is stored in the timestampMap.
silentReload - Pass true if reloading should proceed without prompting the user whenever possible. Pass false if reloading should always prompt the user. Even when true is passed, the UI would still end up prompting the user if the Node buffer was modified within the IDE and externally at the same time.

reloadBuffers

@Deprecated
public static void reloadBuffers(java.util.Map<Node,java.lang.Long> timestampMap,
                                            boolean silentReload,
                                            boolean manualReload)
Deprecated. 

This method reloads Node buffers by comparing timestamps stored in the map, Node, and on disk. This method is synchronous -- i.e. it blocks until all reloading is finished. Replaced with reloadBuffers(Map, Set).

Parameters:
timestampMap - A Map of Node->Long. This must be the same map that was passed to storeTimestamps(java.util.Map, java.util.Collection). This method will reload the buffers of all the Nodes in the timestampMap that are open and have currently have a different on-disk timestamp than what is stored in the timestampMap.
silentReload - Pass true if reloading should proceed without prompting the user whenever possible. Pass false if reloading should always prompt the user. Even when true is passed, the UI would still end up prompting the user if the Node buffer was modified within the IDE and externally at the same time.
manualReload - Pass true if reloading is being requested manually (eg, from a menu or explicit user action); false otherwise.

reloadBuffers

public static void reloadBuffers(java.util.Collection<Node> nodes,
                                 boolean silentReload)
Identical to reloadBuffers(java.util.Map, boolean) but reloads the node independently of the timestamp.

Parameters:
nodes - a collection of nodes to reload
silentReload - Pass true if reloading should proceed without prompting the user whenever possible. Pass false if reloading should always prompt the user. Even when true is passed, the UI would still end up prompting the user if the Node buffer was modified within the IDE and externally at the same time.
See Also:
reloadBuffers(java.util.Map)

reloadBuffers

@Deprecated
public static void reloadBuffers(java.util.Collection<Node> nodes,
                                            java.util.Map<Node,java.lang.Long> timestampMap,
                                            int reloadMode,
                                            boolean manualReload)
Deprecated. 

This method reloads Node buffers by comparing timestamps stored in the map, Node, and on disk. This method is synchronous -- i.e. it blocks until all reloading is finished. Replaced with reloadNodes(Collection, Set).

Parameters:
nodes - a collection of nodes to reload
timestampMap - A Map of Node->Long. This must be the same map that was passed to storeTimestamps(java.util.Map, java.util.Collection). This method will reload the buffers of all the Nodes in the timestampMap that are open and have currently have a different on-disk timestamp than what is stored in the timestampMap.
reloadMode - A value identifying the mode for buffer reloading. This is one of RELOAD_PROMPTED, RELOAD_PROMPTED_IF_DIRTY and RELOAD_SILENTLY.
manualReload - Pass true if reloading is being requested manually (eg, from a menu or explicit user action); false otherwise.

reloadNodes

public static void reloadNodes(java.util.Collection<Node> nodesToBeReloaded,
                               java.util.Set<NodeUtil.ReloadMode> reloadFlags)
Reloads all Node buffers passed in. This method executes synchronously, and will block until all Nodes have been reloaded. Method is thread safe in silent mode only. If not called from the event thread, ensure that the only reload flag set is NodeUtil.ReloadMode.SILENT_RELOAD.

Parameters:
nodesToBeReloaded - a collection of Nodes all of which need to be reloaded.
reloadFlags - a set of NodeUtil.ReloadModes that controls user interaction while reloading.
Throws:
java.lang.IllegalArgumentException - if the method is called off the event thread and NodeUtil.ReloadMode.SILENT_RELOAD was not the only flag set.
java.lang.NullPointerException - if nodesToBeReloaded or reloadFlags are null.
See Also:
NodeUtil.ReloadMode

reloadBuffers

public static void reloadBuffers(java.util.Map<Node,java.lang.Long> node2timestampMap,
                                 java.util.Set<NodeUtil.ReloadMode> reloadFlags)
This method reloads Node buffers by comparing timestamps stored in the map, Node, and on disk. This method is synchronous: it blocks until all reloading is finished.

Method is thread safe in silent mode only. If not called from the event thread, ensure that the only reload flag set is NodeUtil.ReloadMode.SILENT_RELOAD.

Parameters:
node2timestampMap - A Map of Node->Long. This must be the same map that was passed to NodeUtil#storeAllTimestamps(). This method will reload the buffers of all the Nodes in the node2timestampMap that are open and have currently have a different on-disk timestamp than what is stored in the node2timestampMap.
reloadFlags - a set of NodeUtil.ReloadModes that tailors reload behavior.
Throws:
java.lang.IllegalArgumentException - if the method is called off the event thread while NodeUtil.ReloadMode.SILENT_RELOAD was not the only flag set.
java.lang.NullPointerException - if nodesToBeReloaded or reloadFlags are null.
See Also:
NodeUtil.ReloadMode

startReloading

public static void startReloading(boolean silentReload,
                                  boolean manualReload,
                                  boolean checkTimeStamp)

startReloading

public static void startReloading(java.util.Set<NodeUtil.ReloadMode> reloadFlags,
                                  boolean checkTimeStamp)

stopReloading

public static void stopReloading()

getTimeStampMap

public static java.util.WeakHashMap<Node,java.lang.Long> getTimeStampMap()

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

E13403-05

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