summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Campo2008-02-14 11:34:52 (EST)
committerChristian Campo2008-02-14 11:34:52 (EST)
commit87bfaff44bfe89ada6bfa6a2e35d6c2f4ff7e747 (patch)
tree7b0f259876a70489d94be563f57bf1a4aa8196ba
parent2a9f17474b8443347270b127abaa8651db7971e9 (diff)
downloadorg.eclipse.riena-87bfaff44bfe89ada6bfa6a2e35d6c2f4ff7e747.zip
org.eclipse.riena-87bfaff44bfe89ada6bfa6a2e35d6c2f4ff7e747.tar.gz
org.eclipse.riena-87bfaff44bfe89ada6bfa6a2e35d6c2f4ff7e747.tar.bz2
add logging to hessian
-rw-r--r--org.eclipse.riena.communication.factory.hessian/src/org/eclipse/riena/internal/communication/factory/hessian/Activator.java86
1 files changed, 49 insertions, 37 deletions
diff --git a/org.eclipse.riena.communication.factory.hessian/src/org/eclipse/riena/internal/communication/factory/hessian/Activator.java b/org.eclipse.riena.communication.factory.hessian/src/org/eclipse/riena/internal/communication/factory/hessian/Activator.java
index 8b6aa20..994a1ab 100644
--- a/org.eclipse.riena.communication.factory.hessian/src/org/eclipse/riena/internal/communication/factory/hessian/Activator.java
+++ b/org.eclipse.riena.communication.factory.hessian/src/org/eclipse/riena/internal/communication/factory/hessian/Activator.java
@@ -12,55 +12,67 @@ package org.eclipse.riena.internal.communication.factory.hessian;
import java.util.Hashtable;
+import org.eclipse.equinox.log.Logger;
import org.eclipse.riena.communication.core.factory.IRemoteServiceFactory;
+import org.eclipse.riena.core.logging.LogUtil;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
-
+import org.osgi.service.log.LogService;
public class Activator implements BundleActivator {
- private ServiceRegistration regFactory;
- private RemoteServiceFactoryHessian factory;
+ private ServiceRegistration regFactory;
+ private RemoteServiceFactoryHessian factory;
+ private LogUtil logUtil;
+ private Logger LOGGER = null;
+
+ private static BundleContext CONTEXT;
- private static BundleContext CONTEXT;
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ LOGGER = getLogger(this.getClass().getName());
+ CONTEXT = context;
+ LOGGER.log(LogService.LOG_INFO, "start hessian support on client");
+ factory = new RemoteServiceFactoryHessian();
+ Hashtable<String, Object> properties = new Hashtable<String, Object>(1);
+ properties.put(IRemoteServiceFactory.PROP_PROTOCOL, factory.getProtocol());
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- CONTEXT = context;
- System.out.println("start hessian support on client");
- factory = new RemoteServiceFactoryHessian();
- Hashtable<String, Object> properties = new Hashtable<String, Object>(1);
- properties.put(IRemoteServiceFactory.PROP_PROTOCOL, factory.getProtocol());
+ regFactory = context.registerService(IRemoteServiceFactory.ID, factory, properties);
+ }
- regFactory = context.registerService(IRemoteServiceFactory.ID, factory, properties);
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ regFactory.unregister();
+ regFactory = null;
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- regFactory.unregister();
- regFactory = null;
+ factory.dispose();
+ CONTEXT = null;
+ LOGGER.log(LogService.LOG_INFO, "stop hessian support on client");
+ }
- factory.dispose();
- CONTEXT = null;
- System.out.println("stop hessian support on client");
- }
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static BundleContext getContext() {
+ return CONTEXT;
+ }
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static BundleContext getContext() {
- return CONTEXT;
- }
+ public Logger getLogger(String name) {
+ if (logUtil == null) {
+ logUtil = new LogUtil(CONTEXT);
+ }
+ return logUtil.getLogger(name);
+ }
}