Class Configuration

  • All Implemented Interfaces:
    Property, PropertyWalk

    public class Configuration
    extends Element
    The Configuration class represents a pools configuration.
    • Field Summary

      • Fields inherited from class com.sun.solaris.service.pools.Element

        _conf
    • Constructor Summary

      Constructors 
      Constructor Description
      Configuration​(java.lang.String location, int perms)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the configuration.
      void commit​(int active)
      Commit the configuration, making any changes since the configuration was last committed (or opened if there have been no prior commits) permanent.
      Pool createPool​(java.lang.String name)
      Create a pool with the supplied name.
      Resource createResource​(java.lang.String type, java.lang.String name)
      Create a resource with the supplied type and name.
      void destroyPool​(Pool aPool)
      Destroy the supplied PoolInternal.
      void destroyResource​(Resource res)
      Destroy the supplied resource.
      boolean equals​(java.lang.Object o)
      Indicates whether some other Configuration is "equal to this one.
      void export​(java.lang.String location, int format)
      Export the configuration, storing the current state of the configuration at the supplied location in the supplied format.
      protected void finalize()
      Reclaim the memory allocated for this configuration by the C proxy.
      Component getComponent​(java.lang.String type, long sys_id)
      Get the component with the supplied name.
      java.util.List getComponents​(java.util.List values)
      Get a list of components which match the supplied selection criteria in values.
      protected long getElem()
      Return the pointer to this configuration as an element.
      java.lang.String getInformation​(int deep)
      Returns a descriptive string which describes the configuration.
      java.lang.String getLocation()
      Returns the location of the configuration.
      Pool getPool​(java.lang.String name)
      Get the pool with the supplied name.
      java.util.List getPools​(java.util.List values)
      Get a list of pools which match the supplied selection criteria in values.
      Resource getResource​(java.lang.String type, java.lang.String name)
      Get the resource with the supplied name.
      java.util.List getResources​(java.util.List values)
      Get a list of resources which match the supplied selection criteria in values.
      int hashCode()
      Returns a hash code value for the object.
      void open​(java.lang.String location, int perms)
      Opens the configuration at the supplied location and with the supplied permissions.
      void remove()
      Remove the configuration.
      void rollback()
      Rollback the configuration, undoing any changes which have been made since the last commit or (if there are no commits) since the configuration was opened.
      int status()
      Returns the status of the configuration.
      java.lang.String toString()
      Returns a string representation of this configuration.
      int update()
      Update the configuration, ensuring that the current state of the configuration reflects that of the kernel.
      void validate​(int level)
      Validate the configuration, ensuring that the current state of the configuration satisfies the supplied validation level.
      • Methods inherited from class java.lang.Object

        clone, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Configuration

        public Configuration​(java.lang.String location,
                             int perms)
                      throws PoolsException
        Constructor
        Parameters:
        location - The location of the configuration.
        perms - The OR'd permissions used when opening this configuration.
        Throws:
        PoolsException - The error message generated by libpool.
    • Method Detail

      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Reclaim the memory allocated for this configuration by the C proxy.
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable - If freeing this configuration fails.
      • open

        public void open​(java.lang.String location,
                         int perms)
                  throws PoolsException
        Opens the configuration at the supplied location and with the supplied permissions.
        Throws:
        PoolsException - if there is an error opening the configuration.
      • close

        public void close()
        Closes the configuration.
      • getLocation

        public java.lang.String getLocation()
        Returns the location of the configuration.
        Returns:
        the location of the configuration.
      • status

        public int status()
        Returns the status of the configuration.
        Returns:
        the status of the configuration.
      • rollback

        public void rollback()
                      throws PoolsException
        Rollback the configuration, undoing any changes which have been made since the last commit or (if there are no commits) since the configuration was opened.
        Throws:
        PoolsException - If the rollback fails.
      • commit

        public void commit​(int active)
                    throws PoolsException
        Commit the configuration, making any changes since the configuration was last committed (or opened if there have been no prior commits) permanent.
        Throws:
        PoolsException - If the commit fails.
      • export

        public void export​(java.lang.String location,
                           int format)
                    throws PoolsException
        Export the configuration, storing the current state of the configuration at the supplied location in the supplied format.
        Parameters:
        location - The location of the export.
        format - The format of the export.
        Throws:
        PoolsException - If the export fails.
      • validate

        public void validate​(int level)
                      throws PoolsException
        Validate the configuration, ensuring that the current state of the configuration satisfies the supplied validation level.
        Parameters:
        level - The desired level of validation.
        Throws:
        PoolsException - If the validation fails.
      • update

        public int update()
                   throws PoolsException
        Update the configuration, ensuring that the current state of the configuration reflects that of the kernel.
        Returns:
        a bitmap of the changed types.
        Throws:
        PoolsException - If the update fails.
      • createPool

        public Pool createPool​(java.lang.String name)
                        throws PoolsException
        Create a pool with the supplied name.
        Parameters:
        name - The name of the PoolInternal.
        Returns:
        a pool with the supplied name.
        Throws:
        PoolsException - If the pool creation fails.
      • destroyPool

        public void destroyPool​(Pool aPool)
                         throws PoolsException
        Destroy the supplied PoolInternal.
        Parameters:
        aPool - The pool to be destroyed.
        Throws:
        PoolsException - If the pool cannot be located.
      • getPool

        public Pool getPool​(java.lang.String name)
                     throws PoolsException
        Get the pool with the supplied name.
        Parameters:
        name - The name of the pool to be found.
        Returns:
        a pool with the supplied name.
        Throws:
        PoolsException - If the pool cannot be located.
      • getPools

        public java.util.List getPools​(java.util.List values)
                                throws PoolsException
        Get a list of pools which match the supplied selection criteria in values.
        Parameters:
        values - A list of values to be used to qualify the search.
        Returns:
        a list of pools which match the supplied criteria
        Throws:
        PoolsException - If there is an error executing the query.
      • createResource

        public Resource createResource​(java.lang.String type,
                                       java.lang.String name)
                                throws PoolsException
        Create a resource with the supplied type and name.
        Parameters:
        type - The type of the resource.
        name - The name of the resource.
        Returns:
        a resource of the supplied type and name.
        Throws:
        PoolsException - If the resource creation fails.
      • destroyResource

        public void destroyResource​(Resource res)
                             throws PoolsException
        Destroy the supplied resource.
        Parameters:
        res - The resource to be destroyed.
        Throws:
        PoolsException - If the resource cannot be located.
      • getResource

        public Resource getResource​(java.lang.String type,
                                    java.lang.String name)
                             throws PoolsException
        Get the resource with the supplied name.
        Parameters:
        type - The type of the resource to be found.
        name - The name of the resource to be found.
        Returns:
        a resource with the supplied name.
        Throws:
        PoolsException - If the resource cannot be located.
      • getResources

        public java.util.List getResources​(java.util.List values)
                                    throws PoolsException
        Get a list of resources which match the supplied selection criteria in values.
        Parameters:
        values - A list of values to be used to qualify the search.
        Returns:
        a list of resources which match the supplied criteria
        Throws:
        PoolsException - If there is an error executing the query.
      • getComponent

        public Component getComponent​(java.lang.String type,
                                      long sys_id)
                               throws PoolsException
        Get the component with the supplied name.
        Parameters:
        type - The type of the component to be found.
        sys_id - The sys_id of the component to be found.
        Returns:
        a component with the supplied name.
        Throws:
        PoolsException - If the component cannot be located.
      • getComponents

        public java.util.List getComponents​(java.util.List values)
                                     throws PoolsException
        Get a list of components which match the supplied selection criteria in values.
        Parameters:
        values - A list of values to be used to qualify the search.
        Returns:
        a list of components which match the supplied criteria
        Throws:
        PoolsException - If there is an error executing the query.
      • getInformation

        public java.lang.String getInformation​(int deep)
        Returns a descriptive string which describes the configuration.
        Specified by:
        getInformation in class Element
        Parameters:
        deep - Whether the information should contain information about all contained elements.
        Returns:
        a descriptive string which describes the configuration.
      • toString

        public java.lang.String toString()
        Returns a string representation of this configuration.
        Overrides:
        toString in class Element
        Returns:
        a string representation of this configuration.
      • equals

        public boolean equals​(java.lang.Object o)
        Indicates whether some other Configuration is "equal to this one.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - the reference object with which to compare.
        Returns:
        true if this object is the same as the o argument; false otherwise.
        See Also:
        hashCode()
      • hashCode

        public int hashCode()
        Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hash code value for this object.
        See Also:
        equals(java.lang.Object), Hashtable
      • getElem

        protected long getElem()
                        throws PoolsException
        Return the pointer to this configuration as an element.
        Specified by:
        getElem in class Element
        Returns:
        The pointer to the native configuration which this object wraps.
        Throws:
        PoolsException - If there is an error converting the native configuration pointer to a native elem pointer.