[213776]: [xslt] URIResolver
https://bugs.eclipse.org/bugs/show_bug.cgi?id=213776
diff --git a/bundles/org.eclipse.wst.xsl.jaxp.debug/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.wst.xsl.jaxp.debug/.settings/org.eclipse.jdt.core.prefs
index d8c24ba..97f3b6f 100644
--- a/bundles/org.eclipse.wst.xsl.jaxp.debug/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.wst.xsl.jaxp.debug/.settings/org.eclipse.jdt.core.prefs
@@ -1,10 +1,15 @@
-#Thu Jun 11 01:36:27 GMT 2009
+#Sat Jan 02 18:55:59 GMT-05:00 2010
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
@@ -13,7 +18,7 @@
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
@@ -79,4 +84,4 @@
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/bundles/org.eclipse.wst.xsl.jaxp.debug/src/org/eclipse/wst/xsl/jaxp/debug/invoker/PipelineDefinition.java b/bundles/org.eclipse.wst.xsl.jaxp.debug/src/org/eclipse/wst/xsl/jaxp/debug/invoker/PipelineDefinition.java
index 198f999..dd5a08e 100644
--- a/bundles/org.eclipse.wst.xsl.jaxp.debug/src/org/eclipse/wst/xsl/jaxp/debug/invoker/PipelineDefinition.java
+++ b/bundles/org.eclipse.wst.xsl.jaxp.debug/src/org/eclipse/wst/xsl/jaxp/debug/invoker/PipelineDefinition.java
@@ -24,11 +24,13 @@
import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.URIResolver;
import org.eclipse.wst.xsl.jaxp.debug.invoker.internal.ConfigurationException;
import org.eclipse.wst.xsl.jaxp.debug.invoker.internal.CreationException;
@@ -40,17 +42,18 @@
/**
* The definition of the transformation pipeline.
* <p>
- * This class is loaded on both the Eclipse classpath and the transformation process's classpath.
- * The whole definition is serialized to an XML document by the Eclipse launcher, and is then
- * read by the transformation process when launched.
+ * This class is loaded on both the Eclipse classpath and the transformation
+ * process's classpath. The whole definition is serialized to an XML document by
+ * the Eclipse launcher, and is then read by the transformation process when
+ * launched.
* </p>
*
* @author Doug Satchwell
*/
-public class PipelineDefinition
-{
+public class PipelineDefinition {
private String sourceURL;
private String targetFile;
+
private final List transformDefs = new ArrayList();
private final Set attributes = new HashSet();
private boolean useEmbedded;
@@ -58,36 +61,40 @@
/**
* Create a new empty instance of this.
*/
- public PipelineDefinition()
- {
+ public PipelineDefinition() {
}
/**
* Create a new instance of this by reading the specified XML file.
*
- * @param launchFile the XSL file to load
- * @throws SAXException if problems occur during parsing
- * @throws IOException if problems occur during parsing
- * @throws ParserConfigurationException if problems occur during parsing
+ * @param launchFile
+ * the XSL file to load
+ * @throws SAXException
+ * if problems occur during parsing
+ * @throws IOException
+ * if problems occur during parsing
+ * @throws ParserConfigurationException
+ * if problems occur during parsing
*/
- public PipelineDefinition(File launchFile) throws SAXException, IOException, ParserConfigurationException
- {
- this(DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new BufferedInputStream(new FileInputStream(launchFile))));
+ public PipelineDefinition(File launchFile) throws SAXException,
+ IOException, ParserConfigurationException {
+ this(DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(
+ new BufferedInputStream(new FileInputStream(launchFile))));
}
/**
* Create a new instance of this from the specified document
*
- * @param doc the Document to create this from
+ * @param doc
+ * the Document to create this from
*/
- public PipelineDefinition(Document doc)
- {
+ public PipelineDefinition(Document doc) {
Element rootEl = doc.getDocumentElement();
- Element attributesEl = (Element) rootEl.getElementsByTagName("Attributes").item(0); //$NON-NLS-1$
+ Element attributesEl = (Element) rootEl.getElementsByTagName(
+ "Attributes").item(0); //$NON-NLS-1$
NodeList attributeEls = attributesEl.getElementsByTagName("Attribute"); //$NON-NLS-1$
- for (int i = 0; i < attributeEls.getLength(); i++)
- {
+ for (int i = 0; i < attributeEls.getLength(); i++) {
Element attributeEl = (Element) attributeEls.item(i);
String name = attributeEl.getAttribute("name"); //$NON-NLS-1$
String type = attributeEl.getAttribute("type"); //$NON-NLS-1$
@@ -95,17 +102,18 @@
addAttribute(new TypedValue(name, type, value));
}
- Element transformsEl = (Element) rootEl.getElementsByTagName("Transforms").item(0); //$NON-NLS-1$
+ Element transformsEl = (Element) rootEl.getElementsByTagName(
+ "Transforms").item(0); //$NON-NLS-1$
String useEmbedded = transformsEl.getAttribute("useEmbedded"); //$NON-NLS-1$
boolean embedded = Boolean.getBoolean(useEmbedded);
setUseEmbedded(embedded);
- if (!embedded)
- {
- NodeList transformEls = transformsEl.getElementsByTagName("Transform"); //$NON-NLS-1$
- for (int i = 0; i < transformEls.getLength(); i++)
- {
+ if (!embedded) {
+ NodeList transformEls = transformsEl
+ .getElementsByTagName("Transform"); //$NON-NLS-1$
+ for (int i = 0; i < transformEls.getLength(); i++) {
Element transformEl = (Element) transformEls.item(i);
- TransformDefinition tdef = TransformDefinition.fromXML(transformEl);
+ TransformDefinition tdef = TransformDefinition
+ .fromXML(transformEl);
addTransformDef(tdef);
}
}
@@ -114,57 +122,66 @@
/**
* Configure the invoker from this.
*
- * @param invoker the invoker to configure
- * @throws ConfigurationException if an exception occurs during configuration
+ * @param invoker
+ * the invoker to configure
+ * @throws ConfigurationException
+ * if an exception occurs during configuration
*/
- public void configure(IProcessorInvoker invoker) throws ConfigurationException
- {
- Map attVals = new HashMap();
- for (Iterator iter = attributes.iterator(); iter.hasNext();)
- {
+ public void configure(IProcessorInvoker invoker)
+ throws ConfigurationException {
+ Map attVals = new ConcurrentHashMap();
+ for (Iterator iter = attributes.iterator(); iter.hasNext();) {
TypedValue att = (TypedValue) iter.next();
Object value;
- try
- {
+ try {
value = att.createValue();
- }
- catch (CreationException e)
- {
+ } catch (CreationException e) {
throw new ConfigurationException(e.getMessage(), e);
}
- attVals.put(att.uri, value);
+ attVals.put(att.name, value);
}
invoker.setAttributes(attVals);
- for (Iterator iter = transformDefs.iterator(); iter.hasNext();)
- {
+ for (Iterator iter = transformDefs.iterator(); iter.hasNext();) {
TransformDefinition tdef = (TransformDefinition) iter.next();
Map params = null;
- try
- {
+ try {
params = tdef.getParametersAsMap();
- }
- catch (CreationException e)
- {
- throw new ConfigurationException(Messages.getString("PipelineDefinition.8"), e); //$NON-NLS-1$
+ } catch (CreationException e) {
+ throw new ConfigurationException(Messages
+ .getString("PipelineDefinition.8"), e); //$NON-NLS-1$
}
URL url = null;
- try
- {
+ try {
url = new URL(tdef.getStylesheetURL());
- }
- catch (MalformedURLException e)
- {
- throw new ConfigurationException(Messages.getString("PipelineDefinition.9") + tdef.getStylesheetURL(), e); //$NON-NLS-1$
+ } catch (MalformedURLException e) {
+ throw new ConfigurationException(
+ Messages.getString("PipelineDefinition.9") + tdef.getStylesheetURL(), e); //$NON-NLS-1$
}
Properties properties = tdef.getOutputProperties();
- try
- {
- invoker.addStylesheet(url, params, properties, null);
- }
- catch (TransformerConfigurationException e)
- {
- throw new ConfigurationException(Messages.getString("PipelineDefinition.10") + tdef.getStylesheetURL(), null); //$NON-NLS-1$
+ URIResolver resolver = null;
+
+// if (tdef.getResolverClass() != null) {
+// try {
+// resolver = (URIResolver) Class.forName(
+// tdef.getResolverClass()).newInstance();
+// } catch (InstantiationException e) {
+// throw new ConfigurationException(
+// Messages.getString("PipelineDefinition.10") + tdef.getResolverClass(), null); //$NON-NLS-1$
+// } catch (IllegalAccessException e) {
+// throw new ConfigurationException(
+// Messages.getString("PipelineDefinition.10") + tdef.getResolverClass(), null); //$NON-NLS-1$
+// } catch (ClassNotFoundException e) {
+// throw new ConfigurationException(
+// Messages.getString("PipelineDefinition.10") + tdef.getResolverClass(), null); //$NON-NLS-1$
+// }
+// }
+
+ try {
+ invoker.addStylesheet(url, params, properties, resolver);
+ } catch (TransformerConfigurationException e) {
+ throw new ConfigurationException(
+ Messages.getString("PipelineDefinition.10") + tdef.getStylesheetURL(), null); //$NON-NLS-1$
}
}
}
@@ -174,28 +191,27 @@
*
* @return the set of attributes
*/
- public Set getAttributes()
- {
+ public Set getAttributes() {
return attributes;
}
/**
* Add a attribute to this configuration
*
- * @param attribute the attribute to add
+ * @param attribute
+ * the attribute to add
*/
- public void addAttribute(TypedValue attribute)
- {
+ public void addAttribute(TypedValue attribute) {
attributes.add(attribute);
}
/**
* Remove a attribute from the set of attributes
*
- * @param attribute the attribute to remove
+ * @param attribute
+ * the attribute to remove
*/
- public void removeAttribute(TypedValue attribute)
- {
+ public void removeAttribute(TypedValue attribute) {
attributes.remove(attribute);
}
@@ -204,48 +220,46 @@
*
* @return the list of transform definitions
*/
- public List getTransformDefs()
- {
+ public List getTransformDefs() {
return transformDefs;
}
/**
* Add a transform definition to this.
*
- * @param tdef the transform definition to add
+ * @param tdef
+ * the transform definition to add
*/
- public void addTransformDef(TransformDefinition tdef)
- {
+ public void addTransformDef(TransformDefinition tdef) {
transformDefs.add(tdef);
}
/**
* Remove a transform definition from this.
*
- * @param tdef the transform definition to remove
+ * @param tdef
+ * the transform definition to remove
*/
- public void removeTransformDef(TransformDefinition tdef)
- {
+ public void removeTransformDef(TransformDefinition tdef) {
transformDefs.remove(tdef);
}
/**
- * Set whether to use an XSL declaration embedded in the XML file
+ * Set whether to use an XSL declaration embedded in the XML file
*
- * @param embedded true to use embedded
+ * @param embedded
+ * true to use embedded
*/
- public void setUseEmbedded(boolean embedded)
- {
+ public void setUseEmbedded(boolean embedded) {
useEmbedded = embedded;
}
/**
- * Get whether to use an XSL declaration embedded in the XML file
+ * Get whether to use an XSL declaration embedded in the XML file
*
* @return true if embedded
*/
- public boolean useEmbedded()
- {
+ public boolean useEmbedded() {
return useEmbedded;
}
@@ -253,10 +267,10 @@
* Serialize this to a DOM Document.
*
* @return the serialized document
- * @throws ParserConfigurationException if a problem occurs during serialization
+ * @throws ParserConfigurationException
+ * if a problem occurs during serialization
*/
- public Document toXML() throws ParserConfigurationException
- {
+ public Document toXML() throws ParserConfigurationException {
Document doc = newDocument();
Element rootEl = doc.createElement("Pipeline"); //$NON-NLS-1$
rootEl.setAttribute("source", sourceURL); //$NON-NLS-1$
@@ -265,23 +279,20 @@
Element attributesEl = doc.createElement("Attributes"); //$NON-NLS-1$
rootEl.appendChild(attributesEl);
- for (Iterator iter = attributes.iterator(); iter.hasNext();)
- {
+ for (Iterator iter = attributes.iterator(); iter.hasNext();) {
TypedValue attribute = (TypedValue) iter.next();
Element attributeEl = doc.createElement("Attribute"); //$NON-NLS-1$
- attributeEl.setAttribute("name", attribute.uri); //$NON-NLS-1$
+ attributeEl.setAttribute("name", attribute.name); //$NON-NLS-1$
attributeEl.setAttribute("type", attribute.type); //$NON-NLS-1$
attributeEl.setAttribute("value", attribute.value); //$NON-NLS-1$
attributesEl.appendChild(attributeEl);
}
rootEl.setAttribute("useEmbedded", String.valueOf(useEmbedded)); //$NON-NLS-1$
- if (!useEmbedded)
- {
+ if (!useEmbedded) {
Element transformsEl = doc.createElement("Transforms"); //$NON-NLS-1$
rootEl.appendChild(transformsEl);
- for (Iterator iter = transformDefs.iterator(); iter.hasNext();)
- {
+ for (Iterator iter = transformDefs.iterator(); iter.hasNext();) {
TransformDefinition tdef = (TransformDefinition) iter.next();
Element tdefEl = tdef.asXML(doc);
transformsEl.appendChild(tdefEl);
@@ -291,8 +302,7 @@
return doc;
}
- private static Document newDocument() throws ParserConfigurationException
- {
+ private static Document newDocument() throws ParserConfigurationException {
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
Document doc = docBuilder.newDocument();
diff --git a/bundles/org.eclipse.wst.xsl.jaxp.debug/src/org/eclipse/wst/xsl/jaxp/debug/invoker/TransformDefinition.java b/bundles/org.eclipse.wst.xsl.jaxp.debug/src/org/eclipse/wst/xsl/jaxp/debug/invoker/TransformDefinition.java
index 8679d90..f51c8bd 100644
--- a/bundles/org.eclipse.wst.xsl.jaxp.debug/src/org/eclipse/wst/xsl/jaxp/debug/invoker/TransformDefinition.java
+++ b/bundles/org.eclipse.wst.xsl.jaxp.debug/src/org/eclipse/wst/xsl/jaxp/debug/invoker/TransformDefinition.java
@@ -10,12 +10,12 @@
*******************************************************************************/
package org.eclipse.wst.xsl.jaxp.debug.invoker;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.wst.xsl.jaxp.debug.invoker.internal.CreationException;
import org.w3c.dom.Document;
@@ -27,26 +27,30 @@
*
* @author Doug Satchwell
*/
-public class TransformDefinition
-{
+public class TransformDefinition {
+ public static final String DEFAULT_CATALOG_RESOLVER = "org.apache.xml.resolver.tools.CatalogResolver"; //$NON-NLS-1$
private String stylesheetURL;
private String resolverClass;
private Properties outputProperties = new Properties();
- private final Set parameters = new HashSet();
+ private final Set<TypedValue> parameters = new HashSet<TypedValue>();
+
+ public TransformDefinition() {
+ this.resolverClass = DEFAULT_CATALOG_RESOLVER;
+ }
/**
- * Get the parameters as a map of name (<code>String</code>) v. value <code>TypedValue</code>.
+ * Get the parameters as a map of name (<code>String</code>) v. value
+ * <code>TypedValue</code>.
*
* @return a map of names and values
- * @throws CreationException if an exception occurred during object creation
+ * @throws CreationException
+ * if an exception occurred during object creation
*/
- public Map getParametersAsMap() throws CreationException
- {
- Map m = new HashMap();
- for (Iterator iter = parameters.iterator(); iter.hasNext();)
- {
- TypedValue tv = (TypedValue) iter.next();
- String key = tv.uri;
+ public Map<String, Object> getParametersAsMap() throws CreationException {
+ Map<String, Object> m = new ConcurrentHashMap<String, Object>();
+ for (Iterator<TypedValue> iter = parameters.iterator(); iter.hasNext();) {
+ TypedValue tv = iter.next();
+ String key = tv.name;
Object value = tv.createValue();
m.put(key, value);
}
@@ -58,28 +62,27 @@
*
* @return a set of <code>TypedValue</code>'s
*/
- public Set getParameters()
- {
+ public Set<TypedValue> getParameters() {
return parameters;
}
/**
* Add a parameter to the set of parameters
*
- * @param parameter the parameter to add
+ * @param parameter
+ * the parameter to add
*/
- public void addParameter(TypedValue parameter)
- {
+ public void addParameter(TypedValue parameter) {
parameters.add(parameter);
}
/**
* Remove a parameter.
*
- * @param parameter the parameter to remove
+ * @param parameter
+ * the parameter to remove
*/
- public void removeParameter(TypedValue parameter)
- {
+ public void removeParameter(TypedValue parameter) {
parameters.remove(parameter);
}
@@ -88,39 +91,40 @@
*
* @return the output properties
*/
- public Properties getOutputProperties()
- {
+ public Properties getOutputProperties() {
return outputProperties;
}
/**
* Set the output properties for this.
*
- * @param outputProperties the output properties to set
+ * @param outputProperties
+ * the output properties to set
*/
- public void setOutputProperties(Properties outputProperties)
- {
+ public void setOutputProperties(Properties outputProperties) {
this.outputProperties = outputProperties;
}
/**
- * Set the value of a specific output property.
+ * Set the value of a specific output property. If the property
+ * does not already exist, it will be created.
*
- * @param name the output property
- * @param value the value
+ * @param name
+ * the output property
+ * @param value
+ * the value
*/
- public void setOutputProperty(String name, String value)
- {
+ public void setOutputProperty(String name, String value) {
outputProperties.put(name, value);
}
/**
* Remove an output property.
*
- * @param name the output property to remove
+ * @param name
+ * the output property to remove
*/
- public void removeOutputProperty(String name)
- {
+ public void removeOutputProperty(String name) {
outputProperties.remove(name);
}
@@ -129,18 +133,17 @@
*
* @return the resolver's class name
*/
- public String getResolverClass()
- {
+ public String getResolverClass() {
return resolverClass;
}
/**
* Set the name of the <code>URIResolver</code> class to use.
*
- * @param resolver the resolver's class name
+ * @param resolver
+ * the resolver's class name
*/
- public void setResolverClass(String resolver)
- {
+ public void setResolverClass(String resolver) {
resolverClass = resolver;
}
@@ -149,38 +152,38 @@
*
* @return the stylesheet URL
*/
- public String getStylesheetURL()
- {
+ public String getStylesheetURL() {
return stylesheetURL;
}
/**
* Set the URL of the stylesheet.
*
- * @param stylesheet the stylesheet URL
+ * @param stylesheet
+ * the stylesheet URL
*/
- public void setStylesheetURL(String stylesheet)
- {
+ public void setStylesheetURL(String stylesheet) {
stylesheetURL = stylesheet;
}
/**
* Serialize this to a Document fragment.
*
- * @param doc the document to attach to
+ * @param doc
+ * the document to attach to
* @return the root element of the fragment
*/
- public Element asXML(Document doc)
- {
+ public Element asXML(Document doc) {
Element tdefEl = doc.createElement("Transform"); //$NON-NLS-1$
- tdefEl.setAttribute(Messages.getString("TransformDefinition.1"), stylesheetURL); //$NON-NLS-1$
+ tdefEl.setAttribute(
+ Messages.getString("TransformDefinition.1"), stylesheetURL); //$NON-NLS-1$
if (resolverClass != null)
tdefEl.setAttribute("uriResolver", resolverClass); //$NON-NLS-1$
Element opEl = doc.createElement("OutputProperties"); //$NON-NLS-1$
tdefEl.appendChild(opEl);
- for (Iterator iter = outputProperties.entrySet().iterator(); iter.hasNext();)
- {
- Map.Entry entry = (Map.Entry) iter.next();
+ for (Iterator<?> iter = outputProperties.entrySet().iterator(); iter
+ .hasNext();) {
+ Map.Entry<?, ?> entry = (Map.Entry<?, ?>) iter.next();
Element propEl = doc.createElement("Property"); //$NON-NLS-1$
propEl.setAttribute("name", (String) entry.getKey()); //$NON-NLS-1$
propEl.setAttribute("value", (String) entry.getValue()); //$NON-NLS-1$
@@ -188,11 +191,10 @@
}
Element paramsEl = doc.createElement("Parameters"); //$NON-NLS-1$
tdefEl.appendChild(paramsEl);
- for (Iterator iter = parameters.iterator(); iter.hasNext();)
- {
+ for (Iterator<TypedValue> iter = parameters.iterator(); iter.hasNext();) {
Element propEl = doc.createElement("Parameter"); //$NON-NLS-1$
- TypedValue param = (TypedValue) iter.next();
- propEl.setAttribute("name", param.uri); //$NON-NLS-1$
+ TypedValue param = iter.next();
+ propEl.setAttribute("name", param.name); //$NON-NLS-1$
propEl.setAttribute("type", param.type); //$NON-NLS-1$
propEl.setAttribute("value", param.value); //$NON-NLS-1$
paramsEl.appendChild(propEl);
@@ -203,23 +205,22 @@
/**
* Create a new instance of this from its serialized form.
*
- * @param transformEl the element to create this from
+ * @param transformEl
+ * the element to create this from
* @return a new instance of this
*/
- public static TransformDefinition fromXML(Element transformEl)
- {
+ public static TransformDefinition fromXML(Element transformEl) {
TransformDefinition tdef = new TransformDefinition();
String url = transformEl.getAttribute("url"); //$NON-NLS-1$
tdef.setStylesheetURL(url);
String uriResolver = transformEl.getAttribute("uriResolver"); //$NON-NLS-1$
tdef.setResolverClass(uriResolver);
- Element opEl = (Element) transformEl.getElementsByTagName("OutputProperties").item(0); //$NON-NLS-1$
- if (opEl != null)
- {
+ Element opEl = (Element) transformEl.getElementsByTagName(
+ "OutputProperties").item(0); //$NON-NLS-1$
+ if (opEl != null) {
NodeList propEls = opEl.getElementsByTagName("Property"); //$NON-NLS-1$
- for (int i = 0; i < propEls.getLength(); i++)
- {
+ for (int i = 0; i < propEls.getLength(); i++) {
Element propEl = (Element) propEls.item(i);
String name = propEl.getAttribute("name"); //$NON-NLS-1$
String value = propEl.getAttribute("value"); //$NON-NLS-1$
@@ -227,16 +228,19 @@
}
}
- Element paramsEl = (Element) transformEl.getElementsByTagName(Messages.getString("TransformDefinition.18")).item(0); //$NON-NLS-1$
- if (paramsEl != null)
- {
- NodeList paramEls = paramsEl.getElementsByTagName(Messages.getString("TransformDefinition.19")); //$NON-NLS-1$
- for (int i = 0; i < paramEls.getLength(); i++)
- {
+ Element paramsEl = (Element) transformEl.getElementsByTagName(
+ Messages.getString("TransformDefinition.18")).item(0); //$NON-NLS-1$
+ if (paramsEl != null) {
+ NodeList paramEls = paramsEl.getElementsByTagName(Messages
+ .getString("TransformDefinition.19")); //$NON-NLS-1$
+ for (int i = 0; i < paramEls.getLength(); i++) {
Element paramEl = (Element) paramEls.item(i);
- String name = paramEl.getAttribute(Messages.getString("TransformDefinition.20")); //$NON-NLS-1$
- String type = paramEl.getAttribute(Messages.getString("TransformDefinition.21")); //$NON-NLS-1$
- String value = paramEl.getAttribute(Messages.getString("TransformDefinition.22")); //$NON-NLS-1$
+ String name = paramEl.getAttribute(Messages
+ .getString("TransformDefinition.20")); //$NON-NLS-1$
+ String type = paramEl.getAttribute(Messages
+ .getString("TransformDefinition.21")); //$NON-NLS-1$
+ String value = paramEl.getAttribute(Messages
+ .getString("TransformDefinition.22")); //$NON-NLS-1$
tdef.addParameter(new TypedValue(name, type, value));
}
}
diff --git a/bundles/org.eclipse.wst.xsl.jaxp.debug/src/org/eclipse/wst/xsl/jaxp/debug/invoker/TypedValue.java b/bundles/org.eclipse.wst.xsl.jaxp.debug/src/org/eclipse/wst/xsl/jaxp/debug/invoker/TypedValue.java
index ad51c4d..e0eea0e 100644
--- a/bundles/org.eclipse.wst.xsl.jaxp.debug/src/org/eclipse/wst/xsl/jaxp/debug/invoker/TypedValue.java
+++ b/bundles/org.eclipse.wst.xsl.jaxp.debug/src/org/eclipse/wst/xsl/jaxp/debug/invoker/TypedValue.java
@@ -13,123 +13,99 @@
import org.eclipse.wst.xsl.jaxp.debug.invoker.internal.CreationException;
/**
- * A value that is to be instantiated from a particular type e.g. Double, Object.
+ * A value that is to be instantiated from a particular type e.g. Double,
+ * Object.
*
* @author Doug Satchwell
*/
-public class TypedValue
-{
+public class TypedValue {
public static final String TYPE_STRING = "string"; //$NON-NLS-1$
- private static final String TYPE_BOOLEAN = "boolean"; //$NON-NLS-1$
- private static final String TYPE_INT = "int"; //$NON-NLS-1$
- private static final String TYPE_DOUBLE = "double"; //$NON-NLS-1$
- private static final String TYPE_FLOAT = "float"; //$NON-NLS-1$
- private static final String TYPE_CLASS = "class"; //$NON-NLS-1$
- private static final String TYPE_OBJECT = "object"; //$NON-NLS-1$
+ public static final String TYPE_BOOLEAN = "boolean"; //$NON-NLS-1$
+ public static final String TYPE_INT = "int"; //$NON-NLS-1$
+ public static final String TYPE_DOUBLE = "double"; //$NON-NLS-1$
+ public static final String TYPE_FLOAT = "float"; //$NON-NLS-1$
+ public static final String TYPE_CLASS = "class"; //$NON-NLS-1$
+ public static final String TYPE_OBJECT = "object"; //$NON-NLS-1$
- final String uri;
+ final String name;
final String type;
final String value;
/**
- * Create a new instance of this from the given information.
+ * Create a new instance of this from the given information.
*
- * @param uri the URI
- * @param type the type of value
- * @param value the value
+ * @param name
+ * the parameter name
+ * @param type
+ * the type of value
+ * @param value
+ * the value
*/
- public TypedValue(String uri, String type, String value)
- {
- this.uri = uri;
+ public TypedValue(String name, String type, String value) {
+ this.name = name;
this.type = type;
this.value = value;
}
/**
- * Create the type of object defined by this.
+ * Create the type of object defined by this.
*
* @return the value
- * @throws CreationException if a problem occurred
+ * @throws CreationException
+ * if a problem occurred
*/
- public Object createValue() throws CreationException
- {
+ public Object createValue() throws CreationException {
Object o = null;
- if (TYPE_STRING.equals(type))
- {
+ if (TYPE_STRING.equals(type)) {
o = value;
- }
- else if (TYPE_BOOLEAN.equals(type))
- {
+ } else if (TYPE_BOOLEAN.equals(type)) {
boolean b = "yes".equalsIgnoreCase(value) || "true".equalsIgnoreCase(value); //$NON-NLS-1$ //$NON-NLS-2$
o = new Boolean(b);
- }
- else if (TYPE_INT.equals(type))
- {
- try
- {
+ } else if (TYPE_INT.equals(type)) {
+ try {
o = new Integer(value);
+ } catch (NumberFormatException e) {
+ throw new CreationException(
+ Messages.getString("TypedValue.9") + value + Messages.getString("TypedValue.10"), e); //$NON-NLS-1$ //$NON-NLS-2$
}
- catch (NumberFormatException e)
- {
- throw new CreationException(Messages.getString("TypedValue.9") + value + Messages.getString("TypedValue.10"), e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- else if (TYPE_DOUBLE.equals(type))
- {
- try
- {
+ } else if (TYPE_DOUBLE.equals(type)) {
+ try {
o = new Double(value);
+ } catch (NumberFormatException e) {
+ throw new CreationException(
+ Messages.getString("TypedValue.11") + value + Messages.getString("TypedValue.12"), e); //$NON-NLS-1$ //$NON-NLS-2$
}
- catch (NumberFormatException e)
- {
- throw new CreationException(Messages.getString("TypedValue.11") + value + Messages.getString("TypedValue.12"), e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- else if (TYPE_FLOAT.equals(type))
- {
- try
- {
+ } else if (TYPE_FLOAT.equals(type)) {
+ try {
o = new Float(value);
+ } catch (NumberFormatException e) {
+ throw new CreationException(
+ Messages.getString("TypedValue.13") + value + Messages.getString("TypedValue.14"), e); //$NON-NLS-1$ //$NON-NLS-2$
}
- catch (NumberFormatException e)
- {
- throw new CreationException(Messages.getString("TypedValue.13") + value + Messages.getString("TypedValue.14"), e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- else if (TYPE_CLASS.equals(type))
- {
- try
- {
+ } else if (TYPE_CLASS.equals(type)) {
+ try {
o = Class.forName(value);
+ } catch (ClassNotFoundException e) {
+ throw new CreationException(
+ Messages.getString("TypedValue.15") + value + Messages.getString("TypedValue.16"), e); //$NON-NLS-1$ //$NON-NLS-2$
}
- catch (ClassNotFoundException e)
- {
- throw new CreationException(Messages.getString("TypedValue.15") + value + Messages.getString("TypedValue.16"), e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- else if (TYPE_OBJECT.equals(type))
- {
- try
- {
+ } else if (TYPE_OBJECT.equals(type)) {
+ try {
Class c = Class.forName(value);
o = c.newInstance();
+ } catch (ClassNotFoundException e) {
+ throw new CreationException(
+ Messages.getString("TypedValue.17") + value + Messages.getString("TypedValue.18"), e); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (InstantiationException e) {
+ throw new CreationException(
+ Messages.getString("TypedValue.19") + value + Messages.getString("TypedValue.20"), e); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (IllegalAccessException e) {
+ throw new CreationException(
+ Messages.getString("TypedValue.21") + value + Messages.getString("TypedValue.22"), e); //$NON-NLS-1$ //$NON-NLS-2$
}
- catch (ClassNotFoundException e)
- {
- throw new CreationException(Messages.getString("TypedValue.17") + value + Messages.getString("TypedValue.18"), e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- catch (InstantiationException e)
- {
- throw new CreationException(Messages.getString("TypedValue.19") + value + Messages.getString("TypedValue.20"), e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- catch (IllegalAccessException e)
- {
- throw new CreationException(Messages.getString("TypedValue.21") + value + Messages.getString("TypedValue.22"), e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- else
- {
- throw new CreationException(Messages.getString("TypedValue.23") + type + Messages.getString("TypedValue.24")); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ throw new CreationException(
+ Messages.getString("TypedValue.23") + type + Messages.getString("TypedValue.24")); //$NON-NLS-1$ //$NON-NLS-2$
}
return o;
}