You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2014/08/26 09:41:32 UTC

[1/2] git commit: [KARAF-3182] Fix compilation issue

Repository: karaf
Updated Branches:
  refs/heads/karaf-2.x b8e1c728c -> 31bbbce15


[KARAF-3182] Fix compilation issue

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/b288b8dc
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/b288b8dc
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/b288b8dc

Branch: refs/heads/karaf-2.x
Commit: b288b8dcb924076dbf2fa1838e09716e258d4acd
Parents: b8e1c72
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Tue Aug 26 09:34:13 2014 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Tue Aug 26 09:34:13 2014 +0200

----------------------------------------------------------------------
 .../felix/eventadmin/impl/Configuration.java    | 38 +++++++++++++-
 .../eventadmin/impl/handler/EventAdminImpl.java | 54 ++++++++++++++++----
 2 files changed, 80 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/b288b8dc/services/eventadmin/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java
----------------------------------------------------------------------
diff --git a/services/eventadmin/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java b/services/eventadmin/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java
index 5f37fd1..5b69275 100644
--- a/services/eventadmin/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java
+++ b/services/eventadmin/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java
@@ -107,6 +107,7 @@ public class Configuration
     static final String PROP_TIMEOUT = "org.apache.felix.eventadmin.Timeout";
     static final String PROP_REQUIRE_TOPIC = "org.apache.felix.eventadmin.RequireTopic";
     static final String PROP_IGNORE_TIMEOUT = "org.apache.felix.eventadmin.IgnoreTimeout";
+    static final String PROP_IGNORE_TOPIC = "org.apache.felix.eventadmin.IgnoreTopic";
     static final String PROP_LOG_LEVEL = "org.apache.felix.eventadmin.LogLevel";
     static final String PROP_ADD_TIMESTAMP = "org.apache.felix.eventadmin.AddTimestamp";
     static final String PROP_ADD_SUBJECT = "org.apache.felix.eventadmin.AddSubject";
@@ -122,6 +123,8 @@ public class Configuration
 
     private String[] m_ignoreTimeout;
 
+    private String[] m_ignoreTopics;
+
     private int m_logLevel;
 
     private boolean m_addTimestamp;
@@ -250,6 +253,21 @@ public class Configuration
                     m_ignoreTimeout[i] = st.nextToken();
                 }
             }
+
+            final String valueIgnoreTopic = m_bundleContext.getProperty(PROP_IGNORE_TOPIC);
+            if ( valueIgnoreTopic == null )
+            {
+                m_ignoreTopics = null;
+            }
+            else
+            {
+                final StringTokenizer st = new StringTokenizer(valueIgnoreTopic, ",");
+                m_ignoreTopics = new String[st.countTokens()];
+                for(int i=0; i<m_ignoreTopics.length; i++)
+                {
+                    m_ignoreTopics[i] = st.nextToken();
+                }
+            }
             m_logLevel = getIntProperty(PROP_LOG_LEVEL,
                     m_bundleContext.getProperty(PROP_LOG_LEVEL),
                     LogWrapper.LOG_WARNING, // default log level is WARNING
@@ -279,6 +297,21 @@ public class Configuration
                 LogWrapper.getLogger().log(LogWrapper.LOG_WARNING,
                         "Value for property: " + PROP_IGNORE_TIMEOUT + " is neither a string nor a string array - Using default");
             }
+            m_ignoreTopics = null;
+            final Object valueIT = config.get(PROP_IGNORE_TOPIC);
+            if ( valueIT instanceof String )
+            {
+                m_ignoreTopics = new String[] {(String)valueIT};
+            }
+            else if ( valueIT instanceof String[] )
+            {
+                m_ignoreTopics = (String[])valueIT;
+            }
+            else
+            {
+                LogWrapper.getLogger().log(LogWrapper.LOG_WARNING,
+                        "Value for property: " + PROP_IGNORE_TOPIC + " is neither a string nor a string array - Using default");
+            }
             m_logLevel = getIntProperty(PROP_LOG_LEVEL,
                     config.get(PROP_LOG_LEVEL),
                     LogWrapper.LOG_WARNING, // default log level is WARNING
@@ -337,6 +370,7 @@ public class Configuration
                     m_timeout,
                     m_ignoreTimeout,
                     m_requireTopic,
+                    m_ignoreTopics,
                     m_addTimestamp,
                     m_addSubject);
 
@@ -351,7 +385,7 @@ public class Configuration
         }
         else
         {
-            m_admin.update(m_timeout, m_ignoreTimeout, m_requireTopic, m_addTimestamp, m_addSubject);
+            m_admin.update(m_timeout, m_ignoreTimeout, m_requireTopic, m_ignoreTopics, m_addTimestamp, m_addSubject);
         }
 
     }
