Example usage for org.apache.commons.collections IterableMap mapIterator

List of usage examples for org.apache.commons.collections IterableMap mapIterator

Introduction

In this page you can find the example usage for org.apache.commons.collections IterableMap mapIterator.

Prototype

MapIterator mapIterator();

Source Link

Document

Obtains a MapIterator over the map.

Usage

From source file:de.tum.in.python.bluetooth.milling.machine.BluetoothMillingMachine.java

/** {@inheritDoc} */
@Override//from  www  . j av a 2 s. c om
protected void doGet(final CloudletTopic reqTopic, final KuraRequestPayload reqPayload,
        final KuraResponsePayload respPayload) throws KuraException {
    LOGGER.info("Bluetooth Python Milling Machine Component GET handler");

    // Retrieve the configurations
    if ("configurations".equals(reqTopic.getResources()[0])) {
        LOGGER.info("Bluetooth Python Milling Machine Configuration Retrieval Started...");

        final ComponentConfiguration configuration = this.m_configurationService
                .getComponentConfiguration(APP_CONF_ID);

        final IterableMap map = (IterableMap) configuration.getConfigurationProperties();
        final MapIterator it = map.mapIterator();

        while (it.hasNext()) {
            final Object key = it.next();
            final Object value = it.getValue();

            respPayload.addMetric((String) key, value);
        }
        this.m_activityLogService.saveLog("Bluetooth Python Milling Machine Configuration Retrieved");

        respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_OK);

        LOGGER.info("Bluetooth Python Milling Machine Configuration Retrieval Finished");
    }
}

From source file:de.tum.in.bluetooth.milling.machine.BluetoothMillingMachine.java

/** {@inheritDoc} */
@Override/*from   w  w w.j  av  a  2s.  c  o m*/
protected void doGet(final CloudletTopic reqTopic, final KuraRequestPayload reqPayload,
        final KuraResponsePayload respPayload) throws KuraException {
    LOGGER.info("Bluetooth Milling Machine Component GET handler");

    // Retrieve the configurations
    if ("configurations".equals(reqTopic.getResources()[0])) {
        LOGGER.info("Bluetooth Milling Machine Configuration Retrieval Started...");

        final ComponentConfiguration configuration = this.m_configurationService
                .getComponentConfiguration(APP_CONF_ID);

        final IterableMap map = (IterableMap) configuration.getConfigurationProperties();
        final MapIterator it = map.mapIterator();

        while (it.hasNext()) {
            final Object key = it.next();
            final Object value = it.getValue();

            respPayload.addMetric((String) key, value);
        }
        this.m_activityLogService.saveLog("Bluetooth Milling Machine Configuration Retrieved");

        respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_OK);

        LOGGER.info("Bluetooth Milling Machine Configuration Retrieval Finished");
    }
}

From source file:de.tum.in.opcua.client.OpcUaClient.java

/** {@inheritDoc}} */
@Override/*w ww.j av  a  2 s.  c om*/
protected void doGet(final CloudletTopic reqTopic, final KuraRequestPayload reqPayload,
        final KuraResponsePayload respPayload) throws KuraException {
    LOGGER.info("OPC-UA Configuration Retrieving...");
    // Retrieve the configurations
    if ("configurations".equals(reqTopic.getResources()[0])) {
        final ComponentConfiguration configuration = this.m_configurationService
                .getComponentConfiguration(APP_ID);

        final IterableMap map = new HashedMap(configuration.getConfigurationProperties());
        final MapIterator it = map.mapIterator();

        while (it.hasNext()) {
            final Object key = it.next();
            final Object value = it.getValue();

            respPayload.addMetric((String) key, value);
        }
        this.m_activityLogService.saveLog("OPC-UA Configuration Retrieved");

        respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_OK);
    }

    if ("list".equals(reqTopic.getResources()[0])) {
        final KuraPayload payload = new KuraPayload();
        this.m_opcuaClientActions.stream().map(opcClientAction -> opcClientAction.name())
                .forEach(opcClientActionName -> payload.addMetric("action", opcClientActionName));
    }

    LOGGER.info("OPC-UA Configuration Retrieved");
}

From source file:de.tum.in.socket.client.SocketClient.java

/** {@inheritDoc}} */
@Override//from w  ww.j ava2s .  co m
protected void doGet(final CloudletTopic reqTopic, final KuraRequestPayload reqPayload,
        final KuraResponsePayload respPayload) throws KuraException {
    LOGGER.info("Socket Client Configuration Retrieving...");
    // Retrieve the configurations
    if ("configurations".equals(reqTopic.getResources()[0])) {
        final ComponentConfiguration configuration = this.m_configurationService
                .getComponentConfiguration(APP_ID);

        final IterableMap map = new HashedMap(configuration.getConfigurationProperties());
        final MapIterator it = map.mapIterator();

        while (it.hasNext()) {
            final Object key = it.next();
            final Object value = it.getValue();

            respPayload.addMetric((String) key, value);
        }
        this.m_activityLogService.saveLog("Socket Client Configuration Retrieved");

        respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_OK);
    }

    LOGGER.info("Socket Client Configuration Retrieved");
}

From source file:de.tum.in.bluetooth.discovery.BluetoothDeviceDiscovery.java

/** {@inheritDoc} */
@Override//from   w ww . ja  v  a  2 s  .  c  o m
protected void doGet(final CloudletTopic reqTopic, final KuraRequestPayload reqPayload,
        final KuraResponsePayload respPayload) throws KuraException {
    LOGGER.info("Bluetooth Configuration Retrieving...");
    // Retrieve the configurations
    if ("configurations".equals(reqTopic.getResources()[0])) {
        final ComponentConfiguration configuration = this.m_configurationService
                .getComponentConfiguration(APP_CONF_ID);

        final IterableMap map = new HashedMap(configuration.getConfigurationProperties());
        final MapIterator it = map.mapIterator();

        while (it.hasNext()) {
            final Object key = it.next();
            final Object value = it.getValue();

            respPayload.addMetric((String) key, value);
        }
        this.m_activityLogService.saveLog("Bluetooth Configuration Retrieved");

        respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_OK);
    }

    LOGGER.info("Bluetooth Configuration Retrieved");
}