summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/certsrv/base
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2013-08-07 00:00:59 -0400
committerEndi S. Dewata <edewata@redhat.com>2013-08-20 14:23:18 -0400
commit6d99354ce9e2f1250538eb31a8b7e2e788518892 (patch)
treefc3af79644a1d8ad311502a4e38f7896693c1fba /base/common/src/com/netscape/certsrv/base
parent4a2880f466451d8089409d83474a7339bffffe25 (diff)
downloadpki-6d99354ce9e2f1250538eb31a8b7e2e788518892.tar.gz
pki-6d99354ce9e2f1250538eb31a8b7e2e788518892.tar.xz
pki-6d99354ce9e2f1250538eb31a8b7e2e788518892.zip
Added generic database.
A new generic database class has been added to simplify in-memory database creation. The token database has been refactored to inherit this class. Ticket #652
Diffstat (limited to 'base/common/src/com/netscape/certsrv/base')
-rw-r--r--base/common/src/com/netscape/certsrv/base/DataCollection.java68
1 files changed, 68 insertions, 0 deletions
diff --git a/base/common/src/com/netscape/certsrv/base/DataCollection.java b/base/common/src/com/netscape/certsrv/base/DataCollection.java
new file mode 100644
index 000000000..0237e8fcc
--- /dev/null
+++ b/base/common/src/com/netscape/certsrv/base/DataCollection.java
@@ -0,0 +1,68 @@
+// --- 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) 2013 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+
+package com.netscape.certsrv.base;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.xml.bind.annotation.XmlElement;
+
+import org.jboss.resteasy.plugins.providers.atom.Link;
+
+/**
+ * @author Endi S. Dewata
+ */
+public class DataCollection<E> {
+
+ Collection<E> entries = new ArrayList<E>();
+ Collection<Link> links = new ArrayList<Link>();
+
+ public Collection<E> getEntries() {
+ return entries;
+ }
+
+ public void setEntries(Collection<E> entries) {
+ this.entries = entries;
+ }
+
+ public void addEntry(E entry) {
+ entries.add(entry);
+ }
+
+ public void removeEntry(E entry) {
+ entries.remove(entry);
+ }
+
+ @XmlElement(name="Link")
+ public Collection<Link> getLinks() {
+ return links;
+ }
+
+ public void setLink(Collection<Link> links) {
+ this.links = links;
+ }
+
+ public void addLink(Link link) {
+ links.add(link);
+ }
+
+ public void removeLink(Link link) {
+ links.remove(link);
+ }
+}