Package au.edu.qut.prom.helpers
Class HeadlessDefinitelyNotUIPluginContext
- java.lang.Object
-
- au.edu.qut.prom.helpers.HeadlessDefinitelyNotUIPluginContext
-
- All Implemented Interfaces:
org.processmining.framework.plugin.GlobalContext,org.processmining.framework.plugin.ObjectConstructor,org.processmining.framework.plugin.PluginContext
public class HeadlessDefinitelyNotUIPluginContext extends java.lang.Object implements org.processmining.framework.plugin.PluginContextUsually it's enough for the type signature to be a PluginContext. But some code specifically checks if the object is an instanceof UIPluginContext, and then starts throwing dialog boxes up all over your nice new shoes.- Author:
- burkeat
-
-
Constructor Summary
Constructors Constructor Description HeadlessDefinitelyNotUIPluginContext(org.processmining.framework.plugin.PluginContext context, java.lang.String label)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends org.processmining.framework.connections.Connection>
TaddConnection(T c)Registers the given connection in the global context.voidclear()org.processmining.contexts.uitopia.UIPluginContextcreateChildContext(java.lang.String label)Returns a new plugin context instance, which can be used to invoke other plugins.org.processmining.framework.plugin.PluginContextIDcreateNewPluginContextID()The GlobalContext implementation should create IDs for all PluginContexts instantiated for it.booleandeleteChild(org.processmining.framework.plugin.PluginContext child)Delete this child from this context.booleanequals(java.lang.Object o)java.util.List<org.processmining.framework.plugin.PluginContext>getChildContexts()Returns a list of all child contexts which have been created with createChildContext().org.processmining.framework.connections.ConnectionManagergetConnectionManager()Returns the connection manager.java.util.concurrent.ExecutorgetExecutor()Returns an executor which can be used to execute plugins in child contexts.org.processmining.framework.plugin.ProMFuture<?>getFutureResult(int i)This method should only be used by a plugin, in the body of that plugin.org.processmining.contexts.uitopia.UIContextgetGlobalContext()org.processmining.framework.plugin.PluginContextIDgetID()Each PluginContext should carry an ID.java.lang.StringgetLabel()Returns the label of this context.org.processmining.framework.plugin.events.Logger.ListenerListgetLoggingListeners()Returns the list of logging listeners registered to this context.org.processmining.framework.plugin.PluginContextgetParentContext()Returns the context which created this context or null if it has no parent.java.lang.Class<? extends org.processmining.framework.plugin.PluginContext>getPluginContextType()Returns the specific type of the PluginContext.org.processmining.framework.util.Pair<org.processmining.framework.plugin.PluginDescriptor,java.lang.Integer>getPluginDescriptor()Return the plugin descriptor and method index of the plugin which is invoked in this context.org.processmining.framework.plugin.events.PluginLifeCycleEventListener.ListgetPluginLifeCycleEventListeners()Returns the list of registered plugin life cycle listeners.org.processmining.framework.plugin.PluginManagergetPluginManager()Returns the plugin manager.org.processmining.framework.plugin.ProgressgetProgress()Returns the progress object corresponding to this contextorg.processmining.framework.plugin.events.ProgressEventListener.ListenerListgetProgressEventListeners()Returns the list of registered progress listenersorg.processmining.framework.providedobjects.ProvidedObjectManagergetProvidedObjectManager()Returns the providedObject manager.org.processmining.framework.plugin.PluginExecutionResultgetResult()This method returns the PluginExecutionResult of the plugin which is invoked in this context.org.processmining.contexts.uitopia.UIPluginContextgetRootContext()Returns the root plugin context.org.processmining.contexts.uitopia.model.ProMTaskgetTask()inthashCode()booleanhasPluginDescriptorInPath(org.processmining.framework.plugin.PluginDescriptor plugin, int methodIndex)voidinvokeBinding(org.processmining.framework.plugin.PluginParameterBinding binding, java.lang.Object... objects)This method invokes the specified binding in a context which is a child of the main plugin context maintained by this globalContext.voidinvokePlugin(org.processmining.framework.plugin.PluginDescriptor plugin, int index, java.lang.Object... objects)This method invokes the specified plugin in a context which is a child of the main plugin context maintained by this globalContext.booleanisDistantChildOf(org.processmining.framework.plugin.PluginContext context)Returns true if this is a distant child of context, i.e.voidlog(java.lang.String message)Same as calling log(message, MessageLevel.NORMAL);voidlog(java.lang.String message, org.processmining.framework.plugin.events.Logger.MessageLevel level)The provided String is provided to the context for information.voidlog(java.lang.Throwable exception)The provided Exception is provided to the context.java.io.FileopenFile(javax.swing.filechooser.FileFilter filter)java.io.File[]openFiles(javax.swing.filechooser.FileFilter filter)java.io.FilesaveFile(java.lang.String defaultExtension, java.lang.String... extensions)voidsetFuture(org.processmining.framework.plugin.PluginExecutionResult futureToBe)voidsetPluginDescriptor(org.processmining.framework.plugin.PluginDescriptor descriptor, int methodIndex)voidsetTask(org.processmining.contexts.uitopia.model.ProMTask task)org.deckfour.uitopia.api.event.TaskListener.InteractionResultshowConfiguration(java.lang.String title, javax.swing.JComponent configuration)org.deckfour.uitopia.api.event.TaskListener.InteractionResultshowWizard(java.lang.String title, boolean first, boolean last, javax.swing.JComponent configuration)java.lang.StringtoString()<T,C extends org.processmining.framework.connections.Connection>
java.util.Collection<T>tryToFindOrConstructAllObjects(java.lang.Class<T> type, java.lang.Class<C> connectionType, java.lang.String role, java.lang.Object... input)Finds as many objects of the given type as can be found through the connections of the other given type.<T,C extends org.processmining.framework.connections.Connection>
TtryToFindOrConstructFirstNamedObject(java.lang.Class<T> type, java.lang.String name, java.lang.Class<C> connectionType, java.lang.String role, java.lang.Object... input)Returns the first object of the given type as can be found through the connections of the other given type.<T,C extends org.processmining.framework.connections.Connection>
TtryToFindOrConstructFirstObject(java.lang.Class<T> type, java.lang.Class<C> connectionType, java.lang.String role, java.lang.Object... input)Returns the first object of the given type as can be found through the connections of the other given type.
-
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getConnectionManager
public org.processmining.framework.connections.ConnectionManager getConnectionManager()
Description copied from interface:org.processmining.framework.plugin.GlobalContextReturns the connection manager. The connection manager can be used to query for connections which are registered in ProM.- Specified by:
getConnectionManagerin interfaceorg.processmining.framework.plugin.GlobalContext- Returns:
- the connection manager
-
addConnection
public <T extends org.processmining.framework.connections.Connection> T addConnection(T c)
Description copied from interface:org.processmining.framework.plugin.PluginContextRegisters the given connection in the global context. The implementation is addConnection(this,c);- Specified by:
addConnectionin interfaceorg.processmining.framework.plugin.PluginContext
-
clear
public void clear()
- Specified by:
clearin interfaceorg.processmining.framework.plugin.PluginContext
-
getProgress
public org.processmining.framework.plugin.Progress getProgress()
Description copied from interface:org.processmining.framework.plugin.PluginContextReturns the progress object corresponding to this context- Specified by:
getProgressin interfaceorg.processmining.framework.plugin.PluginContext- Returns:
- the progress object corresponding to this context
-
getFutureResult
public org.processmining.framework.plugin.ProMFuture<?> getFutureResult(int i)
Description copied from interface:org.processmining.framework.plugin.PluginContextThis method should only be used by a plugin, in the body of that plugin. That is the only location, where it is guaranteed that each result object in getResults() can safely be cast to a ProMFuture.- Specified by:
getFutureResultin interfaceorg.processmining.framework.plugin.PluginContext- Returns:
-
setFuture
public void setFuture(org.processmining.framework.plugin.PluginExecutionResult futureToBe)
- Specified by:
setFuturein interfaceorg.processmining.framework.plugin.PluginContext
-
getResult
public org.processmining.framework.plugin.PluginExecutionResult getResult()
Description copied from interface:org.processmining.framework.plugin.PluginContextThis method returns the PluginExecutionResult of the plugin which is invoked in this context. This future result is set by PluginManager.invoke() and will not be available (will be null) until the invoke() method is called.- Specified by:
getResultin interfaceorg.processmining.framework.plugin.PluginContext- Returns:
- The PluginExecutionResult that represents the result of this plugin invocation
-
getExecutor
public java.util.concurrent.Executor getExecutor()
Description copied from interface:org.processmining.framework.plugin.PluginContextReturns an executor which can be used to execute plugins in child contexts.- Specified by:
getExecutorin interfaceorg.processmining.framework.plugin.PluginContext- Returns:
-
log
public void log(java.lang.String message, org.processmining.framework.plugin.events.Logger.MessageLevel level)Description copied from interface:org.processmining.framework.plugin.PluginContextThe provided String is provided to the context for information. It can for example signal a state change of a plugin. Note that some contexts can completely ignore this message.- Specified by:
login interfaceorg.processmining.framework.plugin.PluginContext- Parameters:
message- the message to loglevel- the message level
-
log
public void log(java.lang.String message)
Description copied from interface:org.processmining.framework.plugin.PluginContextSame as calling log(message, MessageLevel.NORMAL);- Specified by:
login interfaceorg.processmining.framework.plugin.PluginContext- Parameters:
message- The message
-
log
public void log(java.lang.Throwable exception)
Description copied from interface:org.processmining.framework.plugin.PluginContextThe provided Exception is provided to the context. It signals the context about an error in the plugin, that specifically lead to abnormal termination. The plugin signaling the exception is no longer executing!- Specified by:
login interfaceorg.processmining.framework.plugin.PluginContext- Parameters:
exception- the exception thrown
-
openFile
public java.io.File openFile(javax.swing.filechooser.FileFilter filter) throws java.io.IOException- Throws:
java.io.IOException
-
saveFile
public java.io.File saveFile(java.lang.String defaultExtension, java.lang.String... extensions) throws java.io.IOException- Throws:
java.io.IOException
-
openFiles
public java.io.File[] openFiles(javax.swing.filechooser.FileFilter filter) throws java.io.IOException- Throws:
java.io.IOException
-
getPluginDescriptor
public org.processmining.framework.util.Pair<org.processmining.framework.plugin.PluginDescriptor,java.lang.Integer> getPluginDescriptor()
Description copied from interface:org.processmining.framework.plugin.PluginContextReturn the plugin descriptor and method index of the plugin which is invoked in this context. This descriptor is set by the PluginDescriptor.invoke() method and will not be set yet before PluginManager.invoke() is called.- Specified by:
getPluginDescriptorin interfaceorg.processmining.framework.plugin.PluginContext- Returns:
- the descriptor of the plugin which is invoked in this context If the plugin is not set yet, a pair of (null,-1) is returned
-
getGlobalContext
public org.processmining.contexts.uitopia.UIContext getGlobalContext()
-
getPluginLifeCycleEventListeners
public org.processmining.framework.plugin.events.PluginLifeCycleEventListener.List getPluginLifeCycleEventListeners()
Description copied from interface:org.processmining.framework.plugin.PluginContextReturns the list of registered plugin life cycle listeners.- Specified by:
getPluginLifeCycleEventListenersin interfaceorg.processmining.framework.plugin.PluginContext- Returns:
- the list of registered plugin life cycle listeners.
-
getRootContext
public org.processmining.contexts.uitopia.UIPluginContext getRootContext()
Description copied from interface:org.processmining.framework.plugin.PluginContextReturns the root plugin context. This is an instance of PluginContext of which all other contexts are distant childs.- Specified by:
getRootContextin interfaceorg.processmining.framework.plugin.PluginContext- Returns:
-
getProgressEventListeners
public org.processmining.framework.plugin.events.ProgressEventListener.ListenerList getProgressEventListeners()
Description copied from interface:org.processmining.framework.plugin.PluginContextReturns the list of registered progress listeners- Specified by:
getProgressEventListenersin interfaceorg.processmining.framework.plugin.PluginContext- Returns:
- the list of registered progress listeners
-
setTask
public void setTask(org.processmining.contexts.uitopia.model.ProMTask task)
-
getTask
public org.processmining.contexts.uitopia.model.ProMTask getTask()
-
getID
public org.processmining.framework.plugin.PluginContextID getID()
Description copied from interface:org.processmining.framework.plugin.PluginContextEach PluginContext should carry an ID. This ID is unique within this plugin context's global context.- Specified by:
getIDin interfaceorg.processmining.framework.plugin.PluginContext- Returns:
- the ID of this context
-
showConfiguration
public org.deckfour.uitopia.api.event.TaskListener.InteractionResult showConfiguration(java.lang.String title, javax.swing.JComponent configuration)
-
getLabel
public java.lang.String getLabel()
Description copied from interface:org.processmining.framework.plugin.PluginContextReturns the label of this context.- Specified by:
getLabelin interfaceorg.processmining.framework.plugin.PluginContext- Returns:
-
hasPluginDescriptorInPath
public boolean hasPluginDescriptorInPath(org.processmining.framework.plugin.PluginDescriptor plugin, int methodIndex)- Specified by:
hasPluginDescriptorInPathin interfaceorg.processmining.framework.plugin.PluginContext
-
showWizard
public org.deckfour.uitopia.api.event.TaskListener.InteractionResult showWizard(java.lang.String title, boolean first, boolean last, javax.swing.JComponent configuration)
-
setPluginDescriptor
public void setPluginDescriptor(org.processmining.framework.plugin.PluginDescriptor descriptor, int methodIndex) throws org.processmining.framework.plugin.impl.FieldSetException, org.processmining.framework.plugin.RecursiveCallException- Specified by:
setPluginDescriptorin interfaceorg.processmining.framework.plugin.PluginContext- Throws:
org.processmining.framework.plugin.impl.FieldSetExceptionorg.processmining.framework.plugin.RecursiveCallException
-
createChildContext
public org.processmining.contexts.uitopia.UIPluginContext createChildContext(java.lang.String label)
Description copied from interface:org.processmining.framework.plugin.PluginContextReturns a new plugin context instance, which can be used to invoke other plugins.- Specified by:
createChildContextin interfaceorg.processmining.framework.plugin.PluginContext- Returns:
- the new plugin context instance
-
getChildContexts
public java.util.List<org.processmining.framework.plugin.PluginContext> getChildContexts()
Description copied from interface:org.processmining.framework.plugin.PluginContextReturns a list of all child contexts which have been created with createChildContext().- Specified by:
getChildContextsin interfaceorg.processmining.framework.plugin.PluginContext- Returns:
-
getParentContext
public org.processmining.framework.plugin.PluginContext getParentContext()
Description copied from interface:org.processmining.framework.plugin.PluginContextReturns the context which created this context or null if it has no parent.- Specified by:
getParentContextin interfaceorg.processmining.framework.plugin.PluginContext- Returns:
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isDistantChildOf
public boolean isDistantChildOf(org.processmining.framework.plugin.PluginContext context)
Description copied from interface:org.processmining.framework.plugin.PluginContextReturns true if this is a distant child of context, i.e. true if getParent.getID().equals(context.getID()) || getParent().isDistantChildOf(context);- Specified by:
isDistantChildOfin interfaceorg.processmining.framework.plugin.PluginContext- Returns:
-
getPluginManager
public org.processmining.framework.plugin.PluginManager getPluginManager()
Description copied from interface:org.processmining.framework.plugin.GlobalContextReturns the plugin manager. The plugin manager can be used to query for plugins which are registered in ProM.- Specified by:
getPluginManagerin interfaceorg.processmining.framework.plugin.GlobalContext- Returns:
- the plugin manager
-
getProvidedObjectManager
public org.processmining.framework.providedobjects.ProvidedObjectManager getProvidedObjectManager()
Description copied from interface:org.processmining.framework.plugin.GlobalContextReturns the providedObject manager. The providedObject manager can be used to query for providedObjects which are registered in ProM. The manager should be a ProvidedObjectListener on all PluginInstanceContexts created by createRootInstanceContext.- Specified by:
getProvidedObjectManagerin interfaceorg.processmining.framework.plugin.GlobalContext- Returns:
- the providedObject manager
-
createNewPluginContextID
public org.processmining.framework.plugin.PluginContextID createNewPluginContextID()
Description copied from interface:org.processmining.framework.plugin.GlobalContextThe GlobalContext implementation should create IDs for all PluginContexts instantiated for it.- Specified by:
createNewPluginContextIDin interfaceorg.processmining.framework.plugin.GlobalContext- Returns:
-
invokePlugin
public void invokePlugin(org.processmining.framework.plugin.PluginDescriptor plugin, int index, java.lang.Object... objects)Description copied from interface:org.processmining.framework.plugin.GlobalContextThis method invokes the specified plugin in a context which is a child of the main plugin context maintained by this globalContext. No results are provided to the method calling this method and the plugin is executed some time in the future, as decided by the implementing class.- Specified by:
invokePluginin interfaceorg.processmining.framework.plugin.GlobalContext- Parameters:
plugin- The plugin that should be invoked by the frameworkindex- The index of the plugin method that should be invoked.objects- The objects to serve as input as accepted by the method at index of the plugin
-
invokeBinding
public void invokeBinding(org.processmining.framework.plugin.PluginParameterBinding binding, java.lang.Object... objects)Description copied from interface:org.processmining.framework.plugin.GlobalContextThis method invokes the specified binding in a context which is a child of the main plugin context maintained by this globalContext. No results are provided to the method calling this method and the plugin is executed some time in the future, as decided by the implementing class.- Specified by:
invokeBindingin interfaceorg.processmining.framework.plugin.GlobalContext- Parameters:
binding- The binding that should be invoked by the frameworkobjects- The objects to serve as input as accepted by the given binding.
-
getLoggingListeners
public org.processmining.framework.plugin.events.Logger.ListenerList getLoggingListeners()
Description copied from interface:org.processmining.framework.plugin.PluginContextReturns the list of logging listeners registered to this context.- Specified by:
getLoggingListenersin interfaceorg.processmining.framework.plugin.PluginContext- Returns:
-
deleteChild
public boolean deleteChild(org.processmining.framework.plugin.PluginContext child)
Description copied from interface:org.processmining.framework.plugin.PluginContextDelete this child from this context.- Specified by:
deleteChildin interfaceorg.processmining.framework.plugin.PluginContext
-
getPluginContextType
public java.lang.Class<? extends org.processmining.framework.plugin.PluginContext> getPluginContextType()
Description copied from interface:org.processmining.framework.plugin.GlobalContextReturns the specific type of the PluginContext. This type is used to instantiate new contexts in which to invoke plugins.- Specified by:
getPluginContextTypein interfaceorg.processmining.framework.plugin.GlobalContext- Returns:
- the type of PluginContext provided by this global context
-
tryToFindOrConstructAllObjects
public <T,C extends org.processmining.framework.connections.Connection> java.util.Collection<T> tryToFindOrConstructAllObjects(java.lang.Class<T> type, java.lang.Class<C> connectionType, java.lang.String role, java.lang.Object... input) throws org.processmining.framework.connections.ConnectionCannotBeObtainedDescription copied from interface:org.processmining.framework.plugin.ObjectConstructorFinds as many objects of the given type as can be found through the connections of the other given type. If no objects can be found, it constructs as many objects of the given type as there are plugins available to the framework to do so. These plugins should be able to execute in a child of the given context and accept, in any order, exactly the input provided. Any other objects returned by the plugin, not being the requested type are added to the provided objects of the framework. Also, listeners are notified where applicable. If no plugings exist, or if these plugins fail, a ConnectionDoesntExistException is thrown.- Specified by:
tryToFindOrConstructAllObjectsin interfaceorg.processmining.framework.plugin.ObjectConstructor- Type Parameters:
T- The type of the return object required.- Parameters:
type- the type of the return object required.connectionType- the type of the connections to use when trying to find the objects.role- the assumed role of the object in the connection. Given a connection, the object can be retrieved through the role.input- the input on which the plugin should work- Returns:
- a collection of objects as found or returned by the plugins.
- Throws:
org.processmining.framework.connections.ConnectionCannotBeObtained
-
tryToFindOrConstructFirstObject
public <T,C extends org.processmining.framework.connections.Connection> T tryToFindOrConstructFirstObject(java.lang.Class<T> type, java.lang.Class<C> connectionType, java.lang.String role, java.lang.Object... input) throws org.processmining.framework.connections.ConnectionCannotBeObtainedDescription copied from interface:org.processmining.framework.plugin.ObjectConstructorReturns the first object of the given type as can be found through the connections of the other given type. If no objects can be found, it constructs as an object of the given type using a plugin available to the framework to do so. This plugins should be able to execute in a child of the given context and accept, in any order, exactly the input provided. Any other objects returned by the plugin, not being the requested type are added to the provided objects of the framework. Also, listeners are notified where applicable. If no plugins exist, or if these plugins fail, a ConnectionDoesntExistException is thrown.- Specified by:
tryToFindOrConstructFirstObjectin interfaceorg.processmining.framework.plugin.ObjectConstructor- Type Parameters:
T- The type of the return object required.- Parameters:
type- the type of the return object required.connectionType- the type of the connections to use when trying to find the objects.role- the assumed role of the object in the connection. Given a connection, the object can be retrieved through the role.input- the input on which the plugin should work- Returns:
- a collection of objects as returned by the plugins.
- Throws:
org.processmining.framework.connections.ConnectionCannotBeObtained
-
tryToFindOrConstructFirstNamedObject
public <T,C extends org.processmining.framework.connections.Connection> T tryToFindOrConstructFirstNamedObject(java.lang.Class<T> type, java.lang.String name, java.lang.Class<C> connectionType, java.lang.String role, java.lang.Object... input) throws org.processmining.framework.connections.ConnectionCannotBeObtainedDescription copied from interface:org.processmining.framework.plugin.ObjectConstructorReturns the first object of the given type as can be found through the connections of the other given type. If no objects can be found, it constructs as an object of the given type using a plugin available to the framework to do so. This plugins should be able to execute in a child of the given context and accept, in any order, exactly the input provided. Furthermore, the returned object should have the right label assigned to it in the plugin definition. Any other objects returned by the plugin, not being the requested type are added to the provided objects of the framework. Also, listeners are notified where applicable. If no plugins exist, or if these plugins fail, a ConnectionDoesntExistException is thrown.- Specified by:
tryToFindOrConstructFirstNamedObjectin interfaceorg.processmining.framework.plugin.ObjectConstructor- Type Parameters:
T- The type of the return object required.- Parameters:
type- the type of the return object required.name- the name of the plugin to use.connectionType- the type of the connections to use when trying to find the objects.role- the assumed role of the object in the connection. Given a connection, the object can be retrieved through the role.input- the input on which the plugin should work- Returns:
- a collection of objects as returned by the plugins.
- Throws:
org.processmining.framework.connections.ConnectionCannotBeObtained
-
-