public class Bootstrapper
extends java.lang.Object
In the case the client is not already provisioned, the Bootstrapper
joins the UDP multicast group at the predefined address
MULTICAST_ADDRESS
and port UDP_PORT
to wait for a message
from the Network Provisioner for discovery or provisioning. If the message
received is for discovery DISCOVER_REQUEST
, the Bootstrapper sends
back the client information. By default, the information is the client's MAC
address. This information will be displayed by the Network Provisioner to the
operator to select the target client. The information is sent as a key value
pair, where key="MAC" and value is the MAC address. If different information
is desired from the client, the getDeviceInfo()
method should be
modified to return the desired data.
If the message received is for provisioning PROVISION_REQUEST
, the
Bootstrapper saves and verifies the provisioning data.
The result of the provisioning is sent back to the Network
Provisioner. If the provisioning was successful, the Bootstrapper continues
to start the sample application as described previously. If the provisioning
was unsuccessful, the Bootstrapper waits until another provisioning attempt
is made.
The provisioning file should be in the unified provisioner format so that the provisioning data is sent in encrypted form.
Constructor and Description |
---|
Bootstrapper() |
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args) |
static void |
startApp(java.lang.String name,
java.lang.String[] args)
Starts the sample application.
|
public static void main(java.lang.String[] args)
public static void startApp(java.lang.String name, java.lang.String[] args) throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
name
- full class name of the sample application to startargs
- arguments to pass on to the sample applicationjava.lang.ClassNotFoundException
- if the class cannot be locatedjava.lang.NoSuchMethodException
- if the "main" method is not foundjava.lang.IllegalAccessException
- if the Method object enforces Java
language access control and the "main" is inaccessiblejava.lang.reflect.InvocationTargetException
- if the "main" method throws an
exception