KickJava   Java API By Example, From Geeks To Geeks.

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


1 /* $Id: CSProcCall.java,v 1.1.1.1 2003/02/11 16:19:41 bures Exp $ */
2 package SOFA.SOFAnode.Util.ConnectorProtocolGen;
3
4 public class CSProcCall implements ConnectorProtocolGen {
5
6    public String JavaDoc generate(RoleDescription[] provideRoles, RoleDescription[] requireRoles) throws CannotGenerateException {
7        String JavaDoc all="";
8        for( int i=0; i<provideRoles.length ; i++)
9        {
10             if( provideRoles[i].declaration.indexOf("[")!=-1
11           || requireRoles[0].declaration.indexOf("[")!=-1 )
12         throw new CannotGenerateException("Arrays not supported");
13         String JavaDoc result="";
14         for( int m=0 ; m<provideRoles[i].methods.length ; m++)
15         {
16         String JavaDoc thismethod="?"+provideRoles[i].methods[m]+"{!"+requireRoles[0].methods[m]+"}";
17         if( m>0 ) result = result+"||"+thismethod;
18         else result = thismethod;
19         }
20         
21         if( i>0 ) all=all+"||"+result;
22         else all=result;
23        }
24        if( all.length()==0 ) all="NULL";
25        all = "("+all+")*"/*+ "|| [UPDATE]*"*/;
26        return all;
27    }
28 }
29
30
Popular Tags