All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gate.util.persistence.AnalyserRunningStrategyPersistence Maven / Gradle / Ivy

Go to download

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 java.io.Serializable;

import gate.LanguageAnalyser;
import gate.creole.AnalyserRunningStrategy;
import gate.creole.ResourceInstantiationException;
import gate.persist.PersistenceException;

/**
 * Persistent holder for {@link gate.creole.AnalyserRunningStrategy}.
 */

public class AnalyserRunningStrategyPersistence extends AbstractPersistence {

  @Override
  public void extractDataFromSource(Object source) throws PersistenceException {
    if(! (source instanceof AnalyserRunningStrategy))
      throw new UnsupportedOperationException(
                getClass().getName() + " can only be used for " +
                AnalyserRunningStrategy.class.getName() +
                " objects!\n" + source.getClass().getName() +
                " is not a " + AnalyserRunningStrategy.class.getName());
    AnalyserRunningStrategy strategy = (AnalyserRunningStrategy)source;
    this.pr = PersistenceManager.getPersistentRepresentation(strategy.getPR());
    this.runMode = strategy.getRunMode();
    this.featureName = strategy.getFeatureName();
    this.featureValue = strategy.getFeatureValue();
  }


  @Override
  public Object createObject() throws PersistenceException,
                                      ResourceInstantiationException {
    return new AnalyserRunningStrategy(
            (LanguageAnalyser)PersistenceManager.getTransientRepresentation(
              pr,containingControllerName,initParamOverrides),
                                       runMode, featureName, featureValue);
  }

  protected int runMode;

  protected String featureName;

  protected String featureValue;

  protected Serializable pr;
  /**
   * Serialisation ID
   */
  static final long serialVersionUID = -8288186597177634360L;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy