use of com.serotonin.m2m2.rt.RuntimeManager in project ma-modules-public by infiniteautomation.
the class WatchListDwr method createWatchListState.
/**
* Convenience method for creating a populated view state.
*/
private WatchListState createWatchListState(HttpServletRequest request, DataPointVO pointVO, RuntimeManager rtm, Map<String, Object> model, User user) {
// Get the data point status from the data image.
DataPointRT point = rtm.getDataPoint(pointVO.getId());
WatchListState state = new WatchListState();
state.setId(Integer.toString(pointVO.getId()));
PointValueTime pointValue = prepareBasePointState(Integer.toString(pointVO.getId()), state, pointVO, point, model);
setEvents(pointVO, user, model, pointEventsLimit);
if (pointValue != null && pointValue.getValue() instanceof ImageValue) {
// Text renderers don't help here. Create a thumbnail.
setImageText(request, state, pointVO, model, pointValue);
} else
setPrettyText(state, pointVO, model, pointValue);
if (pointVO.isSettable())
setChange(pointVO, state, point, request, model, user);
if (state.getValue() != null)
setChart(pointVO, state, request, model);
setMessages(state, request, getModule().getWebPath() + "/web/snippet/watchListMessages.jsp", model);
return state;
}
use of com.serotonin.m2m2.rt.RuntimeManager in project ma-core-public by infiniteautomation.
the class DataSourceRT method initializePoints.
/**
* The {@link DataPointGroupInitializer} calls
* {@link RuntimeManager#startDataPoint(DataPointWithEventDetectors, List) startDataPoint()}
* which adds the data points to the cache in the RTM and initializes them.
*/
private void initializePoints() {
DataPointDao dataPointDao = Common.getBean(DataPointDao.class);
ExecutorService executorService = Common.getBean(ExecutorService.class);
PointValueCache pointValueCache = Common.getBean(PointValueCache.class);
// Add the enabled points to the data source.
List<DataPointWithEventDetectors> dataSourcePoints = dataPointDao.getDataPointsForDataSourceStart(getId());
// Startup multi threaded
int pointsPerThread = Common.envProps.getInt("runtime.datapoint.startupThreads.pointsPerThread", 1000);
int startupThreads = Common.envProps.getInt("runtime.datapoint.startupThreads", Runtime.getRuntime().availableProcessors());
DataPointGroupInitializer pointInitializer = new DataPointGroupInitializer(executorService, startupThreads, pointValueCache);
pointInitializer.initialize(dataSourcePoints, pointsPerThread);
// Signal to the data source that all points are added.
initialized();
}
use of com.serotonin.m2m2.rt.RuntimeManager in project ma-modules-public by infiniteautomation.
the class GraphicalViewDwr method addPointComponentState.
private void addPointComponentState(ViewComponent viewComponent, boolean update, RuntimeManager rtm, Map<String, Object> model, HttpServletRequest request, GraphicalView view, User user, List<ViewComponentState> states, boolean edit, boolean add) {
if (viewComponent.isPointComponent() && (edit || viewComponent.isVisible())) {
PointComponent pointComponent = (PointComponent) viewComponent;
DataPointRT dataPointRT = null;
if (pointComponent.tgetDataPoint() != null)
dataPointRT = rtm.getDataPoint(pointComponent.tgetDataPoint().getId());
ViewComponentState state = preparePointComponentState(pointComponent, update, user, dataPointRT, model, request);
if (!edit) {
if (pointComponent.isSettable()) {
if (view.isEditor(user) || view.isSetter(user))
setChange(pointComponent.tgetDataPoint(), state, dataPointRT, request, model);
}
if (pointComponent.tgetDataPoint() != null)
setChart(pointComponent.tgetDataPoint(), state, request, model);
}
if (add)
states.add(state);
model.clear();
}
}
use of com.serotonin.m2m2.rt.RuntimeManager in project ma-core-public by infiniteautomation.
the class PublisherRT method initializePoints.
/**
* The {@link PublishedPointGroupInitializer} calls
* {@link RuntimeManager#startPublishedPoint(PublishedPointVO) startPublishedPoint()}
* which adds the points to the cache in the RTM and initializes them.
*/
private void initializePoints() {
ExecutorService executorService = Common.getBean(ExecutorService.class);
// Add the enabled points to the data source.
List<PublishedPointVO> points = publishedPointDao.getEnabledPublishedPoints(getId());
// Startup multi threaded
int pointsPerThread = Common.envProps.getInt("runtime.publishedPoint.startupThreads.pointsPerThread", 1000);
int startupThreads = Common.envProps.getInt("runtime.publishedPoint.startupThreads", Runtime.getRuntime().availableProcessors());
PublishedPointGroupInitializer pointInitializer = new PublishedPointGroupInitializer(executorService, startupThreads);
pointInitializer.initialize(points, pointsPerThread);
}
Aggregations