Skip to content
Permalink
Browse files
Merge branch 'scrR8'
  • Loading branch information
tjwatson committed Dec 9, 2021
2 parents 3bac62e + 4e8021e commit 6591e106369e346e483fad13f12007302f232452
Show file tree
Hide file tree
Showing 120 changed files with 2,852 additions and 665 deletions.
@@ -5,7 +5,7 @@ Bundle-Activator: org.apache.felix.scr.impl.Activator
Provide-Capability: osgi.extender;\
osgi.extender="osgi.component";\
uses:="org.osgi.service.component";\
version:Version="1.4",\
version:Version="1.5",\
osgi.service;\
objectClass:List<String>="org.osgi.service.component.runtime.ServiceComponentRuntime";\
uses:="org.osgi.service.component.runtime"
@@ -15,9 +15,9 @@ Require-Capability: osgi.ee;\

Export-Package: org.apache.felix.scr.component;version=1.1.0;provide:=true, \
org.apache.felix.scr.info;version=1.0.0;provide:=true, \
org.osgi.service.component;version=1.4;provide:=true, \
org.osgi.service.component.runtime;version=1.4;provide:=true, \
org.osgi.service.component.runtime.dto;version=1.4;provide:=true
org.osgi.service.component;version=1.5;provide:=true, \
org.osgi.service.component.runtime;version=1.5;provide:=true, \
org.osgi.service.component.runtime.dto;version=1.5;provide:=true

Private-Package: org.apache.felix.scr.impl.*

@@ -1,3 +1,7 @@
Changes in 2.2.0-RC1
** Improvement
* Initial implementation of OSGi R8. This version has all the fixes up to and including SCR version 2.1.30

Changes in 2.1.28
-----------------
** Bug
@@ -27,17 +27,17 @@
<packaging>bundle</packaging>
<name>Apache Felix Declarative Services</name>
<description>
Implementation of the Declarative Services specification 1.4
Implementation of the Declarative Services specification 1.5
</description>
<artifactId>org.apache.felix.scr</artifactId>
<version>2.1.31-SNAPSHOT</version>
<version>2.2.0-SNAPSHOT</version>
<scm>
<connection>scm:git:https://github.com/apache/felix-dev.git</connection>
<developerConnection>scm:git:https://github.com/apache/felix-dev.git</developerConnection>
<url>https://gitbox.apache.org/repos/asf?p=felix-dev.git</url>
<tag>HEAD</tag>
</scm>

<!--
A Note on Testing
=================
@@ -79,7 +79,7 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.core</artifactId>
<version>6.0.0</version>
<version>8.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -91,7 +91,7 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.component</artifactId>
<version>1.4.0</version>
<version>1.5.0-RC1</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -295,7 +295,6 @@
<!-- integration tests run with pax-exam -->
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.12</version>
<executions>
<execution>
<goals>
@@ -320,7 +319,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -387,7 +385,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>6.0.4</version>
<version>7.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -49,11 +49,14 @@
import org.apache.felix.scr.impl.metadata.ComponentMetadata;
import org.apache.felix.scr.impl.metadata.MetadataStoreHelper.MetaDataReader;
import org.apache.felix.scr.impl.metadata.MetadataStoreHelper.MetaDataWriter;
import org.apache.felix.scr.impl.metadata.ReferenceMetadata;
import org.apache.felix.scr.impl.runtime.ServiceComponentRuntimeImpl;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.Constants;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.wiring.BundleRevision;
import org.osgi.framework.wiring.BundleWire;
@@ -77,6 +80,8 @@ public class Activator extends AbstractExtender
//Either this bundle's context or the framework bundle context, depending on the globalExtender setting.
private BundleContext m_globalContext;

private ServiceReference<?> m_trueCondition;

// this bundle
private Bundle m_bundle;

@@ -115,13 +120,41 @@ public void start(final BundleContext context) throws Exception
{
m_context = context;
m_bundle = context.getBundle();
m_trueCondition = findTrueCondition(context);
// set bundle context for PackageAdmin tracker
ClassUtils.setBundleContext( context );
// get the configuration
m_configuration.start( m_context ); //this will call restart, which calls super.start.
}


