Example #1
0
        public virtual void contextInitialized(ServletContextEvent sce)
        {
            string dateFormat = sce.ServletContext.getInitParameter(CONTEXT_PARAM_NAME);

            if (!string.ReferenceEquals(dateFormat, null))
            {
                JacksonConfigurator.DateFormatString = dateFormat;
            }
        }
Example #2
0
        public virtual void contextInitialized(ServletContextEvent sce)
        {
            string contextParameter = sce.ServletContext.getInitParameter(CONTEXT_PARAM_NAME);

            if (!string.ReferenceEquals(contextParameter, null))
            {
                configureCaches(contextParameter);
            }
        }
Example #3
0
 public override void contextInitialized(ServletContextEvent sce)
 {
     if (fetchAndLockHandler == null)
     {
         fetchAndLockHandler = lookupFetchAndLockHandler();
         fetchAndLockHandler.contextInitialized(sce);
         fetchAndLockHandler.start();
     }
 }
Example #4
0
 public virtual void ContextDestroyed(ServletContextEvent sce)
 {
     kmsAudit.Shutdown();
     kmsAcls.StopReloader();
     jmxReporter.Stop();
     jmxReporter.Close();
     metricRegistry = null;
     Log.Info("KMS Stopped");
 }
Example #5
0
		public virtual void contextInitialized(ServletContextEvent arg0)
		{

			base.contextInitialized(arg0);

			logger.info("start to load ContextListener");

			isInitialized = true;
			logger.info("end of ContextListener");
		}
Example #6
0
        public virtual void contextInitialized(ServletContextEvent sce)
        {
            servletContext     = sce.ServletContext;
            servletContextPath = servletContext.ContextPath;
            servletContextName = sce.ServletContext.ServletContextName;

            processApplicationClassloader = initProcessApplicationClassloader(sce);

            // perform lifecycle start
            deploy();
        }
Example #7
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public static ClassLoader getServletContextClassloader(final javax.servlet.ServletContextEvent sce)
        public static ClassLoader getServletContextClassloader(ServletContextEvent sce)
        {
            if (System.SecurityManager != null)
            {
                return(AccessController.doPrivileged(new PrivilegedActionAnonymousInnerClass4(sce)));
            }
            else
            {
                return(sce.ServletContext.ClassLoader);
            }
        }
Example #8
0
 protected internal virtual ClassLoader initProcessApplicationClassloader(ServletContextEvent sce)
 {
     if (isServlet30ApiPresent(sce) && this.GetType().Equals(typeof(ServletProcessApplication)))
     {
         return(ClassLoaderUtil.getServletContextClassloader(sce));
     }
     else
     {
         return(ClassLoaderUtil.getClassloader(this.GetType()));
     }
 }
Example #9
0
 /// <summary>
 /// Initializes the <code>ServletContextListener</code> which initializes
 /// the Server.
 /// </summary>
 /// <param name="event">servelt context event.</param>
 public virtual void ContextInitialized(ServletContextEvent @event)
 {
     try
     {
         Init();
     }
     catch (ServerException ex)
     {
         @event.GetServletContext().Log("ERROR: " + ex.Message);
         throw new RuntimeException(ex);
     }
 }
Example #10
0
        public virtual void contextDestroyed(ServletContextEvent sce)
        {
            // perform lifecycle stop
            undeploy();

            // clear the reference
            if (reference != null)
            {
                reference.clear();
            }
            reference = null;
        }
Example #11
0
        public virtual void contextInitialized(ServletContextEvent servletContextEvent)
        {
            ServletContext servletContext = null;

            if (servletContextEvent != null)
            {
                servletContext = servletContextEvent.ServletContext;

                if (servletContext != null)
                {
                    parseUniqueWorkerRequestParam(servletContext.getInitParameter(UNIQUE_WORKER_REQUEST_PARAM_NAME));
                }
            }
        }
Example #12
0
		public override void contextInitialized(ServletContextEvent arg0)
		{

			logger.info("Load StartupListener start...");

			try
			{

				Locale.Default = Locale.SIMPLIFIED_CHINESE;

			}
			catch (Exception t)
			{
				logger.error(t.Message, t);

				Environment.Exit(-1);
			}

			logger.info("Load StartupListener end...");
		}
Example #13
0
 public virtual void contextDestroyed(ServletContextEvent sce)
 {
     // reset to default format
     JacksonConfigurator.DateFormatString = JacksonConfigurator.DEFAULT_DATE_FORMAT;
 }
