예제 #1
0
  /**
   * Called when session is about to die to cleanup anything setup in initServices().
   *
   * @param clientContext The context for the current client.
   */
  @Override
  public void cleanupServices(ClientContext clientContext) {
    if (this.configAdminServiceTracker != null) {
      this.configAdminServiceTracker.stop(clientContext.getBundleContext());
      this.configAdminServiceTracker = null;
    }

    if (this.logger != null) {
      this.logger.stop(clientContext.getBundleContext());
      this.logger = null;
    }
  }
예제 #2
0
  /**
   * Initializes services used by the application.
   *
   * @param clientContext The client context for accessing services.
   */
  @Override
  public void initServices(ClientContext clientContext) {
    this.logger = new APSLogger(System.out);
    this.logger.start(clientContext.getBundleContext());

    this.configAdminServiceTracker =
        new APSServiceTracker<APSConfigAdminService>(
            clientContext.getBundleContext(),
            APSConfigAdminService.class,
            APSServiceTracker.LARGE_TIMEOUT);
    this.configAdminServiceTracker.setLogger(this.logger);
    this.configAdminServiceTracker.start();

    clientContext.addService(
        APSConfigAdminService.class, this.configAdminServiceTracker.getWrappedService());

    this.loginHandler = new APSAdminWebLoginHandler(clientContext.getBundleContext());
  }