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: 2178 $
|
---|
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 | }
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Returns the corbaInfoResponse.
|
---|
52 | */
|
---|
53 | public corbaColInfoResponse getInfo(){
|
---|
54 | return m_Info;
|
---|
55 | }
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * Returns the name of a collection. <br>
|
---|
59 | * Pre: Created instance of NzdlCollectionInfo. Used
|
---|
60 | * {@link NzdlService NzdlService.getCollectionInfo(name)}
|
---|
61 | * to extract collection information.
|
---|
62 | * @return A string representing the name of the collection.
|
---|
63 | */
|
---|
64 | public String getName() {
|
---|
65 | return NzdlCorbaFactory.toString( m_Info.shoftInfo.name ) ;
|
---|
66 | }
|
---|
67 | /**
|
---|
68 | * Returns HTTP Prefix
|
---|
69 | */
|
---|
70 | public String getHTTPPrefix() {
|
---|
71 | //return m_Info.httpprefix.text.toString();
|
---|
72 | return NzdlCorbaFactory.toString( m_Info.httpprefix ) ;
|
---|
73 | }
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * Returns HTTP Domain
|
---|
77 | */
|
---|
78 | public String getHTTPDomain() {
|
---|
79 | return NzdlCorbaFactory.toString( m_Info.httpdomain ) ;
|
---|
80 | }
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * Returns reseptionist
|
---|
84 | */
|
---|
85 | public String getReceptionist() {
|
---|
86 | return NzdlCorbaFactory.toString( m_Info.receptionist ) ;
|
---|
87 | }
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * Returns true if collection is public. <br>
|
---|
91 | * Pre: Created instance of NzdlCollectionInfo. Used
|
---|
92 | * {@link NzdlService NzdlService.getCollectionInfo(name)}
|
---|
93 | * to extract collection information.
|
---|
94 | * @return Boolean true if collection is public, otherwise returns false.
|
---|
95 | */
|
---|
96 | public boolean isPublic() {
|
---|
97 | return m_Info.isPublic;
|
---|
98 | }
|
---|
99 |
|
---|
100 | /**
|
---|
101 | * Returns true if collection is a beta version. <br>
|
---|
102 | * Pre: Created instance of NzdlCollectionInfo. Used
|
---|
103 | * {@link NzdlService NzdlService.getCollectionInfo(name)}
|
---|
104 | * to extract collection information.
|
---|
105 | * @return Boolean true if collection is a beta version, otherwise returns false.
|
---|
106 | */
|
---|
107 | public boolean isBeta() {
|
---|
108 | return m_Info.isBeta;
|
---|
109 | }
|
---|
110 |
|
---|
111 | /**
|
---|
112 | * Returns an integer representation of build date. <br>
|
---|
113 | * Pre: Created instance of NzdlCollectionInfo. Used
|
---|
114 | * {@link NzdlService NzdlService.getCollectionInfo(name)}
|
---|
115 | * to extract collection information.
|
---|
116 | * @return Integer representation of date.
|
---|
117 | */
|
---|
118 | public int getBuildDate() {
|
---|
119 | return m_Info.buildDate;
|
---|
120 | }
|
---|
121 |
|
---|
122 | /**
|
---|
123 | * Returns the number of documents in a collection. <br>
|
---|
124 | * Pre: Created instance of NzdlCollectionInfo. Used
|
---|
125 | * {@link NzdlService NzdlService.getCollectionInfo(name)}
|
---|
126 | * to extract collection information.
|
---|
127 | * @return An integer representing the number of documents in the collection.
|
---|
128 | */
|
---|
129 | public int getNumOfDocs() {
|
---|
130 | return m_Info.numDocs;
|
---|
131 | }
|
---|
132 |
|
---|
133 | /**
|
---|
134 | * Returns the number of words in a collection. <br>
|
---|
135 | * Pre: Created instance of NzdlCollectionInfo. Used
|
---|
136 | * {@link NzdlService NzdlService.getCollectionInfo(name)}
|
---|
137 | * to extract collection information.
|
---|
138 | * @return An integer representing the number of words in the collection.
|
---|
139 | */
|
---|
140 | public int getNumOfWords() {
|
---|
141 | return m_Info.numWords;
|
---|
142 | }
|
---|
143 |
|
---|
144 | /**
|
---|
145 | * Returns the number of bytes in the collection. <br>
|
---|
146 | * Pre: Created instance of NzdlCollectionInfo. Used
|
---|
147 | * {@link NzdlService NzdlService.getCollectionInfo(name)}
|
---|
148 | * to extract collection information.
|
---|
149 | * @return An integer representing the number of bytes in the collection.
|
---|
150 | */
|
---|
151 | public int getNumOfBytes() {
|
---|
152 | return m_Info.numBytes;
|
---|
153 | }
|
---|
154 |
|
---|
155 | /**
|
---|
156 | * Returns a string describing collection details. <br>
|
---|
157 | * Pre: Created instance of NzdlCollectionInfo. Used
|
---|
158 | * {@link NzdlService NzdlService.getCollectionInfo(name)}
|
---|
159 | * to extract collection information.
|
---|
160 | * @return A string describing collection details such as: collection name;
|
---|
161 | * isPublic; isBeta; buildDate; numOfDocs; numOfWords; numOfBytes
|
---|
162 | */
|
---|
163 | public String toString() {
|
---|
164 | StringBuffer buf = new StringBuffer(1000);
|
---|
165 | buf.append("coll name=\"").append(getName());
|
---|
166 | buf.append("\" isPublic=").append(isPublic());
|
---|
167 | buf.append(" isBeta=").append(isBeta());
|
---|
168 | buf.append(" buildDate=").append(getBuildDate());
|
---|
169 | buf.append(" numOfDocs=").append(getNumOfDocs());
|
---|
170 | buf.append(" numOfWords=").append(getNumOfWords());
|
---|
171 | buf.append(" numOfBytes=").append(getNumOfBytes());
|
---|
172 | return buf.toString();
|
---|
173 | }
|
---|
174 |
|
---|
175 | /**
|
---|
176 | * Not currently implemented
|
---|
177 | */
|
---|
178 | public void print() {
|
---|
179 | /* [email protected] */
|
---|
180 | //System.out.println("Collection Information--------------");
|
---|
181 | //System.out.println("Collection Name = " + this.getName());
|
---|
182 | //System.out.println("Collection Name = " + m_info.getName());
|
---|
183 |
|
---|
184 | }
|
---|
185 |
|
---|
186 | }
|
---|
187 |
|
---|
188 |
|
---|
189 |
|
---|
190 |
|
---|
191 |
|
---|
192 |
|
---|
193 |
|
---|
194 |
|
---|