Class Resource


  • public class Resource
    extends Object
    Represents a resource, such as a datasource.
    • Constructor Detail

      • Resource

        public Resource​(String name,
                        String type)
        Parameters:
        name - Name of resource (e.g. jdbc/myConnection).
        type - Type of resource (e.g. javax.sql.DataSource).
    • Method Detail

      • getName

        public String getName()
        Returns:
        The resource name
      • getType

        public String getType()
        Returns:
        The resource Type
      • setParameter

        public void setParameter​(String name,
                                 String value)
        Set a resource parameter. I.e. this relates in tomcat to <ResourceParams...> <parameter> <name>key</name> <value>value</name> </parameter> ... </ResourceParams>
        Parameters:
        name - Name of the value to set.
        value - Value to set.
      • getParameter

        public String getParameter​(String name)
        Get a stored parameter. Returns null if no parameter stored by this name.
        Parameters:
        name - Name of parameter.
        Returns:
        Value of parameter.
      • getParameterNames

        public Set<String> getParameterNames()
        Returns:
        A Set with all parameters.
      • setParameters

        public void setParameters​(Map<String,​String> parameters)
        Set parameters.
        Parameters:
        parameters - The parameters to set.
      • getParameters

        public Map<String,​String> getParameters()
        Get parameters.
        Returns:
        parameters The parameters for this resource.
      • setClassName

        public void setClassName​(String className)
        Parameters:
        className - the className to set
      • getClassName

        public String getClassName()
        Returns:
        the className
      • setId

        public void setId​(String id)
        Parameters:
        id - id used in configuration files.
      • getId

        public String getId()
        The String used to identify this resource in configuration files.
        Returns:
        the resource id