# HG changeset patch
# User Frank Benoit
- * Core exceptions contain a status object describing the
+ * Core exceptions contain a status object describing the
* cause of the exception.
*
* This class can be used without OSGi running.
@@ -34,7 +37,7 @@
/**
* All serializable objects should have a stable serialVersionUID
*/
- private static const long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
/** Status object. */
private IStatus status;
@@ -52,11 +55,11 @@
/**
* Returns the cause of this exception, or
- * Adaptable objects can be dynamically extended to provide different
- * interfaces (or "adapters"). Adapters are created by adapter
+ * Adaptable objects can be dynamically extended to provide different
+ * interfaces (or "adapters"). Adapters are created by adapter
* factories, which are in turn managed by type by adapter managers.
*
@@ -45,9 +46,9 @@
* no such object can be found.
*
* @param adapter the adapter class to look up
- * @return a object castable to the given class,
+ * @return a object castable to the given class,
* or
* Adapter factories can be registered programmatically using the
- *
+ *
*
* This interface can be used without OSGi running.
*
@@ -71,27 +71,27 @@
public interface IAdapterManager {
/**
- * This value can be returned to indicate that no applicable adapter factory
- * was found.
+ * This value can be returned to indicate that no applicable adapter factory
+ * was found.
* @since org.eclipse.equinox.common 3.3
*/
- public static const int NONE = 0;
+ public static final int NONE = 0;
/**
- * This value can be returned to indicate that an adapter factory was found,
+ * This value can be returned to indicate that an adapter factory was found,
* but has not been loaded.
* @since org.eclipse.equinox.common 3.3
*/
- public static const int NOT_LOADED = 1;
+ public static final int NOT_LOADED = 1;
/**
* This value can be returned to indicate that an adapter factory is loaded.
* @since org.eclipse.equinox.common 3.3
*/
- public static const int LOADED = 2;
+ public static final int LOADED = 2;
/**
- * Returns the types that can be obtained by converting
@@ -101,18 +101,18 @@
* loaded, or if the factory itself returns
* Note that this method will never cause plug-ins to be loaded. If the
* only suitable factory is not yet loaded, this method will return
- * Note that paths are value objects; all operations on paths
+ * Note that paths are value objects; all operations on paths
* return a new path; the path that is operated on is unscathed.
*
- * UNC paths are denoted by leading double-slashes such
+ * UNC paths are denoted by leading double-slashes such
* as
* The file extension portion is defined as the string
@@ -186,7 +186,7 @@
* any device id).
*
* Absolute paths start with a path separator.
- * A root path, like
- * An empty path is a prefix of all paths with the same device; a root path is a prefix of
+ * An empty path is a prefix of all paths with the same device; a root path is a prefix of
* all absolute paths with the same device.
*
- * The root path is the absolute non-UNC path with zero segments;
+ * The root path is the absolute non-UNC path with zero segments;
* e.g.,
* The file extension portion is defined as the string
@@ -342,7 +342,7 @@
/**
* Returns a copy of this path with the given number of segments
- * removed from the beginning. The device id is preserved.
+ * removed from the beginning. The device id is preserved.
* The number must be greater or equal zero.
* If the count is zero, this path is returned.
* The resulting path will always be a relative path with respect
@@ -395,13 +395,13 @@
*
+ *
* Note that both root and empty paths have 0 segments.
*
@@ -435,7 +435,7 @@
*
* @return the file corresponding to this path
*/
- public tango.io.FilePath.FilePath toFile();
+ public java.io.File toFile();
/**
* Returns a string representation of this path which uses the
@@ -451,9 +451,9 @@
public String toOSString();
/**
- * Returns a platform-neutral string representation of this path. The
- * format is not specified, except that the resulting string can be
- * passed back to the
* This string is suitable for passing to
* All activity is broken down into a linear sequence of tasks against
* which progress is reported. When a task begins, a
- * A request to cancel an operation can be signaled using the
+ * A request to cancel an operation can be signaled using the
*
- * Since notification is synchronous with the activity itself, the listener should
- * provide a fast and robust implementation. If the handling of notifications would
- * involve blocking operations, or operations which might throw uncaught exceptions,
+ * Since notification is synchronous with the activity itself, the listener should
+ * provide a fast and robust implementation. If the handling of notifications would
+ * involve blocking operations, or operations which might throw uncaught exceptions,
* the notifications should be queued, and the actual processing deferred (or perhaps
* delegated to a separate thread).
*
@@ -53,32 +53,32 @@
/** Constant indicating an unknown amount of work.
*/
- public static const int UNKNOWN = -1;
+ public final static int UNKNOWN = -1;
/**
* Notifies that the main task is beginning. This must only be called once
* on a given progress monitor instance.
- *
+ *
* @param name the name (or description) of the main task
* @param totalWork the total number of work units into which
- * the main task is been subdivided. If the value is
* A status carries the following information:
@@ -29,7 +31,7 @@
*
@@ -49,25 +51,25 @@
* @see #getSeverity()
* @see #isOK()
*/
- public static const int OK = 0;
+ public static final int OK = 0;
/** Status type severity (bit mask, value 1) indicating this status is informational only.
* @see #getSeverity()
* @see #matches(int)
*/
- public static const int INFO = 0x01;
+ public static final int INFO = 0x01;
/** Status type severity (bit mask, value 2) indicating this status represents a warning.
* @see #getSeverity()
* @see #matches(int)
*/
- public static const int WARNING = 0x02;
+ public static final int WARNING = 0x02;
/** Status type severity (bit mask, value 4) indicating this status represents an error.
* @see #getSeverity()
* @see #matches(int)
*/
- public static const int ERROR = 0x04;
+ public static final int ERROR = 0x04;
/** Status type severity (bit mask, value 8) indicating this status represents a
* cancelation
@@ -75,7 +77,7 @@
* @see #matches(int)
* @since 3.0
*/
- public static const int CANCEL = 0x08;
+ public static final int CANCEL = 0x08;
/**
* Returns a list of status object immediately contained in this
@@ -94,14 +96,14 @@
public int getCode();
/**
- * Returns the relevant low-level exception, or org.eclipse.core.runtime
")
* of the Core Runtime (pseudo-) plug-in.
*/
- public static const String PI_RUNTIME = "org.eclipse.core.runtime"; //$NON-NLS-1$
+ public static final String PI_RUNTIME = "org.eclipse.core.runtime"; //$NON-NLS-1$
/**
* Name of this bundle.
*/
- public static const String PI_COMMON = "org.eclipse.equinox.common"; //$NON-NLS-1$
+ public static final String PI_COMMON = "org.eclipse.equinox.common"; //$NON-NLS-1$
/**
* Status code constant (value 2) indicating an error occurred while running a plug-in.
*/
- public static const int PLUGIN_ERROR = 2;
+ public static final int PLUGIN_ERROR = 2;
/**
* Status code constant (value 5) indicating the platform could not write
* some of its metadata.
*/
- public static const int FAILED_WRITE_METADATA = 5;
+ public static final int FAILED_WRITE_METADATA = 5;
}
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/LocalizationUtils.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/LocalizationUtils.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/LocalizationUtils.d Sun Nov 08 12:42:30 2009 +0100
@@ -7,53 +7,56 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit Assert
is useful for for embedding runtime sanity checks
* in code. The predicate methods all test a condition and throw some
@@ -73,18 +73,12 @@
/** Asserts that the given object is not null
. If this
* is not the case, some kind of unchecked exception is thrown.
- *
+ *
* @param object the value to test
*/
public static void isNotNull(Object object) {
isNotNull(object, ""); //$NON-NLS-1$
}
- public static void isNotNull(String str) {
- isTrue(str.ptr !is null); //$NON-NLS-1$
- }
- public static void isNotNull(void* ptr) {
- isTrue(ptr !is null); //$NON-NLS-1$
- }
/** Asserts that the given object is not null
. If this
* is not the case, some kind of unchecked exception is thrown.
@@ -95,13 +89,7 @@
*/
public static void isNotNull(Object object, String message) {
if (object is null)
- throw new AssertionFailedException("null argument:" ~ message); //$NON-NLS-1$
- }
- public static void isNotNull(String str, String message) {
- isTrue(str.ptr !is null, message ); //$NON-NLS-1$
- }
- public static void isNotNull(void* ptr, String message) {
- isTrue(ptr !is null, message ); //$NON-NLS-1$
+ throw new AssertionFailedException("null argument:" + message); //$NON-NLS-1$
}
/** Asserts that the given bool is true
. If this
@@ -126,7 +114,7 @@
*/
public static bool isTrue(bool expression, String message) {
if (!expression)
- throw new AssertionFailedException("assertion failed: " ~ message); //$NON-NLS-1$
+ throw new AssertionFailedException("assertion failed: " + message); //$NON-NLS-1$
return expression;
}
}
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/AssertionFailedException.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/AssertionFailedException.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/AssertionFailedException.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,16 +4,16 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit AssertionFailedException
is a runtime exception thrown
@@ -35,9 +35,9 @@
*/
private static final long serialVersionUID = 1L;
- /**
+ /**
* Constructs a new exception with the given message.
- *
+ *
* @param detail the message
*/
public this(String detail) {
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/CoreException.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/CoreException.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/CoreException.d Sun Nov 08 12:42:30 2009 +0100
@@ -1,28 +1,31 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit null
if none.
- *
+ *
* @return the cause for this exception
* @since 3.4
*/
- public Exception getCause() {
+ public Throwable getCause() {
return status.getException();
}
@@ -83,55 +86,34 @@
* its Status object.
*/
public void printStackTrace() {
-// printStackTrace(System.err);
- getDwtLogger.error( __FILE__, __LINE__, "Exception in File {}({}): {}", this.file, this.line, this.msg );
- foreach( msg; this.info ){
- getDwtLogger.error( __FILE__, __LINE__, " trc: {}", msg );
- }
- if (status.getException() !is null) {
- getDwtLogger.error( __FILE__, __LINE__, "{}[{}]: ", this.classinfo.name, status.getCode() ); //$NON-NLS-1$ //$NON-NLS-2$
-// status.getException().printStackTrace();
- auto e = status.getException();
- getDwtLogger.error( __FILE__, __LINE__, "Exception in File {}({}): {}", e.file, e.line, e.msg );
- foreach( msg; e.info ){
- getDwtLogger.error( __FILE__, __LINE__, " trc: {}", msg );
- }
+ printStackTrace(System.err);
+ }
+
+ /**
+ * Prints a stack trace out for the exception, and
+ * any nested exception that it may have embedded in
+ * its Status object.
+ *
+ * @param output the stream to write to
+ */
+ public void printStackTrace(PrintStream output) {
+ synchronized (output) {
+ super.printStackTrace(output);
+ PrintStackUtil.printChildren(status, output);
}
}
-//FIXME
-// /**
-// * Prints a stack trace out for the exception, and
-// * any nested exception that it may have embedded in
-// * its Status object.
-// *
-// * @param output the stream to write to
-// */
-// public void printStackTrace(PrintStream output) {
-// synchronized (output) {
-// super.printStackTrace(output);
-// if (status.getException() !is null) {
-// output.print(getClass().getName() + "[" + status.getCode() + "]: "); //$NON-NLS-1$ //$NON-NLS-2$
-// status.getException().printStackTrace(output);
-// }
-// }
-// }
-//
-// /**
-// * Prints a stack trace out for the exception, and
-// * any nested exception that it may have embedded in
-// * its Status object.
-// *
-// * @param output the stream to write to
-// */
-// public void printStackTrace(PrintWriter output) {
-// synchronized (output) {
-// super.printStackTrace(output);
-// if (status.getException() !is null) {
-// output.print(getClass().getName() + "[" + status.getCode() + "]: "); //$NON-NLS-1$ //$NON-NLS-2$
-// status.getException().printStackTrace(output);
-// }
-// }
-// }
-
+ /**
+ * Prints a stack trace out for the exception, and
+ * any nested exception that it may have embedded in
+ * its Status object.
+ *
+ * @param output the stream to write to
+ */
+ public void printStackTrace(PrintWriter output) {
+ synchronized (output) {
+ super.printStackTrace(output);
+ PrintStackUtil.printChildren(status, output);
+ }
+ }
}
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/IAdaptable.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IAdaptable.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IAdaptable.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,28 +4,29 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit
* IAdaptable a = [some adaptable];
* IFoo x = (IFoo)a.getAdapter(IFoo.class);
- * if (x !is null)
+ * if (x != null)
* [do IFoo things with x]
*
* null
if this object does not
* have an adapter for the given class
*/
- public Object getAdapter(ClassInfo adapter);
+ public Object getAdapter(Class adapter);
}
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/IAdapterFactory.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IAdapterFactory.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IAdapterFactory.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,16 +4,17 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit IAdaptable
@@ -36,12 +37,12 @@
* @param adaptableObject the adaptable object being queried
* (usually an instance of IAdaptable
)
* @param adapterType the type of adapter to look up
- * @return a object castable to the given adapter type,
- * or null
if this adapter factory
+ * @return a object castable to the given adapter type,
+ * or null
if this adapter factory
* does not have an adapter of the given type for the
* given object
*/
- public Object getAdapter(Object adaptableObject, ClassInfo adapterType);
+ public Object getAdapter(Object adaptableObject, Class adapterType);
/**
* Returns the collection of adapter types handled by this
@@ -54,5 +55,5 @@
*
* @return the collection of adapter types
*/
- public ClassInfo[] getAdapterList();
+ public Class[] getAdapterList();
}
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/IAdapterManager.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IAdapterManager.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IAdapterManager.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,18 +4,18 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit registerAdapters
- * method. Alternatively, they can be registered declaratively using the
+ * method. Alternatively, they can be registered declaratively using the
* org.eclipse.core.runtime.adapters
extension point. Factories registered
* with this extension point will not be able to provide adapters until their
* corresponding plugin has been activated.
@@ -34,30 +34,30 @@
* The following code snippet shows how one might register an adapter of type
* com.example.acme.Sticky
on resources in the workspace.
*
* IAdapterFactory pr = new IAdapterFactory() {
- * public Class[] getAdapterList() {
- * return new Class[] { com.example.acme.Sticky.class };
- * }
- * public Object getAdapter(Object adaptableObject, Class adapterType) {
- * IResource res = (IResource) adaptableObject;
- * QualifiedName key = new QualifiedName("com.example.acme", "sticky-note");
- * try {
- * com.example.acme.Sticky v = (com.example.acme.Sticky) res.getSessionProperty(key);
- * if (v is null) {
- * v = new com.example.acme.Sticky();
- * res.setSessionProperty(key, v);
- * }
- * } catch (CoreException e) {
- * // unable to access session property - ignore
- * }
- * return v;
- * }
+ * public Class[] getAdapterList() {
+ * return new Class[] { com.example.acme.Sticky.class };
+ * }
+ * public Object getAdapter(Object adaptableObject, Class adapterType) {
+ * IResource res = (IResource) adaptableObject;
+ * QualifiedName key = new QualifiedName("com.example.acme", "sticky-note");
+ * try {
+ * com.example.acme.Sticky v = (com.example.acme.Sticky) res.getSessionProperty(key);
+ * if (v == null) {
+ * v = new com.example.acme.Sticky();
+ * res.setSessionProperty(key, v);
+ * }
+ * } catch (CoreException e) {
+ * // unable to access session property - ignore
+ * }
+ * return v;
+ * }
* }
* Platform.getAdapterManager().registerAdapters(pr, IResource.class);
*
- *
+ *
* adaptableClass
+ * Returns the types that can be obtained by converting adaptableClass
* via this manager. Converting means that subsequent calls to getAdapter()
* or loadAdapter()
could result in an adapted object.
* null
, then
* getAdapter
will still return null
.
* adaptableClass
via this manager. An empty array
+ * @param adaptableClass the adaptable class being queried
+ * @return an array of type names that can be obtained by converting
+ * adaptableClass
via this manager. An empty array
* is returned if there are none.
* @since 3.1
*/
- public String[] computeAdapterTypes(ClassInfo adaptableClass);
+ public String[] computeAdapterTypes(Class adaptableClass);
/**
- * Returns the class search order for a given class. The search order from a
+ * Returns the class search order for a given class. The search order from a
* class with the definition
- * class X extends Y implements A, B
+ * class X : Y , A, B
* is as follows:
*
*
- *
- * @param clazz the class for which to return the class order.
+ *
+ * @param clazz the class for which to return the class order.
* @return the class search order for the given class. The returned
* search order will minimally contain the target class.
* @since 3.1
*/
- public ClassInfo[] computeClassOrder(ClassInfo clazz);
+ public Class[] computeClassOrder(Class clazz);
/**
* Returns an object which is an instance of the given class associated
@@ -136,7 +136,7 @@
* getInterfaces
(in the example, A and its
* superinterfaces then B and its superinterfaces) null
.
- *
+ *
* @param adaptable the adaptable object being queried (usually an instance
* of IAdaptable
)
* @param adapterType the type of adapter to look up
@@ -144,7 +144,7 @@
* if the given adaptable object does not have an available adapter of the
* given type
*/
- public Object getAdapter(Object adaptable, ClassInfo adapterType);
+ public Object getAdapter(Object adaptable, Class adapterType);
/**
* Returns an object which is an instance of the given class name associated
@@ -155,7 +155,7 @@
* only suitable factory is not yet loaded, this method will return null
.
* If activation of the plug-in providing the factory is required, use the
* loadAdapter
method instead.
- *
+ *
* @param adaptable the adaptable object being queried (usually an instance
* of IAdaptable
)
* @param adapterTypeName the fully qualified name of the type of adapter to look up
@@ -175,7 +175,7 @@
* will return a non-null result. If the factory's plug-in has not yet been
* loaded, or if the factory itself returns null
, then
* getAdapter
will still return null
.
- *
+ *
* @param adaptable the adaptable object being queried (usually an instance
* of IAdaptable
)
* @param adapterTypeName the fully qualified class name of an adapter to
@@ -200,7 +200,7 @@
* of IAdaptable
)
* @param adapterTypeName the fully qualified class name of an adapter to
* look up
- * @return a status of the adapter
+ * @return a status of the adapter
* @since org.eclipse.equinox.common 3.3
*/
public int queryAdapter(Object adaptable, String adapterTypeName);
@@ -215,7 +215,7 @@
* if necessary. As such, this method should be used judiciously, in order
* to avoid unnecessary plug-in activations. Most clients should avoid
* activation by using getAdapter
instead.
- *
+ *
* @param adaptable the adaptable object being queried (usually an instance
* of IAdaptable
)
* @param adapterTypeName the fully qualified name of the type of adapter to look up
@@ -235,20 +235,20 @@
* an interface, the adapters are available to all classes that directly or
* indirectly implement that interface.
* unregisterAdapters(IAdapterFactory,Class)
* on all classes against which it had been explicitly registered. Does
* nothing if the given factory is not currently registered.
- *
+ *
* @param factory the adapter factory to remove
* @see #registerAdapters(IAdapterFactory, Class)
*/
@@ -258,11 +258,11 @@
* Removes the given adapter factory from the list of factories registered
* as extending the given class. Does nothing if the given factory and type
* combination is not registered.
- *
+ *
* @param factory the adapter factory to remove
* @param adaptable one of the types against which the given factory is
* registered
* @see #registerAdapters(IAdapterFactory, Class)
*/
- public void unregisterAdapters(IAdapterFactory factory, ClassInfo adaptable);
+ public void unregisterAdapters(IAdapterFactory factory, Class adaptable);
}
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/ILogListener.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/ILogListener.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/ILogListener.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,17 +4,18 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit null
for a device id.
* //Server/Volume/My/Path
. When a new path
* is constructed all double-slashes are removed except those
* appearing at the beginning of the path.
@@ -48,16 +48,16 @@
/**
* Path separator character constant "/" used in paths.
*/
- public static const char SEPARATOR = '/';
+ public static final char SEPARATOR = '/';
- /**
+ /**
* Device separator character constant ":" used in paths.
*/
- public static const char DEVICE_SEPARATOR = ':';
+ public static final char DEVICE_SEPARATOR = ':';
/**
* Returns a new path which is the same as this path but with
- * the given file extension added. If this path is empty, root or has a
+ * the given file extension added. If this path is empty, root or has a
* trailing separator, this path is returned. If this path already
* has an extension, the existing extension is left and the given
* extension simply appended. Clients wishing to replace
@@ -93,13 +93,13 @@
* Returns the canonicalized path obtained from the
* concatenation of the given string path to the
* end of this path. The given string path must be a valid
- * path. If it has a trailing separator,
+ * path. If it has a trailing separator,
* the result will have a trailing separator.
* The device id of this path is preserved (the one
* of the given string is ignored). Duplicate slashes
* are removed from the path except at the beginning
* where the path is considered to be UNC.
- *
+ *
* @param path the string path to concatenate
* @return the new path
* @see #isValidPath(String)
@@ -107,7 +107,7 @@
public IPath append(String path);
/**
- * Returns the canonicalized path obtained from the
+ * Returns the canonicalized path obtained from the
* concatenation of the given path's segments to the
* end of this path. If the given path has a trailing
* separator, the result will have a trailing separator.
@@ -141,7 +141,7 @@
* @return true
if the paths are equivalent,
* and false
if they are not
*/
- public int opEquals(Object obj);
+ public override equals_t opEquals(Object obj);
/**
* Returns the device id for this path, or null
if this
@@ -153,7 +153,7 @@
public String getDevice();
/**
- * Returns the file extension portion of this path,
+ * Returns the file extension portion of this path,
* or null
if there is none.
* /
or C:/
,
+ * A root path, like /
or C:/
,
* is considered absolute. UNC paths are always absolute.
* /
or C:/
.
* The separator is considered a leading separator, not a trailing one.
* Path.SEPARATOR
.
- *
- * @return bool indicating if this path is UNC
+ *
+ * @return boolean indicating if this path is UNC
*/
public bool isUNC();
/**
* Returns whether the given string is syntactically correct as
* a path. The device id is the prefix up to and including the device
- * separator for the local file system; the path proper is everything to
- * the right of it, or the entire string if there is no device separator.
+ * separator for the local file system; the path proper is everything to
+ * the right of it, or the entire string if there is no device separator.
* When the platform location is a file system with no meaningful device
* separator, the entire string is treated as the path proper.
- * The device id is not checked for validity; the path proper is correct
+ * The device id is not checked for validity; the path proper is correct
* if each of the segments in its canonicalized form is valid.
*
* @param path the path to check
@@ -260,7 +260,7 @@
public bool isValidPath(String path);
/**
- * Returns whether the given string is valid as a segment in
+ * Returns whether the given string is valid as a segment in
* a path. The rules for valid segments are as follows:
*
*
- * Some status objects, known as multi-statuses, have other status objects
+ * Some status objects, known as multi-statuses, have other status objects
* as children.
* null
if it does not have any segments.
*
- * @return the last segment of this path, or null
+ * @return the last segment of this path, or null
*/
public String lastSegment();
/**
* Returns an absolute path with the segments and device id of this path.
- * Absolute paths start with a path separator. If this path is absolute,
+ * Absolute paths start with a path separator. If this path is absolute,
* it is simply returned.
*
* @return the new path
@@ -295,7 +295,7 @@
/**
* Returns a relative path with the segments and device id of this path.
- * Absolute paths start with a path separator and relative paths do not.
+ * Absolute paths start with a path separator and relative paths do not.
* If this path is relative, it is simply returned.
*
* @return the new path
@@ -304,13 +304,13 @@
/**
* Return a new path which is the equivalent of this path converted to UNC
- * form (if the given bool is true) or this path not as a UNC path (if the given
- * bool is false). If UNC, the returned path will not have a device and the
+ * form (if the given boolean is true) or this path not as a UNC path (if the given
+ * boolean is false). If UNC, the returned path will not have a device and the
* first 2 characters of the path string will be Path.SEPARATOR
. If not UNC, the
- * first 2 characters of the returned path string will not be Path.SEPARATOR
.
- *
+ * first 2 characters of the returned path string will not be Path.SEPARATOR
.
+ *
* @param toUNC true if converting to UNC, false otherwise
- * @return the new path, either in UNC form or not depending on the bool parameter
+ * @return the new path, either in UNC form or not depending on the boolean parameter
*/
public IPath makeUNC(bool toUNC);
@@ -326,7 +326,7 @@
/**
* Returns a new path which is the same as this path but with
- * the file extension removed. If this path does not have an
+ * the file extension removed. If this path does not have an
* extension, this path is returned.
* null
if the path does not have such a segment.
*
* @param index the 0-based segment index
- * @return the specified segment, or null
+ * @return the specified segment, or null
*/
public String segment(int index);
/**
* Returns the number of segments in this path.
- * null
.
* Path#fromPortableString(String)
+ * Returns a platform-neutral string representation of this path. The
+ * format is not specified, except that the resulting string can be
+ * passed back to the Path#fromPortableString(String)
* constructor to produce the exact same path on any platform.
* Path#fromPortableString(String)
.
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/IProgressMonitor.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IProgressMonitor.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IProgressMonitor.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,16 +4,16 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit IProgressMonitor
interface is implemented
@@ -22,25 +22,25 @@
* beginTask(String, int)
- *
notification is reported, followed by any number and mixture of
- * progress reports (worked()
) and subtask notifications
- * (subTask(String)
). When the task is eventually completed, a
+ * notification is reported, followed by any number and mixture of
+ * progress reports (worked()
) and subtask notifications
+ * (subTask(String)
). When the task is eventually completed, a
* done()
notification is reported. After the done()
* notification, the progress monitor cannot be reused; i.e.,
- * beginTask(String, int)
cannot be called again after the call to
+ * beginTask(String, int) cannot be called again after the call to
* done()
.
* setCanceled
method. Operations taking a progress
* monitor are expected to poll the monitor (using isCanceled
)
- * periodically and abort at their earliest convenience. Operation can however
+ * periodically and abort at their earliest convenience. Operation can however
* choose to ignore cancelation requests.
* UNKNOWN
- * the implementation is free to indicate progress in a way which
+ * the main task is been subdivided. If the value is UNKNOWN
+ * the implementation is free to indicate progress in a way which
* doesn't require the total number of work units in advance.
*/
public void beginTask(String name, int totalWork);
/**
- * Notifies that the work is done; that is, either the main task is completed
- * or the user canceled it. This method may be called more than once
+ * Notifies that the work is done; that is, either the main task is completed
+ * or the user canceled it. This method may be called more than once
* (implementations should be prepared to handle this case).
*/
public void done();
/**
* Internal method to handle scaling correctly. This method
- * must not be called by a client. Clients should
+ * must not be called by a client. Clients should
* always use the method worked(int).
- *
+ *
* @param work the amount of work done
*/
public void internalWorked(double work);
@@ -90,13 +90,13 @@
*
* @return true
if cancellation has been requested,
* and false
otherwise
- * @see #setCanceled(bool)
+ * @see #setCanceled(boolean)
*/
public bool isCanceled();
/**
* Sets the cancel state to the given value.
- *
+ *
* @param value true
indicates that cancelation has
* been requested (but not necessarily acknowledged);
* false
clears this flag
@@ -105,8 +105,8 @@
public void setCanceled(bool value);
/**
- * Sets the task name to the given value. This method is used to
- * restore the task label after a nested operation was executed.
+ * Sets the task name to the given value. This method is used to
+ * restore the task label after a nested operation was executed.
* Normally there is no need for clients to call this method.
*
* @param name the name (or description) of the main task
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/IProgressMonitorWithBlocking.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IProgressMonitorWithBlocking.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IProgressMonitorWithBlocking.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,19 +4,19 @@
* 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:
* IBM - Initial API and implementation
- * Port to the D programming language:
- * Frank Benoit IStatus
object.
* null
if this
* information is not available.
@@ -60,7 +60,7 @@
* Clears the blocked state of the running operation. If a running
* operation ever calls setBlocked
, it must eventually call
* clearBlocked
before the operation completes.
- *
+ *
* @see #setBlocked(IStatus)
*/
public void clearBlocked();
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/ISafeRunnable.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/ISafeRunnable.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/ISafeRunnable.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,16 +4,17 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit run()
)
+ * the body of this runnable (i.e., in run()
)
* @see SafeRunner#run(ISafeRunnable)
*/
- public void handleException(Exception exception);
+ public void handleException(Throwable exception);
/**
* Runs this runnable. Any exceptions thrown from this method will
@@ -46,8 +47,8 @@
* method.
*
* @exception Exception if a problem occurred while running this method.
- * The exception will be processed by handleException
+ * The exception will be processed by handleException
* @see SafeRunner#run(ISafeRunnable)
*/
- public void run();
+ public void run() ;
}
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/IStatus.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IStatus.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/IStatus.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,20 +4,22 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit CoreException
s carry a status object to indicate
- * what went wrong. Status objects are also returned by methods needing
+ * All CoreException
s carry a status object to indicate
+ * what went wrong. Status objects are also returned by methods needing
* to provide details of failures (e.g., validation methods).
* null
if none.
+ * Returns the relevant low-level exception, or null
if none.
* For example, when an operation fails because of a network communications
* failure, this might return the java.io.IOException
* describing the exact nature of that failure.
*
* @return the relevant low-level exception, or null
if none
*/
- public Exception getException();
+ public Throwable getException();
/**
* Returns the message describing the outcome.
@@ -135,7 +137,7 @@
* no children.
* OK
, ERROR
,
+ * @return the severity: one of OK
, ERROR
,
* INFO
, WARNING
, or CANCEL
* @see #matches(int)
*/
@@ -154,7 +156,7 @@
* multi-status objects in a multi-status unaware way.
*
true
for a multi-status,
+ * @return true
for a multi-status,
* false
otherwise
* @see #getChildren()
*/
@@ -178,7 +180,7 @@
* @param severityMask a mask formed by bitwise or'ing severity mask
* constants (ERROR
, WARNING
,
* INFO
, CANCEL
)
- * @return true
if there is at least one match,
+ * @return true
if there is at least one match,
* false
if there are no matches
* @see #getSeverity()
* @see #CANCEL
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/ListenerList.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/ListenerList.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/ListenerList.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,41 +4,42 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit - * A listener list handles the same listener being added + * A listener list handles the same listener being added * multiple times, and tolerates removal of listeners that are the same as other - * listeners in the list. For this purpose, listeners can be compared with each other + * listeners in the list. For this purpose, listeners can be compared with each other * using either equality or identity, as specified in the list constructor. *
*
* Use the getListeners
method when notifying listeners. The recommended
* code sequence for notifying all registered listeners of say,
* FooListener.eventHappened
, is:
- *
+ *
*
* Object[] listeners = myListenerList.getListeners(); * for (int i = 0; i < listeners.length; ++i) { - * ((FooListener) listeners[i]).eventHappened(event); + * ((FooListener) listeners[i]).eventHappened(event); * } *- * + * *
* This class can be used without OSGi running. *
@@ -49,19 +50,19 @@ /** * The empty array singleton instance. */ - private static const Object[] EmptyArray; + private static final Object[] EmptyArray = new Object[0]; /** * Mode constant (value 0) indicating that listeners should be considered * the same if they are equal. */ - public static const int EQUALITY = 0; + public static final int EQUALITY = 0; /** * Mode constant (value 1) indicating that listeners should be considered * the same if they are identical. */ - public static const int IDENTITY = 1; + public static final int IDENTITY = 1; /** * Indicates the comparison mode used to determine if two @@ -72,40 +73,40 @@ /** * The list of listeners. Initially empty but initialized * to an array of size capacity the first time a listener is added. - * Maintains invariant: listeners !is null + * Maintains invariant: listeners != null */ - private Object[] listeners; + private /+volatile+/ Object[] listeners = EmptyArray; /** * Creates a listener list in which listeners are compared using equality. */ public this() { - this(EQUALITY); + thiscast(EQUALITY); } /** * Creates a listener list using the provided comparison mode. - * + * * @param mode The mode used to determine if listeners are the same. */ public this(int mode) { if (mode !is EQUALITY && mode !is IDENTITY) - throw new IllegalArgumentException( null ); + throw new IllegalArgumentException(); this.identity = mode is IDENTITY; } /** * Adds a listener to this list. This method has no effect if the same * listener is already registered. - * + * * @param listener the non-null
listener to add
*/
public synchronized void add(Object listener) {
- // This method is synchronized to protect against multiple threads adding
+ // This method is synchronized to protect against multiple threads adding
// or removing listeners concurrently. This does not block concurrent readers.
if (listener is null)
- throw new IllegalArgumentException( null );
- // check for duplicates
+ throw new IllegalArgumentException();
+ // check for duplicates
final int oldSize = listeners.length;
for (int i = 0; i < oldSize; ++i) {
Object listener2 = listeners[i];
@@ -125,10 +126,10 @@
* The resulting array is unaffected by subsequent adds or removes.
* If there are no listeners registered, the result is an empty array.
* Use this method when notifying listeners, so that any modifications
- * to the listener list during the notification will have no effect on
+ * to the listener list during the notification will have no effect on
* the notification itself.
*
- * Note: Callers of this method must not modify the returned array.
+ * Note: Callers of this method must not modify the returned array.
*
* @return the list of registered listeners
*/
@@ -147,16 +148,16 @@
}
/**
- * Removes a listener from this list. Has no effect if the same
+ * Removes a listener from this list. Has no effect if the same
* listener was not already registered.
*
* @param listener the non-
* This class can be used without OSGi running.
@@ -41,9 +40,9 @@
* @param message a human-readable message, localized to the
* current locale
* @param exception a low-level exception, or
* This class can be used without OSGi running.
@@ -29,7 +30,7 @@
/**
* All serializable objects should have a stable serialVersionUID
*/
- private static const long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
/**
* Creates a new exception.
@@ -40,7 +41,7 @@
/**
* Creates a new exception with the given message.
- *
+ *
* @param message the message for the exception
*/
public this(String message) {
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/Path.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Path.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Path.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,29 +4,27 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit
@@ -40,60 +38,50 @@
*/
public class Path : IPath, Cloneable {
/** masks for separator values */
- private static const int HAS_LEADING = 1;
- private static const int IS_UNC = 2;
- private static const int HAS_TRAILING = 4;
+ private static final int HAS_LEADING = 1;
+ private static final int IS_UNC = 2;
+ private static final int HAS_TRAILING = 4;
- private static const int ALL_SEPARATORS = HAS_LEADING | IS_UNC | HAS_TRAILING;
+ private static final int ALL_SEPARATORS = HAS_LEADING | IS_UNC | HAS_TRAILING;
/** Constant empty string value. */
- private static const String EMPTY_STRING = ""; //$NON-NLS-1$
+ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
/** Constant value indicating no segments */
- private static const String[] NO_SEGMENTS = null;
+ private static final String[] NO_SEGMENTS = new String[0];
/** Constant value containing the empty path with no device. */
- public static const Path EMPTY;
+ public static final Path EMPTY = new Pathcast(EMPTY_STRING);
/** Mask for all bits that are involved in the hash code */
- private static const int HASH_MASK = ~HAS_TRAILING;
+ private static final int HASH_MASK = ~HAS_TRAILING;
/** Constant root path string (
* This class can be used without OSGi running.
@@ -50,7 +50,7 @@
* @param localName the local name string
*/
public this(String qualifier, String localName) {
- Assert.isLegal(localName !is null && localName.length !is 0);
+ Assert.isLegal(localName !is null && localName.length() !is 0);
this.qualifier = qualifier;
this.localName = localName;
}
@@ -67,11 +67,11 @@
* @return
* This class can be used without OSGi running.
@@ -33,19 +34,13 @@
*
* @since 3.0
*/
- public static const IStatus OK_STATUS;
+ public static final IStatus OK_STATUS = new Status(OK, IRuntimeConstants.PI_RUNTIME, OK, LocalizationUtils.safeLocalize("ok"), null); //$NON-NLS-1$
/**
* A standard CANCEL status with no message.
- *
+ *
* @since 3.0
*/
- public static const IStatus CANCEL_STATUS;
-
- static this(){
- OK_STATUS = new Status(OK, IRuntimeConstants.PI_RUNTIME, OK, LocalizationUtils.safeLocalize("ok"), null); //$NON-NLS-1$
- CANCEL_STATUS = new Status(CANCEL, IRuntimeConstants.PI_RUNTIME, 1, "", null); //$NON-NLS-1$
- }
-
+ public static final IStatus CANCEL_STATUS = new Status(CANCEL, IRuntimeConstants.PI_RUNTIME, 1, "", null); //$NON-NLS-1$
/**
* The severity. One of
* A progress monitor that uses a given amount of work ticks from a parent monitor. This is intended as a
- * safer, easier-to-use alternative to SubProgressMonitor. The main benefits of SubMonitor over
+ * A progress monitor that uses a given amount of work ticks from a parent monitor. This is intended as a
+ * safer, easier-to-use alternative to SubProgressMonitor. The main benefits of SubMonitor over
* SubProgressMonitor are: USAGE: When implementing a method that accepts an IProgressMonitor: DEFAULT BEHAVIOR: When writing JavaDoc for a method that accepts an IProgressMonitor, you should assume the
+ *
+ * When writing JavaDoc for a method that accepts an IProgressMonitor, you should assume the
* following default behavior unless the method's JavaDoc says otherwise: BEST PRACTISES: We recommend that newly-written methods follow the given contract: If you wish to follow these conventions, you may copy and paste the following text into your method's JavaDoc: This example demonstrates how the recommended usage of It is never necessary to call done() on a monitor obtained from It is never necessary to call done() on a monitor obtained from Example: Default usage You will often need to implement a method that does not explicitly stipulate that calling done() is the responsibility
* of the caller. In this case, you should use the following pattern: Example: Branches This example demonstrates how to smoothly report progress in situations where some of the work is optional. Please beware of the following anti-pattern: Example: Loops This example demonstrates how to report progress in a loop. This example demonstrates how to report progress in a loop. Example: Infinite progress This example demonstrates how to report logarithmic progress in situations where the number of ticks
* cannot be easily computed in advance.
* This class can be used without OSGi running.
* Converts an unknown (possibly null) IProgressMonitor into a SubMonitor. It is
- * not necessary to call done() on the result, but the caller is responsible for calling
+ * Converts an unknown (possibly null) IProgressMonitor into a SubMonitor. It is
+ * not necessary to call done() on the result, but the caller is responsible for calling
* done() on the argument. Calls beginTask on the argument. This method should generally be called at the beginning of a method that accepts
- * an IProgressMonitor in order to convert the IProgressMonitor into a SubMonitor. This method should generally be called at the beginning of a method that accepts
- * an IProgressMonitor in order to convert the IProgressMonitor into a SubMonitor. This method should generally be called at the beginning of a method that accepts
- * an IProgressMonitor in order to convert the IProgressMonitor into a SubMonitor.null
listener to remove
*/
public synchronized void remove(Object listener) {
- // This method is synchronized to protect against multiple threads adding
+ // This method is synchronized to protect against multiple threads adding
// or removing listeners concurrently. This does not block concurrent readers.
if (listener is null)
- throw new IllegalArgumentException( null );
+ throw new IllegalArgumentException();
int oldSize = listeners.length;
for (int i = 0; i < oldSize; ++i) {
Object listener2 = listeners[i];
@@ -184,7 +185,7 @@
public int size() {
return listeners.length;
}
-
+
/**
* Removes all listeners from this list.
*/
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/MultiStatus.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/MultiStatus.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/MultiStatus.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,23 +4,22 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit null
if not
- * applicable
+ * applicable
*/
- public this(String pluginId, int code, IStatus[] newChildren, String message, Exception exception) {
+ public this(String pluginId, int code, IStatus[] newChildren, String message, Throwable exception) {
this(pluginId, code, message, exception);
Assert.isLegal(newChildren !is null);
int maxSeverity = getSeverity();
@@ -55,7 +54,7 @@
}
this.children = new IStatus[newChildren.length];
setSeverity(maxSeverity);
- SimpleType!(IStatus).arraycopy(newChildren, 0, this.children, 0, newChildren.length);
+ System.arraycopy(newChildren, 0, this.children, 0, newChildren.length);
}
/**
@@ -66,9 +65,9 @@
* @param message a human-readable message, localized to the
* current locale
* @param exception a low-level exception, or null
if not
- * applicable
+ * applicable
*/
- public this(String pluginId, int code, String message, Exception exception) {
+ public this(String pluginId, int code, String message, Throwable exception) {
super(OK, pluginId, code, message, exception);
children = new IStatus[0];
}
@@ -81,7 +80,7 @@
public void add(IStatus status) {
Assert.isLegal(status !is null);
IStatus[] result = new IStatus[children.length + 1];
- SimpleType!(IStatus).arraycopy(children, 0, result, 0, children.length);
+ System.arraycopy(children, 0, result, 0, children.length);
result[result.length - 1] = status;
children = result;
int newSev = status.getSeverity();
@@ -108,23 +107,23 @@
/* (Intentionally not javadoc'd)
* Implements the corresponding method on IStatus
.
*/
- public override IStatus[] getChildren() {
+ public IStatus[] getChildren() {
return children;
}
/* (Intentionally not javadoc'd)
* Implements the corresponding method on IStatus
.
*/
- public override bool isMultiStatus() {
+ public bool isMultiStatus() {
return true;
}
/**
* Merges the given status into this multi-status.
* Equivalent to add(status)
if the
- * given status is not a multi-status.
+ * given status is not a multi-status.
* Equivalent to addAll(status)
if the
- * given status is a multi-status.
+ * given status is a multi-status.
*
* @param status the status to merge into this one
* @see #add(IStatus)
@@ -140,18 +139,17 @@
}
/**
- * Returns a string representation of the status, suitable
+ * Returns a string representation of the status, suitable
* for debugging purposes only.
*/
- public override String toString() {
- tango.text.Text.Text!(char) buf = new tango.text.Text.Text!(char);
- buf.append(super.toString());
+ public String toString() {
+ StringBuffer buf = new StringBuffer(super.toString());
buf.append(" children=["); //$NON-NLS-1$
for (int i = 0; i < children.length; i++) {
if (i !is 0) {
buf.append(" "); //$NON-NLS-1$
}
- buf.append( (cast(Object)children[i]).toString());
+ buf.append(children[i].toString());
}
buf.append("]"); //$NON-NLS-1$
return buf.toString();
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/NullProgressMonitor.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/NullProgressMonitor.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/NullProgressMonitor.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,18 +4,18 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit setCanceled
.
* Subclasses which override this method should
* override setCanceled
as well.
*
* @see IProgressMonitor#isCanceled()
- * @see IProgressMonitor#setCanceled(bool)
+ * @see IProgressMonitor#setCanceled(boolean)
*/
public bool isCanceled() {
return cancelled;
@@ -86,11 +87,11 @@
/**
* This implementation sets the value of an internal state variable.
- * Subclasses which override this method should override
+ * Subclasses which override this method should override
* isCanceled
as well.
*
* @see IProgressMonitor#isCanceled()
- * @see IProgressMonitor#setCanceled(bool)
+ * @see IProgressMonitor#setCanceled(boolean)
*/
public void setCanceled(bool cancelled) {
this.cancelled = cancelled;
@@ -100,7 +101,7 @@
* This implementation does nothing.
* Subclasses may override this method to do something
* with the name of the task.
- *
+ *
* @see IProgressMonitor#setTaskName(String)
*/
public void setTaskName(String name) {
@@ -111,7 +112,7 @@
* This implementation does nothing.
* Subclasses may override this method to do interesting
* processing when a subtask begins.
- *
+ *
* @see IProgressMonitor#subTask(String)
*/
public void subTask(String name) {
@@ -122,7 +123,7 @@
* This implementation does nothing.
* Subclasses may override this method to do interesting
* processing when some work has been completed.
- *
+ *
* @see IProgressMonitor#worked(int)
*/
public void worked(int work) {
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/OperationCanceledException.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/OperationCanceledException.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/OperationCanceledException.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,18 +4,19 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit IPath
interface.
* Paths are always maintained in canonicalized form. That is, parent
- * references (i.e., ../../
) and duplicate separators are
+ * references (i.e., ../../
) and duplicate separators are
* resolved. For example,
- * new Path("/a/b").append("../foo/bar")
+ * (new Path("/a/b")).append("../foo/bar")
* will yield the path
* /a/foo/bar
* "/"
). */
- private static const String ROOT_STRING = "/"; //$NON-NLS-1$
+ private static final String ROOT_STRING = "/"; //$NON-NLS-1$
/** Constant value containing the root path with no device. */
- public static const Path ROOT;
+ public static final Path ROOT = new Pathcast(ROOT_STRING);
/** Constant value indicating if the current platform is Windows */
- version(Windows){
- private static const bool WINDOWS = true;
- }
- else {
- private static const bool WINDOWS = false;
- }
-
- static this(){
- EMPTY = new Path(EMPTY_STRING);
- ROOT = new Path(ROOT_STRING);
- }
+ private static final bool WINDOWS = java.io.File.separatorChar is '\\';
/** The device id string. May be null if there is no device. */
private String device = null;
- //Private implementation note: the segments and separators
- //arrays are never modified, so that they can be shared between
+ //Private implementation note: the segments and separators
+ //arrays are never modified, so that they can be shared between
//path instances
/** The path segments */
- private String[] segments_;
+ private String[] segments;
/** flags indicating separators (has leading, is UNC, has trailing) */
private int separators;
- /**
+ /**
* Constructs a new path from the given string path.
* The string path must represent a valid file system path
- * on the local file system.
+ * on the local file system.
* The path is canonicalized and double slashes are removed
* except at the beginning. (to handle UNC paths). All forward
* slashes ('/') are treated as segment delimiters, and any
@@ -108,7 +96,7 @@
return new Path(pathString);
}
- /**
+ /**
* Constructs a new path from the given path string.
* The path string must have been produced by a previous
* call to IPath.toPortableString
.
@@ -118,22 +106,22 @@
* @since 3.1
*/
public static IPath fromPortableString(String pathString) {
- int firstMatch = pathString.indexOf(DEVICE_SEPARATOR) + 1;
+ int firstMatch = pathString.indexOfcast(DEVICE_SEPARATOR) + 1;
//no extra work required if no device characters
if (firstMatch <= 0)
return (new Path()).initialize(null, pathString);
//if we find a single colon, then the path has a device
String devicePart = null;
- int pathLength = pathString.length;
+ int pathLength = pathString.length();
if (firstMatch is pathLength || pathString.charAt(firstMatch) !is DEVICE_SEPARATOR) {
devicePart = pathString.substring(0, firstMatch);
pathString = pathString.substring(firstMatch, pathLength);
}
//optimize for no colon literals
- if (pathString.indexOf(DEVICE_SEPARATOR) is -1)
+ if (pathString.indexOfcast(DEVICE_SEPARATOR) is -1)
return (new Path()).initialize(devicePart, pathString);
//contract colon literals
- char[] chars = pathString/+.toCharArray()+/;
+ char[] chars = pathString.toCharArray();
int readOffset = 0, writeOffset = 0, length = chars.length;
while (readOffset < length) {
if (chars[readOffset] is DEVICE_SEPARATOR)
@@ -141,7 +129,7 @@
break;
chars[writeOffset++] = chars[readOffset++];
}
- return (new Path()).initialize(devicePart, chars[ 0 .. writeOffset] );
+ return (new Path()).initialize(devicePart, new String(chars, 0, writeOffset));
}
/* (Intentionally not included in javadoc)
@@ -151,10 +139,10 @@
// not allowed
}
- /**
+ /**
* Constructs a new path from the given string path.
* The string path must represent a valid file system path
- * on the local file system.
+ * on the local file system.
* The path is canonicalized and double slashes are removed
* except at the beginning. (to handle UNC paths). All forward
* slashes ('/') are treated as segment delimiters, and any
@@ -170,18 +158,18 @@
//convert backslash to forward slash
fullPath = fullPath.indexOf('\\') is -1 ? fullPath : fullPath.replace('\\', SEPARATOR);
//extract device
- int i = fullPath.indexOf(DEVICE_SEPARATOR);
+ int i = fullPath.indexOfcast(DEVICE_SEPARATOR);
if (i !is -1) {
//remove leading slash from device part to handle output of URL.getFile()
int start = fullPath.charAt(0) is SEPARATOR ? 1 : 0;
devicePart = fullPath.substring(start, i + 1);
- fullPath = fullPath.substring(i + 1, fullPath.length);
+ fullPath = fullPath.substring(i + 1, fullPath.length());
}
}
initialize(devicePart, fullPath);
}
- /**
+ /**
* Constructs a new path from the given device id and string path.
* The given string path must be valid.
* The path is canonicalized and double slashes are removed except
@@ -206,9 +194,9 @@
/* (Intentionally not included in javadoc)
* Private constructor.
*/
- private this(String device, String[] segments_, int _separators) {
- // no segment validations are done for performance reasons
- this.segments_ = segments_;
+ private this(String device, String[] segments, int _separators) {
+ // no segment validations are done for performance reasons
+ this.segments = segments;
this.device = device;
//hash code is cached in all but the bottom three bits of the separators field
this.separators = (computeHashCode() << 3) | (_separators & ALL_SEPARATORS);
@@ -220,10 +208,10 @@
public IPath addFileExtension(String extension) {
if (isRoot() || isEmpty() || hasTrailingSeparator())
return this;
- int len = segments_.length;
+ int len = segments.length;
String[] newSegments = new String[len];
- System.arraycopy(segments_, 0, newSegments, 0, len - 1);
- newSegments[len - 1] = segments_[len - 1] ~ '.' ~ extension;
+ System.arraycopy(segments, 0, newSegments, 0, len - 1);
+ newSegments[len - 1] = segments[len - 1] + '.' + extension;
return new Path(device, newSegments, separators);
}
@@ -236,9 +224,9 @@
}
//XXX workaround, see 1GIGQ9V
if (isEmpty()) {
- return new Path(device, segments_, HAS_LEADING);
+ return new Path(device, segments, HAS_LEADING);
}
- return new Path(device, segments_, separators | HAS_TRAILING);
+ return new Path(device, segments, separators | HAS_TRAILING);
}
/* (Intentionally not included in javadoc)
@@ -255,17 +243,17 @@
return tail.setDevice(device).makeAbsolute().makeUNC(isUNC());
//concatenate the two segment arrays
- int myLen = segments_.length;
+ int myLen = segments.length;
int tailLen = tail.segmentCount();
String[] newSegments = new String[myLen + tailLen];
- System.arraycopy(segments_, 0, newSegments, 0, myLen);
+ System.arraycopy(segments, 0, newSegments, 0, myLen);
for (int i = 0; i < tailLen; i++) {
newSegments[myLen + i] = tail.segment(i);
}
//use my leading separators and the tail's trailing separator
Path result = new Path(device, newSegments, (separators & (HAS_LEADING | IS_UNC)) | (tail.hasTrailingSeparator() ? HAS_TRAILING : 0));
String tailFirstSegment = newSegments[myLen];
- if (tailFirstSegment.equals("..") || tailFirstSegment.equals(".")) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (tailFirstSegment.opEquals("..") || tailFirstSegment.opEquals(".")) { //$NON-NLS-1$ //$NON-NLS-2$
result.canonicalize();
}
return result;
@@ -276,20 +264,20 @@
*/
public IPath append(String tail) {
//optimize addition of a single segment
- if (tail.indexOf(SEPARATOR) is -1 && tail.indexOf("\\") is -1 && tail.indexOf(DEVICE_SEPARATOR) is -1) { //$NON-NLS-1$
- int tailLength = tail.length;
+ if (tail.indexOfcast(SEPARATOR) is -1 && tail.indexOf("\\") is -1 && tail.indexOfcast(DEVICE_SEPARATOR) is -1) { //$NON-NLS-1$
+ int tailLength = tail.length();
if (tailLength < 3) {
//some special cases
- if (tailLength is 0 || ".".equals(tail)) { //$NON-NLS-1$
+ if (tailLength is 0 || ".".opEquals(tail)) { //$NON-NLS-1$
return this;
}
- if ("..".equals(tail)) //$NON-NLS-1$
+ if ("..".opEquals(tail)) //$NON-NLS-1$
return removeLastSegments(1);
}
//just add the segment
- int myLen = segments_.length;
+ int myLen = segments.length;
String[] newSegments = new String[myLen + 1];
- System.arraycopy(segments_, 0, newSegments, 0, myLen);
+ System.arraycopy(segments, 0, newSegments, 0, myLen);
newSegments[myLen] = tail;
return new Path(device, newSegments, separators & ~HAS_TRAILING);
}
@@ -308,13 +296,13 @@
*/
private bool canonicalize() {
//look for segments that need canonicalizing
- for (int i = 0, max = segments_.length; i < max; i++) {
- String segment = segments_[i];
- if (segment.charAt(0) is '.' && (segment.equals("..") || segment.equals("."))) { //$NON-NLS-1$ //$NON-NLS-2$
+ for (int i = 0, max = segments.length; i < max; i++) {
+ String segment = segments[i];
+ if (segment.charAt(0) is '.' && (segment.opEquals("..") || segment.opEquals("."))) { //$NON-NLS-1$ //$NON-NLS-2$
//path needs to be canonicalized
collapseParentReferences();
//paths of length 0 have no trailing separator
- if (segments_.length is 0)
+ if (segments.length is 0)
separators &= (HAS_LEADING | IS_UNC);
//recompute hash because canonicalize affects hash
separators = (separators & ALL_SEPARATORS) | (computeHashCode() << 3);
@@ -327,22 +315,26 @@
/* (Intentionally not included in javadoc)
* Clones this object.
*/
- public Path clone() {
- return new Path(device, segments_, separators);
+ public Object clone() {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ return null;
+ }
}
/**
* Destructively removes all occurrences of ".." segments from this path.
*/
private void collapseParentReferences() {
- int segmentCount = segments_.length;
+ int segmentCount = segments.length;
String[] stack = new String[segmentCount];
int stackPointer = 0;
for (int i = 0; i < segmentCount; i++) {
- String segment = segments_[i];
- if (segment.equals("..")) { //$NON-NLS-1$
+ String segment = segments[i];
+ if (segment.opEquals("..")) { //$NON-NLS-1$
if (stackPointer is 0) {
- // if the stack is empty we are going out of our scope
+ // if the stack is empty we are going out of our scope
// so we need to accumulate segments. But only if the original
// path is relative. If it is absolute then we can't go any higher than
// root so simply toss the .. references.
@@ -350,14 +342,14 @@
stack[stackPointer++] = segment; //stack push
} else {
// if the top is '..' then we are accumulating segments so don't pop
- if ("..".equals(stack[stackPointer - 1])) //$NON-NLS-1$
+ if ("..".opEquals(stack[stackPointer - 1])) //$NON-NLS-1$
stack[stackPointer++] = ".."; //$NON-NLS-1$
else
stackPointer--;
//stack pop
}
//collapse current references
- } else if (!segment.equals(".") || segmentCount is 1) //$NON-NLS-1$
+ } else if (!segment.opEquals(".") || segmentCount is 1) //$NON-NLS-1$
stack[stackPointer++] = segment; //stack push
}
//if the number of segments hasn't changed, then no modification needed
@@ -366,7 +358,7 @@
//build the new segment array backwards by popping the stack
String[] newSegments = new String[stackPointer];
System.arraycopy(stack, 0, newSegments, 0, stackPointer);
- this.segments_ = newSegments;
+ this.segments = newSegments;
}
/**
@@ -374,7 +366,7 @@
* of leading double slash which represents a UNC path.
*/
private String collapseSlashes(String path) {
- int length = path.length;
+ int length = path.length();
// if the path is only 0, 1 or 2 chars long then it could not possibly have illegal
// duplicate slashes.
if (length < 3)
@@ -384,10 +376,10 @@
if (path.indexOf("//", 1) is -1) //$NON-NLS-1$
return path;
// We found an occurrence of // in the path so do the slow collapse.
- char[] result = new char[path.length];
+ char[] result = new char[path.length()];
int count = 0;
bool hasPrevious = false;
- char[] characters = path/+.toCharArray()+/;
+ char[] characters = path.toCharArray();
for (int index = 0; index < characters.length; index++) {
char c = characters[index];
if (c is SEPARATOR) {
@@ -409,18 +401,18 @@
count++;
}
}
- return result[ 0 .. count];
+ return new String(result, 0, count);
}
/* (Intentionally not included in javadoc)
* Computes the hash code for this object.
*/
private int computeHashCode() {
- int hash = device.length is 0 ? 17 : java.lang.all.toHash(device);
- int segmentCount = segments_.length;
+ int hash = device is null ? 17 : device.toHash();
+ int segmentCount = segments.length;
for (int i = 0; i < segmentCount; i++) {
//this function tends to given a fairly even distribution
- hash = hash * 37 + java.lang.all.toHash(segments_[i]);
+ hash = hash * 37 + segments[i].toHash();
}
return hash;
}
@@ -431,16 +423,16 @@
private int computeLength() {
int length = 0;
if (device !is null)
- length += device.length;
+ length += device.length();
if ((separators & HAS_LEADING) !is 0)
length++;
if ((separators & IS_UNC) !is 0)
length++;
//add the segment lengths
- int max = segments_.length;
+ int max = segments.length;
if (max > 0) {
for (int i = 0; i < max; i++) {
- length += segments_[i].length;
+ length += segments[i].length();
}
//add the separator lengths
length += max - 1;
@@ -454,7 +446,7 @@
* Returns the number of segments in the given path
*/
private int computeSegmentCount(String path) {
- int len = path.length;
+ int len = path.length();
if (len is 0 || (len is 1 && path.charAt(0) is SEPARATOR)) {
return 0;
}
@@ -482,14 +474,14 @@
if (segmentCount is 0)
return NO_SEGMENTS;
String[] newSegments = new String[segmentCount];
- int len = path.length;
+ int len = path.length();
// check for initial slash
int firstPosition = (path.charAt(0) is SEPARATOR) ? 1 : 0;
// check for UNC
if (firstPosition is 1 && len > 1 && (path.charAt(1) is SEPARATOR))
firstPosition = 2;
int lastPosition = (path.charAt(len - 1) !is SEPARATOR) ? len - 1 : len - 2;
- // for non-empty paths, the number of segments is
+ // for non-empty paths, the number of segments is
// the number of slashes plus 1, ignoring any leading
// and trailing slashes
int next = firstPosition;
@@ -511,38 +503,38 @@
* the given string buffer. This escapes literal colon characters with double colons.
*/
private void encodeSegment(String string, StringBuffer buf) {
- int len = string.length;
+ int len = string.length();
for (int i = 0; i < len; i++) {
char c = string.charAt(i);
buf.append(c);
if (c is DEVICE_SEPARATOR)
- buf.append(DEVICE_SEPARATOR);
+ buf.appendcast(DEVICE_SEPARATOR);
}
}
/* (Intentionally not included in javadoc)
* Compares objects for equality.
*/
- public override int opEquals(Object obj) {
+ public override equals_t opEquals(Object obj) {
if (this is obj)
return true;
- if (!(cast(Path)obj))
+ if (!( null !is cast(Path)obj ))
return false;
Path target = cast(Path) obj;
//check leading separators and hash code
if ((separators & HASH_MASK) !is (target.separators & HASH_MASK))
return false;
- String[] targetSegments = target.segments_;
- int i = segments_.length;
+ String[] targetSegments = target.segments;
+ int i = segments.length;
//check segment count
if (i !is targetSegments.length)
return false;
//check segments in reverse order - later segments more likely to differ
while (--i >= 0)
- if (!segments_[i].equals(targetSegments[i]))
+ if (!segments[i].opEquals(targetSegments[i]))
return false;
//check device last (least likely to differ)
- return device is target.device || (device !is null && device.equals(target.device));
+ return device is target.device || (device !is null && device.opEquals(target.device));
}
/* (Intentionally not included in javadoc)
@@ -588,11 +580,11 @@
* Initialize the current path with the given string.
*/
private IPath initialize(String deviceString, String path) {
- //Assert.isNotNull(path); // allow for SWT
+ Assert.isNotNull(path);
this.device = deviceString;
path = collapseSlashes(path);
- int len = path.length;
+ int len = path.length();
//compute the separators array
if (len < 2) {
@@ -613,7 +605,7 @@
separators |= HAS_TRAILING;
}
//compute segments and ensure canonical form
- segments_ = computeSegments(path);
+ segments = computeSegments(path);
if (!canonicalize()) {
//compute hash now because canonicalize didn't need to do it
separators = (separators & ALL_SEPARATORS) | (computeHashCode() << 3);
@@ -634,7 +626,7 @@
*/
public bool isEmpty() {
//true if no segments and no leading prefix
- return segments_.length is 0 && ((separators & ALL_SEPARATORS) !is HAS_LEADING);
+ return segments.length is 0 && ((separators & ALL_SEPARATORS) !is HAS_LEADING);
}
@@ -654,12 +646,12 @@
if (isEmpty() || (isRoot() && anotherPath.isAbsolute())) {
return true;
}
- int len = segments_.length;
+ int len = segments.length;
if (len > anotherPath.segmentCount()) {
return false;
}
for (int i = 0; i < len; i++) {
- if (!segments_[i].equals(anotherPath.segment(i)))
+ if (!segments[i].opEquals(anotherPath.segment(i)))
return false;
}
return true;
@@ -670,7 +662,7 @@
*/
public bool isRoot() {
//must have no segments, a leading separator, and not be a UNC path.
- return this is ROOT || (segments_.length is 0 && ((separators & ALL_SEPARATORS) is HAS_LEADING));
+ return this is ROOT || (segments.length is 0 && ((separators & ALL_SEPARATORS) is HAS_LEADING));
}
/* (Intentionally not included in javadoc)
@@ -697,7 +689,7 @@
* @see IPath#isValidSegment(String)
*/
public bool isValidSegment(String segment) {
- int size = segment.length;
+ int size = segment.length();
if (size is 0)
return false;
for (int i = 0; i < size; i++) {
@@ -714,8 +706,8 @@
* @see IPath#lastSegment()
*/
public String lastSegment() {
- int len = segments_.length;
- return len is 0 ? null : segments_[len - 1];
+ int len = segments.length;
+ return len is 0 ? null : segments[len - 1];
}
/* (Intentionally not included in javadoc)
@@ -725,11 +717,11 @@
if (isAbsolute()) {
return this;
}
- Path result = new Path(device, segments_, separators | HAS_LEADING);
+ Path result = new Path(device, segments, separators | HAS_LEADING);
//may need canonicalizing if it has leading ".." or "." segments
if (result.segmentCount() > 0) {
String first = result.segment(0);
- if (first.equals("..") || first.equals(".")) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (first.opEquals("..") || first.opEquals(".")) { //$NON-NLS-1$ //$NON-NLS-2$
result.canonicalize();
}
}
@@ -743,11 +735,11 @@
if (!isAbsolute()) {
return this;
}
- return new Path(device, segments_, separators & HAS_TRAILING);
+ return new Path(device, segments, separators & HAS_TRAILING);
}
/* (Intentionally not included in javadoc)
- * @see IPath#makeUNC(bool)
+ * @see IPath#makeUNC(boolean)
*/
public IPath makeUNC(bool toUNC) {
// if we are already in the right form then just return
@@ -761,19 +753,19 @@
//mask out the UNC bit
newSeparators &= HAS_LEADING | HAS_TRAILING;
}
- return new Path(toUNC ? null : device, segments_, newSeparators);
+ return new Path(toUNC ? null : device, segments, newSeparators);
}
/* (Intentionally not included in javadoc)
* @see IPath#matchingFirstSegments(IPath)
*/
public int matchingFirstSegments(IPath anotherPath) {
- Assert.isNotNull( cast(Object) anotherPath);
+ Assert.isNotNull(anotherPath);
int anotherPathLen = anotherPath.segmentCount();
- int max = Math.min(segments_.length, anotherPathLen);
+ int max = Math.min(segments.length, anotherPathLen);
int count = 0;
for (int i = 0; i < max; i++) {
- if (!segments_[i].equals(anotherPath.segment(i))) {
+ if (!segments[i].opEquals(anotherPath.segment(i))) {
return count;
}
count++;
@@ -786,7 +778,7 @@
*/
public IPath removeFileExtension() {
String extension = getFileExtension();
- if (extension is null || extension.equals("")) { //$NON-NLS-1$
+ if (extension is null || extension.opEquals("")) { //$NON-NLS-1$
return this;
}
String lastSegment = lastSegment();
@@ -800,13 +792,13 @@
public IPath removeFirstSegments(int count) {
if (count is 0)
return this;
- if (count >= segments_.length) {
+ if (count >= segments.length) {
return new Path(device, NO_SEGMENTS, 0);
}
Assert.isLegal(count > 0);
- int newSize = segments_.length - count;
+ int newSize = segments.length - count;
String[] newSegments = new String[newSize];
- System.arraycopy(this.segments_, count, newSegments, 0, newSize);
+ System.arraycopy(this.segments, count, newSegments, 0, newSize);
//result is always a relative path
return new Path(device, newSegments, separators & HAS_TRAILING);
@@ -818,14 +810,14 @@
public IPath removeLastSegments(int count) {
if (count is 0)
return this;
- if (count >= segments_.length) {
+ if (count >= segments.length) {
//result will have no trailing separator
return new Path(device, NO_SEGMENTS, separators & (HAS_LEADING | IS_UNC));
}
Assert.isLegal(count > 0);
- int newSize = segments_.length - count;
+ int newSize = segments.length - count;
String[] newSegments = new String[newSize];
- System.arraycopy(this.segments_, 0, newSegments, 0, newSize);
+ System.arraycopy(this.segments, 0, newSegments, 0, newSize);
return new Path(device, newSegments, separators);
}
@@ -836,31 +828,31 @@
if (!hasTrailingSeparator()) {
return this;
}
- return new Path(device, segments_, separators & (HAS_LEADING | IS_UNC));
+ return new Path(device, segments, separators & (HAS_LEADING | IS_UNC));
}
/* (Intentionally not included in javadoc)
* @see IPath#segment(int)
*/
public String segment(int index) {
- if (index >= segments_.length)
+ if (index >= segments.length)
return null;
- return segments_[index];
+ return segments[index];
}
/* (Intentionally not included in javadoc)
* @see IPath#segmentCount()
*/
public int segmentCount() {
- return segments_.length;
+ return segments.length;
}
/* (Intentionally not included in javadoc)
* @see IPath#segments()
*/
public String[] segments() {
- String[] segmentCopy = new String[](segments_.length);
- System.arraycopy(segments_, 0, segmentCopy, 0, segments_.length);
+ String[] segmentCopy = new String[segments.length];
+ System.arraycopy(segments, 0, segmentCopy, 0, segments.length);
return segmentCopy;
}
@@ -869,20 +861,20 @@
*/
public IPath setDevice(String value) {
if (value !is null) {
- Assert.isTrue(value.indexOf(IPath.DEVICE_SEPARATOR) is (value.length - 1), "Last character should be the device separator"); //$NON-NLS-1$
+ Assert.isTrue(value.indexOfcast(IPath.DEVICE_SEPARATOR) is (value.length() - 1), "Last character should be the device separator"); //$NON-NLS-1$
}
//return the receiver if the device is the same
- if (value is device || (value !is null && value.equals(device)))
+ if (value is device || (value !is null && value.opEquals(device)))
return this;
- return new Path(value, segments_, separators);
+ return new Path(value, segments, separators);
}
/* (Intentionally not included in javadoc)
* @see IPath#toFile()
*/
- public FilePath toFile() {
- return new FilePath(tango.io.Path.standard(toOSString()));
+ public File toFile() {
+ return new File(toOSString());
}
/* (Intentionally not included in javadoc)
@@ -894,11 +886,11 @@
int resultSize = computeLength();
if (resultSize <= 0)
return EMPTY_STRING;
- char FILE_SEPARATOR = FileConst.PathSeparatorChar;
+ char FILE_SEPARATOR = File.separatorChar;
char[] result = new char[resultSize];
int offset = 0;
if (device !is null) {
- int size = device.length;
+ int size = device.length();
device.getChars(0, size, result, offset);
offset += size;
}
@@ -906,23 +898,23 @@
result[offset++] = FILE_SEPARATOR;
if ((separators & IS_UNC) !is 0)
result[offset++] = FILE_SEPARATOR;
- int len = segments_.length - 1;
+ int len = segments.length - 1;
if (len >= 0) {
//append all but the last segment, with separators
for (int i = 0; i < len; i++) {
- int size = segments_[i].length;
- segments_[i].getChars(0, size, result, offset);
+ int size = segments[i].length();
+ segments[i].getChars(0, size, result, offset);
offset += size;
result[offset++] = FILE_SEPARATOR;
}
//append the last segment
- int size = segments_[len].length;
- segments_[len].getChars(0, size, result, offset);
+ int size = segments[len].length();
+ segments[len].getChars(0, size, result, offset);
offset += size;
}
if ((separators & HAS_TRAILING) !is 0)
result[offset++] = FILE_SEPARATOR;
- return result;
+ return new String(result);
}
/* (Intentionally not included in javadoc)
@@ -936,18 +928,18 @@
if (device !is null)
result.append(device);
if ((separators & HAS_LEADING) !is 0)
- result.append(SEPARATOR);
+ result.appendcast(SEPARATOR);
if ((separators & IS_UNC) !is 0)
- result.append(SEPARATOR);
- int len = segments_.length;
+ result.appendcast(SEPARATOR);
+ int len = segments.length;
//append all segments with separators
for (int i = 0; i < len; i++) {
- if (segments_[i].indexOf(DEVICE_SEPARATOR) >= 0)
- encodeSegment(segments_[i], result);
+ if (segments[i].indexOfcast(DEVICE_SEPARATOR) >= 0)
+ encodeSegment(segments[i], result);
else
- result.append(segments_[i]);
+ result.append(segments[i]);
if (i < len - 1 || (separators & HAS_TRAILING) !is 0)
- result.append(SEPARATOR);
+ result.appendcast(SEPARATOR);
}
return result.toString();
}
@@ -955,14 +947,14 @@
/* (Intentionally not included in javadoc)
* @see IPath#toString()
*/
- public override String toString() {
+ public String toString() {
int resultSize = computeLength();
if (resultSize <= 0)
return EMPTY_STRING;
char[] result = new char[resultSize];
int offset = 0;
if (device !is null) {
- int size = device.length;
+ int size = device.length();
device.getChars(0, size, result, offset);
offset += size;
}
@@ -970,23 +962,23 @@
result[offset++] = SEPARATOR;
if ((separators & IS_UNC) !is 0)
result[offset++] = SEPARATOR;
- int len = segments_.length - 1;
+ int len = segments.length - 1;
if (len >= 0) {
//append all but the last segment, with separators
for (int i = 0; i < len; i++) {
- int size = segments_[i].length;
- segments_[i].getChars(0, size, result, offset);
+ int size = segments[i].length();
+ segments[i].getChars(0, size, result, offset);
offset += size;
result[offset++] = SEPARATOR;
}
//append the last segment
- int size = segments_[len].length;
- segments_[len].getChars(0, size, result, offset);
+ int size = segments[len].length();
+ segments[len].getChars(0, size, result, offset);
offset += size;
}
if ((separators & HAS_TRAILING) !is 0)
result[offset++] = SEPARATOR;
- return result;
+ return new String(result);
}
/* (Intentionally not included in javadoc)
@@ -995,11 +987,11 @@
public IPath uptoSegment(int count) {
if (count is 0)
return new Path(device, NO_SEGMENTS, separators & (HAS_LEADING | IS_UNC));
- if (count >= segments_.length)
+ if (count >= segments.length)
return this;
Assert.isTrue(count > 0, "Invalid parameter to Path.uptoSegment"); //$NON-NLS-1$
String[] newSegments = new String[count];
- System.arraycopy(segments_, 0, newSegments, 0, count);
+ System.arraycopy(segments, 0, newSegments, 0, count);
return new Path(device, newSegments, separators);
}
-}
+}
\ No newline at end of file
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/PlatformObject.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/PlatformObject.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/PlatformObject.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,18 +4,19 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit IAdaptable
@@ -29,7 +30,7 @@
* of the {@link IAdapterManager} service. The method would look like:
*
* public Object getAdapter(Class adapter) {
- * IAdapterManager manager = ...;//lookup the IAdapterManager service
+ * IAdapterManager manager = ...;//lookup the IAdapterManager service
* return manager.getAdapter(this, adapter);
* }
*
@@ -47,7 +48,7 @@
* Constructs a new platform object.
*/
public this() {
-// super();
+ super();
}
/**
@@ -67,9 +68,7 @@
* @return the adapted object or null
* @see IAdaptable#getAdapter(Class)
*/
- public Object getAdapter(ClassInfo adapter) {
- implMissing( __FILE__, __LINE__ );
- return null;
-// return AdapterManager.getDefault().getAdapter(this, adapter);
+ public Object getAdapter(Class adapter) {
+ return AdapterManager.getDefault().getAdapter(this, adapter);
}
}
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/ProgressMonitorWrapper.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/ProgressMonitorWrapper.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/ProgressMonitorWrapper.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,21 +4,21 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit IProgressMonitor
@@ -34,17 +34,17 @@
/** The wrapped progress monitor. */
private IProgressMonitor progressMonitor;
- /**
+ /**
* Creates a new wrapper around the given monitor.
*
* @param monitor the progress monitor to forward to
*/
protected this(IProgressMonitor monitor) {
- Assert.isNotNull(cast(Object)monitor);
+ Assert.isNotNull(monitor);
progressMonitor = monitor;
}
- /**
+ /**
* This implementation of a IProgressMonitor
* method forwards to the wrapped progress monitor.
* Clients may override this method to do additional
@@ -66,8 +66,8 @@
* @since 3.0
*/
public void clearBlocked() {
- if ( auto mon = cast(IProgressMonitorWithBlocking)progressMonitor )
- mon.clearBlocked();
+ if ( null !is cast(IProgressMonitorWithBlocking)progressMonitor )
+ (cast(IProgressMonitorWithBlocking) progressMonitor).clearBlocked();
}
/**
@@ -125,8 +125,8 @@
* @since 3.0
*/
public void setBlocked(IStatus reason) {
- if ( auto mon = cast(IProgressMonitorWithBlocking)progressMonitor)
- mon.setBlocked(reason);
+ if ( null !is cast(IProgressMonitorWithBlocking)progressMonitor )
+ (cast(IProgressMonitorWithBlocking) progressMonitor).setBlocked(reason);
}
/**
@@ -135,7 +135,7 @@
* Clients may override this method to do additional
* processing.
*
- * @see IProgressMonitor#setCanceled(bool)
+ * @see IProgressMonitor#setCanceled(boolean)
*/
public void setCanceled(bool b) {
progressMonitor.setCanceled(b);
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/QualifiedName.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/QualifiedName.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/QualifiedName.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,23 +4,23 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit null
if
- * the default name space is being used. The empty string is not
+ * the default name space is being used. The empty string is not
* a valid local name.
* true
if these are equivalent qualified
* names, and false
otherwise
*/
- public override int opEquals(Object obj) {
+ public override equals_t opEquals(Object obj) {
if (obj is this) {
return true;
}
- if (!(cast(QualifiedName)obj )) {
+ if (!( null !is cast(QualifiedName)obj )) {
return false;
}
QualifiedName qName = cast(QualifiedName) obj;
@@ -79,10 +79,10 @@
if (qualifier is null && qName.getQualifier() !is null) {
return false;
}
- if (qualifier !is null && !qualifier.equals(qName.getQualifier())) {
+ if (qualifier !is null && !qualifier.opEquals(qName.getQualifier())) {
return false;
}
- return localName.equals(qName.getLocalName());
+ return localName.opEquals(qName.getLocalName());
}
/**
@@ -106,18 +106,18 @@
/* (Intentionally omitted from javadoc)
* Implements the method Object.hashCode
.
- *
+ *
* Returns the hash code for this qualified name.
*/
public override hash_t toHash() {
- return (qualifier is null ? 0 : .toHash(qualifier)) + .toHash(localName);
+ return (qualifier is null ? 0 : qualifier.toHash()) + localName.toHash();
}
/**
- * Converts this qualified name into a string, suitable for
+ * Converts this qualified name into a string, suitable for
* debug purposes only.
*/
- public override String toString() {
- return (getQualifier() is null ? "" : getQualifier() ~ ':') ~ getLocalName(); //$NON-NLS-1$
+ public String toString() {
+ return (getQualifier() is null ? "" : getQualifier() + ':') + getLocalName(); //$NON-NLS-1$
}
}
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/SafeRunner.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/SafeRunner.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/SafeRunner.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,27 +4,30 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit
@@ -72,25 +67,25 @@
/** Wrapped exception, or
null
if none.
*/
- private Exception exception = null;
+ private Throwable exception = null;
/** Constant to avoid generating garbage.
*/
- private static const IStatus[] theEmptyStatusArray = null;
+ private static final IStatus[] theEmptyStatusArray = new IStatus[0];
/**
* Creates a new status object. The created status has no children.
*
- * @param severity the severity; one of OK
, ERROR
,
+ * @param severity the severity; one of OK
, ERROR
,
* INFO
, WARNING
, or CANCEL
* @param pluginId the unique identifier of the relevant plug-in
* @param code the plug-in-specific status code, or OK
* @param message a human-readable message, localized to the
* current locale
* @param exception a low-level exception, or null
if not
- * applicable
+ * applicable
*/
- public this(int severity, String pluginId, int code, String message, Exception exception) {
+ public this(int severity, String pluginId, int code, String message, Throwable exception) {
setSeverity(severity);
setPlugin(pluginId);
setCode(code);
@@ -102,41 +97,41 @@
* Simplified constructor of a new status object; assumes that code is OK
.
* The created status has no children.
*
- * @param severity the severity; one of OK
, ERROR
,
+ * @param severity the severity; one of OK
, ERROR
,
* INFO
, WARNING
, or CANCEL
* @param pluginId the unique identifier of the relevant plug-in
* @param message a human-readable message, localized to the
* current locale
* @param exception a low-level exception, or null
if not
* applicable
- *
+ *
* @since org.eclipse.equinox.common 3.3
*/
- public this(int severity, String pluginId, String message, Exception exception) {
+ public this(int severity, String pluginId, String message, Throwable exception) {
setSeverity(severity);
setPlugin(pluginId);
setMessage(message);
setException(exception);
- setCode(OK);
+ setCodecast(OK);
}
/**
* Simplified constructor of a new status object; assumes that code is OK
and
* exception is null
. The created status has no children.
*
- * @param severity the severity; one of OK
, ERROR
,
+ * @param severity the severity; one of OK
, ERROR
,
* INFO
, WARNING
, or CANCEL
* @param pluginId the unique identifier of the relevant plug-in
* @param message a human-readable message, localized to the
* current locale
- *
+ *
* @since org.eclipse.equinox.common 3.3
*/
public this(int severity, String pluginId, String message) {
setSeverity(severity);
setPlugin(pluginId);
setMessage(message);
- setCode(OK);
+ setCodecast(OK);
setException(null);
}
@@ -157,7 +152,7 @@
/* (Intentionally not javadoc'd)
* Implements the corresponding method on IStatus
.
*/
- public Exception getException() {
+ public Throwable getException() {
return exception;
}
@@ -216,9 +211,9 @@
* Sets the exception.
*
* @param exception a low-level exception, or null
if not
- * applicable
+ * applicable
*/
- protected void setException(Exception exception) {
+ protected void setException(Throwable exception) {
this.exception = exception;
}
@@ -242,14 +237,14 @@
* @param pluginId the unique identifier of the relevant plug-in
*/
protected void setPlugin(String pluginId) {
- Assert.isLegal(pluginId !is null && pluginId.length > 0);
+ Assert.isLegal(pluginId !is null && pluginId.length() > 0);
this.pluginId = pluginId;
}
/**
* Sets the severity.
*
- * @param severity the severity; one of OK
, ERROR
,
+ * @param severity the severity; one of OK
, ERROR
,
* INFO
, WARNING
, or CANCEL
*/
protected void setSeverity(int severity) {
@@ -258,24 +253,34 @@
}
/**
- * Returns a string representation of the status, suitable
+ * Returns a string representation of the status, suitable
* for debugging purposes only.
*/
- public override String toString() {
- String sev;
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("Status "); //$NON-NLS-1$
if (severity is OK) {
- sev="OK"; //$NON-NLS-1$
+ buf.append("OK"); //$NON-NLS-1$
} else if (severity is ERROR) {
- sev="ERROR"; //$NON-NLS-1$
+ buf.append("ERROR"); //$NON-NLS-1$
} else if (severity is WARNING) {
- sev="WARNING"; //$NON-NLS-1$
+ buf.append("WARNING"); //$NON-NLS-1$
} else if (severity is INFO) {
- sev="INFO"; //$NON-NLS-1$
+ buf.append("INFO"); //$NON-NLS-1$
} else if (severity is CANCEL) {
- sev="CANCEL"; //$NON-NLS-1$
+ buf.append("CANCEL"); //$NON-NLS-1$
} else {
- sev=Format( "severity={}", severity);
+ buf.append("severity="); //$NON-NLS-1$
+ buf.append(severity);
}
- return Format("Status {}: {} code={} {} {}", sev, pluginId, code, message, exception.toString );
+ buf.append(": "); //$NON-NLS-1$
+ buf.append(pluginId);
+ buf.append(" code="); //$NON-NLS-1$
+ buf.append(code);
+ buf.append(' ');
+ buf.append(message);
+ buf.append(' ');
+ buf.append(exception);
+ return buf.toString();
}
}
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/SubMonitor.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/SubMonitor.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/SubMonitor.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,52 +4,52 @@
* 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:
* Stefan Xenos - initial API and implementation
- * Stefan Xenos - bug 174539 - add a 1-argument convert(...) method
+ * Stefan Xenos - bug 174539 - add a 1-argument convert(...) method
* Stefan Xenos - bug 174040 - SubMonitor#convert doesn't always set task name
* Stefan Xenos - bug 206942 - updated javadoc to recommend better constants for infinite progress
- * Port to the D programming language:
- * Frank Benoit
*
*
*
- *
*
* SubMonitor.convert(...).
to convert the IProgressMonitor
+ * SubMonitor.convert(...).
to convert the IProgressMonitor
* into a SubMonitor. SubMonitor.newChild(...)
whenever you need to call another method that
+ * SubMonitor.newChild(...)
whenever you need to call another method that
* accepts an IProgressMonitor.
*
*
*
*
* @param monitor the progress monitor to use for reporting progress to the user. It is the caller's responsibility
* to call done() on the given monitor. Accepts
@@ -76,121 +76,121 @@
*
* null
, indicating that no progress should be
* reported and that the operation cannot be cancelled.SubMonitor
makes it unnecessary to call
* IProgressMonitor.done() in most situations.convert
or progress.newChild()
.
- * In this example, there is no guarantee that monitor
is an instance of SubMonitor
, making it
- * necessary to call monitor.done()
. The JavaDoc contract makes this the responsibility of the caller.convert
or progress.newChild()
.
+ * In this example, there is no guarantee that monitor
is an instance of SubMonitor
, making it
+ * necessary to call monitor.done()
. The JavaDoc contract makes this the responsibility of the caller.
* // param monitor the progress monitor to use for reporting progress to the user. It is the caller's responsibility
* // to call done() on the given monitor. Accepts
*
*
*
* null
, indicating that no progress should be
* // reported and that the operation cannot be cancelled.
* //
* void doSomething(IProgressMonitor monitor) {
- * // Convert the given monitor into a progress instance
+ * // Convert the given monitor into a progress instance
* SubMonitor progress = SubMonitor.convert(monitor, 100);
- *
+ *
* // Use 30% of the progress to do some work
* doSomeWork(progress.newChild(30));
- *
+ *
* // Advance the monitor by another 30%
* progress.worked(30);
- *
+ *
* // Use the remaining 40% of the progress to do some more work
- * doSomeWork(progress.newChild(40));
+ * doSomeWork(progress.newChild(40));
* }
*
* // param monitor the progress monitor to use for reporting progress to the user, or
- *
+ *
*
* null
indicating
* // that no progress should be reported and the operation cannot be cancelled.
* //
* void doSomething(IProgressMonitor monitor) {
- * // Convert the given monitor into a progress instance
+ * // Convert the given monitor into a progress instance
* SubMonitor progress = SubMonitor.convert(monitor, 100);
* try {
* // Use 30% of the progress to do some work
* doSomeWork(progress.newChild(30));
- *
+ *
* // Advance the monitor by another 30%
* progress.worked(30);
- *
+ *
* // Use the remaining 40% of the progress to do some more work
* doSomeWork(progress.newChild(40));
- *
+ *
* } finally {
- * if (monitor !is null) {
- * monitor.done();
+ * if (monitor != null) {
+ * monitor.done();
* }
- * }
+ * }
* }
*
* void doSomething(IProgressMonitor monitor) {
* SubMonitor progress = SubMonitor.convert(monitor, 100);
- *
+ *
* if (condition) {
* // Use 50% of the progress to do some work
- * doSomeWork(progress.newChild(50));
+ * doSomeWork(progress.newChild(50));
* }
- *
+ *
* // Don't report any work, but ensure that we have 50 ticks remaining on the progress monitor.
* // If we already consumed 50 ticks in the above branch, this is a no-op. Otherwise, the remaining
* // space in the monitor is redistributed into 50 ticks.
- *
+ *
* progress.setWorkRemaining(50);
- *
+ *
* // Use the remainder of the progress monitor to do the rest of the work
- * doSomeWork(progress.newChild(50));
+ * doSomeWork(progress.newChild(50));
* }
*
- *
+ *
*
* if (condition) {
* // Use 50% of the progress to do some work
- * doSomeWork(progress.newChild(50));
+ * doSomeWork(progress.newChild(50));
* } else {
* // Bad: Causes the progress monitor to appear to start at 50%, wasting half of the
* // space in the monitor.
* progress.worked(50);
* }
*
- *
- *
+ *
+ *
*
*
* void doSomething(IProgressMonitor monitor, Collection someCollection) {
* SubMonitor progress = SubMonitor.convert(monitor, 100);
*
* // Create a new progress monitor that uses 70% of the total progress and will allocate one tick
- * // for each element of the given collection.
+ * // for each element of the given collection.
* SubMonitor loopProgress = progress.newChild(70).setWorkRemaining(someCollection.size());
- *
+ *
* for (Iterator iter = someCollection.iterator(); iter.hasNext();) {
- * Object next = iter.next();
- *
+ * Object next = iter.next();
+ *
* doWorkOnElement(next, loopProgress.newChild(1));
* }
- *
+ *
* // Use the remaining 30% of the progress monitor to do some work outside the loop
* doSomeWork(progress.newChild(30));
* }
@@ -199,30 +199,30 @@
*
*
*
+ *
*
* void doSomething(IProgressMonitor monitor, LinkedListNode node) {
* SubMonitor progress = SubMonitor.convert(monitor);
*
- * while (node !is null) {
+ * while (node !is null) {
* // Regardless of the amount of progress reported so far,
* // use 0.01% of the space remaining in the monitor to process the next node.
* progress.setWorkRemaining(10000);
- *
- * doWorkOnElement(node, progress.newChild(1));
+ *
+ * doWorkOnElement(node, progress.newChild(1));
*
* node = node.next;
* }
* }
- *
- *
+ * NullProgressMonitor
.
* @return a SubMonitor instance that adapts the argument
@@ -418,10 +418,10 @@
* with the given number of ticks. It is not necessary to call done() on the result,
* but the caller is responsible for calling done() on the argument. Calls beginTask
* on the argument.NullProgressMonitor
.
* @param work number of ticks that will be available in the resulting monitor
@@ -436,13 +436,13 @@
* with the given number of ticks. It is not necessary to call done() on the result,
* but the caller is responsible for calling done() on the argument. Calls beginTask
* on the argument.
Sets the work remaining for this SubMonitor instance. This is the total number * of ticks that may be reported by all subsequent calls to worked(int), newChild(int), etc. - * This may be called many times for the same SubMonitor instance. When this method - * is called, the remaining space on the progress monitor is redistributed into the given + * This may be called many times for the same SubMonitor instance. When this method + * is called, the remaining space on the progress monitor is redistributed into the given * number of ticks.
- * + * *It doesn't matter how much progress has already been reported with this SubMonitor - * instance. If you call setWorkRemaining(100), you will be able to report 100 more ticks of + * instance. If you call setWorkRemaining(100), you will be able to report 100 more ticks of * work before the progress meter reaches 100%.
- * + * * @param workRemaining total number of remaining ticks * @return the receiver */ @@ -481,10 +481,10 @@ // Ensure we don't cause division by zero if (totalForChildren > 0 && totalParent > usedForParent) { // Note: We want the following value to remain invariant after this method returns - double remainForParent = totalParent * (1.0 - (usedForChildren / totalForChildren)); - usedForChildren = (workRemaining * (1.0 - remainForParent / (totalParent - usedForParent))); + double remainForParent = totalParent * (1.0d - (usedForChildren / totalForChildren)); + usedForChildren = (workRemaining * (1.0d - remainForParent / (totalParent - usedForParent))); } else - usedForChildren = 0.0; + usedForChildren = 0.0d; totalParent = totalParent - usedForParent; usedForParent = 0; @@ -493,9 +493,9 @@ } /** - * Consumes the given number of child ticks, given as a double. Must only + * Consumes the given number of child ticks, given as a double. Must only * be called if the monitor is in floating-point mode. - * + * * @param ticks the number of ticks to consume * @return ticks the number of ticks to be consumed from parent */ @@ -535,15 +535,15 @@ /** * Starts a new main task. The string argument is ignored * if and only if the SUPPRESS_BEGINTASK flag has been set on this SubMonitor - * instance. - * - *This method is equivalent calling setWorkRemaining(...) on the reciever. Unless - * the SUPPRESS_BEGINTASK flag is set, this will also be equivalent to calling + * instance. + * + *
This method is equivalent calling setWorkRemaining(...) on the reciever. Unless + * the SUPPRESS_BEGINTASK flag is set, this will also be equivalent to calling * setTaskName(...) on the parent.
- * + * * @param name new main task name * @param totalWork number of ticks to allocate - * + * * @see org.eclipse.core.runtime.IProgressMonitor#beginTask(java.lang.String, int) */ public void beginTask(String name, int totalWork) { @@ -564,7 +564,7 @@ totalParent = 0; usedForParent = 0; totalForChildren = 0; - usedForChildren = 0.0; + usedForChildren = 0.0d; } /* (non-Javadoc) @@ -573,7 +573,7 @@ public void internalWorked(double work) { cleanupActiveChild(); - int delta = consume((work > 0.0) ? work : 0.0); + int delta = consume((work > 0.0d) ? work : 0.0d); if (delta !is 0) root.worked(delta); } @@ -594,69 +594,69 @@ } /* (non-Javadoc) - * @see org.eclipse.core.runtime.IProgressMonitor#setCanceled(bool) + * @see org.eclipse.core.runtime.IProgressMonitor#setCanceled(boolean) */ public void setCanceled(bool b) { root.setCanceled(b); } /** - *Creates a sub progress monitor that will consume the given number of ticks from the + *
Creates a sub progress monitor that will consume the given number of ticks from the
* receiver. It is not necessary to call beginTask
or done
on the
- * result. However, the resulting progress monitor will not report any work after the first
+ * result. However, the resulting progress monitor will not report any work after the first
* call to done() or before ticks are allocated. Ticks may be allocated by calling beginTask
* or setWorkRemaining.
Each SubMonitor only has one active child at a time. Each time newChild() is called, the * result becomes the new active child and any unused progress from the previously-active child is * consumed.
- * + * *This is property makes it unnecessary to call done() on a SubMonitor instance, since child - * monitors are automatically cleaned up the next time the parent is touched.
- * - *
+ * monitors are automatically cleaned up the next time the parent is touched.
+ *
+ *
* ////////////////////////////////////////////////////////////////////////////
* // Example 1: Typical usage of newChild
* void myMethod(IProgressMonitor parent) {
- * SubMonitor progress = SubMonitor.convert(parent, 100);
+ * SubMonitor progress = SubMonitor.convert(parent, 100);
* doSomething(progress.newChild(50));
* doSomethingElse(progress.newChild(50));
* }
- *
+ *
* ////////////////////////////////////////////////////////////////////////////
* // Example 2: Demonstrates the function of active children. Creating children
* // is sufficient to smoothly report progress, even if worked(...) and done()
* // are never called.
* void myMethod(IProgressMonitor parent) {
* SubMonitor progress = SubMonitor.convert(parent, 100);
- *
+ *
* for (int i = 0; i < 100; i++) {
* // Creating the next child monitor will clean up the previous one,
* // causing progress to be reported smoothly even if we don't do anything
* // with the monitors we create
- * progress.newChild(1);
+ * progress.newChild(1);
* }
* }
- *
+ *
* ////////////////////////////////////////////////////////////////////////////
* // Example 3: Demonstrates a common anti-pattern
* void wrongMethod(IProgressMonitor parent) {
* SubMonitor progress = SubMonitor.convert(parent, 100);
- *
+ *
* // WRONG WAY: Won't have the intended effect, as only one of these progress
* // monitors may be active at a time and the other will report no progress.
* callMethod(progress.newChild(50), computeValue(progress.newChild(50)));
* }
- *
+ *
* void rightMethod(IProgressMonitor parent) {
* SubMonitor progress = SubMonitor.convert(parent, 100);
- *
+ *
* // RIGHT WAY: Break up method calls so that only one SubMonitor is in use at a time.
* Object someValue = computeValue(progress.newChild(50));
* callMethod(progress.newChild(50), someValue);
* }
*
- *
+ *
* @param totalWork number of ticks to consume from the reciever
* @return new sub progress monitor that may be used in place of a new SubMonitor
*/
@@ -665,75 +665,75 @@
}
/**
- * Creates a sub progress monitor that will consume the given number of ticks from the
+ *
Creates a sub progress monitor that will consume the given number of ticks from the
* receiver. It is not necessary to call beginTask
or done
on the
- * result. However, the resulting progress monitor will not report any work after the first
+ * result. However, the resulting progress monitor will not report any work after the first
* call to done() or before ticks are allocated. Ticks may be allocated by calling beginTask
* or setWorkRemaining.
- *
+ *
* Each SubMonitor only has one active child at a time. Each time newChild() is called, the
* result becomes the new active child and any unused progress from the previously-active child is
* consumed.
- *
+ *
* This is property makes it unnecessary to call done() on a SubMonitor instance, since child
- * monitors are automatically cleaned up the next time the parent is touched.
- *
- *
+ * monitors are automatically cleaned up the next time the parent is touched.
+ *
+ *
* ////////////////////////////////////////////////////////////////////////////
* // Example 1: Typical usage of newChild
* void myMethod(IProgressMonitor parent) {
- * SubMonitor progress = SubMonitor.convert(parent, 100);
+ * SubMonitor progress = SubMonitor.convert(parent, 100);
* doSomething(progress.newChild(50));
* doSomethingElse(progress.newChild(50));
* }
- *
+ *
* ////////////////////////////////////////////////////////////////////////////
* // Example 2: Demonstrates the function of active children. Creating children
* // is sufficient to smoothly report progress, even if worked(...) and done()
* // are never called.
* void myMethod(IProgressMonitor parent) {
* SubMonitor progress = SubMonitor.convert(parent, 100);
- *
+ *
* for (int i = 0; i < 100; i++) {
* // Creating the next child monitor will clean up the previous one,
* // causing progress to be reported smoothly even if we don't do anything
* // with the monitors we create
- * progress.newChild(1);
+ * progress.newChild(1);
* }
* }
- *
+ *
* ////////////////////////////////////////////////////////////////////////////
* // Example 3: Demonstrates a common anti-pattern
* void wrongMethod(IProgressMonitor parent) {
* SubMonitor progress = SubMonitor.convert(parent, 100);
- *
+ *
* // WRONG WAY: Won't have the intended effect, as only one of these progress
* // monitors may be active at a time and the other will report no progress.
* callMethod(progress.newChild(50), computeValue(progress.newChild(50)));
* }
- *
+ *
* void rightMethod(IProgressMonitor parent) {
* SubMonitor progress = SubMonitor.convert(parent, 100);
- *
+ *
* // RIGHT WAY: Break up method calls so that only one SubMonitor is in use at a time.
* Object someValue = computeValue(progress.newChild(50));
* callMethod(progress.newChild(50), someValue);
* }
*
- *
+ *
* @param totalWork number of ticks to consume from the reciever
* @return new sub progress monitor that may be used in place of a new SubMonitor
*/
public SubMonitor newChild(int totalWork, int suppressFlags) {
- double totalWorkDouble = (totalWork > 0) ? totalWork : 0.0;
+ double totalWorkDouble = (totalWork > 0) ? totalWork : 0.0d;
totalWorkDouble = Math.min(totalWorkDouble, totalForChildren - usedForChildren);
cleanupActiveChild();
// Compute the flags for the child. We want the net effect to be as though the child is
// delegating to its parent, even though it is actually talking directly to the root.
- // This means that we need to compute the flags such that - even if a label isn't
+ // This means that we need to compute the flags such that - even if a label isn't
// suppressed by the child - if that same label would have been suppressed when the
- // child delegated to its parent, the child must explicitly suppress the label.
+ // child delegated to its parent, the child must explicitly suppress the label.
int childFlags = SUPPRESS_NONE;
if ((flags & SUPPRESS_SETTASKNAME) !is 0) {
@@ -780,11 +780,11 @@
root.setBlocked(reason);
}
- protected static bool eq(String o1, String o2) {
- if (o1.length is 0)
- return (o2.length is 0);
- if (o2.length is 0)
+ protected static bool eq(Object o1, Object o2) {
+ if (o1 is null)
+ return (o2 is null);
+ if (o2 is null)
return false;
- return o1.equals(o2);
+ return o1.opEquals(o2);
}
}
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.equinox.common/src/org/eclipse/core/runtime/SubProgressMonitor.d
--- a/org.eclipse.equinox.common/src/org/eclipse/core/runtime/SubProgressMonitor.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.equinox.common/src/org/eclipse/core/runtime/SubProgressMonitor.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,22 +4,22 @@
* 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:
* IBM Corporation - initial API and implementation
- * Port to the D programming language:
- * Frank Benoit
*******************************************************************************/
-module org.eclipse.core.runtime.SubProgressMonitor;
-
-import org.eclipse.core.runtime.ProgressMonitorWrapper;
-import org.eclipse.core.runtime.IProgressMonitor;
+// Port to the D programming language:
+// Frank Benoit
+module org.eclipse.core.runtimeSubProgressMonitor;
import java.lang.all;
+import org.eclipse.core.runtimeIProgressMonitor; // packageimport
+import org.eclipse.core.runtimeProgressMonitorWrapper; // packageimport
+
/**
* For new implementations consider using {@link SubMonitor}.
- *
+ *
* A progress monitor that uses a given amount of work ticks
* from a parent monitor. It can be used as follows:
*
@@ -43,7 +43,7 @@
*
* This class may be instantiated or subclassed by clients.
*
- *
+ *
* @see SubMonitor
*/
public class SubProgressMonitor : ProgressMonitorWrapper {
@@ -54,14 +54,14 @@
*
* @see #SubProgressMonitor(IProgressMonitor,int,int)
*/
- public static const int SUPPRESS_SUBTASK_LABEL = 1 << 1;
+ public static final int SUPPRESS_SUBTASK_LABEL = 1 << 1;
/**
- * Style constant indicating that the main task label
+ * Style constant indicating that the main task label
* should be prepended to the subtask label.
*
* @see #SubProgressMonitor(IProgressMonitor,int,int)
*/
- public static const int PREPEND_MAIN_LABEL_TO_SUBTASK = 1 << 2;
+ public static final int PREPEND_MAIN_LABEL_TO_SUBTASK = 1 << 2;
private int parentTicks = 0;
private double sentToParent = 0.0;
@@ -73,8 +73,8 @@
private String mainTaskLabel;
/**
- * Creates a new sub-progress monitor for the given monitor. The sub
- * progress monitor uses the given number of work ticks from its
+ * Creates a new sub-progress monitor for the given monitor. The sub
+ * progress monitor uses the given number of work ticks from its
* parent monitor.
*
* @param monitor the parent progress monitor
@@ -86,8 +86,8 @@
}
/**
- * Creates a new sub-progress monitor for the given monitor. The sub
- * progress monitor uses the given number of work ticks from its
+ * Creates a new sub-progress monitor for the given monitor. The sub
+ * progress monitor uses the given number of work ticks from its
* parent monitor.
*
* @param monitor the parent progress monitor
@@ -112,20 +112,20 @@
*
* Starts a new main task. Since this progress monitor is a sub
* progress monitor, the given name will NOT be used to update
- * the progress bar's main task label. That means the given
+ * the progress bar's main task label. That means the given
* string will be ignored. If style PREPEND_MAIN_LABEL_TO_SUBTASK
* is specified, then the given string will be prepended to
* every string passed to subTask(String)
.
*/
- public override void beginTask(String name, int totalWork) {
+ public void beginTask(String name, int totalWork) {
nestedBeginTasks++;
// Ignore nested begin task calls.
if (nestedBeginTasks > 1) {
return;
}
- // be safe: if the argument would cause math errors (zero or
+ // be safe: if the argument would cause math errors (zero or
// negative), just use 0 as the scale. This disables progress for
- // this submonitor.
+ // this submonitor.
scale = totalWork <= 0 ? 0 : cast(double) parentTicks / cast(double) totalWork;
if ((style & PREPEND_MAIN_LABEL_TO_SUBTASK) !is 0) {
mainTaskLabel = name;
@@ -135,7 +135,7 @@
/* (Intentionally not javadoc'd)
* Implements the method IProgressMonitor.done
.
*/
- public override void done() {
+ public void done() {
// Ignore if more done calls than beginTask calls or if we are still
// in some nested beginTasks
if (nestedBeginTasks is 0 || --nestedBeginTasks > 0)
@@ -153,12 +153,12 @@
/* (Intentionally not javadoc'd)
* Implements the internal method IProgressMonitor.internalWorked
.
*/
- public override void internalWorked(double work) {
+ public void internalWorked(double work) {
if (usedUp || nestedBeginTasks !is 1) {
return;
}
- double realWork = (work > 0.0) ? scale * work : 0.0;
+ double realWork = (work > 0.0d) ? scale * work : 0.0d;
super.internalWorked(realWork);
sentToParent += realWork;
if (sentToParent >= parentTicks) {
@@ -169,14 +169,14 @@
/* (Intentionally not javadoc'd)
* Implements the method IProgressMonitor.subTask
.
*/
- public override void subTask(String name) {
+ public void subTask(String name) {
if ((style & SUPPRESS_SUBTASK_LABEL) !is 0) {
return;
}
hasSubTask = true;
String label = name;
- if ((style & PREPEND_MAIN_LABEL_TO_SUBTASK) !is 0 && mainTaskLabel !is null && mainTaskLabel.length > 0) {
- label = mainTaskLabel ~ ' ' ~ label;
+ if ((style & PREPEND_MAIN_LABEL_TO_SUBTASK) !is 0 && mainTaskLabel !is null && mainTaskLabel.length() > 0) {
+ label = mainTaskLabel + ' ' + label;
}
super.subTask(label);
}
@@ -184,7 +184,7 @@
/* (Intentionally not javadoc'd)
* Implements the method IProgressMonitor.worked
.
*/
- public override void worked(int work) {
+ public void worked(int work) {
internalWorked(work);
}
}
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.d
--- a/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.d Sun Nov 08 12:42:30 2009 +0100
@@ -16,15 +16,21 @@
* limitations under the License.
*/
+// Port to the D programming language:
+// Frank Benoit
module org.osgi.framework.Bundle;
import java.lang.all;
-// import java.io.IOException;
-// import java.io.InputStream;
-// import java.net.URL;
-// import java.util.Dictionary;
-// import java.util.Enumeration;
+import org.osgi.framework.BundleException; // packageimport
+import org.osgi.framework.ServiceReference; // packageimport
+import org.osgi.framework.BundleContext; // packageimport
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Dictionary;
+import java.util.Enumeration;
/**
* An installed bundle in the Framework.
@@ -81,7 +87,7 @@
*
* The value of UNINSTALLED
is 0x00000001.
*/
- public static const int UNINSTALLED = 0x00000001;
+ public static final int UNINSTALLED = 0x00000001;
/**
* The bundle is installed but not yet resolved.
@@ -97,7 +103,7 @@
*
* The value of INSTALLED
is 0x00000002.
*/
- public static const int INSTALLED = 0x00000002;
+ public static final int INSTALLED = 0x00000002;
/**
* The bundle is resolved and is able to be started.
@@ -124,7 +130,7 @@
*
* The value of RESOLVED
is 0x00000004.
*/
- public static const int RESOLVED = 0x00000004;
+ public static final int RESOLVED = 0x00000004;
/**
* The bundle is in the process of starting.
@@ -144,7 +150,7 @@
*
* The value of STARTING
is 0x00000008.
*/
- public static const int STARTING = 0x00000008;
+ public static final int STARTING = 0x00000008;
/**
* The bundle is in the process of stopping.
@@ -158,7 +164,7 @@
*
* The value of STOPPING
is 0x00000010.
*/
- public static const int STOPPING = 0x00000010;
+ public static final int STOPPING = 0x00000010;
/**
* The bundle is now running.
@@ -169,7 +175,7 @@
*
* The value of ACTIVE
is 0x00000020.
*/
- public static const int ACTIVE = 0x00000020;
+ public static final int ACTIVE = 0x00000020;
/**
* The bundle start operation is transient and the persistent autostart
@@ -184,7 +190,7 @@
* @since 1.4
* @see #start(int)
*/
- public static const int START_TRANSIENT = 0x00000001;
+ public static final int START_TRANSIENT = 0x00000001;
/**
* The bundle start operation must activate the bundle according to the
@@ -200,7 +206,7 @@
* @see Constants#BUNDLE_ACTIVATIONPOLICY
* @see #start(int)
*/
- public static const int START_ACTIVATION_POLICY = 0x00000002;
+ public static final int START_ACTIVATION_POLICY = 0x00000002;
/**
* The bundle stop is transient and the persistent autostart setting of the
@@ -351,7 +357,7 @@
* the Java Runtime Environment supports permissions.
* @since 1.4
*/
- public void start(int options);
+ public void start(int options) ;
/**
* Starts this bundle with no options.
@@ -370,7 +376,7 @@
* the Java Runtime Environment supports permissions.
* @see #start(int)
*/
- public void start();
+ public void start() ;
/**
* Stops this bundle.
@@ -448,7 +454,7 @@
* the Java Runtime Environment supports permissions.
* @since 1.4
*/
- public void stop(int options);
+ public void stop(int options) ;
/**
* Stops this bundle with no options.
@@ -465,7 +471,7 @@
* the Java Runtime Environment supports permissions.
* @see #start(int)
*/
- public void stop();
+ public void stop() ;
/**
* Updates this bundle.
@@ -552,571 +558,571 @@
* @see #stop()
* @see #start()
*/
- public void update();
+ public void update() ;
+
+ /**
+ * Updates this bundle from an InputStream
.
+ *
+ *
+ * This method performs all the steps listed in Bundle.update()
,
+ * except the new version of this bundle must be read from the supplied
+ * InputStream
, rather than a URL
.
+ *
+ * This method must always close the InputStream
when it is
+ * done, even if an exception is thrown.
+ *
+ * @param in The InputStream
from which to read the new
+ * bundle.
+ * @throws BundleException If the provided stream cannot be read or the
+ * update fails.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled or this bundle tries to change its own state.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate AdminPermission[this,LIFECYCLE]
for
+ * both the current bundle and the updated bundle, and the Java
+ * Runtime Environment supports permissions.
+ * @see #update()
+ */
+ public void update(InputStream in_) ;
+
+ /**
+ * Uninstalls this bundle.
+ *
+ *
+ * This method causes the Framework to notify other bundles that this bundle
+ * is being uninstalled, and then puts this bundle into the
+ * UNINSTALLED
state. The Framework must remove any resources
+ * related to this bundle that it is able to remove.
+ *
+ *
+ * If this bundle has exported any packages, the Framework must continue to
+ * make these packages available to their importing bundles until the
+ * PackageAdmin.refreshPackages
method has been called or the
+ * Framework is relaunched.
+ *
+ *
+ * The following steps are required to uninstall a bundle:
+ *
+ * - If this bundle's state is
UNINSTALLED
then an
+ * IllegalStateException
is thrown.
+ *
+ * - If this bundle's state is
ACTIVE
,
+ * STARTING
or STOPPING
, this bundle is
+ * stopped as described in the Bundle.stop
method. If
+ * Bundle.stop
throws an exception, a Framework event of type
+ * {@link FrameworkEvent#ERROR} is fired containing the exception.
+ *
+ * - This bundle's state is set to
UNINSTALLED
.
+ *
+ * - A bundle event of type {@link BundleEvent#UNINSTALLED} is fired.
+ *
+ *
- This bundle and any persistent storage area provided for this bundle
+ * by the Framework are removed.
+ *
+ *
+ * Preconditions
+ *
+ * getState()
not in {UNINSTALLED
}.
+ *
+ * Postconditions, no exceptions thrown
+ *
+ * getState()
in {UNINSTALLED
}.
+ * - This bundle has been uninstalled.
+ *
+ * Postconditions, when an exception is thrown
+ *
+ * getState()
not in {UNINSTALLED
}.
+ * - This Bundle has not been uninstalled.
+ *
+ *
+ * @throws BundleException If the uninstall failed. This can occur if
+ * another thread is attempting to change this bundle's state and
+ * does not complete in a timely manner.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled or this bundle tries to change its own state.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate AdminPermission[this,LIFECYCLE]
, and
+ * the Java Runtime Environment supports permissions.
+ * @see #stop()
+ */
+ public void uninstall() ;
+
+ /**
+ * Returns this bundle's Manifest headers and values. This method returns
+ * all the Manifest headers and values from the main section of this
+ * bundle's Manifest file; that is, all lines prior to the first blank line.
+ *
+ *
+ * Manifest header names are case-insensitive. The methods of the returned
+ * Dictionary
object must operate on header names in a
+ * case-insensitive manner.
+ *
+ * If a Manifest header value starts with "%", it must be
+ * localized according to the default locale.
+ *
+ *
+ * For example, the following Manifest headers and values are included if
+ * they are present in the Manifest file:
+ *
+ *
+ * Bundle-Name
+ * Bundle-Vendor
+ * Bundle-Version
+ * Bundle-Description
+ * Bundle-DocURL
+ * Bundle-ContactAddress
+ *
+ *
+ *
+ * This method must continue to return Manifest header information while
+ * this bundle is in the UNINSTALLED
state.
+ *
+ * @return A Dictionary
object containing this bundle's
+ * Manifest headers and values.
+ *
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate AdminPermission[this,METADATA]
, and
+ * the Java Runtime Environment supports permissions.
+ *
+ * @see Constants#BUNDLE_LOCALIZATION
+ */
+ public Dictionary getHeaders();
+
+ /**
+ * Returns this bundle's unique identifier. This bundle is assigned a unique
+ * identifier by the Framework when it was installed in the OSGi
+ * environment.
+ *
+ *
+ * A bundle's unique identifier has the following attributes:
+ *
+ * - Is unique and persistent.
+ *
- Is a
long
.
+ * - Its value is not reused for another bundle, even after a bundle is
+ * uninstalled.
+ *
- Does not change while a bundle remains installed.
+ *
- Does not change when a bundle is updated.
+ *
+ *
+ *
+ * This method must continue to return this bundle's unique identifier while
+ * this bundle is in the UNINSTALLED
state.
+ *
+ * @return The unique identifier of this bundle.
+ */
+ public long getBundleId();
+
+ /**
+ * Returns this bundle's location identifier.
+ *
+ *
+ * The location identifier is the location passed to
+ * BundleContext.installBundle
when a bundle is installed.
+ * The location identifier does not change while this bundle remains
+ * installed, even if this bundle is updated.
+ *
+ *
+ * This method must continue to return this bundle's location identifier
+ * while this bundle is in the UNINSTALLED
state.
+ *
+ * @return The string representation of this bundle's location identifier.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate AdminPermission[this,METADATA]
, and
+ * the Java Runtime Environment supports permissions.
+ */
+ public String getLocation();
+
+ /**
+ * Returns this bundle's ServiceReference
list for all
+ * services it has registered or null
if this bundle has no
+ * registered services.
+ *
+ *
+ * If the Java runtime supports permissions, a ServiceReference
+ * object to a service is included in the returned list only if the caller
+ * has the ServicePermission
to get the service using at
+ * least one of the named classes the service was registered under.
+ *
+ *
+ * The list is valid at the time of the call to this method, however, as the
+ * Framework is a very dynamic environment, services can be modified or
+ * unregistered at anytime.
+ *
+ * @return An array of ServiceReference
objects or
+ * null
.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled.
+ * @see ServiceRegistration
+ * @see ServiceReference
+ * @see ServicePermission
+ */
+ public ServiceReference[] getRegisteredServices();
+
+ /**
+ * Returns this bundle's ServiceReference
list for all
+ * services it is using or returns null
if this bundle is not
+ * using any services. A bundle is considered to be using a service if its
+ * use count for that service is greater than zero.
+ *
+ *
+ * If the Java Runtime Environment supports permissions, a
+ * ServiceReference
object to a service is included in the
+ * returned list only if the caller has the ServicePermission
+ * to get the service using at least one of the named classes the service
+ * was registered under.
+ *
+ * The list is valid at the time of the call to this method, however, as the
+ * Framework is a very dynamic environment, services can be modified or
+ * unregistered at anytime.
+ *
+ * @return An array of ServiceReference
objects or
+ * null
.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled.
+ * @see ServiceReference
+ * @see ServicePermission
+ */
+ public ServiceReference[] getServicesInUse();
+
+ /**
+ * Determines if this bundle has the specified permissions.
+ *
+ *
+ * If the Java Runtime Environment does not support permissions, this method
+ * always returns true
.
+ *
+ * permission
is of type Object
to avoid
+ * referencing the java.security.Permission
class directly.
+ * This is to allow the Framework to be implemented in Java environments
+ * which do not support permissions.
+ *
+ *
+ * If the Java Runtime Environment does support permissions, this bundle and
+ * all its resources including embedded JAR files, belong to the same
+ * java.security.ProtectionDomain
; that is, they must share
+ * the same set of permissions.
+ *
+ * @param permission The permission to verify.
+ *
+ * @return true
if this bundle has the specified permission
+ * or the permissions possessed by this bundle imply the specified
+ * permission; false
if this bundle does not have the
+ * specified permission or permission
is not an
+ * instanceof
java.security.Permission
.
+ *
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled.
+ */
+ public bool hasPermission(Object permission);
-// /**
-// * Updates this bundle from an InputStream
.
-// *
-// *
-// * This method performs all the steps listed in Bundle.update()
,
-// * except the new version of this bundle must be read from the supplied
-// * InputStream
, rather than a URL
.
-// *
-// * This method must always close the InputStream
when it is
-// * done, even if an exception is thrown.
-// *
-// * @param in The InputStream
from which to read the new
-// * bundle.
-// * @throws BundleException If the provided stream cannot be read or the
-// * update fails.
-// * @throws java.lang.IllegalStateException If this bundle has been
-// * uninstalled or this bundle tries to change its own state.
-// * @throws java.lang.SecurityException If the caller does not have the
-// * appropriate AdminPermission[this,LIFECYCLE]
for
-// * both the current bundle and the updated bundle, and the Java
-// * Runtime Environment supports permissions.
-// * @see #update()
-// */
-// public void update(InputStream in_);
-//
-// /**
-// * Uninstalls this bundle.
-// *
-// *
-// * This method causes the Framework to notify other bundles that this bundle
-// * is being uninstalled, and then puts this bundle into the
-// * UNINSTALLED
state. The Framework must remove any resources
-// * related to this bundle that it is able to remove.
-// *
-// *
-// * If this bundle has exported any packages, the Framework must continue to
-// * make these packages available to their importing bundles until the
-// * PackageAdmin.refreshPackages
method has been called or the
-// * Framework is relaunched.
-// *
-// *
-// * The following steps are required to uninstall a bundle:
-// *
-// * - If this bundle's state is
UNINSTALLED
then an
-// * IllegalStateException
is thrown.
-// *
-// * - If this bundle's state is
ACTIVE
,
-// * STARTING
or STOPPING
, this bundle is
-// * stopped as described in the Bundle.stop
method. If
-// * Bundle.stop
throws an exception, a Framework event of type
-// * {@link FrameworkEvent#ERROR} is fired containing the exception.
-// *
-// * - This bundle's state is set to
UNINSTALLED
.
-// *
-// * - A bundle event of type {@link BundleEvent#UNINSTALLED} is fired.
-// *
-// *
- This bundle and any persistent storage area provided for this bundle
-// * by the Framework are removed.
-// *
-// *
-// * Preconditions
-// *
-// * getState()
not in {UNINSTALLED
}.
-// *
-// * Postconditions, no exceptions thrown
-// *
-// * getState()
in {UNINSTALLED
}.
-// * - This bundle has been uninstalled.
-// *
-// * Postconditions, when an exception is thrown
-// *
-// * getState()
not in {UNINSTALLED
}.
-// * - This Bundle has not been uninstalled.
-// *
-// *
-// * @throws BundleException If the uninstall failed. This can occur if
-// * another thread is attempting to change this bundle's state and
-// * does not complete in a timely manner.
-// * @throws java.lang.IllegalStateException If this bundle has been
-// * uninstalled or this bundle tries to change its own state.
-// * @throws java.lang.SecurityException If the caller does not have the
-// * appropriate AdminPermission[this,LIFECYCLE]
, and
-// * the Java Runtime Environment supports permissions.
-// * @see #stop()
-// */
-// public void uninstall();
-//
-// /**
-// * Returns this bundle's Manifest headers and values. This method returns
-// * all the Manifest headers and values from the main section of this
-// * bundle's Manifest file; that is, all lines prior to the first blank line.
-// *
-// *
-// * Manifest header names are case-insensitive. The methods of the returned
-// * Dictionary
object must operate on header names in a
-// * case-insensitive manner.
-// *
-// * If a Manifest header value starts with "%", it must be
-// * localized according to the default locale.
-// *
-// *
-// * For example, the following Manifest headers and values are included if
-// * they are present in the Manifest file:
-// *
-// *
-// * Bundle-Name
-// * Bundle-Vendor
-// * Bundle-Version
-// * Bundle-Description
-// * Bundle-DocURL
-// * Bundle-ContactAddress
-// *
-// *
-// *
-// * This method must continue to return Manifest header information while
-// * this bundle is in the UNINSTALLED
state.
-// *
-// * @return A Dictionary
object containing this bundle's
-// * Manifest headers and values.
-// *
-// * @throws java.lang.SecurityException If the caller does not have the
-// * appropriate AdminPermission[this,METADATA]
, and
-// * the Java Runtime Environment supports permissions.
-// *
-// * @see Constants#BUNDLE_LOCALIZATION
-// */
-// public Dictionary getHeaders();
-//
-// /**
-// * Returns this bundle's unique identifier. This bundle is assigned a unique
-// * identifier by the Framework when it was installed in the OSGi
-// * environment.
-// *
-// *
-// * A bundle's unique identifier has the following attributes:
-// *
-// * - Is unique and persistent.
-// *
- Is a
long
.
-// * - Its value is not reused for another bundle, even after a bundle is
-// * uninstalled.
-// *
- Does not change while a bundle remains installed.
-// *
- Does not change when a bundle is updated.
-// *
-// *
-// *
-// * This method must continue to return this bundle's unique identifier while
-// * this bundle is in the UNINSTALLED
state.
-// *
-// * @return The unique identifier of this bundle.
-// */
-// public long getBundleId();
-//
-// /**
-// * Returns this bundle's location identifier.
-// *
-// *
-// * The location identifier is the location passed to
-// * BundleContext.installBundle
when a bundle is installed.
-// * The location identifier does not change while this bundle remains
-// * installed, even if this bundle is updated.
-// *
-// *
-// * This method must continue to return this bundle's location identifier
-// * while this bundle is in the UNINSTALLED
state.
-// *
-// * @return The string representation of this bundle's location identifier.
-// * @throws java.lang.SecurityException If the caller does not have the
-// * appropriate AdminPermission[this,METADATA]
, and
-// * the Java Runtime Environment supports permissions.
-// */
-// public String getLocation();
-//
-// /**
-// * Returns this bundle's ServiceReference
list for all
-// * services it has registered or null
if this bundle has no
-// * registered services.
-// *
-// *
-// * If the Java runtime supports permissions, a ServiceReference
-// * object to a service is included in the returned list only if the caller
-// * has the ServicePermission
to get the service using at
-// * least one of the named classes the service was registered under.
-// *
-// *
-// * The list is valid at the time of the call to this method, however, as the
-// * Framework is a very dynamic environment, services can be modified or
-// * unregistered at anytime.
-// *
-// * @return An array of ServiceReference
objects or
-// * null
.
-// * @throws java.lang.IllegalStateException If this bundle has been
-// * uninstalled.
-// * @see ServiceRegistration
-// * @see ServiceReference
-// * @see ServicePermission
-// */
-// public ServiceReference[] getRegisteredServices();
-//
-// /**
-// * Returns this bundle's ServiceReference
list for all
-// * services it is using or returns null
if this bundle is not
-// * using any services. A bundle is considered to be using a service if its
-// * use count for that service is greater than zero.
-// *
-// *
-// * If the Java Runtime Environment supports permissions, a
-// * ServiceReference
object to a service is included in the
-// * returned list only if the caller has the ServicePermission
-// * to get the service using at least one of the named classes the service
-// * was registered under.
-// *
-// * The list is valid at the time of the call to this method, however, as the
-// * Framework is a very dynamic environment, services can be modified or
-// * unregistered at anytime.
-// *
-// * @return An array of ServiceReference
objects or
-// * null
.
-// * @throws java.lang.IllegalStateException If this bundle has been
-// * uninstalled.
-// * @see ServiceReference
-// * @see ServicePermission
-// */
-// public ServiceReference[] getServicesInUse();
-//
-// /**
-// * Determines if this bundle has the specified permissions.
-// *
-// *
-// * If the Java Runtime Environment does not support permissions, this method
-// * always returns true
.
-// *
-// * permission
is of type Object
to avoid
-// * referencing the java.security.Permission
class directly.
-// * This is to allow the Framework to be implemented in Java environments
-// * which do not support permissions.
-// *
-// *
-// * If the Java Runtime Environment does support permissions, this bundle and
-// * all its resources including embedded JAR files, belong to the same
-// * java.security.ProtectionDomain
; that is, they must share
-// * the same set of permissions.
-// *
-// * @param permission The permission to verify.
-// *
-// * @return true
if this bundle has the specified permission
-// * or the permissions possessed by this bundle imply the specified
-// * permission; false
if this bundle does not have the
-// * specified permission or permission
is not an
-// * instanceof
java.security.Permission
.
-// *
-// * @throws java.lang.IllegalStateException If this bundle has been
-// * uninstalled.
-// */
-// public bool hasPermission(Object permission);
-//
-// /**
-// * Find the specified resource from this bundle.
-// *
-// * This bundle's class loader is called to search for the specified
-// * resource. If this bundle's state is INSTALLED
, this
-// * method must attempt to resolve this bundle before attempting to get the
-// * specified resource. If this bundle cannot be resolved, then only this
-// * bundle must be searched for the specified resource. Imported packages
-// * cannot be searched when this bundle has not been resolved. If this bundle
-// * is a fragment bundle then null
is returned.
-// *
-// * @param name The name of the resource. See
-// * java.lang.ClassLoader.getResource
for a description
-// * of the format of a resource name.
-// * @return A URL to the named resource, or null
if the
-// * resource could not be found or if this bundle is a fragment
-// * bundle or if the caller does not have the appropriate
-// * AdminPermission[this,RESOURCE]
, and the Java
-// * Runtime Environment supports permissions.
-// *
-// * @since 1.1
-// * @throws java.lang.IllegalStateException If this bundle has been
-// * uninstalled.
-// * @see #getEntry
-// * @see #findEntries
-// */
-// public URL getResource(String name);
-//
-// /**
-// * Returns this bundle's Manifest headers and values localized to the
-// * specified locale.
-// *
-// *
-// * This method performs the same function as
-// * Bundle.getHeaders()
except the manifest header values are
-// * localized to the specified locale.
-// *
-// *
-// * If a Manifest header value starts with "%", it must be
-// * localized according to the specified locale. If a locale is specified and
-// * cannot be found, then the header values must be returned using the
-// * default locale. Localizations are searched for in the following order:
-// *
-// *
-// * bn + "_" + Ls + "_" + Cs + "_" + Vs
-// * bn + "_" + Ls + "_" + Cs
-// * bn + "_" + Ls
-// * bn + "_" + Ld + "_" + Cd + "_" + Vd
-// * bn + "_" + Ld + "_" + Cd
-// * bn + "_" + Ld
-// * bn
-// *
-// *
-// * Where bn
is this bundle's localization basename,
-// * Ls
, Cs
and Vs
are the
-// * specified locale (language, country, variant) and Ld
,
-// * Cd
and Vd
are the default locale (language,
-// * country, variant).
-// *
-// * If null
is specified as the locale string, the header
-// * values must be localized using the default locale. If the empty string
-// * ("") is specified as the locale string, the header values must
-// * not be localized and the raw (unlocalized) header values, including any
-// * leading "%", must be returned.
-// *
-// *
-// * This method must continue to return Manifest header information while
-// * this bundle is in the UNINSTALLED
state, however the
-// * header values must only be available in the raw and default locale
-// * values.
-// *
-// * @param locale The locale name into which the header values are to be
-// * localized. If the specified locale is null
then the
-// * locale returned by java.util.Locale.getDefault
is
-// * used. If the specified locale is the empty string, this method
-// * will return the raw (unlocalized) manifest headers including any
-// * leading "%".
-// * @return A Dictionary
object containing this bundle's
-// * Manifest headers and values.
-// *
-// * @throws java.lang.SecurityException If the caller does not have the
-// * appropriate AdminPermission[this,METADATA]
, and
-// * the Java Runtime Environment supports permissions.
-// *
-// * @see #getHeaders()
-// * @see Constants#BUNDLE_LOCALIZATION
-// * @since 1.3
-// */
-// public Dictionary getHeaders(String locale);
-//
-// /**
-// * Returns the symbolic name of this bundle as specified by its
-// * Bundle-SymbolicName
manifest header. The name must be
-// * unique, it is recommended to use a reverse domain name naming convention
-// * like that used for java packages. If this bundle does not have a
-// * specified symbolic name then null
is returned.
-// *
-// *
-// * This method must continue to return this bundle's symbolic name while
-// * this bundle is in the UNINSTALLED
state.
-// *
-// * @return The symbolic name of this bundle.
-// * @since 1.3
-// */
-// public String getSymbolicName();
-//
-// /**
-// * Loads the specified class using this bundle's classloader.
-// *
-// *
-// * If this bundle is a fragment bundle then this method must throw a
-// * ClassNotFoundException
.
-// *
-// *
-// * If this bundle's state is INSTALLED
, this method must
-// * attempt to resolve this bundle before attempting to load the class.
-// *
-// *
-// * If this bundle cannot be resolved, a Framework event of type
-// * {@link FrameworkEvent#ERROR} is fired containing a
-// * BundleException
with details of the reason this bundle
-// * could not be resolved. This method must then throw a
-// * ClassNotFoundException
.
-// *
-// *
-// * If this bundle's state is UNINSTALLED
, then an
-// * IllegalStateException
is thrown.
-// *
-// * @param name The name of the class to load.
-// * @return The Class object for the requested class.
-// * @throws java.lang.ClassNotFoundException If no such class can be found or
-// * if this bundle is a fragment bundle or if the caller does not
-// * have the appropriate AdminPermission[this,CLASS]
,
-// * and the Java Runtime Environment supports permissions.
-// * @throws java.lang.IllegalStateException If this bundle has been
-// * uninstalled.
-// * @since 1.3
-// */
-// public Class loadClass(String name) throws ClassNotFoundException;
-//
-// /**
-// * Find the specified resources from this bundle.
-// *
-// * This bundle's class loader is called to search for the specified
-// * resources. If this bundle's state is INSTALLED
, this
-// * method must attempt to resolve this bundle before attempting to get the
-// * specified resources. If this bundle cannot be resolved, then only this
-// * bundle must be searched for the specified resources. Imported packages
-// * cannot be searched when a bundle has not been resolved. If this bundle is
-// * a fragment bundle then null
is returned.
-// *
-// * @param name The name of the resource. See
-// * java.lang.ClassLoader.getResources
for a
-// * description of the format of a resource name.
-// * @return An enumeration of URLs to the named resources, or
-// * null
if the resource could not be found or if this
-// * bundle is a fragment bundle or if the caller does not have the
-// * appropriate AdminPermission[this,RESOURCE]
, and
-// * the Java Runtime Environment supports permissions.
-// *
-// * @since 1.3
-// * @throws java.lang.IllegalStateException If this bundle has been
-// * uninstalled.
-// * @throws java.io.IOException If there is an I/O error.
-// */
-// public Enumeration getResources(String name) throws IOException;
-//
-// /**
-// * Returns an Enumeration of all the paths (String
objects)
-// * to entries within this bundle whose longest sub-path matches the
-// * specified path. This bundle's classloader is not used to search for
-// * entries. Only the contents of this bundle are searched.
-// *
-// * The specified path is always relative to the root of this bundle and may
-// * begin with a "/". A path value of "/" indicates the
-// * root of this bundle.
-// *
-// * Returned paths indicating subdirectory paths end with a "/".
-// * The returned paths are all relative to the root of this bundle and must
-// * not begin with "/".
-// *
-// * @param path The path name for which to return entry paths.
-// * @return An Enumeration of the entry paths (String
-// * objects) or null
if no entry could be found or if
-// * the caller does not have the appropriate
-// * AdminPermission[this,RESOURCE]
and the Java
-// * Runtime Environment supports permissions.
-// * @throws java.lang.IllegalStateException If this bundle has been
-// * uninstalled.
-// * @since 1.3
-// */
-// public Enumeration getEntryPaths(String path);
-//
-// /**
-// * Returns a URL to the entry at the specified path in this bundle. This
-// * bundle's classloader is not used to search for the entry. Only the
-// * contents of this bundle are searched for the entry.
-// *
-// * The specified path is always relative to the root of this bundle and may
-// * begin with "/". A path value of "/" indicates the
-// * root of this bundle.
-// *
-// * @param path The path name of the entry.
-// * @return A URL to the entry, or null
if no entry could be
-// * found or if the caller does not have the appropriate
-// * AdminPermission[this,RESOURCE]
and the Java
-// * Runtime Environment supports permissions.
-// *
-// * @throws java.lang.IllegalStateException If this bundle has been
-// * uninstalled.
-// * @since 1.3
-// */
-// public URL getEntry(String path);
-//
-// /**
-// * Returns the time when this bundle was last modified. A bundle is
-// * considered to be modified when it is installed, updated or uninstalled.
-// *
-// *
-// * The time value is the number of milliseconds since January 1, 1970,
-// * 00:00:00 GMT.
-// *
-// * @return The time when this bundle was last modified.
-// * @since 1.3
-// */
-// public long getLastModified();
-//
-// /**
-// * Returns entries in this bundle and its attached fragments. This bundle's
-// * classloader is not used to search for entries. Only the contents of this
-// * bundle and its attached fragments are searched for the specified entries.
-// *
-// * If this bundle's state is INSTALLED
, this method must
-// * attempt to resolve this bundle before attempting to find entries.
-// *
-// *
-// * This method is intended to be used to obtain configuration, setup,
-// * localization and other information from this bundle. This method takes
-// * into account that the "contents" of this bundle can be extended
-// * with fragments. This "bundle space" is not a namespace with
-// * unique members; the same entry name can be present multiple times. This
-// * method therefore returns an enumeration of URL objects. These URLs can
-// * come from different JARs but have the same path name. This method can
-// * either return only entries in the specified path or recurse into
-// * subdirectories returning entries in the directory tree beginning at the
-// * specified path. Fragments can be attached after this bundle is resolved,
-// * possibly changing the set of URLs returned by this method. If this bundle
-// * is not resolved, only the entries in the JAR file of this bundle are
-// * returned.
-// *
-// * Examples:
-// *
-// *
-// * // List all XML files in the OSGI-INF directory and below
-// * Enumeration e = b.findEntries("OSGI-INF", "*.xml", true);
-// *
-// * // Find a specific localization file
-// * Enumeration e = b.findEntries("OSGI-INF/l10n",
-// * "bundle_nl_DU.properties",
-// * false);
-// * if (e.hasMoreElements())
-// * return (URL) e.nextElement();
-// *
-// *
-// * @param path The path name in which to look. The path is always relative
-// * to the root of this bundle and may begin with "/". A
-// * path value of "/" indicates the root of this bundle.
-// * @param filePattern The file name pattern for selecting entries in the
-// * specified path. The pattern is only matched against the last
-// * element of the entry path and it supports substring matching, as
-// * specified in the Filter specification, using the wildcard
-// * character ("*"). If null is specified, this is
-// * equivalent to "*" and matches all files.
-// * @param recurse If true
, recurse into subdirectories.
-// * Otherwise only return entries from the specified path.
-// * @return An enumeration of URL objects for each matching entry, or
-// * null
if an entry could not be found or if the
-// * caller does not have the appropriate
-// * AdminPermission[this,RESOURCE]
, and the Java
-// * Runtime Environment supports permissions. The URLs are sorted
-// * such that entries from this bundle are returned first followed by
-// * the entries from attached fragments in ascending bundle id order.
-// * If this bundle is a fragment, then only matching entries in this
-// * fragment are returned.
-// * @since 1.3
-// */
-// public Enumeration findEntries(String path, String filePattern,
-// bool recurse);
-//
-// /**
-// * Returns this bundle's {@link BundleContext}. The returned
-// * BundleContext
can be used by the caller to act on behalf
-// * of this bundle.
-// *
-// *
-// * If this bundle is not in the {@link #STARTING}, {@link #ACTIVE}, or
-// * {@link #STOPPING} states or this bundle is a fragment bundle, then this
-// * bundle has no valid BundleContext
. This method will
-// * return null
if this bundle has no valid
-// * BundleContext
.
-// *
-// * @return A BundleContext
for this bundle or
-// * null
if this bundle has no valid
-// * BundleContext
.
-// * @throws java.lang.SecurityException If the caller does not have the
-// * appropriate AdminPermission[this,CONTEXT]
, and
-// * the Java Runtime Environment supports permissions.
-// * @since 1.4
-// */
-// public BundleContext getBundleContext();
+ /**
+ * Find the specified resource from this bundle.
+ *
+ * This bundle's class loader is called to search for the specified
+ * resource. If this bundle's state is INSTALLED
, this
+ * method must attempt to resolve this bundle before attempting to get the
+ * specified resource. If this bundle cannot be resolved, then only this
+ * bundle must be searched for the specified resource. Imported packages
+ * cannot be searched when this bundle has not been resolved. If this bundle
+ * is a fragment bundle then null
is returned.
+ *
+ * @param name The name of the resource. See
+ * java.lang.ClassLoader.getResource
for a description
+ * of the format of a resource name.
+ * @return A URL to the named resource, or null
if the
+ * resource could not be found or if this bundle is a fragment
+ * bundle or if the caller does not have the appropriate
+ * AdminPermission[this,RESOURCE]
, and the Java
+ * Runtime Environment supports permissions.
+ *
+ * @since 1.1
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled.
+ * @see #getEntry
+ * @see #findEntries
+ */
+ public URL getResource(String name);
+
+ /**
+ * Returns this bundle's Manifest headers and values localized to the
+ * specified locale.
+ *
+ *
+ * This method performs the same function as
+ * Bundle.getHeaders()
except the manifest header values are
+ * localized to the specified locale.
+ *
+ *
+ * If a Manifest header value starts with "%", it must be
+ * localized according to the specified locale. If a locale is specified and
+ * cannot be found, then the header values must be returned using the
+ * default locale. Localizations are searched for in the following order:
+ *
+ *
+ * bn + "_" + Ls + "_" + Cs + "_" + Vs
+ * bn + "_" + Ls + "_" + Cs
+ * bn + "_" + Ls
+ * bn + "_" + Ld + "_" + Cd + "_" + Vd
+ * bn + "_" + Ld + "_" + Cd
+ * bn + "_" + Ld
+ * bn
+ *
+ *
+ * Where bn
is this bundle's localization basename,
+ * Ls
, Cs
and Vs
are the
+ * specified locale (language, country, variant) and Ld
,
+ * Cd
and Vd
are the default locale (language,
+ * country, variant).
+ *
+ * If null
is specified as the locale string, the header
+ * values must be localized using the default locale. If the empty string
+ * ("") is specified as the locale string, the header values must
+ * not be localized and the raw (unlocalized) header values, including any
+ * leading "%", must be returned.
+ *
+ *
+ * This method must continue to return Manifest header information while
+ * this bundle is in the UNINSTALLED
state, however the
+ * header values must only be available in the raw and default locale
+ * values.
+ *
+ * @param locale The locale name into which the header values are to be
+ * localized. If the specified locale is null
then the
+ * locale returned by java.util.Locale.getDefault
is
+ * used. If the specified locale is the empty string, this method
+ * will return the raw (unlocalized) manifest headers including any
+ * leading "%".
+ * @return A Dictionary
object containing this bundle's
+ * Manifest headers and values.
+ *
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate AdminPermission[this,METADATA]
, and
+ * the Java Runtime Environment supports permissions.
+ *
+ * @see #getHeaders()
+ * @see Constants#BUNDLE_LOCALIZATION
+ * @since 1.3
+ */
+ public Dictionary getHeaders(String locale);
+
+ /**
+ * Returns the symbolic name of this bundle as specified by its
+ * Bundle-SymbolicName
manifest header. The name must be
+ * unique, it is recommended to use a reverse domain name naming convention
+ * like that used for java packages. If this bundle does not have a
+ * specified symbolic name then null
is returned.
+ *
+ *
+ * This method must continue to return this bundle's symbolic name while
+ * this bundle is in the UNINSTALLED
state.
+ *
+ * @return The symbolic name of this bundle.
+ * @since 1.3
+ */
+ public String getSymbolicName();
+
+ /**
+ * Loads the specified class using this bundle's classloader.
+ *
+ *
+ * If this bundle is a fragment bundle then this method must throw a
+ * ClassNotFoundException
.
+ *
+ *
+ * If this bundle's state is INSTALLED
, this method must
+ * attempt to resolve this bundle before attempting to load the class.
+ *
+ *
+ * If this bundle cannot be resolved, a Framework event of type
+ * {@link FrameworkEvent#ERROR} is fired containing a
+ * BundleException
with details of the reason this bundle
+ * could not be resolved. This method must then throw a
+ * ClassNotFoundException
.
+ *
+ *
+ * If this bundle's state is UNINSTALLED
, then an
+ * IllegalStateException
is thrown.
+ *
+ * @param name The name of the class to load.
+ * @return The Class object for the requested class.
+ * @throws java.lang.ClassNotFoundException If no such class can be found or
+ * if this bundle is a fragment bundle or if the caller does not
+ * have the appropriate AdminPermission[this,CLASS]
,
+ * and the Java Runtime Environment supports permissions.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled.
+ * @since 1.3
+ */
+ public Class loadClass(String name) ;
+
+ /**
+ * Find the specified resources from this bundle.
+ *
+ * This bundle's class loader is called to search for the specified
+ * resources. If this bundle's state is INSTALLED
, this
+ * method must attempt to resolve this bundle before attempting to get the
+ * specified resources. If this bundle cannot be resolved, then only this
+ * bundle must be searched for the specified resources. Imported packages
+ * cannot be searched when a bundle has not been resolved. If this bundle is
+ * a fragment bundle then null
is returned.
+ *
+ * @param name The name of the resource. See
+ * java.lang.ClassLoader.getResources
for a
+ * description of the format of a resource name.
+ * @return An enumeration of URLs to the named resources, or
+ * null
if the resource could not be found or if this
+ * bundle is a fragment bundle or if the caller does not have the
+ * appropriate AdminPermission[this,RESOURCE]
, and
+ * the Java Runtime Environment supports permissions.
+ *
+ * @since 1.3
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled.
+ * @throws java.io.IOException If there is an I/O error.
+ */
+ public Enumeration getResources(String name) ;
+
+ /**
+ * Returns an Enumeration of all the paths (String
objects)
+ * to entries within this bundle whose longest sub-path matches the
+ * specified path. This bundle's classloader is not used to search for
+ * entries. Only the contents of this bundle are searched.
+ *
+ * The specified path is always relative to the root of this bundle and may
+ * begin with a "/". A path value of "/" indicates the
+ * root of this bundle.
+ *
+ * Returned paths indicating subdirectory paths end with a "/".
+ * The returned paths are all relative to the root of this bundle and must
+ * not begin with "/".
+ *
+ * @param path The path name for which to return entry paths.
+ * @return An Enumeration of the entry paths (String
+ * objects) or null
if no entry could be found or if
+ * the caller does not have the appropriate
+ * AdminPermission[this,RESOURCE]
and the Java
+ * Runtime Environment supports permissions.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled.
+ * @since 1.3
+ */
+ public Enumeration getEntryPaths(String path);
+
+ /**
+ * Returns a URL to the entry at the specified path in this bundle. This
+ * bundle's classloader is not used to search for the entry. Only the
+ * contents of this bundle are searched for the entry.
+ *
+ * The specified path is always relative to the root of this bundle and may
+ * begin with "/". A path value of "/" indicates the
+ * root of this bundle.
+ *
+ * @param path The path name of the entry.
+ * @return A URL to the entry, or null
if no entry could be
+ * found or if the caller does not have the appropriate
+ * AdminPermission[this,RESOURCE]
and the Java
+ * Runtime Environment supports permissions.
+ *
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled.
+ * @since 1.3
+ */
+ public URL getEntry(String path);
+
+ /**
+ * Returns the time when this bundle was last modified. A bundle is
+ * considered to be modified when it is installed, updated or uninstalled.
+ *
+ *
+ * The time value is the number of milliseconds since January 1, 1970,
+ * 00:00:00 GMT.
+ *
+ * @return The time when this bundle was last modified.
+ * @since 1.3
+ */
+ public long getLastModified();
+
+ /**
+ * Returns entries in this bundle and its attached fragments. This bundle's
+ * classloader is not used to search for entries. Only the contents of this
+ * bundle and its attached fragments are searched for the specified entries.
+ *
+ * If this bundle's state is INSTALLED
, this method must
+ * attempt to resolve this bundle before attempting to find entries.
+ *
+ *
+ * This method is intended to be used to obtain configuration, setup,
+ * localization and other information from this bundle. This method takes
+ * into account that the "contents" of this bundle can be extended
+ * with fragments. This "bundle space" is not a namespace with
+ * unique members; the same entry name can be present multiple times. This
+ * method therefore returns an enumeration of URL objects. These URLs can
+ * come from different JARs but have the same path name. This method can
+ * either return only entries in the specified path or recurse into
+ * subdirectories returning entries in the directory tree beginning at the
+ * specified path. Fragments can be attached after this bundle is resolved,
+ * possibly changing the set of URLs returned by this method. If this bundle
+ * is not resolved, only the entries in the JAR file of this bundle are
+ * returned.
+ *
+ * Examples:
+ *
+ *
+ * // List all XML files in the OSGI-INF directory and below
+ * Enumeration e = b.findEntries("OSGI-INF", "*.xml", true);
+ *
+ * // Find a specific localization file
+ * Enumeration e = b.findEntries("OSGI-INF/l10n",
+ * "bundle_nl_DU.properties",
+ * false);
+ * if (e.hasMoreElements())
+ * return (URL) e.nextElement();
+ *
+ *
+ * @param path The path name in which to look. The path is always relative
+ * to the root of this bundle and may begin with "/". A
+ * path value of "/" indicates the root of this bundle.
+ * @param filePattern The file name pattern for selecting entries in the
+ * specified path. The pattern is only matched against the last
+ * element of the entry path and it supports substring matching, as
+ * specified in the Filter specification, using the wildcard
+ * character ("*"). If null is specified, this is
+ * equivalent to "*" and matches all files.
+ * @param recurse If true
, recurse into subdirectories.
+ * Otherwise only return entries from the specified path.
+ * @return An enumeration of URL objects for each matching entry, or
+ * null
if an entry could not be found or if the
+ * caller does not have the appropriate
+ * AdminPermission[this,RESOURCE]
, and the Java
+ * Runtime Environment supports permissions. The URLs are sorted
+ * such that entries from this bundle are returned first followed by
+ * the entries from attached fragments in ascending bundle id order.
+ * If this bundle is a fragment, then only matching entries in this
+ * fragment are returned.
+ * @since 1.3
+ */
+ public Enumeration findEntries(String path, String filePattern,
+ bool recurse);
+
+ /**
+ * Returns this bundle's {@link BundleContext}. The returned
+ * BundleContext
can be used by the caller to act on behalf
+ * of this bundle.
+ *
+ *
+ * If this bundle is not in the {@link #STARTING}, {@link #ACTIVE}, or
+ * {@link #STOPPING} states or this bundle is a fragment bundle, then this
+ * bundle has no valid BundleContext
. This method will
+ * return null
if this bundle has no valid
+ * BundleContext
.
+ *
+ * @return A BundleContext
for this bundle or
+ * null
if this bundle has no valid
+ * BundleContext
.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate AdminPermission[this,CONTEXT]
, and
+ * the Java Runtime Environment supports permissions.
+ * @since 1.4
+ */
+ public BundleContext getBundleContext();
}
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.osgi/osgi/src/org/osgi/framework/BundleActivator.d
--- a/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleActivator.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleActivator.d Sun Nov 08 12:42:30 2009 +0100
@@ -1,8 +1,8 @@
/*
* $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleActivator.java,v 1.14 2007/02/21 16:49:05 hargrave Exp $
- *
+ *
* Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -16,12 +16,14 @@
* limitations under the License.
*/
+// Port to the D programming language:
+// Frank Benoit
module org.osgi.framework.BundleActivator;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
import java.lang.all;
+import org.osgi.framework.BundleContext; // packageimport
+
/**
* Customizes the starting and stopping of a bundle.
*
@@ -32,24 +34,24 @@
* guaranteed that the same instance's BundleActivator.stop
* method will be called when the bundle is to be stopped. The Framework must
* not concurrently call a BundleActivator
object.
- *
+ *
*
* BundleActivator
is specified through the
* Bundle-Activator
Manifest header. A bundle can only specify a
* single BundleActivator
in the Manifest file. Fragment bundles
* must not have a BundleActivator
. The form of the Manifest
* header is:
- *
+ *
*
* Bundle-Activator: class-name
- *
+ *
*
* where class-name
is a fully qualified Java classname.
*
* The specified BundleActivator
class must have a public
* constructor that takes no parameters so that a BundleActivator
* object can be created by Class.newInstance()
.
- *
+ *
* @NotThreadSafe
* @version $Revision: 1.14 $
*/
@@ -60,17 +62,17 @@
* bundle-specific activities necessary to start this bundle. This method
* can be used to register services or to allocate any resources that this
* bundle needs.
- *
+ *
*
* This method must complete and return to its caller in a timely manner.
- *
+ *
* @param context The execution context of the bundle being started.
* @throws java.lang.Exception If this method throws an exception, this
* bundle is marked as stopped and the Framework will remove this
* bundle's listeners, unregister all services registered by this
* bundle, and release all services used by this bundle.
*/
- public void start(BundleContext context);
+ public void start(BundleContext context) ;
/**
* Called when this bundle is stopped so the Framework can perform the
@@ -79,15 +81,15 @@
* method started. There should be no active threads that were started by
* this bundle when this bundle returns. A stopped bundle must not call any
* Framework objects.
- *
+ *
*
* This method must complete and return to its caller in a timely manner.
- *
+ *
* @param context The execution context of the bundle being stopped.
* @throws java.lang.Exception If this method throws an exception, the
* bundle is still marked as stopped, and the Framework will remove
* the bundle's listeners, unregister all services registered by the
* bundle, and release all services used by the bundle.
*/
- public void stop(BundleContext context);
+ public void stop(BundleContext context) ;
}
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.osgi/osgi/src/org/osgi/framework/BundleContext.d
--- a/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleContext.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleContext.d Sun Nov 08 12:42:30 2009 +0100
@@ -1,8 +1,8 @@
/*
* $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleContext.java,v 1.22 2007/02/21 16:49:05 hargrave Exp $
- *
+ *
* Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -16,16 +16,22 @@
* limitations under the License.
*/
+// Port to the D programming language:
+// Frank Benoit
module org.osgi.framework.BundleContext;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleListener;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.FrameworkListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.framework.Filter;
import java.lang.all;
+
+import org.osgi.framework.BundleListener; // packageimport
+import org.osgi.framework.BundleException; // packageimport
+import org.osgi.framework.ServiceListener; // packageimport
+import org.osgi.framework.InvalidSyntaxException; // packageimport
+import org.osgi.framework.ServiceRegistration; // packageimport
+import org.osgi.framework.ServiceReference; // packageimport
+import org.osgi.framework.Bundle; // packageimport
+import org.osgi.framework.Filter; // packageimport
+import org.osgi.framework.FrameworkListener; // packageimport
+
import java.io.File;
import java.io.InputStream;
import java.util.Dictionary;
@@ -34,7 +40,7 @@
* A bundle's execution context within the Framework. The context is used to
* grant access to other methods so that this bundle can interact with the
* Framework.
- *
+ *
*
* BundleContext
methods allow a bundle to:
*
@@ -49,7 +55,7 @@
* - Create
File
objects for files in a persistent storage
* area provided for the bundle by the Framework.
*
- *
+ *
*
* A BundleContext
object will be created and provided to the
* bundle associated with this context when it is started using the
@@ -59,11 +65,11 @@
* BundleContext
object is generally for the private use of its
* associated bundle and is not meant to be shared with other bundles in the
* OSGi environment.
- *
+ *
*
* The Bundle
object associated with a BundleContext
* object is called the context bundle.
- *
+ *
*
* The BundleContext
object is only valid during the execution of
* its context bundle; that is, during the period from when the context bundle
@@ -72,11 +78,11 @@
* object is used subsequently, an IllegalStateException
must be
* thrown. The BundleContext
object must never be reused after
* its context bundle is stopped.
- *
+ *
*
* The Framework is the only entity that can create BundleContext
* objects and they are only valid within the Framework that created them.
- *
+ *
* @ThreadSafe
* @version $Revision: 1.22 $
*/
@@ -86,7 +92,7 @@
* Returns the value of the specified property. If the key is not found in
* the Framework properties, the system properties are then searched. The
* method returns null
if the property is not found.
- *
+ *
*
* The Framework defines the following standard property keys:
*
@@ -106,12 +112,12 @@
*
*
* All bundles must have permission to read these properties.
- *
+ *
*
* Note: The last four standard properties are used by the
* {@link Constants#BUNDLE_NATIVECODE} Manifest
header's
* matching algorithm for selecting native language code.
- *
+ *
* @param key The name of the requested property.
* @return The value of the requested property, or null
if
* the property is undefined.
@@ -124,7 +130,7 @@
/**
* Returns the Bundle
object associated with this
* BundleContext
. This bundle is called the context bundle.
- *
+ *
* @return The Bundle
object associated with this
* BundleContext
.
* @throws java.lang.IllegalStateException If this BundleContext is no
@@ -139,38 +145,38 @@
*
* Every installed bundle is uniquely identified by its location string,
* typically in the form of a URL.
- *
+ *
*
* The following steps are required to install a bundle:
*
* - If a bundle containing the same location string is already
* installed, the
Bundle
object for that bundle is returned.
- *
+ *
* - The bundle's content is read from the location string. If this
* fails, a {@link BundleException} is thrown.
- *
+ *
*
- The bundle's
Bundle-NativeCode
dependencies are
* resolved. If this fails, a BundleException
is thrown.
- *
+ *
* - The bundle's associated resources are allocated. The associated
* resources minimally consist of a unique identifier and a persistent
* storage area if the platform has file system support. If this step fails,
* a
BundleException
is thrown.
- *
+ *
* - If the bundle has declared an Bundle-RequiredExecutionEnvironment
* header, then the listed execution environments must be verified against
- * the installed execution environments. If none of the listed execution
+ * the installed execution environments. If none of the listed execution
* environments match an installed execution environment, a
*
BundleException
must be thrown.
- *
+ *
* - The bundle's state is set to
INSTALLED
.
- *
+ *
* - A bundle event of type {@link BundleEvent#INSTALLED} is fired.
- *
+ *
*
- The
Bundle
object for the newly or previously
* installed bundle is returned.
*
- *
+ *
* Postconditions, no exceptions thrown
*
* getState()
in {INSTALLED
,RESOLVED
}.
@@ -180,7 +186,7 @@
*
* - Bundle is not installed and no trace of the bundle exists.
*
- *
+ *
* @param location The location identifier of the bundle to install.
* @return The Bundle
object of the installed bundle.
* @throws BundleException If the installation failed.
@@ -190,22 +196,22 @@
* @throws java.lang.IllegalStateException If this BundleContext is no
* longer valid.
*/
- public Bundle installBundle(String location);
+ public Bundle installBundle(String location) ;
/**
* Installs a bundle from the specified InputStream
object.
- *
+ *
*
* This method performs all of the steps listed in
* BundleContext.installBundle(String location)
, except that
* the bundle's content will be read from the InputStream
* object. The location identifier string specified will be used as the
* identity of the bundle.
- *
+ *
*
* This method must always close the InputStream
object, even
* if an exception is thrown.
- *
+ *
* @param location The location identifier of the bundle to install.
* @param input The InputStream
object from which this bundle
* will be read.
@@ -219,11 +225,11 @@
* longer valid.
* @see #installBundle(java.lang.String)
*/
- public Bundle installBundle(String location, InputStream input);
+ public Bundle installBundle(String location, InputStream input) ;
/**
* Returns the bundle with the specified identifier.
- *
+ *
* @param id The identifier of the bundle to retrieve.
* @return A Bundle
object or null
if the
* identifier does not match any installed bundle.
@@ -237,7 +243,7 @@
* environment at the time of the call to this method. However, since the
* Framework is a very dynamic environment, bundles can be installed or
* uninstalled at anytime.
- *
+ *
* @return An array of Bundle
objects, one object per
* installed bundle.
*/
@@ -249,19 +255,19 @@
* listeners. See {@link Filter} for a description of the filter syntax.
* ServiceListener
objects are notified when a service has a
* lifecycle state change.
- *
+ *
*
* If the context bundle's list of listeners already contains a listener
* l
such that (l==listener)
, then this
* method replaces that listener's filter (which may be null
)
* with the specified one (which may be null
).
- *
+ *
*
* The listener is called if the filter criteria is met. To filter based
* upon the class of the service, the filter should reference the
* {@link Constants#OBJECTCLASS} property. If filter
is
* null
, all services are considered to match the filter.
- *
+ *
*
* When using a filter
, it is possible that the
* ServiceEvent
s for the complete lifecycle of a service
@@ -275,43 +281,43 @@
* ServiceEvent
of type MODIFIED
. Thus, the
* listener will not be called with a ServiceEvent
of type
* REGISTERED
.
- *
+ *
*
* If the Java Runtime Environment supports permissions, the
* ServiceListener
object will be notified of a service event
* only if the bundle that is registering it has the
* ServicePermission
to get the service using at least one of
* the named classes the service was registered under.
- *
+ *
* @param listener The ServiceListener
object to be added.
* @param filter The filter criteria.
- *
+ *
* @throws InvalidSyntaxException If filter
contains an
* invalid filter string that cannot be parsed.
* @throws java.lang.IllegalStateException If this BundleContext is no
* longer valid.
- *
+ *
* @see ServiceEvent
* @see ServiceListener
* @see ServicePermission
*/
public void addServiceListener(ServiceListener listener,
- String filter);
+ String filter) ;
/**
* Adds the specified ServiceListener
object to the context
* bundle's list of listeners.
- *
+ *
*
* This method is the same as calling
* BundleContext.addServiceListener(ServiceListener listener,
* String filter)
* with filter
set to null
.
- *
+ *
* @param listener The ServiceListener
object to be added.
* @throws java.lang.IllegalStateException If this BundleContext is no
* longer valid.
- *
+ *
* @see #addServiceListener(ServiceListener, String)
*/
public void addServiceListener(ServiceListener listener);
@@ -319,11 +325,11 @@
/**
* Removes the specified ServiceListener
object from the
* context bundle's list of listeners.
- *
+ *
*
* If listener
is not contained in this context bundle's list
* of listeners, this method does nothing.
- *
+ *
* @param listener The ServiceListener
to be removed.
* @throws java.lang.IllegalStateException If this BundleContext is no
* longer valid.
@@ -334,12 +340,12 @@
* Adds the specified BundleListener
object to the context
* bundle's list of listeners if not already present. BundleListener objects
* are notified when a bundle has a lifecycle state change.
- *
+ *
*
* If the context bundle's list of listeners already contains a listener
* l
such that (l==listener)
, this method
* does nothing.
- *
+ *
* @param listener The BundleListener
to be added.
* @throws java.lang.IllegalStateException If this BundleContext is no
* longer valid.
@@ -347,7 +353,7 @@
* SynchronousBundleListener
and the caller does not
* have the appropriate AdminPermission[context bundle,LISTENER]
,
* and the Java Runtime Environment supports permissions.
- *
+ *
* @see BundleEvent
* @see BundleListener
*/
@@ -356,11 +362,11 @@
/**
* Removes the specified BundleListener
object from the
* context bundle's list of listeners.
- *
+ *
*
* If listener
is not contained in the context bundle's list
* of listeners, this method does nothing.
- *
+ *
* @param listener The BundleListener
object to be removed.
* @throws java.lang.IllegalStateException If this BundleContext is no
* longer valid.
@@ -375,16 +381,16 @@
* Adds the specified FrameworkListener
object to the context
* bundle's list of listeners if not already present. FrameworkListeners are
* notified of general Framework events.
- *
+ *
*
* If the context bundle's list of listeners already contains a listener
* l
such that (l==listener)
, this method
* does nothing.
- *
+ *
* @param listener The FrameworkListener
object to be added.
* @throws java.lang.IllegalStateException If this BundleContext is no
* longer valid.
- *
+ *
* @see FrameworkEvent
* @see FrameworkListener
*/
@@ -393,11 +399,11 @@
/**
* Removes the specified FrameworkListener
object from the
* context bundle's list of listeners.
- *
+ *
*
* If listener
is not contained in the context bundle's list
* of listeners, this method does nothing.
- *
+ *
* @param listener The FrameworkListener
object to be
* removed.
* @throws java.lang.IllegalStateException If this BundleContext is no
@@ -414,12 +420,12 @@
* bundles. The registering bundle is defined to be the context bundle.
* Other bundles can locate the service by using either the
* {@link #getServiceReferences} or {@link #getServiceReference} method.
- *
+ *
*
* A bundle can register a service object that implements the
* {@link ServiceFactory} interface to have more flexibility in providing
* service objects to other bundles.
- *
+ *
*
* The following steps are required to register a service:
*
@@ -441,7 +447,7 @@
* - A
ServiceRegistration
object for this registration is
* returned.
*
- *
+ *
* @param clazzes The class names under which the service can be located.
* The class names in this array will be stored in the service's
* properties under the key {@link Constants#OBJECTCLASS}.
@@ -455,11 +461,11 @@
* {@link ServiceRegistration#setProperties} method must be called.
* The set of properties may be null
if the service
* has no properties.
- *
+ *
* @return A ServiceRegistration
object for use by the bundle
* registering the service to update the service's properties or to
* unregister the service.
- *
+ *
* @throws java.lang.IllegalArgumentException If one of the following is
* true:
*
@@ -470,15 +476,15 @@
* properties
contains case variants of the same
* key name.
*
- *
+ *
* @throws java.lang.SecurityException If the caller does not have the
* ServicePermission
to register the service for all
* the named classes and the Java Runtime Environment supports
* permissions.
- *
+ *
* @throws java.lang.IllegalStateException If this BundleContext is no
* longer valid.
- *
+ *
* @see ServiceRegistration
* @see ServiceFactory
*/
@@ -488,7 +494,7 @@
/**
* Registers the specified service object with the specified properties
* under the specified class name with the Framework.
- *
+ *
*
* This method is otherwise identical to
* {@link #registerService(java.lang.String[], java.lang.Object,
@@ -497,16 +503,16 @@
* Note that even in this case the value of the service's
* {@link Constants#OBJECTCLASS} property will be an array of strings,
* rather than just a single string.
- *
+ *
* @param clazz The class name under which the service can be located.
* @param service The service object or a ServiceFactory
* object.
- * @param properties The properties for this service.
- *
+ * @param properties The properties for this service.
+ *
* @return A ServiceRegistration
object for use by the bundle
* registering the service to update the service's properties or to
* unregister the service.
- *
+ *
* @throws java.lang.IllegalStateException If this BundleContext is no
* longer valid.
* @see #registerService(java.lang.String[], java.lang.Object,
@@ -522,23 +528,23 @@
* criteria, and the packages for the class names under which the services
* were registered match the context bundle's packages as defined in
* {@link ServiceReference#isAssignableTo(Bundle, String)}.
- *
+ *
*
* The list is valid at the time of the call to this method, however since
* the Framework is a very dynamic environment, services can be modified or
* unregistered at anytime.
- *
+ *
*
* filter
is used to select the registered service whose
* properties objects contain keys and values which satisfy the filter. See
* {@link Filter} for a description of the filter string syntax.
- *
+ *
*
* If filter
is null
, all registered services
* are considered to match the filter. If filter
cannot be
* parsed, an {@link InvalidSyntaxException} will be thrown with a human
* readable message where the filter became unparsable.
- *
+ *
*
* The following steps are required to select a set of
* ServiceReference
objects:
@@ -573,7 +579,7 @@
*
- An array of the remaining
ServiceReference
objects is
* returned.
*
- *
+ *
* @param clazz The class name with which the service was registered or
* null
for all services.
* @param filter The filter criteria.
@@ -586,30 +592,30 @@
* longer valid.
*/
public ServiceReference[] getServiceReferences(String clazz,
- String filter);
+ String filter) ;
/**
* Returns an array of ServiceReference
objects. The returned
* array of ServiceReference
objects contains services that
* were registered under the specified class and match the specified filter
* criteria.
- *
+ *
*
* The list is valid at the time of the call to this method, however since
* the Framework is a very dynamic environment, services can be modified or
* unregistered at anytime.
- *
+ *
*
* filter
is used to select the registered service whose
* properties objects contain keys and values which satisfy the filter. See
* {@link Filter} for a description of the filter string syntax.
- *
+ *
*
* If filter
is null
, all registered services
* are considered to match the filter. If filter
cannot be
* parsed, an {@link InvalidSyntaxException} will be thrown with a human
* readable message where the filter became unparsable.
- *
+ *
*
* The following steps are required to select a set of
* ServiceReference
objects:
@@ -635,7 +641,7 @@
*
- An array of the remaining
ServiceReference
objects is
* returned.
*
- *
+ *
* @param clazz The class name with which the service was registered or
* null
for all services.
* @param filter The filter criteria.
@@ -649,17 +655,17 @@
* @since 1.3
*/
public ServiceReference[] getAllServiceReferences(String clazz,
- String filter);
+ String filter) ;
/**
* Returns a ServiceReference
object for a service that
* implements and was registered under the specified class.
- *
+ *
*
* This ServiceReference
object is valid at the time of the
* call to this method, however as the Framework is a very dynamic
* environment, services can be modified or unregistered at anytime.
- *
+ *
*
* This method is the same as calling
* {@link BundleContext#getServiceReferences(String, String)} with a
@@ -673,7 +679,7 @@
* If there is a tie in ranking, the service with the lowest service ID (as
* specified in its {@link Constants#SERVICE_ID} property); that is, the
* service that was registered first is returned.
- *
+ *
* @param clazz The class name with which the service was registered.
* @return A ServiceReference
object, or null
* if no services are registered which implement the named class.
@@ -695,11 +701,11 @@
*
* When a bundle's use count for a service drops to zero, the bundle should
* no longer use that service.
- *
+ *
*
* This method will always return null
when the service
* associated with this reference
has been unregistered.
- *
+ *
*
* The following steps are required to get the service object:
*
@@ -723,7 +729,7 @@
* type {@link FrameworkEvent#ERROR} is fired.
* - The service object for the service is returned.
*
- *
+ *
* @param reference A reference to the service.
* @return A service object for the service associated with
* reference
or null
if the service is
@@ -746,12 +752,12 @@
* for the service is zero, this method returns false
.
* Otherwise, the context bundle's use count for the service is decremented
* by one.
- *
+ *
*
* The service's service object should no longer be used and all references
* to it should be destroyed when a bundle's use count for the service drops
* to zero.
- *
+ *
*
* The following steps are required to unget the service object:
*
@@ -766,7 +772,7 @@
* method is called to release the service object for the context bundle.
* true
is returned.
*
- *
+ *
* @param reference A reference to the service to be released.
* @return false
if the context bundle's use count for the
* service is zero or if the service has been unregistered;
@@ -782,20 +788,20 @@
* Creates a File
object for a file in the persistent storage
* area provided for the bundle by the Framework. This method will return
* null
if the platform does not have file system support.
- *
+ *
*
* A File
object for the base directory of the persistent
* storage area provided for the context bundle by the Framework can be
* obtained by calling this method with an empty string as
* filename
.
- *
+ *
*
* If the Java Runtime Environment supports permissions, the Framework will
* ensure that the bundle has the java.io.FilePermission
with
* actions read
,write
,delete
* for all files (recursively) in the persistent storage area provided for
* the context bundle.
- *
+ *
* @param filename A relative name to the file to be accessed.
* @return A File
object that represents the requested file
* or null
if the platform does not have file system
@@ -809,11 +815,11 @@
* Creates a Filter
object. This Filter
object
* may be used to match a ServiceReference
object or a
* Dictionary
object.
- *
+ *
*
* If the filter cannot be parsed, an {@link InvalidSyntaxException} will be
* thrown with a human readable message where the filter became unparsable.
- *
+ *
* @param filter The filter string.
* @return A Filter
object encapsulating the filter string.
* @throws InvalidSyntaxException If filter
contains an
@@ -821,10 +827,10 @@
* @throws NullPointerException If filter
is null.
* @throws java.lang.IllegalStateException If this BundleContext is no
* longer valid.
- *
+ *
* @since 1.1
* @see "Framework specification for a description of the filter string syntax."
* @see FrameworkUtil#createFilter(String)
*/
- public Filter createFilter(String filter);
+ public Filter createFilter(String filter) ;
}
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.osgi/osgi/src/org/osgi/framework/BundleEvent.d
--- a/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleEvent.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleEvent.d Sun Nov 08 12:42:30 2009 +0100
@@ -1,8 +1,8 @@
/*
* $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleEvent.java,v 1.19 2007/02/20 00:14:12 hargrave Exp $
- *
+ *
* Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -16,8 +16,13 @@
* limitations under the License.
*/
+// Port to the D programming language:
+// Frank Benoit
module org.osgi.framework.BundleEvent;
-import org.osgi.framework.Bundle;
+
+import java.lang.all;
+
+import org.osgi.framework.Bundle; // packageimport
import java.util.EventObject;
@@ -28,10 +33,10 @@
* SynchronousBundleListener
s and BundleListener
s
* when a change occurs in a bundle's lifecycle. A type code is used to identify
* the event type for future extendability.
- *
+ *
*
* OSGi Alliance reserves the right to extend the set of types.
- *
+ *
* @Immutable
* @see BundleListener
* @see SynchronousBundleListener
@@ -54,7 +59,7 @@
* The bundle has been installed.
*
* The value of INSTALLED
is 0x00000001.
- *
+ *
* @see BundleContext#installBundle(String)
*/
public final static int INSTALLED = 0x00000001;
@@ -67,7 +72,7 @@
* has been executed if the bundle has a bundle activator class.
*
* The value of STARTED
is 0x00000002.
- *
+ *
* @see Bundle#start()
*/
public final static int STARTED = 0x00000002;
@@ -80,7 +85,7 @@
* has been executed if the bundle has a bundle activator class.
*
* The value of STOPPED
is 0x00000004.
- *
+ *
* @see Bundle#stop()
*/
public final static int STOPPED = 0x00000004;
@@ -89,7 +94,7 @@
* The bundle has been updated.
*
* The value of UPDATED
is 0x00000008.
- *
+ *
* @see Bundle#update()
*/
public final static int UPDATED = 0x00000008;
@@ -98,7 +103,7 @@
* The bundle has been uninstalled.
*
* The value of UNINSTALLED
is 0x00000010.
- *
+ *
* @see Bundle#uninstall
*/
public final static int UNINSTALLED = 0x00000010;
@@ -107,7 +112,7 @@
* The bundle has been resolved.
*
* The value of RESOLVED
is 0x00000020.
- *
+ *
* @see Bundle#RESOLVED
* @since 1.3
*/
@@ -117,7 +122,7 @@
* The bundle has been unresolved.
*
* The value of UNRESOLVED
is 0x00000040.
- *
+ *
* @see Bundle#INSTALLED
* @since 1.3
*/
@@ -133,7 +138,7 @@
* delivered to BundleListener
s.
*
* The value of STARTING
is 0x00000080.
- *
+ *
* @see Bundle#start()
* @since 1.3
*/
@@ -149,7 +154,7 @@
* delivered to BundleListener
s.
*
* The value of STOPPING
is 0x00000100.
- *
+ *
* @see Bundle#stop()
* @since 1.3
*/
@@ -166,20 +171,20 @@
* BundleListener
s.
*
* The value of LAZY_ACTIVATION
is 0x00000200.
- *
+ *
* @since 1.4
*/
public final static int LAZY_ACTIVATION = 0x00000200;
/**
* Creates a bundle event of the specified type.
- *
+ *
* @param type The event type.
* @param bundle The bundle which had a lifecycle change.
*/
public this(int type, Bundle bundle) {
- super(cast(Object)bundle);
+ super(bundle);
this.bundle = bundle;
this.type = type;
}
@@ -187,7 +192,7 @@
/**
* Returns the bundle which had a lifecycle change. This bundle is the
* source of the event.
- *
+ *
* @return The bundle that had a change occur in its lifecycle.
*/
public Bundle getBundle() {
@@ -208,7 +213,7 @@
*
- {@link #UNRESOLVED}
*
- {@link #UNINSTALLED}
*
- *
+ *
* @return The type of lifecycle event.
*/
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.osgi/osgi/src/org/osgi/framework/BundleListener.d
--- a/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleListener.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.osgi/osgi/src/org/osgi/framework/BundleListener.d Sun Nov 08 12:42:30 2009 +0100
@@ -1,8 +1,8 @@
/*
* $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleListener.java,v 1.13 2007/02/21 16:49:05 hargrave Exp $
- *
+ *
* Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -16,10 +16,14 @@
* limitations under the License.
*/
+// Port to the D programming language:
+// Frank Benoit
module org.osgi.framework.BundleListener;
-import org.osgi.framework.BundleEvent;
import java.lang.all;
+
+import org.osgi.framework.BundleEvent; // packageimport
+
import java.util.EventListener;
/**
@@ -35,7 +39,7 @@
* BundleListener
s are called with a BundleEvent
* object when a bundle has been installed, resolved, started, stopped, updated,
* unresolved, or uninstalled.
- *
+ *
* @see BundleEvent
* @NotThreadSafe
* @version $Revision: 1.13 $
@@ -44,7 +48,7 @@
public interface BundleListener : EventListener {
/**
* Receives notification that a bundle has had a lifecycle change.
- *
+ *
* @param event The BundleEvent
.
*/
public void bundleChanged(BundleEvent event);
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.osgi/osgi/src/org/osgi/framework/Filter.d
--- a/org.eclipse.osgi/osgi/src/org/osgi/framework/Filter.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.osgi/osgi/src/org/osgi/framework/Filter.d Sun Nov 08 12:42:30 2009 +0100
@@ -1,8 +1,8 @@
/*
* $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Filter.java,v 1.16 2007/02/21 16:49:05 hargrave Exp $
- *
+ *
* Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -15,10 +15,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+// Port to the D programming language:
+// Frank Benoit
module org.osgi.framework.Filter;
-import org.osgi.framework.ServiceReference;
import java.lang.all;
+
+import org.osgi.framework.ServiceReference; // packageimport
+
import java.util.Dictionary;
/**
@@ -32,14 +36,14 @@
* Filter
object.
*
* Some examples of LDAP filters are:
- *
+ *
*
* "(cn=Babs Jensen)"
* "(!(cn=Tim Howes))"
* "(&(" + Constants.OBJECTCLASS + "=Person)(|(sn=Jensen)(cn=Babs J*)))"
* "(o=univ*of*mich*)"
*
- *
+ *
* @since 1.1
* @see "Core Specification, section 5.5, for a description of the filter string
* syntax."
@@ -53,10 +57,10 @@
* The filter is executed using the keys and values of the referenced
* service's properties. The keys are case insensitively matched with the
* filter.
- *
+ *
* @param reference The reference to the service whose properties are used
* in the match.
- *
+ *
* @return true
if the service's properties match this
* filter; false
otherwise.
*/
@@ -66,14 +70,14 @@
* Filter using a Dictionary
object. The Filter is executed
* using the Dictionary
object's keys and values. The keys
* are case insensitively matched with the filter.
- *
+ *
* @param dictionary The Dictionary
object whose keys are
* used in the match.
- *
+ *
* @return true
if the Dictionary
object's
* keys and values match this filter; false
* otherwise.
- *
+ *
* @throws IllegalArgumentException If dictionary
contains
* case variants of the same key name.
*/
@@ -84,43 +88,43 @@
*
* The filter string is normalized by removing whitespace which does not
* affect the meaning of the filter.
- *
+ *
* @return Filter string.
*/
public String toString();
/**
* Compares this Filter
object to another object.
- *
+ *
* @param obj The object to compare against this Filter
* object.
- *
+ *
* @return If the other object is a Filter
object, then
* returns this.toString().equals(obj.toString()
;false
* otherwise.
*/
- public bool equals(Object obj);
+ public equals_t opEquals(Object obj);
/**
* Returns the hashCode for this Filter
object.
- *
+ *
* @return The hashCode of the filter string; that is,
* this.toString().hashCode()
.
*/
- public int hashCode();
+ public hash_t toHash();
/**
* Filter with case sensitivity using a Dictionary
object.
* The Filter is executed using the Dictionary
object's keys
* and values. The keys are case sensitively matched with the filter.
- *
+ *
* @param dictionary The Dictionary
object whose keys are
* used in the match.
- *
+ *
* @return true
if the Dictionary
object's
* keys and values match this filter; false
* otherwise.
- *
+ *
* @since 1.3
*/
public bool matchCase(Dictionary dictionary);
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkEvent.d
--- a/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkEvent.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkEvent.d Sun Nov 08 12:42:30 2009 +0100
@@ -1,8 +1,8 @@
/*
* $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/FrameworkEvent.java,v 1.15 2007/02/20 00:14:12 hargrave Exp $
- *
+ *
* Copyright (c) OSGi Alliance (2004, 2007). All Rights Reserved.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -16,24 +16,28 @@
* limitations under the License.
*/
+// Port to the D programming language:
+// Frank Benoit
module org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.Bundle;
import java.lang.all;
+
+import org.osgi.framework.Bundle; // packageimport
+
import java.util.EventObject;
/**
* A general event from the Framework.
- *
+ *
*
* FrameworkEvent
objects are delivered to
* FrameworkListener
s when a general event occurs within the
* OSGi environment. A type code is used to identify the event type for future
* extendability.
- *
+ *
*
* OSGi Alliance reserves the right to extend the set of event types.
- *
+ *
* @Immutable
* @see FrameworkListener
* @version $Revision: 1.15 $
@@ -58,25 +62,25 @@
/**
* The Framework has started.
- *
+ *
*
* This event is fired when the Framework has started after all installed
* bundles that are marked to be started have been started and the Framework
* has reached the intitial start level.
- *
+ *
*
* The value of STARTED
is 0x00000001.
- *
+ *
* @see "StartLevel
"
*/
public final static int STARTED = 0x00000001;
/**
* An error has occurred.
- *
+ *
*
* There was an error associated with a bundle.
- *
+ *
*
* The value of ERROR
is 0x00000002.
*/
@@ -84,14 +88,14 @@
/**
* A PackageAdmin.refreshPackage operation has completed.
- *
+ *
*
* This event is fired when the Framework has completed the refresh packages
* operation initiated by a call to the PackageAdmin.refreshPackages method.
- *
+ *
*
* The value of PACKAGES_REFRESHED
is 0x00000004.
- *
+ *
* @since 1.2
* @see "PackageAdmin.refreshPackages
"
*/
@@ -99,14 +103,14 @@
/**
* A StartLevel.setStartLevel operation has completed.
- *
+ *
*
* This event is fired when the Framework has completed changing the active
* start level initiated by a call to the StartLevel.setStartLevel method.
- *
+ *
*
* The value of STARTLEVEL_CHANGED
is 0x00000008.
- *
+ *
* @since 1.2
* @see "StartLevel
"
*/
@@ -114,33 +118,33 @@
/**
* A warning has occurred.
- *
+ *
*
* There was a warning associated with a bundle.
- *
+ *
*
* The value of WARNING
is 0x00000010.
- *
+ *
* @since 1.3
*/
public final static int WARNING = 0x00000010;
/**
* An informational event has occurred.
- *
+ *
*
* There was an informational event associated with a bundle.
- *
+ *
*
* The value of INFO
is 0x00000020.
- *
+ *
* @since 1.3
*/
public final static int INFO = 0x00000020;
/**
* Creates a Framework event.
- *
+ *
* @param type The event type.
* @param source The event source object. This may not be null
.
* @deprecated As of 1.2. This constructor is deprecated in favor of using
@@ -156,14 +160,14 @@
/**
* Creates a Framework event regarding the specified bundle.
- *
+ *
* @param type The event type.
* @param bundle The event source.
* @param throwable The related exception. This argument may be
* null
if there is no related exception.
*/
public this(int type, Bundle bundle, Throwable throwable) {
- super(cast(Object)bundle);
+ super(bundle);
this.type = type;
this.bundle = bundle;
this.throwable = throwable;
@@ -171,7 +175,7 @@
/**
* Returns the exception related to this event.
- *
+ *
* @return The related exception or null
if none.
*/
public Throwable getThrowable() {
@@ -181,7 +185,7 @@
/**
* Returns the bundle associated with the event. This bundle is also the
* source of the event.
- *
+ *
* @return The bundle associated with the event.
*/
public Bundle getBundle() {
@@ -200,7 +204,7 @@
*
{@link #PACKAGES_REFRESHED}
* {@link #STARTLEVEL_CHANGED}
*
- *
+ *
* @return The type of state change.
*/
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkListener.d
--- a/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkListener.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkListener.d Sun Nov 08 12:42:30 2009 +0100
@@ -1,8 +1,8 @@
/*
* $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/FrameworkListener.java,v 1.12 2007/02/21 16:49:05 hargrave Exp $
- *
+ *
* Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -16,10 +16,14 @@
* limitations under the License.
*/
+// Port to the D programming language:
+// Frank Benoit
module org.osgi.framework.FrameworkListener;
-import org.osgi.framework.FrameworkEvent;
import java.lang.all;
+
+import org.osgi.framework.FrameworkEvent; // packageimport
+
import java.util.EventListener;
/**
@@ -29,14 +33,14 @@
* FrameworkListener
. The Framework delivers
* FrameworkEvent
objects to a FrameworkListener
* in order and must not concurrently call a FrameworkListener
.
- *
+ *
*
* A FrameworkListener
object is registered with the Framework
* using the {@link BundleContext#addFrameworkListener} method.
* FrameworkListener
objects are called with a
* FrameworkEvent
objects when the Framework starts and when
* asynchronous errors occur.
- *
+ *
* @see FrameworkEvent
* @NotThreadSafe
* @version $Revision: 1.12 $
@@ -46,7 +50,7 @@
/**
* Receives notification of a general FrameworkEvent
object.
- *
+ *
* @param event The FrameworkEvent
object.
*/
public void frameworkEvent(FrameworkEvent event);
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceEvent.d
--- a/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceEvent.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceEvent.d Sun Nov 08 12:42:30 2009 +0100
@@ -1,8 +1,8 @@
/*
* $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceEvent.java,v 1.15 2007/02/20 00:14:12 hargrave Exp $
- *
+ *
* Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -16,10 +16,14 @@
* limitations under the License.
*/
+// Port to the D programming language:
+// Frank Benoit
module org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceReference;
+
+import java.lang.all;
-import java.lang.util;
+import org.osgi.framework.ServiceReference; // packageimport
+
import java.util.EventObject;
/**
@@ -29,10 +33,10 @@
* ServiceListener
s and AllServiceListener
s when
* a change occurs in this service's lifecycle. A type code is used to identify
* the event type for future extendability.
- *
+ *
*
* OSGi Alliance reserves the right to extend the set of types.
- *
+ *
* @Immutable
* @see ServiceListener
* @see AllServiceListener
@@ -56,10 +60,10 @@
*
* This event is synchronously delivered after the service
* has been registered with the Framework.
- *
+ *
*
* The value of REGISTERED
is 0x00000001.
- *
+ *
* @see BundleContext#registerService(String[],Object,java.util.Dictionary)
*/
public final static int REGISTERED = 0x00000001;
@@ -69,10 +73,10 @@
*
* This event is synchronously delivered after the service
* properties have been modified.
- *
+ *
*
* The value of MODIFIED
is 0x00000002.
- *
+ *
* @see ServiceRegistration#setProperties
*/
public final static int MODIFIED = 0x00000002;
@@ -82,17 +86,17 @@
*
* This event is synchronously delivered before the
* service has completed unregistering.
- *
+ *
*
* If a bundle is using a service that is UNREGISTERING
, the
* bundle should release its use of the service when it receives this event.
* If the bundle does not release its use of the service when it receives
* this event, the Framework will automatically release the bundle's use of
* the service while completing the service unregistration operation.
- *
+ *
*
* The value of UNREGISTERING is 0x00000004.
- *
+ *
* @see ServiceRegistration#unregister
* @see BundleContext#ungetService
*/
@@ -100,13 +104,13 @@
/**
* Creates a new service event object.
- *
+ *
* @param type The event type.
* @param reference A ServiceReference
object to the service
* that had a lifecycle change.
*/
public this(int type, ServiceReference reference) {
- super(cast(Object)reference);
+ super(reference);
this.reference = reference;
this.type = type;
}
@@ -116,7 +120,7 @@
* lifecycle.
*
* This reference is the source of the event.
- *
+ *
* @return Reference to the service that had a lifecycle change.
*/
public ServiceReference getServiceReference() {
@@ -130,7 +134,7 @@
*
{@link #MODIFIED}
* {@link #UNREGISTERING}
*
- *
+ *
* @return Type of service lifecycle change.
*/
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceListener.d
--- a/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceListener.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceListener.d Sun Nov 08 12:42:30 2009 +0100
@@ -1,8 +1,8 @@
/*
* $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceListener.java,v 1.15 2007/02/20 00:16:30 hargrave Exp $
- *
+ *
* Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -16,10 +16,14 @@
* limitations under the License.
*/
+// Port to the D programming language:
+// Frank Benoit
module org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceEvent;
import java.lang.all;
+
+import org.osgi.framework.ServiceEvent; // packageimport
+
import java.util.EventListener;
/**
@@ -30,14 +34,14 @@
* ServiceEvent
objects to a ServiceListener
out
* of order and may concurrently call and/or reenter a
* ServiceListener
.
- *
+ *
*
* A ServiceListener
object is registered with the Framework
* using the BundleContext.addServiceListener
method.
* ServiceListener
objects are called with a
* ServiceEvent
object when a service is registered, modified, or
* is in the process of unregistering.
- *
+ *
*
* ServiceEvent
object delivery to ServiceListener
* objects is filtered by the filter specified when the listener was registered.
@@ -46,12 +50,12 @@
* the listener if the bundle which defines the listener object's class has the
* appropriate ServicePermission
to get the service using at
* least one of the named classes under which the service was registered.
- *
+ *
*
* ServiceEvent
object delivery to ServiceListener
* objects is further filtered according to package sources as defined in
* {@link ServiceReference#isAssignableTo(Bundle, String)}.
- *
+ *
* @see ServiceEvent
* @see ServicePermission
* @ThreadSafe
@@ -61,7 +65,7 @@
public interface ServiceListener : EventListener {
/**
* Receives notification that a service has had a lifecycle change.
- *
+ *
* @param event The ServiceEvent
object.
*/
public void serviceChanged(ServiceEvent event);
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.d
--- a/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceReference.d Sun Nov 08 12:42:30 2009 +0100
@@ -1,8 +1,8 @@
/*
* $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceReference.java,v 1.20 2007/02/21 16:49:05 hargrave Exp $
- *
+ *
* Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -16,14 +16,17 @@
* limitations under the License.
*/
+// Port to the D programming language:
+// Frank Benoit
module org.osgi.framework.ServiceReference;
-import org.osgi.framework.Bundle;
import java.lang.all;
+import org.osgi.framework.Bundle; // packageimport
+
/**
* A reference to a service.
- *
+ *
*
* The Framework returns ServiceReference
objects from the
* BundleContext.getServiceReference
and
@@ -44,7 +47,7 @@
* If the same service object is registered multiple times,
* ServiceReference
objects associated with different
* ServiceRegistration
objects are not equal.
- *
+ *
* @see BundleContext#getServiceReference
* @see BundleContext#getServiceReferences
* @see BundleContext#getService
@@ -57,16 +60,16 @@
* Returns the property value to which the specified property key is mapped
* in the properties Dictionary
object of the service
* referenced by this ServiceReference
object.
- *
+ *
*
* Property keys are case-insensitive.
- *
+ *
*
* This method must continue to return property values after the service has
* been unregistered. This is so references to unregistered services (for
* example, ServiceReference
objects stored in the log) can
* still be interrogated.
- *
+ *
* @param key The property key.
* @return The property value to which the key is mapped; null
* if there is no property named after the key.
@@ -77,20 +80,20 @@
* Returns an array of the keys in the properties Dictionary
* object of the service referenced by this ServiceReference
* object.
- *
+ *
*
* This method will continue to return the keys after the service has been
* unregistered. This is so references to unregistered services (for
* example, ServiceReference
objects stored in the log) can
* still be interrogated.
- *
+ *
*
* This method is case-preserving ; this means that every key in the
* returned array must have the same case as the corresponding key in the
* properties Dictionary
that was passed to the
* {@link BundleContext#registerService(String[],Object,java.util.Dictionary)}
* or {@link ServiceRegistration#setProperties} methods.
- *
+ *
* @return An array of property keys.
*/
public String[] getPropertyKeys();
@@ -98,12 +101,12 @@
/**
* Returns the bundle that registered the service referenced by this
* ServiceReference
object.
- *
+ *
*
* This method must return null
when the service has been
* unregistered. This can be used to determine if the service has been
* unregistered.
- *
+ *
* @return The bundle that registered the service referenced by this
* ServiceReference
object; null
if
* that service has already been unregistered.
@@ -115,12 +118,12 @@
* Returns the bundles that are using the service referenced by this
* ServiceReference
object. Specifically, this method returns
* the bundles whose usage count for that service is greater than zero.
- *
+ *
* @return An array of bundles whose usage count for the service referenced
* by this ServiceReference
object is greater than
* zero; null
if no bundles are currently using that
* service.
- *
+ *
* @since 1.1
*/
public Bundle[] getUsingBundles();
@@ -142,14 +145,14 @@
* package source of the specified bundle then return true
;
* otherwise return false
.
*
- *
+ *
* @param bundle The Bundle
object to check.
* @param className The class name to check.
* @return true
if the bundle which registered the service
* referenced by this ServiceReference
and the
* specified bundle use the same source for the package of the
* specified class name. Otherwise false
is returned.
- *
+ *
* @since 1.3
*/
public bool isAssignableTo(Bundle bundle, String className);
@@ -157,7 +160,7 @@
/**
* Compares this ServiceReference
with the specified
* ServiceReference
for order.
- *
+ *
*
* If this ServiceReference
and the specified
* ServiceReference
have the same
@@ -172,7 +175,7 @@
* ServiceReference
if it has a higher
* {@link Constants#SERVICE_ID service id} and greater if it has a lower
* service id.
- *
+ *
* @param reference The ServiceReference
to be compared.
* @return Returns a negative integer, zero, or a positive integer if this
* ServiceReference
is less than, equal to, or
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceRegistration.d
--- a/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceRegistration.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.osgi/osgi/src/org/osgi/framework/ServiceRegistration.d Sun Nov 08 12:42:30 2009 +0100
@@ -1,8 +1,8 @@
/*
* $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceRegistration.java,v 1.14 2007/02/21 16:49:05 hargrave Exp $
- *
+ *
* Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -16,15 +16,19 @@
* limitations under the License.
*/
+// Port to the D programming language:
+// Frank Benoit
module org.osgi.framework.ServiceRegistration;
-import org.osgi.framework.ServiceReference;
import java.lang.all;
+
+import org.osgi.framework.ServiceReference; // packageimport
+
import java.util.Dictionary;
/**
* A registered service.
- *
+ *
*
* The Framework returns a ServiceRegistration
object when a
* BundleContext.registerService
method invocation is successful.
@@ -33,7 +37,7 @@
*
* The ServiceRegistration
object may be used to update the
* properties of the service or to unregister the service.
- *
+ *
* @see BundleContext#registerService(String[],Object,Dictionary)
* @ThreadSafe
* @version $Revision: 1.14 $
@@ -46,7 +50,7 @@
*
* The ServiceReference
object may be shared with other
* bundles.
- *
+ *
* @throws java.lang.IllegalStateException If this
* ServiceRegistration
object has already been
* unregistered.
@@ -56,12 +60,12 @@
/**
* Updates the properties associated with a service.
- *
+ *
*
* The {@link Constants#OBJECTCLASS} and {@link Constants#SERVICE_ID} keys
* cannot be modified by this method. These values are set by the Framework
* when the service is registered in the OSGi environment.
- *
+ *
*
* The following steps are required to modify service properties:
*
@@ -69,12 +73,12 @@
* - A service event of type {@link ServiceEvent#MODIFIED} is
* fired.
*
- *
+ *
* @param properties The properties for this service. See {@link Constants}
* for a list of standard service property keys. Changes should not
* be made to this object after calling this method. To update the
* service's properties this method should be called again.
- *
+ *
* @throws IllegalStateException If this ServiceRegistration
* object has already been unregistered.
* @throws IllegalArgumentException If properties
contains
@@ -87,7 +91,7 @@
* from the Framework service registry. All ServiceReference
* objects associated with this ServiceRegistration
object
* can no longer be used to interact with the service.
- *
+ *
*
* The following steps are required to unregister a service:
*
@@ -104,7 +108,7 @@
* ServiceFactory.ungetService
method is called to release
* the service object for the bundle.
*
- *
+ *
* @throws java.lang.IllegalStateException If this
* ServiceRegistration
object has already been
* unregistered.
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.d
--- a/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.d Sun Nov 08 12:42:30 2009 +0100
@@ -1,8 +1,8 @@
/*
* $Header: /cvshome/build/org.osgi.util.tracker/src/org/osgi/util/tracker/ServiceTracker.java,v 1.22 2006/07/20 16:14:43 hargrave Exp $
- *
+ *
* Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -16,21 +16,25 @@
* limitations under the License.
*/
+// Port to the D programming language:
+// Frank Benoit
module org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
import java.lang.all;
+
+import org.osgi.util.tracker.ServiceTrackerCustomizer; // packageimport
+
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.LinkedList;
-//FIXME tmp remove: import org.eclipse.osgi.framework.internal.core.FilterImpl;
-//FIXME tmp remove: import org.osgi.framework.AllServiceListener;
+import org.eclipse.osgi.framework.internal.core.FilterImpl;
+import org.osgi.framework.AllServiceListener;
import org.osgi.framework.BundleContext;
-//FIXME tmp remove: import org.osgi.framework.Constants;
+import org.osgi.framework.Constants;
import org.osgi.framework.Filter;
-//FIXME tmp remove: import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceReference;
@@ -58,7 +62,7 @@
* ServiceTrackerCustomizer
object while holding any locks.
* ServiceTrackerCustomizer
implementations must also be
* thread-safe.
- *
+ *
* @ThreadSafe
* @version $Revision: 1.29 $
*/
@@ -70,48 +74,8 @@
*/
public class ServiceTracker : ServiceTrackerCustomizer {
- public this(BundleContext context, ServiceReference reference, ServiceTrackerCustomizer customizer) {
- implMissing(__FILE__,__LINE__);
- }
- public this(BundleContext context, String clazz, ServiceTrackerCustomizer customizer) {
- implMissing(__FILE__,__LINE__);
- }
- public this(BundleContext context, Filter filter, ServiceTrackerCustomizer customizer) {
- implMissing(__FILE__,__LINE__);
- }
- public Object addingService(ServiceReference reference){
- implMissing(__FILE__,__LINE__);
- return null;
- }
- public void modifiedService(ServiceReference reference, Object service){
- implMissing(__FILE__,__LINE__);
- }
- public void removedService(ServiceReference reference, Object service){
- implMissing(__FILE__,__LINE__);
- }
- public void open() {
- implMissing(__FILE__,__LINE__);
- }
- public void open( bool trackAll) {
- implMissing(__FILE__,__LINE__);
- }
- public synchronized void close() {
- implMissing(__FILE__,__LINE__);
- }
- public Object getService(ServiceReference reference) {
- implMissing(__FILE__,__LINE__);
- return null;
- }
- public Object getService() {
- implMissing(__FILE__,__LINE__);
- return null;
- }
-}
-//FIXME Dummy class
-/+++
-public class ServiceTracker : ServiceTrackerCustomizer {
- /* set this to true to compile in debug messages */
- static final bool DEBUG = false;
+ /* set this to true to compile in_ debug_ messages */
+ static final bool DEBUG = false;
/**
* Bundle context against which this ServiceTracker
object is
* tracking.
@@ -119,7 +83,7 @@
protected final BundleContext context;
/**
* Filter specifying search criteria for the services to track.
- *
+ *
* @since 1.1
*/
protected final Filter filter;
@@ -145,40 +109,40 @@
* True if no Filter object was supplied in a constructor or we are not
* using the supplied filter.
*/
- final bool noUserFilter;
+ final bool noUserFilter;
/**
* Tracked services: ServiceReference
object -> customized
* Object and ServiceListener
object
*/
- private volatile Tracked tracked;
+ private /+volatile+/ Tracked tracked;
/**
* Modification count. This field is initialized to zero by open, set to -1
* by close and incremented by modified.
- *
+ *
* This field is volatile since it is accessed by multiple threads.
*/
- private volatile int trackingCount = -1;
+ private /+volatile+/ int trackingCount = -1;
/**
* Cached ServiceReference for getServiceReference.
- *
+ *
* This field is volatile since it is accessed by multiple threads.
*/
- private volatile ServiceReference cachedReference;
+ private /+volatile+/ ServiceReference cachedReference;
/**
* Cached service object for getService.
- *
+ *
* This field is volatile since it is accessed by multiple threads.
*/
- private volatile Object cachedService;
+ private /+volatile+/ Object cachedService;
/**
* Create a ServiceTracker
object on the specified
* ServiceReference
object.
- *
+ *
*
* The service referenced by the specified ServiceReference
* object will be tracked by this ServiceTracker
object.
- *
+ *
* @param context BundleContext
object against which the
* tracking is done.
* @param reference ServiceReference
object for the service
@@ -196,8 +160,8 @@
this.context = context;
this.trackReference = reference;
this.trackClass = null;
- this.customizer = (customizer == null) ? this : customizer;
- this.listenerFilter = "(&(" + Constants.OBJECTCLASS + "=" + ((String[]) reference.getProperty(Constants.OBJECTCLASS))[0] //$NON-NLS-1$ //$NON-NLS-2$
+ this.customizer = (customizer is null) ? this : customizer;
+ this.listenerFilter = "(&(" + Constants.OBJECTCLASS + "=" + (stringcast( reference.getProperty(Constants.OBJECTCLASS)))[0] //$NON-NLS-1$ //$NON-NLS-2$
+ ")(" + Constants.SERVICE_ID + "=" + reference.getProperty(Constants.SERVICE_ID).toString() + "))" ; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
this.noUserFilter = true;
try {
@@ -214,11 +178,11 @@
/**
* Create a ServiceTracker
object on the specified class
* name.
- *
+ *
*
* Services registered under the specified class name will be tracked by
* this ServiceTracker
object.
- *
+ *
* @param context BundleContext
object against which the
* tracking is done.
* @param clazz Class name of the services to be tracked.
@@ -235,7 +199,7 @@
this.context = context;
this.trackReference = null;
this.trackClass = clazz;
- this.customizer = (customizer == null) ? this : customizer;
+ this.customizer = (customizer is null) ? this : customizer;
this.listenerFilter = "(" + Constants.OBJECTCLASS + "=" + clazz.toString() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
this.noUserFilter = true;
try {
@@ -252,11 +216,11 @@
/**
* Create a ServiceTracker
object on the specified
* Filter
object.
- *
+ *
*
* Services which match the specified Filter
object will be
* tracked by this ServiceTracker
object.
- *
+ *
* @param context BundleContext
object against which the
* tracking is done.
* @param filter Filter
object to select the services to be
@@ -275,24 +239,24 @@
this.trackReference = null;
// obtain a required objectClass from the user supplied filter
- if (filter instanceof FilterImpl) {
- this.trackClass = ((FilterImpl)filter).getRequiredObjectClass();
+ if ( null !is cast(FilterImpl)filter ) {
+ this.trackClass = (cast(FilterImpl)filter).getRequiredObjectClass();
} else {
this.trackClass = null;
}
-
- if (this.trackClass != null) {
+
+ if (this.trackClass !is null) {
this.listenerFilter = FilterImpl.getObjectClassFilterString(this.trackClass);
- //convert to track by class instead of filter if the user filter is in the form (objectClass=some.Clazz)
- this.noUserFilter = this.listenerFilter.equals(filter.toString());
+ //convert to track by class instead of filter if the user filter is in the form (objectClass=some.Clazz)
+ this.noUserFilter = this.listenerFilter.opEquals(filter.toString());
} else {
this.listenerFilter = null;
this.noUserFilter = false;
}
this.filter = filter;
- this.customizer = (customizer == null) ? this : customizer;
- if ((context == null) || (filter == null)) { // we throw a NPE here
+ this.customizer = (customizer is null) ? this : customizer;
+ if ((context is null) || (filter is null)) { // we throw a NPE here
// to
// be consistent with the
// other constructors
@@ -303,14 +267,14 @@
/**
* Open this ServiceTracker
object and begin tracking
* services.
- *
+ *
*
* This method calls open(false)
.
- *
+ *
* @throws java.lang.IllegalStateException if the BundleContext
* object with which this ServiceTracker
object was
* created is no longer valid.
- * @see #open(bool)
+ * @see #open(boolean)
*/
public void open() {
open(false);
@@ -319,12 +283,12 @@
/**
* Open this ServiceTracker
object and begin tracking
* services.
- *
+ *
*
* Services which match the search criteria specified when this
* ServiceTracker
object was created are now tracked by this
* ServiceTracker
object.
- *
+ *
* @param trackAllServices If true
, then this
* ServiceTracker
will track all matching services
* regardless of class loader accessibility. If false
,
@@ -338,11 +302,11 @@
* @since 1.3
*/
public synchronized void open(bool trackAllServices) {
- if (tracked != null) {
+ if (tracked !is null) {
return;
}
if (DEBUG) {
- System.out.println("ServiceTracker.open: " + filter); //$NON-NLS-1$
+ System.out_.println("ServiceTracker.open: " + filter); //$NON-NLS-1$
}
tracked = trackAllServices ? new AllTracked() : new Tracked();
trackingCount = 0;
@@ -350,16 +314,16 @@
try {
context.addServiceListener(tracked, listenerFilter);
ServiceReference[] references;
-
- if (trackReference != null) { // tracking a single reference
- references = new ServiceReference[] {trackReference};
+
+ if (trackReference !is null) { // tracking a single reference
+ references = [ cast(ServiceReference)trackReference];
}
else { // tracking a set of references
references = getInitialReferences(trackAllServices, trackClass,
noUserFilter ? null: filter.toString());
}
- tracked.setInitialServices(references); // set tracked with
+ tracked.setInitialServices(references); // set tracked with_
// the initial
// references
}
@@ -375,7 +339,7 @@
/**
* Returns the list of initial ServiceReference
objects that
* will be tracked by this ServiceTracker
object.
- *
+ *
* @param trackAllServices If true, use getAllServiceReferences.
* @param trackClass the class name with which the service was registered,
* or null for all services.
@@ -384,8 +348,7 @@
* @throws InvalidSyntaxException if the filter uses an invalid syntax.
*/
private ServiceReference[] getInitialReferences(bool trackAllServices,
- String trackClass, String filterString)
- throws InvalidSyntaxException {
+ String trackClass, String filterString) {
if (trackAllServices) {
return context.getAllServiceReferences(trackClass, filterString);
}
@@ -396,17 +359,17 @@
/**
* Close this ServiceTracker
object.
- *
+ *
*
* This method should be called when this ServiceTracker
* object should end the tracking of services.
*/
public synchronized void close() {
- if (tracked == null) {
+ if (tracked is null) {
return;
}
if (DEBUG) {
- System.out.println("ServiceTracker.close: " + filter); //$NON-NLS-1$
+ System.out_.println("ServiceTracker.close: " + filter); //$NON-NLS-1$
}
tracked.close();
ServiceReference[] references = getServiceReferences();
@@ -418,15 +381,15 @@
catch (IllegalStateException e) {
/* In case the context was stopped. */
}
- if (references != null) {
- for (int i = 0; i < references.length; i++) {
+ if (references !is null) {
+ for (int i = 0; i < references.length_; i++) {
outgoing.untrack(references[i]);
}
}
trackingCount = -1;
if (DEBUG) {
- if ((cachedReference == null) && (cachedService == null)) {
- System.out
+ if ((cachedReference is null) && (cachedService is null)) {
+ System.out_
.println("ServiceTracker.close[cached cleared]: " + filter); //$NON-NLS-1$
}
}
@@ -435,12 +398,12 @@
/**
* Default implementation of the
* ServiceTrackerCustomizer.addingService
method.
- *
+ *
*
* This method is only called when this ServiceTracker
object
* has been constructed with a null ServiceTrackerCustomizer
* argument.
- *
+ *
* The default implementation returns the result of calling
* getService
, on the BundleContext
object
* with which this ServiceTracker
object was created, passing
@@ -450,7 +413,7 @@
* object to be tracked for the service being added. In that case, take care
* not to rely on the default implementation of removedService that will
* unget the service.
- *
+ *
* @param reference Reference to service being added to this
* ServiceTracker
object.
* @return The service object to be tracked for the service added to this
@@ -464,14 +427,14 @@
/**
* Default implementation of the
* ServiceTrackerCustomizer.modifiedService
method.
- *
+ *
*
* This method is only called when this ServiceTracker
object
* has been constructed with a null ServiceTrackerCustomizer
* argument.
- *
+ *
* The default implementation does nothing.
- *
+ *
* @param reference Reference to modified service.
* @param service The service object for the modified service.
* @see ServiceTrackerCustomizer
@@ -482,12 +445,12 @@
/**
* Default implementation of the
* ServiceTrackerCustomizer.removedService
method.
- *
+ *
*
* This method is only called when this ServiceTracker
object
* has been constructed with a null ServiceTrackerCustomizer
* argument.
- *
+ *
* The default implementation calls ungetService
, on the
* BundleContext
object with which this
* ServiceTracker
object was created, passing the specified
@@ -496,7 +459,7 @@
* This method can be overridden in a subclass. If the default
* implementation of addingService
method was used, this
* method must unget the service.
- *
+ *
* @param reference Reference to removed service.
* @param service The service object for the removed service.
* @see ServiceTrackerCustomizer
@@ -513,7 +476,7 @@
* during the calling of the BundleActivator
methods.
* BundleActivator
methods are expected to complete in a
* short period of time.
- *
+ *
* @param timeout time interval in milliseconds to wait. If zero, the method
* will wait indefinately.
* @return Returns the result of getService()
.
@@ -521,21 +484,21 @@
* current thread.
* @throws IllegalArgumentException If the value of timeout is negative.
*/
- public Object waitForService(long timeout) throws InterruptedException {
+ public Object waitForService(long timeout) {
if (timeout < 0) {
- throw new IllegalArgumentException("timeout value is negative"); //$NON-NLS-1$
+ throw new IllegalArgumentException("timeout value is_ negative"); //$NON-NLS-1$
}
Object object = getService();
- while (object == null) {
+ while (object is null) {
Tracked tracked = this.tracked; /*
* use local var since we are not
* synchronized
*/
- if (tracked == null) { /* if ServiceTracker is not open */
+ if (tracked is null) { /* if ServiceTracker is_ not open */
return null;
}
synchronized (tracked) {
- if (tracked.size() == 0) {
+ if (tracked.size() is 0) {
tracked.wait(timeout);
}
}
@@ -550,7 +513,7 @@
/**
* Return an array of ServiceReference
objects for all
* services being tracked by this ServiceTracker
object.
- *
+ *
* @return Array of ServiceReference
objects or
* null
if no service are being tracked.
*/
@@ -559,18 +522,18 @@
* use local var since we are not
* synchronized
*/
- if (tracked == null) { /* if ServiceTracker is not open */
+ if (tracked is null) { /* if ServiceTracker is_ not open */
return null;
}
synchronized (tracked) {
- int length = tracked.size();
- if (length == 0) {
+ int length_ = tracked.size();
+ if (length_ is 0) {
return null;
}
- ServiceReference[] references = new ServiceReference[length];
+ ServiceReference[] references = new ServiceReference[length_];
Enumeration keys = tracked.keys();
- for (int i = 0; i < length; i++) {
- references[i] = (ServiceReference) keys.nextElement();
+ for (int i = 0; i < length_; i++) {
+ references[i] = cast(ServiceReference) keys.nextElement();
}
return references;
}
@@ -579,12 +542,12 @@
/**
* Returns a ServiceReference
object for one of the services
* being tracked by this ServiceTracker
object.
- *
+ *
*
* If multiple services are being tracked, the service with the highest
* ranking (as specified in its service.ranking
property) is
* returned.
- *
+ *
*
* If there is a tie in ranking, the service with the lowest service ID (as
* specified in its service.id
property); that is, the
@@ -592,39 +555,39 @@
*
* This is the same algorithm used by
* BundleContext.getServiceReference
.
- *
+ *
* @return ServiceReference
object or null
if
* no service is being tracked.
* @since 1.1
*/
public ServiceReference getServiceReference() {
ServiceReference reference = cachedReference;
- if (reference != null) {
+ if (reference !is null) {
if (DEBUG) {
- System.out
+ System.out_
.println("ServiceTracker.getServiceReference[cached]: " + filter); //$NON-NLS-1$
}
return reference;
}
if (DEBUG) {
- System.out.println("ServiceTracker.getServiceReference: " + filter); //$NON-NLS-1$
+ System.out_.println("ServiceTracker.getServiceReference: " + filter); //$NON-NLS-1$
}
ServiceReference[] references = getServiceReferences();
- int length = (references == null) ? 0 : references.length;
- if (length == 0) /* if no service is being tracked */
+ int length_ = (references is null) ? 0 : references.length_;
+ if (length_ is 0) /* if no service is_ being tracked */
{
return null;
}
int index = 0;
- if (length > 1) /* if more than one service, select highest ranking */
+ if (length_ > 1) /* if more than one service, select highest ranking */
{
- int rankings[] = new int[length];
+ int rankings[] = new int[length_];
int count = 0;
int maxRanking = Integer.MIN_VALUE;
- for (int i = 0; i < length; i++) {
+ for (int i = 0; i < length_; i++) {
Object property = references[i]
.getProperty(Constants.SERVICE_RANKING);
- int ranking = (property instanceof Integer) ? ((Integer) property)
+ int ranking = ( null !is cast(Integer)property ) ? (cast(Integer) property)
.intValue()
: 0;
rankings[i] = ranking;
@@ -634,7 +597,7 @@
count = 1;
}
else {
- if (ranking == maxRanking) {
+ if (ranking is maxRanking) {
count++;
}
}
@@ -642,9 +605,9 @@
if (count > 1) /* if still more than one service, select lowest id */
{
long minId = Long.MAX_VALUE;
- for (int i = 0; i < length; i++) {
- if (rankings[i] == maxRanking) {
- long id = ((Long) (references[i]
+ for (int i = 0; i < length_; i++) {
+ if (rankings[i] is maxRanking) {
+ long id = (cast(Long) (references[i]
.getProperty(Constants.SERVICE_ID)))
.longValue();
if (id < minId) {
@@ -662,7 +625,7 @@
* Returns the service object for the specified
* ServiceReference
object if the referenced service is being
* tracked by this ServiceTracker
object.
- *
+ *
* @param reference Reference to the desired service.
* @return Service object or null
if the service referenced
* by the specified ServiceReference
object is not
@@ -673,7 +636,7 @@
* use local var since we are not
* synchronized
*/
- if (tracked == null) { /* if ServiceTracker is not open */
+ if (tracked is null) { /* if ServiceTracker is_ not open */
return null;
}
synchronized (tracked) {
@@ -684,7 +647,7 @@
/**
* Return an array of service objects for all services being tracked by this
* ServiceTracker
object.
- *
+ *
* @return Array of service objects or null
if no service are
* being tracked.
*/
@@ -693,17 +656,17 @@
* use local var since we are not
* synchronized
*/
- if (tracked == null) { /* if ServiceTracker is not open */
+ if (tracked is null) { /* if ServiceTracker is_ not open */
return null;
}
synchronized (tracked) {
ServiceReference[] references = getServiceReferences();
- int length = (references == null) ? 0 : references.length;
- if (length == 0) {
+ int length_ = (references is null) ? 0 : references.length_;
+ if (length_ is 0) {
return null;
}
- Object[] objects = new Object[length];
- for (int i = 0; i < length; i++) {
+ Object[] objects = new Object[length_];
+ for (int i = 0; i < length_; i++) {
objects[i] = getService(references[i]);
}
return objects;
@@ -713,28 +676,28 @@
/**
* Returns a service object for one of the services being tracked by this
* ServiceTracker
object.
- *
+ *
*
* If any services are being tracked, this method returns the result of
* calling getService(getServiceReference())
.
- *
+ *
* @return Service object or null
if no service is being
* tracked.
*/
public Object getService() {
Object service = cachedService;
- if (service != null) {
+ if (service !is null) {
if (DEBUG) {
- System.out
+ System.out_
.println("ServiceTracker.getService[cached]: " + filter); //$NON-NLS-1$
}
return service;
}
if (DEBUG) {
- System.out.println("ServiceTracker.getService: " + filter); //$NON-NLS-1$
+ System.out_.println("ServiceTracker.getService: " + filter); //$NON-NLS-1$
}
ServiceReference reference = getServiceReference();
- if (reference == null) {
+ if (reference is null) {
return null;
}
return cachedService = getService(reference);
@@ -742,12 +705,12 @@
/**
* Remove a service from this ServiceTracker
object.
- *
+ *
* The specified service will be removed from this
* ServiceTracker
object. If the specified service was being
* tracked then the ServiceTrackerCustomizer.removedService
* method will be called for that service.
- *
+ *
* @param reference Reference to the service to be removed.
*/
public void remove(ServiceReference reference) {
@@ -755,7 +718,7 @@
* use local var since we are not
* synchronized
*/
- if (tracked == null) { /* if ServiceTracker is not open */
+ if (tracked is null) { /* if ServiceTracker is_ not open */
return;
}
tracked.untrack(reference);
@@ -764,7 +727,7 @@
/**
* Return the number of services being tracked by this
* ServiceTracker
object.
- *
+ *
* @return Number of services being tracked.
*/
public int size() {
@@ -772,7 +735,7 @@
* use local var since we are not
* synchronized
*/
- if (tracked == null) { /* if ServiceTracker is not open */
+ if (tracked is null) { /* if ServiceTracker is_ not open */
return 0;
}
return tracked.size();
@@ -780,12 +743,12 @@
/**
* Returns the tracking count for this ServiceTracker
object.
- *
+ *
* The tracking count is initialized to 0 when this
* ServiceTracker
object is opened. Every time a service is
* added, modified or removed from this ServiceTracker
object
* the tracking count is incremented.
- *
+ *
*
* The tracking count can be used to determine if this
* ServiceTracker
object has added, modified or removed a
@@ -794,7 +757,7 @@
* service has been added, modified or removed from this
* ServiceTracker
object since the previous tracking count
* was collected.
- *
+ *
* @since 1.2
* @return The tracking count for this ServiceTracker
object
* or -1 if this ServiceTracker
object is not open.
@@ -806,7 +769,7 @@
/**
* Called by the Tracked object whenever the set of tracked services is
* modified. Increments the tracking count and clears the cache.
- *
+ *
* @GuardedBy tracked
*/
/*
@@ -819,7 +782,7 @@
cachedReference = null; /* clear cached value */
cachedService = null; /* clear cached value */
if (DEBUG) {
- System.out.println("ServiceTracker.modified: " + filter); //$NON-NLS-1$
+ System.out_.println("ServiceTracker.modified: " + filter); //$NON-NLS-1$
}
}
@@ -832,10 +795,10 @@
* object for the tracker. This class is used to synchronize access to the
* tracked services. This is not a public class. It is only for use by the
* implementation of the ServiceTracker
class.
- *
+ *
* @ThreadSafe
*/
- class Tracked extends Hashtable implements ServiceListener {
+ class Tracked : Hashtable , ServiceListener {
static final long serialVersionUID = -7420065199791006079L;
/**
* List of ServiceReferences in the process of being added. This is used
@@ -845,22 +808,22 @@
* service to be unregistered, notification to the nested call to
* untrack that the service was unregistered can be made to the track
* method.
- *
+ *
* Since the ArrayList implementation is not synchronized, all access to
* this list must be protected by the same synchronized object for
* thread-safety.
- *
+ *
* @GuardedBy this
*/
private final ArrayList adding;
/**
* true if the tracked object is closed.
- *
+ *
* This field is volatile because it is set by one thread and read by
* another.
*/
- private volatile bool closed;
+ private /+volatile+/ bool closed;
/**
* Initial list of ServiceReferences for the tracker. This is used to
@@ -869,15 +832,15 @@
* initial set of tracked services are not "announced" by ServiceEvents
* and therefore the ServiceEvent for unregistration could be delivered
* before we track the service.
- *
+ *
* A service must not be in both the initial and adding lists at the
* same time. A service must be moved from the initial list to the
* adding list "atomically" before we begin tracking it.
- *
+ *
* Since the LinkedList implementation is not synchronized, all access
* to this list must be protected by the same synchronized object for
* thread-safety.
- *
+ *
* @GuardedBy this
*/
private final LinkedList initial;
@@ -885,7 +848,7 @@
/**
* Tracked constructor.
*/
- protected Tracked() {
+ protected this() {
super();
closed = false;
adding = new ArrayList(6);
@@ -895,22 +858,22 @@
/**
* Set initial list of services into tracker before ServiceEvents begin
* to be received.
- *
+ *
* This method must be called from ServiceTracker.open while
* synchronized on this object in the same synchronized block as the
* addServiceListener call.
- *
+ *
* @param references The initial list of services to be tracked.
* @GuardedBy this
*/
protected void setInitialServices(ServiceReference[] references) {
- if (references == null) {
+ if (references is null) {
return;
}
- int size = references.length;
+ int size = references.length_;
for (int i = 0; i < size; i++) {
if (DEBUG) {
- System.out
+ System.out_
.println("ServiceTracker.Tracked.setInitialServices: " + references[i]); //$NON-NLS-1$
}
initial.add(references[i]);
@@ -920,16 +883,16 @@
/**
* Track the initial list of services. This is called after
* ServiceEvents can begin to be received.
- *
+ *
* This method must be called from ServiceTracker.open while not
* synchronized on this object after the addServiceListener call.
- *
+ *
*/
protected void trackInitialServices() {
while (true) {
ServiceReference reference;
synchronized (this) {
- if (initial.size() == 0) {
+ if (initial.size() is 0) {
/*
* if there are no more inital services
*/
@@ -939,11 +902,11 @@
* move the first service from the initial list to the
* adding list within this synchronized block.
*/
- reference = (ServiceReference) initial.removeFirst();
- if (this.get(reference) != null) {
+ reference = cast(ServiceReference) initial.removeFirst();
+ if (this.get(reference) !is null) {
/* if we are already tracking this service */
if (DEBUG) {
- System.out
+ System.out_
.println("ServiceTracker.Tracked.trackInitialServices[already tracked]: " + reference); //$NON-NLS-1$
}
continue; /* skip this service */
@@ -954,7 +917,7 @@
* added.
*/
if (DEBUG) {
- System.out
+ System.out_
.println("ServiceTracker.Tracked.trackInitialServices[already adding]: " + reference); //$NON-NLS-1$
}
continue; /* skip this service */
@@ -962,7 +925,7 @@
adding.add(reference);
}
if (DEBUG) {
- System.out
+ System.out_
.println("ServiceTracker.Tracked.trackInitialServices: " + reference); //$NON-NLS-1$
}
trackAdding(reference); /*
@@ -985,7 +948,7 @@
* ServiceListener
method for the
* ServiceTracker
class. This method must NOT be
* synchronized to avoid deadlock potential.
- *
+ *
* @param event ServiceEvent
object from the framework.
*/
public void serviceChanged(ServiceEvent event) {
@@ -998,7 +961,7 @@
}
ServiceReference reference = event.getServiceReference();
if (DEBUG) {
- System.out
+ System.out_
.println("ServiceTracker.Tracked.serviceChanged[" + event.getType() + "]: " + reference); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -1041,7 +1004,7 @@
/**
* Begin to track the referenced service.
- *
+ *
* @param reference Reference to a service to be tracked.
*/
private void track(ServiceReference reference) {
@@ -1049,10 +1012,10 @@
synchronized (this) {
object = this.get(reference);
}
- if (object != null) /* we are already tracking the service */
+ if (object !is null) /* we are already tracking the service */
{
if (DEBUG) {
- System.out
+ System.out_
.println("ServiceTracker.Tracked.track[modified]: " + reference); //$NON-NLS-1$
}
synchronized (this) {
@@ -1073,12 +1036,12 @@
* being added.
*/
if (DEBUG) {
- System.out
+ System.out_
.println("ServiceTracker.Tracked.track[already adding]: " + reference); //$NON-NLS-1$
}
return;
}
- adding.add(reference); /* mark this service is being added */
+ adding.add(reference); /* mark this service is_ being added */
}
trackAdding(reference); /*
@@ -1091,12 +1054,12 @@
* Common logic to add a service to the tracker used by track and
* trackInitialServices. The specified reference must have been placed
* in the adding list before calling this method.
- *
+ *
* @param reference Reference to a service to be tracked.
*/
private void trackAdding(ServiceReference reference) {
if (DEBUG) {
- System.out
+ System.out_
.println("ServiceTracker.Tracked.trackAdding: " + reference); //$NON-NLS-1$
}
Object object = null;
@@ -1116,7 +1079,7 @@
* untracked during the
* customizer callback
*/
- if (object != null) {
+ if (object !is null) {
this.put(reference, object);
modified(); /* increment modification count */
notifyAll(); /*
@@ -1135,7 +1098,7 @@
*/
if (becameUntracked) {
if (DEBUG) {
- System.out
+ System.out_
.println("ServiceTracker.Tracked.trackAdding[removed]: " + reference); //$NON-NLS-1$
}
/* Call customizer outside of synchronized region */
@@ -1149,7 +1112,7 @@
/**
* Discontinue tracking the referenced service.
- *
+ *
* @param reference Reference to the tracked service.
*/
protected void untrack(ServiceReference reference) {
@@ -1162,7 +1125,7 @@
* process
*/
if (DEBUG) {
- System.out
+ System.out_
.println("ServiceTracker.Tracked.untrack[removed from initial]: " + reference); //$NON-NLS-1$
}
return; /*
@@ -1176,7 +1139,7 @@
* process of being added
*/
if (DEBUG) {
- System.out
+ System.out_
.println("ServiceTracker.Tracked.untrack[being added]: " + reference); //$NON-NLS-1$
}
return; /*
@@ -1189,13 +1152,13 @@
* before calling customizer
* callback
*/
- if (object == null) { /* are we actually tracking the service */
+ if (object is null) { /* are we actually tracking the service */
return;
}
modified(); /* increment modification count */
}
if (DEBUG) {
- System.out
+ System.out_
.println("ServiceTracker.Tracked.untrack[removed]: " + reference); //$NON-NLS-1$
}
/* Call customizer outside of synchronized region */
@@ -1210,21 +1173,18 @@
/**
* Subclass of Tracked which implements the AllServiceListener interface.
* This class is used by the ServiceTracker if open is called with true.
- *
+ *
* @since 1.3
* @ThreadSafe
*/
- class AllTracked extends Tracked implements AllServiceListener {
+ class AllTracked : Tracked , AllServiceListener {
static final long serialVersionUID = 4050764875305137716L;
/**
* AllTracked constructor.
*/
- protected AllTracked() {
+ protected this() {
super();
}
}
}
-+++/
-
-
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTrackerCustomizer.d
--- a/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTrackerCustomizer.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTrackerCustomizer.d Sun Nov 08 12:42:30 2009 +0100
@@ -1,8 +1,8 @@
/*
* $Header: /cvshome/build/org.osgi.util.tracker/src/org/osgi/util/tracker/ServiceTrackerCustomizer.java,v 1.13 2007/02/19 19:04:33 hargrave Exp $
- *
+ *
* Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -16,9 +16,13 @@
* limitations under the License.
*/
+// Port to the D programming language:
+// Frank Benoit
module org.osgi.util.tracker.ServiceTrackerCustomizer;
import java.lang.all;
+
+
import org.osgi.framework.ServiceReference;
/**
@@ -30,7 +34,7 @@
* tracked service. The ServiceTrackerCustomizer
object is also
* called when a tracked service is modified or has been removed from the
* ServiceTracker
object.
- *
+ *
*
* The methods in this interface may be called as the result of a
* ServiceEvent
being received by a ServiceTracker
@@ -40,20 +44,20 @@
* ServiceRegistration.setProperties
) or unregister (
* ServiceRegistration.unregister
) a service while being
* synchronized on any object.
- *
+ *
*
* The ServiceTracker
class is thread-safe. It does not call a
* ServiceTrackerCustomizer
object while holding any locks.
* ServiceTrackerCustomizer
implementations must also be
* thread-safe.
- *
+ *
* @ThreadSafe
* @version $Revision: 1.13 $
*/
public interface ServiceTrackerCustomizer {
/**
* A service is being added to the ServiceTracker
object.
- *
+ *
*
* This method is called before a service which matched the search
* parameters of the ServiceTracker
object is added to it.
@@ -61,7 +65,7 @@
* ServiceReference
object. The returned service object is
* stored in the ServiceTracker
object and is available from
* the getService
and getServices
methods.
- *
+ *
* @param reference Reference to service being added to the
* ServiceTracker
object.
* @return The service object to be tracked for the
@@ -73,11 +77,11 @@
/**
* A service tracked by the ServiceTracker
object has been
* modified.
- *
+ *
*
* This method is called when a service being tracked by the
* ServiceTracker
object has had it properties modified.
- *
+ *
* @param reference Reference to service that has been modified.
* @param service The service object for the modified service.
*/
@@ -86,11 +90,11 @@
/**
* A service tracked by the ServiceTracker
object has been
* removed.
- *
+ *
*
* This method is called after a service is no longer being tracked by the
* ServiceTracker
object.
- *
+ *
* @param reference Reference to service that has been removed.
* @param service The service object for the removed service.
*/
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/FrameworkLog.d
--- a/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/FrameworkLog.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/FrameworkLog.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,16 +4,20 @@
* 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
+// Port to the D programming language:
+// Frank Benoit
module org.eclipse.osgi.framework.log.FrameworkLog;
-import org.eclipse.osgi.framework.log.FrameworkLogEntry;
import java.lang.all;
+
+import org.eclipse.osgi.framework.log.FrameworkLogEntry; // packageimport
+
import java.io.File;
-//import java.io.IOException;
+import java.io.IOException;
import java.io.Writer;
import org.osgi.framework.FrameworkEvent;
@@ -21,18 +25,18 @@
/**
* The FramworkLog interface. A FrameworkLog implementation is provided by the
* FrameworkAdaptor and used by the Framework to log any error messages and
- * FrameworkEvents of type ERROR. The FrameworkLog may persist the log messages
+ * FrameworkEvents of type ERROR. The FrameworkLog may persist the log messages
* to the filesystem or allow other ways of accessing the log information.
* @since 3.1
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface FrameworkLog {
/**
- * A service lookup constant (value "performance") indicating an
- * implementation of the logging service that logs performance events.
- * Create a filter with this property set to "true"
in order to
+ * A service lookup constant (value "performance") indicating an
+ * implementation of the logging service that logs performance events.
+ * Create a filter with this property set to "true"
in order to
* obtain a performance log.
- *
+ *
* @since 3.1
*/
public static final String SERVICE_PERFORMANCE = "performance"; //$NON-NLS-1$
@@ -52,28 +56,28 @@
/**
* Sets the current Writer used to log messages to the specified
* newWriter. If append is set to true then the content
- * of the current Writer will be appended to the new Writer
+ * of the current Writer will be appended to the new Writer
* if possible.
- * @param newWriter The Writer to use for logging messages.
+ * @param newWriter The Writer to use for logging messages.
* @param append Indicates whether the content of the current Writer
- * used for logging messages should be appended to the end of the new
+ * used for logging messages should be appended to the end of the new
* Writer.
*/
public void setWriter(Writer newWriter, bool append);
- /**
+ /**
* Sets the current File used to log messages to a FileWriter
- * using the specified File. If append is set to true then the
- * content of the current Writer will be appended to the
+ * using the specified File. If append is set to true then the
+ * content of the current Writer will be appended to the
* new File if possible.
* @param newFile The File to create a new FileWriter which will be
* used for logging messages.
* @param append Indicates whether the content of the current Writer
- * used for logging messages should be appended to the end of the new
+ * used for logging messages should be appended to the end of the new
* File.
* @throws IOException if any problem occurs while constructing a
- * FileWriter from the newFile. If this exception is thrown the
- * FrameworkLog will not be effected and will continue to use the
+ * FileWriter from the newFile. If this exception is thrown the
+ * FrameworkLog will not be effected and will continue to use the
* current Writer to log messages.
*/
public void setFile(File newFile, bool append) ;
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/FrameworkLogEntry.d
--- a/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/FrameworkLogEntry.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/FrameworkLogEntry.d Sun Nov 08 12:42:30 2009 +0100
@@ -4,15 +4,18 @@
* 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
+// Port to the D programming language:
+// Frank Benoit
module org.eclipse.osgi.framework.log.FrameworkLogEntry;
import java.lang.all;
+
/**
* A framework log entry used to log information to a FrameworkLog
* @since 3.1
@@ -26,21 +29,21 @@
*/
public static final int OK = 0;
- /**
+ /**
* Severity constant (bit mask, value 1) indicating this log entry is informational only.
* @see #getSeverity()
* @since 3.2
*/
public static final int INFO = 0x01;
- /**
+ /**
* Severity constant (bit mask, value 2) indicating this log entry represents a warning.
* @see #getSeverity()
* @since 3.2
*/
public static final int WARNING = 0x02;
- /**
+ /**
* Severity constant (bit mask, value 4) indicating this log entry represents an error.
* @see #getSeverity()
* @since 3.2
@@ -56,7 +59,7 @@
// It would be nice to rename some of these fields but we cannot change the getter method
// names without breaking clients. Changing only the field names would be confusing.
- //TODO "entry" has another meaning here - title, summary, tag are better names
+ //TODO "entry" has another meaning here - title, summary, tag are better names
private String entry;
private String message;
//TODO get rid of this
@@ -105,7 +108,7 @@
}
/**
- *
+ *
* @return Returns the children.
*/
public FrameworkLogEntry[] getChildren() {
@@ -155,7 +158,7 @@
* no children.
*
*
- * @return the severity: one of OK
, ERROR
,
+ * @return the severity: one of OK
, ERROR
,
* INFO
, WARNING
, or CANCEL
* @since 3.2
*/
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.d
--- a/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.d Sun Nov 08 12:42:30 2009 +0100
@@ -7,28 +7,29 @@
*
* Contributors:
* IBM - Initial API and implementation
- * Port to the D programming language:
- * Frank Benoit
*******************************************************************************/
+// Port to the D programming language:
+// Frank Benoit
module org.eclipse.osgi.util.NLS;
import java.lang.all;
-// import java.io.IOException;
-// import java.io.InputStream;
-// import java.lang.reflect.Field;
-// import java.lang.reflect.Modifier;
-// import java.security.AccessController;
-// import java.security.PrivilegedAction;
-// import java.util.ArrayList;
-// import java.util.HashMap;
-// import java.util.Locale;
-// import java.util.Map;
-// import java.util.Properties;
-//
-// import org.eclipse.osgi.framework.debug.Debug;
-// import org.eclipse.osgi.framework.log.FrameworkLog;
-// import org.eclipse.osgi.framework.log.FrameworkLogEntry;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Properties;
+
+import org.eclipse.osgi.framework.debug_.Debug;
+import org.eclipse.osgi.framework.log.FrameworkLog;
+import org.eclipse.osgi.framework.log.FrameworkLogEntry;
/**
* Common superclass for all message bundle classes. Provides convenience
@@ -60,28 +61,28 @@
*/
public abstract class NLS {
-// private static final Object[] EMPTY_ARGS = new Object[0];
-// private static final String EXTENSION = ".properties"; //$NON-NLS-1$
-// private static String[] nlSuffixes;
-// /*
-// * NOTE do not change the name of this field; it is set by the Framework using reflection
-// */
-// private static FrameworkLog frameworkLog;
-//
-// static final int SEVERITY_ERROR = 0x04;
-// static final int SEVERITY_WARNING = 0x02;
-// /*
-// * This object is assigned to the value of a field map to indicate
-// * that a translated message has already been assigned to that field.
-// */
-// static final Object ASSIGNED = new Object();
-//
-// /**
-// * Creates a new NLS instance.
-// */
-// protected NLS() {
-// super();
-// }
+ private static final Object[] EMPTY_ARGS = null;
+ private static final String EXTENSION = ".properties"; //$NON-NLS-1$
+ private static String[] nlSuffixes;
+ /*
+ * NOTE do not change the name of this field; it is set by the Framework using reflection
+ */
+ private static FrameworkLog frameworkLog;
+
+ static final int SEVERITY_ERROR = 0x04;
+ static final int SEVERITY_WARNING = 0x02;
+ /*
+ * This object is assigned to the value of a field map to indicate
+ * that a translated message has already been assigned to that field.
+ */
+ static final Object ASSIGNED = new Object();
+
+ /**
+ * Creates a new NLS instance.
+ */
+ protected this() {
+ super();
+ }
/**
* Bind the given message's substitution locations with the given string value.
@@ -92,14 +93,7 @@
* @throws IllegalArgumentException if the text appearing within curly braces in the given message does not map to an integer
*/
public static String bind(String message, Object binding) {
- implMissing( __FILE__, __LINE__ );
- return null;
-// return internalBind(message, null, String.valueOf(binding), null);
- }
- public static String bind(String message, String binding) {
- implMissing( __FILE__, __LINE__ );
- return null;
-// return internalBind(message, null, String.valueOf(binding), null);
+ return internalBind(message, null, String.valueOf(binding), null);
}
/**
@@ -112,14 +106,7 @@
* @throws IllegalArgumentException if the text appearing within curly braces in the given message does not map to an integer
*/
public static String bind(String message, Object binding1, Object binding2) {
- implMissing( __FILE__, __LINE__ );
- return null;
-// return internalBind(message, null, String.valueOf(binding1), String.valueOf(binding2));
- }
- public static String bind(String message, String binding1, String binding2) {
- implMissing( __FILE__, __LINE__ );
- return null;
-// return internalBind(message, null, String.valueOf(binding1), String.valueOf(binding2));
+ return internalBind(message, null, String.valueOf(binding1), String.valueOf(binding2));
}
/**
@@ -131,316 +118,309 @@
* @throws IllegalArgumentException if the text appearing within curly braces in the given message does not map to an integer
*/
public static String bind(String message, Object[] bindings) {
- implMissing( __FILE__, __LINE__ );
- return null;
-// return internalBind(message, bindings, null, null);
+ return internalBind(message, bindings, null, null);
+ }
+
+ /**
+ * Initialize the given class with the values from the specified message bundle.
+ *
+ * @param bundleName fully qualified path of the class name
+ * @param clazz the class where the constants will exist
+ */
+ public static void initializeMessages(/+FIXFINAL+/ String bundleName, /+FIXFINAL+/ Class clazz) {
+ if (System.getSecurityManager() is null) {
+ load(bundleName, clazz);
+ return;
+ }
+ AccessController.doPrivileged(new class() PrivilegedAction {
+ public Object run() {
+ load(bundleName, clazz);
+ return null;
+ }
+ });
}
- public static String bind(String message, String[] bindings) {
- implMissing( __FILE__, __LINE__ );
- return null;
-// return internalBind(message, bindings, null, null);
+
+ /*
+ * Perform the string substitution on the given message with the specified args.
+ * See the class comment for exact details.
+ */
+ private static String internalBind(String message, Object[] args, String argZero, String argOne) {
+ if (message is null)
+ return "No message available."; //$NON-NLS-1$
+ if (args is null || args.length_ is 0)
+ args = EMPTY_ARGS;
+
+ int length_ = message.length();
+ //estimate correct size of string buffer to avoid growth
+ int bufLen = length_ + (args.length_ * 5);
+ if (argZero !is null)
+ bufLen += argZero.length() - 3;
+ if (argOne !is null)
+ bufLen += argOne.length() - 3;
+ StringBuffer buffer = new StringBuffer(bufLen < 0 ? 0 : bufLen);
+ for (int i = 0; i < length_; i++) {
+ char c = message.charAt(i);
+ switch (c) {
+ case '{' :
+ int index = message.indexOf('}', i);
+ // if we don't have a matching closing brace then...
+ if (index is -1) {
+ buffer.append(c);
+ break;
+ }
+ i++;
+ if (i >= length_) {
+ buffer.append(c);
+ break;
+ }
+ // look for a substitution
+ int number = -1;
+ try {
+ number = Integer.parseInt(message.substring(i, index));
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException();
+ }
+ if (number is 0 && argZero !is null)
+ buffer.append(argZero);
+ else if (number is 1 && argOne !is null)
+ buffer.append(argOne);
+ else {
+ if (number >= args.length_ || number < 0) {
+ buffer.append(""); //$NON-NLS-1$
+ i = index;
+ break;
+ }
+ buffer.append(args[number]);
+ }
+ i = index;
+ break;
+ case '\'' :
+ // if a single quote is the last char on the line then skip it
+ int nextIndex = i + 1;
+ if (nextIndex >= length_) {
+ buffer.append(c);
+ break;
+ }
+ char next = message.charAt(nextIndex);
+ // if the next char is another single quote then write out one
+ if (next is '\'') {
+ i++;
+ buffer.append(c);
+ break;
+ }
+ // otherwise we want to read until we get to the next single quote
+ index = message.indexOf('\'', nextIndex);
+ // if there are no more in the string, then skip it
+ if (index is -1) {
+ buffer.append(c);
+ break;
+ }
+ // otherwise write out the chars inside the quotes
+ buffer.append(message.substring(nextIndex, index));
+ i = index;
+ break;
+ default :
+ buffer.append(c);
+ }
+ }
+ return buffer.toString();
+ }
+
+ /*
+ * Build an array of property files to search. The returned array contains
+ * the property fields in order from most specific to most generic.
+ * So, in the FR_fr locale, it will return file_fr_FR.properties, then
+ * file_fr.properties, and finally file.properties.
+ */
+ private static String[] buildVariants(String root) {
+ if (nlSuffixes is null) {
+ //build list of suffixes for loading resource bundles
+ String nl = Locale.getDefault().toString();
+ ArrayList result = new ArrayList(4);
+ int lastSeparator;
+ while (true) {
+ result.add('_' + nl + EXTENSION);
+ lastSeparator = nl.lastIndexOf('_');
+ if (lastSeparator is -1)
+ break;
+ nl = nl.substring(0, lastSeparator);
+ }
+ //add the empty suffix last (most general)
+ result.add(EXTENSION);
+ nlSuffixes = stringcast( result.toArray)(new String[result.size()]);
+ }
+ root = root.replace('.', '/');
+ String[] variants = new String[nlSuffixes.length_];
+ for (int i = 0; i < variants.length_; i++)
+ variants[i] = root + nlSuffixes[i];
+ return variants;
}
-// /**
-// * Initialize the given class with the values from the specified message bundle.
-// *
-// * @param bundleName fully qualified path of the class name
-// * @param clazz the class where the constants will exist
-// */
-// public static void initializeMessages(final String bundleName, final Class clazz) {
-// if (System.getSecurityManager() is null) {
-// load(bundleName, clazz);
-// return;
-// }
-// AccessController.doPrivileged(new PrivilegedAction() {
-// public Object run() {
-// load(bundleName, clazz);
-// return null;
-// }
-// });
-// }
-//
-// /*
-// * Perform the string substitution on the given message with the specified args.
-// * See the class comment for exact details.
-// */
-// private static String internalBind(String message, Object[] args, String argZero, String argOne) {
-// if (message is null)
-// return "No message available."; //$NON-NLS-1$
-// if (args is null || args.length is 0)
-// args = EMPTY_ARGS;
-//
-// int length = message.length();
-// //estimate correct size of string buffer to avoid growth
-// int bufLen = length + (args.length * 5);
-// if (argZero !is null)
-// bufLen += argZero.length() - 3;
-// if (argOne !is null)
-// bufLen += argOne.length() - 3;
-// StringBuffer buffer = new StringBuffer(bufLen < 0 ? 0 : bufLen);
-// for (int i = 0; i < length; i++) {
-// char c = message.charAt(i);
-// switch (c) {
-// case '{' :
-// int index = message.indexOf('}', i);
-// // if we don't have a matching closing brace then...
-// if (index is -1) {
-// buffer.append(c);
-// break;
-// }
-// i++;
-// if (i >= length) {
-// buffer.append(c);
-// break;
-// }
-// // look for a substitution
-// int number = -1;
-// try {
-// number = Integer.parseInt(message.substring(i, index));
-// } catch (NumberFormatException e) {
-// throw new IllegalArgumentException();
-// }
-// if (number is 0 && argZero !is null)
-// buffer.append(argZero);
-// else if (number is 1 && argOne !is null)
-// buffer.append(argOne);
-// else {
-// if (number >= args.length || number < 0) {
-// buffer.append(""); //$NON-NLS-1$
-// i = index;
-// break;
-// }
-// buffer.append(args[number]);
-// }
-// i = index;
-// break;
-// case '\'' :
-// // if a single quote is the last char on the line then skip it
-// int nextIndex = i + 1;
-// if (nextIndex >= length) {
-// buffer.append(c);
-// break;
-// }
-// char next = message.charAt(nextIndex);
-// // if the next char is another single quote then write out one
-// if (next is '\'') {
-// i++;
-// buffer.append(c);
-// break;
-// }
-// // otherwise we want to read until we get to the next single quote
-// index = message.indexOf('\'', nextIndex);
-// // if there are no more in the string, then skip it
-// if (index is -1) {
-// buffer.append(c);
-// break;
-// }
-// // otherwise write out the chars inside the quotes
-// buffer.append(message.substring(nextIndex, index));
-// i = index;
-// break;
-// default :
-// buffer.append(c);
-// }
-// }
-// return buffer.toString();
-// }
-//
-// /*
-// * Build an array of property files to search. The returned array contains
-// * the property fields in order from most specific to most generic.
-// * So, in the FR_fr locale, it will return file_fr_FR.properties, then
-// * file_fr.properties, and finally file.properties.
-// */
-// private static String[] buildVariants(String root) {
-// if (nlSuffixes is null) {
-// //build list of suffixes for loading resource bundles
-// String nl = Locale.getDefault().toString();
-// ArrayList result = new ArrayList(4);
-// int lastSeparator;
-// while (true) {
-// result.add('_' + nl + EXTENSION);
-// lastSeparator = nl.lastIndexOf('_');
-// if (lastSeparator is -1)
-// break;
-// nl = nl.substring(0, lastSeparator);
-// }
-// //add the empty suffix last (most general)
-// result.add(EXTENSION);
-// nlSuffixes = (String[]) result.toArray(new String[result.size()]);
-// }
-// root = root.replace('.', '/');
-// String[] variants = new String[nlSuffixes.length];
-// for (int i = 0; i < variants.length; i++)
-// variants[i] = root + nlSuffixes[i];
-// return variants;
-// }
-//
-// private static void computeMissingMessages(String bundleName, Class clazz, Map fieldMap, Field[] fieldArray, bool isAccessible) {
-// // iterate over the fields in the class to make sure that there aren't any empty ones
-// final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC;
-// final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL;
-// final int numFields = fieldArray.length;
-// for (int i = 0; i < numFields; i++) {
-// Field field = fieldArray[i];
-// if ((field.getModifiers() & MOD_MASK) !is MOD_EXPECTED)
-// continue;
-// //if the field has a a value assigned, there is nothing to do
-// if (fieldMap.get(field.getName()) is ASSIGNED)
-// continue;
-// try {
-// // Set a value for this empty field. We should never get an exception here because
-// // we know we have a public static non-final field. If we do get an exception, silently
-// // log it and continue. This means that the field will (most likely) be un-initialized and
-// // will fail later in the code and if so then we will see both the NPE and this error.
-// String value = "NLS missing message: " + field.getName() + " in: " + bundleName; //$NON-NLS-1$ //$NON-NLS-2$
-// if (Debug.DEBUG_MESSAGE_BUNDLES)
-// System.out.println(value);
-// log(SEVERITY_WARNING, value, null);
-// if (!isAccessible)
-// field.setAccessible(true);
-// field.set(null, value);
-// } catch (Exception e) {
-// log(SEVERITY_ERROR, "Error setting the missing message value for: " + field.getName(), e); //$NON-NLS-1$
-// }
-// }
-// }
-//
-// /*
-// * Load the given resource bundle using the specified class loader.
-// */
-// static void load(final String bundleName, Class clazz) {
-// long start = System.currentTimeMillis();
-// final Field[] fieldArray = clazz.getDeclaredFields();
-// ClassLoader loader = clazz.getClassLoader();
-//
-// bool isAccessible = (clazz.getModifiers() & Modifier.PUBLIC) !is 0;
-//
-// //build a map of field names to Field objects
-// final int len = fieldArray.length;
-// Map fields = new HashMap(len * 2);
-// for (int i = 0; i < len; i++)
-// fields.put(fieldArray[i].getName(), fieldArray[i]);
-//
-// // search the variants from most specific to most general, since
-// // the MessagesProperties.put method will mark assigned fields
-// // to prevent them from being assigned twice
-// final String[] variants = buildVariants(bundleName);
-// for (int i = 0; i < variants.length; i++) {
-// // loader is null if we're launched off the Java boot classpath
-// final InputStream input = loader is null ? ClassLoader.getSystemResourceAsStream(variants[i]) : loader.getResourceAsStream(variants[i]);
-// if (input is null)
-// continue;
-// try {
-// final MessagesProperties properties = new MessagesProperties(fields, bundleName, isAccessible);
-// properties.load(input);
-// } catch (IOException e) {
-// log(SEVERITY_ERROR, "Error loading " + variants[i], e); //$NON-NLS-1$
-// } finally {
-// if (input !is null)
-// try {
-// input.close();
-// } catch (IOException e) {
-// // ignore
-// }
-// }
-// }
-// computeMissingMessages(bundleName, clazz, fields, fieldArray, isAccessible);
-// if (Debug.DEBUG_MESSAGE_BUNDLES)
-// System.out.println("Time to load message bundle: " + bundleName + " was " + (System.currentTimeMillis() - start) + "ms."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-// }
-//
-// /*
-// * The method adds a log entry based on the error message and exception.
-// * The output is written to the System.err.
-// *
-// * This method is only expected to be called if there is a problem in
-// * the NLS mechanism. As a result, translation facility is not available
-// * here and messages coming out of this log are generally not translated.
-// *
-// * @param severity - severity of the message (SEVERITY_ERROR or SEVERITY_WARNING)
-// * @param message - message to log
-// * @param e - exception to log
-// */
-// static void log(int severity, String message, Exception e) {
-// if (frameworkLog !is null) {
-// frameworkLog.log(new FrameworkLogEntry("org.eclipse.osgi", severity, 1, message, 0, e, null)); //$NON-NLS-1$
-// return;
-// }
-// String statusMsg;
-// switch (severity) {
-// case SEVERITY_ERROR :
-// statusMsg = "Error: "; //$NON-NLS-1$
-// break;
-// case SEVERITY_WARNING :
-// // intentionally fall through:
-// default :
-// statusMsg = "Warning: "; //$NON-NLS-1$
-// }
-// if (message !is null)
-// statusMsg += message;
-// if (e !is null)
-// statusMsg += ": " + e.getMessage(); //$NON-NLS-1$
-// System.err.println(statusMsg);
-// if (e !is null)
-// e.printStackTrace();
-// }
-//
-// /*
-// * Class which sub-classes java.util.Properties and uses the #put method
-// * to set field values rather than storing the values in the table.
-// */
-// private static class MessagesProperties extends Properties {
-//
-// private static final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC;
-// private static final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL;
-// private static final long serialVersionUID = 1L;
-//
-// private final String bundleName;
-// private final Map fields;
-// private final bool isAccessible;
-//
-// public MessagesProperties(Map fieldMap, String bundleName, bool isAccessible) {
-// super();
-// this.fields = fieldMap;
-// this.bundleName = bundleName;
-// this.isAccessible = isAccessible;
-// }
-//
-// /* (non-Javadoc)
-// * @see java.util.Hashtable#put(java.lang.Object, java.lang.Object)
-// */
-// public synchronized Object put(Object key, Object value) {
-// Object fieldObject = fields.put(key, ASSIGNED);
-// // if already assigned, there is nothing to do
-// if (fieldObject is ASSIGNED)
-// return null;
-// if (fieldObject is null) {
-// final String msg = "NLS unused message: " + key + " in: " + bundleName;//$NON-NLS-1$ //$NON-NLS-2$
-// if (Debug.DEBUG_MESSAGE_BUNDLES)
-// System.out.println(msg);
-// log(SEVERITY_WARNING, msg, null);
-// return null;
-// }
-// final Field field = (Field) fieldObject;
-// //can only set value of public static non-final fields
-// if ((field.getModifiers() & MOD_MASK) !is MOD_EXPECTED)
-// return null;
-// try {
-// // Check to see if we are allowed to modify the field. If we aren't (for instance
-// // if the class is not public) then change the accessible attribute of the field
-// // before trying to set the value.
-// if (!isAccessible)
-// field.setAccessible(true);
-// // Set the value into the field. We should never get an exception here because
-// // we know we have a public static non-final field. If we do get an exception, silently
-// // log it and continue. This means that the field will (most likely) be un-initialized and
-// // will fail later in the code and if so then we will see both the NPE and this error.
-// field.set(null, value);
-// } catch (Exception e) {
-// log(SEVERITY_ERROR, "Exception setting field value.", e); //$NON-NLS-1$
-// }
-// return null;
-// }
-// }
-}
+ private static void computeMissingMessages(String bundleName, Class clazz, Map fieldMap, Field[] fieldArray, bool isAccessible) {
+ // iterate over the fields in the class to make sure that there aren't any empty ones
+ final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC;
+ final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL;
+ final int numFields = fieldArray.length_;
+ for (int i = 0; i < numFields; i++) {
+ Field field = fieldArray[i];
+ if ((field.getModifiers() & MOD_MASK) !is MOD_EXPECTED)
+ continue;
+ //if the field has a a value assigned, there is nothing to do
+ if (fieldMap.get(field.getName()) is ASSIGNED)
+ continue;
+ try {
+ // Set a value for this empty field. We should never get an exception here because
+ // we know we have a public static non-final field. If we do get an exception, silently
+ // log it and continue. This means that the field will (most likely) be un-initialized and
+ // will fail later in the code and if so then we will see both the NPE and this error.
+ String value = "NLS missing message: " + field.getName() + " in_: " + bundleName; //$NON-NLS-1$ //$NON-NLS-2$
+ if (Debug.DEBUG_MESSAGE_BUNDLES)
+ System.out_.println(value);
+ log(SEVERITY_WARNING, value, null);
+ if (!isAccessible)
+ field.setAccessible(true);
+ field.set(null, value);
+ } catch (Exception e) {
+ log(SEVERITY_ERROR, "Error setting the missing message value for: " + field.getName(), e); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /*
+ * Load the given resource bundle using the specified class loader.
+ */
+ static void load(/+FIXFINAL+/ String bundleName, Class clazz) {
+ long start = System.currentTimeMillis();
+ final Field[] fieldArray = clazz.getDeclaredFields();
+ ClassLoader loader = clazz.getClassLoader();
+
+ bool isAccessible = (clazz.getModifiers() & Modifier.PUBLIC) !is 0;
+
+ //build a map of field names to Field objects
+ final int len = fieldArray.length_;
+ Map fields = new HashMap(len * 2);
+ for (int i = 0; i < len; i++)
+ fields.put(fieldArray[i].getName(), fieldArray[i]);
+
+ // search the variants from most specific to most general, since
+ // the MessagesProperties.put method will mark assigned fields
+ // to prevent them from being assigned twice
+ final String[] variants = buildVariants(bundleName);
+ for (int i = 0; i < variants.length_; i++) {
+ // loader==null if we're launched off the Java boot classpath
+ final InputStream input = loader is null ? ClassLoader.getSystemResourceAsStream(variants[i]) : loader.getResourceAsStream(variants[i]);
+ if (input is null)
+ continue;
+ try {
+ final MessagesProperties properties = new MessagesProperties(fields, bundleName, isAccessible);
+ properties.load(input);
+ } catch (IOException e) {
+ log(SEVERITY_ERROR, "Error loading " + variants[i], e); //$NON-NLS-1$
+ } finally {
+ if (input !is null)
+ try {
+ input.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ computeMissingMessages(bundleName, clazz, fields, fieldArray, isAccessible);
+ if (Debug.DEBUG_MESSAGE_BUNDLES)
+ System.out_.println("Time to load message bundle: " + bundleName + " was " + (System.currentTimeMillis() - start) + "ms."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ /*
+ * The method adds a log entry based on the error message and exception.
+ * The output is written to the System.err.
+ *
+ * This method is only expected to be called if there is a problem in
+ * the NLS mechanism. As a result, translation facility is not available
+ * here and messages coming out of this log are generally not translated.
+ *
+ * @param severity - severity of the message (SEVERITY_ERROR or SEVERITY_WARNING)
+ * @param message - message to log
+ * @param e - exception to log
+ */
+ static void log(int severity, String message, Exception e) {
+ if (frameworkLog !is null) {
+ frameworkLog.log(new FrameworkLogEntry("org.eclipse.osgi", severity, 1, message, 0, e, null)); //$NON-NLS-1$
+ return;
+ }
+ String statusMsg;
+ switch (severity) {
+ case SEVERITY_ERROR :
+ statusMsg = "Error: "; //$NON-NLS-1$
+ break;
+ case SEVERITY_WARNING :
+ // intentionally fall through:
+ default :
+ statusMsg = "Warning: "; //$NON-NLS-1$
+ }
+ if (message !is null)
+ statusMsg += message;
+ if (e !is null)
+ statusMsg += ": " + e.getMessage(); //$NON-NLS-1$
+ System.err.println(statusMsg);
+ if (e !is null)
+ e.printStackTrace();
+ }
+
+ /*
+ * Class which sub-classes java.util.Properties and uses the #put method
+ * to set field values rather than storing the values in the table.
+ */
+ private static class MessagesProperties : Properties {
+
+ private static final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC;
+ private static final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL;
+ private static final long serialVersionUID = 1L;
+
+ private final String bundleName;
+ private final Map fields;
+ private final bool isAccessible;
+
+ public this(Map fieldMap, String bundleName, bool isAccessible) {
+ super();
+ this.fields = fieldMap;
+ this.bundleName = bundleName;
+ this.isAccessible = isAccessible;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Hashtable#put(java.lang.Object, java.lang.Object)
+ */
+ public synchronized Object put(Object key, Object value) {
+ Object fieldObject = fields.put(key, ASSIGNED);
+ // if already assigned, there is nothing to do
+ if (fieldObject is ASSIGNED)
+ return null;
+ if (fieldObject is null) {
+ final String msg = "NLS unused message: " + key + " in_: " + bundleName;//$NON-NLS-1$ //$NON-NLS-2$
+ if (Debug.DEBUG_MESSAGE_BUNDLES)
+ System.out_.println(msg);
+ log(SEVERITY_WARNING, msg, null);
+ return null;
+ }
+ final Field field = cast(Field) fieldObject;
+ //can only set value of public static non-final fields
+ if ((field.getModifiers() & MOD_MASK) !is MOD_EXPECTED)
+ return null;
+ try {
+ // Check to see if we are allowed to modify the field. If we aren't (for instance
+ // if the class is not public) then change the accessible attribute of the field
+ // before trying to set the value.
+ if (!isAccessible)
+ field.setAccessible(true);
+ // Set the value into the field. We should never get an exception here because
+ // we know we have a public static non-final field. If we do get an exception, silently
+ // log it and continue. This means that the field will (most likely) be un-initialized and
+ // will fail later in the code and if so then we will see both the NPE and this error.
+ field.set(null, value);
+ } catch (Exception e) {
+ log(SEVERITY_ERROR, "Exception setting field value.", e); //$NON-NLS-1$
+ }
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff -r 88652073d1c2 -r bbe49769ec18 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/SWT.d
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/SWT.d Sat May 02 11:27:24 2009 +0200
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/SWT.d Sun Nov 08 12:42:30 2009 +0100
@@ -22,22 +22,22 @@
import java.lang.all;
version(build){
- pragma(link, "advapi32.lib");
- pragma(link, "comctl32.lib");
- pragma(link, "comdlg32.lib");
- pragma(link, "gdi32.lib");
- pragma(link, "kernel32.lib");
- pragma(link, "shell32.lib");
- pragma(link, "ole32.lib");
- pragma(link, "oleaut32.lib");
- pragma(link, "olepro32.lib");
- pragma(link, "oleacc.lib");
- pragma(link, "user32.lib");
- pragma(link, "usp10.lib");
- pragma(link, "msimg32.lib");
- pragma(link, "opengl32.lib");
- pragma(link, "shlwapi.lib");
- pragma(link, "org.eclipse.swt.win32.win32.x86.lib");
+ pragma(link, "advapi32");
+ pragma(link, "comctl32");
+ pragma(link, "comdlg32");
+ pragma(link, "gdi32");
+ pragma(link, "kernel32");
+ pragma(link, "shell32");
+ pragma(link, "ole32");
+ pragma(link, "oleaut32");
+ pragma(link, "olepro32");
+ pragma(link, "oleacc");
+ pragma(link, "user32");
+ pragma(link, "usp10");
+ pragma(link, "msimg32");
+ pragma(link, "opengl32");
+ pragma(link, "shlwapi");
+ pragma(link, "org.eclipse.swt.win32.win32.x86");
//pragma(link, "gdiplus"); // load dynamic
//pragma(link, "uxtheme"); // load dynamic
}
diff -r 88652073d1c2 -r bbe49769ec18 rakefile
--- a/rakefile Sat May 02 11:27:24 2009 +0200
+++ b/rakefile Sun Nov 08 12:42:30 2009 +0100
@@ -112,11 +112,13 @@
if isDebug
dbg_str = "Debug "
end
- puts "#{dbg_str}Building #{libname}"
resdir_abs = File.expand_path( File.join( basedir, resdir ))
srcdir_abs = File.expand_path( File.join( basedir, srcdir ))
+ STDERR.puts "#{dbg_str}Building #{libname}"
+ STDERR.puts "workdir=>#{srcdir_abs.to_path}"
+
FileUtils.mkdir_p DIR_IMP
FileUtils.mkdir_p DIR_OBJ
FileUtils.mkdir_p DIR_RES
@@ -312,14 +314,62 @@
end
desc "Build Equinox"
-task :equinox do
+task :default => :work
+
+desc "Build Equinox"
+task "equinox" do
buildTree( "org.eclipse.osgi", "osgi/src" , "res", nil, "org.eclipse.osgi.osgi" )
buildTree( "org.eclipse.osgi", "supplement/src", "res", nil, "org.eclipse.osgi.supplement")
buildTree( "org.eclipse.equinox.common", "src", "res" )
+
+ buildTree( "org.eclipse.osgi", "console/src", "res", nil, "org.eclipse.osgi.console")
+ buildTree( "org.eclipse.osgi", "core/adaptor", "res", nil, "org.eclipse.osgi.core.adaptor")
+ buildTree( "org.eclipse.osgi", "core/framework", "res", nil, "org.eclipse.osgi.core.framework")
+ buildTree( "org.eclipse.osgi", "defaultAdaptor/src", "res", nil, "org.eclipse.osgi.defaultadaptor")
+ buildTree( "org.eclipse.osgi", "eclipseAdaptor/src", "res", nil, "org.eclipse.osgi.eclipseadaptor")
+ buildTree( "org.eclipse.osgi", "jarverifier", "res", nil, "org.eclipse.osgi.jarverifier")
+ buildTree( "org.eclipse.osgi", "resolver/src", "res", nil, "org.eclipse.osgi.resolver")
+ buildTree( "org.eclipse.osgi", "security/src", "res", nil, "org.eclipse.osgi.security")
+ buildTree( "org.eclipse.osgi", "supplement/src", "res", nil, "org.eclipse.osgi.supplement")
+ buildTree( "org.eclipse.osgi.services", "src", "res" )
+ buildTree( "org.eclipse.equinox.app", "src", "res" )
+ buildTree( "org.eclipse.equinox.preferences", "src", "res" )
+ buildTree( "org.eclipse.equinox.registry", "src", "res" )
+ buildTree( "org.eclipse.equinox.security", "src", "res" )
end
desc "Build Current Working area"
task :work do
+ searchdirs = ""
+ searchdirs << "-I../../supplement/src "
+ searchdirs << "-I../../osgi/src "
+ searchdirs << "-I../../core/framework "
+ searchdirs << "-I../../supplement/src "
+ searchdirs << "-I../../console/src "
+ searchdirs << "-I../../core/adaptor "
+ searchdirs << "-I../../defaultAdaptor/src "
+ searchdirs << "-I../../eclipseAdaptor/src "
+ searchdirs << "-I../../jarverifier "
+ searchdirs << "-I../../resolver/src "
+ searchdirs << "-I../../security/src "
+
+ buildTree( "org.eclipse.osgi", "supplement/src", "res", searchdirs, "org.eclipse.osgi.supplement")
+ buildTree( "org.eclipse.osgi", "osgi/src" , "res", searchdirs, "org.eclipse.osgi.osgi" )
+ buildTree( "org.eclipse.osgi", "core/framework", "res", searchdirs, "org.eclipse.osgi.core.framework")
+ buildTree( "org.eclipse.osgi", "supplement/src", "res", nil, "org.eclipse.osgi.supplement")
+ buildTree( "org.eclipse.osgi", "console/src", "res", nil, "org.eclipse.osgi.console")
+ buildTree( "org.eclipse.osgi", "core/adaptor", "res", nil, "org.eclipse.osgi.core.adaptor")
+ buildTree( "org.eclipse.osgi", "defaultAdaptor/src", "res", nil, "org.eclipse.osgi.defaultadaptor")
+ buildTree( "org.eclipse.osgi", "eclipseAdaptor/src", "res", nil, "org.eclipse.osgi.eclipseadaptor")
+ buildTree( "org.eclipse.osgi", "jarverifier", "res", nil, "org.eclipse.osgi.jarverifier")
+ buildTree( "org.eclipse.osgi", "resolver/src", "res", nil, "org.eclipse.osgi.resolver")
+ buildTree( "org.eclipse.osgi", "security/src", "res", nil, "org.eclipse.osgi.security")
+ buildTree( "org.eclipse.osgi.services", "src", "res" )
+ buildTree( "org.eclipse.equinox.common", "src", "res" )
+ buildTree( "org.eclipse.equinox.app", "src", "res" )
+ buildTree( "org.eclipse.equinox.preferences", "src", "res" )
+ buildTree( "org.eclipse.equinox.registry", "src", "res" )
+ buildTree( "org.eclipse.equinox.security", "src", "res" )
end
desc "Build Eclipse Core"
@@ -364,10 +414,6 @@
task :all => [ :base, :swt, :equinox, :core, :jface, :jfacetext, :uiforms,
:draw2d, :swtsnippets, :jfacesnippets ]
-desc "Clean, then build ALL"
-task :default => [ :clean, :all ]
-
-
desc "Build SWT Snippet Collection"
task :swtsnippets, :explicit_snp do | t, args |