public IProvisioningAgent getProvisioningAgent() {
if (agent == null) {
ServiceReference<?> serviceReference = context.getServiceReference(IProvisioningAgentProvider.class.getName());
if (serviceReference != null) {
IProvisioningAgentProvider agentProvider = (IProvisioningAgentProvider) context.getService(serviceReference);
if (agentProvider != null) {
try {
agent = agentProvider.createAgent(getStateLocation().toFile().toURI());
} catch (ProvisionException e) {
getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, e.getMessage(), e));
} catch (IllegalStateException e) {
getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, e.getMessage(), e));
}