Class ZooInspectorManagerImpl
- java.lang.Object
-
- org.apache.zookeeper.inspector.manager.ZooInspectorManagerImpl
-
- All Implemented Interfaces:
ZooInspectorManager,ZooInspectorNodeManager,ZooInspectorNodeTreeManager,ZooInspectorReadOnlyManager
public class ZooInspectorManagerImpl extends java.lang.Object implements ZooInspectorManager
A default implementation ofZooInspectorManagerfor connecting to zookeeper instances
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classZooInspectorManagerImpl.NodeWatcherA Watcher which will re-add itself every time an event is fired
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringAUTH_DATA_KEYThe key used for the authentication data in the connection properties filestatic java.lang.StringAUTH_SCHEME_KEYThe key used for the authentication scheme in the connection properties filestatic java.lang.StringCONNECT_STRINGThe key used for the connect string in the connection properties fileprotected booleanconnectedstatic java.lang.StringDATA_ENCRYPTION_MANAGERThe key used for the data encryption manager in the connection properties filestatic java.lang.StringSESSION_TIMEOUTThe key used for the session timeout in the connection properties file
-
Constructor Summary
Constructors Constructor Description ZooInspectorManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddWatchers(java.util.Collection<java.lang.String> selectedNodes, NodeListener nodeListener)booleanconnect(java.util.Properties connectionProps)booleancreateNode(java.lang.String parent, java.lang.String nodeName)booleandeleteNode(java.lang.String nodePath)booleandisconnect()java.util.List<java.util.Map<java.lang.String,java.lang.String>>getACLs(java.lang.String nodePath)java.util.List<java.lang.String>getChildren(java.lang.String nodePath)Pair<java.util.Map<java.lang.String,java.util.List<java.lang.String>>,java.util.Map<java.lang.String,java.lang.String>>getConnectionPropertiesTemplate()java.lang.StringgetData(java.lang.String nodePath)java.util.List<java.lang.String>getDefaultNodeViewerConfiguration()java.util.PropertiesgetLastConnectionProps()java.util.Map<java.lang.String,java.lang.String>getNodeMeta(java.lang.String nodePath)intgetNumChildren(java.lang.String nodePath)java.util.List<java.lang.String>loadNodeViewersFile(java.io.File selectedFile)voidremoveWatchers(java.util.Collection<java.lang.String> selectedNodes)voidsaveDefaultConnectionFile(java.util.Properties props)voidsaveNodeViewersFile(java.io.File selectedFile, java.util.List<java.lang.String> nodeViewersClassNames)booleansetData(java.lang.String nodePath, java.lang.String data)voidsetDefaultNodeViewerConfiguration(java.util.List<java.lang.String> nodeViewersClassNames)voidsetLastConnectionProps(java.util.Properties connectionProps)
-
-
-
Field Detail
-
CONNECT_STRING
public static final java.lang.String CONNECT_STRING
The key used for the connect string in the connection properties file- See Also:
- Constant Field Values
-
SESSION_TIMEOUT
public static final java.lang.String SESSION_TIMEOUT
The key used for the session timeout in the connection properties file- See Also:
- Constant Field Values
-
DATA_ENCRYPTION_MANAGER
public static final java.lang.String DATA_ENCRYPTION_MANAGER
The key used for the data encryption manager in the connection properties file- See Also:
- Constant Field Values
-
AUTH_SCHEME_KEY
public static final java.lang.String AUTH_SCHEME_KEY
The key used for the authentication scheme in the connection properties file- See Also:
- Constant Field Values
-
AUTH_DATA_KEY
public static final java.lang.String AUTH_DATA_KEY
The key used for the authentication data in the connection properties file- See Also:
- Constant Field Values
-
connected
protected boolean connected
-
-
Method Detail
-
connect
public boolean connect(java.util.Properties connectionProps)
- Specified by:
connectin interfaceZooInspectorManager- Returns:
- true if successfully connected
-
disconnect
public boolean disconnect()
- Specified by:
disconnectin interfaceZooInspectorManager- Returns:
- true if successfully disconnected
-
getChildren
public java.util.List<java.lang.String> getChildren(java.lang.String nodePath)
- Specified by:
getChildrenin interfaceZooInspectorReadOnlyManager- Parameters:
nodePath- - the path to the node whose children to retrieve- Returns:
- a
Listof the children of the node
-
getData
public java.lang.String getData(java.lang.String nodePath)
- Specified by:
getDatain interfaceZooInspectorReadOnlyManager- Parameters:
nodePath- - the path to the node whose data is to be retrieved- Returns:
- the data for the node
-
getACLs
public java.util.List<java.util.Map<java.lang.String,java.lang.String>> getACLs(java.lang.String nodePath)
- Specified by:
getACLsin interfaceZooInspectorReadOnlyManager- Parameters:
nodePath- - the path to the node whose ACLs are to be retrieved- Returns:
- the ACLs set on the node
-
getNodeMeta
public java.util.Map<java.lang.String,java.lang.String> getNodeMeta(java.lang.String nodePath)
- Specified by:
getNodeMetain interfaceZooInspectorReadOnlyManager- Parameters:
nodePath- - the path to the node whose metadata is to be retrieved- Returns:
- the metaData for the node
-
getNumChildren
public int getNumChildren(java.lang.String nodePath)
- Specified by:
getNumChildrenin interfaceZooInspectorReadOnlyManager- Parameters:
nodePath- - the path to the node to parent node- Returns:
- the number of children of the node
-
createNode
public boolean createNode(java.lang.String parent, java.lang.String nodeName)- Specified by:
createNodein 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
public boolean deleteNode(java.lang.String nodePath)
- Specified by:
deleteNodein interfaceZooInspectorNodeTreeManager- Parameters:
nodePath- - the path to the node to delete- Returns:
- true if the node was successfully deleted
-
setData
public boolean setData(java.lang.String nodePath, java.lang.String data)- Specified by:
setDatain 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
public Pair<java.util.Map<java.lang.String,java.util.List<java.lang.String>>,java.util.Map<java.lang.String,java.lang.String>> getConnectionPropertiesTemplate()
- Specified by:
getConnectionPropertiesTemplatein interfaceZooInspectorManager- Returns:
- a
Paircontaining the following:- a
Mapof 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 aJComboBoxwith the first selected as default. - a
Mapof property keys to the label to show on the UI
- a
-
addWatchers
public void addWatchers(java.util.Collection<java.lang.String> selectedNodes, NodeListener nodeListener)- Specified by:
addWatchersin interfaceZooInspectorManager- Parameters:
selectedNodes- - the nodes to add the watcher tonodeListener- - the node listener for this watcher
-
removeWatchers
public void removeWatchers(java.util.Collection<java.lang.String> selectedNodes)
- Specified by:
removeWatchersin interfaceZooInspectorManager- Parameters:
selectedNodes- - the nodes to remove the watchers from
-
loadNodeViewersFile
public java.util.List<java.lang.String> loadNodeViewersFile(java.io.File selectedFile) throws java.io.IOException- Specified by:
loadNodeViewersFilein 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:
java.io.IOException- - if the configuration file cannot be loaded
-
saveDefaultConnectionFile
public void saveDefaultConnectionFile(java.util.Properties props) throws java.io.IOException- Specified by:
saveDefaultConnectionFilein interfaceZooInspectorManager- Parameters:
props- - the properties to use as the default connection settings- Throws:
java.io.IOException- - if the default configuration file cannot be saved
-
saveNodeViewersFile
public void saveNodeViewersFile(java.io.File selectedFile, java.util.List<java.lang.String> nodeViewersClassNames) throws java.io.IOException- Specified by:
saveNodeViewersFilein interfaceZooInspectorManager- Parameters:
selectedFile- - the file to save the configuration tonodeViewersClassNames- - the class names of the node viewers- Throws:
java.io.IOException- - if the configuration file cannot be saved
-
setDefaultNodeViewerConfiguration
public void setDefaultNodeViewerConfiguration(java.util.List<java.lang.String> nodeViewersClassNames) throws java.io.IOException- Specified by:
setDefaultNodeViewerConfigurationin interfaceZooInspectorManager- Parameters:
nodeViewersClassNames- - the class names of the node viewers- Throws:
java.io.IOException- - if the default configuration file cannot be loaded
-
getDefaultNodeViewerConfiguration
public java.util.List<java.lang.String> getDefaultNodeViewerConfiguration() throws java.io.IOException- Specified by:
getDefaultNodeViewerConfigurationin interfaceZooInspectorManager- Returns:
- nodeViewers - the class names of the node viewers from the configuration
- Throws:
java.io.IOException- - if the default configuration file cannot be loaded
-
getLastConnectionProps
public java.util.Properties getLastConnectionProps()
- Specified by:
getLastConnectionPropsin interfaceZooInspectorManager- Returns:
- last connection Properties - the connection properties last used to connect to the zookeeeper instance
-
setLastConnectionProps
public void setLastConnectionProps(java.util.Properties connectionProps)
- Specified by:
setLastConnectionPropsin interfaceZooInspectorManager- Parameters:
connectionProps- - the connection properties last used to connect to the zookeeeper instance
-
-