1
|
/**
|
2
|
* '$RCSfile$'
|
3
|
* Purpose: A Class that implements utility methods like:
|
4
|
* 1/ Reding all doctypes from db connection
|
5
|
* 2/ Reading DTD or Schema file from Metacat catalog system
|
6
|
* 3/ Reading Lore type Data Guide from db connection
|
7
|
* Copyright: 2000 Regents of the University of California and the
|
8
|
* National Center for Ecological Analysis and Synthesis
|
9
|
* Authors: Jivka Bojilova
|
10
|
*
|
11
|
* '$Author: daigle $'
|
12
|
* '$Date: 2009-08-04 14:32:58 -0700 (Tue, 04 Aug 2009) $'
|
13
|
* '$Revision: 5015 $'
|
14
|
*
|
15
|
* This program is free software; you can redistribute it and/or modify
|
16
|
* it under the terms of the GNU General Public License as published by
|
17
|
* the Free Software Foundation; either version 2 of the License, or
|
18
|
* (at your option) any later version.
|
19
|
*
|
20
|
* This program is distributed in the hope that it will be useful,
|
21
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23
|
* GNU General Public License for more details.
|
24
|
*
|
25
|
* You should have received a copy of the GNU General Public License
|
26
|
* along with this program; if not, write to the Free Software
|
27
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
28
|
*/
|
29
|
|
30
|
package edu.ucsb.nceas.metacat.shared;
|
31
|
|
32
|
|
33
|
/**
|
34
|
* A suite of utility classes for querying DB
|
35
|
*
|
36
|
*/
|
37
|
public abstract class BaseService {
|
38
|
protected String _serviceName = null;
|
39
|
|
40
|
// package level method reporting if service is refreshable. Basically,
|
41
|
// we only want ServiceService calling this.
|
42
|
public abstract boolean refreshable();
|
43
|
|
44
|
// subclass must define doRefresh. It is only called from the refresh() method.
|
45
|
protected abstract void doRefresh() throws ServiceException;
|
46
|
|
47
|
// package level method to refresh service. We only want ServiceService
|
48
|
// calling this.
|
49
|
public void refresh() throws ServiceException{
|
50
|
if (refreshable()) {
|
51
|
doRefresh();
|
52
|
} else {
|
53
|
throw new ServiceException("Service: " + _serviceName + " is not refreshable");
|
54
|
}
|
55
|
}
|
56
|
|
57
|
public abstract void stop() throws ServiceException;
|
58
|
|
59
|
}
|