1 | /**
|
---|
2 | *#########################################################################
|
---|
3 | *
|
---|
4 | * A component of the Gatherer application, part of the Greenstone digital
|
---|
5 | * library suite from the New Zealand Digital Library Project at the
|
---|
6 | * University of Waikato, New Zealand.
|
---|
7 | *
|
---|
8 | * Author: John Thompson and David Bainbridge,
|
---|
9 | * Greenstone Digital Library, University of Waikato
|
---|
10 | *
|
---|
11 | * Copyright (C) 1999 New Zealand Digital Library Project
|
---|
12 | *
|
---|
13 | * This program is free software; you can redistribute it and/or modify
|
---|
14 | * it under the terms of the GNU General Public License as published by
|
---|
15 | * the Free Software Foundation; either version 2 of the License, or
|
---|
16 | * (at your option) any later version.
|
---|
17 | *
|
---|
18 | * This program is distributed in the hope that it will be useful,
|
---|
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
21 | * GNU General Public License for more details.
|
---|
22 | *
|
---|
23 | * You should have received a copy of the GNU General Public License
|
---|
24 | * along with this program; if not, write to the Free Software
|
---|
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
26 | *########################################################################
|
---|
27 | */
|
---|
28 |
|
---|
29 | package org.greenstone.gatherer;
|
---|
30 |
|
---|
31 | import java.io.*;
|
---|
32 | import org.greenstone.gatherer.util.StaticStrings;
|
---|
33 | import org.greenstone.gatherer.util.Utility;
|
---|
34 |
|
---|
35 | public class FedoraInfo
|
---|
36 | {
|
---|
37 | private boolean active = false;
|
---|
38 | private String home = null;
|
---|
39 |
|
---|
40 | private String hostname = null;
|
---|
41 | private String port = null;
|
---|
42 | private String username = null;
|
---|
43 | private String password = null;
|
---|
44 | private String protocol = null;
|
---|
45 |
|
---|
46 | public FedoraInfo()
|
---|
47 | {
|
---|
48 | this("localhost", "8080", "fedoraAdmin", "fedoraAdmin", "http");
|
---|
49 | }
|
---|
50 |
|
---|
51 | public FedoraInfo(String hostname, String port, String username, String password, String protocol)
|
---|
52 | {
|
---|
53 | this.hostname = hostname;
|
---|
54 | this.port = port;
|
---|
55 | this.username = username;
|
---|
56 | this.password = password;
|
---|
57 | this.protocol = protocol;
|
---|
58 | }
|
---|
59 |
|
---|
60 | // Called when we are attempting to run fedora
|
---|
61 | public void setActive(boolean active) {
|
---|
62 | this.active = active;
|
---|
63 | }
|
---|
64 |
|
---|
65 | public boolean isActive()
|
---|
66 | {
|
---|
67 | return (home != null || active);
|
---|
68 | }
|
---|
69 |
|
---|
70 | public void setHome(String home)
|
---|
71 | {
|
---|
72 | this.home = home;
|
---|
73 | }
|
---|
74 |
|
---|
75 |
|
---|
76 | public String getHome()
|
---|
77 | {
|
---|
78 | return home;
|
---|
79 | }
|
---|
80 |
|
---|
81 |
|
---|
82 | public void setHostname(String hostname)
|
---|
83 | {
|
---|
84 | this.hostname = hostname;
|
---|
85 | }
|
---|
86 |
|
---|
87 | public String getHostname()
|
---|
88 | {
|
---|
89 | return hostname;
|
---|
90 | }
|
---|
91 |
|
---|
92 |
|
---|
93 | public void setPort(String port)
|
---|
94 | {
|
---|
95 | this.port = port;
|
---|
96 | }
|
---|
97 |
|
---|
98 | public String getPort()
|
---|
99 | {
|
---|
100 | return port;
|
---|
101 | }
|
---|
102 |
|
---|
103 |
|
---|
104 | public void setUsername(String username)
|
---|
105 | {
|
---|
106 | this.username = username;
|
---|
107 | }
|
---|
108 |
|
---|
109 | public String getUsername()
|
---|
110 | {
|
---|
111 | return username;
|
---|
112 | }
|
---|
113 |
|
---|
114 |
|
---|
115 | public void setPassword(String password)
|
---|
116 | {
|
---|
117 | this.password = password;
|
---|
118 | }
|
---|
119 |
|
---|
120 | public String getPassword()
|
---|
121 | {
|
---|
122 | return password;
|
---|
123 | }
|
---|
124 |
|
---|
125 |
|
---|
126 | public void setProtocol(String protocol)
|
---|
127 | {
|
---|
128 | this.protocol = protocol;
|
---|
129 | }
|
---|
130 |
|
---|
131 | public String getProtocol()
|
---|
132 | {
|
---|
133 | return protocol;
|
---|
134 | }
|
---|
135 |
|
---|
136 | public String getBaseURL()
|
---|
137 | {
|
---|
138 | return this.protocol+"://"+this.hostname+":"+this.port+"/";
|
---|
139 | }
|
---|
140 |
|
---|
141 | // The library preview address for Fedora
|
---|
142 | public String getLibraryURL()
|
---|
143 | {
|
---|
144 | return this.getBaseURL() + "fedora/search";
|
---|
145 | }
|
---|
146 | }
|
---|