ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1370186 - in /ace/sandbox/marrs/org.apache.ace.managementagent: bnd.bnd src/org/apache/ace/managementagent/Activator.java
Date Tue, 07 Aug 2012 11:28:58 GMT
Author: jawi
Date: Tue Aug  7 11:28:57 2012
New Revision: 1370186

URL: http://svn.apache.org/viewvc?rev=1370186&view=rev
Log:
Use own logger, instead of duplicating the code.

Modified:
    ace/sandbox/marrs/org.apache.ace.managementagent/bnd.bnd
    ace/sandbox/marrs/org.apache.ace.managementagent/src/org/apache/ace/managementagent/Activator.java

Modified: ace/sandbox/marrs/org.apache.ace.managementagent/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.managementagent/bnd.bnd?rev=1370186&r1=1370185&r2=1370186&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.managementagent/bnd.bnd (original)
+++ ace/sandbox/marrs/org.apache.ace.managementagent/bnd.bnd Tue Aug  7 11:28:57 2012
@@ -1,37 +1,39 @@
 -buildpath: osgi.core,\
 	osgi.cmpn,\
-	org.apache.felix.configadmin,\
-	org.apache.felix.dependencymanager,\
-	org.apache.ace.log.listener;version=latest,\
+	org.apache.ace.connectionfactory;version=latest,\
+	org.apache.ace.consolelogger;version=latest,\
 	org.apache.ace.gateway.log;version=latest,\
 	org.apache.ace.gateway.log.store;version=latest,\
 	org.apache.ace.range.api;version=latest,\
 	org.apache.ace.log;version=latest,\
+	org.apache.ace.log.listener;version=latest,\
 	org.apache.ace.discovery.api;version=latest,\
 	org.apache.ace.discovery.property;version=latest,\
 	org.apache.ace.identification.api;version=latest,\
-	org.apache.ace.scheduler;version=latest,\
+	org.apache.ace.identification.property;version=latest,\
 	org.apache.ace.deployment.api;version=latest,\
 	org.apache.ace.deployment.deploymentadmin;version=latest,\
 	org.apache.ace.deployment.task.base;version=latest,\
 	org.apache.ace.deployment.task;version=latest,\
-	org.apache.ace.connectionfactory;version=latest,\
+	org.apache.ace.scheduler;version=latest,\
+	org.apache.felix.configadmin,\
+	org.apache.felix.dependencymanager,\
 	org.apache.felix.deploymentadmin,\
-	org.apache.ace.identification.property;version=latest,\
 	org.apache.felix.eventadmin
 Private-Package: EDU.oswego.cs.dl.util.concurrent;-split-package:=first,\
     org.apache.felix.*;-split-package:=first,\
     org.apache.ace.*;-split-package:=first,\
     org.apache.commons.codec;-split-package:=first,\
     org.apache.commons.codec.binary;-split-package:=first
-Import-Package: !javax.swing,\
+Import-Package: \
+	!javax.swing,\
 	!javax.swing.border,\
 	!javax.microedition.io,\
-	!org.osgi.service.condpermadmin,\
 	!javax.net.ssl,\
 	!org.apache.ace.test,\
 	!org.apache.ace.target.log,\
 	!org.apache.felix.dm.tracker,\
+	!org.osgi.service.condpermadmin,\
 	!org.osgi.service.useradmin,\
 	org.osgi.service.deploymentadmin;version='[1,2)',\
 	org.osgi.service.deploymentadmin.spi;version='[1,2)',\

Modified: ace/sandbox/marrs/org.apache.ace.managementagent/src/org/apache/ace/managementagent/Activator.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.managementagent/src/org/apache/ace/managementagent/Activator.java?rev=1370186&r1=1370185&r2=1370186&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.managementagent/src/org/apache/ace/managementagent/Activator.java
(original)
+++ ace/sandbox/marrs/org.apache.ace.managementagent/src/org/apache/ace/managementagent/Activator.java
Tue Aug  7 11:28:57 2012
@@ -10,11 +10,8 @@ import org.apache.felix.dm.DependencyAct
 import org.apache.felix.dm.DependencyManager;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.log.LogService;
 
 public class Activator extends DependencyActivatorBase {
 
@@ -63,55 +60,9 @@ public class Activator extends Dependenc
     @Override
     public void init(BundleContext context, DependencyManager manager) throws Exception {
         if (m_logToConsole) {
-        	manager.add(createComponent()
-        		.setInterface(LogService.class.getName(), null)
-        		.setImplementation(new LogService() {
-        		    private String[] LEVEL = { "", "Error", "Warn ", "Info ", "Debug" };
-
-        		    public void log(int level, String message) {
-        		        log(null, level, message, null);
-        		    }
-
-        		    public void log(int level, String message, Throwable throwable) {
-        		        log(null, level, message, throwable);
-        		    }
-
-        		    public void log(ServiceReference reference, int level, String message) {
-        		        log(reference, level, message, null);
-        		    }
-
-        		    public void log(ServiceReference reference, int level, String message, Throwable
throwable) {
-        		        String bundle = " [   ]";
-        		        String service = " ";
-        		        if (reference != null) {
-        		            bundle = "00" + reference.getBundle().getBundleId();
-        		            bundle = " [" + bundle.substring(bundle.length() - 3) + "]";
-        		            Object objectClass = reference.getProperty(Constants.OBJECTCLASS);
-        		            if (objectClass instanceof String[]) {
-        		                StringBuffer buffer = new StringBuffer();
-        		                String[] objClassArr = ((String[]) objectClass);
-        		                for (int i = 0; i < objClassArr.length; i++) {
-        		                    String svc = objClassArr[i];
-        		                    if (buffer.length() > 0) {
-        		                        buffer.append(';');
-        		                    }
-        		                    buffer.append(svc);
-        		                    service = buffer.toString() + ": ";
-        		                }
-        		            }
-        		            else {
-        		                service = objectClass.toString() + ": ";
-        		            }
-        		        }
-        		        System.out.println("[" + LEVEL[level] + "]" + bundle + service + message);
-        		        if (throwable != null) {
-        		            throwable.printStackTrace();
-        		        }
-        		    }
-				})
-        	);
+            new org.apache.ace.consolelogger.Activator().start(context);
         }
-        
+
         for (int i = 0; i < m_activators.length; i++) {
             BundleActivator a = m_activators[i];
             // start the bundle unless there is a system property with the same package name
as



Mime
View raw message