[jboss-cvs] JBossAS SVN: r61987 - in projects/microcontainer/trunk/osgi-int/src: main/org/jboss/osgi/plugins/facade and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Apr 2 10:14:40 EDT 2007
Author: alesj
Date: 2007-04-02 10:14:39 -0400 (Mon, 02 Apr 2007)
New Revision: 61987
Added:
projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/InternalOSGiFacadeException.java
projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/NumberUtil.java
projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/OSGiUtils.java
Modified:
projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/deployers/BundleActivatorDeployer.java
projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/deployers/ServiceDeploymentDeployer.java
projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/BundleContextImpl.java
projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/ServiceRegistrationImpl.java
projects/microcontainer/trunk/osgi-int/src/resources/schema/osgi-beans_1_0.xsd
Log:
BundleContext implementation work.
Modified: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/deployers/BundleActivatorDeployer.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/deployers/BundleActivatorDeployer.java 2007-04-02 13:46:48 UTC (rev 61986)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/deployers/BundleActivatorDeployer.java 2007-04-02 14:14:39 UTC (rev 61987)
@@ -28,6 +28,7 @@
import org.jboss.deployers.spi.deployer.DeploymentUnit;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.osgi.plugins.facade.BundleContextImpl;
import org.jboss.osgi.spi.metadata.OSGiMetaData;
import org.osgi.framework.BundleContext;
@@ -61,7 +62,8 @@
if (bundleActivator != null)
{
String name = createBundleActivatorBeanName(deployment);
- BundleContext bundleContext = null; // todo
+ // todo - get deployment context in non-depricated way
+ BundleContext bundleContext = new BundleContextImpl(unit.getDeploymentContext());
BeanMetaDataBuilder builder = new BeanMetaDataBuilder(name, bundleActivator)
.addStartParameter(BundleContext.class.getName(), bundleContext)
.addStopParameter(BundleContext.class.getName(), bundleContext);
Modified: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/deployers/ServiceDeploymentDeployer.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/deployers/ServiceDeploymentDeployer.java 2007-04-02 13:46:48 UTC (rev 61986)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/deployers/ServiceDeploymentDeployer.java 2007-04-02 14:14:39 UTC (rev 61987)
@@ -58,7 +58,7 @@
/**
* ServiceDeploymentVisitor.
*/
- public static class ServiceDeploymentVisitor implements SimpleDeploymentVisitor<ServiceDeployment>
+ private static class ServiceDeploymentVisitor implements SimpleDeploymentVisitor<ServiceDeployment>
{
public Class<ServiceDeployment> getVisitorType()
{
@@ -83,7 +83,7 @@
/**
* ServiceMetaDataVisitor.
*/
- public static class ServiceMetaDataVisitor implements SimpleDeploymentVisitor<ServiceMetaData>
+ private static class ServiceMetaDataVisitor implements SimpleDeploymentVisitor<ServiceMetaData>
{
public Class<ServiceMetaData> getVisitorType()
{
Modified: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/BundleContextImpl.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/BundleContextImpl.java 2007-04-02 13:46:48 UTC (rev 61986)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/BundleContextImpl.java 2007-04-02 14:14:39 UTC (rev 61987)
@@ -23,24 +23,34 @@
import java.io.File;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.Collections;
+import java.util.Comparator;
import java.util.Dictionary;
import java.util.EventListener;
import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
import java.util.Map;
import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.kernel.spi.config.KernelConfigurator;
+import org.jboss.kernel.spi.event.KernelEvent;
import org.jboss.kernel.spi.event.KernelEventEmitter;
import org.jboss.kernel.spi.event.KernelEventFilter;
+import org.jboss.kernel.spi.registry.KernelRegistry;
import org.jboss.logging.Logger;
+import org.jboss.reflect.spi.ClassInfo;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.BundleListener;
+import org.osgi.framework.Constants;
import org.osgi.framework.Filter;
import org.osgi.framework.FrameworkListener;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
@@ -54,10 +64,13 @@
{
/** The log */
private static final Logger log = Logger.getLogger(BundleContextImpl.class);
+ /** The service reference comparator */
+ private static Comparator<ServiceReference> serviceRefenceComparator = new ServiceReferenceComparator();
protected DeploymentContext context;
protected Bundle bundle;
- protected KernelEventEmitter eventEmitter;
+ protected KernelEventEmitter eventEmitter; // todo - get it
+ protected KernelConfigurator kernelConfigurator; // todo - get it
protected Map<EventListener, AbstractDelegateListener> listeners = Collections.synchronizedMap(new HashMap<EventListener, AbstractDelegateListener>());
protected Map<ServiceListener, KernelEventFilter> filters = Collections.synchronizedMap(new HashMap<ServiceListener, KernelEventFilter>());
@@ -78,6 +91,13 @@
throw new IllegalStateException("BundleContext is no longer valid.");
}
+ protected ClassLoader getClassLoader()
+ {
+ return null;
+ }
+
+ // --------------- OSGi framework -----------------------
+
public String getProperty(String string)
{
return null; //To change body of implemented methods use File | Settings | File Templates.
@@ -156,6 +176,7 @@
public void removeServiceListener(ServiceListener serviceListener)
{
+ validateBundle();
AbstractDelegateListener listener = listeners.get(serviceListener);
if (listener != null)
{
@@ -262,37 +283,117 @@
}
}
- public ServiceRegistration registerService(String[] strings, Object object, Dictionary dictionary)
+ public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties)
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ validateBundle();
+ // todo - permissions
+ if (service == null)
+ throw new IllegalArgumentException("service is null!");
+ if (clazzes == null)
+ throw new Error("null clazzes parameter!"); // todo - what else?
+
+ ClassInfo serviceInfo;
+ ClassInfo[] infos = new ClassInfo[clazzes.length];
+ try
+ {
+ serviceInfo = kernelConfigurator.getClassInfo(service.getClass());
+ for(int i=0; i < clazzes.length; i++)
+ {
+ infos[i] = kernelConfigurator.getClassInfo(clazzes[i], getClassLoader());
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new InternalOSGiFacadeException(t);
+ }
+ // check types
+ boolean isServiceFactory = (service instanceof ServiceFactory);
+ if (isServiceFactory == false)
+ {
+ for (ClassInfo info : infos)
+ {
+ if (info.isAssignableFrom(serviceInfo) == false)
+ throw new IllegalArgumentException("service is not a ServiceFactory object and is not an instance of all the named classes in clazzes: " + info);
+ }
+ }
+ // handle properties
+ if (properties == null)
+ {
+ properties = new Hashtable();
+ }
+ Long serviceId = NumberUtil.nextLong();
+ properties.put(Constants.SERVICE_ID, serviceId);
+ properties.put(Constants.OBJECTCLASS, clazzes);
+ // todo - add to framework --> controller + handle factory bean!
+ // todo - get underlying bundle --> ServiceReference
+ KernelEvent event = new AbstractServiceEvent(this, KernelRegistry.KERNEL_REGISTRY_REGISTERED, serviceId, System.currentTimeMillis(), service);
+ eventEmitter.fireKernelEvent(event);
+ return new ServiceRegistrationImpl();
}
- public ServiceRegistration registerService(String string, Object object, Dictionary dictionary)
+ public ServiceRegistration registerService(String clazz, Object service, Dictionary properties)
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return registerService(new String[]{clazz}, service, properties);
}
- public ServiceReference[] getServiceReferences(String string, String string1) throws InvalidSyntaxException
+ public ServiceReference[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException
{
- return new ServiceReference[0]; //To change body of implemented methods use File | Settings | File Templates.
+ validateBundle();
+ // todo - see spec API
+ return null;
}
- public ServiceReference[] getAllServiceReferences(String string, String string1) throws InvalidSyntaxException
+ public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException
{
- return new ServiceReference[0]; //To change body of implemented methods use File | Settings | File Templates.
+ ServiceReference[] references = getAllServiceReferences(clazz, filter);
+ if (references != null && references.length > 0)
+ {
+ List<ServiceReference> list = new ArrayList<ServiceReference>();
+ for(ServiceReference ref : references)
+ {
+ String[] clazzes = (String[])ref.getProperty(Constants.OBJECTCLASS);
+ for (String refClass : clazzes)
+ {
+ if (ref.isAssignableTo(getBundle(), refClass))
+ {
+ list.add(ref);
+ }
+ }
+ }
+ Collections.sort(list, serviceRefenceComparator);
+ return list.toArray(new ServiceReference[list.size()]);
+ }
+ else
+ {
+ return null;
+ }
}
- public ServiceReference getServiceReference(String string)
+ public ServiceReference getServiceReference(String clazz)
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ validateBundle();
+ try
+ {
+ ServiceReference[] references = getServiceReferences(clazz, null);
+ if (references != null && references.length > 0)
+ {
+ // watch for the order in getServiceReferences
+ return references[0];
+ }
+ return null;
+ }
+ catch (InvalidSyntaxException e)
+ {
+ throw new InternalOSGiFacadeException("Should not be here, since filter was null!");
+ }
}
- public Object getService(ServiceReference serviceReference)
+ public Object getService(ServiceReference reference)
{
return null; //To change body of implemented methods use File | Settings | File Templates.
}
- public boolean ungetService(ServiceReference serviceReference)
+ public boolean ungetService(ServiceReference reference)
{
return false; //To change body of implemented methods use File | Settings | File Templates.
}
@@ -305,7 +406,27 @@
public Filter createFilter(String filter) throws InvalidSyntaxException
{
validateBundle();
+ // todo - create our own impl?
return FrameworkUtil.createFilter(filter);
}
+ /**
+ * @see org.osgi.framework.BundleContext#getServiceReferences(String, String)
+ */
+ private static class ServiceReferenceComparator implements Comparator<ServiceReference>
+ {
+ public int compare(ServiceReference sr1, ServiceReference sr2)
+ {
+ int rank1 = OSGiUtils.getServiceRanking(sr1);
+ int rank2 = OSGiUtils.getServiceRanking(sr2);
+ if (rank1 == rank2)
+ {
+ long id1 = OSGiUtils.getServiceId(sr1);
+ long id2 = OSGiUtils.getServiceId(sr2);
+ return (int)(id1 - id2);
+ }
+ return rank2 - rank1;
+ }
+ }
+
}
Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/InternalOSGiFacadeException.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/InternalOSGiFacadeException.java (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/InternalOSGiFacadeException.java 2007-04-02 14:14:39 UTC (rev 61987)
@@ -0,0 +1,51 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.plugins.facade;
+
+/**
+ * Signaling internal exception - container, dependency, kernel related.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class InternalOSGiFacadeException extends RuntimeException
+{
+ public InternalOSGiFacadeException()
+ {
+ super();
+ }
+
+ public InternalOSGiFacadeException(String message)
+ {
+ super(message);
+ }
+
+ public InternalOSGiFacadeException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public InternalOSGiFacadeException(Throwable cause)
+ {
+ super(cause);
+ }
+
+}
Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/NumberUtil.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/NumberUtil.java (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/NumberUtil.java 2007-04-02 14:14:39 UTC (rev 61987)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.plugins.facade;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * Unique numbering util.
+ * todo - should we do this more generic?
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class NumberUtil
+{
+ private static AtomicLong longOrder = new AtomicLong(Long.MIN_VALUE);
+
+ private NumberUtil()
+ {
+ }
+
+ /**
+ * Return next long.
+ *
+ * @return unique Long number
+ */
+ public static Long nextLong()
+ {
+ return longOrder.getAndIncrement();
+ }
+
+}
Added: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/OSGiUtils.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/OSGiUtils.java (rev 0)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/OSGiUtils.java 2007-04-02 14:14:39 UTC (rev 61987)
@@ -0,0 +1,71 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.plugins.facade;
+
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Helpful methods for handling specific OSGi cases.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class OSGiUtils
+{
+ /**
+ * Get ServiceReference id.
+ *
+ * @param reference service reference to look for id
+ * @return reference's id or error if no such property
+ */
+ public static Long getServiceId(ServiceReference reference)
+ {
+ Object value = reference.getProperty(Constants.SERVICE_RANKING);
+ if (value == null || value instanceof Long == false)
+ {
+ throw new IllegalArgumentException("No such property: " + Constants.SERVICE_ID);
+ }
+ else
+ {
+ return (Long)value;
+ }
+ }
+
+ /**
+ * Get ServiceReference ranking.
+ *
+ * @param reference service reference to look for ranking
+ * @return reference's ranking or 0 if no such property
+ */
+ public static Integer getServiceRanking(ServiceReference reference)
+ {
+ Object value = reference.getProperty(Constants.SERVICE_RANKING);
+ if (value == null || value instanceof Integer == false)
+ {
+ return 0;
+ }
+ else
+ {
+ return (Integer)value;
+ }
+ }
+}
Modified: projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/ServiceRegistrationImpl.java
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/ServiceRegistrationImpl.java 2007-04-02 13:46:48 UTC (rev 61986)
+++ projects/microcontainer/trunk/osgi-int/src/main/org/jboss/osgi/plugins/facade/ServiceRegistrationImpl.java 2007-04-02 14:14:39 UTC (rev 61987)
@@ -22,7 +22,9 @@
package org.jboss.osgi.plugins.facade;
import java.util.Dictionary;
+import java.util.Map;
+import org.jboss.reflect.spi.ClassInfo;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
@@ -33,6 +35,10 @@
*/
public class ServiceRegistrationImpl implements ServiceRegistration
{
+ private ClassInfo serviceInfo;
+ private ClassInfo[] interfaces;
+ private Map properties;
+
public ServiceReference getReference()
{
return null; //To change body of implemented methods use File | Settings | File Templates.
Modified: projects/microcontainer/trunk/osgi-int/src/resources/schema/osgi-beans_1_0.xsd
===================================================================
--- projects/microcontainer/trunk/osgi-int/src/resources/schema/osgi-beans_1_0.xsd 2007-04-02 13:46:48 UTC (rev 61986)
+++ projects/microcontainer/trunk/osgi-int/src/resources/schema/osgi-beans_1_0.xsd 2007-04-02 14:14:39 UTC (rev 61987)
@@ -1,84 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- A prototype xsd schema for the osgi xml deployer -->
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- targetNamespace="urn:jboss:osgi-beans:1.0"
- xmlns="urn:jboss:osgi-beans:1.0"
- xmlns:mc="urn:jboss:bean-deployer:2.0"
- elementFormDefault="qualified"
- attributeFormDefault="unqualified"
- version="1.0">
+<!--
+/*
+ * $Header: /cvshome/build/xmlns/scr/scr.xsd,v 1.12 2006/07/11 13:27:46 hargrave Exp $
+ *
+ * Copyright (c) OSGi Alliance (2005, 2006). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.osgi.org/xmlns/scr/v1.0.0"
+ xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
+ <annotation>
+ <documentation xml:lang="en">
+ This is the XML Schema for component descriptions used by the Service Component Runtime (SCR).
+ Component description documents may be embedded in other XML documents. The SCR will
+ process all XML documents listed in the Service-Component manifest header of a bundle.
+ XML documents containing component descriptions may contain a single, root component
+ element or one or more component elements embedded in a larger document. Use of the
+ namespace is optional if the document only contains a root component element. In this
+ case, the scr namespace is assumed. Otherwise the namespace must be used.
+ </documentation>
+ </annotation>
- <xsd:import namespace="urn:jboss:bean-deployer:2.0"/>
+ <element name="component" type="scr:Tcomponent"/>
- <!-- reference -->
- <xsd:element name="reference" type="referenceType"/>
+ <complexType name="Tcomponent">
+ <annotation>
+ <documentation xml:lang="en">
+ Implementations of SCR must not require component descriptions to specify the subelements
+ of the component element in the order as required by the schema. SCR implementations must
+ allow other orderings since arbitrary orderings do not affect the meaning of the component
+ description. Only the relative ordering of property and properties element have meaning.
+ </documentation>
+ </annotation>
+ <sequence>
+ <element name="implementation" type="scr:Timplementation" minOccurs="1" maxOccurs="1"/>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="property" type="scr:Tproperty"/>
+ <element name="properties" type="scr:Tproperties"/>
+ </choice>
+ <element name="service" type="scr:Tservice" minOccurs="0" maxOccurs="1"/>
+ <element name="reference" type="scr:Treference" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="enabled" type="boolean" default="true" use="optional"/>
+ <attribute name="name" type="token" use="required"/>
+ <attribute name="factory" type="string" use="optional"/>
+ <attribute name="immediate" type="boolean" use="optional"/>
+ </complexType>
- <xsd:complexType name="referenceType">
- <xsd:complexContent>
- <xsd:sequence minOccurs="0" maxOccurs="unbounded">
- <xsd:element name="property" type="mc:propertyType" minOccurs="0"/>
- <xsd:element name="listener" type="listenerType" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="id" use="required" type="xsd:string"/>
- <xsd:attribute name="interface" use="required" type="xsd:string"/>
- <xsd:attribute name="filter" use="optional" type="xsd:string"/>
- <xsd:attribute name="cardinality" use="optional" type="Tcardinality" default="1..1"/>
- <xsd:attribute name="timeout" use="optional" type="xsd:int" default="0"/>
- <xsd:attribute name="depends-on" type="xsd:string" use="optional"/>
- <xsd:attribute name="context-classloader" type="TreferenceClassLoaderOptions" default="client"/>
- </xsd:complexContent>
+ <complexType name="Timplementation">
+ <attribute name="class" type="token" use="required"/>
+ </complexType>
- </xsd:complexType>
+ <complexType name="Tproperty">
+ <simpleContent>
+ <extension base="string">
+ <attribute name="name" type="string" use="required"/>
+ <attribute name="value" type="string" use="optional"/>
+ <attribute name="type" type="scr:TjavaTypes" default="String" use="optional"/>
+ </extension>
+ </simpleContent>
+ </complexType>
- <xsd:simpleType name="Tcardinality">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="0..1"/>
- <xsd:enumeration value="0..n"/>
- <xsd:enumeration value="1..1"/>
- <xsd:enumeration value="1..n"/>
- </xsd:restriction>
- </xsd:simpleType>
+ <complexType name="Tproperties">
+ <attribute name="entry" type="string" use="required"/>
+ </complexType>
- <xsd:simpleType name="TreferenceClassLoaderOptions">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="client"/>
- <xsd:enumeration value="service-provider"/>
- <xsd:enumeration value="unmanaged"/>
- </xsd:restriction>
- </xsd:simpleType>
+ <complexType name="Tservice">
+ <sequence>
+ <element name="provide" type="scr:Tprovide" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="servicefactory" type="boolean" default="false" use="optional"/>
+ </complexType>
- <xsd:complexType name="listenerType">
- <xsd:attribute name="ref" type="xsd:string" use="required"/>
- <xsd:attribute name="bind-method" type="xsd:string" use="optional"/>
- <xsd:attribute name="unbind-method" type="xsd:string" use="optional"/>
- </xsd:complexType>
+ <complexType name="Tprovide">
+ <attribute name="interface" type="token" use="required"/>
+ </complexType>
- <!-- service -->
- <xsd:element name="service" type="serviceType"/>
+ <complexType name="Treference">
+ <attribute name="name" type="NMTOKEN" use="required"/>
+ <attribute name="interface" type="token" use="required"/>
+ <attribute name="cardinality" type="scr:Tcardinality" default="1..1" use="optional"/>
+ <attribute name="policy" type="scr:Tpolicy" default="static" use="optional"/>
+ <attribute name="target" type="string" use="optional"/>
+ <attribute name="bind" type="token" use="optional"/>
+ <attribute name="unbind" type="token" use="optional"/>
+ </complexType>
- <xsd:complexType name="serviceType">
- <xsd:complexContent>
- <xsd:sequence minOccurs="0" maxOccurs="1">
- <xsd:element name="interfaces" type="mc:setType" minOccurs="0"/>
- <xsd:element name="service-properties" type="mc:mapType" minOccurs="0"/>
- <!-- this next entry is to allow a nested bean element -->
- <!--<xsd:any namespace="##other" minOccurs="0" maxOccurs="1" processContents="skip"/>-->
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="optional"/>
- <xsd:attribute name="ref" type="xsd:string" use="required"/>
- <xsd:attribute name="interface" type="xsd:string" use="optional"/>
- <xsd:attribute name="lazy-init" type="xsd:boolean" use="optional" default="false"/>
- <xsd:attribute name="depends-on" type="xsd:string" use="optional"/>
- <xsd:attribute name="context-classloader" type="TserviceClassLoaderOptions" default="unmanaged"/>
- </xsd:complexContent>
- </xsd:complexType>
+ <simpleType name="TjavaTypes">
+ <restriction base="string">
+ <enumeration value="String"/>
+ <enumeration value="Long"/>
+ <enumeration value="Double"/>
+ <enumeration value="Float"/>
+ <enumeration value="Integer"/>
+ <enumeration value="Byte"/>
+ <enumeration value="Char"/>
+ <enumeration value="Boolean"/>
+ <enumeration value="Short"/>
+ </restriction>
+ </simpleType>
- <xsd:simpleType name="TserviceClassLoaderOptions">
+ <simpleType name="Tcardinality">
+ <restriction base="string">
+ <enumeration value="0..1"/>
+ <enumeration value="0..n"/>
+ <enumeration value="1..1"/>
+ <enumeration value="1..n"/>
+ </restriction>
+ </simpleType>
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="service-provider"/>
- <xsd:enumeration value="unmanaged"/>
- </xsd:restriction>
- </xsd:simpleType>
+ <simpleType name="Tpolicy">
+ <restriction base="string">
+ <enumeration value="static"/>
+ <enumeration value="dynamic"/>
+ </restriction>
+ </simpleType>
-</xsd:schema>
+</schema>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list