|
29 | 29 |
|
30 | 30 | import java.io.IOException;
|
31 | 31 | import java.io.InterruptedIOException;
|
| 32 | +import java.util.Hashtable; |
32 | 33 | import java.util.Vector;
|
33 | 34 |
|
34 | 35 |
|
@@ -80,6 +81,7 @@ class IFSFileDescriptorImplRemote
|
80 | 81 | String fileOwnerName_ = null;
|
81 | 82 | boolean isDirectory_ = false;
|
82 | 83 | //@AC7 End
|
| 84 | + Hashtable fileText_ = null; //TODO |
83 | 85 |
|
84 | 86 | // Static initialization code.
|
85 | 87 | static
|
@@ -2111,7 +2113,7 @@ else if (ds instanceof IFSReturnCodeRep)
|
2111 | 2113 | //@AC7A Start
|
2112 | 2114 | private void retrieveAttributes(ClientAccessDataStream ds, int objectHandle) throws IOException, AS400SecurityException {
|
2113 | 2115 | fileAsp_ = ((IFSLookupRep) ds).getASP();
|
2114 |
| - //if (isDirectory_) { @AE8D |
| 2116 | + //if (isDirectory_) { TODO remove |
2115 | 2117 | fileOwnerName_ = ((IFSLookupRep) ds).getOwnerName(system_.getCcsid());
|
2116 | 2118 | fileDataCCSID_ = ((IFSLookupRep) ds).getCCSID(serverDatastreamLevel_);
|
2117 | 2119 | //}
|
@@ -2165,6 +2167,191 @@ else if (ds instanceof IFSReturnCodeRep)
|
2165 | 2167 | }
|
2166 | 2168 | }
|
2167 | 2169 | //@AC7A End
|
| 2170 | + |
| 2171 | + //TODO |
| 2172 | + /* |
| 2173 | + public IFSGetEAsRep listEAs() throws IOException, AS400SecurityException { |
| 2174 | + IFSGetEAsRep reply = null; |
| 2175 | + int fileHandle = UNINITIALIZED; |
| 2176 | + boolean usedGlobalHandle = false; |
| 2177 | + try { |
| 2178 | + // Open the file, and obtain a file handle. |
| 2179 | + if (fileHandle_ != UNINITIALIZED) |
| 2180 | + { |
| 2181 | + fileHandle = fileHandle_; |
| 2182 | + usedGlobalHandle = true; |
| 2183 | + } |
| 2184 | + else |
| 2185 | + { |
| 2186 | + fileHandle = createFileHandle(); //@KKBC |
| 2187 | + if (fileHandle == UNINITIALIZED) |
| 2188 | + { |
| 2189 | + if (Trace.traceOn_) Trace.log(Trace.ERROR, "Unable to create handle to file " + path_ + ". IFSReturnCodeRep return code", errorRC_); |
| 2190 | + return null; |
| 2191 | + } |
| 2192 | + } |
| 2193 | + IFSGetEAsReq req = new IFSGetEAsReq(fileHandle, serverDatastreamLevel_); |
| 2194 | +
|
| 2195 | + int rc = 0; |
| 2196 | + ClientAccessDataStream ds = null; |
| 2197 | + try |
| 2198 | + { |
| 2199 | + ds = (ClientAccessDataStream) server_.sendAndReceive(req); |
| 2200 | + } |
| 2201 | + catch(ConnectionDroppedException e) |
| 2202 | + { |
| 2203 | + Trace.log(Trace.ERROR, "Byte stream server connection lost."); |
| 2204 | + connectionDropped(e); |
| 2205 | + } |
| 2206 | + catch(InterruptedException e) |
| 2207 | + { |
| 2208 | + Trace.log(Trace.ERROR, "Interrupted"); |
| 2209 | + InterruptedIOException throwException = new InterruptedIOException(e.getMessage()); |
| 2210 | + try { |
| 2211 | + throwException.initCause(e); |
| 2212 | + } catch (Throwable t) {} |
| 2213 | + throw throwException; |
| 2214 | + } |
| 2215 | + |
| 2216 | + if (ds instanceof IFSGetEAsRep) |
| 2217 | + { |
| 2218 | + reply = (IFSGetEAsRep) ds; |
| 2219 | + return reply; |
| 2220 | + } |
| 2221 | + else if (ds instanceof IFSReturnCodeRep) |
| 2222 | + { |
| 2223 | + rc = ((IFSReturnCodeRep) ds).getReturnCode(); |
| 2224 | + if (rc != IFSReturnCodeRep.SUCCESS) |
| 2225 | + { |
| 2226 | + Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", rc); |
| 2227 | + throw new ExtendedIOException(path_, rc); |
| 2228 | + } |
| 2229 | + } |
| 2230 | + else |
| 2231 | + { |
| 2232 | + // Unknown data stream. |
| 2233 | + Trace.log(Trace.ERROR, "Unknown reply data stream", ds.data_); |
| 2234 | + throw new |
| 2235 | + InternalErrorException(Integer.toHexString(ds.getReqRepID()), |
| 2236 | + InternalErrorException.DATA_STREAM_UNKNOWN); |
| 2237 | + } |
| 2238 | + } |
| 2239 | + finally { |
| 2240 | + if(!usedGlobalHandle && fileHandle != UNINITIALIZED) |
| 2241 | + close(fileHandle); |
| 2242 | + } |
| 2243 | + return reply; |
| 2244 | + }*/ |
| 2245 | + |
| 2246 | + public IFSGetEAsRep getExtendedAttributes(byte[][] eaNamelist, int eaNameLength, int ccsid) throws IOException, AS400SecurityException { |
| 2247 | + IFSGetEAsRep reply = null; |
| 2248 | + ClientAccessDataStream ds = null; |
| 2249 | + connect(); |
| 2250 | + //create user handle |
| 2251 | + int userHandle = UNINITIALIZED, objectHandle = UNINITIALIZED, nodeObjectHandle = UNINITIALIZED; |
| 2252 | + try{ |
| 2253 | + userHandle = system_.createUserHandle(); |
| 2254 | + try |
| 2255 | + { |
| 2256 | + byte[] path = getConverter().stringToByteArray(path_); |
| 2257 | + //IFSLookupReq req = new IFSLookupReq(path, preferredServerCCSID_, userHandle, IFSLookupReq.OA2, 0, 0); |
| 2258 | + //IFSLookupReq req = new IFSLookupReq(path, preferredServerCCSID_, userHandle, IFSLookupReq.OA12, IFSObjAttrs1.OWNERANAME_ASP_FLAS, 0); //@AC7A |
| 2259 | + IFSLookupReq req = new IFSLookupReq(path, preferredServerCCSID_,userHandle); |
| 2260 | + ds = (ClientAccessDataStream) server_.sendAndReceive(req); |
| 2261 | + int rc = 0; |
| 2262 | + if (ds instanceof IFSLookupRep) |
| 2263 | + { |
| 2264 | + objectHandle = ((IFSLookupRep) ds).getHandle(); |
| 2265 | + //Open Node to get object request; |
| 2266 | + IFSOpenNodeReq nodeReq = new IFSOpenNodeReq(objectHandle, serverDatastreamLevel_); |
| 2267 | + ds = null; |
| 2268 | + ds = (ClientAccessDataStream) server_.sendAndReceive(nodeReq); |
| 2269 | + if (ds instanceof IFSOpenNodeRep) { |
| 2270 | + nodeObjectHandle = ((IFSOpenNodeRep) ds).getObjectHandle(); |
| 2271 | + IFSGetEAsReq eaReq = new IFSGetEAsReq(nodeObjectHandle, eaNamelist, eaNameLength, ccsid, serverDatastreamLevel_); |
| 2272 | + ds = (ClientAccessDataStream) server_.sendAndReceive(eaReq); |
| 2273 | + if (ds instanceof IFSGetEAsRep) { |
| 2274 | + reply = (IFSGetEAsRep) ds; |
| 2275 | + } else if (ds instanceof IFSReturnCodeRep) |
| 2276 | + { |
| 2277 | + rc = ((IFSReturnCodeRep) ds).getReturnCode(); |
| 2278 | + if (rc != IFSReturnCodeRep.SUCCESS) |
| 2279 | + { |
| 2280 | + Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", rc); |
| 2281 | + } |
| 2282 | + throw new ExtendedIOException(path_, rc); |
| 2283 | + } |
| 2284 | + else |
| 2285 | + { |
| 2286 | + // Unknown data stream. |
| 2287 | + Trace.log(Trace.ERROR, "Unknown reply data stream", |
| 2288 | + ds.getReqRepID()); |
| 2289 | + throw new |
| 2290 | + InternalErrorException(Integer.toHexString(ds.getReqRepID()), |
| 2291 | + InternalErrorException.DATA_STREAM_UNKNOWN); |
| 2292 | + } |
| 2293 | + } else if (ds instanceof IFSReturnCodeRep) |
| 2294 | + { |
| 2295 | + rc = ((IFSReturnCodeRep) ds).getReturnCode(); |
| 2296 | + if (rc != IFSReturnCodeRep.SUCCESS) |
| 2297 | + { |
| 2298 | + Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", rc); |
| 2299 | + } |
| 2300 | + throw new ExtendedIOException(path_, rc); |
| 2301 | + } |
| 2302 | + else |
| 2303 | + { |
| 2304 | + // Unknown data stream. |
| 2305 | + Trace.log(Trace.ERROR, "Unknown reply data stream", |
| 2306 | + ds.getReqRepID()); |
| 2307 | + throw new |
| 2308 | + InternalErrorException(Integer.toHexString(ds.getReqRepID()), |
| 2309 | + InternalErrorException.DATA_STREAM_UNKNOWN); |
| 2310 | + } |
| 2311 | + } |
| 2312 | + else if (ds instanceof IFSReturnCodeRep) |
| 2313 | + { |
| 2314 | + rc = ((IFSReturnCodeRep) ds).getReturnCode(); |
| 2315 | + if (rc != IFSReturnCodeRep.SUCCESS) |
| 2316 | + { |
| 2317 | + Trace.log(Trace.ERROR, "IFSReturnCodeRep return code", rc); |
| 2318 | + } |
| 2319 | + throw new ExtendedIOException(path_, rc); |
| 2320 | + } |
| 2321 | + else |
| 2322 | + { |
| 2323 | + // Unknown data stream. |
| 2324 | + Trace.log(Trace.ERROR, "Unknown reply data stream", |
| 2325 | + ds.getReqRepID()); |
| 2326 | + throw new |
| 2327 | + InternalErrorException(Integer.toHexString(ds.getReqRepID()), |
| 2328 | + InternalErrorException.DATA_STREAM_UNKNOWN); |
| 2329 | + } |
| 2330 | + |
| 2331 | + } catch(ConnectionDroppedException e) |
| 2332 | + { |
| 2333 | + Trace.log(Trace.ERROR, "Byte stream server connection lost."); |
| 2334 | + connectionDropped(e); |
| 2335 | + } |
| 2336 | + catch(InterruptedException e) |
| 2337 | + { |
| 2338 | + Trace.log(Trace.ERROR, "Interrupted"); |
| 2339 | + InterruptedIOException throwException = new InterruptedIOException(e.getMessage()); |
| 2340 | + try { |
| 2341 | + throwException.initCause(e); |
| 2342 | + } catch (Throwable t) {} |
| 2343 | + throw throwException; |
| 2344 | + } |
| 2345 | + }finally{ |
| 2346 | + if(nodeObjectHandle != UNINITIALIZED) |
| 2347 | + freeHandle(nodeObjectHandle); |
| 2348 | + if(objectHandle != UNINITIALIZED) |
| 2349 | + freeHandle(objectHandle); |
| 2350 | + } |
| 2351 | + return reply; |
| 2352 | + } |
| 2353 | + |
| 2354 | + |
2168 | 2355 |
|
2169 | 2356 | }
|
2170 | 2357 |
|
|
0 commit comments