[jboss-cvs] JBossAS SVN: r90737 - in projects/jboss-osgi/trunk: blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jul 1 04:15:22 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-07-01 04:15:22 -0400 (Wed, 01 Jul 2009)
New Revision: 90737
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TBean.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TBlueprint.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TComponent.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TProperty.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TService.java
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java
projects/jboss-osgi/trunk/eclipse/readme-commiters.txt
Log:
More JAXB based parsing
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TBean.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TBean.java 2009-07-01 07:45:21 UTC (rev 90736)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TBean.java 2009-07-01 08:15:22 UTC (rev 90737)
@@ -27,6 +27,8 @@
import java.util.List;
import java.util.Map;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
@@ -53,22 +55,17 @@
protected Boolean lazyInit;
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
- /**
- * Gets the value of the description property.
- */
public String getDescription()
{
return description;
}
- /**
- * Sets the value of the description property.
- */
public void setDescription(String value)
{
this.description = value;
}
+ @XmlElement(name = "property", namespace = BlueprintContext.XMLNS_BLUEPRINT)
public List<TProperty> getProperties()
{
return properties;
@@ -89,161 +86,77 @@
this.arguments = arguments;
}
- /**
- * Gets the value of the class property.
- */
+ @XmlAttribute(name = "class")
public String getClassName()
{
return className;
}
- /**
- * Sets the value of the class property.
- */
public void setClassName(String value)
{
this.className = value;
}
- /**
- * Gets the value of the initMethod property.
- *
- * @return possible object is {@link String }
- *
- */
public String getInitMethod()
{
return initMethod;
}
- /**
- * Sets the value of the initMethod property.
- *
- * @param value allowed object is {@link String }
- *
- */
public void setInitMethod(String value)
{
this.initMethod = value;
}
- /**
- * Gets the value of the destroyMethod property.
- *
- * @return possible object is {@link String }
- *
- */
public String getDestroyMethod()
{
return destroyMethod;
}
- /**
- * Sets the value of the destroyMethod property.
- *
- * @param value allowed object is {@link String }
- *
- */
public void setDestroyMethod(String value)
{
this.destroyMethod = value;
}
- /**
- * Gets the value of the factoryMethod property.
- *
- * @return possible object is {@link String }
- *
- */
public String getFactoryMethod()
{
return factoryMethod;
}
- /**
- * Sets the value of the factoryMethod property.
- *
- * @param value allowed object is {@link String }
- *
- */
public void setFactoryMethod(String value)
{
this.factoryMethod = value;
}
- /**
- * Gets the value of the factoryComponent property.
- *
- */
public String getFactoryComponentId()
{
return factoryComponent;
}
- /**
- * Sets the value of the factoryComponent property.
- *
- */
public void setFactoryComponentId(String value)
{
this.factoryComponent = value;
}
- /**
- * Gets the value of the scope property.
- *
- * @return possible object is {@link String }
- *
- */
public String getScope()
{
return scope;
}
- /**
- * Sets the value of the scope property.
- *
- * @param value allowed object is {@link String }
- *
- */
public void setScope(String value)
{
this.scope = value;
}
- /**
- * Gets the value of the lazyInit property.
- *
- * @return possible object is {@link Boolean }
- *
- */
public boolean isLazyInit()
{
return lazyInit;
}
- /**
- * Sets the value of the lazyInit property.
- *
- * @param value allowed object is {@link Boolean }
- *
- */
public void setLazyInit(boolean value)
{
this.lazyInit = value;
}
- /**
- * Gets a map that contains attributes that aren't bound to any typed property on this class.
- *
- * <p>
- * the map is keyed by the name of the attribute and the value is the string value of the attribute.
- *
- * the map returned by this method is live, and you can add new attribute by updating the map directly. Because of this design, there's no setter.
- *
- *
- * @return always non-null
- */
public Map<QName, String> getOtherAttributes()
{
return otherAttributes;
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TBlueprint.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TBlueprint.java 2009-07-01 07:45:21 UTC (rev 90736)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TBlueprint.java 2009-07-01 08:15:22 UTC (rev 90737)
@@ -33,6 +33,7 @@
import java.util.Map;
import java.util.Set;
+import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlNsForm;
@@ -50,9 +51,7 @@
*
* The definitions consist of two sections: the type-converter section and the components section.
*
- * blueprint ::= <type-converters> component
- * component ::= <bean> | <service> | service-reference
- * service-reference ::= <reference> | <ref-list> | <ref-set>
+ * blueprint ::= <type-converters> component component ::= <bean> | <service> | service-reference service-reference ::= <reference> | <ref-list> | <ref-set>
* type-converter ::= <bean> | <ref>
*
* @author thomas.diesler at jboss.com
@@ -65,10 +64,6 @@
{
protected String description;
protected TTypeConverters typeConverters;
- @XmlElements({
- @XmlElement(name="bean", namespace = BlueprintContext.XMLNS_BLUEPRINT, type=TBean.class),
- @XmlElement(name="service", namespace = BlueprintContext.XMLNS_BLUEPRINT, type=TService.class),
- @XmlElement(name="reference", namespace = BlueprintContext.XMLNS_BLUEPRINT, type=TReference.class)})
protected List<TComponent> components;
protected Boolean defaultLazyInit;
protected String defaultInitMethod;
@@ -77,49 +72,29 @@
protected TAvailability defaultAvailability;
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
- /**
- * Gets the value of the description property.
- *
- */
public String getDescription()
{
return description;
}
- /**
- * Sets the value of the description property.
- *
- */
public void setDescription(String value)
{
this.description = value;
}
- /**
- * Gets the value of the typeConverters property.
- *
- * @return possible object is {@link TTypeConverters }
- *
- */
public TTypeConverters getTypeConverters()
{
return typeConverters;
}
- /**
- * Sets the value of the typeConverters property.
- *
- * @param value allowed object is {@link TTypeConverters }
- *
- */
public void setTypeConverters(TTypeConverters value)
{
this.typeConverters = value;
}
- /**
- * Gets the value of components
- */
+ @XmlElements( { @XmlElement(name = "bean", namespace = BlueprintContext.XMLNS_BLUEPRINT, type = TBean.class),
+ @XmlElement(name = "service", namespace = BlueprintContext.XMLNS_BLUEPRINT, type = TService.class),
+ @XmlElement(name = "reference", namespace = BlueprintContext.XMLNS_BLUEPRINT, type = TReference.class) })
public List<TComponent> getComponents()
{
if (components == null)
@@ -171,75 +146,37 @@
return compMetadata;
}
- /**
- * Gets the value of the defaultLazyInit property.
- *
- * @return possible object is {@link Boolean }
- *
- */
+ @XmlAttribute(name = "default-lazy-init")
public Boolean isDefaultLazyInit()
{
return defaultLazyInit;
}
- /**
- * Sets the value of the defaultLazyInit property.
- *
- * @param value allowed object is {@link Boolean }
- *
- */
public void setDefaultLazyInit(Boolean value)
{
this.defaultLazyInit = value;
}
- /**
- * Gets the value of the defaultInitMethod property.
- *
- * @return possible object is {@link String }
- *
- */
public String getDefaultInitMethod()
{
return defaultInitMethod;
}
- /**
- * Sets the value of the defaultInitMethod property.
- *
- * @param value allowed object is {@link String }
- *
- */
public void setDefaultInitMethod(String value)
{
this.defaultInitMethod = value;
}
- /**
- * Gets the value of the defaultDestroyMethod property.
- *
- * @return possible object is {@link String }
- *
- */
public String getDefaultDestroyMethod()
{
return defaultDestroyMethod;
}
- /**
- * Sets the value of the defaultDestroyMethod property.
- *
- * @param value allowed object is {@link String }
- *
- */
public void setDefaultDestroyMethod(String value)
{
this.defaultDestroyMethod = value;
}
- /**
- * Gets the value of the defaultTimeout property.
- */
public BigInteger getDefaultTimeout()
{
if (defaultTimeout == null)
@@ -248,20 +185,11 @@
return defaultTimeout;
}
- /**
- * Sets the value of the defaultTimeout property.
- */
public void setDefaultTimeout(BigInteger value)
{
this.defaultTimeout = value;
}
- /**
- * Gets the value of the defaultAvailability property.
- *
- * @return possible object is {@link Tavailability }
- *
- */
public TAvailability getDefaultAvailability()
{
if (defaultAvailability == null)
@@ -270,28 +198,11 @@
return defaultAvailability;
}
- /**
- * Sets the value of the defaultAvailability property.
- *
- * @param value allowed object is {@link Tavailability }
- *
- */
public void setDefaultAvailability(TAvailability value)
{
this.defaultAvailability = value;
}
- /**
- * Gets a map that contains attributes that aren't bound to any typed property on this class.
- *
- * <p>
- * the map is keyed by the name of the attribute and the value is the string value of the attribute.
- *
- * the map returned by this method is live, and you can add new attribute by updating the map directly. Because of this design, there's no setter.
- *
- *
- * @return always non-null
- */
public Map<QName, String> getOtherAttributes()
{
return otherAttributes;
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TComponent.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TComponent.java 2009-07-01 07:45:21 UTC (rev 90736)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TComponent.java 2009-07-01 08:15:22 UTC (rev 90737)
@@ -26,6 +26,10 @@
import java.util.ArrayList;
import java.util.List;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.osgi.blueprint.BlueprintContext;
import org.osgi.service.blueprint.reflect.ComponentMetadata;
/**
@@ -41,23 +45,19 @@
* @author thomas.diesler at jboss.com
* @since 13-May-2009
*/
+ at XmlType(name = "TComponent", namespace = BlueprintContext.XMLNS_BLUEPRINT)
public abstract class TComponent
{
protected String id;
protected List<String> dependsOn;
protected int initialization;
- /**
- * Gets the value of the id property.
- */
+ @XmlAttribute(name = "id")
public String getId()
{
return id;
}
- /**
- * Sets the value of the id property.
- */
public void setId(String value)
{
this.id = value;
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TProperty.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TProperty.java 2009-07-01 07:45:21 UTC (rev 90736)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TProperty.java 2009-07-01 08:15:22 UTC (rev 90737)
@@ -26,6 +26,10 @@
import java.util.ArrayList;
import java.util.List;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.osgi.blueprint.BlueprintContext;
+
/**
*
*
@@ -60,6 +64,7 @@
*
*
*/
+ at XmlType(name = "TProperty", namespace = BlueprintContext.XMLNS_BLUEPRINT)
public class TProperty
{
protected String description;
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TService.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TService.java 2009-07-01 07:45:21 UTC (rev 90736)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TService.java 2009-07-01 08:15:22 UTC (rev 90737)
@@ -29,6 +29,7 @@
import java.util.List;
import java.util.Map;
+import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
@@ -55,31 +56,28 @@
protected int ranking;
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
- /**
- * Gets the value of the description property.
- *
- * @return possible object is {@link String }
- *
- */
public String getDescription()
{
return description;
}
- /**
- * Sets the value of the description property.
- *
- * @param value allowed object is {@link String }
- *
- */
public void setDescription(String value)
{
this.description = value;
}
- /**
- * Gets the value of the interfaces property.
- */
+ @XmlAttribute(name = "interface")
+ public String getInterface()
+ {
+ List<String> interfaceNames = getInterfaceNames();
+ return interfaceNames.size() > 0 ? interfaceNames.get(0) : null;
+ }
+
+ public void setInterface(String interf)
+ {
+ getInterfaceNames().add(interf);
+ }
+
public List<String> getInterfaceNames()
{
if (interfaceNames == null)
@@ -93,9 +91,6 @@
this.interfaceNames = interfaces;
}
- /**
- * Gets the value of the serviceProperties property.
- */
public List<TServicePropertyEntry> getServiceProperties()
{
if (serviceProperties == null)
@@ -109,9 +104,6 @@
this.serviceProperties = serviceProperties;
}
- /**
- * Gets the value of the registrationListener property.
- */
public Collection<TRegistrationListener> getRegistrationListeners()
{
if (registrationListener == null)
@@ -125,31 +117,16 @@
this.registrationListener = registrationListener;
}
- /**
- * Gets the value of the bean property.
- *
- * @return possible object is {@link TBean }
- *
- */
public TBean getBean()
{
return bean;
}
- /**
- * Sets the value of the bean property.
- *
- * @param value allowed object is {@link TBean }
- *
- */
public void setBean(TBean value)
{
this.bean = value;
}
- /**
- * Gets the value of the any property.
- */
public List<Object> getAny()
{
if (any == null)
@@ -159,33 +136,16 @@
return this.any;
}
- /**
- * Gets the value of the ref property.
- *
- * @return possible object is {@link String }
- *
- */
public String getRef()
{
return ref;
}
- /**
- * Sets the value of the ref property.
- *
- * @param value allowed object is {@link String }
- *
- */
public void setRef(String value)
{
this.ref = value;
}
- /**
- * Gets the value of the autoExport property.
- *
- * @return possible object is {@link TAutoExportModes }
- */
public TAutoExportModes getAutoExportMode()
{
if (autoExportMode == null)
@@ -194,35 +154,21 @@
return autoExportMode;
}
- /**
- * Sets the value of the autoExport property.
- *
- * @param value allowed object is {@link TAutoExportModes }
- */
public void setAutoExportMode(TAutoExportModes value)
{
this.autoExportMode = value;
}
- /**
- * Gets the value of the ranking property.
- */
public int getRanking()
{
return ranking;
}
- /**
- * Sets the value of the ranking property.
- */
public void setRanking(int value)
{
this.ranking = value;
}
- /**
- * Gets a map that contains attributes that aren't bound to any typed property on this class.
- */
public Map<QName, String> getOtherAttributes()
{
return otherAttributes;
Modified: projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java 2009-07-01 07:45:21 UTC (rev 90736)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java 2009-07-01 08:15:22 UTC (rev 90737)
@@ -51,11 +51,11 @@
TBlueprint blueprint = new BlueprintParser(new MockBlueprintContext()).parse(xmlURL);
// assert default attributes
- assertEquals(TAvailability.MANDATORY, blueprint.getDefaultAvailability());
- assertEquals(new BigInteger("300000"), blueprint.getDefaultTimeout());
- assertEquals(Boolean.FALSE, blueprint.isDefaultLazyInit());
- assertNull(blueprint.getDefaultInitMethod());
- assertNull(blueprint.getDefaultDestroyMethod());
+ assertEquals("default-availability: mandatory", TAvailability.MANDATORY, blueprint.getDefaultAvailability());
+ assertEquals("default-timeout: 300000", new BigInteger("300000"), blueprint.getDefaultTimeout());
+ assertEquals("default-lazy-init: FALSE", Boolean.FALSE, blueprint.isDefaultLazyInit());
+ assertNull("default-init-method: null", blueprint.getDefaultInitMethod());
+ assertNull("default-destroy-method: null", blueprint.getDefaultDestroyMethod());
}
@Test
Modified: projects/jboss-osgi/trunk/eclipse/readme-commiters.txt
===================================================================
--- projects/jboss-osgi/trunk/eclipse/readme-commiters.txt 2009-07-01 07:45:21 UTC (rev 90736)
+++ projects/jboss-osgi/trunk/eclipse/readme-commiters.txt 2009-07-01 08:15:22 UTC (rev 90737)
@@ -10,6 +10,7 @@
[auto-props]
*.bat = svn:keywords=Id Revision;svn:eol-style=LF
*.java = svn:keywords=Id Revision;svn:eol-style=LF
+*.properties = svn:keywords=Id Revision;svn:eol-style=LF
*.sh = svn:keywords=Id Revision;svn:eol-style=LF
*.txt = svn:keywords=Id Revision;svn:eol-style=LF
*.wsdl = svn:keywords=Id Revision;svn:eol-style=LF
More information about the jboss-cvs-commits
mailing list