@Override
public CallbackCompletion<Void> initialize (final ControllerCloudletContext context, final CloudletCallbackArguments<ControllerCloudletContext> arguments)
{
this.logger.info ("ControllerCloudlet initializing...");
context.cloudlet = arguments.getCloudlet ();
final IConfiguration configuration = context.cloudlet.getConfiguration ();
final IConfiguration kvConfiguration = configuration.spliceConfiguration (ConfigurationIdentifier.resolveAbsolute ("statostore"));
context.kvStore = context.cloudlet.getConnectorFactory (IKvStoreConnectorFactory.class).create (kvConfiguration, String.class, JsonDataEncoder.create (String.class), new KeyValueCallbackresult (), context);
final IConfiguration queueConfiguration2 = configuration.spliceConfiguration (ConfigurationIdentifier.resolveAbsolute ("queueclient.consumer"));
context.consumer = context.cloudlet.getConnectorFactory (IAmqpQueueConsumerConnectorFactory.class).create (queueConfiguration2, String.class, PlainTextDataEncoder.DEFAULT_INSTANCE, new AmqpConsumerCallbackClient (), context);
final IConfiguration queueConfiguration4 = configuration.spliceConfiguration (ConfigurationIdentifier.resolveAbsolute ("queuestate.consumer"));
context.consumerev = context.cloudlet.getConnectorFactory (IAmqpQueueConsumerConnectorFactory.class).create (queueConfiguration4, String.class, PlainTextDataEncoder.DEFAULT_INSTANCE, new AmqpConsumerCallbackState (), context);
final IConfiguration queueConfiguration = configuration.spliceConfiguration (ConfigurationIdentifier.resolveAbsolute ("queuerequest.publisher"));
context.publisher = context.cloudlet.getConnectorFactory (IAmqpQueuePublisherConnectorFactory.class).create (queueConfiguration, String.class, PlainTextDataEncoder.DEFAULT_INSTANCE, new AmqpPublisherCallbackWG (), context);
final IConfiguration queueConfiguration3 = configuration.spliceConfiguration (ConfigurationIdentifier.resolveAbsolute ("queueresult.publisher"));
context.publisherev = context.cloudlet.getConnectorFactory (IAmqpQueuePublisherConnectorFactory.class).create (queueConfiguration3, String.class, PlainTextDataEncoder.DEFAULT_INSTANCE, new AmqpPublisherCallbackResult (), context);
return CallbackCompletion.createAndChained (context.kvStore.initialize (), context.consumer.initialize (),context.consumerev.initialize (),context.publisher.initialize (),context.publisherev.initialize ());
}