KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jcifs > dcerpc > msrpc > MsrpcShareEnum


1 /* jcifs msrpc client library in Java
2  * Copyright (C) 2006 "Michael B. Allen" <jcifs at samba dot org>
3  * "Eric Glass" <jcifs at samba dot org>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library 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 GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 package jcifs.dcerpc.msrpc;
21
22 import jcifs.smb.*;
23 import jcifs.util.Hexdump;
24
25 public class MsrpcShareEnum extends srvsvc.ShareEnumAll {
26
27     class MsrpcShareInfo1 extends SmbShareInfo {
28
29         MsrpcShareInfo1(srvsvc.ShareInfo1 info1) {
30             this.netName = info1.netname;
31             this.type = info1.type;
32             this.remark = info1.remark;
33         }
34     }
35
36     public MsrpcShareEnum(String JavaDoc server) {
37         super("\\\\" + server, 1, new srvsvc.ShareInfoCtr1(), -1, 0, 0);
38         ptype = 0;
39         flags = DCERPC_FIRST_FRAG | DCERPC_LAST_FRAG;
40     }
41
42     public FileEntry[] getEntries() {
43         /* The ShareInfo1 class does not implement the FileEntry
44          * interface (because it is generated from IDL). Therefore
45          * we must create an array of objects that do.
46          */

47         srvsvc.ShareInfoCtr1 ctr = (srvsvc.ShareInfoCtr1)info;
48         MsrpcShareInfo1[] entries = new MsrpcShareInfo1[ctr.count];
49         for (int i = 0; i < ctr.count; i++) {
50             entries[i] = new MsrpcShareInfo1(ctr.array[i]);
51         }
52         return entries;
53     }
54 }
55
Popular Tags