Skip to content

Commit

Permalink
felix.eventadmin: Remove event adapters. They are all in felix.log.
Browse files Browse the repository at this point in the history
Having felix.eventadmin and felix.log both in runtime causes
logged events to be doubled.
  • Loading branch information
wilx committed Dec 14, 2024
1 parent ec12d01 commit efc1c24
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 746 deletions.
10 changes: 5 additions & 5 deletions eventadmin/bridge.configuration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>org.apache.felix</groupId>
<artifactId>felix-parent</artifactId>
<version>4</version>
<version>9</version>
<relativePath>../../pom/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand All @@ -39,14 +39,14 @@
</scm>

<properties>
<felix.java.version>6</felix.java.version>
<felix.java.version>7</felix.java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>5.0.0</version>
<artifactId>osgi.core</artifactId>
<version>7.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -68,7 +68,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.2.0</version>
<version>6.0.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
Expand Down
4 changes: 2 additions & 2 deletions eventadmin/bridge.upnp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.apache.felix</groupId>
<artifactId>felix</artifactId>
<version>1.0.4</version>
<artifactId>felix-parent</artifactId>
<version>9</version>
<relativePath>../../pom/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
4 changes: 2 additions & 2 deletions eventadmin/bridge.useradmin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.apache.felix</groupId>
<artifactId>felix</artifactId>
<version>1.0.4</version>
<artifactId>felix-parent</artifactId>
<version>9</version>
<relativePath>../../pom/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
4 changes: 2 additions & 2 deletions eventadmin/bridge.wireadmin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.apache.felix</groupId>
<artifactId>felix</artifactId>
<version>1.0.4</version>
<artifactId>felix-parent</artifactId>
<version>9</version>
<relativePath>../../pom/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
30 changes: 15 additions & 15 deletions eventadmin/impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>org.apache.felix</groupId>
<artifactId>felix-parent</artifactId>
<version>7</version>
<version>9</version>
<relativePath>../../pom/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -53,7 +53,7 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.core</artifactId>
<version>6.0.0</version>
<version>7.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -71,7 +71,7 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.log</artifactId>
<version>1.3.0</version>
<version>1.4.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -96,38 +96,38 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.5</version>
<version>1.7.36</version>
<scope>test</scope>
</dependency>
<!-- Integration Testing with Pax Exam -->
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-forked</artifactId>
<version>4.13.1</version>
<version>4.13.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit4</artifactId>
<version>4.13.1</version>
<version>4.13.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-link-mvn</artifactId>
<version>4.13.1</version>
<version>4.13.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.url</groupId>
<artifactId>pax-url-aether</artifactId>
<version>2.6.2</version>
<version>2.6.14</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.url</groupId>
<artifactId>pax-url-wrap</artifactId>
<version>2.6.2</version>
<version>2.6.14</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -139,7 +139,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>6.0.3</version>
<version>7.0.5</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -153,7 +153,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>4.2.1</version>
<version>6.0.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
Expand All @@ -180,10 +180,10 @@
-->
org.osgi.service.metatype;version="[1.1,2)";resolution:=optional,

<!--
Optional import to back the dynamic import on org.osgi.service.log
-->
org.osgi.service.log;version="[1.3,2)";resolution:=optional,
<!--
Optional import to back the dynamic import on org.osgi.service.log
-->
org.osgi.service.log;version="[1.3,2)";resolution:=optional,

<!-- default -->
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
import java.util.Hashtable;
import java.util.StringTokenizer;

import org.apache.felix.eventadmin.impl.adapter.AbstractAdapter;
import org.apache.felix.eventadmin.impl.adapter.BundleEventAdapter;
import org.apache.felix.eventadmin.impl.adapter.FrameworkEventAdapter;
import org.apache.felix.eventadmin.impl.adapter.LogEventAdapter;
import org.apache.felix.eventadmin.impl.adapter.ServiceEventAdapter;
import org.apache.felix.eventadmin.impl.handler.EventAdminImpl;
import org.apache.felix.eventadmin.impl.security.SecureEventAdminFactory;
import org.apache.felix.eventadmin.impl.tasks.DefaultThreadPool;
Expand Down Expand Up @@ -172,9 +167,6 @@ public class Configuration
// The registration of the mbean
private volatile ServiceRegistration<Object> m_mbeanreg;

// all adapters
private AbstractAdapter[] m_adapters;

private ServiceRegistration<?> m_managedServiceReg;

// the access control context
Expand Down Expand Up @@ -431,9 +423,6 @@ private void startOrUpdate()
m_requireTopic,
m_ignoreTopics);

// Finally, adapt the outside events to our kind of events as per spec
adaptEvents(m_admin);

// register the admin wrapped in a service factory (SecureEventAdminFactory)
// that hands-out the m_admin object wrapped in a decorator that checks
// appropriated permissions of each calling bundle
Expand Down Expand Up @@ -463,14 +452,6 @@ public void destroy()
{
synchronized ( this )
{
if ( m_adapters != null )
{
for(int i=0;i<m_adapters.length;i++)
{
m_adapters[i].destroy(m_bundleContext);
}
m_adapters = null;
}
if ( m_managedServiceReg != null )
{
m_managedServiceReg.unregister();
Expand Down Expand Up @@ -504,18 +485,6 @@ public void destroy()
}
}

/**
* Init the adapters in org.apache.felix.eventadmin.impl.adapter
*/
private void adaptEvents(final EventAdmin admin)
{
m_adapters = new AbstractAdapter[4];
m_adapters[0] = new FrameworkEventAdapter(m_bundleContext, admin);
m_adapters[1] = new BundleEventAdapter(m_bundleContext, admin);
m_adapters[2] = new ServiceEventAdapter(m_bundleContext, admin);
m_adapters[3] = new LogEventAdapter(m_bundleContext, admin);
}

private Object tryToCreateMetaTypeProvider(final Object managedService)
{
try
Expand Down Expand Up @@ -565,7 +534,7 @@ private int getIntProperty(final String key, final Object value,
final int result;
if ( value instanceof Integer )
{
result = ((Integer)value).intValue();
result = (Integer) value;
}
else
{
Expand Down Expand Up @@ -606,7 +575,7 @@ private double getDoubleProperty(final String key, final Object value,
final double result;
if ( value instanceof Double )
{
result = ((Double)value).doubleValue();
result = (Double) value;
}
else
{
Expand Down Expand Up @@ -645,17 +614,17 @@ private boolean getBooleanProperty(final Object obj,
{
if ( obj instanceof Boolean )
{
return ((Boolean)obj).booleanValue();
return (Boolean) obj;
}
String value = obj.toString().trim().toLowerCase();

if(0 < value.length() && ("0".equals(value) || "false".equals(value)
if(!value.isEmpty() && ("0".equals(value) || "false".equals(value)
|| "no".equals(value)))
{
return false;
}

if(0 < value.length() && ("1".equals(value) || "true".equals(value)
if(!value.isEmpty() && ("1".equals(value) || "true".equals(value)
|| "yes".equals(value)))
{
return true;
Expand Down

This file was deleted.

Loading

0 comments on commit efc1c24

Please sign in to comment.