Search in sources :

Example 1 with KuraRequestMessage

use of org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestMessage in project kapua by eclipse.

the class TranslatorAppCommandKapuaKura method translate.

@Override
public KuraRequestMessage translate(CommandRequestMessage kapuaMessage) throws KapuaException {
    // 
    // Kura channel
    KapuaLocator locator = KapuaLocator.getInstance();
    AccountService accountService = locator.getService(AccountService.class);
    Account account = accountService.find(kapuaMessage.getScopeId());
    DeviceRegistryService deviceService = locator.getService(DeviceRegistryService.class);
    Device device = deviceService.find(kapuaMessage.getScopeId(), kapuaMessage.getDeviceId());
    KuraRequestChannel kuraRequestChannel = translate(kapuaMessage.getChannel());
    kuraRequestChannel.setScope(account.getName());
    kuraRequestChannel.setClientId(device.getClientId());
    // 
    // Kura payload
    KuraRequestPayload kuraPayload = translate(kapuaMessage.getPayload());
    // return Kura Message
    return new KuraRequestMessage(kuraRequestChannel, kapuaMessage.getReceivedOn(), kuraPayload);
}
Also used : KapuaLocator(org.eclipse.kapua.locator.KapuaLocator) Account(org.eclipse.kapua.service.account.Account) Device(org.eclipse.kapua.service.device.registry.Device) KuraRequestMessage(org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestMessage) DeviceRegistryService(org.eclipse.kapua.service.device.registry.DeviceRegistryService) KuraRequestChannel(org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestChannel) AccountService(org.eclipse.kapua.service.account.AccountService) KuraRequestPayload(org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestPayload)

Example 2 with KuraRequestMessage

use of org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestMessage in project kapua by eclipse.

the class TranslatorAppBundleKapuaKura method translate.

@Override
public KuraRequestMessage translate(BundleRequestMessage kapuaMessage) throws KapuaException {
    // 
    // Kura channel
    KapuaLocator locator = KapuaLocator.getInstance();
    AccountService accountService = locator.getService(AccountService.class);
    Account account = accountService.find(kapuaMessage.getScopeId());
    DeviceRegistryService deviceService = locator.getService(DeviceRegistryService.class);
    Device device = deviceService.find(kapuaMessage.getScopeId(), kapuaMessage.getDeviceId());
    KuraRequestChannel kuraRequestChannel = translate(kapuaMessage.getChannel());
    kuraRequestChannel.setScope(account.getName());
    kuraRequestChannel.setClientId(device.getClientId());
    // 
    // Kura payload
    KuraRequestPayload kuraPayload = translate(kapuaMessage.getPayload());
    // Return Kura Message
    return new KuraRequestMessage(kuraRequestChannel, kapuaMessage.getReceivedOn(), kuraPayload);
}
Also used : KapuaLocator(org.eclipse.kapua.locator.KapuaLocator) Account(org.eclipse.kapua.service.account.Account) Device(org.eclipse.kapua.service.device.registry.Device) KuraRequestMessage(org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestMessage) DeviceRegistryService(org.eclipse.kapua.service.device.registry.DeviceRegistryService) KuraRequestChannel(org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestChannel) AccountService(org.eclipse.kapua.service.account.AccountService) KuraRequestPayload(org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestPayload)

Example 3 with KuraRequestMessage

use of org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestMessage in project kapua by eclipse.

the class TranslatorAppConfigurationKapuaKura method translate.

@Override
public KuraRequestMessage translate(ConfigurationRequestMessage kapuaMessage) throws KapuaException {
    // 
    // Kura channel
    KapuaLocator locator = KapuaLocator.getInstance();
    AccountService accountService = locator.getService(AccountService.class);
    Account account = accountService.find(kapuaMessage.getScopeId());
    DeviceRegistryService deviceService = locator.getService(DeviceRegistryService.class);
    Device device = deviceService.find(kapuaMessage.getScopeId(), kapuaMessage.getDeviceId());
    KuraRequestChannel kuraRequestChannel = translate(kapuaMessage.getChannel());
    kuraRequestChannel.setScope(account.getName());
    kuraRequestChannel.setClientId(device.getClientId());
    // 
    // Kura payload
    KuraRequestPayload kuraPayload = translate(kapuaMessage.getPayload());
    // Return Kura Message
    return new KuraRequestMessage(kuraRequestChannel, kapuaMessage.getReceivedOn(), kuraPayload);
}
Also used : KapuaLocator(org.eclipse.kapua.locator.KapuaLocator) Account(org.eclipse.kapua.service.account.Account) Device(org.eclipse.kapua.service.device.registry.Device) KuraRequestMessage(org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestMessage) DeviceRegistryService(org.eclipse.kapua.service.device.registry.DeviceRegistryService) KuraRequestChannel(org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestChannel) AccountService(org.eclipse.kapua.service.account.AccountService) KuraRequestPayload(org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestPayload)

