public class BrowserController extends Object implements TreeExpansionListener, ReferralAuthenticationListener
Modifier and Type | Field and Description |
---|---|
static String |
ALL_OBJECTS_FILTER
The filter used to retrieve all the entries.
|
Constructor and Description |
---|
BrowserController(JTree tree,
LDAPConnectionPool cpool,
IconPool ipool)
Constructor of the BrowserController.
|
Modifier and Type | Method and Description |
---|---|
void |
addBrowserEventListener(BrowserEventListener l)
Add a BrowserEventListener to this controller.
|
TreePath |
addNodeUnderRoot(String nodeDn)
Add an LDAP suffix to this controller.
|
TreePath |
addSuffix(String suffixDn,
String parentSuffixDn)
Add an LDAP suffix to this controller.
|
void |
expandNode(BasicNode node)
Expands node.
|
int |
findChildNode(BasicNode parent,
String childDn)
Find a child node matching a given DN.
|
InitialLdapContext |
findConnectionForDisplayedEntry(BasicNode node)
Return the LDAP connection to search the displayed entry (which can be the
local or remote entry).
|
InitialLdapContext |
getConfigurationConnection()
Return the connection for accessing the directory configuration.
|
LDAPConnectionPool |
getConnectionPool()
Return the connection pool used by this controller.
|
String[] |
getContainerClasses()
Return the array of container classes for this controller.
|
String |
getDisplayAttribute()
Returns the attribute used to display the entry.
|
int |
getDisplayFlags()
Return the display flags.
|
String |
getFilter()
Returns the filter that is being used to search the entries.
|
boolean |
getFollowReferrals()
Return true if this controller follows referrals.
|
static boolean |
getHasSubOrdinates(CustomSearchResult entry)
Returns whether the entry has subordinates or not.
|
static boolean |
getHasSubOrdinates(SearchResult entry)
Returns whether the entry has subordinates or not.
|
IconPool |
getIconPool()
Return the icon pool used by this controller.
|
int |
getMaxChildren()
Return the maximum number of children to display.
|
BrowserNodeInfo |
getNodeInfoFromPath(TreePath path)
Find the BrowserNodeInfo associated to a TreePath and returns
the describing IBrowserNodeInfo.
|
NumSubordinateHacker |
getNumSubordinateHacker()
NUMSUBORDINATE HACK
Make the hacker public so that RefreshTask can use it.
|
int |
getQueueSize()
Returns the size of the queue containing the different tasks.
|
static String[] |
getReferral(SearchResult entry)
Returns the value of the 'ref' attribute.
|
JTree |
getTree()
Return the JTree controlled by this controller.
|
DefaultTreeModel |
getTreeModel()
The tree model created by the controller and assigned
to the JTree.
|
InitialLdapContext |
getUserDataConnection()
Return the connection for accessing the directory user data.
|
boolean |
hasSuffix(String suffixDn)
Tells whether the given suffix is in the tree or not.
|
boolean |
isAttributeNameShown()
Says whether we are showing the attribute name or not.
|
boolean |
isAutomaticExpand()
Returns whether we are in automatic expand mode.
|
boolean |
isConfigurationNode(BasicNode node)
Returns whether a given node is a configuration node or not.
|
boolean |
isShowContainerOnly()
Return true if only container entries are displayed.
|
boolean |
isSorted()
Return true if entries are displayed sorted.
|
boolean |
nodeIsExpanded(BasicNode node)
Returns true if the node is expanded.
|
void |
notifyAuthDataChanged()
Notify this controller that authentication data have changed in the
connection pool.
|
TreePath |
notifyEntryAdded(BrowserNodeInfo parentInfo,
String newEntryDn)
Notify this controller that an entry has been added.
|
void |
notifyEntryChanged(BrowserNodeInfo nodeInfo)
Notify this controller that an entry has changed.
|
TreePath |
notifyEntryDeleted(BrowserNodeInfo nodeInfo)
Notify this controller that a entry has been deleted.
|
TreePath |
removeAllUnderRoot()
Remove all the suffixes.
|
void |
setAutomaticExpand(boolean automaticExpand)
Sets the automatic expand mode.
|
void |
setConnections(ServerDescriptor server,
InitialLdapContext ctxConfiguration,
InitialLdapContext ctxUserData)
Set the connection for accessing the directory.
|
void |
setContainerClasses(String[] containerClasses)
Set the list of container classes and calls startRefresh().
|
void |
setDisplayAttribute(String displayAttribute)
Set the display attribute (the attribute that will be used to retrieve
the string that will appear in the tree when rendering the node).
|
void |
setDisplayFlags(int flags)
Set the display flags and call startRefresh().
|
void |
setFilter(String filter)
Sets the filter that must be used by the browser controller to retrieve
entries.
|
void |
setFollowReferrals(boolean followReferrals)
Enable/display the following of referrals.
|
void |
setInspectedNode(BrowserNodeInfo node)
Sets which is the inspected node.
|
void |
setMaxChildren(int maxChildren)
Sets the maximum number of children to display for a node.
|
void |
setNumSubordinateHacker(NumSubordinateHacker h)
NUMSUBORDINATE HACK
Set the hacker.
|
void |
setShowContainerOnly(boolean showContainerOnly)
Enable or disable container display and call startRefresh().
|
void |
setSorted(boolean sorted)
Enable/disable entry sort.
|
void |
startRefresh(BrowserNodeInfo nodeInfo)
Start a refresh from the specified node.
|
void |
treeCollapsed(TreeExpansionEvent event)
For BrowserController private use.
|
void |
treeExpanded(TreeExpansionEvent event)
For BrowserController private use.
|
public static final String ALL_OBJECTS_FILTER
public BrowserController(JTree tree, LDAPConnectionPool cpool, IconPool ipool)
tree
- the tree that must be updated.cpool
- the connection pool object that will provide the connections
to be used.ipool
- the icon pool to be used to retrieve the icons that will be
used to render the nodes in the tree.public void setConnections(ServerDescriptor server, InitialLdapContext ctxConfiguration, InitialLdapContext ctxUserData) throws NamingException
server
- the server descriptor.ctxConfiguration
- the connection to be used to retrieve the data in
the configuration base DNs.ctxUserData
- the connection to be used to retrieve the data in the
user base DNs.NamingException
- if an error occurs.public InitialLdapContext getConfigurationConnection()
public InitialLdapContext getUserDataConnection()
public JTree getTree()
public LDAPConnectionPool getConnectionPool()
public IconPool getIconPool()
public boolean hasSuffix(String suffixDn) throws IllegalArgumentException
suffixDn
- the DN of the suffix to be analyzed.true
if the provided String is the DN of a suffix
and false
otherwise.IllegalArgumentException
- if a node with the given dn exists but
is not a suffix node.public TreePath addSuffix(String suffixDn, String parentSuffixDn) throws IllegalArgumentException
suffixDn
- the DN of the suffix.parentSuffixDn
- the DN of the parent suffix (or null
if
there is no parent DN).IllegalArgumentException
- if a node with the given dn exists.public TreePath addNodeUnderRoot(String nodeDn)
nodeDn
- the DN of the node to be added.public TreePath removeAllUnderRoot()
public int getDisplayFlags()
public void setDisplayFlags(int flags)
flags
- the display flags to be set.public void setDisplayAttribute(String displayAttribute)
displayAttribute
- the display attribute to be used.public String getDisplayAttribute()
public boolean isAttributeNameShown()
true
if we are showing the attribute name and
false
otherwise.public void setMaxChildren(int maxChildren)
maxChildren
- the maximum number of children to display for a node.public int getMaxChildren()
public boolean getFollowReferrals()
true
if this controller follows referrals and
false
otherwise.public void setFollowReferrals(boolean followReferrals) throws NamingException
followReferrals
- whether to follow referrals or not.NamingException
- if there is an error updating the request controls
of the internal connections.public boolean isSorted()
true
if entries are displayed sorted and
false
otherwise.public void setSorted(boolean sorted) throws NamingException
sorted
- whether to sort the entries or not.NamingException
- if there is an error updating the request controls
of the internal connections.public boolean isShowContainerOnly()
true
if only container entries are displayed and
false
otherwise.public void setShowContainerOnly(boolean showContainerOnly)
showContainerOnly
- whether to display only containers or all the
entries.public BrowserNodeInfo getNodeInfoFromPath(TreePath path)
path
- the TreePath associated with the node we are searching.public String[] getContainerClasses()
public void setContainerClasses(String[] containerClasses)
containerClasses
- the lis of container classes.public NumSubordinateHacker getNumSubordinateHacker()
public void setNumSubordinateHacker(NumSubordinateHacker h)
h
- the NumSubordinateHacker.public void addBrowserEventListener(BrowserEventListener l)
l
- the listener to be added.public TreePath notifyEntryAdded(BrowserNodeInfo parentInfo, String newEntryDn)
parentInfo
- the parent node of the entry added.newEntryDn
- the dn of the entry to be added.public TreePath notifyEntryDeleted(BrowserNodeInfo nodeInfo)
nodeInfo
- the node to be deleted.public void notifyEntryChanged(BrowserNodeInfo nodeInfo)
nodeInfo
- the node that changed.public void notifyAuthDataChanged()
notifyAuthDataChanged
in interface ReferralAuthenticationListener
public void startRefresh(BrowserNodeInfo nodeInfo)
nodeInfo
- the node to be refreshed.public void treeExpanded(TreeExpansionEvent event)
treeExpanded
in interface TreeExpansionListener
event
- the tree expansion event.public void treeCollapsed(TreeExpansionEvent event)
treeCollapsed
in interface TreeExpansionListener
event
- the tree collapse event.public void setInspectedNode(BrowserNodeInfo node)
node
- the selected node.public DefaultTreeModel getTreeModel()
public void setFilter(String filter)
filter
- the LDAP filter.public String getFilter()
public boolean isConfigurationNode(BasicNode node)
node
- the node to analyze.true
if the node is a configuration node and
false
otherwise.public InitialLdapContext findConnectionForDisplayedEntry(BasicNode node) throws NamingException
node
- the node for which we want toe LDAP connection.NamingException
- if there is an error retrieving the connection.public int findChildNode(BasicNode parent, String childDn)
parent
- the parent node of the node that is being searched.childDn
- the DN of the entry that is being searched.public int getQueueSize()
public static boolean getHasSubOrdinates(SearchResult entry) throws NamingException
entry
- the entry to analyze.true
if the entry has subordinates according to the values
of hasSubordinates and numSubordinates, returns false
if none of
the attributes could be found.NamingException
- if an error occurs.public static boolean getHasSubOrdinates(CustomSearchResult entry)
entry
- the entry to analyze.true
if the entry has subordinates according to the values
of hasSubordinates and numSubordinates, returns false
if none of
the attributes could be found.public static String[] getReferral(SearchResult entry) throws NamingException
null
if the attribute is not present.entry
- the entry to analyze.null
if the attribute
could not be found.NamingException
- if an error occurs.public boolean nodeIsExpanded(BasicNode node)
node
- the node to analyze.true
if the node is expanded and false
otherwise.public void expandNode(BasicNode node)
node
- the node to expand.public boolean isAutomaticExpand()
true
if we are in automatic expand mode and
false
otherwise.public void setAutomaticExpand(boolean automaticExpand)
automaticExpand
- whether to expand automatically the nodes or not.Copyright © 2010-2016 ForgeRock AS. All Rights Reserved.