@Override public void tenantInitialize(ILifecycleProgressMonitor monitor) throws SiteWhereException { this.eventSourcesManager = (IEventSourcesManager) getModuleContext() .getBean(EventSourcesBeans.BEAN_EVENT_SOURCES_MANAGER); // Create step that will initialize components. ICompositeLifecycleStep init = new CompositeLifecycleStep("Initialize " + getComponentName()); // Initialize event sources manager. init.addInitializeStep(this, getEventSourcesManager(), true); // Execute initialization steps. init.execute(monitor); }
@Override public void execute(ILifecycleProgressMonitor monitor) throws SiteWhereException { monitor.pushContext(new LifecycleProgressContext(steps.size(), getName())); StringBuffer buffer = new StringBuffer(); buffer.append("About to process composite lifecycle with " + steps.size() + "steps:\n"); for (ILifecycleStep step : steps) { buffer.append(" " + step.getName() + "\n"); } LOGGER.debug(buffer.toString()); try { for (ILifecycleStep step : steps) { LOGGER.debug("Starting " + step.getName()); monitor.startProgress(step.getName()); step.execute(monitor); monitor.finishProgress(); } } finally { monitor.popContext(); } }
public void addStep(ILifecycleStep step) { getSteps().add(step); }
@Override public void addTerminateStep(ILifecycleComponent owner, ILifecycleComponent component) { addStep(new TerminateComponentLifecycleStep(owner, component)); }
@Override public void addStopStep(ILifecycleComponent owner, ILifecycleComponent component) { if (component != null) { addStep(new StopComponentLifecycleStep(owner, component)); } else { owner.getLogger().warn("Skipping 'stop' step for null component."); } }
@Override public void tenantInitialize(ILifecycleProgressMonitor monitor) throws SiteWhereException { // Create search providers manager. this.searchProvidersManager = (ISearchProvidersManager) getModuleContext() .getBean(EventSearchBeans.BEAN_SEARCH_PROVIDERS_MANAGER); // Create step that will initialize components. ICompositeLifecycleStep init = new CompositeLifecycleStep("Initialize " + getComponentName()); // Initialize search providers manager. init.addInitializeStep(this, getSearchProvidersManager(), true); // Execute initialization steps. init.execute(monitor); }
public void addStep(ILifecycleStep step) { getSteps().add(step); }
@Override public void execute(ILifecycleProgressMonitor monitor) throws SiteWhereException { monitor.pushContext(new LifecycleProgressContext(steps.size(), getName())); try { for (ILifecycleStep step : steps) { LOGGER.debug("Starting " + step.getName()); ActiveSpan span = monitor.getMicroservice().getTracer().activeSpan(); try { TracerUtils.logToSpan(span, "Starting step '" + step.getName() + "'."); monitor.startProgress(step.getName()); step.execute(monitor); monitor.finishProgress(); } catch (SiteWhereException e) { TracerUtils.handleErrorInTracerSpan(span, e); throw e; } catch (Throwable t) { SiteWhereException e = new SiteWhereException("Unhandled exception in composite lifecycle step.", t); TracerUtils.handleErrorInTracerSpan(span, e); throw e; } } } finally { monitor.popContext(); } }
@Override public void addStartStep(ILifecycleComponent owner, ILifecycleComponent component, boolean require) { if (component != null) { addStep(new StartComponentLifecycleStep(owner, component, require)); } else { owner.getLogger().warn("Skipping 'start' step for null component."); } }
@Override public void tenantInitialize(ILifecycleProgressMonitor monitor) throws SiteWhereException { // Create outbound connectors manager. this.outboundConnectorsManager = (IOutboundConnectorsManager) getModuleContext() .getBean(OutboundConnectorsBeans.BEAN_OUTBOUND_CONNECTORS_MANAGER); // Create step that will initialize components. ICompositeLifecycleStep init = new CompositeLifecycleStep("Initialize " + getComponentName()); // Initialize outbound connectors manager. init.addInitializeStep(this, getOutboundConnectorsManager(), true); // Execute initialization steps. init.execute(monitor); }
@Override public void addInitializeStep(ILifecycleComponent owner, ILifecycleComponent component, boolean require) { if (component != null) { addStep(new InitializeComponentLifecycleStep(owner, component, require)); } else { owner.getLogger().warn("Skipping 'initialize' step for null component."); } }
@Override public void tenantInitialize(ILifecycleProgressMonitor monitor) throws SiteWhereException { // Create outbound connectors manager. this.ruleProcessorsManager = (IRuleProcessorsManager) getModuleContext() .getBean(RuleProcessingBeans.BEAN_RULE_PROCESSORS_MANAGER); // Create step that will initialize components. ICompositeLifecycleStep init = new CompositeLifecycleStep("Initialize " + getComponentName()); // Initialize rule processors manager. init.addInitializeStep(this, getRuleProcessorsManager(), true); // Execute initialization steps. init.execute(monitor); }
@Override public void tenantStart(ILifecycleProgressMonitor monitor) throws SiteWhereException { // Create step that will start components. ICompositeLifecycleStep start = new CompositeLifecycleStep("Start " + getComponentName()); // Start event sources manager. start.addStartStep(this, getEventSourcesManager(), true); // Execute startup steps. start.execute(monitor); }
@Override public void microserviceStart(ILifecycleProgressMonitor monitor) throws SiteWhereException { // Composite step for starting microservice. ICompositeLifecycleStep start = new CompositeLifecycleStep("Start " + getName()); // Start device mangement API demux. start.addStartStep(this, getDeviceManagementApiDemux(), true); // Execute startup steps. start.execute(monitor); }
@Override public void tenantStop(ILifecycleProgressMonitor monitor) throws SiteWhereException { // Create step that will stop components. ICompositeLifecycleStep start = new CompositeLifecycleStep("Stop " + getComponentName()); // Stop outbound connectors manager. start.addStopStep(this, getOutboundConnectorsManager()); // Execute shutdown steps. start.execute(monitor); }
@Override public void tenantStop(ILifecycleProgressMonitor monitor) throws SiteWhereException { // Create step that will stop components. ICompositeLifecycleStep start = new CompositeLifecycleStep("Stop " + getComponentName()); // Stop rule processors manager. start.addStopStep(this, getRuleProcessorsManager()); // Execute shutdown steps. start.execute(monitor); }
@Override public void tenantStop(ILifecycleProgressMonitor monitor) throws SiteWhereException { // Create step that will stop components. ICompositeLifecycleStep start = new CompositeLifecycleStep("Stop " + getComponentName()); // Stop event sources manager. start.addStopStep(this, getEventSourcesManager()); // Execute shutdown steps. start.execute(monitor); }
@Override public void tenantStart(ILifecycleProgressMonitor monitor) throws SiteWhereException { // Create step that will start components. ICompositeLifecycleStep start = new CompositeLifecycleStep("Start " + getComponentName()); // Start outbound connectors manager. start.addStartStep(this, getOutboundConnectorsManager(), true); // Execute startup steps. start.execute(monitor); }
@Override public void microserviceStart(ILifecycleProgressMonitor monitor) throws SiteWhereException { // Create step that will start components. ICompositeLifecycleStep start = new CompositeLifecycleStep("Start " + getName()); // Start schedule management GRPC server. start.addStartStep(this, getScheduleManagementGrpcServer(), true); // Execute startup steps. start.execute(monitor); }
@Override public void configurationStop(ApplicationContext global, ApplicationContext local, ILifecycleProgressMonitor monitor) throws SiteWhereException { // Composite step for stopping microservice. ICompositeLifecycleStep stop = new CompositeLifecycleStep("Stop " + getName()); // Stop tenant management persistence. stop.addStopStep(this, getTenantManagement()); // Execute shutdown steps. stop.execute(monitor); }