source: trunk/java-client/org/nzdl/gsdl/service/NzdlCollectionInfo.java@ 2186

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

added comments to corbaiface.idl and an hostname accessor to NzdlCollectionInfo

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