Class AbstractProcessingEngine

    • Constructor Detail

      • AbstractProcessingEngine

        public AbstractProcessingEngine()
    • Method Detail

      • getStatisticsCollectorType

        public java.lang.String getStatisticsCollectorType()
        Specified by:
        getStatisticsCollectorType in interface org.copperengine.management.ProcessingEngineMXBean
      • setDependencyInjector

        public void setDependencyInjector​(DependencyInjector dependencyInjector)
      • getDependencyInjectorType

        public java.lang.String getDependencyInjectorType()
        Specified by:
        getDependencyInjectorType in interface org.copperengine.management.ProcessingEngineMXBean
      • setEngineIdProvider

        public void setEngineIdProvider​(EngineIdProvider engineIdProvider)
      • getEngineId

        public java.lang.String getEngineId()
        Description copied from interface: ProcessingEngine
        returns the engines id
        Specified by:
        getEngineId in interface ProcessingEngine
        Specified by:
        getEngineId in interface org.copperengine.management.ProcessingEngineMXBean
        Returns:
        the engine id
      • setIdFactory

        public final void setIdFactory​(IdFactory idFactory)
      • createUUID

        public final java.lang.String createUUID()
        Specified by:
        createUUID in interface ProcessingEngine
        Returns:
        Creates and returns a Universally Unique Identifier (UUID). The UUID may be used for workflow ids or correlation ids.
      • createWorkflowFactory

        public final <E> WorkflowFactory<E> createWorkflowFactory​(java.lang.String classname)
                                                           throws java.lang.ClassNotFoundException
        Throws:
        java.lang.ClassNotFoundException
      • addShutdownObserver

        public void addShutdownObserver​(java.lang.Runnable observer)
        Description copied from interface: ProcessingEngine
        Adds a shutdown observer/hook to the engine. During shutdown of the engine, Runnable.run() of each registered observer is called subsequently.
        Specified by:
        addShutdownObserver in interface ProcessingEngine
        Parameters:
        observer - the observer/hook to add
      • startup

        public void startup()
        Description copied from interface: ProcessingEngine
        Starts up the engine. The invocation of this method blocks until the startup procedure is finished. This method might even throw an Error, if something fundamentally wents wrong like starting up the workflow repository or database storage.
        Specified by:
        startup in interface ProcessingEngine
      • shutdown

        public void shutdown()
                      throws CopperRuntimeException
        Description copied from interface: ProcessingEngine
        Triggers the shutdown of the engine. The engine tries to end running workflow instances gracefully. The invocation of this method returns immediately.
        Specified by:
        shutdown in interface ProcessingEngine
        Throws:
        CopperRuntimeException - - wraps Exceptions which could happen in different types of configured engines into RuntimeExceptions. Further RuntimeExceptions like IllegalStateException might also be thrown.
      • convert2Wfi

        protected org.copperengine.management.model.WorkflowInfo convert2Wfi​(Workflow<?> wf)
      • run

        public java.lang.String run​(java.lang.String wfname,
                                    java.lang.Object data)
                             throws CopperException
        Description copied from interface: ProcessingEngine
        Enqueues the specified workflow instance into the engine for execution.
        Specified by:
        run in interface ProcessingEngine
        Parameters:
        wfname - name or alias of the workflows class
        data - the data to pass to the workflow
        Returns:
        workflow instance Id
        Throws:
        CopperException - if the engine can not run the workflow for some reason, e.g. in case of an unknown processor pool id.
      • run

        public java.lang.String run​(WorkflowInstanceDescr<?> wfInstanceDescr)
                             throws CopperException
        Description copied from interface: ProcessingEngine
        Enqueues the specified workflow instance description into the engine for execution.
        Specified by:
        run in interface ProcessingEngine
        Parameters:
        wfInstanceDescr - the workflow instance description out of which a workflow is generated and put into the engine for execution
        Returns:
        workflow instance Id
        Throws:
        CopperException - if the engine can not run the workflow for some reason, e.g. in case of an unknown processor pool id.
      • createWorkflowInstance

        protected Workflow<java.lang.Object> createWorkflowInstance​(WorkflowInstanceDescr<?> wfInstanceDescr)
                                                             throws java.lang.InstantiationException,
                                                                    java.lang.IllegalAccessException,
                                                                    java.lang.ClassNotFoundException
        Throws:
        java.lang.InstantiationException
        java.lang.IllegalAccessException
        java.lang.ClassNotFoundException
      • runBatch

        public void runBatch​(java.util.List<WorkflowInstanceDescr<?>> wfInstanceDescr)
                      throws CopperException
        Description copied from interface: ProcessingEngine
        Enqueues the specified batch of workflow instance descriptions into the engine for execution.
        Specified by:
        runBatch in interface ProcessingEngine
        Parameters:
        wfInstanceDescr - batch or workflow instance descriptions to be put into the engine for execution
        Throws:
        CopperException - if the engine can not run the workflows for some reason, e.g. in case of an unknown processor pool id.
      • getWorkflowRepository

        public org.copperengine.management.WorkflowRepositoryMXBean getWorkflowRepository()
        Specified by:
        getWorkflowRepository in interface org.copperengine.management.ProcessingEngineMXBean
      • injectDependencies

        public void injectDependencies​(Workflow<?> wf)
      • trackActivity

        protected void trackActivity()
      • trackWfiStarted

        protected void trackWfiStarted()
      • queryEngineActivity

        public org.copperengine.management.model.EngineActivity queryEngineActivity​(int minutesInHistory)
        Specified by:
        queryEngineActivity in interface org.copperengine.management.ProcessingEngineMXBean
      • filter

        protected java.util.List<org.copperengine.management.model.WorkflowInfo> filter​(org.copperengine.management.model.WorkflowInstanceFilter filter,
                                                                                        java.util.Collection<Workflow<?>> workflowInstances)
      • getInvalidCount

        public long getInvalidCount()
        Specified by:
        getInvalidCount in interface org.copperengine.management.ProcessingEngineMXBean
      • getErrorCount

        public long getErrorCount()
        Specified by:
        getErrorCount in interface org.copperengine.management.ProcessingEngineMXBean
      • getDequeuedCount

        public long getDequeuedCount()
        Specified by:
        getDequeuedCount in interface org.copperengine.management.ProcessingEngineMXBean
      • getRunningCount

        public long getRunningCount()
        Specified by:
        getRunningCount in interface org.copperengine.management.ProcessingEngineMXBean
      • getFinishedCount

        public long getFinishedCount()
        Specified by:
        getFinishedCount in interface org.copperengine.management.ProcessingEngineMXBean
      • getWaitingCount

        public long getWaitingCount()
        Specified by:
        getWaitingCount in interface org.copperengine.management.ProcessingEngineMXBean
      • count

        protected long count​(org.copperengine.management.model.WorkflowInstanceFilter filter,
                             java.util.Collection<Workflow<?>> workflowInstances)