[jboss-cvs] JBossAS SVN: r90313 - in projects/jboss-osgi/trunk: blueprint/impl/src/main/java/org/jboss/osgi/blueprint/context and 8 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jun 17 06:37:51 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-06-17 06:37:51 -0400 (Wed, 17 Jun 2009)
New Revision: 90313
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BlueprintMetadata.java
Removed:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BlueprintImpl.java
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/context/BlueprintContextImpl.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/BlueprintParser.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/TypeConverters.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/resources/schema/blueprint-jbxb.xsd
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/AllElementsParserTestCase.java
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java
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/BasicServiceParserTestCase.java
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/resources/log4j.xml
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/resources/parser/blueprint-all-elements.xml
projects/jboss-osgi/trunk/pom.xml
Log:
More BP parser test coverage
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/context/BlueprintContextImpl.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/context/BlueprintContextImpl.java 2009-06-17 10:17:23 UTC (rev 90312)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/context/BlueprintContextImpl.java 2009-06-17 10:37:51 UTC (rev 90313)
@@ -23,19 +23,14 @@
//$Id$
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.List;
import java.util.Set;
-import org.jboss.osgi.blueprint.reflect.BlueprintImpl;
+import org.jboss.osgi.blueprint.reflect.BlueprintMetadata;
import org.jboss.osgi.spi.NotImplementedException;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.service.blueprint.context.BlueprintContext;
-import org.osgi.service.blueprint.context.NoSuchComponentException;
import org.osgi.service.blueprint.reflect.BeanMetadata;
import org.osgi.service.blueprint.reflect.ComponentMetadata;
import org.osgi.service.blueprint.reflect.ServiceMetadata;
@@ -53,9 +48,9 @@
public class BlueprintContextImpl implements BlueprintContext
{
private Bundle bundle;
- private BlueprintImpl bpMetadata;
+ private BlueprintMetadata bpMetadata;
- public BlueprintContextImpl(Bundle bundle, BlueprintImpl bpMetadata)
+ public BlueprintContextImpl(Bundle bundle, BlueprintMetadata bpMetadata)
{
this.bundle = bundle;
this.bpMetadata = bpMetadata;
@@ -63,13 +58,7 @@
public Collection<BeanMetadata> getBeanComponentsMetadata()
{
- List<BeanMetadata> beanMetadata = new ArrayList<BeanMetadata>();
- for (ComponentMetadata comp : bpMetadata.getComponents())
- {
- if (comp instanceof BeanMetadata)
- beanMetadata.add((BeanMetadata)comp);
- }
- return Collections.unmodifiableList(beanMetadata);
+ return bpMetadata.getBeanComponentsMetadata();
}
public BundleContext getBundleContext()
@@ -84,50 +73,21 @@
public ComponentMetadata getComponentMetadata(String name)
{
- ComponentMetadata compMetadata = null;
- for (ComponentMetadata aux : bpMetadata.getComponents())
- {
- if (aux.getId().equals(name))
- {
- compMetadata = aux;
- break;
- }
- }
-
- if (compMetadata == null)
- throw new NoSuchComponentException("Cannot get component metadata for: " + name);
-
- return compMetadata;
+ return bpMetadata.getComponentMetadata(name);
}
public Set<String> getComponentNames()
{
- Set<String> compNames = new LinkedHashSet<String>();
- for (ComponentMetadata comp : bpMetadata.getComponents())
- compNames.add(comp.getId());
-
- return Collections.unmodifiableSet(compNames);
+ return bpMetadata.getComponentNames();
}
public Collection<ServiceMetadata> getExportedServicesMetadata()
{
- List<ServiceMetadata> servMetadata = new ArrayList<ServiceMetadata>();
- for (ComponentMetadata comp : bpMetadata.getComponents())
- {
- if (comp instanceof ServiceMetadata)
- servMetadata.add((ServiceMetadata)comp);
- }
- return Collections.unmodifiableList(servMetadata);
+ return bpMetadata.getExportedServicesMetadata();
}
public Collection<ServiceReferenceMetadata> getReferencedServicesMetadata()
{
- List<ServiceReferenceMetadata> srefMetadata = new ArrayList<ServiceReferenceMetadata>();
- for (ComponentMetadata comp : bpMetadata.getComponents())
- {
- if (comp instanceof ServiceReferenceMetadata)
- srefMetadata.add((ServiceReferenceMetadata)comp);
- }
- return Collections.unmodifiableList(srefMetadata);
+ return bpMetadata.getReferencedServicesMetadata();
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java 2009-06-17 10:17:23 UTC (rev 90312)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java 2009-06-17 10:37:51 UTC (rev 90313)
@@ -28,7 +28,7 @@
import org.jboss.osgi.blueprint.context.BlueprintContextImpl;
import org.jboss.osgi.blueprint.parser.BlueprintParser;
-import org.jboss.osgi.blueprint.reflect.BlueprintImpl;
+import org.jboss.osgi.blueprint.reflect.BlueprintMetadata;
import org.jboss.osgi.common.log.LogServiceTracker;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -61,7 +61,7 @@
{
Bundle bundle = event.getBundle();
- BlueprintImpl bpMetadata = null;
+ BlueprintMetadata bpMetadata = null;
if (event.getType() == BundleEvent.STARTING)
{
@@ -78,7 +78,7 @@
for (String descriptor : descritors)
{
- BlueprintImpl aux = processDescriptor(bundle, descriptor);
+ BlueprintMetadata aux = processDescriptor(bundle, descriptor);
bpMetadata = aux.merge(bpMetadata);
}
}
@@ -89,7 +89,7 @@
while (foundEntries.hasMoreElements())
{
URL nextEntry = (URL)foundEntries.nextElement();
- BlueprintImpl aux = processDescriptor(bundle, nextEntry);
+ BlueprintMetadata aux = processDescriptor(bundle, nextEntry);
bpMetadata = aux.merge(bpMetadata);
}
}
@@ -111,15 +111,15 @@
// currently does nothing
}
- private BlueprintImpl processDescriptor(Bundle bundle, String descriptor)
+ private BlueprintMetadata processDescriptor(Bundle bundle, String descriptor)
{
URL descriptorURL = bundle.getResource(descriptor);
return processDescriptor(bundle, descriptorURL);
}
- private BlueprintImpl processDescriptor(Bundle bundle, URL descriptorURL)
+ private BlueprintMetadata processDescriptor(Bundle bundle, URL descriptorURL)
{
- BlueprintImpl blueprint = new BlueprintParser().parse(descriptorURL);
+ BlueprintMetadata blueprint = new BlueprintParser().parse(descriptorURL);
return blueprint;
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/BlueprintParser.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/BlueprintParser.java 2009-06-17 10:17:23 UTC (rev 90312)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/BlueprintParser.java 2009-06-17 10:37:51 UTC (rev 90313)
@@ -27,7 +27,7 @@
import org.apache.xerces.dom.DOMXSImplementationSourceImpl;
import org.jboss.osgi.blueprint.BlueprintException;
-import org.jboss.osgi.blueprint.reflect.BlueprintImpl;
+import org.jboss.osgi.blueprint.reflect.BlueprintMetadata;
import org.jboss.xb.binding.JBossXBException;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
@@ -84,7 +84,7 @@
/*
* * Parse a blueprint descriptor
*/
- public BlueprintImpl parse(URL xmlURL)
+ public BlueprintMetadata parse(URL xmlURL)
{
if (xmlURL == null)
throw new IllegalArgumentException("Cannot parse null descriptor URL");
@@ -96,7 +96,11 @@
Thread.currentThread().setContextClassLoader(bundleCL);
Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- return (BlueprintImpl)unmarshaller.unmarshal(xmlURL.toExternalForm(), schemaBinding);
+ BlueprintMetadata bpMetadata = (BlueprintMetadata)unmarshaller.unmarshal(xmlURL.toExternalForm(), schemaBinding);
+
+ bpMetadata.initialize();
+
+ return bpMetadata;
}
catch (JBossXBException ex)
{
Deleted: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BlueprintImpl.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BlueprintImpl.java 2009-06-17 10:17:23 UTC (rev 90312)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BlueprintImpl.java 2009-06-17 10:37:51 UTC (rev 90313)
@@ -1,248 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.blueprint.reflect;
-
-// $Id$
-
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.osgi.spi.NotImplementedException;
-import org.osgi.service.blueprint.reflect.ComponentMetadata;
-
-/**
- * The blueprint element is the top element.
- *
- * 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>
- * type-converter ::= <bean> | <ref>
- *
- * @author thomas.diesler at jboss.com
- * @since 13-May-2009
- */
-public class BlueprintImpl
-{
- protected String description;
- protected TypeConverters typeConverters;
- protected List<ComponentMetadata> components;
- protected Boolean defaultLazyInit;
- protected String defaultInitMethod;
- protected String defaultDestroyMethod;
- protected BigInteger defaultTimeout;
- protected Availability 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 TypeConverters }
- *
- */
- public TypeConverters getTypeConverters()
- {
- return typeConverters;
- }
-
- /**
- * Sets the value of the typeConverters property.
- *
- * @param value allowed object is {@link TypeConverters }
- *
- */
- public void setTypeConverters(TypeConverters value)
- {
- this.typeConverters = value;
- }
-
- /**
- * Gets the value of components
- */
- public List<ComponentMetadata> getComponents()
- {
- if (components == null)
- components = new ArrayList<ComponentMetadata>();
-
- return this.components;
- }
-
- /**
- * Gets the value of the defaultLazyInit property.
- *
- * @return possible object is {@link Boolean }
- *
- */
- 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)
- defaultTimeout = new BigInteger("300000");
-
- 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 Availability getDefaultAvailability()
- {
- if (defaultAvailability == null)
- defaultAvailability = Availability.MANDATORY;
-
- return defaultAvailability;
- }
-
- /**
- * Sets the value of the defaultAvailability property.
- *
- * @param value allowed object is {@link Tavailability }
- *
- */
- public void setDefaultAvailability(Availability 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;
- }
-
- // Merge this Blueprint meta data with the given other, which may be null.
- public BlueprintImpl merge(BlueprintImpl other)
- {
- if (other == null)
- return this;
-
- throw new NotImplementedException("Blueprint metadata merge not yet implemented");
- }
-}
Copied: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BlueprintMetadata.java (from rev 90297, projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BlueprintImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BlueprintMetadata.java (rev 0)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BlueprintMetadata.java 2009-06-17 10:37:51 UTC (rev 90313)
@@ -0,0 +1,329 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.blueprint.reflect;
+
+// $Id$
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.osgi.spi.NotImplementedException;
+import org.osgi.service.blueprint.context.NoSuchComponentException;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.osgi.service.blueprint.reflect.ServiceMetadata;
+import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata;
+
+/**
+ * The blueprint element is the top element.
+ *
+ * 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>
+ * type-converter ::= <bean> | <ref>
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class BlueprintMetadata
+{
+ protected String description;
+ protected TypeConverters typeConverters;
+ protected List<ComponentMetadata> components;
+ protected Boolean defaultLazyInit;
+ protected String defaultInitMethod;
+ protected String defaultDestroyMethod;
+ protected BigInteger defaultTimeout;
+ protected Availability defaultAvailability;
+ private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+ public void initialize()
+ {
+ if (typeConverters != null)
+ typeConverters.resolveRefs(this);
+ }
+
+ /**
+ * 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 TypeConverters }
+ *
+ */
+ public TypeConverters getTypeConverters()
+ {
+ return typeConverters;
+ }
+
+ /**
+ * Sets the value of the typeConverters property.
+ *
+ * @param value allowed object is {@link TypeConverters }
+ *
+ */
+ public void setTypeConverters(TypeConverters value)
+ {
+ this.typeConverters = value;
+ }
+
+ /**
+ * Gets the value of components
+ */
+ public List<ComponentMetadata> getComponents()
+ {
+ if (components == null)
+ components = new ArrayList<ComponentMetadata>();
+
+ return this.components;
+ }
+
+ public Set<String> getComponentNames()
+ {
+ Set<String> compNames = new LinkedHashSet<String>();
+ for (ComponentMetadata comp : getComponents())
+ compNames.add(comp.getId());
+
+ return Collections.unmodifiableSet(compNames);
+ }
+
+ /**
+ * Get ComponentMetadata by name
+ * @throws NoSuchComponentException if not found
+ */
+ public ComponentMetadata getComponentMetadata(String name)
+ {
+ if (name == null)
+ throw new IllegalArgumentException("Cannot get component metadata for 'null' name");
+
+ ComponentMetadata compMetadata = null;
+ for (ComponentMetadata aux : getComponents())
+ {
+ if (name.equals(aux.getId()))
+ {
+ compMetadata = aux;
+ break;
+ }
+ }
+
+ if (compMetadata == null)
+ throw new NoSuchComponentException(name);
+
+ return compMetadata;
+ }
+
+ public Collection<BeanMetadata> getBeanComponentsMetadata()
+ {
+ List<BeanMetadata> beanMetadata = new ArrayList<BeanMetadata>();
+ for (ComponentMetadata comp : getComponents())
+ {
+ if (comp instanceof BeanMetadata)
+ beanMetadata.add((BeanMetadata)comp);
+ }
+ return Collections.unmodifiableList(beanMetadata);
+ }
+
+ public Collection<ServiceMetadata> getExportedServicesMetadata()
+ {
+ List<ServiceMetadata> servMetadata = new ArrayList<ServiceMetadata>();
+ for (ComponentMetadata comp : getComponents())
+ {
+ if (comp instanceof ServiceMetadata)
+ servMetadata.add((ServiceMetadata)comp);
+ }
+ return Collections.unmodifiableList(servMetadata);
+ }
+
+ public Collection<ServiceReferenceMetadata> getReferencedServicesMetadata()
+ {
+ List<ServiceReferenceMetadata> srefMetadata = new ArrayList<ServiceReferenceMetadata>();
+ for (ComponentMetadata comp : getComponents())
+ {
+ if (comp instanceof ServiceReferenceMetadata)
+ srefMetadata.add((ServiceReferenceMetadata)comp);
+ }
+ return Collections.unmodifiableList(srefMetadata);
+ }
+
+ /**
+ * Gets the value of the defaultLazyInit property.
+ *
+ * @return possible object is {@link Boolean }
+ *
+ */
+ 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)
+ defaultTimeout = new BigInteger("300000");
+
+ 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 Availability getDefaultAvailability()
+ {
+ if (defaultAvailability == null)
+ defaultAvailability = Availability.MANDATORY;
+
+ return defaultAvailability;
+ }
+
+ /**
+ * Sets the value of the defaultAvailability property.
+ *
+ * @param value allowed object is {@link Tavailability }
+ *
+ */
+ public void setDefaultAvailability(Availability 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;
+ }
+
+ // Merge this Blueprint meta data with the given other, which may be null.
+ public BlueprintMetadata merge(BlueprintMetadata other)
+ {
+ if (other == null)
+ return this;
+
+ throw new NotImplementedException("Blueprint metadata merge not yet implemented");
+ }
+}
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/TypeConverters.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/TypeConverters.java 2009-06-17 10:17:23 UTC (rev 90312)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/TypeConverters.java 2009-06-17 10:37:51 UTC (rev 90313)
@@ -56,19 +56,33 @@
*/
public class TypeConverters
{
- protected List<Object> beanOrReferenceOrRef;
+ protected List<Object> components;
- /**
- * Gets the value of the beanOrReferenceOrRef property.
- *
- */
- public List<Object> getBeanOrReferenceOrRef()
+ public List<Object> getComponents()
{
- if (beanOrReferenceOrRef == null)
+ if (components == null)
+ components = new ArrayList<Object>();
+
+ return components;
+ }
+
+ public void setComponents(List<Object> converters)
+ {
+ this.components = converters;
+ }
+
+ void resolveRefs(BlueprintMetadata bpMetadata)
+ {
+ for (int i = 0; i < getComponents().size(); i++)
{
- beanOrReferenceOrRef = new ArrayList<Object>();
+ Object comp = components.get(i);
+ if (comp instanceof RefImpl)
+ {
+ RefImpl ref = (RefImpl)comp;
+ String compName = ref.getComponent();
+ comp = bpMetadata.getComponentMetadata(compName);
+ components.set(i, comp);
+ }
}
- return this.beanOrReferenceOrRef;
}
-
}
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java 2009-06-17 10:17:23 UTC (rev 90312)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java 2009-06-17 10:37:51 UTC (rev 90313)
@@ -15,7 +15,6 @@
*/
package org.osgi.service.blueprint.reflect;
-
/**
* Base class for all components.
*
@@ -23,14 +22,11 @@
* @see ServiceReferenceMetadata
* @see ServiceMetadata
*/
-public interface ComponentMetadata extends NonNullMetadata {
-
- /**
- * The id of the component.
- *
- * ### renamed to getId
- * @return component id. The component id can be <code>null</code> if this is an anonymously
- * defined inner component.
- */
- String getId();
+public interface ComponentMetadata extends NonNullMetadata
+{
+ /*
+ * The id of the component. ### renamed to getId
+ * @return component id. The component id can be <code>null</code> if this is an anonymously defined inner component.
+ */
+ String getId();
}
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/resources/schema/blueprint-jbxb.xsd
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/resources/schema/blueprint-jbxb.xsd 2009-06-17 10:17:23 UTC (rev 90312)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/resources/schema/blueprint-jbxb.xsd 2009-06-17 10:37:51 UTC (rev 90313)
@@ -85,7 +85,7 @@
<xsd:complexType name="Tblueprint">
<xsd:annotation>
<xsd:appinfo>
- <jbxb:class impl="org.jboss.osgi.blueprint.reflect.BlueprintImpl"></jbxb:class>
+ <jbxb:class impl="org.jboss.osgi.blueprint.reflect.BlueprintMetadata"></jbxb:class>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
Modified: projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/AllElementsParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/AllElementsParserTestCase.java 2009-06-17 10:17:23 UTC (rev 90312)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/AllElementsParserTestCase.java 2009-06-17 10:37:51 UTC (rev 90313)
@@ -31,11 +31,13 @@
import org.jboss.osgi.blueprint.parser.BlueprintParser;
import org.jboss.osgi.blueprint.reflect.Availability;
-import org.jboss.osgi.blueprint.reflect.BlueprintImpl;
+import org.jboss.osgi.blueprint.reflect.BlueprintMetadata;
import org.jboss.osgi.blueprint.reflect.TypeConverters;
import org.jboss.osgi.spi.testing.OSGiTestHelper;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.reflect.ReferenceMetadata;
/**
* Blueprint parser tests
@@ -45,7 +47,7 @@
*/
public class AllElementsParserTestCase
{
- private static BlueprintImpl blueprint;
+ private static BlueprintMetadata blueprint;
@BeforeClass
public static void beforeClass()
@@ -86,7 +88,22 @@
TypeConverters typeConverters = blueprint.getTypeConverters();
assertNotNull("TypeConverters not null", typeConverters);
- List<Object> beanOrReferenceOrRef = typeConverters.getBeanOrReferenceOrRef();
- assertEquals("TypeConverters size", 5, beanOrReferenceOrRef);
+ List<Object> converters = typeConverters.getComponents();
+ assertEquals("TypeConverters size", 5, converters.size());
+
+ BeanMetadata conv1 = (BeanMetadata)converters.get(0);
+ assertNotNull("Converter not null", conv1);
+
+ ReferenceMetadata conv2 = (ReferenceMetadata)converters.get(1);
+ assertNotNull("Converter not null", conv2);
+
+ ReferenceMetadata conv3 = (ReferenceMetadata)converters.get(2);
+ assertNotNull("Converter not null", conv3);
+
+ BeanMetadata conv4 = (BeanMetadata)converters.get(3);
+ assertNotNull("Converter not null", conv4);
+
+ BeanMetadata conv5 = (BeanMetadata)converters.get(4);
+ assertNotNull("Converter not null", conv5);
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java 2009-06-17 10:17:23 UTC (rev 90312)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java 2009-06-17 10:37:51 UTC (rev 90313)
@@ -30,7 +30,7 @@
import java.util.List;
import org.jboss.osgi.blueprint.parser.BlueprintParser;
-import org.jboss.osgi.blueprint.reflect.BlueprintImpl;
+import org.jboss.osgi.blueprint.reflect.BlueprintMetadata;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.jboss.test.osgi.blueprint.parser.comp.BeanA;
import org.jboss.test.osgi.blueprint.parser.comp.BeanB;
@@ -50,7 +50,7 @@
public void testBasicBeans() throws Exception
{
URL xmlURL = getResourceURL("parser/blueprint-basic-beans.xml");
- BlueprintImpl blueprint = new BlueprintParser().parse(xmlURL);
+ BlueprintMetadata blueprint = new BlueprintParser().parse(xmlURL);
List<ComponentMetadata> compList = blueprint.getComponents();
assertTrue(compList.size() > 0);
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-06-17 10:17:23 UTC (rev 90312)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java 2009-06-17 10:37:51 UTC (rev 90313)
@@ -31,7 +31,7 @@
import org.jboss.osgi.blueprint.parser.BlueprintParser;
import org.jboss.osgi.blueprint.reflect.Availability;
-import org.jboss.osgi.blueprint.reflect.BlueprintImpl;
+import org.jboss.osgi.blueprint.reflect.BlueprintMetadata;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.junit.Test;
@@ -47,7 +47,7 @@
public void testBlueprintDefaultAttributes() throws Exception
{
URL xmlURL = getResourceURL("parser/blueprint-basic-root.xml");
- BlueprintImpl blueprint = new BlueprintParser().parse(xmlURL);
+ BlueprintMetadata blueprint = new BlueprintParser().parse(xmlURL);
// assert default attributes
assertEquals(Availability.MANDATORY, blueprint.getDefaultAvailability());
@@ -61,7 +61,7 @@
public void testBlueprintDescription() throws Exception
{
URL xmlURL = getResourceURL("parser/blueprint-basic-root.xml");
- BlueprintImpl blueprint = new BlueprintParser().parse(xmlURL);
+ BlueprintMetadata blueprint = new BlueprintParser().parse(xmlURL);
// assert description
assertEquals("some text", blueprint.getDescription());
Modified: projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java 2009-06-17 10:17:23 UTC (rev 90312)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java 2009-06-17 10:37:51 UTC (rev 90313)
@@ -30,7 +30,7 @@
import java.util.List;
import org.jboss.osgi.blueprint.parser.BlueprintParser;
-import org.jboss.osgi.blueprint.reflect.BlueprintImpl;
+import org.jboss.osgi.blueprint.reflect.BlueprintMetadata;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.jboss.test.osgi.blueprint.parser.comp.BeanA;
import org.jboss.test.osgi.blueprint.parser.comp.ServiceA;
@@ -52,7 +52,7 @@
public void testBasicBeans() throws Exception
{
URL xmlURL = getResourceURL("parser/blueprint-basic-service.xml");
- BlueprintImpl blueprint = new BlueprintParser().parse(xmlURL);
+ BlueprintMetadata blueprint = new BlueprintParser().parse(xmlURL);
List<ComponentMetadata> compList = blueprint.getComponents();
assertTrue(compList.size() > 0);
Modified: projects/jboss-osgi/trunk/blueprint/testsuite/src/test/resources/log4j.xml
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/src/test/resources/log4j.xml 2009-06-17 10:17:23 UTC (rev 90312)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/src/test/resources/log4j.xml 2009-06-17 10:37:51 UTC (rev 90313)
@@ -38,11 +38,11 @@
</category>
-->
- <!-- Show jboss deployer traces -->
+ <!-- Show jboss deployer traces
<category name="org.jboss.xb">
<priority value="TRACE" />
</category>
-
+ -->
<!-- ======================= -->
<!-- Setup the Root category -->
Modified: projects/jboss-osgi/trunk/blueprint/testsuite/src/test/resources/parser/blueprint-all-elements.xml
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/src/test/resources/parser/blueprint-all-elements.xml 2009-06-17 10:17:23 UTC (rev 90312)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/src/test/resources/parser/blueprint-all-elements.xml 2009-06-17 10:37:51 UTC (rev 90313)
@@ -12,27 +12,24 @@
<ref component="typeConverterRefA" />
<ref component="typeConverterRefB" />
</type-converters>
+
+ <bean id="typeConverterRefA" class="foo.TypeConverterRefA"/>
+ <bean id="typeConverterRefB" class="foo.TypeConverterRefB"/>
- <service id="idServiceA" auto-export="disabled" depends-on="someServiceDependency" interface="foo.ServiceInterface" ranking="0" ref="NCName">
-
+ <service id="idServiceA" auto-export="disabled" depends-on="someServiceDependency" interface="foo.ServiceInterface" ranking="0">
<description>service description</description>
-
<interfaces>
<value>foo.ServiceInterfA</value>
<value>foo.ServiceInterfB</value>
</interfaces>
-
<service-properties>
<entry key="keyA" value="valueA" />
<entry key="keyB" value="valueB" />
</service-properties>
-
<registration-listener registration-method="regMethod" unregistration-method="unregMethod">
<bean class="foo.RegistrationListenerBean" />
</registration-listener>
-
<registration-listener ref="regListenerRef" />
-
<bean class="foo.ServiceBean" />
</service>
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-06-17 10:17:23 UTC (rev 90312)
+++ projects/jboss-osgi/trunk/pom.xml 2009-06-17 10:37:51 UTC (rev 90313)
@@ -45,7 +45,7 @@
<version.jboss.osgi.common>1.0.0.Beta2</version.jboss.osgi.common>
<version.jboss.osgi.common.core>2.2.11</version.jboss.osgi.common.core>
<version.jboss.osgi.deployers>1.0.0.Beta2</version.jboss.osgi.deployers>
- <version.jboss.osgi.hotdeploy>1.0.0.Beta2</version.jboss.osgi.hotdeploy>
+ <version.jboss.osgi.hotdeploy>1.0.0-SNAPSHOT</version.jboss.osgi.hotdeploy>
<version.jboss.osgi.integration.jbossas>1.0.0.Beta2</version.jboss.osgi.integration.jbossas>
<version.jboss.osgi.jaxb>2.1.10</version.jboss.osgi.jaxb>
<version.jboss.osgi.jmx>1.0.0.Beta2</version.jboss.osgi.jmx>
More information about the jboss-cvs-commits
mailing list