Example #14
0
 private bool isServlet30ApiPresent(ServletContextEvent sce)
 {
     return(sce.ServletContext.MajorVersion >= 3);
 }
Example #15
0
 /// <summary>
 /// Destroys the <code>ServletContextListener</code> which destroys
 /// the Server.
 /// </summary>
 /// <param name="event">servelt context event.</param>
 public virtual void ContextDestroyed(ServletContextEvent @event)
 {
     Destroy();
 }
Example #16
0
 public PrivilegedActionAnonymousInnerClass4(ServletContextEvent sce)
 {
     this.sce = sce;
 }
Example #17
0
 public virtual void contextDestroyed(ServletContextEvent arg0)
 {
 }
Example #18
0
        public virtual void contextInitialized(ServletContextEvent contextEvent)
        {
            string contextPath = contextEvent.ServletContext.ContextPath;

            defaultEjbProcessApplication.Properties[org.camunda.bpm.application.ProcessApplicationInfo_Fields.PROP_SERVLET_CONTEXT_PATH] = contextPath;
        }
        /// <seealso cref="ServletContextListener.contextInitialized(ServletContextEvent)">
        /// </seealso>
        //UPGRADE_ISSUE: Class 'javax.servlet.ServletContextEvent' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxservletServletContextEvent'"
        public virtual void contextInitialized(ServletContextEvent sce)
        {
            try
            {

                // WEB-INF/classes and WEB-INF/lib are not in the system classpath (as defined by
                // System.getProperty("java.class.path")); add it to the search path here
                if (firstRun)
                {
                    ClassDiscoveryUtil.addResourceListSource(new WebAppResourceListSource(System.Web.HttpContext.Current.Server.MapPath("//WEB-INF")));
                }
                firstRun = false;

                // The MigrationLauncher is responsible for handling the interaction
                // between the PatchTable and the underlying MigrationTasks; as each
                // task is executed, the patch level is incremented, etc.
                try
                {
                    ADOMigrationLauncherFactory launcherFactory = ADOMigrationLauncherFactoryLoader.createFactory();
                    ADOMigrationLauncher launcher = launcherFactory.createMigrationLauncher(sce);
                    launcher.doMigrations();
                }
                catch (MigrationException e)
                {
                    // Runtime exceptions coming from a ServletContextListener prevent the
                    // application from being deployed.  In this case, the intention is
                    // for migration-enabled applications to fail-fast if there are any
                    // errors during migration.
                    throw new RuntimeException("Migration exception caught during migration", e);
                }
            }
            catch (System.SystemException e)
            {
                // Catch all exceptions for the sole reason of logging in
                // as many places as possible - debugging migration
                // problems requires detection first, and that means
                // getting the word of failures out.
                log.error(e);
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                System.Console.Out.WriteLine(e.Message);
                SupportClass.WriteStackTrace(e, System.Console.Out);
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                System.Console.Error.WriteLine(e.Message);
                SupportClass.WriteStackTrace(e, System.Console.Error);

                throw e;
            }
        }
 /// <seealso cref="ServletContextListener.contextDestroyed(ServletContextEvent)">
 /// </seealso>
 //UPGRADE_ISSUE: Class 'javax.servlet.ServletContextEvent' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxservletServletContextEvent'"
 public virtual void contextDestroyed(ServletContextEvent sce)
 {
     log.debug("context is being destroyed " + sce);
 }
Example #21
0
		public override void contextDestroyed(ServletContextEvent arg0)
		{

		}
