/** * Produces a {@link CasConsumer} instance from a <code>ResourceSpecifier</code>. The * <code>ResourceSpecifier</code> may either specify how to construct a new instance or how to * locate an existing instance. * * @param aSpecifier * an object that specifies how to acquire an instance of a <code>Resource</code>. * This must specify a subclass of <code>CasConsumer</code>. * * @return a <code>CasConsumer</code> instance. * * @throws ResourceInitializationException * if a failure occurred during production of the resource. */ public static CasConsumer produceCasConsumer(ResourceSpecifier aSpecifier) throws ResourceInitializationException { return (CasConsumer) produceResource(CasConsumer.class, aSpecifier, null); }
/** * Produces a {@link CollectionReader} instance from a <code>ResourceSpecifier</code>. The * <code>ResourceSpecifier</code> may either specify how to construct a new instance or how to * locate an existing instance. * * @param aSpecifier * an object that specifies how to acquire an instance of a <code>Resource</code>. * This must specify a subclass of <code>CollectionReader</code>. * * @return a <code>CollectionReader</code> instance. * * @throws ResourceInitializationException * if a failure occurred during production of the resource. */ public static CollectionReader produceCollectionReader(ResourceSpecifier aSpecifier) throws ResourceInitializationException { return (CollectionReader) produceResource(CollectionReader.class, aSpecifier, null); }
ResourceManager aResourceManager, Map<String, Object> aAdditionalParams) throws ResourceInitializationException { return (CasConsumer) produceResource(CasConsumer.class, aSpecifier, aResourceManager, aAdditionalParams);
/** * Produces an appropriate <code>Resource</code> instance from a <code>ResourceSpecifier</code>. * The <code>ResourceSpecifier</code> may either specify how to construct a new instance or how * to locate an existing instance. * * @param aSpecifier * an object that specifies how to acquire an instance of a <code>Resource</code>. * @param aAdditionalParams * a Map containing additional parameters to pass to the * {@link Resource#initialize(ResourceSpecifier,Map)} method. May be <code>null</code> * if there are no parameters. Parameter names are defined as constants on the * {@link AnalysisEngine}, and {@link Resource}. * Furthermore, the entry under the key {@link Resource#PARAM_PERFORMANCE_TUNING_SETTINGS} * is a map which may contain settings with keys defined as constants here {@link UIMAFramework} interfaces. * For example this can be used to set * performance-tuning settings as described in * {@link #getDefaultPerformanceTuningProperties()}. * * @return a <code>Resource</code> instance. * * @throws ResourceInitializationException * if a failure occurred during production of the resource. */ public static Resource produceResource(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams) throws ResourceInitializationException { return produceResource(Resource.class, aSpecifier, aAdditionalParams); }
/** * Produces a {@link CasInitializer} instance from a <code>ResourceSpecifier</code>. The * <code>ResourceSpecifier</code> may either specify how to construct a new instance or how to * locate an existing instance. * * @param aSpecifier * an object that specifies how to acquire an instance of a <code>Resource</code>. * This must specify a subclass of <code>CasInitializer</code>. * @param aAdditionalParams * a Map containing additional parameters to pass to the * {@link Resource#initialize(ResourceSpecifier,Map)} method. May be <code>null</code> * if there are no parameters. Parameter names are defined as constants on the * {@link AnalysisEngine}, and {@link Resource}. * Furthermore, the entry under the key {@link Resource#PARAM_PERFORMANCE_TUNING_SETTINGS} * is a map which may contain settings with keys defined as constants here {@link UIMAFramework} interfaces. * For example this can be used to set * performance-tuning settings as described in * {@link #getDefaultPerformanceTuningProperties()}. * * @return a <code>CasInitializer</code> instance. * * @throws ResourceInitializationException * if a failure occurred during production of the resource. */ public static CasInitializer produceCasInitializer(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams) throws ResourceInitializationException { return (CasInitializer) produceResource(CasInitializer.class, aSpecifier, aAdditionalParams); }
/** * Produces a {@link CasConsumer} instance from a <code>ResourceSpecifier</code>. The * <code>ResourceSpecifier</code> may either specify how to construct a new instance or how to * locate an existing instance. * * @param aSpecifier * an object that specifies how to acquire an instance of a <code>Resource</code>. * This must specify a subclass of <code>CasConsumer</code>. * @param aAdditionalParams * a Map containing additional parameters to pass to the * {@link Resource#initialize(ResourceSpecifier,Map)} method. May be <code>null</code> * if there are no parameters. Parameter names are defined as constants on the * {@link AnalysisEngine}, and {@link Resource}. * Furthermore, the entry under the key {@link Resource#PARAM_PERFORMANCE_TUNING_SETTINGS} * is a map which may contain settings with keys defined as constants here {@link UIMAFramework} interfaces. * For example this can be used to set * performance-tuning settings as described in * {@link #getDefaultPerformanceTuningProperties()}. * * @return a <code>CasConsumer</code> instance. * * @throws ResourceInitializationException * if a failure occurred during production of the resource. */ public static CasConsumer produceCasConsumer(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams) throws ResourceInitializationException { return (CasConsumer) produceResource(CasConsumer.class, aSpecifier, aAdditionalParams); }
/** * Produces a {@link CollectionReader} instance from a <code>ResourceSpecifier</code>. The * <code>ResourceSpecifier</code> may either specify how to construct a new instance or how to * locate an existing instance. * * @param aSpecifier * an object that specifies how to acquire an instance of a <code>Resource</code>. * This must specify a subclass of <code>CollectionReader</code>. * @param aAdditionalParams * a Map containing additional parameters to pass to the * {@link Resource#initialize(ResourceSpecifier,Map)} method. May be <code>null</code> * if there are no parameters. Parameter names are defined as constants on the * {@link AnalysisEngine}, and {@link Resource}. * Furthermore, the entry under the key {@link Resource#PARAM_PERFORMANCE_TUNING_SETTINGS} * is a map which may contain settings with keys defined as constants here {@link UIMAFramework} interfaces. * For example this can be used to set * performance-tuning settings as described in * {@link #getDefaultPerformanceTuningProperties()}. * * @return a <code>CollectionReader</code> instance. * * @throws ResourceInitializationException * if a failure occurred during production of the resource. */ public static CollectionReader produceCollectionReader(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams) throws ResourceInitializationException { return (CollectionReader) produceResource(CollectionReader.class, aSpecifier, aAdditionalParams); }
ResourceManager aResourceManager, Map<String, Object> aAdditionalParams) throws ResourceInitializationException { return (CasInitializer) produceResource(CasInitializer.class, aSpecifier, aResourceManager, aAdditionalParams);
ResourceManager aResourceManager, Map<String, Object> aAdditionalParams) throws ResourceInitializationException { return (CollectionReader) produceResource(CollectionReader.class, aSpecifier, aResourceManager, aAdditionalParams);
/** * Produces a {@link CasInitializer} instance from a <code>ResourceSpecifier</code>. The * <code>ResourceSpecifier</code> may either specify how to construct a new instance or how to * locate an existing instance. * * @param aSpecifier * an object that specifies how to acquire an instance of a <code>Resource</code>. * This must specify a subclass of <code>CasInitializer</code>. * * @return a <code>CasInitializer</code> instance. * * @throws ResourceInitializationException * if a failure occurred during production of the resource. * * @deprecated As of v2.0, CAS Initializers are deprecated. A component that performs an operation * like HTML detagging should instead be implemented as a "multi-Sofa" annotator. See * org.apache.uima.examples.XmlDetagger for an example. */ @Deprecated public static CasInitializer produceCasInitializer(ResourceSpecifier aSpecifier) throws ResourceInitializationException { return (CasInitializer) produceResource(CasInitializer.class, aSpecifier, null); }
/** * Produces a {@link TextAnalysisEngine} instance from a <code>ResourceSpecifier</code>. The * <code>ResourceSpecifier</code> may either specify how to construct a new instance or how to * locate an existing instance. * <p> * The TextAnalysisEngine returned from this method is not guaranteed to be able to process * multiple simultaneous requests. See {@link #produceTAE(ResourceSpecifier,int,int)} for more * information. * * @param aSpecifier * an object that specifies how to acquire an instance of a <code>Resource</code>. * This must specify a subclass of <code>TextAnalysisEngine</code>. * * @return a <code>TextAnalysisEngine</code> instance. * * @throws ResourceInitializationException * if a failure occurred during production of the resource. * * @deprecated As of v2.0, {@link #produceAnalysisEngine(ResourceSpecifier)} should be used * instead. */ @Deprecated public static TextAnalysisEngine produceTAE(ResourceSpecifier aSpecifier) throws ResourceInitializationException { return (TextAnalysisEngine) produceResource(TextAnalysisEngine.class, aSpecifier, null); }
public static TextAnalysisEngine produceTAE(ResourceSpecifier aSpecifier, Map<String, Object> aAdditionalParams) throws ResourceInitializationException { return (TextAnalysisEngine) produceResource(TextAnalysisEngine.class, aSpecifier, aAdditionalParams);
/** * Utility method used in the constructor to fill the pool with Resource instances. * * @param aResourceSpecifier * specifier that describes how to create the Resource instances for the pool * @param aResourceClass * class of resource to instantiate * @param aResourceInitParams * initialization parameters to be passed to the * {@link Resource#initialize(ResourceSpecifier,Map)} method. * * * @throws ResourceInitializationException * if the Resource instances could not be created */ protected void fillPool(ResourceSpecifier aResourceSpecifier, Class<? extends Resource> aResourceClass, Map<String, Object> aResourceInitParams) throws ResourceInitializationException { // fill the pool for (int i = 0; i < mNumInstances; i++) { Resource_ImplBase resource = (Resource_ImplBase) UIMAFramework.produceResource( aResourceClass, aResourceSpecifier, aResourceInitParams); mAllInstances.add(resource); mFreeInstances.add(resource); } }
ResourceManager aResourceManager, Map<String, Object> aAdditionalParams) throws ResourceInitializationException { return (TextAnalysisEngine) produceResource(TextAnalysisEngine.class, aSpecifier, aResourceManager, aAdditionalParams);
/** * Initializes this ResourceService_impl. This method must be called before any other methods on * this class may be called. * * @param aResourceSpecifier * specifier that describes how to create the resources that provide the functionality * for this service. * @param aResourceInitParams * additional parameters to be passed on to the Resource Factory. * @throws ResourceInitializationException - */ public void initialize(ResourceSpecifier aResourceSpecifier, Map<String, Object> aResourceInitParams) throws ResourceInitializationException { // create Resource mResource = UIMAFramework.produceResource(getResourceClass(), aResourceSpecifier, aResourceInitParams); }
private static <T extends Resource> T buildResource(Class<? extends Resource> resourceClass, Map<String, Object> tuples, Class<T> type) throws Exception { CustomResourceSpecifier spec = new CustomResourceSpecifier_impl(); spec.setResourceClassName(resourceClass.getName()); Resource resource = UIMAFramework.produceResource(spec, tuples); return type.cast(resource); }
aAdditionalParams.put(AnalysisEngine.PARAM_TIMEOUT_PERIOD, Integer.valueOf(aTimeoutPeriod)); return (TextAnalysisEngine) produceResource(TextAnalysisEngine.class, aSpecifier, aAdditionalParams);
/** * Produces an {@link AnalysisEngine} instance from a <code>ResourceSpecifier</code>. The * <code>ResourceSpecifier</code> may either specify how to construct a new instance or how to * locate an existing instance. * <p> * The AnalysisEngine returned from this method is not guaranteed to be able to process multiple * simultaneous requests. See {@link #produceAnalysisEngine(ResourceSpecifier,int,int)} for more * information. * * @param aSpecifier * an object that specifies how to acquire an instance of a <code>Resource</code>. * This must specify a subclass of <code>AnalysisEngine</code>. * * @return an <code>AnalysisEngine</code> instance. * * @throws ResourceInitializationException * if a failure occurred during production of the resource. */ public static AnalysisEngine produceAnalysisEngine(ResourceSpecifier aSpecifier) throws ResourceInitializationException { AnalysisEngine ae = null; // Fetch current time to compute initialization time long initStartTime = System.currentTimeMillis(); ae = (AnalysisEngine) produceResource(AnalysisEngine.class, aSpecifier, null); // initialization succeeded, update AE state and initialization time updateAeState(ae,initStartTime); return ae; }
ae = (AnalysisEngine) produceResource(AnalysisEngine.class, aSpecifier, aAdditionalParams);
ae = (AnalysisEngine) produceResource(AnalysisEngine.class, aSpecifier, aResourceManager, aAdditionalParams);