Horus Doc || Java GUI Reference || Doxygen's quick Index  

IntRepManager Class Reference

Singleton class for simplified access to the Corba Interface Repository, that is org.omg.CORBA.Repository. More...

List of all members.

Public Methods

 IntRepManager (Repository ir)
void buildMethodMenu (String entry, CorbaMenuBuilder builder)
void buildMethodMenu (CorbaMenuBuilder builder)
OperationDef describeOperation (String intfName, String opName)
Any getDefaultValue (String intfName, String opName, String paramName)
SequenceDef describeSequence (String seqName)
String[] listGroups (String intfName, String group)
String[] listOperations (String intfName, String group)

Static Public Methods

IntRepManager defaultIrMgr ()


Detailed Description

Singleton class for simplified access to the Corba Interface Repository, that is org.omg.CORBA.Repository.


Constructor & Destructor Documentation

IntRepManager::IntRepManager Repository    ir [inline]
 

00023 {
00024     if(ir == null)
00025         throw new IllegalArgumentException("null org.omg.CORBA.Repository");
00026 
00027     _ir = ir;
00028 }


Member Function Documentation

IntRepManager IntRepManager::defaultIrMgr   [inline, static]
 

00032 {
00033     if(_default == null) {
00034         Repository ir =
00035             ServiceRepository.instance().getRepository();
00036         if(ir != null) _default = new IntRepManager(ir);
00037     }
00038     return _default;
00039 }

void IntRepManager::buildMethodMenu String    entry,
CorbaMenuBuilder    builder
[inline]
 

00043 {
00044     boolean built = buildMenu(entry, builder);
00045     if(!built)
00046         builder.createNullMenu(entry);
00047 }

void IntRepManager::buildMethodMenu CorbaMenuBuilder    builder [inline]
 

00050 {
00051     builder.openMainMenu("HxCorba");
00052     String[] entries = listMenuEntries();
00053     for (int i=0 ; i<entries.length ; i++)
00054         buildMenu(entries[i], builder);
00055     builder.closeMainMenu();
00056 }

OperationDef IntRepManager::describeOperation String    intfName,
String    opName
[inline]
 

00059 {
00060     //if(_ir == null) return null;
00061 
00062     try {
00063         String path = "HxCorba/"+intfName+"/"+opName;
00064         org.omg.CORBA.Contained cont = _ir.lookup_id("IDL:"+path+":1.0");
00065         if(cont != null) return OperationDefHelper.narrow(cont);
00066 
00067         // try base interfaces
00068         cont = _ir.lookup_id("IDL:HxCorba/"+intfName+":1.0");
00069         if(cont == null) return null; //Interface doesn't exists
00070 
00071         InterfaceDef iDef = InterfaceDefHelper.narrow(cont);
00072         InterfaceDef[] baseIntf = iDef.base_interfaces();
00073         for(int i=0; i<baseIntf.length; i++) {
00074             OperationDef op = describeOperation(baseIntf[i].name(), opName);
00075             if(op != null) return op;
00076         }
00077 
00078     }catch(org.omg.CORBA.TRANSIENT e){
00079         ErrorStreamArea.println("Cannot find InterfaceRepository server");
00080         _ir = null;
00081     }catch(Exception e){
00082         ErrorStreamArea.println(""+e);
00083         e.printStackTrace();
00084     }
00085     return null;
00086 }

Any IntRepManager::getDefaultValue String    intfName,
String    opName,
String    paramName
[inline]
 

00089 {
00090     try {
00091         String path = "HxCorbaDefParams/"+intfName+"/"+opName+"_"+paramName;
00092         org.omg.CORBA.Contained cont = _ir.lookup_id("IDL:"+path+":1.0");
00093         if(cont != null) return ConstantDefHelper.narrow(cont).value();
00094 
00095         // try base interfaces ?
00096 
00097     }catch(org.omg.CORBA.TRANSIENT e){
00098         ErrorStreamArea.println("Cannot find InterfaceRepository server");
00099         _ir = null;
00100     }catch(Exception e){
00101         ErrorStreamArea.println(""+e);
00102         e.printStackTrace();
00103     }
00104     return null;
00105 }

SequenceDef IntRepManager::describeSequence String    seqName [inline]
 

00108 {
00109     //if(_ir == null) return null;
00110 
00111     try {
00112         org.omg.CORBA.Contained cont =
00113             _ir.lookup_id("IDL:HxCorba/"+seqName+":1.0");
00114         AliasDef alias = AliasDefHelper.narrow(cont);
00115         return SequenceDefHelper.narrow(alias.original_type_def());
00116 
00117     }catch(org.omg.CORBA.TRANSIENT e){
00118         ErrorStreamArea.println("Cannot find InterfaceRepository server");
00119         _ir = null;
00120     }catch(Exception e){
00121         ErrorStreamArea.println(""+e);
00122         e.printStackTrace();
00123     }
00124     return null;
00125 }

String [] IntRepManager::listGroups String    intfName,
String    group
[inline]
 

00234 {
00235     //if(_ir == null) return new String[0];
00236 
00237     try {
00238         StructDef menu = lookupGroup(intfName, group);
00239         StructMember[] menuMembers = menu.members();
00240 
00241         String[] memberNames = new String[menuMembers.length];
00242         int nGroups = 0;
00243         for (int i=0 ; i<menuMembers.length ; i++) {
00244             if(menuMembers[i].type.kind() == TCKind.tk_struct)
00245                 memberNames[nGroups++] = menuMembers[i].type.name();
00246         }
00247 
00248         String[] res = new String[nGroups];
00249         System.arraycopy(memberNames, 0, res, 0, nGroups);
00250 
00251         return res;
00252 
00253     }catch(org.omg.CORBA.TRANSIENT e){
00254         ErrorStreamArea.println("Cannot find InterfaceRepository server");
00255         _ir = null;
00256     }catch(Exception e){
00257         ErrorStreamArea.println(""+e);
00258         e.printStackTrace();
00259     }
00260     return new String[0];
00261 }

String [] IntRepManager::listOperations String    intfName,
String    group
[inline]
 

00264 {
00265     //if(_ir == null) return new String[0];
00266 
00267     try {
00268         StructDef menu = lookupGroup(intfName, group);
00269         StructMember[] menuMembers = menu.members();
00270 
00271         String[] memberNames = new String[menuMembers.length];
00272         int nOps = 0;
00273         for (int i=0 ; i<menuMembers.length ; i++) {
00274             if(menuMembers[i].type.kind() != TCKind.tk_struct)
00275                 memberNames[nOps++] = menuMembers[i].name;
00276         }
00277 
00278         String[] res = new String[nOps];
00279         System.arraycopy(memberNames, 0, res, 0, nOps);
00280 
00281         return res;
00282 
00283     }catch(org.omg.CORBA.TRANSIENT e){
00284         ErrorStreamArea.println("Cannot find InterfaceRepository server");
00285         _ir = null;
00286     }catch(Exception e){
00287         ErrorStreamArea.println(""+e);
00288         e.printStackTrace();
00289     }
00290     return new String[0];
00291 }


The documentation for this class was generated from the following file:
Generated on Mon Jan 27 15:11:22 2003 for JavaReference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001