1 | /*
|
---|
2 | * NzdlCollectionInfo.java
|
---|
3 | * Copyright (C) 2001 New Zealand Digital Library Project
|
---|
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
|
---|
21 | package org.nzdl.gsdl.service;
|
---|
22 |
|
---|
23 | /** gsdl corba stuff */
|
---|
24 | import org.nzdl.gsdl.corba.gsdlInterface.*;
|
---|
25 | import org.nzdl.gsdl.util.*;
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * An object that stores information on a collection. Information is obtained from
|
---|
29 | * {@link NzdlService NzdlService.getCollectionInfo(name)}
|
---|
30 | * Easily interrogated by a user.
|
---|
31 | *
|
---|
32 | * @author Stuart Yeates ([email protected])
|
---|
33 | * @author Aziz Mahoui ([email protected])
|
---|
34 | * @author Gordon Paynter ([email protected])
|
---|
35 | * @author Dave Nichols ([email protected])
|
---|
36 | * @author Brett Sheeran ([email protected]) (comments)
|
---|
37 | * @version $Revision: 2179 $
|
---|
38 | */
|
---|
39 | public class NzdlCollectionInfo extends Object {
|
---|
40 |
|
---|
41 | private corbaColInfoResponse m_Info = null;
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * Create an instance of NzdlCollectionInfo.
|
---|
45 | */
|
---|
46 | public NzdlCollectionInfo( corbaColInfoResponse _info ) {
|
---|
47 | m_Info = _info;
|
---|
48 | if (!getHTTPDomain().equals(""))
|
---|
49 | System.out.println("getHTTPDomain working !");
|
---|
50 | if (!getName().equals(""))
|
---|
51 | System.out.println("getName working !");
|
---|
52 | }
|
---|
53 |
|
---|
54 | /**
|
---|
55 | * Returns the corbaInfoResponse.
|
---|
56 | */
|
---|
57 | public corbaColInfoResponse getInfo(){
|
---|
58 | return m_Info;
|
---|
59 | }
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Returns the name of a collection. <br>
|
---|
63 | * Pre: Created instance of NzdlCollectionInfo. Used
|
---|
64 | * {@link NzdlService NzdlService.getCollectionInfo(name)}
|
---|
65 | * to extract collection information.
|
---|
66 | * @return A string representing the name of the collection.
|
---|
67 | */
|
---|
68 | public String getName() {
|
---|
69 | return NzdlCorbaFactory.toString( m_Info.shoftInfo.name ) ;
|
---|
70 | }
|
---|
71 | /**
|
---|
72 | * Returns HTTP Prefix
|
---|
73 | */
|
---|
74 | public String getHTTPPrefix() {
|
---|
75 | //return m_Info.httpprefix.text.toString();
|
---|
76 | return NzdlCorbaFactory.toString( m_Info.httpprefix ) ;
|
---|
77 | }
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * Returns HTTP Domain
|
---|
81 | */
|
---|
82 | public String getHTTPDomain() {
|
---|
83 | return NzdlCorbaFactory.toString( m_Info.httpdomain ) ;
|
---|
84 | }
|
---|
85 |
|
---|
86 | /**
|
---|
87 | * Returns reseptionist
|
---|
88 | */
|
---|
89 | public String getReceptionist() {
|
---|
90 | return NzdlCorbaFactory.toString( m_Info.receptionist ) ;
|
---|
91 | }
|
---|
92 |
|
---|
93 | /**
|
---|
94 | * Returns true if collection is public. <br>
|
---|
95 | * Pre: Created instance of NzdlCollectionInfo. Used
|
---|
96 | * {@link NzdlService NzdlService.getCollectionInfo(name)}
|
---|
97 | * to extract collection information.
|
---|
98 | * @return Boolean true if collection is public, otherwise returns false.
|
---|
99 | */
|
---|
100 | public boolean isPublic() {
|
---|
101 | return m_Info.isPublic;
|
---|
102 | }
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * Returns true if collection is a beta version. <br>
|
---|
106 | * Pre: Created instance of NzdlCollectionInfo. Used
|
---|
107 | * {@link NzdlService NzdlService.getCollectionInfo(name)}
|
---|
108 | * to extract collection information.
|
---|
109 | * @return Boolean true if collection is a beta version, otherwise returns false.
|
---|
110 | */
|
---|
111 | public boolean isBeta() {
|
---|
112 | return m_Info.isBeta;
|
---|
113 | }
|
---|
114 |
|
---|
115 | /**
|
---|
116 | * Returns an integer representation of build date. <br>
|
---|
117 | * Pre: Created instance of NzdlCollectionInfo. Used
|
---|
118 | * {@link NzdlService NzdlService.getCollectionInfo(name)}
|
---|
119 | * to extract collection information.
|
---|
120 | * @return Integer representation of date.
|
---|
121 | */
|
---|
122 | public int getBuildDate() {
|
---|
123 | return m_Info.buildDate;
|
---|
124 | }
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * Returns the number of documents in a collection. <br>
|
---|
128 | * Pre: Created instance of NzdlCollectionInfo. Used
|
---|
129 | * {@link NzdlService NzdlService.getCollectionInfo(name)}
|
---|
130 | * to extract collection information.
|
---|
131 | * @return An integer representing the number of documents in the collection.
|
---|
132 | */
|
---|
133 | public int getNumOfDocs() {
|
---|
134 | return m_Info.numDocs;
|
---|
135 | }
|
---|
136 |
|
---|
137 | /**
|
---|
138 | * Returns the number of words in a collection. <br>
|
---|
139 | * Pre: Created instance of NzdlCollectionInfo. Used
|
---|
140 | * {@link NzdlService NzdlService.getCollectionInfo(name)}
|
---|
141 | * to extract collection information.
|
---|
142 | * @return An integer representing the number of words in the collection.
|
---|
143 | */
|
---|
144 | public int getNumOfWords() {
|
---|
145 | return m_Info.numWords;
|
---|
146 | }
|
---|
147 |
|
---|
148 | /**
|
---|
149 | * Returns the number of bytes in the collection. <br>
|
---|
150 | * Pre: Created instance of NzdlCollectionInfo. Used
|
---|
151 | * {@link NzdlService NzdlService.getCollectionInfo(name)}
|
---|
152 | * to extract collection information.
|
---|
153 | * @return An integer representing the number of bytes in the collection.
|
---|
154 | */
|
---|
155 | public int getNumOfBytes() {
|
---|
156 | return m_Info.numBytes;
|
---|
157 | }
|
---|
158 |
|
---|
159 | /**
|
---|
160 | * Returns a string describing collection details. <br>
|
---|
161 | * Pre: Created instance of NzdlCollectionInfo. Used
|
---|
162 | * {@link NzdlService NzdlService.getCollectionInfo(name)}
|
---|
163 | * to extract collection information.
|
---|
164 | * @return A string describing collection details such as: collection name;
|
---|
165 | * isPublic; isBeta; buildDate; numOfDocs; numOfWords; numOfBytes
|
---|
166 | */
|
---|
167 | public String toString() {
|
---|
168 | StringBuffer buf = new StringBuffer(1000);
|
---|
169 | buf.append("coll name=\"").append(getName());
|
---|
170 | buf.append("\" isPublic=").append(isPublic());
|
---|
171 | buf.append(" isBeta=").append(isBeta());
|
---|
172 | buf.append(" buildDate=").append(getBuildDate());
|
---|
173 | buf.append(" numOfDocs=").append(getNumOfDocs());
|
---|
174 | buf.append(" numOfWords=").append(getNumOfWords());
|
---|
175 | buf.append(" numOfBytes=").append(getNumOfBytes());
|
---|
176 | return buf.toString();
|
---|
177 | }
|
---|
178 |
|
---|
179 | /**
|
---|
180 | * Not currently implemented
|
---|
181 | */
|
---|
182 | public void print() {
|
---|
183 | /* [email protected] */
|
---|
184 | //System.out.println("Collection Information--------------");
|
---|
185 | //System.out.println("Collection Name = " + this.getName());
|
---|
186 | //System.out.println("Collection Name = " + m_info.getName());
|
---|
187 |
|
---|
188 | }
|
---|
189 |
|
---|
190 | }
|
---|
191 |
|
---|
192 |
|
---|
193 |
|
---|
194 |
|
---|
195 |
|
---|
196 |
|
---|
197 |
|
---|
198 |
|
---|