Example 4 with KuraRequestMessage

use of org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestMessage in project kapua by eclipse.

the class TranslatorAppPackageKapuaKura method translate.

@Override
public KuraRequestMessage translate(PackageRequestMessage kapuaMessage) throws KapuaException {
    // 
    // Kura channel
    KapuaLocator locator = KapuaLocator.getInstance();
    AccountService accountService = locator.getService(AccountService.class);
    Account account = accountService.find(kapuaMessage.getScopeId());
    DeviceRegistryService deviceService = locator.getService(DeviceRegistryService.class);
    Device device = deviceService.find(kapuaMessage.getScopeId(), kapuaMessage.getDeviceId());
    KuraRequestChannel kuraRequestChannel = translate(kapuaMessage.getChannel());
    kuraRequestChannel.setScope(account.getName());
    kuraRequestChannel.setClientId(device.getClientId());
    // 
    // Kura payload
    KuraRequestPayload kuraPayload = translate(kapuaMessage.getPayload());
    // Return Kura Message
    return new KuraRequestMessage(kuraRequestChannel, kapuaMessage.getReceivedOn(), kuraPayload);
}
Also used : KapuaLocator(org.eclipse.kapua.locator.KapuaLocator) Account(org.eclipse.kapua.service.account.Account) Device(org.eclipse.kapua.service.device.registry.Device) KuraRequestMessage(org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestMessage) DeviceRegistryService(org.eclipse.kapua.service.device.registry.DeviceRegistryService) KuraRequestChannel(org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestChannel) AccountService(org.eclipse.kapua.service.account.AccountService) KuraRequestPayload(org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestPayload)

Example 5 with KuraRequestMessage

use of org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestMessage in project kapua by eclipse.

the class TranslatorAppSnapshotKapuaKura method translate.

@Override
public KuraRequestMessage translate(SnapshotRequestMessage kapuaMessage) throws KapuaException {
    // 
    // Kura channel
    KapuaLocator locator = KapuaLocator.getInstance();
    AccountService accountService = locator.getService(AccountService.class);
    Account account = accountService.find(kapuaMessage.getScopeId());
    DeviceRegistryService deviceService = locator.getService(DeviceRegistryService.class);
    Device device = deviceService.find(kapuaMessage.getScopeId(), kapuaMessage.getDeviceId());
    KuraRequestChannel kuraRequestChannel = translate(kapuaMessage.getChannel());
    kuraRequestChannel.setScope(account.getName());
    kuraRequestChannel.setClientId(device.getClientId());
    // 
    // Kura payload
    KuraRequestPayload kuraPayload = translate(kapuaMessage.getPayload());
    // Return Kura Message
    return new KuraRequestMessage(kuraRequestChannel, kapuaMessage.getReceivedOn(), kuraPayload);
}
Also used : KapuaLocator(org.eclipse.kapua.locator.KapuaLocator) Account(org.eclipse.kapua.service.account.Account) Device(org.eclipse.kapua.service.device.registry.Device) KuraRequestMessage(org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestMessage) DeviceRegistryService(org.eclipse.kapua.service.device.registry.DeviceRegistryService) KuraRequestChannel(org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestChannel) AccountService(org.eclipse.kapua.service.account.AccountService) KuraRequestPayload(org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestPayload)

Aggregations

KapuaLocator (org.eclipse.kapua.locator.KapuaLocator)6 KuraRequestChannel (org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestChannel)6 KuraRequestMessage (org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestMessage)6 KuraRequestPayload (org.eclipse.kapua.service.device.call.message.app.request.kura.KuraRequestPayload)6 Account (org.eclipse.kapua.service.account.Account)5 AccountService (org.eclipse.kapua.service.account.AccountService)5 Device (org.eclipse.kapua.service.device.registry.Device)5 DeviceRegistryService (org.eclipse.kapua.service.device.registry.DeviceRegistryService)5 Date (java.util.Date)1 DeviceCall (org.eclipse.kapua.service.device.call.DeviceCall)1 DeviceCallFactory (org.eclipse.kapua.service.device.call.DeviceCallFactory)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1