1 5 package SOFA.SOFAnode.InOut.Connector; 6 7 import java.rmi.RemoteException ; 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 17 public class InOut2ClientRMIStub implements CNInOut2Client { 18 19 protected CNInOut2ClientRemote target; 20 21 public InOut2ClientRMIStub (String url) throws RemoteException { 22 try { 23 target = (CNInOut2ClientRemote) java.rmi.Naming.lookup(url); 24 } catch (java.net.MalformedURLException e) { 25 throw new RemoteException ("Can't create CNInOut2ClientRemote.\n" + url + "\n", e); 26 } catch (java.rmi.NotBoundException e) { 27 throw new RemoteException ("Can't create CNInOut2ClientRemote.\n" + url + "\n", e); 28 } 29 } 30 31 47 public void obtain (String [] offers, String [] components, String sofaNode) throws InOutException { 48 try { 49 target.obtain(offers, components, sofaNode); 50 } catch (RemoteException e) { 51 throw new ConnectorTransportException("Remote exception in the 'InOut2ClientRMIStub.obtain'.", e); 52 } 53 } 54 55 public void distribute (String [] offers, String [] components, String [] sofaNodes) throws InOutException { 56 try { 57 target.distribute(offers, components, sofaNodes); 58 } catch (RemoteException e) { 59 throw new ConnectorTransportException("Remote exception in the 'InOut2ClientRMIStub.distribute'.", e); 60 } 61 } 62 63 public void obtainOffers (String [] offers, String sofaNode) throws InOutException { 64 try { 65 target.obtainOffers(offers, sofaNode); 66 } catch (RemoteException e) { 67 throw new ConnectorTransportException("Remote exception in the 'InOut2ClientRMIStub.obtainOffers'.", e); 68 } 69 } 70 71 public void distributeOffers (String [] offers, String [] sofaNodes) throws InOutException { 72 try { 73 target.distributeOffers(offers, sofaNodes); 74 } catch (RemoteException e) { 75 throw new ConnectorTransportException("Remote exception in the 'InOut2ClientRMIStub.distributeOffers'.", e); 76 } 77 } 78 79 public void obtainComponents (String [] components, String sofaNode) throws InOutException { 80 try { 81 target.obtainComponents(components, sofaNode); 82 } catch (RemoteException e) { 83 throw new ConnectorTransportException("Remote exception in the 'InOut2ClientRMIStub.obtainComponents'.", e); 84 } 85 } 86 87 public void distributeComponents (String [] components, String [] sofaNodes) throws InOutException { 88 try { 89 target.distributeComponents(components, sofaNodes); 90 } catch (RemoteException 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 e) { 102 throw new ConnectorTransportException("Remote exception in the 'InOut2ClientRMIStub.list'.", e); 103 } catch (java.io.IOException e) { 104 throw new ConnectorTransportException("IOException exception in the 'InOut2ClientRMIStub.list'.", e); 105 } 106 } 107 108 } 109 | Popular Tags |