UnifiedNlp/src/org/microg/nlp/ProviderService.java
mar-v-in 9b92b83950 Config more or less done, can't keep order...
Current way to combine multiple backends is Fusion, every backend is called!
Works so far, changed sample backends to better show fusion results.
2014-03-06 18:31:05 +01:00

55 lines
1.1 KiB
Java

package org.microg.nlp;
import android.app.IntentService;
import android.content.Intent;
import android.os.IBinder;
public abstract class ProviderService extends IntentService {
private Provider provider;
/**
* Creates an ProviderService. Invoked by your subclass's constructor.
*
* @param tag Used for debugging.
*/
public ProviderService(String tag) {
super(tag);
}
@Override
public void onCreate() {
super.onCreate();
provider = createProvider();
}
@Override
public IBinder onBind(Intent intent) {
return provider.getBinder();
}
@Override
public void onDestroy() {
provider = null;
}
/**
* Create a {@link org.microg.nlp.Provider}.
* This is most likely only called once
*
* @return a new {@link org.microg.nlp.Provider} instance
*/
protected abstract Provider createProvider();
@Override
protected void onHandleIntent(Intent intent) {
// Default implementation is to do nothing
}
/**
* @return the currently used {@link org.microg.nlp.Provider} instance
*/
protected Provider getCurrentProvider() {
return provider;
}
}