Search in sources :

Example 26 with BounceProxyRecord

use of io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord in project joynr by bmwcarit.

the class BounceProxyDatabase method getAssignableBounceProxies.

@Override
public List<BounceProxyRecord> getAssignableBounceProxies() {
    logger.trace("getAssignableBounceProxies()");
    List<BounceProxyRecord> bounceProxyList = new LinkedList<BounceProxyRecord>();
    for (BounceProxyEntity entity : getBounceProxyEntityList(getSqlWhereClauseForAssignableBounceProxies())) {
        bounceProxyList.add(entity.convertToBounceProxyRecord());
    }
    logger.debug("found {} assignable bounce proxies", bounceProxyList.size());
    return bounceProxyList;
}
Also used : BounceProxyEntity(io.joynr.messaging.bounceproxy.controller.directory.jdbc.entities.BounceProxyEntity) BounceProxyRecord(io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord) LinkedList(java.util.LinkedList)

Example 27 with BounceProxyRecord

use of io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord in project joynr by bmwcarit.

the class BounceProxyEhcacheAdapter method getAssignableBounceProxies.

@Override
public List<BounceProxyRecord> getAssignableBounceProxies() {
    if (log.isTraceEnabled()) {
        log.trace("Retrieving assignable bounce proxies from cache {}", cacheName);
        tracePeers();
    }
    List<BounceProxyRecord> result = new LinkedList<BounceProxyRecord>();
    Cache cache = manager.getCache(cacheName);
    @SuppressWarnings("rawtypes") List keys = cache.getKeys();
    Map<Object, Element> elements = cache.getAll(keys);
    for (Element element : elements.values()) {
        BounceProxyRecord bounceProxyRecord = getBounceProxyRecordFromElement(element);
        if (bounceProxyRecord.getStatus().isAssignable()) {
            result.add(bounceProxyRecord);
        }
    }
    return result;
}
Also used : BounceProxyRecord(io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord) Element(net.sf.ehcache.Element) List(java.util.List) LinkedList(java.util.LinkedList) LinkedList(java.util.LinkedList) Cache(net.sf.ehcache.Cache)

Example 28 with BounceProxyRecord

use of io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord in project joynr by bmwcarit.

the class BounceProxyEhcacheAdapter method addBounceProxy.

@Override
public void addBounceProxy(ControlledBounceProxyInformation bpInfo) throws IllegalArgumentException {
    if (log.isTraceEnabled()) {
        log.trace("addBounceProxy {} to cache {}", bpInfo.getId(), cacheName);
        tracePeers();
    }
    Cache cache = manager.getCache(cacheName);
    Element element = new Element(bpInfo.getId(), new BounceProxyRecord(bpInfo));
    cache.put(element);
}
Also used : BounceProxyRecord(io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord) Element(net.sf.ehcache.Element) Cache(net.sf.ehcache.Cache)

Example 29 with BounceProxyRecord

use of io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord in project joynr by bmwcarit.

the class MonitoringServiceImpl method updateStatus.

@Override
public void updateStatus(String bpId, BounceProxyStatus status) {
    BounceProxyRecord bounceProxyRecord = bounceProxyDirectory.getBounceProxy(bpId);
    bounceProxyRecord.setStatus(status);
    bounceProxyDirectory.updateBounceProxy(bounceProxyRecord);
}
Also used : BounceProxyRecord(io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord)

Example 30 with BounceProxyRecord

use of io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord in project joynr by bmwcarit.

the class MonitoringServiceImpl method update.

@Override
public void update(String bpId, String urlForCc, String urlForBpc) {
    BounceProxyRecord bounceProxyRecord = bounceProxyDirectory.getBounceProxy(bpId);
    bounceProxyRecord.getInfo().setLocation(URI.create(urlForCc));
    bounceProxyRecord.getInfo().setLocationForBpc(URI.create(urlForBpc));
    bounceProxyRecord.setStatus(BounceProxyStatus.ALIVE);
    bounceProxyDirectory.updateBounceProxy(bounceProxyRecord);
}
Also used : BounceProxyRecord(io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord)

Aggregations

BounceProxyRecord (io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord)30 ControlledBounceProxyInformation (io.joynr.messaging.info.ControlledBounceProxyInformation)17 Test (org.junit.Test)16 LinkedList (java.util.LinkedList)6 BounceProxyInformation (io.joynr.messaging.info.BounceProxyInformation)4 BounceProxyStatusInformation (io.joynr.messaging.info.BounceProxyStatusInformation)4 Cache (net.sf.ehcache.Cache)3 Element (net.sf.ehcache.Element)3 BounceProxyEntity (io.joynr.messaging.bounceproxy.controller.directory.jdbc.entities.BounceProxyEntity)2 BounceProxyStatus (io.joynr.messaging.info.BounceProxyStatus)2 Channel (io.joynr.messaging.info.Channel)1 PerformanceMeasures (io.joynr.messaging.info.PerformanceMeasures)1 List (java.util.List)1 EntityManager (javax.persistence.EntityManager)1 EntityTransaction (javax.persistence.EntityTransaction)1