From 6e22b184c222d77405d7cf575a0b646bc744e25f Mon Sep 17 00:00:00 2001 From: Tom Schindl Date: Sat, 13 Apr 2013 11:27:34 +0200 Subject: initial checkin --- bundles/runtime/org.eclipse.fx.core/.classpath | 7 + bundles/runtime/org.eclipse.fx.core/.gitignore | 2 + bundles/runtime/org.eclipse.fx.core/.project | 33 +++ .../.settings/org.eclipse.jdt.core.prefs | 7 + .../org.eclipse.fx.core/META-INF/MANIFEST.MF | 13 + .../org.eclipse.fx.core/OSGI-INF/jlogger.xml | 7 + .../OSGI-INF/l10n/bundle.properties | 3 + .../runtime/org.eclipse.fx.core/build.properties | 5 + bundles/runtime/org.eclipse.fx.core/pom.xml | 34 +++ .../src/org/eclipse/fx/core/Callback.java | 15 + .../eclipse/fx/core/log/JUtilLoggerFactory.java | 329 +++++++++++++++++++++ .../src/org/eclipse/fx/core/log/Log.java | 27 ++ .../src/org/eclipse/fx/core/log/Logger.java | 255 ++++++++++++++++ .../src/org/eclipse/fx/core/log/LoggerFactory.java | 15 + .../org/eclipse/fx/core/update/UpdateService.java | 71 +++++ 15 files changed, 823 insertions(+) create mode 100755 bundles/runtime/org.eclipse.fx.core/.classpath create mode 100755 bundles/runtime/org.eclipse.fx.core/.gitignore create mode 100755 bundles/runtime/org.eclipse.fx.core/.project create mode 100644 bundles/runtime/org.eclipse.fx.core/.settings/org.eclipse.jdt.core.prefs create mode 100755 bundles/runtime/org.eclipse.fx.core/META-INF/MANIFEST.MF create mode 100755 bundles/runtime/org.eclipse.fx.core/OSGI-INF/jlogger.xml create mode 100755 bundles/runtime/org.eclipse.fx.core/OSGI-INF/l10n/bundle.properties create mode 100755 bundles/runtime/org.eclipse.fx.core/build.properties create mode 100755 bundles/runtime/org.eclipse.fx.core/pom.xml create mode 100755 bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/Callback.java create mode 100755 bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/log/JUtilLoggerFactory.java create mode 100755 bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/log/Log.java create mode 100755 bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/log/Logger.java create mode 100755 bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/log/LoggerFactory.java create mode 100755 bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/update/UpdateService.java diff --git a/bundles/runtime/org.eclipse.fx.core/.classpath b/bundles/runtime/org.eclipse.fx.core/.classpath new file mode 100755 index 000000000..b1dabee38 --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.core/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/bundles/runtime/org.eclipse.fx.core/.gitignore b/bundles/runtime/org.eclipse.fx.core/.gitignore new file mode 100755 index 000000000..4dc009173 --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.core/.gitignore @@ -0,0 +1,2 @@ +/target +/bin diff --git a/bundles/runtime/org.eclipse.fx.core/.project b/bundles/runtime/org.eclipse.fx.core/.project new file mode 100755 index 000000000..37d3210a6 --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.core/.project @@ -0,0 +1,33 @@ + + + org.eclipse.fx.core + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.pde.ds.core.builder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/bundles/runtime/org.eclipse.fx.core/.settings/org.eclipse.jdt.core.prefs b/bundles/runtime/org.eclipse.fx.core/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..f42de363a --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.core/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/bundles/runtime/org.eclipse.fx.core/META-INF/MANIFEST.MF b/bundles/runtime/org.eclipse.fx.core/META-INF/MANIFEST.MF new file mode 100755 index 000000000..79e797d63 --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.core/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %Bundle-Name +Bundle-SymbolicName: org.eclipse.fx.core +Bundle-Version: 0.8.1.qualifier +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Import-Package: javax.inject;version="1.0.0" +Export-Package: org.eclipse.fx.core, + org.eclipse.fx.core.log, + org.eclipse.fx.core.update +Bundle-Vendor: %Bundle-Vendor +Service-Component: OSGI-INF/jlogger.xml +Bundle-ActivationPolicy: lazy diff --git a/bundles/runtime/org.eclipse.fx.core/OSGI-INF/jlogger.xml b/bundles/runtime/org.eclipse.fx.core/OSGI-INF/jlogger.xml new file mode 100755 index 000000000..654c5999c --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.core/OSGI-INF/jlogger.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/bundles/runtime/org.eclipse.fx.core/OSGI-INF/l10n/bundle.properties b/bundles/runtime/org.eclipse.fx.core/OSGI-INF/l10n/bundle.properties new file mode 100755 index 000000000..bc7dd5b3a --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.core/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,3 @@ +#Properties file for org.eclipse.fx.core +Bundle-Vendor = BestSolution.at +Bundle-Name = Core (=none UI) components \ No newline at end of file diff --git a/bundles/runtime/org.eclipse.fx.core/build.properties b/bundles/runtime/org.eclipse.fx.core/build.properties new file mode 100755 index 000000000..4ab6e2638 --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.core/build.properties @@ -0,0 +1,5 @@ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + OSGI-INF/ +source.. = src/ diff --git a/bundles/runtime/org.eclipse.fx.core/pom.xml b/bundles/runtime/org.eclipse.fx.core/pom.xml new file mode 100755 index 000000000..33580096f --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.core/pom.xml @@ -0,0 +1,34 @@ + + 4.0.0 + e(fx)clipse - Runtime - Core + org.eclipse.fx.runtime + org.eclipse.fx.core + eclipse-plugin + + + org.eclipse.fx + releng + ../../../releng/org.eclipse.fx.releng/pom.xml + 0.8.1-SNAPSHOT + + + + + + + . + + META-INF/ + + + + + + org.eclipse.tycho + tycho-source-plugin + + + + + \ No newline at end of file diff --git a/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/Callback.java b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/Callback.java new file mode 100755 index 000000000..ae1ced883 --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/Callback.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2013 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are 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: + * Tom Schindl - initial API and implementation + *******************************************************************************/ +package org.eclipse.fx.core; + +public interface Callback { + public void call(T value); +} diff --git a/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/log/JUtilLoggerFactory.java b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/log/JUtilLoggerFactory.java new file mode 100755 index 000000000..3241b1e96 --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/log/JUtilLoggerFactory.java @@ -0,0 +1,329 @@ +/******************************************************************************* + * Copyright (c) 2012 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are 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: + * Tom Schindl - initial API and implementation + *******************************************************************************/ +package org.eclipse.fx.core.log; + +import javax.inject.Provider; + +public class JUtilLoggerFactory implements LoggerFactory, Provider { + + @Override + public LoggerFactory get() { + return this; + } + + @Override + public Logger createLogger(String name) { + return new LoggerImpl(name); + } + + static class LoggerImpl implements Logger { + private java.util.logging.Logger logger; + + private String name; + + public LoggerImpl(String name) { + this.name = name; + } + + private java.util.logging.Logger getLogger() { + if( logger == null ) { + logger = java.util.logging.Logger.getLogger(name); + } + return logger; + } + + private static java.util.logging.Level toLogLevel(Level level) { + switch (level) { + case TRACE: + return java.util.logging.Level.FINEST; + case DEBUG: + return java.util.logging.Level.FINE; + case INFO: + return java.util.logging.Level.INFO; + case WARNING: + return java.util.logging.Level.WARNING; + case ERROR: + return java.util.logging.Level.SEVERE; + case FATAL: + return java.util.logging.Level.SEVERE; + default: + return java.util.logging.Level.SEVERE; + } + } + + private void logInternal(Level level, String message, Throwable t) { + + java.util.logging.Level jlevel = toLogLevel(level); + + StackTraceElement frame = null; + StackTraceElement[] e = Thread.currentThread().getStackTrace(); + if (e.length > 2) { + for (int i = 2; i < e.length; i++) { + if (getClass().getName().equals(e[i].getClassName())) { + continue; + } + else { + frame = e[i]; + break; + } + } + } + + if (t == null) { + if (frame != null) { + getLogger().logp(jlevel, frame.getClassName(), frame.getMethodName(), message); + } + else { + getLogger().log(jlevel, message); + } + } else { + if (frame != null) { + getLogger().logp(jlevel, frame.getClassName(), frame.getMethodName(), message, t); + } + else { + getLogger().log(jlevel, message, t); + } + } + + } + + @Override + public void log(Level level, String message) { + if (!isEnabled(level)) { + return; + } + logInternal(level, message, null); + } + + @Override + public void logf(Level level, String pattern, Throwable t, Object... args) { + if (!isEnabled(level)) { + return; + } + logInternal(level, String.format(pattern, args), t); + } + + @Override + public void logf(Level level, String pattern, Object... args) { + if (!isEnabled(level)) { + return; + } + logInternal(level, String.format(pattern, args), null); + } + + @Override + public void log(Level level, String message, Throwable t) { + if (!isEnabled(level)) { + return; + } + logInternal(level, message, t); + } + + @Override + public void trace(String message) { + if (!isEnabled(Level.TRACE)) { + return; + } + logInternal(Level.TRACE, message, null); + } + + @Override + public void trace(String message, Throwable t) { + if (!isEnabled(Level.TRACE)) { + return; + } + logInternal(Level.TRACE, message, t); + } + + @Override + public void debug(String message) { + if (!isEnabled(Level.DEBUG)) { + return; + } + logInternal(Level.DEBUG, message, null); + } + + @Override + public void debug(String message, Throwable t) { + if (!isEnabled(Level.DEBUG)) { + return; + } + log(Level.DEBUG, message, t); + } + + @Override + public void info(String message) { + if (!isEnabled(Level.INFO)) { + return; + } + logInternal(Level.INFO, message, null); + } + + + @Override + public void info(String message, Throwable t) { + if (!isEnabled(Level.INFO)) { + return; + } + logInternal(Level.INFO, message, t); + } + + @Override + public void warning(String message) { + if (!isEnabled(Level.WARNING)) { + return; + } + logInternal(Level.WARNING, message, null); + } + + @Override + public void warning(String message, Throwable t) { + if (!isEnabled(Level.WARNING)) { + return; + } + logInternal(Level.WARNING, message, t); + } + + @Override + public void error(String message) { + if (!isEnabled(Level.ERROR)) { + return; + } + logInternal(Level.ERROR, message, null); + } + + + @Override + public void error(String message, Throwable t) { + if (!isEnabled(Level.ERROR)) { + return; + } + logInternal(Level.ERROR, message, t); + } + + @Override + public void fatal(String message) { + if (!isEnabled(Level.FATAL)) { + return; + } + logInternal(Level.FATAL, message, null); + } + + @Override + public void fatal(String message, Throwable t) { + if (!isEnabled(Level.FATAL)) { + return; + } + logInternal(Level.FATAL, message, t); + } + + @Override + public void tracef(String pattern, Object... args) { + if (!isEnabled(Level.TRACE)) { + return; + } + logInternal(Level.TRACE, String.format(pattern, args), null); + } + + @Override + public void tracef(String pattern, Throwable t, Object... args) { + if (!isEnabled(Level.TRACE)) { + return; + } + logInternal(Level.TRACE, String.format(pattern, args), t); + } + + @Override + public void debugf(String pattern, Object... args) { + if (!isEnabled(Level.DEBUG)) { + return; + } + logInternal(Level.DEBUG, String.format(pattern, args), null); + } + + @Override + public void debugf(String pattern, Throwable t, Object... args) { + if (!isEnabled(Level.DEBUG)) { + return; + } + logInternal(Level.DEBUG, String.format(pattern, args), t); + } + + @Override + public void infof(String pattern, Object... args) { + if (!isEnabled(Level.INFO)) { + return; + } + logInternal(Level.INFO, String.format(pattern, args), null); + } + + @Override + public void infof(String pattern, Throwable t, Object... args) { + if (!isEnabled(Level.INFO)) { + return; + } + logInternal(Level.INFO, String.format(pattern, args), t); + } + + @Override + public void warningf(String pattern, Object... args) { + if (!isEnabled(Level.WARNING)) { + return; + } + logInternal(Level.WARNING, String.format(pattern, args), null); + } + + @Override + public void warningf(String pattern, Throwable t, Object... args) { + if (!isEnabled(Level.WARNING)) { + return; + } + logInternal(Level.WARNING, String.format(pattern, args), t); + } + + @Override + public void errorf(String pattern, Object... args) { + if (!isEnabled(Level.ERROR)) { + return; + } + logInternal(Level.ERROR, String.format(pattern, args), null); + } + + @Override + public void errorf(String pattern, Throwable t, Object... args) { + if (!isEnabled(Level.ERROR)) { + return; + } + logInternal(Level.ERROR, String.format(pattern, args), t); + } + + @Override + public void fatalf(String pattern, Object... args) { + if (!isEnabled(Level.FATAL)) { + return; + } + logInternal(Level.FATAL, String.format(pattern, args), null); + } + + @Override + public void fatalf(String pattern, Throwable t, Object... args) { + if (!isEnabled(Level.FATAL)) { + return; + } + logInternal(Level.FATAL, String.format(pattern, args), t); + } + + @Override + public boolean isEnabled(Level level) { + return getLogger().isLoggable(toLogLevel(level)); + } + } +} \ No newline at end of file diff --git a/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/log/Log.java b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/log/Log.java new file mode 100755 index 000000000..fb14543c1 --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/log/Log.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2012 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are 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: + * Tom Schindl - initial API and implementation + *******************************************************************************/ +package org.eclipse.fx.core.log; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.inject.Qualifier; + +@Qualifier +@Documented +@Target({ElementType.FIELD, ElementType.PARAMETER}) +@Retention(RetentionPolicy.RUNTIME) +public @interface Log { + String value() default ""; +} diff --git a/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/log/Logger.java b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/log/Logger.java new file mode 100755 index 000000000..729a98c5c --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/log/Logger.java @@ -0,0 +1,255 @@ +/******************************************************************************* + * Copyright (c) 2012 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are 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: + * Tom Schindl - initial API and implementation + * Christoph Caks - initial API and documentation + *******************************************************************************/ +package org.eclipse.fx.core.log; + +public interface Logger { + + /** + * logs a message in the specified log level. + * @param level the Log Level + * @param message the message + */ + public void log(Level level, String message); + /** + * logs a message and an exception in the specified log level + * @param level the Log Level + * @param message the message + * @param t the Exception + */ + public void log(Level level, String message, Throwable t); + + /** + * logs a formatted message in the specified log level. + *

