gate.util.persistence.UnconditionalRunningStrategyPersistence Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gate-core Show documentation
Show all versions of gate-core Show documentation
GATE - general achitecture for text engineering - is open source
software capable of solving almost any text processing problem. This
artifact enables you to embed the core GATE Embedded with its essential
dependencies. You will able to use the GATE Embedded API and load and
store GATE XML documents. This artifact is the perfect dependency for
CREOLE plugins or for applications that need to customize the GATE
dependencies due to confict with their own dependencies or for lower
footprint.
The newest version!
package gate.util.persistence;
import gate.ProcessingResource;
import gate.creole.ResourceInstantiationException;
import gate.creole.RunningStrategy.UnconditionalRunningStrategy;
import gate.persist.PersistenceException;
import java.io.Serializable;
/**
* Persistent holder for {@link gate.creole.RunningStrategy.UnconditionalRunningStrategy}.
*/
public class UnconditionalRunningStrategyPersistence extends AbstractPersistence {
@Override
public void extractDataFromSource(Object source) throws PersistenceException {
if(! (source instanceof UnconditionalRunningStrategy))
throw new UnsupportedOperationException(
getClass().getName() + " can only be used for " +
UnconditionalRunningStrategy.class.getName() +
" objects!\n" + source.getClass().getName() +
" is not a " + UnconditionalRunningStrategy.class.getName());
UnconditionalRunningStrategy strategy = (UnconditionalRunningStrategy)source;
this.pr = PersistenceManager.getPersistentRepresentation(strategy.getPR());
this.shouldRun = strategy.shouldRun();
}
@Override
public Object createObject() throws PersistenceException,
ResourceInstantiationException {
return new UnconditionalRunningStrategy(
(ProcessingResource)PersistenceManager.
getTransientRepresentation(pr,containingControllerName,initParamOverrides),
shouldRun);
}
protected boolean shouldRun;
protected Serializable pr;
/**
* Serialisation ID
*/
private static final long serialVersionUID = 5049829826299681555L;
}