Initialize the Jawr context (config, cache manager, application config
manager...)

@param props
the Jawr properties

@throws ServletException
if an exception occurs
17350
protected void initializeJawrContext(Properties props) throws ServletException {

		// Initialize config
		initializeJawrConfig(props);

		// initialize the cache manager
		initializeApplicationCacheManager();

		// initialize the Application config manager
		JawrApplicationConfigManager appConfigMgr = initApplicationConfigManager();

		JmxUtils.initJMXBean(appConfigMgr, servletContext, resourceType,
				props.getProperty(JawrConstant.JAWR_JMX_MBEAN_PREFIX));
	}
414579
public static void fillBeanProperties(Object bean, Map<String, Object> props) {
        fillBeanProperties(bean, props, EMPTY_MAP);
    }
934796
public void init(ServletConfig config) throws ServletException
    {
        super.init(config);
        ServletTask.initServlet(this, BasicServlet.SERVLET_TYPE.HTML);
    }
756699
protected JawrConfig createJawrConfig(Properties props) {
		jawrConfig = new JawrConfig(resourceType, props, configPropResolver);

		// Override properties which are incompatible with the build time bundle
		// processing
		if (ThreadLocalJawrContext.isBundleProcessingAtBuildTime()) {
			jawrConfig.setUseBundleMapping(true);

			// Use the standard working directory
			jawrConfig.setJawrWorkingDirectory(null);
		}

		return jawrConfig;
	}
683748
public void init() throws ServletException {
        FilterConfig config = getFilterConfig();

        // Default don't delete cache files on exit (persistent cache)
        boolean deleteCacheOnExit = "TRUE".equalsIgnoreCase(config.getInitParameter("deleteCacheOnExit"));

        // Default expiry time 10 minutes
        int expiryTime = 10 * 60 * 1000;

        String expiryTimeStr = config.getInitParameter("expiryTime");
        if (!StringUtil.isEmpty(expiryTimeStr)) {
            try {
                // TODO: This is insane.. :-P Let the expiry time be in minutes or seconds..
                expiryTime = Integer.parseInt(expiryTimeStr);
            }
            catch (NumberFormatException e) {
                throw new ServletConfigException("Could not parse expiryTime: " + e.toString(), e);
            }
        }

        // Default max mem cache size 10 MB
        int memCacheSize = 10;

        String memCacheSizeStr = config.getInitParameter("memCacheSize");
        if (!StringUtil.isEmpty(memCacheSizeStr)) {
            try {
                memCacheSize = Integer.parseInt(memCacheSizeStr);
            }
            catch (NumberFormatException e) {
                throw new ServletConfigException("Could not parse memCacheSize: " + e.toString(), e);
            }
        }

        int maxCachedEntites = 10000;

        try {
            cache = new HTTPCache(
                    getTempFolder(),
                    expiryTime,
                    memCacheSize * 1024 * 1024,
                    maxCachedEntites,
                    deleteCacheOnExit,
                    new ServletContextLoggerAdapter(getFilterName(), getServletContext())
            ) {
                @Override
                protected File getRealFile(CacheRequest pRequest) {
                    String contextRelativeURI = ServletUtil.getContextRelativeURI(((ServletCacheRequest) pRequest).getRequest());

                    String path = getServletContext().getRealPath(contextRelativeURI);

                    if (path != null) {
                        return new File(path);
                    }

                    return null;
                }
            };
            log("Created cache: " + cache);
        }
        catch (IllegalArgumentException e) {
            throw new ServletConfigException("Could not create cache: " + e.toString(), e);
        }
    }
218351
@PostConstruct
    public void init(Map<String,String> properties) {

        vmTransportUrl = properties.getOrDefault(KEY_VM_TRANSPORT_URL, KEY_VM_TRANSPORT_URL_DEFAULT);
        memberInteractionsQueueName = properties.getOrDefault(KEY_MEMBER_INTERACTIONS_QUEUE,
                KEY_MEMBER_INTERACTIONS_QUEUE_DEFAULT);

        jmsConnectionFactory = new ActiveMQConnectionFactory(vmTransportUrl);

        try {
            jmsConnection = jmsConnectionFactory.createConnection();
        } catch (JMSException e) {
            LOG.error("Unable to create connection", e);
            throw new RuntimeException(e);
        }

        try {
            jmsConnection.start();
        } catch (JMSException e) {
            LOG.error("Unable to start connection", e);
            closeSafely(jmsConnection);
            jmsConnection = null;
        }
    }