private ServiceReference<?> findTrueCondition(BundleContext context)
{
try
{
ServiceReference<?>[] foundTrue = context.getServiceReferences(
ReferenceMetadata.CONDITION_SERVICE_CLASS, ReferenceMetadata.CONDITION_TRUE_FILTER);
if (foundTrue == null || foundTrue.length == 0)
{
return null;
}
for (ServiceReference<?> ref : foundTrue)
{
Bundle b = ref.getBundle();
if (b != null && b.getBundleId() == 0)
{
return ref;
}
}
return null;
}
catch (InvalidSyntaxException e)
{
// should never happen; blow up if it does
throw new RuntimeException(e);
}
}

public void restart(boolean globalExtender)
{
m_componentMetadataStore = load(m_context, logger,
@@ -211,6 +244,11 @@ public void stop(BundleContext context) throws Exception
logger.close();
}

public ServiceReference<?> getTrueCondition()
{
return m_trueCondition;
}

@Override
public void bundleChanged(BundleEvent event)
{
@@ -550,7 +588,7 @@ private void loadComponents(Bundle bundle)
try
{
BundleComponentActivator ga = new BundleComponentActivator( this.logger, m_componentRegistry, m_componentActor,
context, m_configuration, cached);
context, m_configuration, cached, getTrueCondition());
ga.initialEnable();
if (cached == null)
{
@@ -95,6 +95,8 @@ public class BundleComponentActivator implements ComponentActivator

private final BundleLogger logger;

private final ServiceReference<?> m_trueCondition;

private static class ListenerInfo implements ServiceListener
{
List<ExtendedServiceListener<ExtendedServiceEvent>> listeners = new ArrayList<>();
@@ -187,6 +189,7 @@ public void removeServiceListener(String serviceFilterString,
* register components with to ensure uniqueness of component names
* and to ensure configuration updates.
* @param context The bundle context owning the components
* @param serviceReference
*
* @throws ComponentException if any error occurrs initializing this class
*/
@@ -195,7 +198,8 @@ public BundleComponentActivator(final ScrLogger scrLogger,
final ComponentActorThread componentActor,
final BundleContext context,
final ScrConfiguration configuration,
final List<ComponentMetadata> cachedComponentMetadata)
final List<ComponentMetadata> cachedComponentMetadata,
final ServiceReference<?> trueConditiion)
throws ComponentException
{
// create a logger on behalf of the bundle
@@ -207,6 +211,7 @@ public BundleComponentActivator(final ScrLogger scrLogger,
m_bundle = context.getBundle();

m_configuration = configuration;
m_trueCondition = trueConditiion;

logger.log(Level.DEBUG, "BundleComponentActivator : Bundle active", null);

@@ -388,7 +393,7 @@ private void loadDescriptor(final URL descriptorURL)
stream = descriptorURL.openStream();

XmlHandler handler = new XmlHandler( m_bundle, this.logger, getConfiguration().isFactoryEnabled(),
getConfiguration().keepInstances() );
getConfiguration().keepInstances(), m_trueCondition);
final SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
final SAXParser parser = factory.newSAXParser();
@@ -760,4 +765,10 @@ public void unsetRegionConfigurationSupport(RegionConfigurationSupport rcs)
public void updateChangeCount() {
this.m_componentRegistry.updateChangeCount();
}

@Override
public ServiceReference<?> getTrueCondition()
{
return this.m_trueCondition;
}
}
@@ -44,6 +44,7 @@
private static final long long0 = 0;
private static final short short0 = 0;

@SuppressWarnings("unchecked")
public static Object coerce(Class<?> type, Object raw, Bundle bundle)
{
if ( type == Byte.class || type == byte.class )
@@ -68,6 +69,7 @@ public static Object coerce(Class<?> type, Object raw, Bundle bundle)
}
if ( type.isEnum() )
{
@SuppressWarnings("rawtypes")
final Class clazz = type;
return coerceToEnum( raw, clazz );
}

0 comments on commit 6591e10

Please sign in to comment.