Public Methods | |
ApplicationsManager (NamingContext nc) | |
boolean | isRemote () |
String[] | listApplications (String type) |
org.omg.CORBA.Object | getApplication (String type, String name) |
boolean | renameApplication (String type, String name, String newName) |
boolean | removeApplication (String type, String name) |
String | putApplication (String type, String prefix, org.omg.CORBA.Object app) |
boolean | bindApplication (String type, String name, org.omg.CORBA.Object app) throws AlreadyBound |
ApplicationsManager | getRemoteManager (String name) |
Static Public Methods | |
ApplicationsManager | defaultAppMgr () |
|
00022 { 00023 this(nc, false); 00024 } |
|
00027 { 00028 if(_default == null) { 00029 NamingContext nc = 00030 ServiceRepository.instance().getNameService(); 00031 if(nc != null) _default = new ApplicationsManager(nc); 00032 } 00033 return _default; 00034 } |
|
00042 { 00043 return _remote; 00044 } |
|
00047 { 00048 NamingContext nc = getApplicationContext(type); 00049 if(nc == null) return new String[0]; 00050 00051 java.util.Vector vec = new java.util.Vector(); 00052 00053 BindingIteratorHolder it_holder = new BindingIteratorHolder(); 00054 BindingHolder binding = new BindingHolder(); 00055 00056 nc.list(0, new BindingListHolder(), it_holder); 00057 00058 if(it_holder.value == null) return new String[0]; 00059 00060 while(it_holder.value.next_one(binding)) { 00061 if(binding.value.binding_type == BindingType.nobject) 00062 vec.add(binding.value.binding_name[0].id); 00063 } 00064 it_holder.value.destroy(); 00065 00066 return (String[])vec.toArray(new String[0]); 00067 } |
|
00070 { 00071 NamingContext nc = getApplicationContext(type); 00072 if(nc == null) return null; 00073 00074 NameComponent[] path = { new NameComponent(name, "") }; 00075 00076 try { 00077 return nc.resolve(path); 00078 }catch(Exception e) {} 00079 00080 return null; 00081 } |
|
00084 { 00085 NamingContext nc = getApplicationContext(type); 00086 if(nc == null) return false; 00087 00088 org.omg.CORBA.Object obj = getApplication(type, name); 00089 if(obj == null) return false; 00090 00091 NameComponent[] newPath = { new NameComponent(newName, "") }; 00092 00093 try { 00094 nc.bind(newPath, obj); 00095 return removeApplication(type, name); 00096 }catch(Exception e) { 00097 return false; 00098 } 00099 } |
|
00102 { 00103 NamingContext nc = getApplicationContext(type); 00104 if(nc == null) return false; 00105 00106 NameComponent[] path = { new NameComponent(name, "") }; 00107 00108 try { 00109 nc.unbind(path); 00110 return true; 00111 }catch(Exception e) { 00112 return false; 00113 } 00114 } |
|
00117 { 00118 NamingContext nc = getApplicationContext(type); 00119 if(nc == null) return null; 00120 00121 boolean bind = false; 00122 int n = 0; 00123 String result = prefix; 00124 while(!bind) { 00125 try { 00126 bindApplication(type, result, app); 00127 bind = true; 00128 }catch (AlreadyBound e){ 00129 n = n+1; 00130 result = prefix + n; 00131 }catch(Exception e){ 00132 return null; 00133 } 00134 } 00135 00136 return result; 00137 } |
|
00141 { 00142 NamingContext nc = getApplicationContext(type); 00143 if(nc == null) return false; 00144 00145 try { 00146 NameComponent[] path = { new NameComponent(name, "") }; 00147 nc.bind(path, app); 00148 return true; 00149 }catch(InvalidName e) { 00150 }catch(CannotProceed e) { 00151 }catch(NotFound e) { 00152 } 00153 00154 return false; 00155 } |
|
00158 { 00159 try { 00160 org.omg.CORBA.Object obj = getApplication("NameServers", name); 00161 NamingContext remote = NamingContextHelper.narrow(obj); 00162 return new ApplicationsManager(remote, true); 00163 }catch(Exception e) { 00164 return null; 00165 } 00166 } |