1018414
protected void loadConfig(Properties props, String path, InputStream is) {
		// load properties into a Properties object
		try {
			props.load(is);
		} catch (IOException e) {
			throw new BundlingProcessException("Unable to load jawr configuration at " + path + ".", e);
		}
	}
1147772
public final void contextInitialized(final ServletContextEvent sce) {
		try {
			// Get the configuration
			final ParalleljConfiguration configuration = (ParalleljConfiguration) ConfigurationService
					.getConfigurationService().getConfigurationManager()
					.get(ParalleljConfigurationManager.class).getConfiguration();

			// Initialize the launcher
			Launcher.getLauncher();

			// Initialize a TcpIpServer
			if (configuration.getServers() != null
					&& configuration.getServers().getTelnet() != null) {
				this.tcpIpServer = new TcpIpServer(configuration.getServers()
						.getTelnet().getHost(), configuration.getServers()
						.getTelnet().getPort(), new TcpIpHandlerAdapter());
				// Try to start the TciIpServer
				if (this.tcpIpServer != null) {
					try {
						this.tcpIpServer.start();
					} catch (IOException e) {
						LaunchingMessageKind.ETCPIP0001.format(e);
					}
				}
			}

			// Initialize a JmxServer
			// and register all defined Program as MBeans
			if (configuration.getServers() != null
					&& configuration.getServers().getJmx() != null) {
				this.jmxServer = new JmxServer(configuration.getServers()
						.getJmx().getHost(), configuration.getServers()
						.getJmx().getPort());
				// Try to start the JmxServer
				if (this.jmxServer != null) {
					try {
						this.jmxServer.start();
					} catch (IOException e) {
						LaunchingMessageKind.EJMX0001.format(e);
					}
				}
			}

			// Initialize a SshServer
			if (configuration.getServers() != null
					&& configuration.getServers().getSsh() != null) {

				this.sshServer = new SshServer(configuration.getServers()
						.getSsh().getPort());

				// Try to start SshServer
				if (this.sshServer != null) {
					try {
						sshServer.start();
					} catch (IOException e) {
						LaunchingMessageKind.ESSH0001.format(e);
					}
				}
			}
			
		} catch (LaunchException e) {
			LaunchingMessageKind.EWLAUNCH0001.format(e);
		}
	}
378290
protected final void configureWebAppContext(WebAppContext context,
			ServletContextInitializer... initializers) {
		Assert.notNull(context, "Context must not be null");
		context.setTempDirectory(getTempDirectory());
		if (this.resourceLoader != null) {
			context.setClassLoader(this.resourceLoader.getClassLoader());
		}
		String contextPath = getContextPath();
		context.setContextPath(StringUtils.hasLength(contextPath) ? contextPath : "/");
		context.setDisplayName(getDisplayName());
		configureDocumentRoot(context);
		if (isRegisterDefaultServlet()) {
			addDefaultServlet(context);
		}
		if (shouldRegisterJspServlet()) {
			addJspServlet(context);
			context.addBean(new JasperInitializer(context), true);
		}
		addLocaleMappings(context);
		ServletContextInitializer[] initializersToUse = mergeInitializers(initializers);
		Configuration[] configurations = getWebAppContextConfigurations(context,
				initializersToUse);
		context.setConfigurations(configurations);
		context.setThrowUnavailableOnStartupException(true);
		configureSession(context);
		postProcessWebAppContext(context);
	}
558661
public static void init(final ClassLoader classLoader, final ClassLoader[] propertyLoaders) {
        getInstance().classLoader = classLoader;
        
        if(propertyLoaders != null && propertyLoaders.length != 0) {
            Map<Integer, ClassLoader> loaderMap = new HashMap<>();
            for(ClassLoader propertyLoader : propertyLoaders) {
                loaderMap.put(propertyLoader.hashCode(), propertyLoader);
            }
            
            getInstance().ognlContext = new OgnlContext(loaderMap);
            getInstance().ognlContext.setMemberAccess(new DefaultMemberAccess(true));
            getInstance().ognlContext.setClassResolver(new MultipleLoaderClassResolver());
            
        }
    }
