import java.util.concurrent.Executor;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.simantics.databoard.Bindings;
import org.simantics.databoard.accessor.error.AccessorException;
import org.simantics.history.util.subscription.SubscriptionItem;
import org.simantics.simulation.data.Datasource.DatasourceListener;
import org.simantics.utils.datastructures.Triple;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This adapter reads data from Datasource and writes to an open Subscription.
*/
public class DatasourceAdapter implements DatasourceListener {
- protected Logger logger = Logger.getLogger( DatasourceAdapter.class.toString() );
+ protected Logger logger = LoggerFactory.getLogger( DatasourceAdapter.class );
protected Collector session;
protected boolean loaded = false;
protected List<VariableHandle> handles = new ArrayList<VariableHandle>();
result.add(Triple.make(key, binding, value));
} catch (AccessorException e) {
if (failedIds.add(key))
- logger.log(Level.SEVERE, e.toString(), e);
+ logger.error(e.toString(), e);
continue;
}
}
Object value = null;
if (handle != null) {
try {
- value = handle.getValue();
+ value = handle.getValue(source);
} catch (AccessorException e) {
if (failedIds.add(key))
- logger.log(Level.SEVERE, e.toString(), e);
+ logger.error(e.toString(), e);
continue;
}
Binding binding = handle.binding();
try {
session.setValue( key, binding, value );
} catch (HistoryException e) {
- logger.log(Level.SEVERE, e.toString(), e);
+ logger.error(e.toString(), e);
}
} else {
Binding binding = bindings.get(i);
if (binding != null) {
session.setValue( key, binding, value );
- }
+ }
}
}
try {
session.endStep();
} catch (HistoryException e) {
- logger.log(Level.SEVERE, e.toString(), e);
+ logger.error(e.toString(), e);
}
}
} catch (HistoryException e) {
- logger.log(Level.SEVERE, e.toString(), e);
+ logger.error(e.toString(), e);
} finally {
stepLock.unlock();
}
public Executor getExecutor() {
return null;
}
-
}