Search in sources :

Example 1 with RuntimeManager

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;
}
Also used : DataPointRT(com.serotonin.m2m2.rt.dataImage.DataPointRT) PointValueTime(com.serotonin.m2m2.rt.dataImage.PointValueTime) ImageValue(com.serotonin.m2m2.rt.dataImage.types.ImageValue)

Example 2 with RuntimeManager

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();
}
Also used : DataPointGroupInitializer(com.serotonin.m2m2.rt.DataPointGroupInitializer) DataPointDao(com.serotonin.m2m2.db.dao.DataPointDao) ExecutorService(java.util.concurrent.ExecutorService) PointValueCache(com.infiniteautomation.mango.pointvaluecache.PointValueCache) DataPointWithEventDetectors(com.serotonin.m2m2.vo.dataPoint.DataPointWithEventDetectors)

Example 3 with RuntimeManager

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();
    }
}
Also used : PointComponent(com.serotonin.m2m2.gviews.component.PointComponent) SimplePointComponent(com.serotonin.m2m2.gviews.component.SimplePointComponent) DataPointRT(com.serotonin.m2m2.rt.dataImage.DataPointRT)

Example 4 with RuntimeManager

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);
}
Also used : ExecutorService(java.util.concurrent.ExecutorService) PublishedPointGroupInitializer(com.serotonin.m2m2.rt.PublishedPointGroupInitializer) PublishedPointVO(com.serotonin.m2m2.vo.publish.PublishedPointVO)

Aggregations

DataPointRT (com.serotonin.m2m2.rt.dataImage.DataPointRT)2 ExecutorService (java.util.concurrent.ExecutorService)2 PointValueCache (com.infiniteautomation.mango.pointvaluecache.PointValueCache)1 DataPointDao (com.serotonin.m2m2.db.dao.DataPointDao)1 PointComponent (com.serotonin.m2m2.gviews.component.PointComponent)1 SimplePointComponent (com.serotonin.m2m2.gviews.component.SimplePointComponent)1 DataPointGroupInitializer (com.serotonin.m2m2.rt.DataPointGroupInitializer)1 PublishedPointGroupInitializer (com.serotonin.m2m2.rt.PublishedPointGroupInitializer)1 PointValueTime (com.serotonin.m2m2.rt.dataImage.PointValueTime)1 ImageValue (com.serotonin.m2m2.rt.dataImage.types.ImageValue)1 DataPointWithEventDetectors (com.serotonin.m2m2.vo.dataPoint.DataPointWithEventDetectors)1 PublishedPointVO (com.serotonin.m2m2.vo.publish.PublishedPointVO)1