Class ZooInspectorManagerImpl
java.lang.Object
org.apache.zookeeper.inspector.manager.ZooInspectorManagerImpl
- All Implemented Interfaces:
ZooInspectorManager
,ZooInspectorNodeManager
,ZooInspectorNodeTreeManager
,ZooInspectorReadOnlyManager
A default implementation of
ZooInspectorManager
for connecting to
zookeeper instances-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
A Watcher which will re-add itself every time an event is fired -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The key used for the authentication data in the connection properties filestatic final String
The key used for the authentication scheme in the connection properties filestatic final String
The key used for the connect string in the connection properties fileprotected boolean
static final String
The key used for the data encryption manager in the connection properties filestatic final String
The key used for the session timeout in the connection properties file -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addWatchers
(Collection<String> selectedNodes, NodeListener nodeListener) boolean
connect
(Properties connectionProps) boolean
createNode
(String parent, String nodeName) boolean
deleteNode
(String nodePath) boolean
getChildren
(String nodePath) getNodeMeta
(String nodePath) int
getNumChildren
(String nodePath) loadNodeViewersFile
(File selectedFile) void
removeWatchers
(Collection<String> selectedNodes) void
void
saveNodeViewersFile
(File selectedFile, List<String> nodeViewersClassNames) boolean
void
setDefaultNodeViewerConfiguration
(List<String> nodeViewersClassNames) void
setLastConnectionProps
(Properties connectionProps)
-
Field Details
-
CONNECT_STRING
The key used for the connect string in the connection properties file- See Also:
-
SESSION_TIMEOUT
The key used for the session timeout in the connection properties file- See Also:
-
DATA_ENCRYPTION_MANAGER
The key used for the data encryption manager in the connection properties file- See Also:
-
AUTH_SCHEME_KEY
The key used for the authentication scheme in the connection properties file- See Also:
-
AUTH_DATA_KEY
The key used for the authentication data in the connection properties file- See Also:
-
connected
protected boolean connected
-
-
Constructor Details
-
ZooInspectorManagerImpl
- Throws:
IOException
- - thrown if the default connection settings cannot be loaded
-
-
Method Details
-
connect
- Specified by:
connect
in interfaceZooInspectorManager
- Returns:
- true if successfully connected
-
disconnect
public boolean disconnect()- Specified by:
disconnect
in interfaceZooInspectorManager
- Returns:
- true if successfully disconnected
-
getChildren
- Specified by:
getChildren
in interfaceZooInspectorReadOnlyManager
- Parameters:
nodePath
- - the path to the node whose children to retrieve- Returns:
- a
List
of the children of the node
-
getData
- Specified by:
getData
in interfaceZooInspectorReadOnlyManager
- Parameters:
nodePath
- - the path to the node whose data is to be retrieved- Returns:
- the data for the node
-
getACLs
- Specified by:
getACLs
in interfaceZooInspectorReadOnlyManager
- Parameters:
nodePath
- - the path to the node whose ACLs are to be retrieved- Returns:
- the ACLs set on the node
-
getNodeMeta
- Specified by:
getNodeMeta
in interfaceZooInspectorReadOnlyManager
- Parameters:
nodePath
- - the path to the node whose metadata is to be retrieved- Returns:
- the metaData for the node
-
getNumChildren
- Specified by:
getNumChildren
in interfaceZooInspectorReadOnlyManager
- Parameters:
nodePath
- - the path to the node to parent node- Returns:
- the number of children of the node
-
createNode
- Specified by:
createNode
in interfaceZooInspectorNodeTreeManager
- Parameters:
parent
- - the parent node path for the node to addnodeName
- - the name of the new node- Returns:
- true if the node was successfully created
-
deleteNode
- Specified by:
deleteNode
in interfaceZooInspectorNodeTreeManager
- Parameters:
nodePath
- - the path to the node to delete- Returns:
- true if the node was successfully deleted
-
setData
- Specified by:
setData
in interfaceZooInspectorNodeManager
- Parameters:
nodePath
- - the path to the node on which to set the datadata
- - the data to set on the this node- Returns:
- true if the data for the node was successfully updated
-
getConnectionPropertiesTemplate
- Specified by:
getConnectionPropertiesTemplate
in interfaceZooInspectorManager
- Returns:
- a
Pair
containing the following:- a
Map
of property keys to list of possible values. If the list size is 1 the value is taken to be the default value for aJTextField
. If the list size is greater than 1, the values are taken to be the possible options to show in aJComboBox
with the first selected as default. - a
Map
of property keys to the label to show on the UI
- a
-
addWatchers
- Specified by:
addWatchers
in interfaceZooInspectorManager
- Parameters:
selectedNodes
- - the nodes to add the watcher tonodeListener
- - the node listener for this watcher
-
removeWatchers
- Specified by:
removeWatchers
in interfaceZooInspectorManager
- Parameters:
selectedNodes
- - the nodes to remove the watchers from
-
loadNodeViewersFile
- Specified by:
loadNodeViewersFile
in interfaceZooInspectorManager
- Parameters:
selectedFile
- - the file to load which contains the node viewers configuration- Returns:
- nodeViewers - the class names of the node viewers from the configuration
- Throws:
IOException
- - if the configuration file cannot be loaded
-
saveDefaultConnectionFile
- Specified by:
saveDefaultConnectionFile
in interfaceZooInspectorManager
- Parameters:
props
- - the properties to use as the default connection settings- Throws:
IOException
- - if the default configuration file cannot be saved
-
saveNodeViewersFile
public void saveNodeViewersFile(File selectedFile, List<String> nodeViewersClassNames) throws IOException - Specified by:
saveNodeViewersFile
in interfaceZooInspectorManager
- Parameters:
selectedFile
- - the file to save the configuration tonodeViewersClassNames
- - the class names of the node viewers- Throws:
IOException
- - if the configuration file cannot be saved
-
setDefaultNodeViewerConfiguration
public void setDefaultNodeViewerConfiguration(List<String> nodeViewersClassNames) throws IOException - Specified by:
setDefaultNodeViewerConfiguration
in interfaceZooInspectorManager
- Parameters:
nodeViewersClassNames
- - the class names of the node viewers- Throws:
IOException
- - if the default configuration file cannot be loaded
-
getDefaultNodeViewerConfiguration
- Specified by:
getDefaultNodeViewerConfiguration
in interfaceZooInspectorManager
- Returns:
- nodeViewers - the class names of the node viewers from the configuration
- Throws:
IOException
- - if the default configuration file cannot be loaded
-
getLastConnectionProps
- Specified by:
getLastConnectionProps
in interfaceZooInspectorManager
- Returns:
- last connection Properties - the connection properties last used to connect to the zookeeeper instance
-
setLastConnectionProps
- Specified by:
setLastConnectionProps
in interfaceZooInspectorManager
- Parameters:
connectionProps
- - the connection properties last used to connect to the zookeeeper instance
-