/** {@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; }
/** * 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()); }
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 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); } }
/** Returns cached instance of {@link ConfigurationService}. */ private static ConfigurationService getConfigService() { if (configService == null) { configService = ServiceUtils.getService(bundleContext, ConfigurationService.class); } return configService; }
/** * Performs UI changes after the chat room join task has finished. * * @param returnCode the result code from the chat room join task. */ private void done(String returnCode) { ConfigurationUtils.updateChatRoomStatus( chatRoomWrapper.getParentProvider().getProtocolProvider(), chatRoomWrapper.getChatRoomID(), GlobalStatusEnum.ONLINE_STATUS); String errorMessage = null; if (JOIN_AUTHENTICATION_FAILED_PROP.equals(returnCode)) { chatRoomWrapper.removePassword(); AuthenticationWindowService authWindowsService = ServiceUtils.getService(MUCActivator.bundleContext, AuthenticationWindowService.class); AuthenticationWindowService.AuthenticationWindow authWindow = authWindowsService.create( null, null, null, false, chatRoomWrapper.isPersistent(), AuthenticationWindow.getAuthenticationWindowIcon( chatRoomWrapper.getParentProvider().getProtocolProvider()), resources.getI18NString( "service.gui.AUTHENTICATION_WINDOW_TITLE", new String[] {chatRoomWrapper.getParentProvider().getName()}), resources.getI18NString( "service.gui.CHAT_ROOM_REQUIRES_PASSWORD", new String[] {chatRoomWrapper.getChatRoomName()}), "", null, isFirstAttempt ? null : resources.getI18NString( "service.gui.AUTHENTICATION_FAILED", new String[] {chatRoomWrapper.getChatRoomName()}), null); authWindow.setVisible(true); if (!authWindow.isCanceled()) { joinChatRoom( chatRoomWrapper, nickName, new String(authWindow.getPassword()).getBytes(), authWindow.isRememberPassword(), false, subject); } } else if (JOIN_REGISTRATION_REQUIRED_PROP.equals(returnCode)) { errorMessage = resources.getI18NString( "service.gui.CHAT_ROOM_REGISTRATION_REQUIRED", new String[] {chatRoomWrapper.getChatRoomName()}); } else if (JOIN_PROVIDER_NOT_REGISTERED_PROP.equals(returnCode)) { errorMessage = resources.getI18NString( "service.gui.CHAT_ROOM_NOT_CONNECTED", new String[] {chatRoomWrapper.getChatRoomName()}); } else if (JOIN_SUBSCRIPTION_ALREADY_EXISTS_PROP.equals(returnCode)) { errorMessage = resources.getI18NString( "service.gui.CHAT_ROOM_ALREADY_JOINED", new String[] {chatRoomWrapper.getChatRoomName()}); } else { errorMessage = resources.getI18NString( "service.gui.FAILED_TO_JOIN_CHAT_ROOM", new String[] {chatRoomWrapper.getChatRoomName()}); } if (!JOIN_SUCCESS_PROP.equals(returnCode) && !JOIN_AUTHENTICATION_FAILED_PROP.equals(returnCode)) { MUCActivator.getAlertUIService() .showAlertPopup(resources.getI18NString("service.gui.ERROR"), errorMessage); } if (JOIN_SUCCESS_PROP.equals(returnCode)) { if (rememberPassword) { chatRoomWrapper.savePassword(new String(password)); } if (subject != null) { try { chatRoomWrapper.getChatRoom().setSubject(subject); } catch (OperationFailedException ex) { logger.warn("Failed to set subject."); } } } chatRoomWrapper.firePropertyChange(returnCode); }
/** * 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 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; }
/** Loads all service references */ private void initServices() { BundleContext bc = DnsConfigActivator.bundleContext; R = ServiceUtils.getService(bc, ResourceManagementService.class); }
/** * 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 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; }