ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1153109 - in /incubator/ace/trunk/ace-managementagent: pom.xml src/main/java/org/apache/ace/managementagent/Activator.java
Date Tue, 02 Aug 2011 12:56:19 GMT
Author: marrs
Date: Tue Aug  2 12:56:18 2011
New Revision: 1153109

URL: http://svn.apache.org/viewvc?rev=1153109&view=rev
Log:
ACE-161 Added a feature to disable parts of the management agent (for example, the built-in
scheduler). Added a switch to disable all output to the console (by default it prints some
diagnostics on startup).

Modified:
    incubator/ace/trunk/ace-managementagent/pom.xml
    incubator/ace/trunk/ace-managementagent/src/main/java/org/apache/ace/managementagent/Activator.java

Modified: incubator/ace/trunk/ace-managementagent/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-managementagent/pom.xml?rev=1153109&r1=1153108&r2=1153109&view=diff
==============================================================================
--- incubator/ace/trunk/ace-managementagent/pom.xml (original)
+++ incubator/ace/trunk/ace-managementagent/pom.xml Tue Aug  2 12:56:18 2011
@@ -49,7 +49,8 @@
 	        org.osgi.service.event;version="1.2",
 	        org.osgi.service.log;version="1.3",
 	        org.osgi.service.metatype;version="1.1",
-	        org.apache.ace.log;version=${project.version}
+	        org.apache.ace.log;version=${project.version},
+            org.apache.ace.deployment.service;version=${project.version}
         </export.package>
         <import.package>
             !org.osgi.service.cm,

Modified: incubator/ace/trunk/ace-managementagent/src/main/java/org/apache/ace/managementagent/Activator.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-managementagent/src/main/java/org/apache/ace/managementagent/Activator.java?rev=1153109&r1=1153108&r2=1153109&view=diff
==============================================================================
--- incubator/ace/trunk/ace-managementagent/src/main/java/org/apache/ace/managementagent/Activator.java
(original)
+++ incubator/ace/trunk/ace-managementagent/src/main/java/org/apache/ace/managementagent/Activator.java
Tue Aug  2 12:56:18 2011
@@ -28,11 +28,22 @@ public class Activator extends Dependenc
     
     private volatile ConfigurationAdmin m_config;
     
+    private boolean m_quiet = Boolean.parseBoolean(System.getProperty("quiet", "false"));
+    
     @Override
     public void init(BundleContext context, DependencyManager manager) throws Exception {
         for (int i = 0; i < m_activators.length; i++) {
             BundleActivator a = m_activators[i];
-            a.start(context);
+            // start the bundle unless there is a system property with the same package name
as
+            // the package that the bundle activator is part of that has the value 'disabled'
+            // example use case: turn off the embedded scheduler
+            String packageName = a.getClass().getPackage().getName();
+            if (!"disabled".equals(System.getProperty(packageName))) {
+                a.start(context);
+            }
+            else if (!m_quiet) {
+                System.out.println("Not starting activator " + packageName + ".");
+            }
         }
         
         manager.add(createComponent()
@@ -59,12 +70,14 @@ public class Activator extends Dependenc
             configureFactory("org.apache.ace.gateway.log.factory", "name", "auditlog");
             configureFactory("org.apache.ace.gateway.log.store.factory", "name", "auditlog");
 
-            System.out.println("Started management agent.\n"
-                    + "  Target ID: " + targetId + "\n"
-                    + "  Server   : " + server + "\n"
-                    + "  Sync interval: " + syncInterval + " ms\n"
-                    + "  Unaffected bundles will " + ("false".equals(stopUnaffectedBundles)
? "not " : "")
-                    + "be stopped during deployment.");
+            if (!m_quiet) {
+                System.out.println("Started management agent.\n"
+                        + "  Target ID    : " + targetId + "\n"
+                        + "  Server       : " + server + "\n"
+                        + "  Sync interval: " + syncInterval + " ms\n"
+                        + "  Unaffected bundles will " + ("false".equals(stopUnaffectedBundles)
? "not " : "")
+                        + "be stopped during deployment.");
+            }
         }
         catch (Exception e) {
             e.printStackTrace();



Mime
View raw message