@@ -422,7 +456,7 @@ public class Configuration
         {
             return new MetaTypeProviderImpl((ManagedService)managedService,
                     m_threadPoolSize, m_timeout, m_requireTopic,
-                    m_ignoreTimeout);
+                    m_ignoreTimeout, m_ignoreTopics);
         }
         catch (final Throwable t)
         {

http://git-wip-us.apache.org/repos/asf/karaf/blob/b288b8dc/services/eventadmin/src/main/java/org/apache/felix/eventadmin/impl/handler/EventAdminImpl.java
----------------------------------------------------------------------
diff --git a/services/eventadmin/src/main/java/org/apache/felix/eventadmin/impl/handler/EventAdminImpl.java b/services/eventadmin/src/main/java/org/apache/felix/eventadmin/impl/handler/EventAdminImpl.java
index 1277842..4c07349 100644
--- a/services/eventadmin/src/main/java/org/apache/felix/eventadmin/impl/handler/EventAdminImpl.java
+++ b/services/eventadmin/src/main/java/org/apache/felix/eventadmin/impl/handler/EventAdminImpl.java
@@ -23,6 +23,7 @@ import java.util.HashMap;
 
 import javax.security.auth.Subject;
 
+import org.apache.felix.eventadmin.impl.handler.EventHandlerTracker.Matcher;
 import org.apache.felix.eventadmin.impl.tasks.AsyncDeliverTasks;
 import org.apache.felix.eventadmin.impl.tasks.DefaultThreadPool;
 import org.apache.felix.eventadmin.impl.tasks.SyncDeliverTasks;
@@ -55,6 +56,9 @@ public class EventAdminImpl implements EventAdmin
     // The synchronous event dispatcher
     private final SyncDeliverTasks m_sendManager;
 
+    // matchers for ignore topics
+    private Matcher[] m_ignoreTopics;
+
     private boolean addTimestamp;
     private boolean addSubject;
 
@@ -71,6 +75,7 @@ public class EventAdminImpl implements EventAdmin
             final int timeout,
             final String[] ignoreTimeout,
             final boolean requireTopic,
+            final String[] ignoreTopics,
             final boolean addTimestamp,
             final boolean addSubject)
     {
@@ -84,6 +89,7 @@ public class EventAdminImpl implements EventAdmin
         this.tracker.open();
         m_sendManager = new SyncDeliverTasks(syncPool, timeout);
         m_postManager = new AsyncDeliverTasks(asyncPool, m_sendManager);
+        m_ignoreTopics = EventHandlerTracker.createMatchers(ignoreTopics);
     }
 
     /**
@@ -100,17 +106,23 @@ public class EventAdminImpl implements EventAdmin
     }
 
     /**
-     * Post an asynchronous event.
-     *
-     * @param event The event to be posted by this service
-     *
-     * @throws IllegalStateException - In case we are stopped
-     *
-     * @see org.osgi.service.event.EventAdmin#postEvent(org.osgi.service.event.Event)
+     * Check whether the topic should be delivered at all
      */
-    public void postEvent(final Event event)
+    private boolean checkTopic( final Event event )
     {
-        m_postManager.execute(this.getTracker().getHandlers(event), prepareEvent(event));
+        boolean result = true;
+        if ( this.m_ignoreTopics != null )
+        {
+            for(final Matcher m : this.m_ignoreTopics)
+            {
+                if ( m.match(event.getTopic()) )
+                {
+                    result = false;
+                    break;
+                }
+            }
+        }
+        return result;
     }
 
     static final String SUBJECT = "subject";
@@ -143,6 +155,23 @@ public class EventAdminImpl implements EventAdmin
     }
 
     /**
+     * Post an asynchronous event.
+     *
+     * @param event The event to be posted by this service
+     *
+     * @throws IllegalStateException - In case we are stopped
+     *
+     * @see org.osgi.service.event.EventAdmin#postEvent(org.osgi.service.event.Event)
+     */
+    public void postEvent(final Event event)
+    {
+        if ( checkTopic( event ) )
+        {
+            m_postManager.execute(this.getTracker().getHandlers(event), prepareEvent(event));
+        }
+    }
+
+    /**
      * Send a synchronous event.
      *
      * @param event The event to be send by this service
@@ -153,7 +182,10 @@ public class EventAdminImpl implements EventAdmin
      */
     public void sendEvent(final Event event)
     {
-        m_sendManager.execute(this.getTracker().getHandlers(event), prepareEvent(event), false);
+        if ( checkTopic( event ) )
+        {
+            m_sendManager.execute(this.getTracker().getHandlers(event), prepareEvent(event), false);
+        }
     }
 
     /**
@@ -171,6 +203,7 @@ public class EventAdminImpl implements EventAdmin
     public void update(final int timeout,
                        final String[] ignoreTimeout,
                        final boolean requireTopic,
+                       final String[] ignoreTopics,
                        final boolean addTimestamp,
                        final boolean addSubject)
     {
@@ -180,6 +213,7 @@ public class EventAdminImpl implements EventAdmin
         this.tracker.update(ignoreTimeout, requireTopic);
         this.m_sendManager.update(timeout);
         this.tracker.open();
+        this.m_ignoreTopics = EventHandlerTracker.createMatchers(ignoreTopics);
     }
 
     /**


[2/2] git commit: [KARAF-3182] Temporarily add missing repository

Posted by gn...@apache.org.
[KARAF-3182] Temporarily add missing repository

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/31bbbce1
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/31bbbce1
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/31bbbce1

Branch: refs/heads/karaf-2.x
Commit: 31bbbce15bdc19d57d28122cb3179d9c1f68e84e
Parents: b288b8d
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Tue Aug 26 09:34:33 2014 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Tue Aug 26 09:34:33 2014 +0200

----------------------------------------------------------------------
 pom.xml | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/31bbbce1/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 79fdf4d..5536497 100644
--- a/pom.xml
+++ b/pom.xml
@@ -233,6 +233,11 @@
     </properties>
 
     <repositories>
+		<!-- temporary until eventadmin 1.4.0 is available on central -->
+		<repository>
+			<id>apache-public</id>
+			<url>https://repository.apache.org/content/groups/public/</url>
+		</repository>
         <!-- ServiceMix repo -->
         <repository>
             <id>servicemix</id>