// Now we need to build our plugin container configuration.
// All static configuration settings are retrieved directly from the agent configuration object,
// but we also have to build our dynamic runtime objects that are also part of the PC config (which
// includes things like the plugin finder object and the remoted services).
PluginContainerConfiguration pc_config = m_configuration.getPluginContainerConfiguration();
pc_config.setPluginFinder(new FileSystemPluginFinder(pc_config.getPluginDirectory()));
try {
LOG.debug(AgentI18NResourceKeys.CREATING_PLUGIN_CONTAINER_SERVER_SERVICES);
//make the service container understand the requests for plugin container lifecycle events.
getServiceContainer().addRemotePojo(new PluginContainerLifecycleListener(this),
PluginContainerLifecycle.class);
// Get remote pojo's for server access and make them accessible in the configuration object
ClientRemotePojoFactory factory = m_clientSender.getClientRemotePojoFactory();
CoreServerService coreServerService = factory.getRemotePojo(CoreServerService.class);
DiscoveryServerService discoveryServerService = factory.getRemotePojo(DiscoveryServerService.class);
MeasurementServerService measurementServerService = factory.getRemotePojo(MeasurementServerService.class);
OperationServerService operationServerService = factory.getRemotePojo(OperationServerService.class);
ConfigurationServerService configurationServerService = factory
.getRemotePojo(ConfigurationServerService.class);
ResourceFactoryServerService resourceFactoryServerSerfice = factory
.getRemotePojo(ResourceFactoryServerService.class);
ContentServerService contentServerService = factory.getRemotePojo(ContentServerService.class);
EventServerService eventServerService = factory.getRemotePojo(EventServerService.class);
BundleServerService bundleServerService = factory.getRemotePojo(BundleServerService.class);
DriftServerService driftServerService = factory.getRemotePojo(DriftServerService.class);
ServerServices serverServices = new ServerServices();
serverServices.setCoreServerService(coreServerService);
serverServices.setDiscoveryServerService(discoveryServerService);
serverServices.setMeasurementServerService(measurementServerService);
serverServices.setOperationServerService(operationServerService);
serverServices.setConfigurationServerService(configurationServerService);
serverServices.setResourceFactoryServerService(resourceFactoryServerSerfice);
serverServices.setContentServerService(contentServerService);
serverServices.setEventServerService(eventServerService);
serverServices.setBundleServerService(bundleServerService);
serverServices.setDriftServerService(driftServerService);
pc_config.setServerServices(serverServices);
} catch (Exception e) {
LOG.error(e, AgentI18NResourceKeys.FAILED_TO_CREATE_PLUGIN_CONTAINER_SERVER_SERVICES, e);
return false;
}
File plugin_dir = pc_config.getPluginDirectory();
// we block until we get our plugins - there is no sense continuing until we have plugins
// there may be instances, though, where we don't want to block (in unit tests for example)
// so allow this to be configurable via the "update plugins at startup" flag.
m_pluginUpdate = new PluginUpdate(pc_config.getServerServices().getCoreServerService(), pc_config);
if (m_configuration.isUpdatePluginsAtStartupEnabled()) {
LOG.info(AgentI18NResourceKeys.WAITING_FOR_PLUGINS_WITH_DIR, plugin_dir);
getOut().println(MSG.getMsg(AgentI18NResourceKeys.WAITING_FOR_PLUGINS));
for (;;) {
try {