875781
public void initializeServlets() throws Exception
    {
        // initialize Filters
        MultiException mex= new MultiException();
        Iterator iter= _filters.iterator();
        while (iter.hasNext())
        {
            FilterHolder holder= (FilterHolder)iter.next();
            try
            {
                holder.start();
            }
            catch (Exception e)
            {
                mex.add(e);
            }
        }

        // initialize Servlets
        try
        {
            super.initializeServlets();
        }
        catch (Exception e)
        {
            mex.add(e);
        }

        jsr154FilterHolder=getFilter("jsr154");
        if (jsr154FilterHolder!=null)
            jsr154Filter= (JSR154Filter)jsr154FilterHolder.getFilter();
        log.debug("jsr154filter="+jsr154Filter);
        
        if (LazyList.size(_requestAttributeListeners) > 0 || LazyList.size(_requestListeners) > 0)
        {
            
            if (jsr154Filter==null)
                log.warn("Filter jsr154 not defined for RequestAttributeListeners");
            else
            {
                jsr154Filter.setRequestAttributeListeners(_requestAttributeListeners);
                jsr154Filter.setRequestListeners(_requestListeners);
            }
        }

        mex.ifExceptionThrow();
    }
465622
@SuppressWarnings("rawtypes")
   @Override
   public void configure(Map props) throws HibernateException
   {
      try {
         LOGGER.debug("Configuring HikariCP");

         this.hcfg = HikariConfigurationUtil.loadConfiguration(props);
         this.hds = new HikariDataSource(this.hcfg);

      }
      catch (Exception e) {
         throw new HibernateException(e);
      }

      LOGGER.debug("HikariCP Configured");
   }
955553
public void init(final Authentication authentication, final Properties props) {
        this.authentication = authentication;
        shardingProperties = new ShardingProperties(props);
    }
661072
private void initJedisPool(Properties props) {
        JedisPoolConfig config = new JedisPoolConfig();

        config.setTestOnBorrow(true);

        Integer maxIdle = Integer.parseInt(props.getProperty("session.redis.pool.max.idle", "2"));
        config.setMaxIdle(maxIdle);

        Integer maxTotal = Integer.parseInt(props.getProperty("session.redis.pool.max.total", "5"));
        config.setMaxTotal(maxTotal);

        final String mode = props.getProperty("session.redis.mode");
        if (Objects.equal(mode, SENTINEL_MODE)){
            // sentinel
            this.executor = new RedisExecutor(config, true, props);
        } else {
            // standalone
            this.executor = new RedisExecutor(config, false, props);
        }
    }
576722
public static void initApplication(Application app){
		
		// Add the Jawr tag handler to the MarkupParserFactory 
		MarkupFactory factory = new MarkupFactory(){
			
			public MarkupParser newMarkupParser(final MarkupResourceStream resource)
		    {
		       MarkupParser parser = new MarkupParser(new XmlPullParser(), resource);
		       parser.add(new JawrWicketLinkTagHandler());
		       return parser;
		    }
		};
		
		app.getMarkupSettings().setMarkupFactory(factory);
		
		// Add the Jawr link resolver
		app.getPageSettings().addComponentResolver(new JawrWicketLinkResolver());
	}
1291049
public static void initialize()
        throws CacheReloadException
    {
        if (InfinispanCache.get().exists(JAASSystem.IDCACHE)) {
            InfinispanCache.get().<Long, JAASSystem>getCache(JAASSystem.IDCACHE).clear();
        } else {
            InfinispanCache.get().<Long, JAASSystem>getCache(JAASSystem.IDCACHE)
                            .addListener(new CacheLogListener(JAASSystem.LOG));
        }
        if (InfinispanCache.get().exists(JAASSystem.NAMECACHE)) {
            InfinispanCache.get().<String, JAASSystem>getCache(JAASSystem.NAMECACHE).clear();
        } else {
            InfinispanCache.get().<String, JAASSystem>getCache(JAASSystem.NAMECACHE)
                            .addListener(new CacheLogListener(JAASSystem.LOG));
        }
        JAASSystem.getJAASSystemFromDB(JAASSystem.SQL_SELECT, null);
    }
183795
public final void initApplicationClassLoader(ClassLoader loader)
    {
        if (loader == null)
            throw new IllegalArgumentException("loader is null");
        if (!Kit.testIfCanLoadRhinoClasses(loader))
            throw new IllegalArgumentException(
                "Loader can not resolve Rhino classes");

        if (this.applicationClassLoader != null)
            throw new IllegalStateException(
                "applicationClassLoader can only be set once");
        checkNotSealed();

        this.applicationClassLoader = loader;
    }