source: trunk/java-client/org/nzdl/gsdl/hli/Collection.java@ 2254

Last change on this file since 2254 was 2220, checked in by say1, 23 years ago

change int-> long in a number of places, new createNzdlService method taking only an IOR, added the start of a hli (high level interface

  • Property svn:keywords set to Author Date Id Revision
File size: 6.4 KB
Line 
1/*
2 * Collection.java
3 * Copyright (C) 2000 Stuart Yeates
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20// the package we're in
21package org.nzdl.gsdl.hli;
22
23import org.nzdl.gsdl.service.*;
24import org.nzdl.gsdl.corba.gsdlInterface.*;
25import org.nzdl.gsdl.util.*;
26
27// java standard library classes used
28import java.io.IOException;
29import java.io.Serializable;
30import java.lang.Cloneable;
31import java.util.Vector;
32import java.util.Set;
33import java.util.Iterator;
34import java.util.Enumeration;
35import java.util.Date;
36
37/**
38 * Class ...
39 *
40 * Based on algorithms in ...
41 *
42 * @author stuart yeates ([email protected])
43 * @version $Revision: 2220 $
44 * @see
45 * @see
46 * @see
47 *
48 */
49
50public class Collection implements Cloneable, Serializable
51{
52 Server server = null;
53
54 /** Collection name */
55 String name = "empty collection name";
56 /** Collection name */
57 public String getName() { return name; };
58 /** Collection name */
59 public void setName(String str) { name = str; };
60
61 /** Collection display name */
62 String displayName = "empty collection display name";
63 /** Collection display name */
64 public String getDisplayName() { return displayName; };
65 /** Collection display name */
66 public void setDisplayName(String str) { displayName = str; };
67
68 /** Collection about text */
69 String aboutText = "empty about text";
70 /** Collection about text */
71 public String getAboutText() { return aboutText; };
72 /** Collection about text */
73 public void setAboutText(String str) { aboutText = str; };
74
75 /** Beta status */
76 boolean beta = true;
77 /** Beta status */
78 public boolean get() { return beta; };
79 /** Beta status */
80 public void set(boolean str) { beta = str; };
81
82 /** The date the collection was built */
83 Date buildDate = new Date();
84 /** The date the collection was built */
85 public Date getBuildDate() { return buildDate; };
86 /** The date the collection was built */
87 public void setBuildDate(Date str) {buildDate = str; };
88
89 /** Docs in Collection */
90 long docsInCollection = 0;
91 /** Docs in Collection */
92 public long getDocsInCollection() { return docsInCollection; };
93 /** Docs in Collection */
94 public void setDocsInCollection(long str) {docsInCollection = str; };
95
96 /** Words in Collection */
97 long wordsInCollection = 0;
98 /** Words in Collection */
99 public long getWordsInCollection() { return wordsInCollection; };
100 /** Words in Collection */
101 public void setWordsInCollection(long str) { wordsInCollection = str; };
102
103 /** Bytes in Collection */
104 long bytesInCollection = 0;
105 /** Bytes in Collection */
106 public long getBytesInCollection() { return bytesInCollection; };
107 /** Bytes in Collection */
108 public void setBytesInCollection(long str) { bytesInCollection = str; };
109
110 /** Collection Level MetaData */
111 Vector collectionLevelMetadata = null;
112 /** Collection Level MetaData */
113 public Vector getCollectionLevelMetadata() { return collectionLevelMetadata; };
114 /** Collection Level MetaData */
115 public void setCollectionLevelMetadata(Vector str) { collectionLevelMetadata = str; };
116
117 /** Building (unclear what this is ...) */
118 Vector building = null;
119 /** Building (unclear what this is ...) */
120 public Vector getBuilding() { return building; };
121 /** Building (unclear what this is ...) */
122 public void setBuilding(Vector str) { building = str; };
123
124 /** Format (unclear what this is ...) */
125 Vector format = null;
126 /** Format (unclear what this is ...) */
127 public Vector getFormat() { return format; };
128 /** Format (unclear what this is ...) */
129 public void setFormat(Vector str) { format = str; };
130
131 class NamedValue {
132 String name;
133 String value;
134 NamedValue(String name, String value) {this.name=name;this.value=value;};
135 }
136
137 Collection(Server sever, String name, NzdlCollectionInfo info) {
138 this.server = server;
139 this.name = name;
140
141 this.beta = info.isBeta();
142 this.buildDate = new Date(info.getBuildDate()*1000);
143 this.docsInCollection = info.getNumOfDocs();
144 this.wordsInCollection = info.getNumOfWords();
145 this.bytesInCollection = info.getNumOfBytes();
146
147 this.collectionLevelMetadata = new Vector();
148 {
149 corbatext_t[] names = info.getInfo().collectionMeta.names;
150 corbatext_t[] values = info.getInfo().collectionMeta.values;
151 for (int i = 0; i < names.length;i++) {
152 String thisname = NzdlCorbaFactory.toString(names[i]);
153 String thisvalue = NzdlCorbaFactory.toString(values[i]);
154 if (thisname == "collectionname")
155 displayName = thisvalue;
156 if (thisname == "collectionextra")
157 aboutText = thisvalue;
158 this.collectionLevelMetadata.add(new NamedValue(thisname,thisvalue));
159 System.err.println("Metadata: \"" + thisname + "\" = \"" + thisvalue + "\"");
160 }
161 }
162 this.building = new Vector();
163 {
164 corbatext_t[] names = info.getInfo().building.names;
165 corbatext_t[] values = info.getInfo().building.values;
166 for (int i = 0; i < names.length;i++) {
167 String thisname = NzdlCorbaFactory.toString(names[i]);
168 String thisvalue = NzdlCorbaFactory.toString(values[i]);
169 this.building.add(new NamedValue(thisname,thisvalue));
170 System.err.println("Building: \"" + thisname + "\" = \"" + thisvalue + "\"");
171 }
172 }
173 this.format = new Vector();
174 {
175 corbatext_t[] names = info.getInfo().format.names;
176 corbatext_t[] values = info.getInfo().format.values;
177 for (int i = 0; i < names.length;i++) {
178 String thisname = NzdlCorbaFactory.toString(names[i]);
179 String thisvalue = NzdlCorbaFactory.toString(values[i]);
180 this.format.add(new NamedValue(thisname,thisvalue));
181 System.err.println("Format: \"" + thisname + "\" = \"" + thisvalue + "\"");
182 }
183 }
184 }
185
186
187
188 /**
189 * Tests...
190 *
191 *
192 * @exception java.io.IOException when ...
193 * @param args the arguments ...
194 */
195
196 public static void main(String args[]) throws IOException
197 {
198 }
199}
200
Note: See TracBrowser for help on using the repository browser.