Reference Guide

Table Of Contents
throw new RuntimeException(message.toString());
}
List<Switch> remoteDevices = jsonService.fromJsonList(
responseData, Switch.class);
return new HashSet<Switch>(remoteDevices);
}
}
ServiceRest is a service provided by the HP VAN SDN Controller framework that enables HTTP
communication by offering the common operations GET, POST, PUT and DELETE. It also takes care
of service authentication. In order to use from ServiceRest we need to add the module it is located
at as a dependency. Open the hm-bl/pom.xml file and add the XML extract from the following
listing, ServiceRest Dependency, to the <dependencies> node; after updating the POM file update
the Eclipse project dependencies (see Updating Project Dependencies on page 146).
ServiceRest Dependency:
<dependency>
<groupId>com.hp.sdn</groupId>
<artifactId>sdn-common-api</artifactId>
<version>${sdn.version}</version>
</dependency>
<dependency>
<groupId>com.hp.sdn</groupId>
<artifactId>sdn-common-misc</artifactId>
<version>${sdn.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.17</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.1</version>
<scope>test</scope>
</dependency>
In order to use SwitchTransferService, inject a reference into the business logic implementation
(SwitchManager for example) as depicted in Consuming Services with OSGi Declarative Services
on page 166. Note how SwitchTransferManager with @Component and @Service is directly
annotated. It is possible to have followed the same pattern described in Providing Services with
OSGi Declarative Services on page 159 to keep our communication service implementation clean
from the OSGi restrictions, however communication service implementations rarely consume other
services and thus there is no need of dealing with the fact that dependency components may
come and go (Binding/unbinding injected references).
192