1 2 package SOFA.SOFAnode.Util.ConnectorProtocolGen; 3 4 public class CSProcCall implements ConnectorProtocolGen { 5 6 public String generate(RoleDescription[] provideRoles, RoleDescription[] requireRoles) throws CannotGenerateException { 7 String 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 result=""; 14 for( int m=0 ; m<provideRoles[i].methods.length ; m++) 15 { 16 String 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+")*"; 26 return all; 27 } 28 } 29 30 | Popular Tags |