Methods Summary |
---|
public void | addDeploymentExtension(DeploymentExtensionDescriptor de)Add a new deployment-extension for this descriptor
Vector extensions = (Vector) getExtraAttribute("deployment-extension");
if (extensions==null) {
extensions = new Vector();
addExtraAttribute("deployment-extension", extensions);
}
extensions.add(de);
|
public void | addNotificationListener(com.sun.enterprise.util.NotificationListener nl)Register the given notification listener for change events.
if ((nl != null) && !listeners.contains(nl)) { // avoid duplicate listeners
listeners.addElement(nl);
}
|
public void | addPrefixMapping(java.lang.String mapping, java.lang.String uri)add a prefix mapping
Map prefixMapping = getPrefixMapping();
if (prefixMapping==null) {
prefixMapping = new java.util.HashMap();
addExtraAttribute("prefix-mapping", prefixMapping);
}
prefixMapping.put(mapping, uri);
|
public void | changed(java.lang.String attribute)Notify all my listeners that I have changed..
// fine-grain attribute currently ignored
// eventually, 'changed(String)' should replace 'changed()' everywhere.
this.changed();
|
public void | changed()Notify all my listeners that I have changed..
String attribute = "";
NotificationEvent ne = new NotificationEvent(this, DESCRIPTOR_CHANGED, this, attribute);
List listenersClone = this.getNotificationListeners();
for (Iterator e = listenersClone.iterator(); e.hasNext();) {
NotificationListener nl = (NotificationListener)e.next();
nl.notification(ne);
}
|
public static java.lang.String | createUniqueFilenameAmongst(java.lang.String trialName, java.util.Vector 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.
/* extract file.ext */
int p = trialName.lastIndexOf(".");
if (p < 0) {
return uniquifyString(trialName, otherNames, 0);
}
String ext = trialName.substring(p);
String file = trialName.substring(0, p);
/* get list of filenames less extension */
Vector nameList = new Vector();
for (Enumeration e = otherNames.elements(); e.hasMoreElements();) {
String name = e.nextElement().toString();
if (name.endsWith(ext)) {
nameList.add(name.substring(0, name.length() - ext.length()));
}
}
String unique = uniquifyString(file, nameList, 0);
return unique + ext;
|
public static java.lang.String | createUniqueNameAmongst(java.lang.String trialName, java.util.Vector 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.
return uniquifyString(trialName, otherNames, 0);
|
public static java.lang.String | createUniqueNameAmongstNamedDescriptors(java.lang.String trialName, java.util.Set 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.
Vector v = new Vector();
for (Iterator itr = descriptors.iterator(); itr.hasNext();) {
Descriptor next = (Descriptor) itr.next();
v.addElement(next.getName());
}
return createUniqueNameAmongst(trialName, v);
|
private void | displayLocalizedMap(java.lang.StringBuffer sb, java.util.Map localizedMap)helper method to display a localized map
for (Iterator itr = localizedMap.keySet().iterator();itr.hasNext();) {
String lang = (String) itr.next();
sb.append("\n lang[" + lang + "] = " + localizedMap.get(lang));
}
|
public void | fillDocType(java.io.InputStream in)
try{
BufferedReader inr = new BufferedReader(new InputStreamReader(in));
String s = inr.readLine();
while (s != null) {
if (s.indexOf("DOCTYPE") > -1) {
docType = s;
in.close();
return;
}
s = inr.readLine();
}
}catch(Exception e){
}
|
private java.lang.String | getDefaultLanguage()
return Locale.getDefault().getLanguage();
|
public java.util.Iterator | getDeploymentExtensions()
Vector extensions = (Vector) getExtraAttribute("deployment-extension");
if (extensions!=null) {
return extensions.iterator();
}
return null;
|
public java.lang.String | getDescription()The description text of this descriptor as a String.
return getLocalizedDescription(null);
|
public java.lang.String | getDisplayName()
return getName();
|
public java.lang.String | getDocType()
return docType;
|
public java.lang.String | getLargeIconUri()The large icon name of this descriptor as a String.
return getLocalizedLargeIconUri(null);
|
public java.lang.String | getLocalizedDescription(java.lang.String lang)
if (descriptions==null)
return "";
if (lang==null) {
lang = Locale.getDefault().getLanguage();
}
String description = (String) descriptions.get(lang);
if (description==null) {
return "";
}
return description;
|
public java.util.Map | getLocalizedDescriptions()
return descriptions;
|
public java.lang.String | getLocalizedDisplayName(java.lang.String language)
if (displayNames==null) {
return "";
}
String originalLanguage = language;
if (language==null) {
language=Locale.getDefault().getLanguage();
}
String localizedName = (String) displayNames.get(language);
if (localizedName!=null) {
return localizedName;
}
// so far, no luck, it is possible that this
// environment property was transfered through jndi
// between machines with different locales, if I have
// at least one value, and no language was specified,
// let's return it.
if (originalLanguage==null && displayNames.size()>0) {
return (String) displayNames.values().iterator().next();
}
// all other cases return empty strings
return "";
|
public java.util.Map | getLocalizedDisplayNames()
return displayNames;
|
public java.lang.String | getLocalizedLargeIconUri(java.lang.String lang)
if (largeIcons==null) {
return null;
}
if (lang==null) {
lang = Locale.getDefault().getLanguage();
}
return (String) largeIcons.get(lang);
|
public java.util.Map | getLocalizedLargeIconUris()
return largeIcons;
|
public java.lang.String | getLocalizedSmallIconUri(java.lang.String lang)
if (smallIcons==null) {
return null;
}
if (lang==null) {
lang = Locale.getDefault().getLanguage();
}
return (String) smallIcons.get(lang);
|
public java.util.Map | getLocalizedSmallIconUris()
return smallIcons;
|
public java.lang.String | getName()The name of this descriptor as a String.
return getLocalizedDisplayName(null);
|
public java.util.List | getNotificationListeners()return current notification listeners
Vector listenersClone = null;
synchronized (listeners) {
listenersClone = (Vector)this.listeners.clone();
}
return listenersClone;
|
public java.util.Map | getPrefixMapping()
return (Map) getExtraAttribute("prefix-mapping");
|
public java.lang.String | getSmallIconUri()The small icon name of this descriptor as a String.
return getLocalizedSmallIconUri(null);
|
public static boolean | isBoundsChecking()Answers whether the object model is bounds checking.
return boundsChecking;
|
public void | print(java.lang.StringBuffer toStringBuffer)A String representation of this object.
StringBuffer sb = toStringBuffer;
if (displayNames!=null) {
sb.append("Display Names:");
displayLocalizedMap(sb, displayNames);
}
if (descriptions!=null) {
sb.append("\n Descriptions");
displayLocalizedMap(sb, descriptions);
}
if (smallIcons!=null) {
sb.append("\n SmallIcons");
displayLocalizedMap(sb, smallIcons);
}
if (largeIcons!=null) {
sb.append("\n LargeIcons");
displayLocalizedMap(sb, largeIcons);
}
Map prefix = getPrefixMapping();
if (prefix!=null)
sb.append("\n Prefix Mapping = ").append(prefix);
Iterator itr = getDeploymentExtensions();
if (itr!=null && itr.hasNext()) {
do {
sb.append("\n Deployment Extension : ");
((Descriptor)(itr.next())).print(sb);
} while (itr.hasNext());
}
sb.append("\n");
super.print(sb);
|
private static java.lang.String | recursiveStripIntegerEndingFrom(java.lang.String s)Returns the largest substring of the given string that
does not have an integer at the end.
if (s.length() > 1) {
String shorterByOne = s.substring(0, s.length() - 1);
String lastBit = s.substring(s.length() - 1, s.length());
try {
Integer.parseInt(lastBit);
return recursiveStripIntegerEndingFrom(shorterByOne);
} catch (NumberFormatException nfe) {
return s;
}
}
return s;
|
public void | removeNotificationListener(com.sun.enterprise.util.NotificationListener nl)Deregister the given notification listener for change events.
listeners.removeElement(nl);
|
public static void | setBoundsChecking(boolean b)Sets a global flag to enable or disable boudsn checking
of deployment information
boundsChecking = b;
|
public void | setDescription(java.lang.String description)Sets the description text of this descriptor.
setLocalizedDescription(null, description);
|
public void | setDisplayName(java.lang.String name)sets the display name for this bundle
setName(name);
|
public void | setLargeIconUri(java.lang.String largeIconUri)Sets the large icon name of this descriptor as a String.
setLocalizedLargeIconUri(null, largeIconUri);
|
public void | setLocalizedDescription(java.lang.String lang, java.lang.String description)Add a localized description for this descriptor
if (lang==null) {
lang = Locale.getDefault().getLanguage();
}
if (descriptions==null) {
descriptions = new HashMap();
}
descriptions.put(lang, description);
changed(DESCRIPTION_CHANGED);
|
public void | setLocalizedDisplayName(java.lang.String lang, java.lang.String displayName)Add a localized display name for this descriptor
if (lang==null) {
lang = Locale.getDefault().getLanguage();
}
if (displayNames==null) {
displayNames = new HashMap();
}
displayNames.put(lang, displayName);
changed(NAME_CHANGED);
|
public void | setLocalizedLargeIconUri(java.lang.String lang, java.lang.String uri)Sets the large icon uri for a particular language
if (lang==null) {
lang = Locale.getDefault().getLanguage();
}
if (largeIcons==null) {
largeIcons = new HashMap();
}
largeIcons.put(lang, uri);
changed(LARGE_ICON_CHANGED);
|
public void | setLocalizedSmallIconUri(java.lang.String lang, java.lang.String uri)set the localized small icon uri for the passed language
if (lang==null) {
lang = Locale.getDefault().getLanguage();
}
if (smallIcons==null) {
smallIcons = new HashMap();
}
smallIcons.put(lang, uri);
changed(LARGE_ICON_CHANGED);
|
public void | setName(java.lang.String name)Sets the name of this descriptor.
setLocalizedDisplayName(null, name);
|
public void | setSmallIconUri(java.lang.String smallIconUri)Sets the small icon name of this descriptor as a String.
setLocalizedSmallIconUri(null, smallIconUri);
|
private static java.lang.String | stripIntegerEndingFrom(java.lang.String s)Returns the largest substring of the given string that
does not have an integer at the end.
return recursiveStripIntegerEndingFrom(s);
|
private static java.lang.String | uniquifyString(java.lang.String trialName, java.util.Vector v, int index)Returns String based on the trial name that is guaramteed to be different
from any of the strings in the vector of String names.
for(Enumeration e = v.elements(); e.hasMoreElements();) {
String next = (String) e.nextElement();
if (next.equals(trialName)) {
index++;
return uniquifyString(stripIntegerEndingFrom(trialName) + index, v, index);
}
}
return trialName;
|
public void | visit(com.sun.enterprise.deployment.util.DescriptorVisitor aVisitor)Visitor API implementation, all descriptors must be visitable
aVisitor.accept(this);
|