Revision 234
Added by bojilova over 24 years ago
src/edu/ucsb/nceas/metacat/MetaCatSession.java | ||
---|---|---|
30 | 30 |
// JNI (Java Native Interface) routines for SRB |
31 | 31 |
static String srbHost; |
32 | 32 |
static String srbPort; |
33 |
static SrbJavaGlueInterface srbJG = null;
|
|
33 |
static SrbJavaGlueInterface srbJG; |
|
34 | 34 |
static { |
35 | 35 |
try { |
36 | 36 |
Properties SRBProps = new Properties(); |
... | ... | |
46 | 46 |
String name = "//" + RMIhost + "/SrbJavaGlue"; |
47 | 47 |
srbJG = (SrbJavaGlueInterface)Naming.lookup(name); |
48 | 48 |
} catch (Exception e) { |
49 |
System.out.println ("MetaCatSession static: " + e.getMessage());
|
|
49 |
System.out.println("MetaCatSession static: " + e.getMessage()); |
|
50 | 50 |
} |
51 | 51 |
} |
52 | 52 |
|
... | ... | |
90 | 90 |
int srbconn = 0; |
91 | 91 |
int err; |
92 | 92 |
|
93 |
if (srbJG == null) return false; |
|
94 |
else return true; |
|
93 |
if (srbJG == null) { |
|
94 |
srbConnection(); |
|
95 |
return false; |
|
96 |
} else return true; |
|
95 | 97 |
/* |
96 | 98 |
// try SRB RMI Connection |
97 | 99 |
// integer value of the SBR Connection ID is returned only |
... | ... | |
123 | 125 |
return true; |
124 | 126 |
*/ |
125 | 127 |
} |
128 |
|
|
129 |
// temp |
|
130 |
private void srbConnection () { |
|
131 |
try { |
|
132 |
Properties SRBProps = new Properties(); |
|
133 |
// SRB properties that tells about the location of SRB RMI Server |
|
134 |
// srbProps.properties should reside on metacat server |
|
135 |
FileInputStream in = new FileInputStream("srbProps.properties"); |
|
136 |
SRBProps.load(in); |
|
137 |
in.close(); |
|
138 |
srbHost = (String)SRBProps.get("host"); |
|
139 |
srbPort = (String)SRBProps.get("port"); |
|
140 |
// should handle missing RMIhost name here |
|
141 |
String RMIhost = (String)SRBProps.get("RMIhost"); |
|
142 |
String name = "//" + RMIhost + "/SrbJavaGlue"; |
|
143 |
srbJG = (SrbJavaGlueInterface)Naming.lookup(name); |
|
144 |
} catch (Exception e) { |
|
145 |
System.out.println("MetaCatSession static: " + e.getMessage()); |
|
146 |
} |
|
147 |
} |
|
126 | 148 |
|
127 | 149 |
/** |
128 | 150 |
* Invalidate this HTTPSession object. |
src/edu/ucsb/nceas/metacat/MetaCatServlet.java | ||
---|---|---|
294 | 294 |
} |
295 | 295 |
|
296 | 296 |
} else { |
297 |
out.println("SRB Host: " + sess.srbHost); |
|
298 |
out.println("SRB Port: " + sess.srbPort); |
|
297 | 299 |
sess.disconnect(); |
298 | 300 |
out.println("SRB Connection failed. " + |
299 | 301 |
"SRB RMI Server is not running now or " + |
Also available in: Unified diff
testing login