Search in sources :

Example 6 with CreoleEvent

use of gate.event.CreoleEvent in project gate-core by GateNLP.

the class CreoleProxy method createDataStore.

// openDataStore()
/**
 * Create a new DataStore and open it. <B>NOTE:</B> for some data
 * stores creation is an system administrator task; in such cases this
 * method will throw an UnsupportedOperationException.
 */
public static DataStore createDataStore(String dataStoreClassName, String storageUrl) throws PersistenceException, UnsupportedOperationException {
    DataStore ds = instantiateDataStore(dataStoreClassName, storageUrl);
    ds.create();
    ds.open();
    if (Gate.getDataStoreRegister().add(ds))
        creoleProxy.fireDatastoreCreated(new CreoleEvent(ds, CreoleEvent.DATASTORE_CREATED));
    return ds;
}
Also used : SerialDataStore(gate.persist.SerialDataStore) CreoleEvent(gate.event.CreoleEvent)

Example 7 with CreoleEvent

use of gate.event.CreoleEvent in project gate-core by GateNLP.

the class CreoleProxy method deleteResource.

// create(resourceClassName, parameterValues, features, listeners)
/**
 * Delete an instance of a resource. This involves removing it from
 * the stack of instantiations maintained by this resource type's
 * resource data. Deletion does not guarantee that the resource will
 * become a candidate for garbage collection, just that the GATE
 * framework is no longer holding references to the resource.
 *
 * @param resource the resource to be deleted.
 */
public static void deleteResource(Resource resource) {
    ResourceData rd = Gate.getCreoleRegister().get(resource.getClass().getName());
    if (rd != null && rd.removeInstantiation(resource)) {
        creoleProxy.fireResourceUnloaded(new CreoleEvent(resource, CreoleEvent.RESOURCE_UNLOADED));
        resource.cleanup();
    }
}
Also used : ResourceData(gate.creole.ResourceData) CreoleEvent(gate.event.CreoleEvent)

Aggregations

CreoleEvent (gate.event.CreoleEvent)7 SerialDataStore (gate.persist.SerialDataStore)3 AbstractVisualResource (gate.creole.AbstractVisualResource)2 AnnotationSchema (gate.creole.AnnotationSchema)2 ResourceData (gate.creole.ResourceData)2 CreoleListener (gate.event.CreoleListener)2 LanguageResource (gate.LanguageResource)1 Resource (gate.Resource)1 AbstractProcessingResource (gate.creole.AbstractProcessingResource)1 AbstractResource (gate.creole.AbstractResource)1 ConditionalController (gate.creole.ConditionalController)1 ParameterException (gate.creole.ParameterException)1 Plugin (gate.creole.Plugin)1 ResourceInstantiationException (gate.creole.ResourceInstantiationException)1 CreoleResource (gate.creole.metadata.CreoleResource)1 PersistenceException (gate.persist.PersistenceException)1 XJPopupMenu (gate.swing.XJPopupMenu)1 Serializable (java.io.Serializable)1 URI (java.net.URI)1 URL (java.net.URL)1