diff --git a/Applications/CoreApp/CMakeLists.txt b/Applications/CoreApp/CMakeLists.txt
index 8044c1c25d..28a216b791 100644
--- a/Applications/CoreApp/CMakeLists.txt
+++ b/Applications/CoreApp/CMakeLists.txt
@@ -1,66 +1,68 @@
FIND_PACKAGE(BlueBerry REQUIRED)
+INCLUDE(${QT_USE_FILE})
+
INCLUDE_DIRECTORIES(
${BLUEBERRY_PLUGIN_SOURCE_DIRS}
- ${org.blueberry.osgi_BIN_DIR} # needed for generated berryConfig.h
+ ${org_blueberry_osgi_INCLUDE_DIRS}
${Poco_INCLUDE_DIRS}
+ ${mbilog_INCLUDE_DIRS}
)
-LINK_DIRECTORIES(${Poco_LIBRARY_DIRS}
- ${BLUEBERRY_PLUGINS_OUTPUT_DIR}/org.blueberry.osgi/bin
- )
+
+LINK_DIRECTORIES(${Poco_LIBRARY_DIRS})
IF(MITK_SHOW_CONSOLE_WINDOW)
ADD_EXECUTABLE(CoreApp MACOSX_BUNDLE CoreApp.cpp)
ELSE(MITK_SHOW_CONSOLE_WINDOW)
ADD_EXECUTABLE(CoreApp MACOSX_BUNDLE WIN32 CoreApp.cpp)
ENDIF(MITK_SHOW_CONSOLE_WINDOW)
IF (WIN32)
FIND_PACKAGE(Qt4)
TARGET_LINK_LIBRARIES(CoreApp ${QT_QTCORE_LIBRARY} ${QT_QTMAIN_LIBRARY})
ENDIF(WIN32)
TARGET_LINK_LIBRARIES(CoreApp
optimized PocoFoundation debug PocoFoundationd
optimized PocoUtil debug PocoUtild
- optimized org_blueberry_osgi debug org_blueberry_osgi${BLUEBERRY_DEBUG_POSTFIX})
+ org_blueberry_osgi)
-SET_TARGET_PROPERTIES(CoreApp PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${CMAKE_INSTALL_RPATH}/BlueBerry/org.blueberry.osgi/bin")
+SET_TARGET_PROPERTIES(CoreApp PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${CMAKE_INSTALL_RPATH}/plugins")
# subproject support
ADD_DEPENDENCIES(MITK-CoreUI CoreApp)
IF(MITK_ENABLE_GUI_TESTING)
ADD_DEPENDENCIES(MITK-CoreUI solstice)
ENDIF()
SET(_plugin_deps
${BLUEBERRY_ENABLED_PLUGINS}
${MITK_CORE_ENABLED_PLUGINS}
- ${MITK_CORE_ENABLED_TEST_PLUGINS}
)
IF(_plugin_deps)
# Make sure all enabled plug-ins are up to date
ADD_DEPENDENCIES(CoreApp ${_plugin_deps})
ENDIF()
SET(BLUEBERRY_PLUGIN_CACHE_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugin_cache")
CONFIGURE_FILE(CoreApp.ini
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CoreApp.ini)
IF(WIN32)
FOREACH(COREAPP_BUILD_TYPE debug release)
mitkFunctionCreateWindowsBatchScript(startCoreApp.bat.in
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/startCoreApp_${COREAPP_BUILD_TYPE}.bat
${COREAPP_BUILD_TYPE})
ENDFOREACH()
ENDIF(WIN32)
MITK_INSTALL_TARGETS(EXECUTABLES CoreApp GLOB_PLUGINS )
+mitkFunctionInstallProvisioningFiles(${BLUEBERRY_PLUGIN_PROVISIONING_FILE} ${MITK_COREAPP_PROVISIONING_FILE})
IF(UNIX AND MITK_INSTALL_RPATH_RELATIVE AND NOT APPLE)
INSTALL(PROGRAMS "${MITK_SOURCE_DIR}/CMake/RunInstalledApp.sh" DESTINATION "." RENAME CoreApp.sh)
ENDIF()
SET(MITK_CPACK_PACKAGE_EXECUTABLES ${MITK_CPACK_PACKAGE_EXECUTABLES} "CoreApp;MITK - CoreApp Application" CACHE INTERNAL "Collecting windows shortcuts to executables")
diff --git a/Applications/CoreApp/CoreApp.cpp b/Applications/CoreApp/CoreApp.cpp
index b2cda40088..d04ffc65c3 100644
--- a/Applications/CoreApp/CoreApp.cpp
+++ b/Applications/CoreApp/CoreApp.cpp
@@ -1,41 +1,86 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/ for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include
* This class is a partial implementation of
* Subclasses may extend the definition of this method (i.e., if a different
* type of listener can be attached to a subclass). This is used primarily
* for support of
* Returns true iff there is one or more IHandlerListeners attached to this
* AbstractHandler.
*
* Subclasses may extend the definition of this method (i.e., if a different
* type of listener can be attached to a subclass). This is used primarily
* for support of
* This class is not intended to be extended by clients.
*
* An event indicating that the set of defined command identifiers has changed.
*
* This class is not intended to be extended by clients.
*
* This interface may be implemented by clients.
*
* A listener to the execution of commands. This listener will be notified if a
* command is about to execute, and when that execution completes. It is not
* possible for the listener to prevent the execution, only to respond to it in
* some way.
*
* This interface may be implemented by clients.
*
* An object that holds zero or more state objects. This state information can
* be shared between different instances of
* Clients may implement, but must not extend this interface.
* IHandler
. This
* abstract implementation provides support for handler listeners. You should
* subclass from this class unless you want to implement your own listener
* support. Subclasses should call
* {@link AbstractHandler#fireHandlerChanged(HandlerEvent)}when the handler
* changes. Subclasses can also override {@link AbstractHandler#isEnabled()} and
* {@link AbstractHandler#isHandled()}.
* true
* @see #setEnabled(Object)
* @see #setBaseEnabled(boolean)
*/
bool IsEnabled();
/**
* Whether this handler is capable of handling delegated responsibilities at
* this time. Subclasses may override this method.
*
* @return true
*/
bool IsHandled();
/**
* @see IHandler#removeHandlerListener(IHandlerListener)
*/
// void RemoveHandlerListener(final IHandlerListener handlerListener) {
// removeListenerObject(handlerListener);
// }
protected:
/**
* Fires an event to all registered listeners describing changes to this
* instance.
* AbstractHandler
in
* org.blueberry.ui.workbench
, and clients should be wary of
* overriding this behaviour. If this method is overridden, then the first
* line of the method should be "super.fireHandlerChanged(handlerEvent);
".
* null
.
*/
// void FireHandlerChanged(final HandlerEvent handlerEvent) {
// if (handlerEvent == null) {
// throw new NullPointerException();
// }
//
// final Object[] listeners = getListeners();
// for (int i = 0; i < listeners.length; i++) {
// final IHandlerListener listener = (IHandlerListener) listeners[i];
// listener.handlerChanged(handlerEvent);
// }
// }
/**
* Allow the default {@link #isEnabled()} to answer our enabled state. It
* will fire a HandlerEvent if necessary. If clients use this method they
* should also consider overriding {@link #setEnabled(Object)} so they can
* be notified about framework execution contexts.
*
* @param state
* the enabled state
* @since 3.4
*/
void SetBaseEnabled(bool state);
/**
* AbstractHandler
in
* org.blueberry.ui.workbench
, and clients should be wary of
* overriding this behaviour. If this method is overridden, then the return
* value should include "super.hasListeners() ||
".
* Command
.
* true
, iff the category property changed.
* @param definedChanged
* true
, iff the defined property changed.
* @param descriptionChanged
* true
, iff the description property changed.
* @param handledChanged
* true
, iff the handled property changed.
* @param nameChanged
* true
, iff the name property changed.
* @param parametersChanged
* true
if the parameters have changed;
* false
otherwise.
* @param returnTypeChanged
* true
iff the return type property changed;
* false
otherwise.
* @param helpContextIdChanged
* true
iff the help context identifier changed;
* false
otherwise.
* @param enabledChanged
* true
iff the comand enablement changed;
* false
otherwise.
* @since 3.3
*/
CommandEvent(const SmartPointernull
.
*/
SmartPointertrue
, iff the category property changed.
*/
bool IsCategoryChanged() const;
/**
* Returns whether or not the handled property changed.
*
* @return true
, iff the handled property changed.
*/
bool IsHandledChanged() const;
/**
* Returns whether or not the help context identifier changed.
*
* @return true
, iff the help context identifier changed.
* @since 3.2
*/
bool IsHelpContextIdChanged() const;
/**
* Returns whether or not the parameters have changed.
*
* @return true
, iff the parameters property changed.
*/
bool IsParametersChanged() const;
/**
* Returns whether or not the return type property changed.
*
* @return true
, iff the return type property changed.
* @since 3.2
*/
bool IsReturnTypeChanged() const;
/**
* Return whether the enable property changed.
*
* @return true
iff the comand enablement changed
* @since 3.3
*/
bool IsEnabledChanged() const;
private:
/**
* The bit used to represent whether the command has changed its category.
*/
static const int CHANGED_CATEGORY; // = LAST_USED_BIT << 1;
/**
* The bit used to represent whether the command has changed its handler.
*/
static const int CHANGED_HANDLED; // = LAST_USED_BIT << 2;
/**
* The bit used to represent whether the command has changed its parameters.
*/
static const int CHANGED_PARAMETERS; // = LAST_USED_BIT << 3;
/**
* The bit used to represent whether the command has changed its return
* type.
*
* @since 3.2
*/
static const int CHANGED_RETURN_TYPE; // = LAST_USED_BIT << 4;
/**
* The bit used to represent whether the command has changed its help
* context identifier.
*
* @since 3.2
*/
static const int CHANGED_HELP_CONTEXT_ID; // = LAST_USED_BIT << 5;
/**
* The bit used to represent whether this commands active handler has
* changed its enablement state.
*
* @since 3.3
*/
static const int CHANGED_ENABLED; // = LAST_USED_BIT << 6;
/**
* The command that has changed; this value is never null
.
*/
const SmartPointerCommandManagerEvent
instance to describe
* changes to commands and/or categories.
*
* @param commandManager
* the instance of the interface that changed; must not be
* null
.
* @param commandId
* The command identifier that was added or removed; must not be
* null
if commandIdChanged is true
.
* @param commandIdAdded
* Whether the command identifier became defined (otherwise, it
* became undefined).
* @param commandIdChanged
* Whether the list of defined command identifiers has changed.
* @param categoryId
* The category identifier that was added or removed; must not be
* null
if categoryIdChanged is true
.
* @param categoryIdAdded
* Whether the category identifier became defined (otherwise, it
* became undefined).
* @param categoryIdChanged
* Whether the list of defined category identifiers has changed.
*/
CommandManagerEvent (CommandManager& commandManager,
const std::string& commandId, const bool commandIdAdded,
const bool commandIdChanged, const std::string& categoryId,
const bool categoryIdAdded, const bool categoryIdChanged);
/**
* Creates a new CommandManagerEvent
instance to describe
* changes to command parameter types.
*
* @param commandManager
* the instance of the interface that changed; must not be
* null
.
* @param parameterTypeId
* The command parameter type identifier that was added or
* removed; must not be null
if
* parameterTypeIdChanged is true
.
* @param parameterTypeIdAdded
* Whether the parameter type identifier became defined
* (otherwise, it became undefined).
* @param parameterTypeIdChanged
* Whether the list of defined parameter type identifiers has
* changed.
*
* @since 3.2
*/
CommandManagerEvent(CommandManager& commandManager,
const std::string& parameterTypeId, const bool parameterTypeIdAdded,
const bool parameterTypeIdChanged);
/**
* Returns the category identifier that was added or removed.
*
* @return The category identifier that was added or removed; may be
* null
.
*/
std::string GetCategoryId() const;
/**
* Returns the command identifier that was added or removed.
*
* @return The command identifier that was added or removed; may be
* null
.
*/
std::string GetCommandId() const;
/**
* Returns the instance of the interface that changed.
*
* @return the instance of the interface that changed. Guaranteed not to be
* null
.
*/
CommandManager& GetCommandManager() const;
/**
* Returns the command parameter type identifier that was added or removed.
*
* @return The command parameter type identifier that was added or removed;
* may be null
.
*
* @since 3.2
*/
std::string GetParameterTypeId() const;
/**
* Returns whether the list of defined category identifiers has changed.
*
* @return true
if the list of category identifiers has
* changed; false
otherwise.
*/
bool IsCategoryChanged() const;
/**
* Returns whether the category identifier became defined. Otherwise, the
* category identifier became undefined.
*
* @return true
if the category identifier became defined;
* false
if the category identifier became undefined.
*/
bool IsCategoryDefined() const;
/**
* Returns whether the list of defined command identifiers has changed.
*
* @return true
if the list of command identifiers has
* changed; false
otherwise.
*/
bool IsCommandChanged() const;
/**
* Returns whether the command identifier became defined. Otherwise, the
* command identifier became undefined.
*
* @return true
if the command identifier became defined;
* false
if the command identifier became undefined.
*/
bool IsCommandDefined() const;
/**
* Returns whether the list of defined command parameter type identifiers
* has changed.
*
* @return true
if the list of command parameter type
* identifiers has changed; false
otherwise.
*
* @since 3.2
*/
bool IsParameterTypeChanged() const;
/**
* Returns whether the command parameter type identifier became defined.
* Otherwise, the command parameter type identifier became undefined.
*
* @return true
if the command parameter type identifier
* became defined; false
if the command parameter
* type identifier became undefined.
*
* @since 3.2
*/
bool IsParameterTypeDefined() const;
private:
/**
* The bit used to represent whether the given category has become defined.
* If this bit is not set and there is no category id, then no category has
* become defined nor undefined. If this bit is not set and there is a
* category id, then the category has become undefined.
*/
static const int CHANGED_CATEGORY_DEFINED; // = 1;
/**
* The bit used to represent whether the given command has become defined.
* If this bit is not set and there is no command id, then no command has
* become defined nor undefined. If this bit is not set and there is a
* command id, then the command has become undefined.
*/
static const int CHANGED_COMMAND_DEFINED; // = 1 << 1;
/**
* The bit used to represent whether the given command parameter type has
* become defined. If this bit is not set and there is no parameter type id,
* then no parameter type has become defined nor undefined. If this bit is
* not set and there is a parameter type id, then the parameter type has
* become undefined.
*
* @since 3.2
*/
static const int CHANGED_PARAMETER_TYPE_DEFINED; // = 1 << 2;
/**
* The category identifier that was added or removed from the list of
* defined category identifiers. This value is null
if the
* list of defined category identifiers did not change.
*/
const std::string categoryId;
/**
* A collection of bits representing whether certain values have changed. A
* bit is set (i.e., 1
) if the corresponding property has
* changed.
*/
int changedValues;
/**
* The command identifier that was added or removed from the list of defined
* command identifiers. This value is null
if the list of
* defined command identifiers did not change.
*/
const std::string commandId;
/**
* The command parameter type identifier that was added or removed from the
* list of defined parameter type identifiers. This value is
* null
if the list of defined parameter type identifiers did
* not change.
*/
const std::string parameterTypeId;
/**
* The command manager that has changed.
*/
CommandManager& commandManager;
};
}
#endif /* BERRYCOMMANDMANAGEREVENT_H_ */
diff --git a/BlueBerry/Bundles/org.blueberry.core.commands/src/berryCommandsDll.h b/BlueBerry/Bundles/org.blueberry.core.commands/src/berryCommandsDll.h
deleted file mode 100644
index 69636e15ee..0000000000
--- a/BlueBerry/Bundles/org.blueberry.core.commands/src/berryCommandsDll.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*=========================================================================
-
-Program: BlueBerry Platform
-Language: C++
-Date: $Date$
-Version: $Revision$
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-#ifndef BERRYCOMMANDSDLL_H_
-#define BERRYCOMMANDSDLL_H_
-
-
-//
-// The following block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the MITK_EXPORTS
-// symbol defined on the command line. this symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// MITK_API functions as being imported from a DLL, wheras this DLL sees symbols
-// defined with this macro as being exported.
-//
-#if defined(_WIN32) && !defined(BERRY_STATIC)
- #if defined(org_blueberry_core_commands_EXPORTS)
- #define BERRY_COMMANDS __declspec(dllexport)
- #else
- #define BERRY_COMMANDS __declspec(dllimport)
- #endif
-#endif
-
-
-#if !defined(BERRY_COMMANDS)
- #define BERRY_COMMANDS
-#endif
-
-#endif /*BERRYCOMMANDSDLL_H_*/
diff --git a/BlueBerry/Bundles/org.blueberry.core.commands/src/berryHandlerEvent.h b/BlueBerry/Bundles/org.blueberry.core.commands/src/berryHandlerEvent.h
index 072c4b0a6d..e4b0332087 100755
--- a/BlueBerry/Bundles/org.blueberry.core.commands/src/berryHandlerEvent.h
+++ b/BlueBerry/Bundles/org.blueberry.core.commands/src/berryHandlerEvent.h
@@ -1,105 +1,105 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRYHANDLEREVENT_H_
#define BERRYHANDLEREVENT_H_
#include "common/berryAbstractBitSetEvent.h"
-#include "berryCommandsDll.h"
+#include IHandler
.
* null
.
* @param enabledChanged
* Whether the enabled state of the handler has changed.
* @param handledChanged
* Whether the handled state of the handler has changed.
*/
HandlerEvent(const SmartPointernull
.
*/
SmartPointertrue
, iff the enabled property changed.
*/
bool IsEnabledChanged() const;
/**
* Returns whether or not the handled property changed.
*
* @return true
, iff the handled property changed.
*/
bool IsHandledChanged() const ;
private:
/**
* The bit used to represent whether the handler has changed its enabled
* state.
*/
static const int CHANGED_ENABLED; // = 1;
/**
* The bit used to represent whether the handler has changed its handled
* state.
*/
static const int CHANGED_HANDLED; // = 1 << 1;
/**
* The handler that changed; this value is never null
.
*/
const SmartPointerICommandManager
.
* ICommandManager
have changed. Specific details are
* described in the CommandManagerEvent
.
*
* @param commandManagerEvent
* the commandManager event. Guaranteed not to be
* null
.
*/
virtual void CommandManagerChanged(const SmartPointernull
* @param exception
* The exception that occurred; never null
.
*/
virtual void NotHandled(const std::string& commandId, const NotHandledException* exception) = 0;
/**
* Notifies the listener that a command has failed to complete execution.
*
* @param commandId
* The identifier of the command that has executed; never
* null
.
* @param exception
* The exception that occurred; never null
.
*/
virtual void PostExecuteFailure(const std::string& commandId,
const ExecutionException* exception) = 0;
/**
* Notifies the listener that a command has completed execution
* successfully.
*
* @param commandId
* The identifier of the command that has executed; never
* null
.
* @param returnValue
* The return value from the command; may be null
.
*/
virtual void PostExecuteSuccess(const std::string& commandId, const Object::Pointer returnValue) = 0;
/**
* Notifies the listener that a command is about to execute.
*
* @param commandId
* The identifier of the command that is about to execute, never
* null
.
* @param event
* The event that will be passed to the execute
* method; never null
.
*/
virtual void PreExecute(const std::string& commandId, const SmartPointerIHandlerListener
to listen for
* changes to properties of this instance.
*
* @param handlerListener
* the instance to register. Must not be null
. If
* an attempt is made to register an instance which is already
* registered with this instance, no operation is performed.
*/
virtual void AddHandlerListener(SmartPointernull
.
* @return the result of the execution. Reserved for future use, must be
* null
.
* @throws ExecutionException
* if an exception occurred during execution.
*/
virtual Object::Pointer Execute(const SmartPointernull
* which indicates that the handler can query whatever model that
* is necessary. This context must not be cached.
*/
virtual void SetEnabled(Object::ConstPointer evaluationContext) = 0;
/**
* Returns whether this handler is capable of executing at this moment in
* time. If the enabled state is other than true clients should also
* consider implementing IHandler2 so they can be notified about framework
* execution contexts.
*
* @return true
if the command is enabled; false
* otherwise.
* @see IHandler2#setEnabled(Object)
*/
virtual bool IsEnabled() const = 0;
/**
* Returns whether this handler is really capable of handling delegation. In
* the case of a handler that is a composition of other handlers, this reply
* is intended to indicate whether the handler is truly capable of receiving
* delegated responsibilities at this time.
*
* @return true
if the handler is handled; false
* otherwise.
*/
virtual bool IsHandled() const = 0;
/**
* Unregisters an instance of IHandlerListener
listening for
* changes to properties of this instance.
*
* @param handlerListener
* the instance to unregister. Must not be null
.
* If an attempt is made to unregister an instance which is not
* already registered with this instance, no operation is
* performed.
*/
virtual void RemoveHandlerListener(SmartPointerIHandler
.
* IHandler
have changed. Specific details are described in
* the HandlerEvent
.
*
* @param handlerEvent
* the handler event. Guaranteed not to be null
.
*/
virtual void HandlerChanged(SmartPointerIObjectWithState
.
* null
.
* @param state
* The new state to add to this object; must not be
* null
.
*/
virtual void AddState(const std::string& id, const State::Pointer state) = 0;
/**
* Gets the state with the given id.
*
* @param stateId
* The identifier of the state to retrieve; must not be
* null
.
* @return The state; may be null
if there is no state with
* the given id.
*/
virtual State::Pointer GetState(const std::string& stateId) const = 0;
/**
* Gets the identifiers for all of the state associated with this object.
*
* @return All of the state identifiers; may be empty, but never
* null
.
*/
virtual std::vectornull
.
*/
virtual void RemoveState(const std::string& stateId) = 0;
};
}
#endif /*BERRYIOBJECTWITHSTATE_H_*/
diff --git a/BlueBerry/Bundles/org.blueberry.core.commands/src/berryIParameter.h b/BlueBerry/Bundles/org.blueberry.core.commands/src/berryIParameter.h
index c96d9e2817..3926f08d40 100644
--- a/BlueBerry/Bundles/org.blueberry.core.commands/src/berryIParameter.h
+++ b/BlueBerry/Bundles/org.blueberry.core.commands/src/berryIParameter.h
@@ -1,80 +1,80 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRYIPARAMETER_H_
#define BERRYIPARAMETER_H_
#include
* There is no guarantee that the same instance of a property tester is used * to handle <test property="..."/> requests. So property testers * should always be implemented in a stateless fashion. *
* @since 3.0 */ class BERRY_EXPRESSIONS PropertyTester : public IPropertyTester { private: IConfigurationElement::Pointer fConfigElement; std::string fNamespace; std::string fProperties; public: /** * Initialize the property tester with the given name space and property. ** Note: this method is for internal use only. Clients must not call * this method. *
* @param descriptor the descriptor object for this tester */ void InternalInitialize(PropertyTesterDescriptor::Pointer descriptor); /** * Note: this method is for internal use only. Clients must not call * this method. * * @return the property tester descriptor */ PropertyTesterDescriptor::Pointer InternalCreateDescriptor(); /** * {@inheritDoc} */ bool Handles(const std::string& namespaze, const std::string& property); /** * {@inheritDoc} */ bool IsInstantiated(); /** * {@inheritDoc} */ bool IsDeclaringPluginActive(); /** * {@inheritDoc} */ IPropertyTester* Instantiate(); }; } // namespace berry #endif /*BERRYPROPERTYTESTER_H_*/ diff --git a/BlueBerry/Bundles/org.blueberry.core.expressions/src/internal/berryExpressions.cpp b/BlueBerry/Bundles/org.blueberry.core.expressions/src/internal/berryExpressions.cpp index 9f349bffc2..52283b238e 100644 --- a/BlueBerry/Bundles/org.blueberry.core.expressions/src/internal/berryExpressions.cpp +++ b/BlueBerry/Bundles/org.blueberry.core.expressions/src/internal/berryExpressions.cpp @@ -1,319 +1,319 @@ /*========================================================================= Program: BlueBerry Platform Language: C++ Date: $Date$ Version: $Revision$ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "berryExpressions.h" -#include "berryPlatform.h" -#include "berryPlatformException.h" -#include "service/berryServiceRegistry.h" +#include-1
if not applicable for this type of event.
* This value is only applicable for the scheduled
event.
*
* @return the delay time for this event
*/
virtual Poco::Timestamp::TimeDiff GetDelay() const = 0;
/**
* The job on which this event occurred.
*
* @return the job for this event
*/
virtual SmartPointernull
if
* not applicable. This value is only applicable for the done
event.
*
* @return the status for this event
*/
virtual IStatus::Pointer GetResult() const = 0;
};
}
#endif /* BERRYIJOBCHANGEEVENT_H_ */
diff --git a/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryIJobManager.h b/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryIJobManager.h
index 601562e691..0b1729e591 100644
--- a/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryIJobManager.h
+++ b/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryIJobManager.h
@@ -1,441 +1,441 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _BERRY_IJOBMANAGER_H
#define _BERRY_IJOBMANAGER_H
#includeschedule
method.true
to force all worker
* threads to be created as daemon threads. Set to false
to force
* all worker threads to be created as non-daemon threads.
*
* not used yet
*/
static const std::string PROP_USE_DAEMON_THREADS ;
/**
* Registers a job listener with the job manager.
* Has no effect if an identical listener is already registered.
*
* @param listener the listener to be added
* @see #removeJobChangeListener(IJobChangeListener)
* @see IJobChangeListener
*/
virtual void AddJobChangeListener(IJobChangeListener::Pointer listener) = 0;
///**
// * Begins applying this rule in the calling thread. If the rule conflicts with another
// * rule currently running in another thread, this method blocks until there are
// * no conflicting rules. Calls to beginRule must eventually be followed
// * by a matching call to endRule in the same thread and with the identical
// * rule instance.
// * // * Rules can be nested only if the rule for the inner beginRule // * is contained within the rule for the outer beginRule. Rule containment // * is tested with the API method ISchedulingRule.contains. Also, begin/end // * pairs must be strictly nested. Only the rule that has most recently begun // * can be ended at any given time. // *
// * A rule of null
can be used, but will be ignored for scheduling
// * purposes. The outermost non-null rule in the thread will be used for scheduling. A
// * null
rule that is begun must still be ended.
// *
// * If this method is called from within a job that has a scheduling rule, the // * given rule must also be contained within the rule for the running job. // *
// * Note that endRule must be called even if beginRule fails. // * The recommended usage is: // *
// * final ISchedulingRule rule = ...; // * try { // * manager.beginRule(rule, monitor); // * } finally { // * manager.endRule(rule); // * } // *// * // * @param rule the rule to begin applying in this thread, or
null
// * @param monitor a progress monitor, or null
if progress
// * reporting and cancellation are not desired
// * @throws IllegalArgumentException if the rule is not strictly nested within
// * all other rules currently active for this thread
// * @throws OperationCanceledException if the supplied monitor reports cancelation
// * before the rule becomes available
// * @see ISchedulingRule#contains(ISchedulingRule)
// */
/// virtual void BeginRule(const ISchedulingRule& rule, const IProgressMonitor& monitor) = 0;
///**
// * Cancels all jobs in the given job family. Jobs in the family that are currently waiting
// * will be removed from the queue. Sleeping jobs will be discarded without having
// * a chance to wake up. Currently executing jobs will be asked to cancel but there
// * is no guarantee that they will do so.
// *
// * @param family the job family to cancel, or null
to cancel all jobs
// * @see Job#belongsTo(Object)
// */
/// virtual void Cancel(const Object& family);
/**
* Returns a progress monitor that can be used to provide
* aggregated progress feedback on a set of running jobs. A user
* interface will typically group all jobs in a progress group together,
* providing progress feedback for individual jobs as well as aggregated
* progress for the entire group. Jobs in the group may be run sequentially,
* in parallel, or some combination of the two.
* * Recommended usage (this snippet runs two jobs in sequence in a * single progress group): *
* Job parseJob, compileJob; * IProgressMonitor pm = Platform.getJobManager().createProgressGroup(); * try { * pm.beginTask("Building", 10); * parseJob.setProgressGroup(pm, 5); * parseJob.schedule(); * compileJob.setProgressGroup(pm, 5); * compileJob.schedule(); * parseJob.join(); * compileJob.join(); * } finally { * pm.done(); * } ** * @see Job#setProgressGroup(IProgressMonitor, int) * @see IProgressMonitor * @return a progress monitor */ virtual IProgressMonitor::Pointer CreateProgressGroup() = 0; ///** // * Returns the job that is currently running in this thread, or
null
if there
// * is no currently running job.
// *
// * @return the job or null
// */
//// virtual Job CurrentJob() = 0;
///**
// * Ends the application of a rule to the calling thread. Calls to endRule
// * must be preceded by a matching call to beginRule in the same thread
// * with an identical rule instance.
// *
// * Rules can be nested only if the rule for the inner beginRule
// * is contained within the rule for the outer beginRule. Also, begin/end
// * pairs must be strictly nested. Only the rule that has most recently begun
// * can be ended at any given time.
// *
// * @param rule the rule to end applying in this thread
// * @throws IllegalArgumentException if this method is called on a rule for which
// * there is no matching begin, or that does not match the most recent begin.
// * @see ISchedulingRule#contains(ISchedulingRule)
// */
/// virtual void EndRule(const ISchedulingRule& rule) = 0;
///**
// * Returns all waiting, executing and sleeping jobs belonging
// * to the given family. If no jobs are found, an empty array is returned.
// *
// * @param family the job family to find, or null
to find all jobs
// * @return the job array
// * @see Job#belongsTo(Object)
// */
/// virtual Job[] Find(const Object& family) = 0;
/**
* Returns whether the job manager is currently idle. The job manager is
* idle if no jobs are currently running or waiting to run.
*
* @return true
if the job manager is idle, and
* false
otherwise
* @since 3.1
*/
virtual bool IsIdle()= 0;
/**
* Returns whether the job manager is currently suspended.
*
* @return true
if the job manager is suspended, and
* false
otherwise
* @since 3.4
* @see #suspend()
* @see #resume()
*/
virtual bool IsSuspended() = 0;
///**
// * Waits until all jobs of the given family are finished. This method will block the
// * calling thread until all such jobs have finished executing, or until this thread is
// * interrupted. If there are no jobs in
// * the family that are currently waiting, running, or sleeping, this method returns
// * immediately. Feedback on how the join is progressing is provided to a progress
// * monitor.
// *
// * If this method is called while the job manager is suspended, only jobs // * that are currently running will be joined; Once there are no jobs // * in the family in the {@link Job#RUNNING} state, this method returns. // *
// *// * Note that there is a deadlock risk when using join. If the calling thread owns // * a lock or object monitor that the joined thread is waiting for, deadlock // * will occur. This method can also result in starvation of the current thread if // * another thread continues to add jobs of the given family, or if a // * job in the given family reschedules itself in an infinite loop. // *
// * // * @param family the job family to join, ornull
to join all jobs.
// * @param monitor Progress monitor for reporting progress on how the
// * wait is progressing, or null
if no progress monitoring is required.
// * @exception InterruptedException if this thread is interrupted while waiting
// * @exception OperationCanceledException if the progress monitor is canceled while waiting
// * @see Job#belongsTo(Object)
// * @see #suspend()
// */
/// virtual void Join(const Object& family, const IProgressMonitor& monitor)
/// throw(InterruptedException, OperationCanceledException) = 0;
///**
// * Creates a new lock object. All lock objects supplied by the job manager
// * know about each other and will always avoid circular deadlock amongst
// * themselves.
// *
// * @return the new lock object
// */
/// virtual ILock newLock() = 0;
/**
* Removes a job listener from the job manager.
* Has no effect if an identical listener is not already registered.
*
* @param listener the listener to be removed
* @see #addJobChangeListener(IJobChangeListener)
* @see IJobChangeListener
*/
virtual void RemoveJobChangeListener(IJobChangeListener::Pointer listener) = 0;
///**
// * Resumes execution of jobs after a previous suspend
. All
// * jobs that were sleeping or waiting prior to the suspension, or that were
// * scheduled while the job manager was suspended, will now be eligible
// * for execution.
// *
// * Calling this method on a rule that is not suspended has no effect. If another
// * thread also owns the rule at the time this method is called, then the rule will
// * not be resumed until all threads have released the rule.
// *
// * @deprecated This method is not safe and should not be used.
// * Suspending a scheduling rule violates the thread safety
// * of clients that use scheduling rules as a mutual exclusion mechanism,
// * and can result in concurrency problems in all clients that use the suspended rule.
// * @see #suspend(ISchedulingRule, IProgressMonitor)
// */
/// virtual void Resume(const ISchedulingRule& rule) = 0;
///**
// * Resumes execution of jobs after a previous suspend
. All
// * jobs that were sleeping or waiting prior to the suspension, or that were
// * scheduled while the job manager was suspended, will now be eligible
// * for execution.
// *
// * Calling resume
when the job manager is not suspended
// * has no effect.
// *
// * @see #suspend()
// * @see #isSuspended()
// */
////virtual void Resume() = 0;
///**
// * Provides a hook that is notified whenever a thread is about to wait on a lock,
// * or when a thread is about to release a lock. This hook must only be set once.
// *
// * This method is for internal use by the platform-related plug-ins. // * Clients should not call this method. // *
// * @see LockListener // */ // TODO LockListener .. SetLockListener /// virtual void SetLockListener(const LockListener& listener) = 0; /** * Registers a progress provider with the job manager. If there was a * provider already registered, it is replaced. ** This method is intended for use by the currently executing Eclipse application. * Plug-ins outside the currently running application should not call this method. *
* * @param provider the new provider, ornull
if no progress
* is needed
*/
virtual void SetProgressProvider(ProgressProvider::Pointer) = 0;
/**
* Suspends execution of all jobs. Jobs that are already running
* when this method is invoked will complete as usual, but all sleeping and
* waiting jobs will not be executed until the job manager is resumed.
*
* The job manager will remain suspended until a subsequent call to
* resume
. Further calls to suspend
* when the job manager is already suspended are ignored.
*
* All attempts to join sleeping and waiting jobs while the job manager is * suspended will return immediately. *
* Note that this very powerful function should be used with extreme caution. * Suspending the job manager will prevent all jobs in the system from executing, * which may have adverse affects on components that are relying on * execution of jobs. The job manager should never be suspended without intent * to resume execution soon afterwards. * * @see #resume() * @see #join(Object, IProgressMonitor) * @see #isSuspended() */ // virtual void Suspend() = 0; ///** // * Defers execution of all jobs with scheduling rules that conflict with the // * given rule. The caller will be blocked until all currently executing jobs with // * conflicting rules are completed. Conflicting jobs that are sleeping or waiting at // * the time this method is called will not be executed until the rule is resumed. // *
// * While a rule is suspended, all calls to beginRule
and
// * endRule
on a suspended rule will not block the caller.
// * The rule remains suspended until a subsequent call to
// * resume(ISchedulingRule)
with the identical rule instance.
// * Further calls to suspend
with an identical rule prior to calling
// * resume
are ignored.
// *
// * This method is long-running; progress and cancelation are provided by // * the given progress monitor. In the case of cancelation, the rule will // * not be suspended. // *
// * Note: this very powerful function should be used with extreme caution. // * Suspending rules will prevent jobs in the system from executing, which may // * have adverse effects on components that are relying on execution of jobs. // * The job manager should never be suspended without intent to resume // * execution soon afterwards. Deadlock will result if the thread responsible // * for resuming the rule attempts to join a suspended job. // * // * @deprecated This method is not safe and should not be used. // * Suspending a scheduling rule violates the thread safety // * of clients that use scheduling rules as a mutual exclusion mechanism, // * and can result in concurrency problems in all clients that use the suspended rule. // * @param rule The scheduling rule to suspend. Must not benull
.
// * @param monitor a progress monitor, or null
if progress
// * reporting is not desired
// * @exception OperationCanceledException if the operation is canceled.
// * Cancelation can occur even if no progress monitor is provided.
// * @see #resume(ISchedulingRule)
// */
/// virtual void Suspend(const ISchedulingRule& rule, const IProgressMonitor& monitor) = 0;
///**
// * Requests that all jobs in the given job family be suspended. Jobs currently
// * waiting to be run will be removed from the queue and moved into the
// * SLEEPING
state. Jobs that have been put to sleep
// * will remain in that state until either resumed or canceled. This method has
// * no effect on jobs that are not currently waiting to be run.
// *
// * Sleeping jobs can be resumed using wakeUp
.
// *
// * @param family the job family to sleep, or null
to sleep all jobs.
// * @see Job#belongsTo(Object)
// */
/// virtual void Sleep(const Object& family) = 0;
///**
// * Transfers ownership of a scheduling rule to another thread. The identical
// * scheduling rule must currently be owned by the calling thread as a result of
// * a previous call to beginRule
. The destination thread must
// * not already own a scheduling rule.
// *
// * Calling this method is equivalent to atomically calling endRule
// * in the calling thread followed by an immediate beginRule
in
// * the destination thread. The destination thread is responsible for subsequently
// * calling endRule
when it is finished using the rule.
// *
// * This method has no effect when the destination thread is the same as the
// * calling thread.
// *
// * @param rule The scheduling rule to transfer
// * @param destinationThread The new owner for the transferred rule.
// * @since 3.1
// */
/// virtual void TransferRule(const ISchedulingRule& rule, Poco::Thread* destinationThread) = 0;
///**
// * Resumes scheduling of all sleeping jobs in the given family. This method
// * has no effect on jobs in the family that are not currently sleeping.
// *
// * @param family the job family to wake up, or
* When a monitor that supports this extension is passed to an operation, the
* operation should call
* This interface can be used without OSGi running.
*
* Clients may implement this interface.
*
* If the caller is blocked by a currently executing job, this method will return
* an
* Clients may implement this interface.
*
* @see Job#GetRule()
* @see Job#SetRule(ISchedulingRule)
* @see Job#Schedule(long)
* @see IJobManager#BeginRule(ISchedulingRule, org.eclipse.core.runtime.IProgressMonitor)
* @see IJobManager#EndRule(ISchedulingRule)
*/
struct BERRY_JOBS ISchedulingRule: public Object
{
berryInterfaceMacro(ISchedulingRule, berry)
/**
* Returns whether this scheduling rule completely contains another scheduling
* rule. Rules can only be nested within a thread if the inner rule is completely
* contained within the outer rule.
*
* Implementations of this method must obey the rules of a partial order relation
* on the set of all scheduling rules. In particular, implementations must be reflexive
* (a.contains(a) is always true), antisymmetric (a.contains(b) and b.contains(a) iff
* equals(b),
* and transitive (if a.contains(b) and b.contains(c), then a.contains(c)). Implementations
* of this method must return
* Implementations of this method must be reflexive, symmetric, and consistent,
* and must return
* Jobs have a state that indicates what they are currently doing. When constructed,
* jobs start with a state value of
* A job can also be in the
* Jobs can be assigned a priority that is used as a hint about how the job should
* be scheduled. There is no guarantee that jobs of one priority will be run before
* all jobs of lower priority. The documentation of the various priority constants provide
* more detail about what each priority means. By default, jobs start in the
*
* Clients may override this method. This default implementation always returns
*
* This method must not be called from within the scope of a job's
* Note that job state is inherently volatile, and in most cases clients
* cannot rely on the result of this method being valid by the time the
* result is obtained. For example, if getState returns
* RUNNING, the job may have actually completed by the
* time the getState method returns. All clients can infer from
* invoking this method is that the job was recently in the returned state.
*
* @return the job state
*/
int GetState() const;
/**
* Returns the thread that this job is currently running in.
*
* @return the thread this job is running in, or
* If this method is called on a job that reschedules itself from within the
* run method, the join will return at the end of the first execution.
* In other words, join will return the first time this job exits the
* {@link #RUNNING} state, or as soon as this job enters the {@link #NONE} state.
*
* If this method is called while the job manager is suspended, this job
* will only be joined if it is already running; if this job is waiting or sleeping,
* this method returns immediately.
*
* Note that there is a deadlock risk when using join. If the calling thread owns
* a lock or object monitor that the joined thread is waiting for, deadlock
* will occur.
*
* This is a convenience method, fully equivalent to
*
* Jobs of equal priority and
* If this job is currently running, it will be rescheduled with the specified
* delay as soon as it finishes. If this method is called multiple times
* while the job is running, the job will still only be rescheduled once,
* with the most recent delay value that was provided.
*
* Scheduling a job that is waiting or sleeping has no effect.
*
* The job name is a human-readable value that is displayed to users. The name
* does not need to be unique, but it must not be
* The progress group must be set before the job is scheduled.
* The group will be used only for a single invocation of the job's
* run method, after which any association of this job to the
* group will be lost.
*
* @see IJobManager#createProgressGroup()
* @param group The progress group to use for this job
* @param ticks the number of work ticks allocated from the
* parent monitor, or {@link IProgressMonitor#UNKNOWN}
*/
void SetProgressGroup(IProgressMonitor::Pointer group, int ticks);
/**
* Sets the value of the property of this job identified
* by the given key. If the supplied value is
* Properties are intended to be used as a caching mechanism
* by ISV plug-ins. They allow key-object associations to be stored with
* a job instance. These key-value associations are maintained in
* memory (at all times), and the information is never discarded automatically.
*
* The qualifier part of the property name must be the unique identifier
* of the declaring plug-in (e.g.
* Jobs that use the {@link #ASYNC_FINISH} return code should tell
* the job what thread it is running in. This is used to prevent deadlocks.
*
* @param thread the thread that this job is running in.
*
* @see #ASYNC_FINISH
* @see #Run(IProgressMonitor::Pointer)
*/
void SetThread(Poco::Thread* thread);
/**
* Returns whether this job should be run.
* If
* This method is called immediately prior to calling the job's
* run method, so it can be used for last minute pre-condition checking before
* a job is run. This method must not attempt to schedule or change the
* state of any other job.
*
* Clients may override this method. This default implementation always returns
*
* This method is called immediately prior to adding the job to the waiting job
* queue.,so it can be used for last minute pre-condition checking before
* a job is scheduled.
*
* Clients may override this method. This default implementation always returns
*
* Sleeping jobs can be resumed using
* This is a convenience method, fully equivalent to
*
* Subclasses may override this method to perform additional work when
* a cancellation request is made. This default implementation does nothing.
*/
virtual void Canceling();
/**
* Executes this job. Returns the result of the execution.
*
* The provided monitor can be used to report progress and respond to
* cancellation. If the progress monitor has been canceled, the job
* should finish its execution at the earliest convenience and return a result
* status of severity {@link IStatus#CANCEL}. The singleton
* cancel status {@link Status#CANCEL_STATUS} can be used for
* this purpose. The monitor is only valid for the duration of the invocation
* of this method.
*
* This method must not be called directly by clients. Clients should call
*
* Jobs can optionally finish their execution asynchronously (in another thread) by
* returning a result status of {@link #ASYNC_FINISH}. Jobs that finish
* asynchronously must specify the execution thread by calling
*
* This class is for internal use by the platform-related plug-ins.
* Clients outside of the base platform should not reference or subclass this class.
*
* This default implementation always returns
* This default implementation does nothing. Subclasses may override.
*/
inline virtual void AboutToRelease()
{
//do nothing
}
protected:
/**
* Returns whether this thread currently owns any locks
* @return
* This class can be used without OSGi running.
*
* This class is not intended to be subclassed by clients.
*
* Clients may instantiate.
*
* Qualified names are equal if and only if they have the same
* qualified parts and local parts.
* Qualified names are not equal to objects other than qualified names.
*
* 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.
*
* This interface can be used without OSGi running.
*
* Clients may implement this interface, or obtain a default implementation
* of this interface by subclassing
* This interface can be used without OSGi running.
*
* Clients may implement this interface.
*
* This method is generally used by an adapter manager
* to discover which adapter types are supported, in advance
* of dispatching any actual
* Adapter factories can be registered programmatically using the
* The following code snippet shows how one might register an adapter of type
*
*
*
* This interface can be used without OSGi running.
*
* This interface is not intended to be implemented by clients.
*
* Note that the returned types do not guarantee that
* a subsequent call to
* 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 an empty Poco::Any.
* If activation of the plug-in providing the factory is required, use the
*
* Note that a return value of
* One of the following values can be returned:
* Note that unlike the
* This interface allows applications to store and retrieve user and system
* preference data. This data is stored persistently in an
* implementation-dependent backing store. Typical implementations include flat
* files, OS-specific registries, directory servers and SQL databases.
*
*
* For each bundle, there is a separate tree of nodes for each user, and one for
* system preferences. The precise description of "user" and "system" will vary
* from one bundle to another. Typical information stored in the user preference
* tree might include font choice, and color choice for a bundle which interacts
* with the user via a servlet. Typical information stored in the system
* preference tree might include installation data, or things like high score
* information for a game program.
*
*
* Nodes in a preference tree are named in a similar fashion to directories in a
* hierarchical file system. Every node in a preference tree has a node name
* (which is not necessarily unique), a unique absolute path name ,
* and a path name relative to each ancestor including itself.
*
*
* The root node has a node name of the empty
* The root node has an absolute path name of
* A node n 's path name relative to its ancestor a is simply the
* string that must be appended to a 's absolute path name in order to
* form n 's absolute path name, with the initial slash character (if
* present) removed. Note that:
*
* Note finally that:
*
* Each
* All node name and property name comparisons are case-sensitive.
*
*
* All of the methods that modify preference data are permitted to operate
* asynchronously; they may return immediately, and changes will eventually
* propagate to the persistent backing store, with an implementation-dependent
* delay. The
* Implementations must automatically attempt to flush to the backing store any
* pending updates for a bundle's preferences when the bundle is stopped or
* otherwise ungets the IPreferences Service.
*
*
* The methods in this class may be invoked concurrently by multiple threads in
* a single Java Virtual Machine (JVM) without the need for external
* synchronization, and the results will be equivalent to some serial execution.
* If this class is used concurrently by multiple JVMs that store their
* preference data in the same backing store, the data store will not be
* corrupted, but no other guarantees are made concerning the consistency of the
* preference data.
*
*
* @version $Revision$
*/
struct BERRY_RUNTIME IPreferences : virtual public Object
{
berryInterfaceMacro(IPreferences, berry)
/**
* Associates the specified value with the specified key in this node.
*
* @param key key with which the specified value is to be associated.
* @param value value to be associated with the specified key.
* @throws NullPointerException if
* Implementor's note: it is not necessary that the property value
* be represented by a
* Implementor's note: it is not necessary that the
* Implementor's note: it is not necessary that the value be
* represented by a string in the backing store. If the backing store
* supports
* Returns the specified default if there is no value associated with the
*
* Implementor's note: it is not necessary that the value be
* represented by a string in the backing store. If the backing store
* supports
* Implementor's note: it is not necessary that the value be
* represented by a string in the backing store. If the backing store
* supports
* Implementor's note: it is not necessary that the value be
* represented by a
* Returns the specified default if there is no value associated with the
*
* If the returned node did not exist prior to this call, this node and any
* ancestors that were created by this call are not guaranteed to become
* persistent until the
* If this node (or an ancestor) has already been removed with the
* {@link #removeNode()}method, it is legal to invoke this method,
* but only with the pathname
* The removal is not guaranteed to be persistent until the
* Once this method returns successfully, it is safe to assume that all
* changes made in the subtree rooted at this node prior to the method
* invocation have become permanent.
*
*
* Implementations are free to flush changes into the persistent store at
* any time. They do not need to wait for this method to be called.
*
*
* When a flush occurs on a newly created node, it is made persistent, as
* are any ancestors (and descendants) that have yet to be made persistent.
* Note however that any properties value changes in ancestors are not
* guaranteed to be made persistent.
*
* @throws BackingStoreException if this operation cannot be completed due
* to a failure in the backing store, or inability to communicate
* with it.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
* @see #sync()
*/
virtual void Flush() throw(Poco::Exception, BackingStoreException) = 0;
/**
* Ensures that future reads from this node and its descendants reflect any
* changes that were committed to the persistent store (from any VM) prior
* to the
* Each bundle using this service has its own set of preference trees: one for
* system preferences, and one for each user.
*
*
* A
* Note: In situations where it would be awkward to subclass this
* class, the same affect can be achieved simply by implementing
* the
* Clients may subclass.
*
* This implementation of the method declared by
* Clients may implement this interface.
*
*
* Applications can return any object they like. If an
* Note: This method is called by the platform; it is not intended
* to be called directly by clients.
*
*
* This method is only called to force an application to exit.
* This method will not be called if an application exits normally from
* the {@link #start()} method.
*
* Note: This method is called by the platform; it is not intended
* to be called directly by clients.
*
* Most users don't have to worry about Platform's lifecycle. However, if your
* code can call methods of this class when Platform is not running, it becomes
* necessary to check {@link #IsRunning()} before making the call. A runtime
* exception might be thrown or incorrect result might be returned if a method
* from this class is called while Platform is not running.
*
* The plug-in state area is a file directory within the
* platform's metadata area where a plug-in is free to create files.
* The content and structure of this area is defined by the plug-in,
* and the particular plug-in is solely responsible for any files
* it puts there. It is recommended for plug-in preference settings and
* other configuration parameters.
* null
to wake up all jobs
// * @see Job#belongsTo(Object)
// */
/// virtual void WakeUp(const Object& family) = 0;
};
}
#endif /* IJOBMANAGER */
diff --git a/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryIProgressMonitor.h b/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryIProgressMonitor.h
index 4e268c65e8..b17f592216 100644
--- a/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryIProgressMonitor.h
+++ b/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryIProgressMonitor.h
@@ -1,118 +1,118 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRY_IPROGRESS_MONITOR_H
#define BERRY_IPROGRESS_MONITOR_H
-#include "berryJobsDll.h"
+#include UNKNOWN
* the implementation is free to indicate progress in a way which
* doesn't require the total number of work units in advance.
*/
virtual void BeginTask(const std::string& name, int totalWork) = 0;
/**
* 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).
*/
virtual void Done() = 0;
/**
* Internal method to handle scaling correctly. This method
* must not be called by a client. Clients should
* always use the method worked(int).
*
* @param work the amount of work done
*/
virtual void InternalWorked(double work) = 0;
/**
* Returns whether cancellation of current operation has been requested.
* Long-running operations should poll to see if cancellation
* has been requested.
*
* @return true
if cancellation has been requested,
* and false
otherwise
* @see #setCanceled(bool)
*/
virtual bool IsCanceled() = 0;
/**
* Sets the cancel state to the given value.
*
* @param value true
indicates that cancellation has
* been requested (but not necessarily acknowledged);
* false
clears this flag
* @see #isCanceled()
*/
virtual void SetCanceled(bool value) = 0;
/**
* 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
* @see #beginTask
*/
virtual void SetTaskName(const std::string& name) = 0;
/**
* Notifies that a subtask of the main task is beginning.
* Subtasks are optional; the main task might not have subtasks.
*
* @param name the name (or description) of the subtask
*/
virtual void SubTask(const std::string& name) = 0;
/**
* Notifies that a given number of work unit of the main task
* has been completed. Note that this amount represents an
* installment, as opposed to a cumulative amount of work done
* to date.
*
* @param work a non-negative number of work units just completed
*/
virtual void Worked(int work) = 0;
};
}
#endif /* _BERRY_IPROGRESS_MONITOR_H */
diff --git a/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryIProgressMonitorWithBlocking.h b/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryIProgressMonitorWithBlocking.h
index 56e4711cdd..8d49983ff4 100644
--- a/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryIProgressMonitorWithBlocking.h
+++ b/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryIProgressMonitorWithBlocking.h
@@ -1,85 +1,85 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _BERRY_IPROGRESSMONITORWITHBLOCKING_H
#define _BERRY_IPROGRESSMONITORWITHBLOCKING_H
#include "berryObject.h"
-#include "berryJobsDll.h"
+#include setBlocked
whenever it knows that it
* must wait for a lock that is currently held by another thread. The operation
* should continue to check for and respond to cancellation requests while
* blocked. When the operation is no longer blocked, it must call clearBlocked
* to clear the blocked state.
* setBlocked
, it must
* eventually call clearBlocked
before the operation
* completes.
* IJobStatus
indicating the job that is currently blocking
* the caller. If this blocking job is not known, this method will return a plain
* informational IStatus
object.
* null
if this
* information is not available.
* @see #clearBlocked()
*/
virtual void SetBlocked(IStatus::Pointer reason)= 0;
/**
* 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)
*/
virtual void ClearBlocked() = 0;
};
}
#endif /* _BERRY_IPROGRESSMONITORWITHBLOCKING_H */
diff --git a/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryISchedulingRule.h b/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryISchedulingRule.h
index 0ecfc6ce31..64c105bef8 100644
--- a/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryISchedulingRule.h
+++ b/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryISchedulingRule.h
@@ -1,94 +1,94 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _BERRY_ISCHEDULING_RULE_H_
#define _BERRY_ISCHEDULING_RULE_H_
-#include "berryJobsDll.h"
+#include contains
method.
*
* false
when compared to a rule they
* know nothing about.
*
* @param rule the rule to check for containment
* @return true
if this rule contains the given rule, and
* false
otherwise.
*/
virtual bool Contains(ISchedulingRule::Pointer rule) const = 0;
/**
* Returns whether this scheduling rule is compatible with another scheduling rule.
* If true
is returned, then no job with this rule will be run at the
* same time as a job with the conflicting rule. If false
is returned,
* then the job manager is free to run jobs with these rules at the same time.
* false
when compared to a rule they know
* nothing about.
*
* @param rule the rule to check for conflicts
* @return true
if the rule is conflicting, and false
* otherwise.
*/
virtual bool IsConflicting(ISchedulingRule::Pointer myRule) const = 0;
};
}
#endif // _BERRY_ISCHEDULING_RULE_H_
diff --git a/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryJob.cpp b/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryJob.cpp
index 1a4b5ecc03..0a445f83fe 100644
--- a/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryJob.cpp
+++ b/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryJob.cpp
@@ -1,205 +1,205 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "berryJob.h"
#include "berryIJobManager.h"
#include "internal/berryJobManager.h"
#include "berryIStatus.h"
#include "berryStatus.h"
#include NONE
. When a job is scheduled
* to be run, it moves into the WAITING
state. When a job starts
* running, it moves into the RUNNING
state. When execution finishes
* (either normally or through cancellation), the state changes back to
* NONE
.
* SLEEPING
state. This happens if a user
* calls Job.sleep() on a waiting job, or if a job is scheduled to run after a specified
* delay. Only jobs in the WAITING
state can be put to sleep.
* Sleeping jobs can be woken at any time using Job.wakeUp(), which will put the
* job back into the WAITING
state.
* LONG
priority class.
*
* @see IJobManager
*
*/
//TODO struct Job: public InternalJob, public IAdaptable
class BERRY_JOBS Job: public InternalJob
{
public:
berryObjectMacro(Job)
/**
* Job status return value that is used to indicate asynchronous job completion.
* @see Job#Run(IProgressMonitor::Pointer)
* @see Job#Done(IStatus::Pointer)
*/
static const IStatus::Pointer ASYNC_FINISH ;
/* Job priorities */
/**
* Job priority constant (value 10) for interactive jobs.
* Interactive jobs generally have priority over all other jobs.
* Interactive jobs should be either fast running or very low on CPU
* usage to avoid blocking other interactive jobs from running.
*
* @see #GetPriority()
* @see #SetPriority(int)
* @see #Run(IProgressMonitor::Pointer)
*/
static const int INTERACTIVE = 10;
/**
* Job priority constant (value 20) for short background jobs.
* Short background jobs are jobs that typically complete within a second,
* but may take longer in some cases. Short jobs are given priority
* over all other jobs except interactive jobs.
*
* @see #GetPriority()
* @see #SetPriority(int)
* @see #Run(IProgressMonitor::Pointer)
*/
static const int SHORT = 20;
/**
* Job priority constant (value 30) for long-running background jobs.
*
* @see #GetPriority()
* @see #SetPriority(int)
* @see #Run(IProgressMonitor::Pointer)
*/
static const int LONG = 30;
/**
* Job priority constant (value 40) for build jobs. Build jobs are
* generally run after all other background jobs complete.
*
* @see #GetPriority()
* @see #SetPriority(int)
* @see #Run(IProgressMonitor)
*/
static const int BUILD = 40;
/**
* Job priority constant (value 50) for decoration jobs.
* Decoration jobs have lowest priority. Decoration jobs generally
* compute extra information that the user may be interested in seeing
* but is generally not waiting for.
*
* @see #GetPriority()
* @see #SetPriority(int)
* @see #Run(IProgressMonitor)
*/
static const int DECORATE = 50;
/**
* Job state code (value 0) indicating that a job is not
* currently sleeping, waiting, or running (i.e., the job manager doesn't know
* anything about the job).
*
* @see #GetState()
*/
static const int NONE = 0;
/**
* Job state code (value 1) indicating that a job is sleeping.
*
* @see #Run(IProgressMonitor)
* @see #GetState()
*/
static const int SLEEPING = 0x01;
/**
* Job state code (value 2) indicating that a job is waiting to be run.
*
* @see #GetState()
*/
static const int WAITING = 0x02;
/**
* Job state code (value 4) indicating that a job is currently running
*
* @see #GetState()
*/
static const int RUNNING = 0x04;
/**
* Returns the job manager.
*
* @return the job manager
*/
static const IJobManager* GetJobManager();
/**
* Creates a new job with the specified name. The job name is a human-readable
* value that is displayed to users. The name does not need to be unique, but it
* must not be null
.
*
* @param name the name of the job.
*/
Job(std::string name);
/**
* Registers a job listener with this job
* Has no effect if an identical listener is already registered.
*
* @param listener the listener to be added.
*/
void AddJobChangeListener(IJobChangeListener::Pointer listener);
/**
* Returns whether this job belongs to the given family. Job families are
* represented as objects that are not interpreted or specified in any way
* by the job manager. Thus, a job can choose to belong to any number of
* families.
* false
. Overriding implementations must return false
* for families they do not recognize.
* true
if this job belongs to the given family, and
* false
otherwise.
*/
bool BelongsTo(Object::Pointer family);
/**
* Stops the job. If the job is currently waiting,
* it will be removed from the queue. If the job is sleeping,
* it will be discarded without having a chance to resume and its sleeping state
* will be cleared. If the job is currently executing, it will be asked to
* stop but there is no guarantee that it will do so.
*
* @return false
if the job is currently running (and thus may not
* respond to cancellation), and true
in all other cases.
*/
bool Cancel();
/**
* Jobs that complete their execution asynchronously must indicate when they
* are finished by calling this method. This method must not be called by
* a job that has not indicated that it is executing asynchronously.
* run
* method. Jobs should normally indicate completion by returning an appropriate
* status from the run
method. Jobs that return a status of
* ASYNC_FINISH
from their run method must later call
* done
to indicate completion.
*
* @param result a status object indicating the result of the job's execution.
* @see #ASYNC_FINISH
* @see #Run(IProgressMonitor::Pointer)
*/
void Done(IStatus::Pointer result);
/**
* Returns the human readable name of this job. The name is never
* null
.
*
* @return the name of this job
*/
std::string GetName() const;
/**
* Returns the priority of this job. The priority is used as a hint when the job
* is scheduled to be run.
*
* @return the priority of the job. One of INTERACTIVE, SHORT, LONG, BUILD,
* or DECORATE.
*/
int GetPriority() const;
/**
* Returns the value of the property of this job identified by the given key,
* or null
if this job has no such property.
*
* @param key the name of the property
* @return the value of the property,
* or null
if this job has no such property
* @see #SetProperty(QualifiedName, Object)
*/
//TODO QualifiedName GetPropertys
///Object GetProperty(QualifiedName key) const ;
/**
* Returns the result of this job's last run.
*
* @return the result of this job's last run, or null
if this
* job has never finished running.
*/
IStatus::Pointer GetResult() const ;
/**
* Returns the scheduling rule for this job. Returns null
if this job has no
* scheduling rule.
*
* @return the scheduling rule for this job, or null
.
* @see ISchedulingRule
* @see #SetRule(ISchedulingRule::Pointer)
*/
ISchedulingRule::Pointer GetRule() const;
/**
* Returns the state of the job. Result will be one of:
*
*
* Job.RUNNING
- if the job is currently running.Job.WAITING
- if the job is waiting to be run.Job.SLEEPING
- if the job is sleeping.Job.NONE
- in all other cases.null
* if this job is not running or the thread is unknown.
*/
Poco::Thread* GetThread() const;
/**
* Returns whether this job is blocking a higher priority non-system job from
* starting due to a conflicting scheduling rule. Returns false
* if this job is not running, or is not blocking a higher priority non-system job.
*
* @return true
if this job is blocking a higher priority non-system
* job, and false
otherwise.
* @see #GetRule()
* @see #IsSystem()
*/
bool IsBlocking();
/**
* Returns whether this job is a system job. System jobs are typically not
* revealed to users in any UI presentation of jobs. Other than their UI presentation,
* system jobs act exactly like other jobs. If this value is not explicitly set, jobs
* are treated as non-system jobs. The default value is false
.
*
* @return true
if this job is a system job, and
* false
otherwise.
* @see #SetSystem(bool)
*/
bool IsSystem() const;
/**
* Returns whether this job has been directly initiated by a UI end user.
* These jobs may be presented differently in the UI. The default value
* is false
.
*
* @return true
if this job is a user-initiated job, and
* false
otherwise.
* @see #SetUser(bool)
*/
bool IsUser() const;
/**
* Waits until this job is finished. This method will block the calling thread until the
* job has finished executing, or until this thread has been interrupted. If the job
* has not been scheduled, this method returns immediately. A job must not
* be joined from within the scope of its run method.
* Schedule(0L)
.
* delay
with conflicting scheduling
* rules are guaranteed to run in the order they are scheduled. No guarantees
* are made about the relative execution order of jobs with unrelated or
* null
scheduling rules, or different priorities.
* null
.
*
* @param name the name of the job.
*/
void SetName(std::string name);
/**
* Sets the priority of the job. This will not affect the execution of
* a running job, but it will affect how the job is scheduled while
* it is waiting to be run.
*
* @param priority the new job priority. One of
* INTERACTIVE, SHORT, LONG, BUILD, or DECORATE.
*/
void SetPriority(int priority);
/**
* Associates this job with a progress group. Progress feedback
* on this job's next execution will be displayed together with other
* jobs in that group. The provided monitor must be a monitor
* created by the method IJobManager.createProgressGroup
* and must have at least ticks
units of available work.
* null
,
* the property is removed from this resource.
* "com.example.plugin"
).
* null
if the property is to be removed
* @see #GetProperty(QualifiedName)
*/
//TODO QualifiedName SetProperty
/// void SetProperty(QualifiedName key, Object value);
/**
* Sets the scheduling rule to be used when scheduling this job. This method
* must be called before the job is scheduled.
*
* @param rule the new scheduling rule, or null
if the job
* should have no scheduling rule
* @see #GetRule()
*/
void SetRule(ISchedulingRule::Pointer rule);
/**
* Sets whether or not this job is a system job. System jobs are typically not
* revealed to users in any UI presentation of jobs. Other than their UI presentation,
* system jobs act exactly like other jobs. If this value is not explicitly set, jobs
* are treated as non-system jobs. This method must be called before the job
* is scheduled.
*
* @param value true
if this job should be a system job, and
* false
otherwise.
* @see #IsSystem()
*/
void SetSystem(bool value);
/**
* Sets whether or not this job has been directly initiated by a UI end user.
* These jobs may be presented differently in the UI. This method must be
* called before the job is scheduled.
*
* @param value true
if this job is a user-initiated job, and
* false
otherwise.
* @see #IsUser()
*/
void SetUser(bool value);
/**
* Sets the thread that this job is currently running in, or null
* if this job is not running or the thread is unknown.
* false
is returned, this job will be discarded by the job manager
* without running.
* true
.
* true
if this job should be run
* and false
otherwise
*/
virtual bool ShouldRun();
/**
* Returns whether this job should be scheduled.
* If false
is returned, this job will be discarded by the job manager
* without being added to the queue.
* true
.
* true
if the job manager should schedule this job
* and false
otherwise
*/
virtual bool ShouldSchedule();
/**
* Requests that this job be suspended. If the job is currently waiting to be run, it
* will be removed from the queue move into the {@link #SLEEPING} state.
* The job will remain asleep until either resumed or canceled. If this job is not
* currently waiting to be run, this method has no effect.
* wakeUp
.
*
* @return false
if the job is currently running (and thus cannot
* be put to sleep), and true
in all other cases
* @see #WakeUp()
*/
bool Sleep();
/**
* Puts this job immediately into the {@link #WAITING} state so that it is
* eligible for immediate execution. If this job is not currently sleeping,
* the request is ignored.
* wakeUp(0L)
.
* schedule
, which will in turn cause this method to be called.
* setThread
, and must indicate when they are finished by calling
* the method done
.
*
* @param monitor the monitor to be used for reporting progress and
* responding to cancellation. The monitor is never null
* @return resulting status of the run. The result must not be null
* @see #ASYNC_FINISH
* @see #Done(IStatus)
*/
virtual IStatus::Pointer Run(IProgressMonitor::Pointer myProgressMonitor) = 0;
};
}
#endif /* BERRY_JOB_H */
diff --git a/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryJobExceptions.h b/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryJobExceptions.h
index 1b57a82c0e..ae5d7e49c1 100644
--- a/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryJobExceptions.h
+++ b/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryJobExceptions.h
@@ -1,35 +1,35 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of g Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRYJOBSEXCEPTIONS_H_
#define BERRYJOBSEXCEPTIONS_H_
-#include "berryJobsDll.h"
+#include false
.
* Subclasses may override.
*
* @param lockOwner the thread that currently owns the lock this thread is
* waiting for, or null
if unknown.
* @return true
if the thread should be granted immediate access,
* and false
if it should wait for the lock to be available
*/
inline virtual bool AboutToWait(Poco::Thread* lockOwner)
{
return false;
}
/**
* Notification that a thread is about to release a lock.
* true
if this thread owns any locks, and
* false
otherwise.
*/
inline bool IsLockOwnerThread() const
{
return manager.isLockOwner();
}
};
}
#endif // _BERRY_LOCKLISTENER_H_
diff --git a/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryQualifiedName.h b/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryQualifiedName.h
index db4985df4a..ec55eb441c 100644
--- a/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryQualifiedName.h
+++ b/BlueBerry/Bundles/org.blueberry.core.jobs/src/berryQualifiedName.h
@@ -1,113 +1,113 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _BERRY_QUALIFIED_NAME_
#define _BERRY_QUALIFIED_NAME_
#include null
if
* the default name space is being used. The empty string is not
* a valid local name.
* null
). */
/*package*/
std::string qualifier;
/** Local name part. */
/*package*/
std::string localName;
/**
* Creates and returns a new qualified name with the given qualifier
* and local name. The local name must not be the empty string.
* The qualifier may be null
.
* null
* @param localName the local name string
*/
QualifiedName(std::string qualifier, std::string localName);
/**
* Returns whether this qualified name is equivalent to the given object.
* true
if these are equivalent qualified
* names, and false
otherwise
*/
bool operator==(const QualifiedName& qName) const;
bool operator<(const QualifiedName& qName) const;
/**
* Returns the local part of this name.
*
* @return the local name string
*/
std::string GetLocalName() const;
/**
* Returns the qualifier part for this qualified name, or null
* if none.
*
* @return the qualifier string, or null
*/
std::string GetQualifier() const;
/*
* Implements the method Object.hashCode
.
*
* Returns the hash code for this qualified name.
*/
std::size_t HashCode() const;
/**
* Converts this qualified name into a string, suitable for
* debug purposes only.
*/
std::string ToString();
};
}
#endif // _BERRY_QUALIFIED_NAME_
diff --git a/BlueBerry/Bundles/org.blueberry.core.jobs/src/internal/berryInternalJob.h b/BlueBerry/Bundles/org.blueberry.core.jobs/src/internal/berryInternalJob.h
index 092e4ee7a7..44eae72fdf 100644
--- a/BlueBerry/Bundles/org.blueberry.core.jobs/src/internal/berryInternalJob.h
+++ b/BlueBerry/Bundles/org.blueberry.core.jobs/src/internal/berryInternalJob.h
@@ -1,468 +1,468 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRY_INTERNALJOB_H
#define BERRY_INTERNALJOB_H
#include org.blueberry_core_jobs.Job
class.
*/
// struct BERRY_JOBS InternalJob: public Object, public Comparable
struct BERRY_JOBS InternalJob : public Object
{
friend struct JobQueue;
friend struct JobManager;
berryObjectMacro(InternalJob)
bool operator==(const Object* otherJob) const;
/**
* Adds an entry at the end of the list of which this item is the head.
*/
void AddLast(InternalJob::Pointer entry);
/*
* Returns the job listeners that are only listening to this job.
*/
const IJobChangeListener::Events& GetListeners() const;
/**
* Returns the job's progress monitor, or null if it is not running.
*/
IProgressMonitor::Pointer GetProgressMonitor() const;
/**
* Returns the time that this job should be started, awakened, or
* rescheduled, depending on the current state.
* @return time in milliseconds
*/
Poco::Timestamp GetStartTime() const;
/**
* Returns the raw job state, including internal states no exposed as API.
*/
int InternalGetState() const;
/*
* @see Job#GetState()
*/
int GetState() const;
/**
* @see Job#GetName()
*/
std::string GetName() const;
/*
* @see Job#setRule(ISchedulingRule::Pointer)
*/
void InternalSetRule(ISchedulingRule::Pointer rule);
/**
* Must be called from JobManager#setPriority
*/
void InternalSetPriority(int newPriority);
/**
* Must be called from JobManager#ChangeState
*/
void InternalSetState(int i);
/**
* Returns whether this job was canceled when it was about to run
*/
bool IsAboutToRunCanceled() const;
/**
* Returns whether this job was canceled when it was running.
*/
bool IsRunCanceled() const ;
/**
* Returns true if this job conflicts with the given job, and false otherwise.
*/
bool IsConflicting(InternalJob::Pointer otherJob) const;
/**
* Returns the next entry (ahead of this one) in the list, or null if there is no next entry
*/
InternalJob::Pointer Next() const;
/**
* Returns the previous entry (behind this one) in the list, or null if there is no previous entry
*/
InternalJob::Pointer Previous() const;
/**
* Removes this entry from any list it belongs to. Returns the receiver.
*/
InternalJob::Pointer Remove();
/*
* @see Job#run(IProgressMonitor)
*/
virtual IStatus::Pointer Run(IProgressMonitor::Pointer myProgressMonitor) = 0 ;
/**
* Sets whether this job was canceled when it was about to run
*/
void SetAboutToRunCanceled(bool value) throw (JobRuntimeException);
/**
* Sets the next entry in this linked list of jobs.
* @param entry
*/
/**
* Sets whether this job was canceled when it was running
*/
void SetRunCanceled(bool value) ;
void SetNext(InternalJob::Pointer entry);
/**
* Sets the previous entry in this linked list of jobs.
* @param entry
*/
void SetPrevious(InternalJob::Pointer entry);
/**
* Sets the progress monitor to use for the next execution of this job,
* or for clearing the monitor when a job completes.
* @param monitor a progress monitor
*/
void SetProgressMonitor(IProgressMonitor::Pointer monitor);
/**
* Sets or clears the result of an execution of this job.
* @param result a result status, or null
*/
void SetResult(IStatus::Pointer result) ;
/**
* Sets a time to start, wake up, or schedule this job,
* depending on the current state
* @param time a time in milliseconds
*/
void SetStartTime(Poco::Timestamp::TimeDiff time);
void SetStartTime(const Poco::Timestamp& newtime);
/*
* @see Job.SetThread
*/
void SetThread(Poco::Thread* thread);
/*
* @see Job.GetThread
*/
Poco::Thread* GetThread() const;
/*
* Prints a string-based representation of this job instance.
* For debugging purposes only.
*/
std::string ToString();
/**
* @param waitQueueStamp The waitQueueStamp to set.
*/
void SetWaitQueueStamp(Poco::Timestamp waitQueueStamp);
/**
* @return Returns the waitQueueStamp.
*/
Poco::Timestamp GetWaitQueueStamp();
protected:
InternalJob(std::string name);
/*
* @see Job#AddJobListener(IJobChangeListener::Pointer)
*/
void AddJobChangeListener(IJobChangeListener::Pointer listener);
/*
* @see Job#BelongsTo(Object)
*/
virtual bool BelongsTo(Object::Pointer family);
/*
* @see Job#Cancel()
*/
bool Cancel();
/*
* @see Job#Canceling()
*/
virtual void Canceling();
/*
*
* @see Job#Done(IStatus:.Pointer)
*/
void Done(IStatus::Pointer endResult);
/*
* @see Job#GetPriority()
*/
int GetPriority() const;
/*
* @see Job#GetProperty
*/
/// Object GetProperty(QualifiedName key) ;
/*
* @see Job#GetResult
*/
IStatus::Pointer GetResult() const ;
/*
* @see Job#GetRule
*/
ISchedulingRule::Pointer GetRule() const;
/*
* @see Job.IsSystem()
*/
bool IsSystem() const;
/*
* @see Job.IsUser()
*/
bool IsUser() const;
/*
* @see Job#Join()
*/
/// void Join() throws InterruptedException ;
/*
* @see Job#RemoveJobListener(IJobChangeListener)
*/
void RemoveJobChangeListener(IJobChangeListener::Pointer listener);
/*
* @see Job#Schedule(long)
*/
void Schedule(Poco::Timestamp::TimeDiff delay);
/*
* @see Job#SetName(std::string)
*/
void SetName(const std::string& name);
/*
* @see Job#SetPriority(int)
*/
void SetPriority(int newPriority);
/*
* @see Job#SetProgressGroup(IProgressMonitor::Pointer, int ticks)
*/
void SetProgressGroup(IProgressMonitor::Pointer group, int ticks);
/*
* @see Job#SetProperty(QualifiedName,Object)
*/
/// void SetProperty(QualifiedName key, Object value) ;
/* internalSetRule
* @see Job#SetRule(ISchedulingRule::Pointer)
*/
void SetRule(ISchedulingRule::Pointer rule);
/*
* @see Job.SetSystem
*/
void SetSystem(bool value);
/*
* @see Job.SetUser
*/
void SetUser(bool value);
/*
* @see Job#ShouldSchedule
*/
virtual bool ShouldSchedule();
/*
* @see Job#Sleep()
*/
bool Sleep();
/*
* @see Job#WakeUp(long)
*/
void WakeUp(long delay);
public:
/**
* Flag on a job indicating that it was canceled when running. This flag
* is used to ensure that #canceling is only ever called once on a job in
* case of recursive cancellation attempts.
*/
static const int M_RUN_CANCELED = 0x0800;
/**
* Job state code (value 16) indicating that a job has been removed from
* the wait queue and is about to start running. From an API point of view,
* this is the same as RUNNING.
*/
static const int ABOUT_TO_RUN = 0x10;
/**
* Job state code (value 32) indicating that a job has passed scheduling
* precondition checks and is about to be added to the wait queue. From an API point of view,
* this is the same as WAITING.
*/
static const int ABOUT_TO_SCHEDULE = 0x20;
/**
* Job state code (value 8) indicating that a job is blocked by another currently
* running job. From an API point of view, this is the same as WAITING.
*/
static const int BLOCKED = 0x08;
/**
* Start time constant indicating a job should be started at
* a time in the infinite future, causing it to sleep forever.
*/
static const Poco::Timestamp::TimeDiff T_INFINITE;
/**
* Start time constant indicating that the job has no start time.
*/
static const Poco::Timestamp::TimeDiff T_NONE;
private:
//flag mask bits
static const int M_STATE = 0xFF;
static const int M_SYSTEM = 0x0100;
static const int M_USER = 0x0200;
/**
* flag on a job indicating that it was about to run, but has been canceled
*/
static const int M_ABOUT_TO_RUN_CANCELED = 0x0400;
static int nextJobNumber;
int jobNumber;
volatile int flags;
/// ListenerList listeners ;
std::string name;
/**
* The job ahead of me in a queue or list.
*/
InternalJob::Pointer next;
/**
* The job behind me in a queue or list.
*/
InternalJob* previous;
int priority;
/**
* Arbitrary properties (key,value) pairs, attached
* to a job instance by a third party.
*/
//std::mapnull
//* @see #Reportunblocked
//*/
void ReportBlocked( IProgressMonitor::Pointer monitor, InternalJob::Pointer blockingjob) const ;
/**
* Reports that this thread was blocked, but is no longer blocked and is able
* to proceed.
* @param monitor The monitor to report unblocking to.
* @see #ReportBlocked
*/
void ReportUnblocked(IProgressMonitor::Pointer monitor) const ;
/**
* @have a look at IJobManager Resume
*/
void Resume();
// /**
// * @have a look at IJobManager Resume
// */
// void Resume(ISchedulingRule::Pointer rule)const ;
/**
* @have a look at IJobManager SetProgressProvider
*/
void SetProgressProvider(ProgressProvider::Pointer provider);
void SetRule(InternalJob::Pointer job, ISchedulingRule::Pointer rule);
// /*
// * @see IJobManager#sleep(std::string)
// */
// void Sleep(Object family) ;
void Suspend();
/*
* @see schedule(long)
*/
void Schedule(InternalJob::Pointer job, Poco::Timestamp::TimeDiff delay, bool reschedule);
// void Suspend(ISchedulingRule::Pointer rule, IProgressMonitor::Pointer monitor)const ;
// void TransferRule(ISchedulingRule rule, Thread destinationThread) ;
// void SetLockListener(LockListener listener) ;
// /**
// * Puts a job to sleep. Returns true if the job was successfully put to sleep.
// */
// void WakeUp(Object family) ;
void AddJobChangeListener(IJobChangeListener::Pointer listener);
// void beginRule(ISchedulingRule rule, IProgressMonitor monitor) ;
protected:
/**
* Cancels a job
*/
bool Cancel(InternalJob::Pointer job);
/**
* Returns a new progress monitor for this job, belonging to the given
* progress group. Returns null if it is not a valid time to set the job's group.
*/
IProgressMonitor::Pointer CreateMonitor(InternalJob::Pointer job,
IProgressMonitor::Pointer group, int ticks);
/**
* Indicates that a job was running, and has now finished. Note that this method
* can be called under OutOfMemoryError conditions and thus must be paranoid
* about allocating objects.
*/
/// optional Extension IStatus for implementation help have a look at the Java JobAPI
void EndJob(InternalJob::Pointer job,IStatus::Pointer result, bool notify);
/**
* Returns a running or blocked job whose scheduling rule conflicts with the
* scheduling rule of the given waiting job. Returns null if there are no
* conflicting jobs. A job can only run if there are no running jobs and no blocked
* jobs whose scheduling rule conflicts with its rule.
*/
InternalJob::Pointer FindBlockingJob(InternalJob::Pointer waitingJob);
/**
* Returns whether the job manager is active (has not been shutdown).
*/
bool IsActive();
/**
* Returns true if the given job is blocking the execution of a non-system
* job.
*/
bool IsBlocking(InternalJob::Pointer runningJob);
// void Join(InternalJob job) ;
/**
* Attempts to immediately start a given job. Returns true if the job was
* successfully started, and false if it could not be started immediately
* due to a currently running job with a conflicting rule. Listeners will never
* be notified of jobs that are run in this way.
*/
bool RunNow(InternalJob::Pointer sptr_job);
/**
* Puts a job to sleep. Returns true if the job was successfully put to sleep.
*/
bool Sleep(InternalJob::Pointer job);
/**
* Changes a job priority.
*/
void SetPriority(InternalJob::Pointer job, int newPriority);
/**
* Returns the estimated time in milliseconds before the next job is scheduled
* to wake up. The result may be negative. Returns InternalJob.T_INFINITE if
* there are no sleeping or waiting jobs.
*/
Poco::Timespan::TimeDiff SleepHint();
/**
* Returns the next job to be run, or null if no jobs are waiting to run.
* The worker must call endJob when the job is finished running.
*/
Job::Pointer StartJob();
/*
* @see Job#WakeUp(long)
*/
void WakeUp(InternalJob::Pointer job, Poco::Timestamp::TimeDiff delay);
private:
JobManager();
/* Poco Mutex for synchronizing purposes */
Poco::Mutex m_mutex;
// Dummy Null rule to validate SchedulingRules implemented by clients
SmartPointersuspend
* is invoked. Once suspended, no jobs will start running until resume
* is cancelled.
*/
bool m_suspended;
/**
* Counter to record wait queue insertion order.
*/
long long m_waitQueueCounter;
// /**
// * For debugging purposes only
// */
// const std::string PrintJobName(Job job);
/**
* Atomically updates the state of a job, adding or removing from the
* necessary queues or sets.
*/
void ChangeState(InternalJob::Pointer job, int newState);
/**
* Returns a new progress monitor for this job. Never returns null.
*/
IProgressMonitor::Pointer CreateMonitor(Job::Pointer sptr_jobToMonitor);
/**
* Returns the delay in milliseconds that a job with a given priority can
* tolerate waiting.
*/
Poco::Timestamp::TimeDiff DelayFor(int priority);
/**
* Performs the scheduling of a job. Does not perform any notifications.
*/
void DoSchedule(InternalJob::Pointer job, Poco::Timestamp::TimeDiff delay);
/**
* Shuts down the job manager. Currently running jobs will be told
* to stop, but worker threads may still continue processing.
* (note: This implemented IJobManager.Shutdown which was removed
* due to problems caused by premature shutdown)
*/
void DoShutdown();
// void InitDebugOptions() ;
/**
* Removes and returns the first waiting job in the queue. Returns null if there
* are no items waiting in the queue. If an item is removed from the queue,
* it is moved to the running jobs list.
*/
Job::Pointer NextJob();
/**
* Returns a non-null progress monitor instance. If the monitor is null,
* returns the default monitor supplied by the progress provider, or a
* NullProgressMonitor if no default monitor is available.
*/
IProgressMonitor::Pointer MonitorFor(IProgressMonitor::Pointer monitor);
// /**
// * Adds all family members in the list of jobs to the collection
// */
// void Select(List members, Object family, InternalJob firstJob, int stateMask) ;
//
// /**
// * Returns a list of all jobs known to the job manager that belong to the given family.
// */
// List Select(Object family) ;
//
// /**
// * Returns a list of all jobs known to the job manager that belong to the given
// * family and are in one of the provided states.
// */
// List Select(Object family, int stateMask) ;
/**
* Validates that the given scheduling rule obeys the constraints of
* scheduling rules as described in the ISchedulingRule
*/
void ValidateRule(ISchedulingRule::Pointer rule);
};
}
#endif /* _BERRY_TEMPLATE_H */
diff --git a/BlueBerry/Bundles/org.blueberry.core.jobs/src/internal/berryJobQueue.h b/BlueBerry/Bundles/org.blueberry.core.jobs/src/internal/berryJobQueue.h
index 7e621bde58..7013fa3444 100644
--- a/BlueBerry/Bundles/org.blueberry.core.jobs/src/internal/berryJobQueue.h
+++ b/BlueBerry/Bundles/org.blueberry.core.jobs/src/internal/berryJobQueue.h
@@ -1,107 +1,107 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _BERRY_JOBQUEUE_H
#define _BERRY_JOBQUEUE_H
#include "berryInternalJob.h"
#include "../berryJob.h"
#include
* IAdaptable a = [some adaptable];
* IFoo x = (IFoo)a.getAdapter(IFoo.class);
* if (x != null)
* [do IFoo things with x]
*
* PlatformObject
.
* null
if
* no such object can be found.
*
* @param adapterType the adapter class to look up
* @return a object castable to the given class,
* or null
if this object does not
* have an adapter for the given class
*/
virtual Poco::Any GetAdapter(const std::string& adapterType) = 0;
virtual ~IAdaptable();
};
} // namespace berry
#endif /*_BERRY_IADAPTABLE_H_*/
diff --git a/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryIAdapterFactory.h b/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryIAdapterFactory.h
index 41ce40064b..6270c6da6f 100644
--- a/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryIAdapterFactory.h
+++ b/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryIAdapterFactory.h
@@ -1,92 +1,92 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef BERRYIADAPTERFACTORY_H_
#define BERRYIADAPTERFACTORY_H_
-#include "berryRuntimeDll.h"
+#include IAdaptable
* interface. Adapter factories are registered with an
* adapter manager.
* 0
if
* no such object can be found.
*
* A typical implementation would look like this:
*
*
* void* GetAdapter(void* adaptableObject, const std::type_info& adaptableType, const std::string& adapterType)
* {
* if (Image* img = CastHelper
*
* @param adaptableObject the adaptable object being queried
* (usually an instance of IAdaptable
)
* @param adaptableType the type information for the adaptable object
* @param adapterType the type of adapter to look up
* @return a object castable to the given adapter type,
* or 0
if this adapter factory
* does not have an adapter of the given type for the
* given object
*/
virtual Object* GetAdapter(IAdaptable* adaptableObject, const std::string& adapterType) = 0;
/**
* Returns the collection of adapter types handled by this
* factory.
* getAdapter
requests.
* IAdaptable
* interface) tunnel IAdaptable.getAdapter
invocations to their
* adapter manager's IAdapterManger.getAdapter
method. The
* adapter manager then forwards this request unmodified to the IAdapterFactory.getAdapter
* method on one of the registered adapter factories.
* registerAdapters
* method. Alternatively, they can be registered declaratively using the
* org.blueberry.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.
* 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 == 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
* via this manager. Converting means that subsequent calls to getAdapter()
* or loadAdapter()
could result in an adapted object.
* getAdapter
with the same type as an argument
* 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
.
* adaptableClass
via this manager. An empty array
* is returned if there are none.
* @since 3.1
*/
virtual std::vector
* class X extends Y implements A, B
* is as follows:
*
*
*
* @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 Class[] computeClassOrder(Class clazz);
/**
* Returns a Poco::Any object which contains an instance of the given name associated
* with the given adaptable. Returns an empty Poco::Any if no such object can
* be found.
* Object
* getInterfaces
(in the example, A and its
* superinterfaces then B and its superinterfaces) 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
* @return a Poco::Any castable to the given adapter type, or empty
* if the given adaptable object does not have an available adapter of the
* given type
*/
templateadaptable
to an object of type adapterTypeName
.
* true
does not guarantee that
* a subsequent call to GetAdapter
with the same arguments
* will return a non-empty result. If the factory's plug-in has not yet been
* loaded, or if the factory itself returns nothing, then
* GetAdapter
will still return an empty Poco::Any.
*
* @param adaptable the adaptable object being queried (usually an instance
* of IAdaptable
)
* @param adapterTypeName the fully qualified class name of an adapter to
* look up
* @return true
if there is an adapter factory that claims
* it can convert adaptable
to an object of type adapterType
,
* and false
otherwise.
*/
virtual bool HasAdapter(const std::string& adaptableType, const std::string& adapterType) = 0;
/**
* Returns a status of an adapter factory registered that may be able
* to convert adaptable
to an object of type adapterTypeName
.
*
*
IAdaptable
)
* @param adapterTypeName the fully qualified class name of an adapter to
* look up
* @return a status of the adapter
*/
virtual int
QueryAdapter(const std::string& adaptableType, const std::string& adapterType) = 0;
/**
* Returns an object that is an instance of the given class name associated
* with the given object. Returns an empty Poco::Any if no such object can
* be found.
* GetAdapter
methods, this method
* will cause the plug-in that contributes the adapter factory to be loaded
* 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
* @return a Poco::Any castable to the given adapter type, or empty
* if the given adaptable object does not have an available adapter of the
* given type
*/
templateUnregisterAdapters(IAdapterFactory*, const std::string&)
* 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*, const std::string&)
*/
virtual void UnregisterAdapters(IAdapterFactory* factory) = 0;
/**
* 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 adaptableTypeName one of the type names against which the given factory is
* registered
* @see #RegisterAdapters(IAdapterFactory*, const std::string&)
*/
virtual void UnregisterAdapters(IAdapterFactory* factory,
const std::string& adaptableTypeName) = 0;
protected:
virtual Poco::Any GetAdapter(Poco::Any adaptable, const std::string& adapterType, bool force) = 0;
};
} // namespace berry
+Q_DECLARE_INTERFACE(berry::IAdapterManager, "org.blueberry.service.IAdapterManager")
+
#endif /*BERRYIADAPTERMANAGER_H_*/
diff --git a/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryIBerryPreferences.h b/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryIBerryPreferences.h
index dc927e3912..7456fbe6d4 100644
--- a/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryIBerryPreferences.h
+++ b/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryIBerryPreferences.h
@@ -1,33 +1,33 @@
#ifndef BERRYIBERRYPREFERENCES_H_
#define BERRYIBERRYPREFERENCES_H_
-#include "berryRuntimeDll.h"
+#include std::string
object ("").
* Every other node has an arbitrary node name, specified at the time it is
* created. The only restrictions on this name are that it cannot be the empty
* string, and it cannot contain the slash character ('/').
*
* "/"
. Children of the
* root node have absolute path names of "/" +
<node name>
* . All other nodes have absolute path names of <parent's absolute
* path name> + "/" +
<node name> . Note that
* all absolute path names begin with the slash character.
*
*
*
*
*
*
*
* Preference
node has zero or more properties associated with
* it, where a property consists of a name and a value. The bundle writer is
* free to choose any appropriate names for properties. Their values can be of
* type std::string
,long
,int
,bool
,
* std::vector
,float
, or double
but they can
* always be accessed as if they were std::string
objects.
*
* flush
method may be used to synchronously force updates
* to the backing store.
*
* key
or value
is
* null
.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
*/
virtual void Put(std::string key, std::string value) = 0;
/**
* Returns the value associated with the specified key
in this
* node. Returns the specified default if there is no value associated with
* the key
, or the backing store is inaccessible.
*
* @param key key whose associated value is to be returned.
* @param def the value to be returned in the event that this node has no
* value associated with key
or the backing store is
* inaccessible.
* @return the value associated with key
, or def
if
* no value is associated with key
.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
* @throws NullPointerException if key
is null
. (A
* null
default is permitted.)
*/
virtual std::string Get(std::string key, std::string def) const = 0;
/**
* Removes the value associated with the specified key
in this
* node, if any.
*
* @param key key whose mapping is to be removed from this node.
* @see #get(std::string,std::string)
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
*/
virtual void Remove(std::string key) = 0;
/**
* Removes all of the properties (key-value associations) in this node. This
* call has no effect on any descendants of this node.
*
* @throws BackingStoreException if this operation cannot be completed due
* to a failure in the backing store, or inability to communicate
* with it.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
* @see #remove(std::string)
*/
virtual void Clear() throw(Poco::Exception, BackingStoreException) = 0;
/**
* Associates a std::string
object representing the specified
* int
value with the specified key
in this node. The
* associated string is the one that would be returned if the int
* value were passed to Integer.toString(int)
. This method is
* intended for use in conjunction with {@link #getInt}method.
*
* std::string
object in the backing store. If the
* backing store supports integer values, it is not unreasonable to use
* them. This implementation detail is not visible through the
* IPreferences
API, which allows the value to be read as an
* int
(with getInt
or a std::string
(with
* get
) type.
*
* @param key key with which the string form of value is to be associated.
* @param value value
whose string form is to be associated with
* key
.
* @throws NullPointerException if key
is null
.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
* @see #getInt(std::string,int)
*/
virtual void PutInt(std::string key, int value) = 0;
/**
* Returns the int
value represented by the std::string
* object associated with the specified key
in this node. The
* std::string
object is converted to an int
as by
* Integer.parseInt(std::string)
. Returns the specified default if
* there is no value associated with the key
, the backing store
* is inaccessible, or if Integer.parseInt(std::string)
would throw a
* NumberFormatException
if the associated value
were
* passed. This method is intended for use in conjunction with the
* {@link #putInt}method.
*
* @param key key whose associated value is to be returned as an
* int
.
* @param def the value to be returned in the event that this node has no
* value associated with key
or the associated value
* cannot be interpreted as an int
or the backing store is
* inaccessible.
* @return the int
value represented by the std::string
* object associated with key
in this node, or
* def
if the associated value does not exist or cannot
* be interpreted as an int
type.
* @throws NullPointerException if key
is null
.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
* @see #putInt(std::string,int)
* @see #get(std::string,std::string)
*/
virtual int GetInt(std::string key, int def) const = 0;
/**
* Associates a std::string
object representing the specified
* long
value with the specified key
in this node. The
* associated std::string
object is the one that would be returned if
* the long
value were passed to Long.toString(long)
.
* This method is intended for use in conjunction with the {@link #getLong}
* method.
*
* value
* be represented by a std::string
type in the backing store. If the
* backing store supports long
values, it is not unreasonable to
* use them. This implementation detail is not visible through the
* IPreferences
API, which allows the value to be read as a
* long
(with getLong
or a std::string
(with
* get
) type.
*
* @param key key
with which the string form of value
* is to be associated.
* @param value value
whose string form is to be associated with
* key
.
* @throws NullPointerException if key
is null
.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
* @see #getLong(std::string,long)
*/
virtual void PutLong(std::string key, long value) = 0;
/**
* Returns the long
value represented by the std::string
* object associated with the specified key
in this node. The
* std::string
object is converted to a long
as by
* Long.parseLong(std::string)
. Returns the specified default if
* there is no value associated with the key
, the backing store
* is inaccessible, or if Long.parseLong(std::string)
would throw a
* NumberFormatException
if the associated value
were
* passed. This method is intended for use in conjunction with the
* {@link #putLong}method.
*
* @param key key
whose associated value is to be returned as a
* long
value.
* @param def the value to be returned in the event that this node has no
* value associated with key
or the associated value
* cannot be interpreted as a long
type or the backing
* store is inaccessible.
* @return the long
value represented by the std::string
* object associated with key
in this node, or
* def
if the associated value does not exist or cannot
* be interpreted as a long
type.
* @throws NullPointerException if key
is null
.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
* @see #putLong(std::string,long)
* @see #get(std::string,std::string)
*/
virtual long GetLong(std::string key, long def) const = 0;
/**
* Associates a std::string
object representing the specified
* bool
value with the specified key in this node. The
* associated string is "true" if the value is true
, and "false"
* if it is false
. This method is intended for use in
* conjunction with the {@link #getBool}method.
*
* bool
values, it is not unreasonable to use them.
* This implementation detail is not visible through the IPreferences
*
API, which allows the value to be read as a bool
* (with getBool
) or a std::string
(with get
)
* type.
*
* @param key key
with which the string form of value is to be
* associated.
* @param value value whose string form is to be associated with
* key
.
* @throws NullPointerException if key
is null
.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
* @see #getBool(std::string,bool)
* @see #get(std::string,std::string)
*/
virtual void PutBool(std::string key, bool value) = 0;
/**
* Returns the bool
value represented by the std::string
* object associated with the specified key
in this node. Valid
* strings are "true", which represents true
, and "false", which
* represents false
. Case is ignored, so, for example, "TRUE"
* and "False" are also valid. This method is intended for use in
* conjunction with the {@link #putBool}method.
*
* key
, the backing store is inaccessible, or if the associated
* value is something other than "true" or "false", ignoring case.
*
* @param key key
whose associated value is to be returned as a
* bool
.
* @param def the value to be returned in the event that this node has no
* value associated with key
or the associated value
* cannot be interpreted as a bool
or the backing store
* is inaccessible.
* @return the bool
value represented by the std::string
* object associated with key
in this node, or
* null
if the associated value does not exist or cannot
* be interpreted as a bool
.
* @throws NullPointerException if key
is null
.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
* @see #get(std::string,std::string)
* @see #putBool(std::string,bool)
*/
virtual bool GetBool(std::string key, bool def) const = 0;
/**
* Associates a std::string
object representing the specified
* float
value with the specified key
in this node.
* The associated std::string
object is the one that would be returned
* if the float
value were passed to
* Float.toString(float)
. This method is intended for use in
* conjunction with the {@link #getFloat}method.
*
* float
values, it is not unreasonable to use them.
* This implementation detail is not visible through the IPreferences
*
API, which allows the value to be read as a float
(with
* getFloat
) or a std::string
(with get
) type.
*
* @param key key
with which the string form of value is to be
* associated.
* @param value value whose string form is to be associated with
* key
.
* @throws NullPointerException if key
is null
.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
* @see #getFloat(std::string,float)
*/
virtual void PutFloat(std::string key, float value) = 0;
/**
* Returns the float value
represented by the std::string
* object associated with the specified key
in this node. The
* std::string
object is converted to a float
value as by
* Float.parseFloat(std::string)
. Returns the specified default if
* there is no value associated with the key
, the backing store
* is inaccessible, or if Float.parseFloat(std::string)
would throw a
* NumberFormatException
if the associated value were passed.
* This method is intended for use in conjunction with the {@link #putFloat}
* method.
*
* @param key key
whose associated value is to be returned as a
* float
value.
* @param def the value to be returned in the event that this node has no
* value associated with key
or the associated value
* cannot be interpreted as a float
type or the backing
* store is inaccessible.
* @return the float
value represented by the string associated
* with key
in this node, or def
if the
* associated value does not exist or cannot be interpreted as a
* float
type.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
* @throws NullPointerException if key
is null
.
* @see #putFloat(std::string,float)
* @see #get(std::string,std::string)
*/
virtual float GetFloat(std::string key, float def) const = 0;
/**
* Associates a std::string
object representing the specified
* double
value with the specified key
in this node.
* The associated std::string
object is the one that would be returned
* if the double
value were passed to
* Double.toString(double)
. This method is intended for use in
* conjunction with the {@link #getDouble}method
*
* double
values, it is not unreasonable to use them.
* This implementation detail is not visible through the IPreferences
*
API, which allows the value to be read as a double
(with
* getDouble
) or a std::string
(with get
)
* type.
*
* @param key key
with which the string form of value is to be
* associated.
* @param value value whose string form is to be associated with
* key
.
* @throws NullPointerException if key
is null
.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
* @see #getDouble(std::string,double)
*/
virtual void PutDouble(std::string key, double value) = 0;
/**
* Returns the double
value represented by the std::string
* object associated with the specified key
in this node. The
* std::string
object is converted to a double
value as by
* Double.parseDouble(std::string)
. Returns the specified default if
* there is no value associated with the key
, the backing store
* is inaccessible, or if Double.parseDouble(std::string)
would throw
* a NumberFormatException
if the associated value were passed.
* This method is intended for use in conjunction with the
* {@link #putDouble}method.
*
* @param key key
whose associated value is to be returned as a
* double
value.
* @param def the value to be returned in the event that this node has no
* value associated with key
or the associated value
* cannot be interpreted as a double
type or the backing
* store is inaccessible.
* @return the double
value represented by the std::string
* object associated with key
in this node, or
* def
if the associated value does not exist or cannot
* be interpreted as a double
type.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the the {@link #removeNode()}method.
* @throws NullPointerException if key
is null
.
* @see #putDouble(std::string,double)
* @see #get(std::string,std::string)
*/
virtual double GetDouble(std::string key, double def) const = 0;
/**
* Associates a std::string
object representing the specified
* std::vector
with the specified key
in this node. The
* associated std::string
object the Base64 encoding of the
* std::vector
, as defined in RFC 2045 , Section 6.8,
* with one minor change: the string will consist solely of characters from
* the Base64 Alphabet ; it will not contain any newline characters.
* This method is intended for use in conjunction with the
* {@link #getByteArray}method.
*
* std::string
type in the backing store. If the
* backing store supports std::vector
values, it is not unreasonable
* to use them. This implementation detail is not visible through the
* IPreferences
API, which allows the value to be read as an a
* std::vector
object (with getByteArray
) or a
* std::string
object (with get
).
*
* @param key key
with which the string form of value
* is to be associated.
* @param value value
whose string form is to be associated with
* key
.
* @throws NullPointerException if key
or value
is
* null
.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
* @see #getByteArray(std::string,std::vectorstd::vector
value represented by the std::string
* object associated with the specified key
in this node. Valid
* std::string
objects are Base64 encoded binary data, as
* defined in RFC 2045 ,
* Section 6.8, with one minor change: the string must consist solely of
* characters from the Base64 Alphabet ; no newline characters or
* extraneous characters are permitted. This method is intended for use in
* conjunction with the {@link #putByteArray}method.
*
* key
, the backing store is inaccessible, or if the associated
* value is not a valid Base64 encoded byte array (as defined above).
*
* @param key key
whose associated value is to be returned as a
* std::vector
object.
* @param def the value to be returned in the event that this node has no
* value associated with key
or the associated value
* cannot be interpreted as a std::vector
type, or the backing
* store is inaccessible.
* @return the std::vector
value represented by the std::string
* object associated with key
in this node, or
* def
if the associated value does not exist or cannot
* be interpreted as a std::vector
.
* @throws NullPointerException if key
is null
. (A
* null
value for def
is permitted.)
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
* @see #get(std::string,std::string)
* @see #putByteArray(std::string,std::vectornull
!)
*
* @return an array of the keys that have an associated value in this node.
* @throws BackingStoreException if this operation cannot be completed due
* to a failure in the backing store, or inability to communicate
* with it.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
*/
virtual std::vectornull
!)
*
* @return the names of the children of this node.
* @throws BackingStoreException if this operation cannot be completed due
* to a failure in the backing store, or inability to communicate
* with it.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
*/
virtual std::vectornull
if this is the root.
*
* @return the parent of this node.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
*/
virtual IPreferences::Pointer Parent() const = 0;
/**
* Returns a named IPreferences
object (node), creating it and any
* of its ancestors if they do not already exist. Accepts a relative or
* absolute pathname. Absolute pathnames (which begin with '/'
)
* are interpreted relative to the root of this node. Relative pathnames
* (which begin with any character other than '/'
) are
* interpreted relative to this node itself. The empty string (""
)
* is a valid relative pathname, referring to this node itself.
*
* flush
method is called on the returned
* node (or one of its descendants).
*
* @param pathName the path name of the IPreferences
object to
* return.
* @return the specified IPreferences
object.
* @throws IllegalArgumentException if the path name is invalid.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
* @throws NullPointerException if path name is null
.
* @see #flush()
*/
virtual IPreferences::Pointer Node(std::string pathName) = 0;
/**
* Returns true if the named node exists. Accepts a relative or absolute
* pathname. Absolute pathnames (which begin with '/'
) are
* interpreted relative to the root of this node. Relative pathnames (which
* begin with any character other than '/'
) are interpreted
* relative to this node itself. The pathname ""
is valid, and
* refers to this node itself.
*
* ""
; the invocation will return
* false
. Thus, the idiom p.nodeExists("")
may be
* used to test whether p
has been removed.
*
* @param pathName the path name of the node whose existence is to be
* checked.
* @return true if the specified node exists.
* @throws BackingStoreException if this operation cannot be completed due
* to a failure in the backing store, or inability to communicate
* with it.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method and
* pathname
is not the empty string (""
).
* @throws IllegalArgumentException if the path name is invalid (i.e., it
* contains multiple consecutive slash characters, or ends with a
* slash character and is more than one character long).
*/
virtual bool NodeExists(std::string pathName) const
throw(Poco::Exception, BackingStoreException) = 0;
/**
* Removes this node and all of its descendants, invalidating any properties
* contained in the removed nodes. Once a node has been removed, attempting
* any method other than name()
,absolutePath()
or
* nodeExists("")
on the corresponding IPreferences
* instance will fail with an IllegalStateException
. (The
* methods defined on Object
can still be invoked on a node after
* it has been removed; they will not throw IllegalStateException
.)
*
* flush
* method is called on the parent of this node.
*
* @throws IllegalStateException if this node (or an ancestor) has already
* been removed with the {@link #removeNode()}method.
* @throws BackingStoreException if this operation cannot be completed due
* to a failure in the backing store, or inability to communicate
* with it.
* @see #flush()
*/
virtual void RemoveNode() throw(Poco::Exception, BackingStoreException) = 0;
/**
* Returns this node's name, relative to its parent.
*
* @return this node's name, relative to its parent.
*/
virtual std::string Name() const = 0;
/**
* Returns this node's absolute path name. Note that:
*
*
*
* @return this node's absolute path name.
*/
virtual std::string AbsolutePath() const = 0;
/**
* Forces any changes in the contents of this node and its descendants to
* the persistent store.
*
* "/"
.
* '/'
).
* "."
and ".."
have no
* special significance in path names.
* sync
invocation. As a side-effect, forces any changes
* in the contents of this node and its descendants to the persistent store,
* as if the flush
method had been invoked on this node.
*
* @throws BackingStoreException if this operation cannot be completed due
* to a failure in the backing store, or inability to communicate
* with it.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()}method.
* @see #flush()
*/
virtual void Sync() throw(Poco::Exception, BackingStoreException) = 0;
};
} // namespace berry
#endif /*BERRYIPREFERENCES_H_*/
diff --git a/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryIPreferencesService.h b/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryIPreferencesService.h
index c1ae592e4a..8d490f8139 100644
--- a/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryIPreferencesService.h
+++ b/BlueBerry/Bundles/org.blueberry.core.runtime/src/berryIPreferencesService.h
@@ -1,61 +1,65 @@
#ifndef BERRYIPREFERENCESSERVICE_H_
#define BERRYIPREFERENCESSERVICE_H_
#include "service/berryService.h"
-#include "berryRuntimeDll.h"
+#include PreferencesService
object is specific to the bundle which
* obtained it from the service registry. If a bundle wishes to allow another
* bundle to access its preferences, it should pass its
* PreferencesService
object to that bundle.
*
*/
struct BERRY_RUNTIME IPreferencesService : public Service
{
///
/// A unique ID for the Service.
///
static const std::string ID;
- berryInterfaceMacro(IPreferencesService, berry)
+ berryInterfaceMacro(IPreferencesService, berry)
/**
* Returns the root system node for the calling bundle.
*
* @return The root system node for the calling bundle.
*/
virtual IPreferences::Pointer GetSystemPreferences() = 0;
/**
* Returns the root node for the specified user and the calling bundle.
*
* @param name The user for which to return the preference root node.
* @return The root node for the specified user and the calling bundle.
*/
virtual IPreferences::Pointer GetUserPreferences(std::string name) = 0;
/**
* Returns the names of users for which node trees exist.
*
* @return The names of users for which node trees exist.
*/
virtual std::vectorIAdaptable
* interface. getAdapter
invocations are directed
* to the platform's adapter manager.
* IAdaptable
interface and explicitly forwarding
* the getAdapter
request to the platform's
* adapater manager. The method would look like:
*
* public Object getAdapter(Class adapter) {
* return Platform.getAdapterManager().getAdapter(this, adapter);
* }
*
* null
if
* no such object can be found.
* IAdaptable
* passes the request along to the platform's adapter manager; roughly
* Platform.getAdapterManager().getAdapter(this, adapter)
.
* Subclasses may override this method (however, if they do so, they
* should invoke the method on their superclass to ensure that the
* Platform's adapter manager is consulted).
* org.blueberry.osgi.applications
extension-point.
*
* BlueBerry.exitdata
system property.
*/
static const int EXIT_RELAUNCH;
virtual ~IApplication();
/**
* Starts this application with the given context and returns a result. This
* method must not exit until the application is finished and is ready to exit.
* The content of the context is unchecked and should conform to the expectations of
* the application being invoked.Integer
is returned
* it is treated as the program exit code if BlueBerry is exiting.
*
#include
*
* null
if none
*/
static const Poco::Path& GetInstallPath();
/**
* Returns the path of the platform's working directory (also known as the instance data area).
* An empty path is returned if the platform is running without an instance location.
*
* @return the location of the platform's instance data area or null
if none
*/
static const Poco::Path& GetInstancePath();
/**
* Returns the path in the local file system of the
* plug-in state area for the given bundle.
* If the plug-in state area did not exist prior to this call,
* it is created.
* null
if none
*/
static const Poco::Path& GetUserPath();
static int GetOS();
static int GetOSArch();
static bool IsUnix();
static bool IsWindows();
static bool IsBSD();
static bool IsLinux();
static bool IsVMS();
static std::string GetProperty(const std::string& key);
static bool IsRunning();
static Poco::Util::LayeredConfiguration& GetConfiguration();
/**
* Returns the unmodified, original command line arguments
*
*/
static int& GetRawApplicationArgs(char**& argv);
/**
* Returns the applications command line arguments which
* have not been consumed by the platform. The first
* argument still is the application name
*/
static std::vector