package de.mpg.mpiz.koeln.anyname;
import de.kerner.commons.osgi.utils.ServiceNotAvailabeException;
import de.mpg.mpiz.koeln.anna.abstractstep.AbstractAnnaStep;
import de.mpg.mpiz.koeln.anna.data.DataBean;
import de.mpg.mpiz.koeln.anna.server.data.DataProxy;
import de.mpg.mpiz.koeln.anna.server.data.simple.SimpleDataServer;
import de.mpg.mpiz.koeln.anna.step.StepExecutionException;
import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;
public class Test extends AbstractAnnaStep<DataBean> {
private volatile ServiceTracker tracker;
@Override
public boolean canBeSkipped(DataProxy<DataBean> proxy) throws Throwable {
// TODO Auto-generated method stub
return false;
}
@Override
public DataProxy<DataBean> getDataProxy()
throws ServiceNotAvailabeException {
SimpleDataServer server = (SimpleDataServer) tracker.getService();
if(server == null)
throw new ServiceNotAvailabeException("could not find data server");
return server;
}
@Override
protected synchronized void init(BundleContext context)
throws StepExecutionException {
super.init(context);
tracker = new ServiceTracker(context, SimpleDataServer.class.getName(), null);
tracker.open();
}
@Override
protected void finalize() throws Throwable {
this.tracker.close();
tracker = null;
super.finalize();
}
@Override
public boolean requirementsSatisfied(DataProxy<DataBean> proxy)
throws Throwable {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean run(DataProxy<DataBean> proxy) throws Throwable {
// TODO Auto-generated method stub
return false;
}
public boolean isCyclic() {
// TODO Auto-generated method stub
return false;
}
}
|