public String getApplicationName() { return this.application!=null?this.application.getName():"<unknown>"; }
private String applicationFailureMessage(String message, Object... objects) { return "[" + this.application.getName() + "] " + String.format(message,objects); }
/** * {@inheritDoc} */ @Override public String applicationName() { return application().getName(); }
public void shutdown() throws ApplicationShutdownException { if(!this.state.isShutdown()) { this.lifecycleEnvironment.stop(); LOGGER.info("Application '{}' ({}) stopped.",this.application.getName(),this.application.getClass().getCanonicalName()); if(this.application!=null) { this.application.shutdown(); LOGGER.info("Application '{}' ({}) shutdown.",this.application.getName(),this.application.getClass().getCanonicalName()); } notifyApplicationStateChange(ApplicationState.SHUTDOWN); } }
public <T extends Configuration> Application<T> initialize(String className) throws ApplicationContextCreationException { checkState(this.state.canInitialize(),"Application cannot be initialized at this moment ("+this.state+")"); if(className==null) { notifyApplicationStateChange(ApplicationState.UNDEFINED); throw new ApplicationContextCreationException("No LDP4j application class specified"); } ApplicationState newState = ApplicationState.UNAVAILABLE; try { ApplicationLoader<T> helper = ApplicationLoader.newInstance(this.<T>loadApplicationClass(className)); Application<T> createdApplication = helper.bootstrap(); newState=ApplicationState.AVAILABLE; this.application=createdApplication; this.configuration=helper.configuration(); this.lifecycleEnvironment=helper.lifecycleEnvironment(); LOGGER.info("Application '{}' ({}) initialized.",this.application.getName(),this.application.getClass().getCanonicalName()); this.lifecycleEnvironment.start(ApplicationContext.getInstance()); LOGGER.info("Application '{}' ({}) started.",this.application.getName(),this.application.getClass().getCanonicalName()); return createdApplication; } catch (ApplicationContextBootstrapException e) { throw e; } finally { notifyApplicationStateChange(newState); } }