+ * For formatting {@link String#format(String, Object...)} is used. + * The following two method calls yield the same result, but the + * logf call allows the underlying implementation to prevent the formatting + * if the log level is disabled. + *
+ * logf(Level.TRACE, "%5.3f", num);
+ * log(Level.TRACE, String.format("%5.3", num)); + *
+ *

+ * @see String#format(String, Object...) + * @param level the Log Level + * @param pattern the message format + * @param args the message arguments + */ + public void logf(Level level, String pattern, Object...args); + public void logf(Level level, String pattern, Throwable t, Object...args); + + /** + * convenience method for {@link #log(Level, String)} with {@link Level#TRACE}. + * @see #log(Level, String) + * @param message the message + */ + public void trace(String message); + /** + * convenience method for {@link #log(Level, String)} with {@link Level#DEBUG}. + * @see #log(Level, String) + * @param message the message + */ + public void debug(String message); + /** + * convenience method for {@link #log(Level, String)} with {@link Level#INFO}. + * @see #log(Level, String) + * @param message the message + */ + public void info(String message); + /** + * convenience method for {@link #log(Level, String)} with {@link Level#WARNING}. + * @see #log(Level, String) + * @param message the message + */ + public void warning(String message); + /** + * convenience method for {@link #log(Level, String)} with {@link Level#ERROR}. + * @see #log(Level, String) + * @param message the message + */ + public void error(String message); + /** + * convenience method for {@link #log(Level, String)} with {@link Level#FATAL}. + * @see #log(Level, String) + * @param message the message + */ + public void fatal(String message); + + /** + * convenience method for {@link #log(Level, String, Throwable)} with {@link Level#TRACE}. + * @see #log(Level, String, Throwable) + * @param message the message + * @param t the Exception + */ + public void trace(String message, Throwable t); + /** + * convenience method for {@link #log(Level, String, Throwable)} with {@link Level#DEBUG}. + * @see #log(Level, String, Throwable) + * @param message the message + * @param t the Exception + */ + public void debug(String message, Throwable t); + /** + * convenience method for {@link #log(Level, String, Throwable)} with {@link Level#INFO}. + * @see #log(Level, String, Throwable) + * @param message the message + * @param t the Exception + */ + public void info(String message, Throwable t); + /** + * convenience method for {@link #log(Level, String, Throwable)} with {@link Level#WARNING}. + * @see #log(Level, String, Throwable) + * @param message the message + * @param t the Exception + */ + public void warning(String message, Throwable t); + /** + * convenience method for {@link #log(Level, String, Throwable)} with {@link Level#ERROR}. + * @see #log(Level, String, Throwable) + * @param message the message + * @param t the Exception + */ + public void error(String message, Throwable t); + /** + * convenience method for {@link #log(Level, String, Throwable)} with {@link Level#FATAL}. + * @see #log(Level, String, Throwable) + * @param message the message + * @param t the Exception + */ + public void fatal(String message, Throwable t); + + + /** + * convenience method for {@link #logf(Level, String, Object..)} with {@link Level#TRACE}. + * @see #logf(Level, String, Object..) + * @see String#format(String, Object...) + * @param pattern the message format + * @param args the message arguments + */ + public void tracef(String pattern, Object...args); + + /** + * convenience method for {@link #logf(Level, String, Object..)} with {@link Level#DEBUG}. + * @see #logf(Level, String, Object..) + * @see String#format(String, Object...) + * @param pattern the message format + * @param args the message arguments + */ + public void debugf(String pattern, Object...args); + + /** + * convenience method for {@link #logf(Level, String, Object..)} with {@link Level#INFO}. + * @see #logf(Level, String, Object..) + * @see String#format(String, Object...) + * @param pattern the message format + * @param args the message arguments + */ + public void infof(String pattern, Object...args); + + /** + * convenience method for {@link #logf(Level, String, Object..)} with {@link Level#WARNING}. + * @see #logf(Level, String, Object..) + * @see String#format(String, Object...) + * @param pattern the message format + * @param args the message arguments + */ + public void warningf(String pattern, Object...args); + + /** + * convenience method for {@link #logf(Level, String, Object..)} with {@link Level#ERROR}. + * @see #logf(Level, String, Object..) + * @see String#format(String, Object...) + * @param pattern the message format + * @param args the message arguments + */ + public void errorf(String pattern, Object...args); + + /** + * convenience method for {@link #logf(Level, String, Object..)} with {@link Level#FATAL}. + * @see #logf(Level, String, Object..) + * @see String#format(String, Object...) + * @param pattern the message format + * @param args the message arguments + */ + public void fatalf(String pattern, Object...args); + + /** + * convenience method for {@link #logf(Level, String, Throwable, Object..)} with {@link Level#TRACE}. + * @see #logf(Level, String, Throwable, Object..) + * @see String#format(String, Object...) + * @param pattern the message format + * @param t the Exception + * @param args the message arguments + */ + public void tracef(String pattern, Throwable t, Object...args); + /** + * convenience method for {@link #logf(Level, String, Throwable, Object..)} with {@link Level#DEBUG}. + * @see #logf(Level, String, Throwable, Object..) + * @see String#format(String, Object...) + * @param pattern the message format + * @param t the Exception + * @param args the message arguments + */ + public void debugf(String pattern, Throwable t, Object...args); + /** + * convenience method for {@link #logf(Level, String, Throwable, Object..)} with {@link Level#INFO}. + * @see #logf(Level, String, Throwable, Object..) + * @see String#format(String, Object...) + * @param pattern the message format + * @param t the Exception + * @param args the message arguments + */ + public void infof(String pattern, Throwable t, Object...args); + /** + * convenience method for {@link #logf(Level, String, Throwable, Object..)} with {@link Level#WARNING}. + * @see #logf(Level, String, Throwable, Object..) + * @see String#format(String, Object...) + * @param pattern the message format + * @param t the Exception + * @param args the message arguments + */ + public void warningf(String pattern, Throwable t, Object...args); + /** + * convenience method for {@link #logf(Level, String, Throwable, Object..)} with {@link Level#ERROR}. + * @see #logf(Level, String, Throwable, Object..) + * @see String#format(String, Object...) + * @param pattern the message format + * @param t the Exception + * @param args the message arguments + */ + public void errorf(String pattern, Throwable t, Object...args); + /** + * convenience method for {@link #logf(Level, String, Throwable, Object..)} with {@link Level#FATAL}. + * @see #logf(Level, String, Throwable, Object..) + * @see String#format(String, Object...) + * @param pattern the message format + * @param t the Exception + * @param args the message arguments + */ + public void fatalf(String pattern, Throwable t, Object...args); + + /** + * checks whether the given log level is enabled for this logger. + * @param level the log level to check against + * @return true if the log level is enabled + */ + public boolean isEnabled(Level level); + + public enum Level { + TRACE, + DEBUG, + INFO, + WARNING, + ERROR, + FATAL + } +} diff --git a/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/log/LoggerFactory.java b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/log/LoggerFactory.java new file mode 100755 index 000000000..610ffca15 --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/log/LoggerFactory.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2012 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are 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: + * Tom Schindl - initial API and implementation + *******************************************************************************/ +package org.eclipse.fx.core.log; + +public interface LoggerFactory { + public Logger createLogger(String name); +} diff --git a/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/update/UpdateService.java b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/update/UpdateService.java new file mode 100755 index 000000000..170eb0242 --- /dev/null +++ b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/update/UpdateService.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2013 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are 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: + * Tom Schindl - initial API and implementation + *******************************************************************************/ +package org.eclipse.fx.core.update; + +import org.eclipse.fx.core.Callback; + +public interface UpdateService { + public void update(UpdateCheckData data, Callback callback); + public void checkUpdate(Callback callback); + + public enum State { + ERROR, + WARNING, + CANCEL, + OK + } + + public static class ReturnValueImpl implements ReturnValue { + public final State state; + public final String message; + public final Throwable throwable; + public final V value; + + public ReturnValueImpl(State state, String message, V value, Throwable throwable) { + this.state = state; + this.message = message; + this.throwable = throwable; + this.value = value; + } + + @Override + public String getMessage() { + return message; + } + + public Throwable getThrowable() { + return throwable; + } + + public State getState() { + return state; + } + + public V getValue() { + return value; + } + } + + interface ReturnValue { + public State getState(); + public String getMessage(); + public V getValue(); + public Throwable getThrowable(); + } + + interface UpdateCheckData extends ReturnValue { + + } + + interface UpdateData extends ReturnValue { + + } +} -- cgit v1.2.3