Package org.glassfish.resources.api
Class JavaEEResourceBase
- java.lang.Object
-
- org.glassfish.resources.api.JavaEEResourceBase
-
- All Implemented Interfaces:
Serializable
,JavaEEResource
- Direct Known Subclasses:
AdministeredObjectResource
,CustomResource
,ExternalJndiResource
,MailBean
public abstract class JavaEEResourceBase extends Object implements JavaEEResource, Serializable
Base class for common JavaEE Resource implementation.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.glassfish.resources.api.JavaEEResource
CONNECTOR_RESOURCE, CUSTOM_RESOURCE, EXTERNAL_JNDI_RESOURCE, JDBC_CONNECTION_POOL, JDBC_DRIVER, JDBC_RESOURCE, JDBC_XA_RESOURCE, JMS_CNX_FACTORY, JMS_DESTINATION, MAIL_RESOURCE, PMF_RESOURCE, RESOURCE_ADAPTER
-
-
Constructor Summary
Constructors Constructor Description JavaEEResourceBase(ResourceInfo resourceInfo)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addProperty(ResourceProperty property)
Add a property.protected abstract JavaEEResource
doClone(ResourceInfo resourceInfo)
Creates a JavaEEResource from a specifiedResourceInfo
String
getDescription()
Gets description of the resourceSet
getProperties()
Set containing elements of type ResourceProperty.ResourceProperty
getProperty(String propertyName)
Get a property with the given name.protected String
getPropsString()
Gets a the of properties as a JSON array i.e.ResourceInfo
getResourceInfo()
Resource Info.abstract int
getType()
Resource type.boolean
isEnabled()
Checks whether the resource is enabled.JavaEEResource
makeClone(ResourceInfo resourceInfo)
Create a new resource with the given name that has the same attribute and property settings as the invoked object.boolean
removeProperty(ResourceProperty property)
Remove a property.void
setDescription(String value)
Sets description of the resourcevoid
setEnabled(boolean value)
Sets whether the resource is enabled.
-
-
-
Constructor Detail
-
JavaEEResourceBase
public JavaEEResourceBase(ResourceInfo resourceInfo)
-
-
Method Detail
-
getResourceInfo
public ResourceInfo getResourceInfo()
Description copied from interface:JavaEEResource
Resource Info. Immutable.- Specified by:
getResourceInfo
in interfaceJavaEEResource
- Returns:
-
setEnabled
public void setEnabled(boolean value)
Description copied from interface:JavaEEResource
Sets whether the resource is enabled.A resource can exist but be disabled, in which case references if an application is deployed that references it will deploy without errors, but when it is looked up a
NamingException
will be thrown- Specified by:
setEnabled
in interfaceJavaEEResource
-
isEnabled
public boolean isEnabled()
Description copied from interface:JavaEEResource
Checks whether the resource is enabled.A resource can exist but be disabled, in which case references if an application is deployed that references it will deploy without errors, but when it is looked up a
NamingException
will be thrown- Specified by:
isEnabled
in interfaceJavaEEResource
- Returns:
-
setDescription
public void setDescription(String value)
Description copied from interface:JavaEEResource
Sets description of the resource- Specified by:
setDescription
in interfaceJavaEEResource
-
getDescription
public String getDescription()
Description copied from interface:JavaEEResource
Gets description of the resource- Specified by:
getDescription
in interfaceJavaEEResource
- Returns:
-
getType
public abstract int getType()
Description copied from interface:JavaEEResource
Resource type. Defined above. Immutable.- Specified by:
getType
in interfaceJavaEEResource
- Returns:
-
getProperties
public Set getProperties()
Description copied from interface:JavaEEResource
Set containing elements of type ResourceProperty. Actual property names are resource type specific.- Specified by:
getProperties
in interfaceJavaEEResource
- Returns:
- Shallow copy of resource property set. If resource has 0 properties, empty set is returned.
-
addProperty
public void addProperty(ResourceProperty property)
Description copied from interface:JavaEEResource
Add a property. Underlying set is keyed by property name. The new property overrides any existing property with same name.- Specified by:
addProperty
in interfaceJavaEEResource
-
removeProperty
public boolean removeProperty(ResourceProperty property)
Description copied from interface:JavaEEResource
Remove a property. Underlying set is keyed by property name.- Specified by:
removeProperty
in interfaceJavaEEResource
- Returns:
- true if property was removed, false if property was not found
-
getProperty
public ResourceProperty getProperty(String propertyName)
Description copied from interface:JavaEEResource
Get a property with the given name.- Specified by:
getProperty
in interfaceJavaEEResource
- Returns:
- ResourceProperty or null if not found.
-
makeClone
public JavaEEResource makeClone(ResourceInfo resourceInfo)
Description copied from interface:JavaEEResource
Create a new resource with the given name that has the same attribute and property settings as the invoked object.- Specified by:
makeClone
in interfaceJavaEEResource
- Returns:
-
getPropsString
protected String getPropsString()
Gets a the of properties as a JSON array i.e. [ propname1=value , propname2=othervalue ]If there are no properties an empty string is returned.
- Returns:
-
doClone
protected abstract JavaEEResource doClone(ResourceInfo resourceInfo)
Creates a JavaEEResource from a specifiedResourceInfo
- Parameters:
resourceInfo
-- Returns:
-
-