summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/certsrv/dbs/IDBSubsystem.java
blob: e82a3a14cf85fd8e31b397364cf4548fa5b7b372 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// (C) 2007 Red Hat, Inc.
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.dbs;


import java.math.*;
import netscape.ldap.*;
import com.netscape.certsrv.base.*;


/**
 * An interface represents certificate server
 * backend database.
 * <P>
 * This interface separate the database subsystem
 * functionalities from internal implementation.
 * <P>
 *
 * @version $Revision$, $Date$ 
 */
public interface IDBSubsystem extends ISubsystem {

    public static final String SUB_ID = "dbs";


    // values for repos
    public static final int CERTS = 0;
    public static final int REQUESTS = 1;
    public static final int REPLICA_ID = 2;
    public static final int NUM_REPOS = 3;

    /**
     * Retrieves the base DN.
     *
     * @return base DN of the subsystem
     */
    public String getBaseDN();

    /**
     * Retrieves the registry.
     *
     * @return registry
     */
    public IDBRegistry getRegistry();

    /**
     * Creates a database session.
     *
     * @return database session
     * @exception EDBException failed to create session
     */
    public IDBSSession createSession() throws EDBException;

    /**
     * Avoids losing serial number.
     *
     * @return true if serial number recovery option is enabled
     */
    public boolean enableSerialNumberRecovery();

    /**
     * Records next serial number in config file
     *
     * @param serial next serial number
     * @exception EBaseException failed to set 
     */
    public void setNextSerialConfig(BigInteger serial) throws EBaseException;

    /**
     * Gets the next serial number in config file
     *
     * @return next serial number
     */
    public BigInteger getNextSerialConfig();

    /**
     * Records maximum serial number limit in config file
     *
     * @param serial max serial number
     * @param repo   repo identifier 
     * @exception EBaseException failed to set 
     */
    public void setMaxSerialConfig(int repo, String serial) throws EBaseException;

    /**
     * Records minimum serial number limit in config file
     *
     * @param serial min serial number
     * @param repo   repo identifier 
     * @exception EBaseException failed to set 
     */
    public void setMinSerialConfig(int repo, String serial) throws EBaseException;

    /**
     * Records maximum serial number limit for the next range in config file
     *
     * @param serial max serial number
     * @param repo   repo identifier 
     * @exception EBaseException failed to set 
     */
    public void setNextMaxSerialConfig(int repo, String serial) throws EBaseException;

    /**
     * Records minimum serial number limit for the next range in config file
     *
     * @param serial min serial number
     * @param repo   repo identifier 
     * @exception EBaseException failed to set 
     */
    public void setNextMinSerialConfig(int repo, String serial) throws EBaseException;

    /**
     * Gets minimum serial number limit in config file
     *
     * @param repo   repo identifier 
     * @return min serial number
     */
    public String getMinSerialConfig(int repo);

    /**
     * Gets the maximum serial number limit in config file
     *
     * @param repo   repo identifier 
     * @return max serial number
     */
    public String getMaxSerialConfig(int repo);

    /**
     * Gets the maximum serial number limit for next range in config file
     *
     * @param repo   repo identifier 
     * @return max serial number
     */
    public String getNextMaxSerialConfig(int repo);

    /**
     * Gets minimum serial number limit for next range in config file
     *
     * @param repo   repo identifier 
     * @return min serial number
     */
    public String getNextMinSerialConfig(int repo);
    
    /**
     * Gets low water mark limit in config file
     *
     * @param repo   repo identifier 
     * @return low water mark
     */
    public String getLowWaterMarkConfig(int repo);
 
    /**
     * Gets range increment limit for next range in config file
     *
     * @param repo   repo identifier 
     * @return range increment
     */
    public String getIncrementConfig(int repo);
  
    /**
     * Gets number corresponding to start of next range from database
     *
     * @param repo   repo identifier 
     * @return start of next range
     */
    public String getNextRange(int repo);

    /**
     * Determines if a range conflict has been observed in database
     *
     * @param repo   repo identifier 
     * @return true if range conflict, false otherwise
     */
    public boolean hasRangeConflict(int repo);

    /**
     * Determines if serial number management has been enabled
     *
     * @return true if enabled, false otherwise
     */
    public boolean getEnableSerialMgmt();

   /**
     * Sets whether serial number management is enabled for certs
     * and requests. 
     *
     * @param value   true/false 
     * @exception EBaseException failed to set 
     */
    public void setEnableSerialMgmt(boolean value) throws EBaseException;

    /**
     * Returns LDAP connection to connection pool.
     *
     * @param conn connection to be returned
     */
    public void returnConn(LDAPConnection conn);
}