KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > agent > client > applications > ApplicationFileChannel


1 package com.sslexplorer.agent.client.applications;
2
3 import java.io.IOException JavaDoc;
4
5 import com.maverick.multiplex.Channel;
6 import com.maverick.util.ByteArrayWriter;
7
8 public class ApplicationFileChannel extends Channel {
9
10     
11     public static final String JavaDoc CHANNEL_TYPE = "applicationFile@3sp.com";
12     
13     String JavaDoc name;
14     String JavaDoc ticket;
15     String JavaDoc filename;
16     
17     
18     public ApplicationFileChannel(String JavaDoc name, String JavaDoc ticket, String JavaDoc filename) {
19         super(CHANNEL_TYPE, 32768, 35000);
20         this.name = name;
21         this.ticket = ticket;
22         this.filename = filename;
23     }
24     
25     public byte[] create() throws IOException JavaDoc {
26     
27         try {
28             ByteArrayWriter msg = new ByteArrayWriter();
29             msg.writeString(name);
30             msg.writeString(ticket);
31             msg.writeString(filename.replace('\\', '/'));
32             
33             return msg.toByteArray();
34         } catch (IOException JavaDoc e) {
35             throw new IOException JavaDoc("Failed to create application descriptor channel open request message");
36         }
37
38     }
39
40     public void onChannelClose() {
41         // TODO Auto-generated method stub
42

43     }
44
45     public void onChannelOpen(byte[] data) {
46         // TODO Auto-generated method stub
47

48     }
49
50     public byte[] open(byte[] data) throws IOException JavaDoc {
51         throw new IOException JavaDoc("Application file channel cannot be opened on the client");
52     }
53
54 }
Popular Tags