# Class ZooInspectorManagerImpl

java.lang.Object
org.apache.zookeeper.inspector.manager.ZooInspectorManagerImpl

All Implemented Interfaces:
  `ZooInspectorManager, ZooInspectorNodeManager, ZooInspectorNodeTreeManager, ZooInspectorReadOnlyManager`

public class ZooInspectorManagerImpl extends Object implements ZooInspectorManager
A default implementation of `ZooInspectorManager` for connecting to zookeeper instances

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`class`
`ZooInspectorManagerImpl.NodeWatcher`
A Watcher which will re-add itself every time an event is fired

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`AUTH_DATA_KEY`
The key used for the authentication data in the connection properties file
`static final String`
`AUTH_SCHEME_KEY`
The key used for the authentication scheme in the connection properties file
`static final String`
`CONNECT_STRING`
The key used for the connect string in the connection properties file
`protected boolean`
`connected`
`static final String`
`DATA_ENCRYPTION_MANAGER`
The key used for the data encryption manager in the connection properties file
`static final String`
`SESSION_TIMEOUT`
The key used for the session timeout in the connection properties file

## Constructor Summary

Constructors
Constructor
Description
`ZooInspectorManagerImpl()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addWatchers(Collection<String> selectedNodes, NodeListener nodeListener)`
`boolean`
`connect(Properties connectionProps)`
`boolean`
`createNode(String parent, String nodeName)`
`boolean`
`deleteNode(String nodePath)`
`boolean`
`disconnect()`
`List<Map<String,String>>`
`getACLs(String nodePath)`
`List<String>`
`getChildren(String nodePath)`
`Pair<Map<String, List<String>>, Map<String,String>>`
`getConnectionPropertiesTemplate()`
`String`
`getData(String nodePath)`
`List<String>`
`getDefaultNodeViewerConfiguration()`
`Properties`
`getLastConnectionProps()`
`Map<String,String>`
`getNodeMeta(String nodePath)`
`int`
`getNumChildren(String nodePath)`
`List<String>`
`loadNodeViewersFile(File selectedFile)`
`void`
`removeWatchers(Collection<String> selectedNodes)`
`void`
`saveDefaultConnectionFile(Properties props)`
`void`
`saveNodeViewersFile(File selectedFile, List<String> nodeViewersClassNames)`
`boolean`
`setData(String nodePath, String data)`
`void`
`setDefaultNodeViewerConfiguration(List<String> nodeViewersClassNames)`
`void`
`setLastConnectionProps(Properties connectionProps)`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### CONNECT_STRING

public static final 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 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 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 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 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

## Constructor Details

### ZooInspectorManagerImpl

public ZooInspectorManagerImpl() throws IOException

Throws:
  `IOException` - - thrown if the default connection settings cannot be loaded

## Method Details

### connect

public boolean connect(Properties connectionProps)

Specified by:
  `connect` in interface `ZooInspectorManager`
Parameters:
  `connectionProps` -
Returns:
  true if successfully connected

### disconnect

public boolean disconnect()

Specified by:
  `disconnect` in interface `ZooInspectorManager`
Returns:
  true if successfully disconnected

### getChildren

public List<String> getChildren(String nodePath)

Specified by:
  `getChildren` in interface `ZooInspectorReadOnlyManager`
Parameters:
  `nodePath` - - the path to the node whose children to retrieve
Returns:
  a `List` of the children of the node

### getData

public String getData(String nodePath)

Specified by:
  `getData` in interface `ZooInspectorReadOnlyManager`
Parameters:
  `nodePath` - - the path to the node whose data is to be retrieved
Returns:
  the data for the node

### getACLs

public List<Map<String,String>> getACLs(String nodePath)

Specified by:
  `getACLs` in interface `ZooInspectorReadOnlyManager`
Parameters:
  `nodePath` - - the path to the node whose ACLs are to be retrieved
Returns:
  the ACLs set on the node

### getNodeMeta

public Map<String,String> getNodeMeta(String nodePath)

Specified by:
  `getNodeMeta` in interface `ZooInspectorReadOnlyManager`
Parameters:
  `nodePath` - - the path to the node whose metadata is to be retrieved
Returns:
  the metaData for the node

### getNumChildren

public int getNumChildren(String nodePath)

Specified by:
  `getNumChildren` in interface `ZooInspectorReadOnlyManager`
Parameters:
  `nodePath` - - the path to the node to parent node
Returns:
  the number of children of the node

### createNode

public boolean createNode(String parent, String nodeName)

Specified by:
  `createNode` in interface `ZooInspectorNodeTreeManager`
Parameters:
  `parent` - - the parent node path for the node to add
  `nodeName` - - the name of the new node
Returns:
  true if the node was successfully created

### deleteNode

public boolean deleteNode(String nodePath)

Specified by:
  `deleteNode` in interface `ZooInspectorNodeTreeManager`
Parameters:
  `nodePath` - - the path to the node to delete
Returns:
  true if the node was successfully deleted

### setData

public boolean setData(String nodePath, String data)

Specified by:
  `setData` in interface `ZooInspectorNodeManager`
Parameters:
  `nodePath` - - the path to the node on which to set the data
  `data` - - the data to set on the this node
Returns:
  true if the data for the node was successfully updated

### getConnectionPropertiesTemplate

public Pair<Map<String, List<String>>, Map<String,String>> getConnectionPropertiesTemplate()

Specified by:
  `getConnectionPropertiesTemplate` in interface `ZooInspectorManager`
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 a `JTextField`. If the list size is greater than 1, the values are taken to be the possible options to show in a `JComboBox` with the first selected as default.
  - a `Map` of property keys to the label to show on the UI

### addWatchers

public void addWatchers(Collection<String> selectedNodes, NodeListener nodeListener)

Specified by:
  `addWatchers` in interface `ZooInspectorManager`
Parameters:
  `selectedNodes` - - the nodes to add the watcher to
  `nodeListener` - - the node listener for this watcher

### removeWatchers

public void removeWatchers(Collection<String> selectedNodes)

Specified by:
  `removeWatchers` in interface `ZooInspectorManager`
Parameters:
  `selectedNodes` - - the nodes to remove the watchers from

### loadNodeViewersFile

public List<String> loadNodeViewersFile(File selectedFile) throws IOException

Specified by:
  `loadNodeViewersFile` in interface `ZooInspectorManager`
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

public void saveDefaultConnectionFile(Properties props) throws IOException

Specified by:
  `saveDefaultConnectionFile` in interface `ZooInspectorManager`
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 interface `ZooInspectorManager`
Parameters:
  `selectedFile` - - the file to save the configuration to
  `nodeViewersClassNames` - - 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 interface `ZooInspectorManager`
Parameters:
  `nodeViewersClassNames` - - the class names of the node viewers
Throws:
  `IOException` - - if the default configuration file cannot be loaded

### getDefaultNodeViewerConfiguration

public List<String> getDefaultNodeViewerConfiguration() throws IOException

Specified by:
  `getDefaultNodeViewerConfiguration` in interface `ZooInspectorManager`
Returns:
  nodeViewers - the class names of the node viewers from the configuration
Throws:
  `IOException` - - if the default configuration file cannot be loaded

### getLastConnectionProps

public Properties getLastConnectionProps()

Specified by:
  `getLastConnectionProps` in interface `ZooInspectorManager`
Returns:
  last connection Properties - the connection properties last used to connect to the zookeeper instance

### setLastConnectionProps

public void setLastConnectionProps(Properties connectionProps)

Specified by:
  `setLastConnectionProps` in interface `ZooInspectorManager`
Parameters:
  `connectionProps` - - the connection properties last used to connect to the zookeeper instance