diff options
Diffstat (limited to 'bundles')
8 files changed, 123 insertions, 23 deletions
diff --git a/bundles/org.eclipse.equinox.app/.settings/.api_filters b/bundles/org.eclipse.equinox.app/.settings/.api_filters new file mode 100644 index 000000000..8391f1406 --- /dev/null +++ b/bundles/org.eclipse.equinox.app/.settings/.api_filters @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<component id="org.eclipse.equinox.app" version="2"> +<resource path="src/org/osgi/service/application/ApplicationException.java" type="org.osgi.service.application.ApplicationException"> +<filter id="1141899266"> +<message_arguments> +<message_argument value="1.1"/> +<message_argument value="1.2"/> +<message_argument value="APPLICATION_EXITVALUE_NOT_AVAILABLE"/> +</message_arguments> +</filter> +</resource> +<resource path="src/org/osgi/service/application/ApplicationHandle.java" type="org.osgi.service.application.ApplicationHandle"> +<filter id="1141899266"> +<message_arguments> +<message_argument value="1.1"/> +<message_argument value="1.2"/> +<message_argument value="getExitValue(long)"/> +</message_arguments> +</filter> +<filter id="1141899266"> +<message_arguments> +<message_argument value="1.1"/> +<message_argument value="1.2"/> +<message_argument value="APPLICATION_SUPPORTS_EXITVALUE"/> +</message_arguments> +</filter> +</resource> +</component> diff --git a/bundles/org.eclipse.equinox.app/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.app/META-INF/MANIFEST.MF index 8181174c6..a7eacff08 100755 --- a/bundles/org.eclipse.equinox.app/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.app/META-INF/MANIFEST.MF @@ -2,14 +2,14 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.app; singleton:=true -Bundle-Version: 1.1.0.qualifier +Bundle-Version: 1.2.0.qualifier Bundle-Vendor: %providerName Bundle-Activator: org.eclipse.equinox.internal.app.Activator Bundle-Localization: plugin Export-Package: org.eclipse.equinox.app;version="1.0", org.eclipse.equinox.internal.app;x-friends:="org.eclipse.core.runtime", - org.osgi.service.application;version="1.0" + org.osgi.service.application;version="1.1" Import-Package: org.eclipse.osgi.framework.console;resolution:=optional, org.eclipse.osgi.framework.log, org.eclipse.osgi.service.datalocation, diff --git a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java index 8d464745f..54f5e0017 100755 --- a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java +++ b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java @@ -343,18 +343,27 @@ public class EclipseAppHandle extends ApplicationHandle implements ApplicationRu } public synchronized Object waitForResult(int timeout) { + try { + return getExitValue(timeout); + } catch (ApplicationException e) { + // return null + } catch (InterruptedException e) { + // return null + } + return null; + } + + public synchronized Object getExitValue(long timeout) throws ApplicationException, InterruptedException { if (handleRegistration == null && application == null) return result; long startTime = System.currentTimeMillis(); long delay = timeout; while (!setResult && delay > 0) { - try { - wait(delay); // only wait for the specified amount of time - } catch (InterruptedException e) { - // Do nothing; return quickly - } + wait(delay); // only wait for the specified amount of time delay -= (System.currentTimeMillis() - startTime); } + if (result == null) + throw new ApplicationException(ApplicationException.APPLICATION_EXITVALUE_NOT_AVAILABLE); return result; } } diff --git a/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ApplicationAdminPermission.java b/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ApplicationAdminPermission.java index 561514806..8a190083c 100755 --- a/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ApplicationAdminPermission.java +++ b/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ApplicationAdminPermission.java @@ -1,7 +1,7 @@ /* - * $Header: /cvshome/build/org.osgi.service.application/src/org/osgi/service/application/ApplicationAdminPermission.java,v 1.34 2006/07/12 21:22:11 hargrave Exp $ + * $Date: 2007-12-19 15:42:59 -0500 (Wed, 19 Dec 2007) $ * - * Copyright (c) OSGi Alliance (2004, 2006). All Rights Reserved. + * 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. @@ -303,6 +303,9 @@ public class ApplicationAdminPermission extends Permission { private String pattern; private ApplicationDescriptor appDesc; + /** + * @param pattern + */ public SignerWrapper(String pattern) { this.pattern = pattern; } diff --git a/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ApplicationDescriptor.java b/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ApplicationDescriptor.java index 1c41ecbbb..8c8865af6 100755 --- a/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ApplicationDescriptor.java +++ b/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ApplicationDescriptor.java @@ -1,5 +1,5 @@ /* - * $Header: /cvshome/build/org.osgi.service.application/src/org/osgi/service/application/ApplicationDescriptor.java,v 1.61 2006/07/10 12:02:31 hargrave Exp $ + * $Date: 2007-11-12 04:35:34 -0500 (Mon, 12 Nov 2007) $ * * Copyright (c) OSGi Alliance (2004, 2006). All Rights Reserved. * @@ -248,8 +248,9 @@ public abstract class ApplicationDescriptor { * The following steps are made: * <UL> * <LI>Check for the appropriate permission. - * <LI>Check the locking state of the application. If locked then return - * null otherwise continue. + * <LI>Check the locking state of the application. If locked then throw + * an {@link ApplicationException} with the reason code + * {@link ApplicationException#APPLICATION_LOCKED}. * <LI>Calls the <code>launchSpecific()</code> method to create and start an application * instance. * <LI>Returns the <code>ApplicationHandle</code> returned by the @@ -275,7 +276,7 @@ public abstract class ApplicationDescriptor { * <code>org.osgi.</code>.</li> * </ul> * <P> - * The method is synchonous, it return only when the application instance was + * The method is synchronous, it return only when the application instance was * successfully started or the attempt to start it failed. * <P> * This method never returns <code>null</code>. If launching an application fails, diff --git a/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ApplicationException.java b/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ApplicationException.java index c30e112b1..748e3b504 100755 --- a/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ApplicationException.java +++ b/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ApplicationException.java @@ -1,7 +1,7 @@ /* - * $Header: /cvshome/build/org.osgi.service.application/src/org/osgi/service/application/ApplicationException.java,v 1.10 2006/07/10 11:49:12 hargrave Exp $ + * $Date: 2008-08-05 13:10:45 -0400 (Tue, 05 Aug 2008) $ * - * Copyright (c) OSGi Alliance (2005, 2006). All Rights Reserved. + * Copyright (c) OSGi Alliance (2005, 2008). 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. @@ -35,6 +35,10 @@ package org.osgi.service.application; * container during launch.</li> * <li> {@link #APPLICATION_SCHEDULING_FAILED} - The scheduling of an application * failed. + * <li> {@link #APPLICATION_DUPLICATE_SCHEDULE_ID} - The application scheduling failed + * because the specified identifier is already in use. + * <li> {@link #APPLICATION_EXITVALUE_NOT_AVAILABLE} - The exit value is not available + * for an application instance because the instance has not terminated. * </ul> * */ @@ -74,11 +78,19 @@ public class ApplicationException extends Exception { public static final int APPLICATION_DUPLICATE_SCHEDULE_ID = 0x05; /** + * The exit value is not available for an application instance because the + * instance has not terminated. + * + * @since 1.1 + */ + public static final int APPLICATION_EXITVALUE_NOT_AVAILABLE = 0x06; + + /** * Creates an <code>ApplicationException</code> with the specified error code. * @param errorCode The code of the error */ public ApplicationException(int errorCode) { - this(errorCode,(Throwable) null); + this(errorCode, (Throwable) null); } /** @@ -99,7 +111,7 @@ public class ApplicationException extends Exception { * @param message The associated message */ public ApplicationException(int errorCode, String message) { - this(errorCode, message,null); + this(errorCode, message, null); } /** @@ -127,7 +139,7 @@ public class ApplicationException extends Exception { } /** - * Returns the error code associcated with this exception. + * Returns the error code associated with this exception. * @return The error code of this exception. */ public int getErrorCode() { diff --git a/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ApplicationHandle.java b/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ApplicationHandle.java index 110d8a7c0..2b8504803 100755 --- a/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ApplicationHandle.java +++ b/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ApplicationHandle.java @@ -1,7 +1,7 @@ /* - * $Header: /cvshome/build/org.osgi.service.application/src/org/osgi/service/application/ApplicationHandle.java,v 1.41 2006/07/10 12:02:31 hargrave Exp $ + * $Date: 2008-08-05 13:38:19 -0400 (Tue, 05 Aug 2008) $ * - * Copyright (c) OSGi Alliance (2004, 2006). All Rights Reserved. + * Copyright (c) OSGi Alliance (2004, 2008). 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. @@ -46,11 +46,19 @@ public abstract class ApplicationHandle { public final static String APPLICATION_DESCRIPTOR = "application.descriptor"; /** - * The property key for the state of this appliction instance. + * The property key for the state of this application instance. */ public final static String APPLICATION_STATE = "application.state"; /** + * The property key for the supports exit value property of this application + * instance. + * + * @since 1.1 + */ + public final static String APPLICATION_SUPPORTS_EXITVALUE = "application.supports.exitvalue"; + + /** * The application instance is running. This is the initial state of a newly * created application instance. */ @@ -121,6 +129,45 @@ public abstract class ApplicationHandle { public abstract String getState(); /** + * Returns the exit value for the application instance. The timeout + * specifies how the method behaves when the application has not yet + * terminated. A negative, zero or positive value may be used. + * <ul> + * <li> negative - The method does not wait for termination. If the + * application has not terminated then an <code>ApplicationException</code> + * is thrown.</li> + * + * <li> zero - The method waits until the application terminates.</li> + * + * <li> positive - The method waits until the application terminates or the + * timeout expires. If the timeout expires and the application has not + * terminated then an <code>ApplicationException</code> is thrown.</li> + * </ul> + * <p> + * The default implementation throws an + * <code>UnsupportedOperationException</code>. The application model should + * override this method if exit values are supported. + * </p> + * + * @param timeout The maximum time in milliseconds to wait for the + * application to timeout. + * @return The exit value for the application instance. The value is + * application specific. + * @throws UnsupportedOperationException If the application model does not + * support exit values. + * @throws InterruptedException If the thread is interrupted while waiting + * for the timeout. + * @throws ApplicationException If the application has not terminated. The + * error code will be + * {@link ApplicationException#APPLICATION_EXITVALUE_NOT_AVAILABLE}. + * + * @since 1.1 + */ + public Object getExitValue(long timeout) throws ApplicationException, InterruptedException{ + throw new UnsupportedOperationException(); + } + + /** * Returns the unique identifier of this instance. This value is also * available as a service property of this application handle's service.pid. * diff --git a/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ScheduledApplication.java b/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ScheduledApplication.java index 46cfe5e66..c462ec79f 100755 --- a/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ScheduledApplication.java +++ b/bundles/org.eclipse.equinox.app/src/org/osgi/service/application/ScheduledApplication.java @@ -1,7 +1,7 @@ /* - * $Header: /cvshome/build/org.osgi.service.application/src/org/osgi/service/application/ScheduledApplication.java,v 1.20 2006/07/06 14:59:29 sboshev Exp $ + * $Date: 2007-12-19 15:42:59 -0500 (Wed, 19 Dec 2007) $ * - * Copyright (c) OSGi Alliance (2004, 2006). All Rights Reserved. + * 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. |