Author: adietish
Date: 2010-11-03 04:19:45 -0400 (Wed, 03 Nov 2010)
New Revision: 26204
Added:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/tracker/internal/UsagePluginLogger.java
Removed:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/tracker/ILoggingAdapter.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/tracker/internal/PluginLogger.java
Modified:
trunk/usage/plugins/org.jboss.tools.usage/META-INF/MANIFEST.MF
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/http/HttpGetRequest.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReport.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/tracker/internal/Tracker.java
Log:
moved logging adapter for plugins to commons
Modified: trunk/usage/plugins/org.jboss.tools.usage/META-INF/MANIFEST.MF
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/META-INF/MANIFEST.MF 2010-11-03 08:17:26 UTC
(rev 26203)
+++ trunk/usage/plugins/org.jboss.tools.usage/META-INF/MANIFEST.MF 2010-11-03 08:19:45 UTC
(rev 26204)
@@ -23,5 +23,6 @@
Bundle-Activator: org.jboss.tools.usage.internal.JBossToolsUsageActivator
Bundle-Vendor: %bundle-vendor
Bundle-ActivationPolicy: lazy
+Import-Package: org.jboss.tools.common.log
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/http/HttpGetRequest.java
===================================================================
---
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/http/HttpGetRequest.java 2010-11-03
08:17:26 UTC (rev 26203)
+++
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/http/HttpGetRequest.java 2010-11-03
08:19:45 UTC (rev 26204)
@@ -15,7 +15,7 @@
import java.net.URL;
import java.text.MessageFormat;
-import org.jboss.tools.usage.tracker.ILoggingAdapter;
+import org.jboss.tools.common.log.ILoggingAdapter;
/**
* Class that executes a HTTP Get request to the given url.
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReport.java
===================================================================
---
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReport.java 2010-11-03
08:17:26 UTC (rev 26203)
+++
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReport.java 2010-11-03
08:19:45 UTC (rev 26204)
@@ -19,6 +19,7 @@
import org.eclipse.jface.window.Window;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.UIJob;
+import org.jboss.tools.common.log.ILoggingAdapter;
import org.jboss.tools.usage.googleanalytics.GoogleAnalyticsUrlStrategy;
import org.jboss.tools.usage.googleanalytics.IJBossToolsEclipseEnvironment;
import org.jboss.tools.usage.http.HttpGetRequest;
@@ -26,13 +27,12 @@
import org.jboss.tools.usage.internal.preferences.GlobalUsageSettings;
import org.jboss.tools.usage.internal.preferences.UsageReportPreferences;
import org.jboss.tools.usage.tracker.IFocusPoint;
-import org.jboss.tools.usage.tracker.ILoggingAdapter;
import org.jboss.tools.usage.tracker.ITracker;
import org.jboss.tools.usage.tracker.IURLBuildingStrategy;
import org.jboss.tools.usage.tracker.internal.FocusPoint;
-import org.jboss.tools.usage.tracker.internal.PluginLogger;
import org.jboss.tools.usage.tracker.internal.SuffixFocusPoint;
import org.jboss.tools.usage.tracker.internal.Tracker;
+import org.jboss.tools.usage.tracker.internal.UsagePluginLogger;
import org.jboss.tools.usage.util.StatusUtils;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.service.prefs.BackingStoreException;
@@ -91,7 +91,7 @@
private void doReport() {
if (UsageReportPreferences.isEnabled()) {
IURLBuildingStrategy urlBuildingStrategy = new
GoogleAnalyticsUrlStrategy(eclipseEnvironment);
- ILoggingAdapter loggingAdapter = new
PluginLogger(JBossToolsUsageActivator.getDefault());
+ ILoggingAdapter loggingAdapter = new
UsagePluginLogger(JBossToolsUsageActivator.getDefault());
ITracker tracker = new Tracker(
urlBuildingStrategy
, new HttpGetRequest(eclipseEnvironment.getUserAgent(), loggingAdapter)
Deleted:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/tracker/ILoggingAdapter.java
===================================================================
---
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/tracker/ILoggingAdapter.java 2010-11-03
08:17:26 UTC (rev 26203)
+++
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/tracker/ILoggingAdapter.java 2010-11-03
08:19:45 UTC (rev 26204)
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.usage.tracker;
-
-/**
- * @author Andre Dietisheim
- */
-public interface ILoggingAdapter {
-
- public void error(String errorMessage);
-
- public void debug(String message);
-
-}
Deleted:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/tracker/internal/PluginLogger.java
===================================================================
---
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/tracker/internal/PluginLogger.java 2010-11-03
08:17:26 UTC (rev 26203)
+++
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/tracker/internal/PluginLogger.java 2010-11-03
08:19:45 UTC (rev 26204)
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.usage.tracker.internal;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.jboss.tools.usage.tracker.ILoggingAdapter;
-import org.jboss.tools.usage.util.LoggingUtils;
-
-/**
- * @author Andre Dietisheim
- */
-public class PluginLogger implements ILoggingAdapter {
-
- private final boolean tracingEnabled;
-
- private Plugin plugin;
-
- public PluginLogger(Plugin plugin) {
- this.tracingEnabled = LoggingUtils.isPluginTracingEnabled(plugin);
- this.plugin = plugin;
- }
-
- public void error(String message) {
- log(IStatus.ERROR, message);
- }
-
- public void debug(String message) {
- log(IStatus.INFO, message);
- }
-
- private void log(int severity, String message) {
- if (!tracingEnabled) {
- return;
- }
-
- if (plugin != null) {
- IStatus status = new Status(severity, plugin.getBundle().getSymbolicName(), message);
- plugin.getLog().log(status);
- }
- }
-}
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/tracker/internal/Tracker.java
===================================================================
---
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/tracker/internal/Tracker.java 2010-11-03
08:17:26 UTC (rev 26203)
+++
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/tracker/internal/Tracker.java 2010-11-03
08:19:45 UTC (rev 26204)
@@ -13,9 +13,9 @@
import java.io.UnsupportedEncodingException;
import java.text.MessageFormat;
+import org.jboss.tools.common.log.ILoggingAdapter;
import org.jboss.tools.usage.http.IHttpGetRequest;
import org.jboss.tools.usage.tracker.IFocusPoint;
-import org.jboss.tools.usage.tracker.ILoggingAdapter;
import org.jboss.tools.usage.tracker.ITracker;
import org.jboss.tools.usage.tracker.IURLBuildingStrategy;
Added:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/tracker/internal/UsagePluginLogger.java
===================================================================
---
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/tracker/internal/UsagePluginLogger.java
(rev 0)
+++
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/tracker/internal/UsagePluginLogger.java 2010-11-03
08:19:45 UTC (rev 26204)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.tracker.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.jboss.tools.common.log.PluginLogger;
+import org.jboss.tools.usage.util.LoggingUtils;
+
+/**
+ * @author Andre Dietisheim
+ *
+ */
+public class UsagePluginLogger extends PluginLogger {
+
+ public UsagePluginLogger(Plugin plugin) {
+ super(plugin);
+ }
+
+ protected boolean isTracingEnabled() {
+ return LoggingUtils.isPluginTracingEnabled(getPlugin());
+ }
+}
Property changes on:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/tracker/internal/UsagePluginLogger.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain