Project

General

Profile

« Previous | Next » 

Revision 5016

Added by daigle almost 15 years ago

Fix references to db classes that were moved and refactoring missed.

View differences:

test/edu/ucsb/nceas/MCTestCase.java
47 47

  
48 48
import org.apache.commons.httpclient.HttpClient;
49 49

  
50
import edu.ucsb.nceas.metacat.DBConnection;
51
import edu.ucsb.nceas.metacat.DBConnectionPool;
50
import edu.ucsb.nceas.metacat.database.DBConnection;
51
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
52 52
import edu.ucsb.nceas.metacat.client.InsufficientKarmaException;
53 53
import edu.ucsb.nceas.metacat.client.Metacat;
54 54
import edu.ucsb.nceas.metacat.client.MetacatException;
test/edu/ucsb/nceas/metacattest/SitemapTest.java
30 30
import java.util.Vector;
31 31

  
32 32
import edu.ucsb.nceas.MCTestCase;
33
import edu.ucsb.nceas.metacat.DBConnectionPool;
33
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
34 34
import edu.ucsb.nceas.metacat.Sitemap;
35 35
import edu.ucsb.nceas.metacat.client.MetacatAuthException;
36 36
import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
test/edu/ucsb/nceas/metacattest/QueryResultBuilderTest.java
29 29
import java.util.Hashtable;
30 30

  
31 31
import edu.ucsb.nceas.MCTestCase;
32
import edu.ucsb.nceas.metacat.DBConnection;
33
import edu.ucsb.nceas.metacat.DBConnectionPool;
32
import edu.ucsb.nceas.metacat.database.DBConnection;
33
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
34 34
import edu.ucsb.nceas.metacat.service.PropertyService;
35 35

  
36 36
import junit.framework.Test;
test/edu/ucsb/nceas/metacattest/EventLogTest.java
28 28
import java.text.SimpleDateFormat;
29 29

  
30 30
import edu.ucsb.nceas.MCTestCase;
31
import edu.ucsb.nceas.metacat.DBConnectionPool;
31
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
32 32
import edu.ucsb.nceas.metacat.EventLog;
33 33

  
34 34
/**
test/edu/ucsb/nceas/metacattest/BuildIndexTest.java
43 43
import edu.ucsb.nceas.metacat.client.MetacatException;
44 44
import edu.ucsb.nceas.metacat.client.MetacatFactory;
45 45
import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
46
import edu.ucsb.nceas.metacat.service.DatabaseService;
46
import edu.ucsb.nceas.metacat.database.DatabaseService;
47 47
import edu.ucsb.nceas.metacat.service.PropertyService;
48 48
import edu.ucsb.nceas.metacat.service.ServiceException;
49 49
import edu.ucsb.nceas.metacat.util.MetacatUtil;
lib/admin/database-configuration.jsp
1 1
<%@ page language="java" %>
2
<%@ page import="java.util.Vector,edu.ucsb.nceas.metacat.DBVersion,edu.ucsb.nceas.metacat.MetaCatVersion" %>
2
<%@ page import="java.util.Vector,edu.ucsb.nceas.metacat.database.DBVersion,edu.ucsb.nceas.metacat.MetaCatVersion" %>
3 3

  
4 4
<% 
5 5
/**
src/edu/ucsb/nceas/metacat/scheduler/SchedulerService.java
38 38
import org.quartz.Scheduler;
39 39
import org.quartz.SchedulerException;
40 40
import org.quartz.SchedulerFactory;
41
import org.quartz.SimpleTrigger;
41 42
import org.quartz.Trigger;
42 43
import org.quartz.TriggerUtils;
43 44

  
......
174 175
	 *            the name of the job
175 176
	 * @param startCal
176 177
	 *            a calendar holding the start date of the job
178
	 * @param endCal
179
	 *            a calendar holding the end date of the job
177 180
	 * @param intervalValue
178 181
	 *            the run interval for the job
179 182
	 * @param intervalUnit
......
235 238
	}
236 239
	
237 240
	/**
241
	 * schedule a job one time with a given delay. The job is registered in the
242
	 * scheduler, but not persisted to the database. The delay is calculated
243
	 * from the time that this method is called.
244
	 * 
245
	 * @param jobName
246
	 *            the name of the job
247
	 * @param delay
248
	 *            the delay in seconds, minutes, hours or days from the time
249
	 *            this method is called (i.e. 30s, 5m, 2h, 1d)
250
	 * @param jobClassName
251
	 *            the job class name
252
	 * @param jobGroup
253
	 *            the job group name
254
	 * @param jobParams
255
	 *            a map of additional job parameters
256
	 * @param username
257
	 *            the user name
258
	 * @param groups
259
	 *            the user's group name
260
	 * @return a message saying that the job was scheduled
261
	 */
262
	public String scheduleDelayedJob(String jobName, String delay, String jobClassName, 
263
			String jobGroup, HashMap<String, String> jobParams, 
264
			String username, String[] groups) throws ServiceException {
265
        
266
        Class<Job> jobClass = null;
267
        try {
268
			jobClass = (Class<Job>) Class.forName(jobClassName);
269
			
270
			Calendar startCal = getStartDateFromDelay(delay);
271

  
272
			logMetacat.info("SchedulerService.scheduleDelayedJob - Scheduling job -- name: "
273
					+ jobName + ", delay: " + delay + ", job class name: " + jobClassName);
274

  
275
			// start the job in the job scheduler
276
			startOneTimeJob(jobName, startCal, jobClass, jobGroup,
277
					jobParams);
278

  
279
		} catch (ClassNotFoundException cnfe) {
280
			throw new ServiceException("SchedulerService.scheduleJob - Could not find class with name: "
281
							+ jobClassName + " : " + cnfe.getMessage());
282
		} 
283
		
284
		return "Scheduled: " + jobName;
285
	}
286
	
287
	/**
238 288
	 * Unschedule a job. This removed it from the scheduler in memory and
239 289
	 * changed it's status to unscheduled in the database.
240 290
	 * 
......
613 663
	 *            the job class object
614 664
	 * @param startTime
615 665
	 *            the time of the first run
666
	 * @param jobGroup
667
	 *            the group of this job
668
	 * @param jobDetail
669
	 *            the job detail object
670
	 */
671
	private void startOneTimeJob(String jobName, Calendar startTime, Class<Job> jobClass, String jobGroup, HashMap<String, String> jobParams) throws ServiceException {
672

  
673
		JobDetail jobDetail = new JobDetail(jobName, jobGroup, jobClass);
674
		jobDetail.setJobDataMap(new JobDataMap(jobParams));
675
		
676
		SimpleTrigger trigger = new SimpleTrigger();
677
		trigger.setName(jobName);
678
		trigger.setStartTime(startTime.getTime());
679
		trigger.setRepeatCount(1);
680

  
681
		try {
682
			sched.scheduleJob(jobDetail, trigger);
683
		} catch (SchedulerException se) {
684
			throw new ServiceException("SchedulerService.scheduleSecondlyJob - Could not create " 
685
					+ "scheduler: " + se.getMessage());
686
		}
687
	}
688
	
689
	/**
690
	 * Schedule a job in the scheduler that has an interval based in seconds
691
	 * 
692
	 * @param jobName
693
	 *            the name of the job
694
	 * @param jobClass
695
	 *            the job class object
696
	 * @param startTime
697
	 *            the time of the first run
616 698
	 * @param interval
617 699
	 *            the interval in seconds between runs
618 700
	 * @param jobGroup

Also available in: Unified diff