Class ZooInspectorManagerImpl

    • 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 java.lang.String AUTH_DATA_KEY
      The key used for the authentication data in the connection properties file
      static java.lang.String AUTH_SCHEME_KEY
      The key used for the authentication scheme in the connection properties file
      static java.lang.String CONNECT_STRING
      The key used for the connect string in the connection properties file
      protected boolean connected  
      static java.lang.String DATA_ENCRYPTION_MANAGER
      The key used for the data encryption manager in the connection properties file
      static java.lang.String SESSION_TIMEOUT
      The key used for the session timeout in the connection properties file
    • 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
    • Constructor Detail

      • ZooInspectorManagerImpl

        public ZooInspectorManagerImpl()
                                throws java.io.IOException
        Throws:
        java.io.IOException - - thrown if the default connection settings cannot be loaded
    • Method Detail

      • connect

        public boolean connect​(java.util.Properties connectionProps)
        Specified by:
        connect in interface ZooInspectorManager
        Returns:
        true if successfully connected
      • disconnect

        public boolean disconnect()
        Specified by:
        disconnect in interface ZooInspectorManager
        Returns:
        true if successfully disconnected
      • getChildren

        public java.util.List<java.lang.String> getChildren​(java.lang.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 java.lang.String getData​(java.lang.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 java.util.List<java.util.Map<java.lang.String,​java.lang.String>> getACLs​(java.lang.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 java.util.Map<java.lang.String,​java.lang.String> getNodeMeta​(java.lang.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​(java.lang.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​(java.lang.String parent,
                                  java.lang.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​(java.lang.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​(java.lang.String nodePath,
                               java.lang.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<java.util.Map<java.lang.String,​java.util.List<java.lang.String>>,​java.util.Map<java.lang.String,​java.lang.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​(java.util.Collection<java.lang.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​(java.util.Collection<java.lang.String> selectedNodes)
        Specified by:
        removeWatchers in interface ZooInspectorManager
        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:
        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:
        java.io.IOException - - if the configuration file cannot be loaded
      • saveDefaultConnectionFile

        public void saveDefaultConnectionFile​(java.util.Properties props)
                                       throws java.io.IOException
        Specified by:
        saveDefaultConnectionFile in interface ZooInspectorManager
        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:
        saveNodeViewersFile in interface ZooInspectorManager
        Parameters:
        selectedFile - - the file to save the configuration to
        nodeViewersClassNames - - 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:
        setDefaultNodeViewerConfiguration in interface ZooInspectorManager
        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:
        getDefaultNodeViewerConfiguration in interface ZooInspectorManager
        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:
        getLastConnectionProps in interface ZooInspectorManager
        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:
        setLastConnectionProps in interface ZooInspectorManager
        Parameters:
        connectionProps - - the connection properties last used to connect to the zookeeeper instance