StdSchedulerFactory implements SchedulerFactory { static Properties overrideWithSysProps(Properties props, Logger log) { Properties sysProps = null; try { sysProps = System.getProperties(); } catch (AccessControlException e) { log.warn( "Skipping overriding quartz properties with System properties " + "during initialization because of an AccessControlException. " + "This is likely due to not having read/write access for " + "java.util.PropertyPermission as required by java.lang.System.getProperties(). " + "To resolve this warning, either add this permission to your policy file or " + "use a non-default version of initialize().", e); } if (sysProps != null) { Enumeration<?> en = sysProps.propertyNames(); while (en.hasMoreElements()) { Object name = en.nextElement(); Object value = sysProps.get(name); if (name instanceof String && value instanceof String) { props.setProperty((String) name, (String) value); } } } return props; } StdSchedulerFactory();  StdSchedulerFactory(Properties props);  StdSchedulerFactory(String fileName); Logger getLog(); void initialize(); void initialize(String filename); void initialize(InputStream propertiesStream); void initialize(Properties props); Scheduler getScheduler(); static Scheduler getDefaultScheduler(); Scheduler getScheduler(String schedName); Collection<Scheduler> getAllSchedulers(); static final String PROPERTIES_FILE; static final String PROP_SCHED_INSTANCE_NAME; static final String PROP_SCHED_INSTANCE_ID; static final String PROP_SCHED_INSTANCE_ID_GENERATOR_PREFIX; static final String PROP_SCHED_INSTANCE_ID_GENERATOR_CLASS; static final String PROP_SCHED_THREAD_NAME; static final String PROP_SCHED_BATCH_TIME_WINDOW; static final String PROP_SCHED_MAX_BATCH_SIZE; static final String PROP_SCHED_JMX_EXPORT; static final String PROP_SCHED_JMX_OBJECT_NAME; static final String PROP_SCHED_JMX_PROXY; static final String PROP_SCHED_JMX_PROXY_CLASS; static final String PROP_SCHED_RMI_EXPORT; static final String PROP_SCHED_RMI_PROXY; static final String PROP_SCHED_RMI_HOST; static final String PROP_SCHED_RMI_PORT; static final String PROP_SCHED_RMI_SERVER_PORT; static final String PROP_SCHED_RMI_CREATE_REGISTRY; static final String PROP_SCHED_RMI_BIND_NAME; static final String PROP_SCHED_WRAP_JOB_IN_USER_TX; static final String PROP_SCHED_USER_TX_URL; static final String PROP_SCHED_IDLE_WAIT_TIME; static final String PROP_SCHED_DB_FAILURE_RETRY_INTERVAL; static final String PROP_SCHED_MAKE_SCHEDULER_THREAD_DAEMON; static final String PROP_SCHED_SCHEDULER_THREADS_INHERIT_CONTEXT_CLASS_LOADER_OF_INITIALIZING_THREAD; static final String PROP_SCHED_CLASS_LOAD_HELPER_CLASS; static final String PROP_SCHED_JOB_FACTORY_CLASS; static final String PROP_SCHED_JOB_FACTORY_PREFIX; static final String PROP_SCHED_INTERRUPT_JOBS_ON_SHUTDOWN; static final String PROP_SCHED_INTERRUPT_JOBS_ON_SHUTDOWN_WITH_WAIT; static final String PROP_SCHED_CONTEXT_PREFIX; static final String PROP_THREAD_POOL_PREFIX; static final String PROP_THREAD_POOL_CLASS; static final String PROP_JOB_STORE_PREFIX; static final String PROP_JOB_STORE_LOCK_HANDLER_PREFIX; static final String PROP_JOB_STORE_LOCK_HANDLER_CLASS; static final String PROP_TABLE_PREFIX; static final String PROP_SCHED_NAME; static final String PROP_JOB_STORE_CLASS; static final String PROP_JOB_STORE_USE_PROP; static final String PROP_DATASOURCE_PREFIX; static final String PROP_CONNECTION_PROVIDER_CLASS; @Deprecated
    static final String PROP_DATASOURCE_DRIVER; @Deprecated
    static final String PROP_DATASOURCE_URL; @Deprecated
    static final String PROP_DATASOURCE_USER; @Deprecated
    static final String PROP_DATASOURCE_PASSWORD; @Deprecated
    static final String PROP_DATASOURCE_MAX_CONNECTIONS; @Deprecated
    static final String PROP_DATASOURCE_VALIDATION_QUERY; static final String PROP_DATASOURCE_JNDI_URL; static final String PROP_DATASOURCE_JNDI_ALWAYS_LOOKUP; static final String PROP_DATASOURCE_JNDI_INITIAL; static final String PROP_DATASOURCE_JNDI_PROVDER; static final String PROP_DATASOURCE_JNDI_PRINCIPAL; static final String PROP_DATASOURCE_JNDI_CREDENTIALS; static final String PROP_PLUGIN_PREFIX; static final String PROP_PLUGIN_CLASS; static final String PROP_JOB_LISTENER_PREFIX; static final String PROP_TRIGGER_LISTENER_PREFIX; static final String PROP_LISTENER_CLASS; static final String DEFAULT_INSTANCE_ID; static final String AUTO_GENERATE_INSTANCE_ID; static final String PROP_THREAD_EXECUTOR; static final String PROP_THREAD_EXECUTOR_CLASS; static final String SYSTEM_PROPERTY_AS_INSTANCE_ID; static final String MANAGEMENT_REST_SERVICE_ENABLED; static final String MANAGEMENT_REST_SERVICE_HOST_PORT; }
@Test public void testOverrideSystemProperties() { Properties p = new Properties(); p.setProperty("nonsense1", "hello1"); p.setProperty("nonsense2", "hello2"); System.setProperty("nonsense1", "boo1"); String osName = System.getProperty("os.name"); Properties q = StdSchedulerFactory.overrideWithSysProps(p, NOPLogger.NOP_LOGGER); assertEquals("boo1", q.get("nonsense1")); assertEquals(osName, q.get("os.name")); }