Class ArrowheadService


  • @Component("ArrowheadService")
    public class ArrowheadService
    extends Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void closeMQTTBroker​(org.eclipse.paho.client.mqttv3.MqttClient client)
      Close connection and release resources
      boolean closeWSConnection​(String wsManagerId)
      Close the WS(S) connection by the given WebSocketConnectionManager ID if any.
      org.eclipse.paho.client.mqttv3.MqttClient connectMQTTBroker​(org.eclipse.paho.client.mqttv3.MqttCallback handler, String brokerAddress, String mqttBrokerUsername, String mqttBrokerPassword, int port, String clientId)
      Connect to MQTT broker.
      String connnectServiceWS​(org.springframework.web.socket.WebSocketHandler handler, String address, int port, String serviceUri, String token, String... queryParams)
      Make WS(S) connection with the specified service reachability details.
      <T> T consumeServiceHTTP​(Class<T> responseType, org.springframework.http.HttpMethod httpMethod, String address, int port, String serviceUri, String interfaceName, String token, Object payload, String... queryParams)
      Sends a http(s) request with the specified service reachability details.
      <T> T consumeServiceHTTP​(Class<T> responseType, org.springframework.http.HttpMethod httpMethod, org.springframework.web.util.UriComponents uriComponents, String token, Object payload)
      Sends a http(s) request with the specified service reachability details.
      void disconnectMQTTBroker​(org.eclipse.paho.client.mqttv3.MqttClient client)
      Disconnect from MQTT broker
      boolean echoCoreSystem​(eu.arrowhead.common.core.CoreSystem coreSystem)
      Sends a http(s) request to the 'echo' end point of the given Arrowhead Core System.
      eu.arrowhead.common.dto.shared.ServiceRegistryResponseDTO forceRegisterServiceToServiceRegistry​(eu.arrowhead.common.dto.shared.ServiceRegistryRequestDTO request)
      Sends a http(s) 'register' request to Service Registry Core System.
      eu.arrowhead.common.dto.shared.SystemResponseDTO forceRegisterSystemToServiceRegistry​(eu.arrowhead.common.dto.shared.SystemRequestDTO request)
      Sends a http(s) 'register-system' request to Service Registry Core System.
      eu.arrowhead.common.dto.shared.SystemRegistryResponseDTO forceRegisterSystemToSystemRegistry​(eu.arrowhead.common.dto.shared.SystemRegistryRequestDTO request)
      Sends a http(s) 'system-register' request to System Registry Core System.
      CoreServiceUri getCoreServiceUri​(eu.arrowhead.common.core.CoreSystemService coreSystemService)  
      PrivateKey getMyPrivateKey()  
      PublicKey getMyPublicKey()  
      eu.arrowhead.common.dto.shared.OrchestrationFormRequestDTO.Builder getOrchestrationFormBuilder()  
      String getServerCN()
      Get the serverCN from arrowheadContext
      eu.arrowhead.common.dto.shared.DeviceRegistryOnboardingWithCsrResponseDTO onboardDeviceWithCSR​(eu.arrowhead.common.dto.shared.DeviceRegistryOnboardingWithCsrRequestDTO request)
      Sends a http(s) 'device-onboarding-with-csr' request to Device Registry Core System.
      eu.arrowhead.common.dto.shared.DeviceRegistryOnboardingWithNameResponseDTO onboardDeviceWithName​(eu.arrowhead.common.dto.shared.DeviceRegistryOnboardingWithNameRequestDTO request)
      Sends a http(s) 'device-onboarding-with-name' request to Device Registry Core System.
      eu.arrowhead.common.dto.shared.SystemRegistryOnboardingWithCsrRequestDTO onboardSystemWithCSR​(eu.arrowhead.common.dto.shared.SystemRegistryOnboardingWithCsrRequestDTO request)
      Sends a http(s) 'system-onboarding-with-csr' request to System Registry Core System.
      eu.arrowhead.common.dto.shared.SystemRegistryOnboardingWithNameResponseDTO onboardSystemWithName​(eu.arrowhead.common.dto.shared.SystemRegistryOnboardingWithNameRequestDTO request)
      Sends a http(s) 'system-onboarding-with-name' request to System Registry Core System.
      eu.arrowhead.common.dto.shared.OrchestrationResponseDTO proceedOrchestration​(eu.arrowhead.common.dto.shared.OrchestrationFormRequestDTO request)
      Sends a http(s) 'orchestration' request to Orchestrator Core System.
      void publishToEventHandler​(eu.arrowhead.common.dto.shared.EventPublishRequestDTO request)
      Sends a http(s) 'publish' request to Event Handler Core System.
      PublicKey queryAuthorizationPublicKey()
      Queries its public key from Authorization Core System.
      eu.arrowhead.common.dto.shared.OrchestrationResponseDTO queryOrchestrationStore​(long systemId)
      Sends a http(s) 'orchestration/{systemId}' request to Orchestrator Core System.
      eu.arrowhead.common.dto.shared.DeviceRegistryResponseDTO registerDeviceToDeviceRegistry​(eu.arrowhead.common.dto.shared.DeviceRegistryRequestDTO request)
      Sends a http(s) 'device-register' request to Device Registry Core System.
      eu.arrowhead.common.dto.shared.ServiceRegistryResponseDTO registerServiceToServiceRegistry​(eu.arrowhead.common.dto.shared.ServiceRegistryRequestDTO request)
      Sends a http(s) 'register' request to Service Registry Core System.
      eu.arrowhead.common.dto.shared.SystemResponseDTO registerSystemToServiceRegistry​(eu.arrowhead.common.dto.shared.SystemRequestDTO request)
      Sends a http(s) 'register-system' request to Service Registry Core System.
      eu.arrowhead.common.dto.shared.SystemRegistryResponseDTO registerSystemToSystemRegistry​(eu.arrowhead.common.dto.shared.SystemRegistryRequestDTO request)
      Sends a http(s) 'system-register' request to System Registry Core System.
      void subscribeToEventHandler​(eu.arrowhead.common.dto.shared.SubscriptionRequestDTO request)
      Sends a http(s) 'subscription' request to Event Handler Core System.
      boolean unregisterDeviceFromDeviceRegistry​(String deviceName, String macAdders)
      Sends a http(s) 'device-unregister' request to Device Registry Core System.
      void unregisterServiceFromServiceRegistry​(String serviceDefinition, String serviceUri)
      Sends a http(s) 'unregister' request to Service Registry Core System.
      void unregisterSystemFromServiceRegistry()
      Sends a http(s) 'unregister-system' request to Service Registry Core System.
      boolean unregisterSystemFromSystemRegistry()
      Sends a http(s) 'system-unregister' request to System Registry Core System.
      void unsubscribeFromEventHandler​(String eventType, String subscriberName, String subscriberAddress, int subscriberPort)
      Sends a http(s) 'unsubscription' request to Event Handler Core System.
      void updateCoreServiceURIs​(eu.arrowhead.common.core.CoreSystem coreSystem)
      Queries and stores the public service URIs of the given Arrowhead Core System in the ArrowheadContext component.
    • Constructor Detail

      • ArrowheadService

        public ArrowheadService()
    • Method Detail

      • getCoreServiceUri

        public CoreServiceUri getCoreServiceUri​(eu.arrowhead.common.core.CoreSystemService coreSystemService)
        Parameters:
        coreSystemService - CoreSystemService enum which represents an Arrowhead Core System Service
        Returns:
        the URI details of the Arrowhead Core System or null when the specified coreSystemService is not a public one or ArrowhedContext component not contains the the given core service.
      • updateCoreServiceURIs

        public void updateCoreServiceURIs​(eu.arrowhead.common.core.CoreSystem coreSystem)
        Queries and stores the public service URIs of the given Arrowhead Core System in the ArrowheadContext component. If the specified Core System has no public service or the server is not available, then ArrowheadContext won't contain the core service and a log info message will be triggered.
        Parameters:
        coreSystem - CoreSystem enum which represents an Arrowhead Core System
      • echoCoreSystem

        public boolean echoCoreSystem​(eu.arrowhead.common.core.CoreSystem coreSystem)
        Sends a http(s) request to the 'echo' end point of the given Arrowhead Core System.
        Parameters:
        coreSystem - CoreSystem enum which represents an Arrowhead Core System
        Returns:
        true if answer received from core system server and false if not or the specified core system has no public service or it is not known by Service Registry Core System
      • registerServiceToServiceRegistry

        public eu.arrowhead.common.dto.shared.ServiceRegistryResponseDTO registerServiceToServiceRegistry​(eu.arrowhead.common.dto.shared.ServiceRegistryRequestDTO request)
        Sends a http(s) 'register' request to Service Registry Core System.
        Parameters:
        request - ServiceRegistryRequestDTO which represents the required payload of the http(s) request
        Returns:
        the ServiceRegistryResponseDTO received from Service Registry Core System
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by Service Registry Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by Service Registry Core System
        eu.arrowhead.common.exception.InvalidParameterException - when the payload content couldn't be validated by Service Registry Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at Service Registry Core System
        eu.arrowhead.common.exception.UnavailableServerException - when Service Registry Core System is not available
      • forceRegisterServiceToServiceRegistry

        public eu.arrowhead.common.dto.shared.ServiceRegistryResponseDTO forceRegisterServiceToServiceRegistry​(eu.arrowhead.common.dto.shared.ServiceRegistryRequestDTO request)
        Sends a http(s) 'register' request to Service Registry Core System. In the case of service already registered, then the old service registry entry will be overwritten.
        Parameters:
        request - ServiceRegistryRequestDTO which represents the required payload of the http(s) request
        Returns:
        the ServiceRegistryResponseDTO received from Service Registry Core System
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by Service Registry Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by Service Registry Core System
        eu.arrowhead.common.exception.InvalidParameterException - when the payload content couldn't be validated by Service Registry Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at Service Registry Core System
        eu.arrowhead.common.exception.UnavailableServerException - when Service Registry Core System is not available
      • unregisterServiceFromServiceRegistry

        public void unregisterServiceFromServiceRegistry​(String serviceDefinition,
                                                         String serviceUri)
        Sends a http(s) 'unregister' request to Service Registry Core System.
        Parameters:
        serviceDefinition - String value which represents the service being deleted from service registry
        serviceUri - String value which represents the service URI (path after the hostname and port) of the service being deleted from service registry
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by Service Registry Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by Service Registry Core System
        eu.arrowhead.common.exception.InvalidParameterException - when the payload content couldn't be validated by Service Registry Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at Service Registry Core System
        eu.arrowhead.common.exception.UnavailableServerException - when Service Registry Core System is not available
      • registerSystemToServiceRegistry

        public eu.arrowhead.common.dto.shared.SystemResponseDTO registerSystemToServiceRegistry​(eu.arrowhead.common.dto.shared.SystemRequestDTO request)
        Sends a http(s) 'register-system' request to Service Registry Core System.
        Parameters:
        request - SystemRequestDTO which represents the required payload of the http(s) request
        Returns:
        the SystemResponseDTO received from Service Registry Core System
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by Service Registry Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by Service Registry Core System
        eu.arrowhead.common.exception.InvalidParameterException - when the payload content couldn't be validated by Service Registry Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at Service Registry Core System
        eu.arrowhead.common.exception.UnavailableServerException - when Service Registry Core System is not available
      • forceRegisterSystemToServiceRegistry

        public eu.arrowhead.common.dto.shared.SystemResponseDTO forceRegisterSystemToServiceRegistry​(eu.arrowhead.common.dto.shared.SystemRequestDTO request)
        Sends a http(s) 'register-system' request to Service Registry Core System. In the case of service already registered, then the old service registry entry will be overwritten.
        Parameters:
        request - SystemRequestDTO which represents the required payload of the http(s) request
        Returns:
        the SystemResponseDTO received from Service Registry Core System
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by Service Registry Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by Service Registry Core System
        eu.arrowhead.common.exception.InvalidParameterException - when the payload content couldn't be validated by Service Registry Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at Service Registry Core System
        eu.arrowhead.common.exception.UnavailableServerException - when Service Registry Core System is not available
      • unregisterSystemFromServiceRegistry

        public void unregisterSystemFromServiceRegistry()
        Sends a http(s) 'unregister-system' request to Service Registry Core System.
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by Service Registry Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by Service Registry Core System
        eu.arrowhead.common.exception.InvalidParameterException - when the payload content couldn't be validated by Service Registry Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at Service Registry Core System
        eu.arrowhead.common.exception.UnavailableServerException - when Service Registry Core System is not available
      • queryAuthorizationPublicKey

        public PublicKey queryAuthorizationPublicKey()
        Queries its public key from Authorization Core System.
        Returns:
        the public key of Authorization Core System or null when the public key core service URI is not known by ArrowheadContext component.
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by Authorization Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at Authorization Core System
        eu.arrowhead.common.exception.UnavailableServerException - when Authorization Core System is not available
      • proceedOrchestration

        public eu.arrowhead.common.dto.shared.OrchestrationResponseDTO proceedOrchestration​(eu.arrowhead.common.dto.shared.OrchestrationFormRequestDTO request)
        Sends a http(s) 'orchestration' request to Orchestrator Core System.
        Parameters:
        request - OrchestrationFormRequestDTO which represents the required payload of the http(s) request
        Returns:
        the OrchestrationResponseDTO received from Orchestrator Core System or null when the orchestration service URI is not known by Arrowhead Context
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by Orchestrator Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by Orchestrator Core System
        eu.arrowhead.common.exception.InvalidParameterException - when the payload content couldn't be validated by Orchestrator Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at one of the core system involved in orchestration process
        eu.arrowhead.common.exception.UnavailableServerException - when one of the core system involved in orchestration process is not available
      • queryOrchestrationStore

        public eu.arrowhead.common.dto.shared.OrchestrationResponseDTO queryOrchestrationStore​(long systemId)
        Sends a http(s) 'orchestration/{systemId}' request to Orchestrator Core System.
        Parameters:
        systemId - long value which represents the required system id path variable
        Returns:
        the OrchestrationResponseDTO with all top priority provider from Orchestration Store or null when the orchestration service URI is not known by Arrowhead Context
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by Orchestrator Core System
        eu.arrowhead.common.exception.BadPayloadException - when the systemId couldn't be validated by Orchestrator Core System
        eu.arrowhead.common.exception.InvalidParameterException - when the system is not found by Service Registry Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at one of the core system involved in orchestration process
        eu.arrowhead.common.exception.UnavailableServerException - when one of the core system involved in orchestration process is not available
      • registerSystemToSystemRegistry

        public eu.arrowhead.common.dto.shared.SystemRegistryResponseDTO registerSystemToSystemRegistry​(eu.arrowhead.common.dto.shared.SystemRegistryRequestDTO request)
        Sends a http(s) 'system-register' request to System Registry Core System.
        Parameters:
        request - SystemRegistryRequestDTO which represents the required payload of the http(s) request
        Returns:
        the SystemRegistryResponseDTO received from System Registry Core System
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by System Registry Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by System Registry Core System
        eu.arrowhead.common.exception.InvalidParameterException - when the payload content couldn't be validated by System Registry Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at System Registry Core System
        eu.arrowhead.common.exception.UnavailableServerException - when System Registry Core System is not available
      • forceRegisterSystemToSystemRegistry

        public eu.arrowhead.common.dto.shared.SystemRegistryResponseDTO forceRegisterSystemToSystemRegistry​(eu.arrowhead.common.dto.shared.SystemRegistryRequestDTO request)
        Sends a http(s) 'system-register' request to System Registry Core System. In the case of system is already registered, then the old system registry entry will be overwritten.
        Parameters:
        request - SystemRegistryRequestDTO which represents the required payload of the http(s) request
        Returns:
        the SystemRegistryResponseDTO received from System Registry Core System
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by System Registry Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by System Registry Core System
        eu.arrowhead.common.exception.InvalidParameterException - when the payload content couldn't be validated by System Registry Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at System Registry Core System
        eu.arrowhead.common.exception.UnavailableServerException - when System Registry Core System is not available
      • unregisterSystemFromSystemRegistry

        public boolean unregisterSystemFromSystemRegistry()
        Sends a http(s) 'system-unregister' request to System Registry Core System.
        Returns:
        true if successfully deregistered or false if the service is not known by Arrowhead Context
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by System Registry Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by System Registry Core System
        eu.arrowhead.common.exception.InvalidParameterException - when the payload content couldn't be validated by System Registry Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at System Registry Core System
        eu.arrowhead.common.exception.UnavailableServerException - when System Registry Core System is not available
      • onboardSystemWithName

        public eu.arrowhead.common.dto.shared.SystemRegistryOnboardingWithNameResponseDTO onboardSystemWithName​(eu.arrowhead.common.dto.shared.SystemRegistryOnboardingWithNameRequestDTO request)
        Sends a http(s) 'system-onboarding-with-name' request to System Registry Core System.
        Parameters:
        request - SystemRegistryOnboardingWithNameRequestDTO which represents the required payload of the http(s) request
        Returns:
        the DeviceRegistryOnboardingWithNameResponseDTO received from System Registry Core System
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by System Registry Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by System Registry Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at System Registry Core System
        eu.arrowhead.common.exception.UnavailableServerException - when System Registry Core System is not available
      • onboardSystemWithCSR

        public eu.arrowhead.common.dto.shared.SystemRegistryOnboardingWithCsrRequestDTO onboardSystemWithCSR​(eu.arrowhead.common.dto.shared.SystemRegistryOnboardingWithCsrRequestDTO request)
        Sends a http(s) 'system-onboarding-with-csr' request to System Registry Core System.
        Parameters:
        request - SystemRegistryOnboardingWithCsrRequestDTO which represents the required payload of the http(s) request
        Returns:
        the SystemRegistryOnboardingWithCsrRequestDTO received from System Registry Core System
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by System Registry Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by System Registry Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at System Registry Core System
        eu.arrowhead.common.exception.UnavailableServerException - when System Registry Core System is not available
      • registerDeviceToDeviceRegistry

        public eu.arrowhead.common.dto.shared.DeviceRegistryResponseDTO registerDeviceToDeviceRegistry​(eu.arrowhead.common.dto.shared.DeviceRegistryRequestDTO request)
        Sends a http(s) 'device-register' request to Device Registry Core System.
        Parameters:
        request - DeviceRegistryRequestDTO which represents the required payload of the http(s) request
        Returns:
        the DeviceRegistryResponseDTO received from Device Registry Core System
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by Device Registry Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by Device Registry Core System
        eu.arrowhead.common.exception.InvalidParameterException - when the payload content couldn't be validated by Device Registry Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at Device Registry Core System
        eu.arrowhead.common.exception.UnavailableServerException - when Device Registry Core System is not available
      • unregisterDeviceFromDeviceRegistry

        public boolean unregisterDeviceFromDeviceRegistry​(String deviceName,
                                                          String macAdders)
        Sends a http(s) 'device-unregister' request to Device Registry Core System.
        Returns:
        true if successfully deregistered or false if the service is not known by Arrowhead Context
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by Device Registry Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by Device Registry Core System
        eu.arrowhead.common.exception.InvalidParameterException - when the payload content couldn't be validated by Device Registry Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at Device Registry Core System
        eu.arrowhead.common.exception.UnavailableServerException - when Device Registry Core System is not available
      • onboardDeviceWithName

        public eu.arrowhead.common.dto.shared.DeviceRegistryOnboardingWithNameResponseDTO onboardDeviceWithName​(eu.arrowhead.common.dto.shared.DeviceRegistryOnboardingWithNameRequestDTO request)
        Sends a http(s) 'device-onboarding-with-name' request to Device Registry Core System.
        Parameters:
        request - DeviceRegistryOnboardingWithNameRequestDTO which represents the required payload of the http(s) request
        Returns:
        the DeviceRegistryOnboardingWithNameResponseDTO received from Device Registry Core System
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by Device Registry Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by Device Registry Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at Device Registry Core System
        eu.arrowhead.common.exception.UnavailableServerException - when Device Registry Core System is not available
      • onboardDeviceWithCSR

        public eu.arrowhead.common.dto.shared.DeviceRegistryOnboardingWithCsrResponseDTO onboardDeviceWithCSR​(eu.arrowhead.common.dto.shared.DeviceRegistryOnboardingWithCsrRequestDTO request)
        Sends a http(s) 'device-onboarding-with-csr' request to Device Registry Core System.
        Parameters:
        request - DeviceRegistryOnboardingWithCsrRequestDTO which represents the required payload of the http(s) request
        Returns:
        the DeviceRegistryOnboardingWithCsrResponseDTO received from Device Registry Core System
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by Device Registry Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by Device Registry Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at Device Registry Core System
        eu.arrowhead.common.exception.UnavailableServerException - when Device Registry Core System is not available
      • subscribeToEventHandler

        public void subscribeToEventHandler​(eu.arrowhead.common.dto.shared.SubscriptionRequestDTO request)
        Sends a http(s) 'subscription' request to Event Handler Core System.
        Parameters:
        request - SubscriptionRequestDTO which represents the required payload of the http(s) request
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by Event Handler Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by Event Handler Core System
        eu.arrowhead.common.exception.InvalidParameterException - when the payload content couldn't be validated by Event Handler Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at Event Handler Core System
        eu.arrowhead.common.exception.UnavailableServerException - when Event Handler Core System is not available
      • unsubscribeFromEventHandler

        public void unsubscribeFromEventHandler​(String eventType,
                                                String subscriberName,
                                                String subscriberAddress,
                                                int subscriberPort)
        Sends a http(s) 'unsubscription' request to Event Handler Core System.
        Parameters:
        eventType - String which represents the required eventType parameter of the http(s) request
        subscriberName - String which represents the required subscriberName parameter of the http(s) request
        subscriberAddress - String which represents the required subscriberAddress parameter of the http(s) request
        subscriberPort - int which represents the required subscriberPort parameter of the http(s) request
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by Event Handler Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by Event Handler Core System
        eu.arrowhead.common.exception.InvalidParameterException - when the payload content couldn't be validated by Event Handler Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at Event Handler Core System
        eu.arrowhead.common.exception.UnavailableServerException - when Event Handler Core System is not available
      • publishToEventHandler

        public void publishToEventHandler​(eu.arrowhead.common.dto.shared.EventPublishRequestDTO request)
        Sends a http(s) 'publish' request to Event Handler Core System.
        Parameters:
        request - EventPublishRequestDTO which represents the required payload of the http(s) request
        Throws:
        eu.arrowhead.common.exception.AuthException - when you are not authorized by Event Handler Core System
        eu.arrowhead.common.exception.BadPayloadException - when the payload couldn't be validated by Event Handler Core System
        eu.arrowhead.common.exception.InvalidParameterException - when the payload content couldn't be validated by Event Handler Core System
        eu.arrowhead.common.exception.ArrowheadException - when internal server error happened at Event Handler Core System
        eu.arrowhead.common.exception.UnavailableServerException - when Event Handler Core System is not available
      • getMyPublicKey

        public PublicKey getMyPublicKey()
        Returns:
        your public key or null when https mode is not enabled
      • getMyPrivateKey

        public PrivateKey getMyPrivateKey()
        Returns:
        your private key or null when https mode is not enabled
      • getOrchestrationFormBuilder

        public eu.arrowhead.common.dto.shared.OrchestrationFormRequestDTO.Builder getOrchestrationFormBuilder()
        Returns:
        an Orchestration form builder prefilled with your system properties
      • consumeServiceHTTP

        public <T> T consumeServiceHTTP​(Class<T> responseType,
                                        org.springframework.http.HttpMethod httpMethod,
                                        String address,
                                        int port,
                                        String serviceUri,
                                        String interfaceName,
                                        String token,
                                        Object payload,
                                        String... queryParams)
        Sends a http(s) request with the specified service reachability details.
        Type Parameters:
        T - responseType which represents the expected response body.
        Parameters:
        httpMethod - HttpMethod enum which represents the method how the service is available.
        address - String value which represents the host where the service is available.
        port - int value which represents the port where the service is available
        serviceUri - String value which represents the URI where the service is available.
        interfaceName - String value which represents the name of the interface used for the communication. Usable interfaces could be received in orchestration response.
        token - (nullable) String value which represents the token for being authorized at the provider side if necessary. Token could be received in orchestration response per interface type.
        payload - (nullable) Object type which represents the required payload of the http(s) request if any necessary.
        queryParams - (nullable) String... variable arguments which represent the additional key-value http(s) query parameters if any necessary. E.g.: "k1", "v1", "k2", "v2".
        Returns:
        the response received from the provider
        Throws:
        eu.arrowhead.common.exception.InvalidParameterException - when service URL can't be assembled.
        eu.arrowhead.common.exception.AuthException - when ssl context or access control related issue happened.
        eu.arrowhead.common.exception.ArrowheadException - when the communication is managed via Gateway Core System and internal server error happened.
        eu.arrowhead.common.exception.UnavailableServerException - when the specified server is not available.
      • consumeServiceHTTP

        public <T> T consumeServiceHTTP​(Class<T> responseType,
                                        org.springframework.http.HttpMethod httpMethod,
                                        org.springframework.web.util.UriComponents uriComponents,
                                        String token,
                                        Object payload)
        Sends a http(s) request with the specified service reachability details.
        Type Parameters:
        T - responseType which represents the expected response body.
        Parameters:
        httpMethod - HttpMethod enum which represents the method how the service is available.
        uriComponents - UriComponents object which represents the URI where the service is available.
        token - (nullable) String value which represents the token for being authorized at the provider side if necessary. Token could be received in orchestration response per interface type.
        payload - (nullable) Object type which represents the required payload of the http(s) request if any necessary.
        Returns:
        the response received from the provider
        Throws:
        eu.arrowhead.common.exception.InvalidParameterException - when service URL can't be assembled.
        eu.arrowhead.common.exception.AuthException - when ssl context or access control related issue happened.
        eu.arrowhead.common.exception.ArrowheadException - when the communication is managed via Gateway Core System and internal server error happened.
        eu.arrowhead.common.exception.UnavailableServerException - when the specified server is not available.
      • connnectServiceWS

        public String connnectServiceWS​(org.springframework.web.socket.WebSocketHandler handler,
                                        String address,
                                        int port,
                                        String serviceUri,
                                        String token,
                                        String... queryParams)
        Make WS(S) connection with the specified service reachability details.
        Parameters:
        handler - WebSocket handler to use for message exchanges
        address - String value which represents the host where the service is available.
        port - int value which represents the port where the service is available
        serviceUri - String value which represents the URI where the service is available.
        token - (nullable) String value which represents the token for being authorized at the provider side if necessary. Token could be received in orchestration response per interface type.
        queryParams - (nullable) String... variable arguments which represent the additional key-value http(s) query parameters if any necessary. E.g.: "k1", "v1", "k2", "v2".
        Returns:
        A string ID for the WebSocketConnection manager created and used for the full-duplex communication
        Throws:
        eu.arrowhead.common.exception.InvalidParameterException - when service URL can't be assembled.
        eu.arrowhead.common.exception.ArrowheadException - when WSS connection failed or the communication is managed via Gateway Core System and internal server error happened.
      • closeWSConnection

        public boolean closeWSConnection​(String wsManagerId)
        Close the WS(S) connection by the given WebSocketConnectionManager ID if any.
        Parameters:
        wsManagerId - string id of the WebSocketConnectionManager
        Returns:
        true if and only if the connection was alive, otherwise false
        Throws:
        eu.arrowhead.common.exception.InvalidParameterException - when wsManagerId is null or blank..
      • connectMQTTBroker

        public org.eclipse.paho.client.mqttv3.MqttClient connectMQTTBroker​(org.eclipse.paho.client.mqttv3.MqttCallback handler,
                                                                           String brokerAddress,
                                                                           String mqttBrokerUsername,
                                                                           String mqttBrokerPassword,
                                                                           int port,
                                                                           String clientId)
                                                                    throws org.eclipse.paho.client.mqttv3.MqttException
        Connect to MQTT broker.
        Parameters:
        handler - string id of the MqttCallback handler
        brokerAddress - address to the broker
        mqttBrokerUsername - user name to the broker if necessary
        mqttBrokerPassword - password to the broker if necessary
        port - port to the broker
        clientId - the client name to use
        Returns:
        an MQTTclient if successful
        Throws:
        org.eclipse.paho.client.mqttv3.MqttException - if communication related error occurs
        eu.arrowhead.common.exception.InvalidParameterException - if a parameter error occurs
        eu.arrowhead.common.exception.ArrowheadException - if a certificate error occurs
      • closeMQTTBroker

        public void closeMQTTBroker​(org.eclipse.paho.client.mqttv3.MqttClient client)
                             throws org.eclipse.paho.client.mqttv3.MqttException
        Close connection and release resources
        Parameters:
        client - the client to close
        Throws:
        org.eclipse.paho.client.mqttv3.MqttException - if the client is not disconnected
      • disconnectMQTTBroker

        public void disconnectMQTTBroker​(org.eclipse.paho.client.mqttv3.MqttClient client)
                                  throws org.eclipse.paho.client.mqttv3.MqttException
        Disconnect from MQTT broker
        Parameters:
        client - the client to disconnect
        Throws:
        org.eclipse.paho.client.mqttv3.MqttException - if a problem is encountered while disconnecting
      • getServerCN

        public String getServerCN()
        Get the serverCN from arrowheadContext
        Returns:
        Arrowhead Application-System ServerCN