Example #1
0
  /** {@inheritDoc} */
  @Override
  public void start(BundleContext bundleContext) throws Exception {
    focusManager = ServiceUtils.getService(bundleContext, FocusManager.class);

    Assert.notNull(focusManager, "focusManager");

    versionService = ServiceUtils.getService(bundleContext, VersionService.class);

    Assert.notNull(versionService, "versionService");

    meetTools = focusManager.getOperationSet(OperationSetJitsiMeetTools.class);

    Assert.notNull(meetTools, "meetTools");

    super.start(bundleContext);
  }
 /**
  * Returns the <tt>UIService</tt> obtained from the bundle context.
  *
  * @return the <tt>UIService</tt> obtained from the bundle context
  */
 private UIService getUIService() {
   if (uiService == null) {
     uiService =
         ServiceUtils.getService(ResourceManagementActivator.bundleContext, UIService.class);
   }
   return uiService;
 }
  /**
   * 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);
  }
  /**
   * 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;
  }
  /** implements BundleActivator.start() */
  public void start(BundleContext bc) throws Exception {
    logger.info("starting popup message test ");

    bundleContext = bc;

    setName("PopupMessageHandlerSLick");

    Hashtable<String, String> properties = new Hashtable<String, String>();

    properties.put("service.pid", getName());

    // we maybe are running on machine without WM and systray
    // (test server machine), skip tests
    if (ServiceUtils.getService(bc, SystrayService.class) != null) {
      addTest(TestPopupMessageHandler.suite());
    }

    bundleContext.registerService(getClass().getName(), this, properties);
  }
  /**
   * 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);
    }
  }
 /** Loads all service references */
 private void initServices() {
   BundleContext bc = DnsConfigActivator.bundleContext;
   R = ServiceUtils.getService(bc, ResourceManagementService.class);
 }
Example #8
0
 /**
  * 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;
 }
Example #9
0
 /**
  * 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);
 }
Example #10
0
 /**
  * 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;
 }
Example #11
0
 /**
  * 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;
 }
Example #12
0
 /**
  * Returns the <tt>ResourceManagementService</tt>, through which we will access all resources.
  *
  * @return the <tt>ResourceManagementService</tt>, through which we will access all resources.
  */
 public static ResourceManagementService getResources() {
   if (resourceService == null) {
     resourceService = ServiceUtils.getService(bundleContext, ResourceManagementService.class);
   }
   return resourceService;
 }
 /**
  * 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;
 }
Example #15
0
 /** Returns cached instance of {@link ConfigurationService}. */
 private static ConfigurationService getConfigService() {
   if (configService == null) {
     configService = ServiceUtils.getService(bundleContext, ConfigurationService.class);
   }
   return configService;
 }