All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.quartz.core.QuartzSchedulerResources Maven / Gradle / Ivy

Go to download

SDK for dev_appserver (local development) with some of the dependencies shaded (repackaged)

There is a newer version: 2.0.31
Show newest version

/* 
 * Copyright 2004-2005 OpenSymphony 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 
 * use this file except in compliance with the License. You may obtain a copy 
 * of the License at 
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0 
 *   
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 
 * License for the specific language governing permissions and limitations 
 * under the License.
 * 
 */

/*
 * Previously Copyright (c) 2001-2004 James House
 */
package org.quartz.core;

import org.quartz.spi.JobStore;
import org.quartz.spi.ThreadPool;

/**
 * 

* Contains all of the resources (JobStore,ThreadPool, * etc.) necessary to create a {@link QuartzScheduler} instance. *

* * @see QuartzScheduler * * @author James House */ public class QuartzSchedulerResources { /* * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * Data members. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ public static final String CREATE_REGISTRY_NEVER = "never"; public static final String CREATE_REGISTRY_ALWAYS = "always"; public static final String CREATE_REGISTRY_AS_NEEDED = "as_needed"; private String name; private String instanceId; private String threadName; private String rmiRegistryHost = null; private int rmiRegistryPort = 1099; private int rmiServerPort = -1; private String rmiCreateRegistryStrategy = CREATE_REGISTRY_NEVER; private ThreadPool threadPool; private JobStore jobStore; private JobRunShellFactory jobRunShellFactory; /* * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * Constructors. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /** *

* Create an instance with no properties initialized. *

*/ public QuartzSchedulerResources() { // do nothing... } /* * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * Interface. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /** *

* Get the name for the {@link QuartzScheduler}. *

*/ public String getName() { return name; } /** *

* Set the name for the {@link QuartzScheduler}. *

* * @exception IllegalArgumentException * if name is null or empty. */ public void setName(String name) { if (name == null || name.trim().length() == 0) throw new IllegalArgumentException( "Scheduler name cannot be empty."); this.name = name; if (threadName == null) { // thread name not already set, use default thread name setThreadName(name + "_QuartzSchedulerThread"); } } /** *

* Get the instance Id for the {@link QuartzScheduler}. *

*/ public String getInstanceId() { return instanceId; } /** *

* Set the name for the {@link QuartzScheduler}. *

* * @exception IllegalArgumentException * if name is null or empty. */ public void setInstanceId(String instanceId) { if (instanceId == null || instanceId.trim().length() == 0) throw new IllegalArgumentException( "Scheduler instanceId cannot be empty."); this.instanceId = instanceId; } public static String getUniqueIdentifier(String schedName, String schedInstId) { return schedName + "_$_" + schedInstId; } public String getUniqueIdentifier() { return getUniqueIdentifier(name, instanceId); } /** *

* Get the host name of the RMI Registry that the scheduler should export * itself to. *

*/ public String getRMIRegistryHost() { return rmiRegistryHost; } /** *

* Set the host name of the RMI Registry that the scheduler should export * itself to. *

*/ public void setRMIRegistryHost(String hostName) { this.rmiRegistryHost = hostName; } /** *

* Get the port number of the RMI Registry that the scheduler should export * itself to. *

*/ public int getRMIRegistryPort() { return rmiRegistryPort; } /** *

* Set the port number of the RMI Registry that the scheduler should export * itself to. *

*/ public void setRMIRegistryPort(int port) { this.rmiRegistryPort = port; } /** *

* Get the port number the scheduler server will be bound to. *

*/ public int getRMIServerPort() { return rmiServerPort; } /** *

* Set the port number the scheduler server will be bound to. *

*/ public void setRMIServerPort(int port) { this.rmiServerPort = port; } /** *

* Get the setting of whether or not Quartz should create an RMI Registry, * and if so, how. *

*/ public String getRMICreateRegistryStrategy() { return rmiCreateRegistryStrategy; } /** *

* Get the name for the {@link QuartzSchedulerThread}. *

*/ public String getThreadName() { return threadName; } /** *

* Set the name for the {@link QuartzSchedulerThread}. *

* * @exception IllegalArgumentException * if name is null or empty. */ public void setThreadName(String threadName) { if (threadName == null || threadName.trim().length() == 0) throw new IllegalArgumentException( "Scheduler thread name cannot be empty."); this.threadName = threadName; } /** *

* Set whether or not Quartz should create an RMI Registry, and if so, how. *

* * @see #CREATE_REGISTRY_ALWAYS * @see #CREATE_REGISTRY_AS_NEEDED * @see #CREATE_REGISTRY_NEVER */ public void setRMICreateRegistryStrategy(String rmiCreateRegistryStrategy) { if (rmiCreateRegistryStrategy == null || rmiCreateRegistryStrategy.trim().length() == 0) rmiCreateRegistryStrategy = CREATE_REGISTRY_NEVER; else if (rmiCreateRegistryStrategy.equalsIgnoreCase("true")) rmiCreateRegistryStrategy = CREATE_REGISTRY_AS_NEEDED; else if (rmiCreateRegistryStrategy.equalsIgnoreCase("false")) rmiCreateRegistryStrategy = CREATE_REGISTRY_NEVER; else if (rmiCreateRegistryStrategy .equalsIgnoreCase(CREATE_REGISTRY_ALWAYS)) rmiCreateRegistryStrategy = CREATE_REGISTRY_ALWAYS; else if (rmiCreateRegistryStrategy .equalsIgnoreCase(CREATE_REGISTRY_AS_NEEDED)) rmiCreateRegistryStrategy = CREATE_REGISTRY_AS_NEEDED; else if (rmiCreateRegistryStrategy .equalsIgnoreCase(CREATE_REGISTRY_NEVER)) rmiCreateRegistryStrategy = CREATE_REGISTRY_NEVER; else throw new IllegalArgumentException( "Faild to set RMICreateRegistryStrategy - strategy unknown: '" + rmiCreateRegistryStrategy + "'"); this.rmiCreateRegistryStrategy = rmiCreateRegistryStrategy; } /** *

* Get the {@link ThreadPool} for the {@link QuartzScheduler} * to use. *

*/ public ThreadPool getThreadPool() { return threadPool; } /** *

* Set the {@link ThreadPool} for the {@link QuartzScheduler} * to use. *

* * @exception IllegalArgumentException * if threadPool is null. */ public void setThreadPool(ThreadPool threadPool) { if (threadPool == null) throw new IllegalArgumentException("ThreadPool cannot be null."); this.threadPool = threadPool; } /** *

* Get the {@link JobStore} for the {@link QuartzScheduler} * to use. *

*/ public JobStore getJobStore() { return jobStore; } /** *

* Set the {@link JobStore} for the {@link QuartzScheduler} * to use. *

* * @exception IllegalArgumentException * if jobStore is null. */ public void setJobStore(JobStore jobStore) { if (jobStore == null) throw new IllegalArgumentException("JobStore cannot be null."); this.jobStore = jobStore; } /** *

* Get the {@link JobRunShellFactory} for the {@link QuartzScheduler} * to use. *

*/ public JobRunShellFactory getJobRunShellFactory() { return jobRunShellFactory; } /** *

* Set the {@link JobRunShellFactory} for the {@link QuartzScheduler} * to use. *

* * @exception IllegalArgumentException * if jobRunShellFactory is null. */ public void setJobRunShellFactory(JobRunShellFactory jobRunShellFactory) { if (jobRunShellFactory == null) throw new IllegalArgumentException( "JobRunShellFactory cannot be null."); this.jobRunShellFactory = jobRunShellFactory; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy