KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > InOut > Connector > InOut2ClientRMIStub


1 /**
2  * InOut2ClientRMIStub.java is a part of the SOFA project.
3  * This file was created by pepan on 16.4.2003.
4  */

5 package SOFA.SOFAnode.InOut.Connector;
6
7 import java.rmi.RemoteException JavaDoc;
8
9 import SOFA.Connector.ConnectorTransportException;
10 import SOFA.SOFAnode.InOut.Bundle;
11 import SOFA.SOFAnode.InOut.InOutException;
12 import SOFA.SOFAnode.TR.Impl.BundleImpl;
13
14 /**
15  * @author Petr Panuska
16  */

17 public class InOut2ClientRMIStub implements CNInOut2Client {
18
19   protected CNInOut2ClientRemote target;
20
21   public InOut2ClientRMIStub (String JavaDoc url) throws RemoteException JavaDoc {
22     try {
23       target = (CNInOut2ClientRemote) java.rmi.Naming.lookup(url);
24     } catch (java.net.MalformedURLException JavaDoc e) {
25       throw new RemoteException JavaDoc("Can't create CNInOut2ClientRemote.\n" + url + "\n", e);
26     } catch (java.rmi.NotBoundException JavaDoc e) {
27       throw new RemoteException JavaDoc("Can't create CNInOut2ClientRemote.\n" + url + "\n", e);
28     }
29   }
30
31 // public void obtainComponent (String fullName, String sofanode) throws InOutException {
32
// try {
33
// target.obtainComponent(fullName, sofanode);
34
// } catch (RemoteException e) {
35
// throw new ConnectorTransportException("Remote exception in the 'InOut2ClientRMIStub.obtainComponent'.", e);
36
// }
37
// }
38
//
39
// public void distributeComponent (String fullName, String[] sofanodes) throws InOutException {
40
// try {
41
// target.distributeComponent(fullName, sofanodes);
42
// } catch (RemoteException e) {
43
// throw new ConnectorTransportException("Remote exception in the 'InOut2ClientRMIStub.distributeComponent'.", e);
44
// }
45
// }
46

47   public void obtain (String JavaDoc[] offers, String JavaDoc[] components, String JavaDoc sofaNode) throws InOutException {
48     try {
49       target.obtain(offers, components, sofaNode);
50     } catch (RemoteException JavaDoc e) {
51       throw new ConnectorTransportException("Remote exception in the 'InOut2ClientRMIStub.obtain'.", e);
52     }
53   }
54
55   public void distribute (String JavaDoc[] offers, String JavaDoc[] components, String JavaDoc[] sofaNodes) throws InOutException {
56     try {
57       target.distribute(offers, components, sofaNodes);
58     } catch (RemoteException JavaDoc e) {
59       throw new ConnectorTransportException("Remote exception in the 'InOut2ClientRMIStub.distribute'.", e);
60     }
61   }
62
63   public void obtainOffers (String JavaDoc[] offers, String JavaDoc sofaNode) throws InOutException {
64     try {
65       target.obtainOffers(offers, sofaNode);
66     } catch (RemoteException JavaDoc e) {
67       throw new ConnectorTransportException("Remote exception in the 'InOut2ClientRMIStub.obtainOffers'.", e);
68     }
69   }
70
71   public void distributeOffers (String JavaDoc[] offers, String JavaDoc[] sofaNodes) throws InOutException {
72     try {
73       target.distributeOffers(offers, sofaNodes);
74     } catch (RemoteException JavaDoc e) {
75       throw new ConnectorTransportException("Remote exception in the 'InOut2ClientRMIStub.distributeOffers'.", e);
76     }
77   }
78
79   public void obtainComponents (String JavaDoc[] components, String JavaDoc sofaNode) throws InOutException {
80     try {
81       target.obtainComponents(components, sofaNode);
82     } catch (RemoteException JavaDoc e) {
83       throw new ConnectorTransportException("Remote exception in the 'InOut2ClientRMIStub.obtainComponents'.", e);
84     }
85   }
86
87   public void distributeComponents (String JavaDoc[] components, String JavaDoc[] sofaNodes) throws InOutException {
88     try {
89       target.distributeComponents(components, sofaNodes);
90     } catch (RemoteException JavaDoc e) {
91       throw new ConnectorTransportException("Remote exception in the 'InOut2ClientRMIStub.distributeComponents'.", e);
92     }
93   }
94
95   public Bundle list () throws InOutException {
96     try {
97       byte[] s = target.list();
98       BundleImpl bundle = new BundleImpl();
99       bundle._read(new cz.cuni.sofa.lib.Impl.ByteArrayInputStream(s));
100       return bundle;
101     } catch (java.rmi.RemoteException JavaDoc e) {
102       throw new ConnectorTransportException("Remote exception in the 'InOut2ClientRMIStub.list'.", e);
103     } catch (java.io.IOException JavaDoc e) {
104       throw new ConnectorTransportException("IOException exception in the 'InOut2ClientRMIStub.list'.", e);
105     }
106   }
107
108 }
109
Popular Tags