Package org.glassfish.deployment.common
Class Descriptor
- java.lang.Object
-
- java.util.Observable
-
- org.glassfish.deployment.common.DynamicAttributesDescriptor
-
- org.glassfish.deployment.common.Descriptor
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ModuleDescriptor,RootDeploymentDescriptor
public class Descriptor extends DynamicAttributesDescriptor
Descriptor is the root class for all objects representing deployment information in J2EE. Descriptors notify listeners of state changes, and have a name, description, and icons.- Author:
- Danny Coward
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringDESCRIPTION_CHANGEDstatic StringDESCRIPTOR_CHANGEDNotification String for a general descriptor change.StringdocTypestatic StringLARGE_ICON_CHANGEDstatic StringNAME_CHANGEDstatic StringSMALL_ICON_CHANGED
-
Constructor Summary
Constructors Modifier Constructor Description Descriptor()The default constructor.Descriptor(String name, String description)Constructs a descriptor with given name, description.protectedDescriptor(Descriptor other)The copy constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Descriptor>
voidaddDescriptorExtension(T dde)Add a child descriptor to the parent descriptor as an extension.voidaddPrefixMapping(String mapping, String uri)add a prefix mappingstatic StringcreateUniqueFilenameAmongst(String trialName, Vector<String> otherNames)Returns String based on the trial name that is guaramteed to be different from any of the strings in the vector of String names.static StringcreateUniqueNameAmongst(String trialName, Vector<String> otherNames)Returns String based on the trial name that is guaramteed to be different from any of the strings in the vector of String names.static StringcreateUniqueNameAmongstNamedDescriptors(String trialName, Set<? extends Descriptor> descriptors)Returns String based on the trial name that is guaramteed to be different from any of the strings returnsed by the getName() call in any of the Descriptor objects in the Set supplied.voidfillDocType(InputStream in)IteratorgetDeploymentExtensions()StringgetDescription()The description text of this descriptor as a String.<T extends Descriptor>
TgetDescriptorExtension(Class<T> c)Get child descriptor extension for a given type.<T extends Descriptor>
List<T>getDescriptorExtensions(Class<T> c)Get all child descriptor extensions for a given type.StringgetDisplayName()StringgetDocType()StringgetLargeIconUri()The large icon name of this descriptor as a String.StringgetLocalizedDescription(String lang)Map<? extends String,? extends String>getLocalizedDescriptions()StringgetLocalizedDisplayName(String language)Map<? extends String,? extends String>getLocalizedDisplayNames()StringgetLocalizedLargeIconUri(String lang)MapgetLocalizedLargeIconUris()StringgetLocalizedSmallIconUri(String lang)Map<? extends String,? extends String>getLocalizedSmallIconUris()StringgetName()The name of this descriptor as a String.Map<String,String>getPrefixMapping()StringgetSmallIconUri()The small icon name of this descriptor as a String.static booleanisBoundsChecking()Answers whether the object model is bounds checking.voidprint(StringBuffer sb)A String representation of this object.static voidsetBoundsChecking(boolean b)Sets a global flag to enable or disable boudsn checking of deployment informationvoidsetDescription(String description)Sets the description text of this descriptor.voidsetDisplayName(String name)sets the display name for this bundlevoidsetLargeIconUri(String largeIconUri)Sets the large icon name of this descriptor as a String.voidsetLocalizedDescription(String lang, String description)Add a localized description for this descriptorvoidsetLocalizedDisplayName(String lang, String displayName)Add a localized display name for this descriptorvoidsetLocalizedLargeIconUri(String lang, String uri)Sets the large icon uri for a particular languagevoidsetLocalizedSmallIconUri(String lang, String uri)set the localized small icon uri for the passed languagevoidsetName(String name)Sets the name of this descriptor.voidsetSmallIconUri(String smallIconUri)Sets the small icon name of this descriptor as a String.voidvisit(DescriptorVisitor aVisitor)Visitor API implementation, all descriptors must be visitable-
Methods inherited from class org.glassfish.deployment.common.DynamicAttributesDescriptor
addExtraAttribute, getExtraAttribute, getExtraAttributes, removeExtraAttribute, toString
-
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
-
-
-
-
Field Detail
-
DESCRIPTOR_CHANGED
public static final String DESCRIPTOR_CHANGED
Notification String for a general descriptor change.- See Also:
- Constant Field Values
-
NAME_CHANGED
public static final String NAME_CHANGED
- See Also:
- Constant Field Values
-
DESCRIPTION_CHANGED
public static final String DESCRIPTION_CHANGED
- See Also:
- Constant Field Values
-
LARGE_ICON_CHANGED
public static final String LARGE_ICON_CHANGED
- See Also:
- Constant Field Values
-
SMALL_ICON_CHANGED
public static final String SMALL_ICON_CHANGED
- See Also:
- Constant Field Values
-
docType
public String docType
-
-
Constructor Detail
-
Descriptor
public Descriptor()
The default constructor. Constructs a descriptor with name, description and icons as empty Strings.
-
Descriptor
protected Descriptor(Descriptor other)
The copy constructor.- Parameters:
other- the source descriptor
-
-
Method Detail
-
addDescriptorExtension
public <T extends Descriptor> void addDescriptorExtension(T dde)
Add a child descriptor to the parent descriptor as an extension.- Parameters:
dde- the child descriptor
-
getDescriptorExtensions
public <T extends Descriptor> List<T> getDescriptorExtensions(Class<T> c)
Get all child descriptor extensions for a given type.- Parameters:
c- the child descriptor type- Returns:
- the list of descriptor extension for a given type
-
getDescriptorExtension
public <T extends Descriptor> T getDescriptorExtension(Class<T> c)
Get child descriptor extension for a given type. It is a convenience API to get the single child extension descriptor if the XML element it represents can only occur once. Returns that single descriptor if the XML element that the given type represents can only occur once. Returns the first element of the list of descriptors if the XML element that the given type represents can occur multiple times.- Parameters:
c- the child descriptor type- Returns:
- the single or the first descriptor extension for a given type
-
setBoundsChecking
public static void setBoundsChecking(boolean b)
Sets a global flag to enable or disable boudsn checking of deployment information- Parameters:
b- true for bounds checking on, false else.
-
isBoundsChecking
public static boolean isBoundsChecking()
Answers whether the object model is bounds checking.- Returns:
- true for boudsn checking, false else.
-
setName
public void setName(String name)
Sets the name of this descriptor.- Parameters:
name- the new name of the descriptor.
-
getName
public String getName()
The name of this descriptor as a String.- Returns:
- the name of this descriptor
-
setLocalizedDisplayName
public void setLocalizedDisplayName(String lang, String displayName)
Add a localized display name for this descriptor- Parameters:
lang- the local identifier (null if using default locale)displayName- the localized string
-
getLocalizedDisplayName
public String getLocalizedDisplayName(String language)
- Parameters:
language- the language- Returns:
- the localized display name for the passed language
-
getLocalizedDisplayNames
public Map<? extends String,? extends String> getLocalizedDisplayNames()
- Returns:
- the localized display name indexed by language
-
setDisplayName
public void setDisplayName(String name)
sets the display name for this bundle- Parameters:
name- the display name
-
getDisplayName
public String getDisplayName()
- Returns:
- the display name
-
setDescription
public void setDescription(String description)
Sets the description text of this descriptor.- Parameters:
description- the new description text of the descriptor.
-
getDescription
public String getDescription()
The description text of this descriptor as a String.- Returns:
- the description text of this descriptor
-
setLocalizedDescription
public void setLocalizedDescription(String lang, String description)
Add a localized description for this descriptor- Parameters:
lang- the local identifier (null if using default locale)description- the localized string
-
getLocalizedDescription
public String getLocalizedDescription(String lang)
- Parameters:
lang- the local language- Returns:
- the localized description
-
getLocalizedDescriptions
public Map<? extends String,? extends String> getLocalizedDescriptions()
- Returns:
- a Map of localized description, where lang is the key
-
setLocalizedLargeIconUri
public void setLocalizedLargeIconUri(String lang, String uri)
Sets the large icon uri for a particular language- Parameters:
lang- the language identifieruri- the large icon uri
-
getLocalizedLargeIconUri
public String getLocalizedLargeIconUri(String lang)
- Parameters:
lang- the language or null for the current locale- Returns:
- the large icon uri for a language
-
getLocalizedLargeIconUris
public Map getLocalizedLargeIconUris()
- Returns:
- a map of localized large icons uris indexed by language
-
setLocalizedSmallIconUri
public void setLocalizedSmallIconUri(String lang, String uri)
set the localized small icon uri for the passed language- Parameters:
lang- the languageuri- the uri for the small icon
-
getLocalizedSmallIconUri
public String getLocalizedSmallIconUri(String lang)
- Parameters:
lang- the language- Returns:
- the small icon uri for the passed language
-
getLocalizedSmallIconUris
public Map<? extends String,? extends String> getLocalizedSmallIconUris()
- Returns:
- the map of small icons indexed by language
-
getLargeIconUri
public String getLargeIconUri()
The large icon name of this descriptor as a String.- Returns:
- the large icon name of this descriptor
-
setLargeIconUri
public void setLargeIconUri(String largeIconUri)
Sets the large icon name of this descriptor as a String.- Parameters:
largeIconUri- the large icon name of this descriptor
-
getSmallIconUri
public String getSmallIconUri()
The small icon name of this descriptor as a String.- Returns:
- the small icon name of this descriptor
-
setSmallIconUri
public void setSmallIconUri(String smallIconUri)
Sets the small icon name of this descriptor as a String.- Parameters:
smallIconUri- the small icon name of this descriptor
-
createUniqueFilenameAmongst
public static String createUniqueFilenameAmongst(String trialName, Vector<String> otherNames)
Returns String based on the trial name that is guaramteed to be different from any of the strings in the vector of String names.- Parameters:
trialName- the suggested nameotherNames- The Vector of String objects none of which will be the same as the return- Returns:
- the unique String
-
createUniqueNameAmongst
public static String createUniqueNameAmongst(String trialName, Vector<String> otherNames)
Returns String based on the trial name that is guaramteed to be different from any of the strings in the vector of String names.- Parameters:
trialName- the suggested nameotherNames- The Vector of String objects none of which will be the same as the return- Returns:
- the unique String
-
createUniqueNameAmongstNamedDescriptors
public static String createUniqueNameAmongstNamedDescriptors(String trialName, Set<? extends Descriptor> descriptors)
Returns String based on the trial name that is guaramteed to be different from any of the strings returnsed by the getName() call in any of the Descriptor objects in the Set supplied.- Parameters:
trialName- the suggested namedescriptors- The Set of Descriptor objects to whose name attribute will not be the same as the return- Returns:
- the unique String
-
getDeploymentExtensions
public Iterator getDeploymentExtensions()
- Returns:
- an iterator on the deployment-extension
-
addPrefixMapping
public void addPrefixMapping(String mapping, String uri)
add a prefix mapping- Parameters:
mapping- the mappinguri- the uri
-
getPrefixMapping
public Map<String,String> getPrefixMapping()
- Returns:
- the map of prefix to namepace uri
-
print
public void print(StringBuffer sb)
A String representation of this object.- Overrides:
printin classDynamicAttributesDescriptor
-
visit
public void visit(DescriptorVisitor aVisitor)
Visitor API implementation, all descriptors must be visitable- Parameters:
aVisitor- the visitor implementation
-
getDocType
public String getDocType()
-
fillDocType
public void fillDocType(InputStream in)
-
-