InternalModuleServiceCall.java
001 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
002  *
003  * Copyright 2000-2014,  Michael Meyling <mime@qedeq.org>.
004  *
005  * "Hilbert II" is free software; you can redistribute
006  * it and/or modify it under the terms of the GNU General Public
007  * License as published by the Free Software Foundation; either
008  * version 2 of the License, or (at your option) any later version.
009  *
010  * This program is distributed in the hope that it will be useful,
011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013  * GNU General Public License for more details.
014  */
015 
016 package org.qedeq.kernel.bo.module;
017 
018 import org.qedeq.base.io.Parameters;
019 import org.qedeq.kernel.bo.common.ModuleServiceCall;
020 import org.qedeq.kernel.bo.common.ModuleServiceResult;
021 import org.qedeq.kernel.se.common.ServiceCompleteness;
022 
023 
024 /**
025  * Information for a service call. Occurs during execution of a
026  {@link org.qedeq.kernel.se.common.ServiceJob}.
027  *
028  @author  Michael Meyling
029  */
030 public interface InternalModuleServiceCall extends ModuleServiceCall {
031 
032     /**
033      * Get global config parameters for service call.
034      *
035      @return  Service parameter.
036      */
037     public Parameters getConfigParameters();
038 
039     /**
040      * Get call specific parameters for service call.
041      *
042      @return  Service parameter.
043      */
044     public Parameters getParameters();
045 
046     /**
047      * Set percentage of currently running plugin execution.
048      *
049      @param   percentage  Number between 0 and 100.
050      */
051     public void setExecutionPercentage(double percentage);
052 
053     /**
054      * Set someone who answers completeness questions.
055      *
056      @param   completeness    An answer for completeness questions. Might be <code>null</code>.
057      */
058     public void setServiceCompleteness(ServiceCompleteness completeness);
059 
060     /**
061      * Set description of currently taken action.
062      *
063      @param   action  We are doing this currently.
064      */
065     public void setAction(String action);
066 
067     /**
068      * Return service process the call was initiated.
069      *
070      @return  Service process for this call.
071      */
072     public InternalServiceJob getInternalServiceProcess();
073 
074     /**
075      * Signal an execution pause.
076      */
077     public void pause();
078 
079     /**
080      * Signal execution resume.
081      */
082     public void resume();
083 
084     /**
085      * Set generic success result for call and stop.
086      * Can only be done if call is still running.
087      */
088     public void finishOk();
089 
090     /**
091      * Set generic failure result for call and stop.
092      * Can only be done if call is still running.
093      *
094      @param   errorMessage    Reason for finishing with error.
095      */
096     public void finishError(final String errorMessage);
097 
098     /**
099      * Set result state for call and stop.
100      * Can only be done if call is still running.
101      *
102      @param   result  Service result.
103      */
104     public void finish(ModuleServiceResult result);
105 
106     /**
107      * Set result state for call and stop.
108      * Can only be done if call is still running.
109      *
110      @param   result  Must include reason for halting.
111      */
112     public void halt(ModuleServiceResult result);
113 
114     /**
115      * Set generic failure result for call and stop.
116      * Can only be done if call is still running.
117      *
118      @param   errorMessage    Reason for halting.
119      */
120     public void halt(final String errorMessage);
121 
122     /**
123      * Set failure state for call and stop.
124      * Can only be done if call is still running.
125      */
126     public void interrupt();
127 
128 }