KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Util > ConnectorProtocolGen > CSProcCallBinding


1 /* $Id: CSProcCallBinding.java,v 1.2 2004/05/20 14:23:53 bures Exp $ */
2 package SOFA.SOFAnode.Util.ConnectorProtocolGen;
3
4 import SOFA.SOFAnode.Made.CDL.BadBindException;
5 import SOFA.SOFAnode.Made.CDL.CompBind;
6 import SOFA.SOFAnode.Made.CDL.CompBindOper;
7 import SOFA.SOFAnode.Made.CDL.DetectedConnector;
8 import SOFA.SOFAnode.Made.CDL.DetectedConnectors;
9
10 public class CSProcCallBinding {
11
12   public static void addDetectedConnector(String JavaDoc[] connectorOperations, DetectedConnectors dc, CompBind cb) throws BadBindException {
13     CompBindOper rhs, lhs;
14     rhs = cb.rhs;
15     lhs = cb.lhs;
16     DetectedConnector cn = dc.containsConnWithSRole(rhs);
17     if (cn == null) { // doesn't contain this connector
18
cn = new DetectedConnector(lhs, rhs, cb.mode, cb.using);
19       cn.operations = connectorOperations;
20       dc.add(cn);
21     } else { // this connector allready exists
22
if ( (cb.using.compareTo("CSProcCall")!=0)) {
23         throw new BadBindException("One interface is connected by different types of connectors.");
24       }
25       if (cn.bindMode != cb.mode) {
26         throw new BadBindException("One interface is connected by different modes of ties.");
27       }
28       if ( !cn.containsSameCRole(lhs) ) {
29         cn.addCRole(lhs);
30       }
31     }
32   }
33 }
34
35
Popular Tags