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 voidaddProperty(ResourceProperty property)Add a property.protected abstract JavaEEResourcedoClone(ResourceInfo resourceInfo)Creates a JavaEEResource from a specifiedResourceInfoStringgetDescription()Gets description of the resourceSetgetProperties()Set containing elements of type ResourceProperty.ResourcePropertygetProperty(String propertyName)Get a property with the given name.protected StringgetPropsString()Gets a the of properties as a JSON array i.e.ResourceInfogetResourceInfo()Resource Info.abstract intgetType()Resource type.booleanisEnabled()Checks whether the resource is enabled.JavaEEResourcemakeClone(ResourceInfo resourceInfo)Create a new resource with the given name that has the same attribute and property settings as the invoked object.booleanremoveProperty(ResourceProperty property)Remove a property.voidsetDescription(String value)Sets description of the resourcevoidsetEnabled(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:JavaEEResourceResource Info. Immutable.- Specified by:
getResourceInfoin interfaceJavaEEResource- Returns:
-
setEnabled
public void setEnabled(boolean value)
Description copied from interface:JavaEEResourceSets 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
NamingExceptionwill be thrown- Specified by:
setEnabledin interfaceJavaEEResource
-
isEnabled
public boolean isEnabled()
Description copied from interface:JavaEEResourceChecks 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
NamingExceptionwill be thrown- Specified by:
isEnabledin interfaceJavaEEResource- Returns:
-
setDescription
public void setDescription(String value)
Description copied from interface:JavaEEResourceSets description of the resource- Specified by:
setDescriptionin interfaceJavaEEResource
-
getDescription
public String getDescription()
Description copied from interface:JavaEEResourceGets description of the resource- Specified by:
getDescriptionin interfaceJavaEEResource- Returns:
-
getType
public abstract int getType()
Description copied from interface:JavaEEResourceResource type. Defined above. Immutable.- Specified by:
getTypein interfaceJavaEEResource- Returns:
-
getProperties
public Set getProperties()
Description copied from interface:JavaEEResourceSet containing elements of type ResourceProperty. Actual property names are resource type specific.- Specified by:
getPropertiesin 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:JavaEEResourceAdd a property. Underlying set is keyed by property name. The new property overrides any existing property with same name.- Specified by:
addPropertyin interfaceJavaEEResource
-
removeProperty
public boolean removeProperty(ResourceProperty property)
Description copied from interface:JavaEEResourceRemove a property. Underlying set is keyed by property name.- Specified by:
removePropertyin interfaceJavaEEResource- Returns:
- true if property was removed, false if property was not found
-
getProperty
public ResourceProperty getProperty(String propertyName)
Description copied from interface:JavaEEResourceGet a property with the given name.- Specified by:
getPropertyin interfaceJavaEEResource- Returns:
- ResourceProperty or null if not found.
-
makeClone
public JavaEEResource makeClone(ResourceInfo resourceInfo)
Description copied from interface:JavaEEResourceCreate a new resource with the given name that has the same attribute and property settings as the invoked object.- Specified by:
makeClonein 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:
-
-