Example #22
0
 public virtual void ContextInitialized(ServletContextEvent sce)
 {
     try
     {
         string confDir = Runtime.GetProperty(KMSConfiguration.KmsConfigDir);
         if (confDir == null)
         {
             throw new RuntimeException("System property '" + KMSConfiguration.KmsConfigDir +
                                        "' not defined");
         }
         kmsConf = KMSConfiguration.GetKMSConf();
         InitLogging(confDir);
         Log.Info("-------------------------------------------------------------");
         Log.Info("  Java runtime version : {}", Runtime.GetProperty("java.runtime.version"
                                                                     ));
         Log.Info("  KMS Hadoop Version: " + VersionInfo.GetVersion());
         Log.Info("-------------------------------------------------------------");
         kmsAcls = new KMSACLs();
         kmsAcls.StartReloader();
         metricRegistry = new MetricRegistry();
         jmxReporter    = JmxReporter.ForRegistry(metricRegistry).Build();
         jmxReporter.Start();
         generateEEKCallsMeter  = metricRegistry.Register(GenerateEekMeter, new Meter());
         decryptEEKCallsMeter   = metricRegistry.Register(DecryptEekMeter, new Meter());
         adminCallsMeter        = metricRegistry.Register(AdminCallsMeter, new Meter());
         keyCallsMeter          = metricRegistry.Register(KeyCallsMeter, new Meter());
         invalidCallsMeter      = metricRegistry.Register(InvalidCallsMeter, new Meter());
         unauthorizedCallsMeter = metricRegistry.Register(UnauthorizedCallsMeter, new Meter
                                                              ());
         unauthenticatedCallsMeter = metricRegistry.Register(UnauthenticatedCallsMeter, new
                                                             Meter());
         kmsAudit = new KMSAudit(kmsConf.GetLong(KMSConfiguration.KmsAuditAggregationWindow
                                                 , KMSConfiguration.KmsAuditAggregationWindowDefault));
         // this is required for the the JMXJsonServlet to work properly.
         // the JMXJsonServlet is behind the authentication filter,
         // thus the '*' ACL.
         sce.GetServletContext().SetAttribute(HttpServer2.ConfContextAttribute, kmsConf);
         sce.GetServletContext().SetAttribute(HttpServer2.AdminsAcl, new AccessControlList
                                                  (AccessControlList.WildcardAclValue));
         // intializing the KeyProvider
         string providerString = kmsConf.Get(KMSConfiguration.KeyProviderUri);
         if (providerString == null)
         {
             throw new InvalidOperationException("No KeyProvider has been defined");
         }
         KeyProvider keyProvider = KeyProviderFactory.Get(new URI(providerString), kmsConf
                                                          );
         if (kmsConf.GetBoolean(KMSConfiguration.KeyCacheEnable, KMSConfiguration.KeyCacheEnableDefault
                                ))
         {
             long keyTimeOutMillis = kmsConf.GetLong(KMSConfiguration.KeyCacheTimeoutKey, KMSConfiguration
                                                     .KeyCacheTimeoutDefault);
             long currKeyTimeOutMillis = kmsConf.GetLong(KMSConfiguration.CurrKeyCacheTimeoutKey
                                                         , KMSConfiguration.CurrKeyCacheTimeoutDefault);
             keyProvider = new CachingKeyProvider(keyProvider, keyTimeOutMillis, currKeyTimeOutMillis
                                                  );
         }
         Log.Info("Initialized KeyProvider " + keyProvider);
         keyProviderCryptoExtension = KeyProviderCryptoExtension.CreateKeyProviderCryptoExtension
                                          (keyProvider);
         keyProviderCryptoExtension = new EagerKeyGeneratorKeyProviderCryptoExtension(kmsConf
                                                                                      , keyProviderCryptoExtension);
         if (kmsConf.GetBoolean(KMSConfiguration.KeyAuthorizationEnable, KMSConfiguration.
                                KeyAuthorizationEnableDefault))
         {
             keyProviderCryptoExtension = new KeyAuthorizationKeyProvider(keyProviderCryptoExtension
                                                                          , kmsAcls);
         }
         Log.Info("Initialized KeyProviderCryptoExtension " + keyProviderCryptoExtension);
         int defaultBitlength = kmsConf.GetInt(KeyProvider.DefaultBitlengthName, KeyProvider
                                               .DefaultBitlength);
         Log.Info("Default key bitlength is {}", defaultBitlength);
         Log.Info("KMS Started");
     }
     catch (Exception ex)
     {
         System.Console.Out.WriteLine();
         System.Console.Out.WriteLine("ERROR: Hadoop KMS could not be started");
         System.Console.Out.WriteLine();
         System.Console.Out.WriteLine("REASON: " + ex.ToString());
         System.Console.Out.WriteLine();
         System.Console.Out.WriteLine("Stacktrace:");
         System.Console.Out.WriteLine("---------------------------------------------------"
                                      );
         Runtime.PrintStackTrace(ex, System.Console.Out);
         System.Console.Out.WriteLine("---------------------------------------------------"
                                      );
         System.Console.Out.WriteLine();
         System.Environment.Exit(1);
     }
 }
Example #23
0
 public virtual void contextDestroyed(ServletContextEvent sce)
 {
     Hal.Instance.destroyHalRelationCaches();
 }
Example #24
0
 public override void contextDestroyed(ServletContextEvent sce)
 {
     fetchAndLockHandler.shutdown();
 }
Example #25
0
		public virtual void contextDestroyed(ServletContextEvent arg0)
		{
			base.contextDestroyed(arg0);
		}