/** * Get a {@link Map} of {@link ILdapServer} instances from the spring configuration. * * @return A {@link Map} of {@link ILdapServer} instances. */ @SuppressWarnings("unchecked") public static Map<String, ILdapServer> getLdapServerMap() { final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext(); final Map<String, ILdapServer> ldapServers = applicationContext.getBeansOfType(ILdapServer.class); if (LOG.isDebugEnabled()) { LOG.debug("Found Map of ILdapServers=" + ldapServers + "'"); } return Collections.unmodifiableMap(ldapServers); }
getLogger().debug("Using WebApplicationContext"); "A portal managed ApplicationContext has already been created but now a ServletContext is available and a WebApplicationContext will be returned. " + "This situation should be resolved by delaying calls to this class until after the web-application has completely initialized."); getLogger().error(createException, createException); getLogger() .error( "Stack trace of original ApplicationContext creator",
getLogger().debug("Using WebApplicationContext"); "A portal managed ApplicationContext has already been created but now a ServletContext is available and a WebApplicationContext will be returned. " + "This situation should be resolved by delaying calls to this class until after the web-application has completely initialized."); getLogger().error(createException, createException); getLogger() .error( "Stack trace of original ApplicationContext creator",
/** * Get a {@link Map} of {@link ILdapServer} instances from the spring configuration. * * @return A {@link Map} of {@link ILdapServer} instances. */ @SuppressWarnings("unchecked") public static Map<String, ILdapServer> getLdapServerMap() { final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext(); final Map<String, ILdapServer> ldapServers = applicationContext.getBeansOfType(ILdapServer.class); if (LOG.isDebugEnabled()) { LOG.debug("Found Map of ILdapServers=" + ldapServers + "'"); } return Collections.unmodifiableMap(ldapServers); }
/** * If the ApplicationContext returned by {@link #getApplicationContext()} is 'portal managed' * the shutdown hook for the context is called, closing and cleaning up all spring managed * resources. * * <p>If the ApplicationContext returned by {@link #getApplicationContext()} is actually a * WebApplicationContext this method does nothing but log an error message. */ public static void shutdown() { if (applicationContextCreator.isCreated()) { final ConfigurableApplicationContext applicationContext = applicationContextCreator.get(); applicationContext.close(); } else { final IllegalStateException createException = new IllegalStateException( "No portal managed ApplicationContext has been created, there is nothing to shutdown."); getLogger().error(createException, createException); } }
/** * Get the {@link ILdapServer} from the portal spring context with the specified name. * * @param name The name of the ILdapServer to return. * @return An {@link ILdapServer} with the specified name, <code>null</code> if there is no * connection with the specified name. */ public static ILdapServer getLdapServer(String name) { final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext(); ILdapServer ldapServer = null; try { ldapServer = (ILdapServer) applicationContext.getBean(name, ILdapServer.class); } catch (NoSuchBeanDefinitionException nsbde) { // Ignore the exception for not finding the named bean. } if (LOG.isDebugEnabled()) { LOG.debug("Found ILdapServer='" + ldapServer + "' for name='" + name + "'"); } return ldapServer; }
/** * If the ApplicationContext returned by {@link #getApplicationContext()} is 'portal managed' * the shutdown hook for the context is called, closing and cleaning up all spring managed * resources. * * <p>If the ApplicationContext returned by {@link #getApplicationContext()} is actually a * WebApplicationContext this method does nothing but log an error message. */ public static void shutdown() { if (applicationContextCreator.isCreated()) { final ConfigurableApplicationContext applicationContext = applicationContextCreator.get(); applicationContext.close(); } else { final IllegalStateException createException = new IllegalStateException( "No portal managed ApplicationContext has been created, there is nothing to shutdown."); getLogger().error(createException, createException); } }
/** * Get the {@link ILdapServer} from the portal spring context with the specified name. * * @param name The name of the ILdapServer to return. * @return An {@link ILdapServer} with the specified name, <code>null</code> if there is no * connection with the specified name. */ public static ILdapServer getLdapServer(String name) { final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext(); ILdapServer ldapServer = null; try { ldapServer = (ILdapServer) applicationContext.getBean(name, ILdapServer.class); } catch (NoSuchBeanDefinitionException nsbde) { // Ignore the exception for not finding the named bean. } if (LOG.isDebugEnabled()) { LOG.debug("Found ILdapServer='" + ldapServer + "' for name='" + name + "'"); } return ldapServer; }
public static IDatabaseMetadata getPortalDbMetadata() { AbstractBeanLocator<IDatabaseMetadata> locator = locatorInstance; if (locator == null) { LOG.info( "Looking up bean '" + BEAN_NAME + "' in ApplicationContext due to context not yet being initialized"); final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext(); applicationContext.getBean(PortalDbMetadataLocator.class.getName()); locator = locatorInstance; if (locator == null) { LOG.warn( "Instance of '" + BEAN_NAME + "' still null after portal application context has been initialized"); return applicationContext.getBean(BEAN_NAME, IDatabaseMetadata.class); } } return locator.getInstance(); }
public static ICounterStore getCounterStore() { AbstractBeanLocator<ICounterStore> locator = locatorInstance; if (locator == null) { LOG.info( "Looking up bean '" + BEAN_NAME + "' in ApplicationContext due to context not yet being initialized"); final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext(); applicationContext.getBean(CounterStoreLocator.class.getName()); locator = locatorInstance; if (locator == null) { LOG.warn( "Instance of '" + BEAN_NAME + "' still null after portal application context has been initialized"); return applicationContext.getBean(BEAN_NAME, ICounterStore.class); } } return locator.getInstance(); }
public static ILocalAccountDao getLocalAccountDao() { AbstractBeanLocator<ILocalAccountDao> locator = locatorInstance; if (locator == null) { LOG.info( "Looking up bean '" + BEAN_NAME + "' in ApplicationContext due to context not yet being initialized"); final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext(); applicationContext.getBean(LocalAccountDaoLocator.class.getName()); locator = locatorInstance; if (locator == null) { LOG.warn( "Instance of '" + BEAN_NAME + "' still null after portal application context has been initialized"); return applicationContext.getBean(BEAN_NAME, ILocalAccountDao.class); } } return locator.getInstance(); }
public static IEntitySearcher getReferenceEntitySearcher() { AbstractBeanLocator<IEntitySearcher> locator = locatorInstance; if (locator == null) { LOG.info( "Looking up bean '" + BEAN_NAME + "' in ApplicationContext due to context not yet being initialized"); final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext(); applicationContext.getBean(ReferenceEntitySearcherLocator.class.getName()); locator = locatorInstance; if (locator == null) { LOG.warn( "Instance of '" + BEAN_NAME + "' still null after portal application context has been initialized"); return applicationContext.getBean(BEAN_NAME, IEntitySearcher.class); } } return locator.getInstance(); }
public static IPersonAttributeDao getPersonAttributeDao() { AbstractBeanLocator<IPersonAttributeDao> locator = locatorInstance; if (locator == null) { LOG.info( "Looking up bean '" + BEAN_NAME + "' in ApplicationContext due to context not yet being initialized"); final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext(); applicationContext.getBean(PersonAttributeDaoLocator.class.getName()); locator = locatorInstance; if (locator == null) { LOG.warn( "Instance of '" + BEAN_NAME + "' still null after portal application context has been initialized"); return applicationContext.getBean(BEAN_NAME, IPersonAttributeDao.class); } } return locator.getInstance(); }
public static IEntityCachingService getEntityCachingService() { AbstractBeanLocator<IEntityCachingService> locator = locatorInstance; if (locator == null) { LOG.info( "Looking up bean '" + BEAN_NAME + "' in ApplicationContext due to context not yet being initialized"); final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext(); applicationContext.getBean(EntityCachingServiceLocator.class.getName()); locator = locatorInstance; if (locator == null) { LOG.warn( "Instance of '" + BEAN_NAME + "' still null after portal application context has been initialized"); return applicationContext.getBean(BEAN_NAME, IEntityCachingService.class); } } return locator.getInstance(); }
public static EntityTypes getEntityTypes() { AbstractBeanLocator<EntityTypes> locator = locatorInstance; if (locator == null) { LOG.info( "Looking up bean '" + BEAN_NAME + "' in ApplicationContext due to context not yet being initialized"); final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext(); applicationContext.getBean(EntityTypesLocator.class.getName()); locator = locatorInstance; if (locator == null) { LOG.warn( "Instance of '" + BEAN_NAME + "' still null after portal application context has been initialized"); return applicationContext.getBean(BEAN_NAME, EntityTypes.class); } } return locator.getInstance(); }
public static IPortalPasswordService getPortalPasswordService() { AbstractBeanLocator<IPortalPasswordService> locator = locatorInstance; if (locator == null) { LOG.info( "Looking up bean '" + BEAN_NAME + "' in ApplicationContext due to context not yet being initialized"); final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext(); applicationContext.getBean(PortalPasswordServiceLocator.class.getName()); locator = locatorInstance; if (locator == null) { LOG.warn( "Instance of '" + BEAN_NAME + "' still null after portal application context has been initialized"); return applicationContext.getBean(BEAN_NAME, IPortalPasswordService.class); } } return locator.getInstance(); }
public static IStringEncryptionService getPasswordEncryptionService() { AbstractBeanLocator<IStringEncryptionService> locator = locatorInstance; if (locator == null) { LOG.info( "Looking up bean '" + BEAN_NAME + "' in ApplicationContext due to context not yet being initialized"); final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext(); applicationContext.getBean(PasswordEncryptionServiceLocator.class.getName()); locator = locatorInstance; if (locator == null) { LOG.warn( "Instance of '" + BEAN_NAME + "' still null after portal application context has been initialized"); return applicationContext.getBean(BEAN_NAME, IStringEncryptionService.class); } } return locator.getInstance(); }
public static ICounterStore getCounterStore() { AbstractBeanLocator<ICounterStore> locator = locatorInstance; if (locator == null) { LOG.info( "Looking up bean '" + BEAN_NAME + "' in ApplicationContext due to context not yet being initialized"); final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext(); applicationContext.getBean(CounterStoreLocator.class.getName()); locator = locatorInstance; if (locator == null) { LOG.warn( "Instance of '" + BEAN_NAME + "' still null after portal application context has been initialized"); return applicationContext.getBean(BEAN_NAME, ICounterStore.class); } } return locator.getInstance(); }
public static IPortletDefinitionRegistry getPortletDefinitionRegistry() { AbstractBeanLocator<IPortletDefinitionRegistry> locator = locatorInstance; if (locator == null) { LOG.info( "Looking up bean '" + BEAN_NAME + "' in ApplicationContext due to context not yet being initialized"); final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext(); applicationContext.getBean(PortletDefinitionRegistryLocator.class.getName()); locator = locatorInstance; if (locator == null) { LOG.warn( "Instance of '" + BEAN_NAME + "' still null after portal application context has been initialized"); return applicationContext.getBean(BEAN_NAME, IPortletDefinitionRegistry.class); } } return locator.getInstance(); }
public static DataSource getPortalDb() { AbstractBeanLocator<DataSource> locator = locatorInstance; if (locator == null) { LOG.info( "Looking up bean '" + BEAN_NAME + "' in ApplicationContext due to context not yet being initialized"); final ApplicationContext applicationContext = PortalApplicationContextLocator.getApplicationContext(); applicationContext.getBean(PortalDbLocator.class.getName()); locator = locatorInstance; if (locator == null) { LOG.warn( "Instance of '" + BEAN_NAME + "' still null after portal application context has been initialized"); return applicationContext.getBean(BEAN_NAME, DataSource.class); } } return locator.getInstance(); }