/**
  * Ctor.
  *
  * @param videoChannel The <tt>VideoChannel</tt> associated to this <tt>SimulcastEngine</tt>.
  */
 public SimulcastEngine(VideoChannel videoChannel) {
   this.videoChannel = videoChannel;
   simulcastReceiver =
       new SimulcastReceiver(
           this,
           ServiceUtils.getService(videoChannel.getBundleContext(), ConfigurationService.class));
   this.logger =
       Logger.getLogger(classLogger, videoChannel.getContent().getConference().getLogger());
 }
  /**
   * Returns the password last saved for the specified account.
   *
   * <p>TODO Delegate the implementation to {@link AccountManager} because it knows the format in
   * which the password (among the other account properties) was saved.
   *
   * @param bundleContext a currently valid bundle context.
   * @param accountID the AccountID for the account whose password we're looking for..
   * @return a String containing the password for the specified accountID.
   */
  protected String loadPassword(BundleContext bundleContext, AccountID accountID) {
    String accountPrefix = findAccountPrefix(bundleContext, accountID, getFactoryImplPackageName());

    if (accountPrefix == null) return null;

    CredentialsStorageService credentialsStorage =
        ServiceUtils.getService(bundleContext, CredentialsStorageService.class);

    return credentialsStorage.loadPassword(accountPrefix);
  }
Exemple #3
0
  private void maybeDoShutdown() {
    if (shutdownInProgress && conferences.size() == 0) {
      logger.info("Focus is shutting down NOW");

      ShutdownService shutdownService =
          ServiceUtils.getService(FocusBundleActivator.bundleContext, ShutdownService.class);

      shutdownService.beginShutdown();
    }
  }
  /**
   * Returns a <tt>MediaService</tt> implementation (if any).
   *
   * @return a <tt>MediaService</tt> implementation (if any)
   */
  MediaService getMediaService() {
    MediaService mediaService = ServiceUtils.getService(getBundleContext(), MediaService.class);

    // TODO For an unknown reason, ServiceUtils2.getService fails to
    // retrieve the MediaService implementation. In the form of a temporary
    // workaround, get it through LibJitsi.
    if (mediaService == null) mediaService = LibJitsi.getMediaService();

    return mediaService;
  }
  /**
   * Saves the password for the specified account after scrambling it a bit so that it is not
   * visible from first sight (Method remains highly insecure).
   *
   * <p>TODO Delegate the implementation to {@link AccountManager} because it knows the format in
   * which the password (among the other account properties) is to be saved.
   *
   * @param bundleContext a currently valid bundle context.
   * @param accountID the <tt>AccountID</tt> of the account whose password is to be stored
   * @param password the password to be stored
   * @throws IllegalArgumentException if no account corresponding to <tt>accountID</tt> has been
   *     previously stored.
   * @throws OperationFailedException if anything goes wrong while storing the specified
   *     <tt>password</tt>
   */
  protected void storePassword(BundleContext bundleContext, AccountID accountID, String password)
      throws IllegalArgumentException, OperationFailedException {
    String accountPrefix = findAccountPrefix(bundleContext, accountID, getFactoryImplPackageName());

    if (accountPrefix == null) {
      throw new IllegalArgumentException(
          "No previous records found for account ID: "
              + accountID.getAccountUniqueID()
              + " in package"
              + getFactoryImplPackageName());
    }

    CredentialsStorageService credentialsStorage =
        ServiceUtils.getService(bundleContext, CredentialsStorageService.class);

    if (!credentialsStorage.storePassword(accountPrefix, password)) {
      throw new OperationFailedException(
          "CredentialsStorageService failed to storePassword",
          OperationFailedException.GENERAL_ERROR);
    }
  }
 /**
  * Returns the <tt>BrowserLauncherService</tt> obtained from the bundle context.
  *
  * @return the <tt>BrowserLauncherService</tt> obtained from the bundle context
  */
 static BrowserLauncherService getBrowserLauncher() {
   if (browserLauncher == null) {
     browserLauncher = ServiceUtils.getService(bundleContext, BrowserLauncherService.class);
   }
   return browserLauncher;
 }
 /**
  * Returns a reference to the UIService implementation currently registered in the bundle context
  * or null if no such implementation was found.
  *
  * @return a reference to a UIService implementation currently registered in the bundle context or
  *     null if no such implementation was found.
  */
 static UIService getUIService() {
   if (uiService == null) uiService = ServiceUtils.getService(bundleContext, UIService.class);
   return uiService;
 }
 /**
  * Gets a reference to a <code>ShutdownService</code> implementation currently registered in the
  * bundle context of the active <code>UpdateCheckActivator</code> instance.
  *
  * <p>The returned reference to <code>ShutdownService</code> is not being cached.
  *
  * @return reference to a <code>ShutdownService</code> implementation currently registered in the
  *     bundle context of the active <code>UpdateCheckActivator</code> instance
  */
 static ShutdownService getShutdownService() {
   return ServiceUtils.getService(bundleContext, ShutdownService.class);
 }
 /**
  * Returns the <tt>ConfigurationService</tt> obtained from the bundle context.
  *
  * @return the <tt>ConfigurationService</tt> obtained from the bundle context
  */
 static ConfigurationService getConfiguration() {
   if (configuration == null) {
     configuration = ServiceUtils.getService(bundleContext, ConfigurationService.class);
   }
   return configuration;
 }
 /**
  * Returns a reference to the <tt>PacketLoggingService</tt> implementation currently registered in
  * the bundle context or null if no such implementation was found.
  *
  * @return a reference to a <tt>PacketLoggingService</tt> implementation currently registered in
  *     the bundle context or null if no such implementation was found.
  */
 public static PacketLoggingService getPacketLogging() {
   if (packetLoggingService == null) {
     packetLoggingService = ServiceUtils.getService(bundleContext, PacketLoggingService.class);
   }
   return packetLoggingService;
 }
 /**
  * Returns a reference to a FileAccessService implementation currently registered in the bundle
  * context or null if no such implementation was found.
  *
  * @return a currently valid implementation of the FileAccessService .
  */
 public static FileAccessService getFileAccessService() {
   if (fileAccessService == null) {
     fileAccessService = ServiceUtils.getService(bundleContext, FileAccessService.class);
   }
   return fileAccessService;
 }
 /** Returns cached instance of {@link ConfigurationService}. */
 private static ConfigurationService getConfigService() {
   if (configService == null) {
     configService = ServiceUtils.getService(bundleContext, ConfigurationService.class);
   }
   return configService;
 }