1 22 package org.objectweb.joram.client.tools.admin; 23 24 import java.util.Hashtable ; 25 import java.util.Iterator ; 26 import java.util.List ; 27 import java.util.Enumeration ; 28 import java.net.ConnectException ; 29 import javax.naming.*; 30 import javax.swing.*; 31 import java.awt.event.*; 32 import javax.swing.tree.*; 33 import javax.jms.*; 34 35 import org.objectweb.joram.client.jms.admin.*; 36 import org.objectweb.joram.client.jms.tcp.*; 37 import org.objectweb.joram.client.jms.Queue; 38 import org.objectweb.joram.client.jms.Topic; 39 import org.objectweb.joram.client.jms.Destination; 40 41 import org.objectweb.util.monolog.api.*; 42 43 public class AdminController 44 { 45 private boolean adminConnected = false; 46 private String adminConnectionStr = "Not connected"; 47 48 private ControllerEventListener gui; 49 50 private DefaultTreeModel adminTreeModel; 51 private PlatformTreeNode adminRoot; 52 53 private DefaultTreeModel jndiTreeModel; 54 private MutableTreeNode jndiRoot; 55 56 private String namedCtx = ""; 57 private Context ctx = null; 58 59 private boolean jndiConnected = false; 60 61 public static final String DEFAULT_ADMIN_HOST = "localhost"; 62 public static final String DEFAULT_ADMIN_PORT = "16010"; 63 64 public static final String PROP_JNDI_FACTORY = "java.naming.factory.initial"; 65 public static final String PROP_JNDI_HOST = "java.naming.factory.host"; 66 public static final String PROP_JNDI_PORT = "java.naming.factory.port"; 67 68 public static final String DEFAULT_JNDI_FACTORY = "fr.dyade.aaa.jndi2.client.NamingContextFactory"; 69 public static final String DEFAULT_JNDI_HOST = "localhost"; 70 public static final String DEFAULT_JNDI_PORT = "16400"; 71 72 private static final String STR_ADMIN_DISCONNECTED = "Disconnected"; 73 private static final String STR_JNDI_DISCONNECTED = "Disconnected"; 74 75 public AdminController() 76 { 77 adminRoot = new PlatformTreeNode(this, STR_ADMIN_DISCONNECTED); 78 adminTreeModel = new DefaultTreeModel(adminRoot, true); 79 80 jndiRoot = new DefaultMutableTreeNode(STR_JNDI_DISCONNECTED); 81 jndiTreeModel = new DefaultTreeModel(jndiRoot, true); 82 } 83 84 public void setControllerEventListener(ControllerEventListener l) 85 { 86 this.gui = l; 87 } 88 89 protected DefaultTreeModel getAdminTreeModel() { return adminTreeModel; } 90 91 protected DefaultTreeModel getJndiTreeModel() { return jndiTreeModel; } 92 93 public void connectJndi(String host, int port, String ctxName) throws NamingException 94 { 95 namedCtx = ctxName; 96 97 Hashtable env = new Hashtable (); 98 env.put(PROP_JNDI_FACTORY, 99 System.getProperty(PROP_JNDI_FACTORY) != null ? System.getProperty(PROP_JNDI_FACTORY) : DEFAULT_JNDI_FACTORY); 100 env.put(PROP_JNDI_HOST, host); 101 env.put(PROP_JNDI_PORT, Integer.toString(port)); 102 103 ctx = new InitialContext(env); 104 jndiConnected = true; 105 if (ctxName != null) { 106 ctx = (Context)ctx.lookup(ctxName); 107 } 108 jndiRoot.setUserObject((ctxName == null || ctxName.length() == 0) ? "Root Context" : ctxName); 109 jndiTreeModel.nodeChanged(jndiRoot); 110 refreshJndiData(); 111 } 112 113 public void refreshJndiData() throws NamingException 114 { 115 cleanupJndiTree(); 116 117 for (NamingEnumeration e = ctx.list(""); e.hasMore();) { 118 NameClassPair pair = (NameClassPair) e.next(); 119 JndiTreeNode node = new JndiTreeNode(this, ctx, pair.getName()); 120 insertJndiNode(node); 121 } 122 } 123 124 public void disconnectJndi() throws NamingException 125 { 126 ctx.close(); 127 128 jndiRoot.setUserObject(STR_JNDI_DISCONNECTED); 129 jndiTreeModel.nodeChanged(jndiRoot); 130 cleanupJndiTree(); 131 132 ctx = null; 133 jndiConnected = false; 134 } 135 136 public JndiTreeNode findJndiNodeByName(String name) 137 { 138 int i; 139 for (i = 0; i < jndiRoot.getChildCount(); i++) { 140 JndiTreeNode curr = (JndiTreeNode) jndiRoot.getChildAt(i); 141 if (name.equals(curr.getName())) 142 return curr; 143 } 144 145 return null; 146 } 147 148 public void connectAdmin(final String host, 149 final int port, 150 final String user, 151 final String passwd) 152 throws Exception { 153 try { 154 disconnectAdmin(); 155 } 156 catch (Exception exc) {} 157 158 AdminModule.connect(host, port, user, passwd, 4); 159 adminConnected = true; 160 adminConnectionStr = "//" + host + ":" + port; 161 adminRoot.setUserObject("Active Config"); 162 adminTreeModel.nodeChanged(adminRoot); 163 164 AdminTool.invokeLater(new CommandWorker() { 165 public void run() throws Exception { 166 refreshAdminData(); 167 gui.adminControllerEvent( 168 new ControllerEvent(ControllerEvent.ADMIN_CONNECTED)); 169 } 170 }); 171 } 172 173 176 private void refreshAdminData1(ServerTreeNode serverTreeNode) 177 throws ConnectException , AdminException { 178 if (Log.logger.isLoggable(BasicLevel.DEBUG)) 179 Log.logger.log(BasicLevel.DEBUG, 180 "AdminController.refreshAdminData(" + 181 serverTreeNode + ')'); 182 String [] domainNames = AdminModule.getDomainNames( 183 serverTreeNode.getServerId()); 184 TreeNode parentTreeNode = serverTreeNode.getParent(); 185 String parentDomainName = null; 186 if (parentTreeNode instanceof DomainTreeNode) { 187 DomainTreeNode dtn = (DomainTreeNode)parentTreeNode; 188 parentDomainName = dtn.getDomainName(); 189 } 190 for (int i = 0; i < domainNames.length; i++) { 191 if (! domainNames[i].equals(parentDomainName)) { 192 DomainTreeNode dtn = 193 new DomainTreeNode(this, domainNames[i]); 194 adminTreeModel.insertNodeInto( 195 dtn, 196 serverTreeNode.getDomainRoot(), 197 serverTreeNode.getDomainRoot().getChildCount()); 198 199 Server[] servers = AdminModule.getServers(domainNames[i]); 200 for (int j = 0; j < servers.length; j++) { 201 if (servers[j].getId() != 202 serverTreeNode.getServerId()) { 203 ServerTreeNode stn = 204 new ServerTreeNode(this, servers[j]); 205 adminTreeModel.insertNodeInto( 206 stn, dtn, 207 dtn.getChildCount()); 208 refreshAdminData1(stn); 209 } 210 } 211 } 212 } 213 } 214 215 void updateDestinations(int serverId, 216 MutableTreeNode destinationRoot) 217 throws ConnectException , AdminException { 218 List destList = AdminModule.getDestinations(serverId); 219 for (Iterator i = destList.iterator(); i.hasNext();) { 220 Destination dest = (Destination) i.next(); 221 DestinationTreeNode destNode; 222 if (dest instanceof Topic) { 223 destNode = new TopicTreeNode(this, (Topic)dest); 224 } else if (dest instanceof Queue) { 225 destNode = new QueueTreeNode(this, (Queue)dest); 226 } else if (dest instanceof TemporaryQueue) { 227 destNode = new TopicTreeNode(this, (Topic)dest); 228 } else if (dest instanceof TemporaryTopic) { 229 destNode = new QueueTreeNode(this, (Queue)dest); 230 } else { 231 destNode = new DestinationTreeNode(this, dest); 232 } 233 adminTreeModel.insertNodeInto( 234 destNode, 235 destinationRoot, 236 destinationRoot.getChildCount()); 237 } 238 } 239 240 void updateUsers(int serverId, 241 MutableTreeNode userRoot) 242 throws ConnectException , AdminException { 243 List userList = AdminModule.getUsers(serverId); 244 for (Iterator i = userList.iterator(); i.hasNext();) { 245 User user = (User) i.next(); 246 UserTreeNode userNode = new UserTreeNode(this, user); 247 adminTreeModel.insertNodeInto( 248 userNode, 249 userRoot, 250 userRoot.getChildCount()); 251 } 252 } 253 254 257 private void refreshAdminData2(ServerTreeNode serverTreeNode) 258 throws ConnectException , AdminException { 259 if (Log.logger.isLoggable(BasicLevel.DEBUG)) 260 Log.logger.log(BasicLevel.DEBUG, 261 "AdminController.refreshAdminData(" + 262 serverTreeNode + ')'); 263 List destList; 264 List userList; 265 try { 266 updateDestinations( 267 serverTreeNode.getServerId(), 268 serverTreeNode.getDestinationRoot()); 269 updateUsers( 270 serverTreeNode.getServerId(), 271 serverTreeNode.getUserRoot()); 272 } catch (AdminException exc) { 273 if (Log.logger.isLoggable(BasicLevel.WARN)) 274 Log.logger.log(BasicLevel.WARN, "", exc); 275 return; 276 } catch (ConnectException ce) { 277 if (Log.logger.isLoggable(BasicLevel.WARN)) 278 Log.logger.log(BasicLevel.WARN, "", ce); 279 return; 280 } 281 282 Enumeration e = serverTreeNode.getDomainRoot().children(); 283 while (e.hasMoreElements()) { 284 DomainTreeNode dtn = (DomainTreeNode)e.nextElement(); 285 Enumeration e2 = dtn.children(); 286 while (e2.hasMoreElements()) { 287 ServerTreeNode stn = (ServerTreeNode)e2.nextElement(); 288 refreshAdminData2(stn); 289 } 290 } 291 } 292 293 public void refreshAdminData() 294 throws ConnectException , AdminException { 295 if (Log.logger.isLoggable(BasicLevel.DEBUG)) 296 Log.logger.log(BasicLevel.DEBUG, 297 "AdminController.refreshAdminData()"); 298 cleanupAdminTree(); 299 300 Server localServer = AdminModule.getLocalServer(); 302 ServerTreeNode localServerNode = 303 new ServerTreeNode( 304 this, 305 localServer); 306 adminTreeModel.insertNodeInto( 307 localServerNode, adminRoot, 308 adminRoot.getChildCount()); 309 310 refreshAdminData1(localServerNode); 312 refreshAdminData2(localServerNode); 313 } 314 315 public void disconnectAdmin() throws Exception { 316 if (adminConnected) { 317 AdminModule.disconnect(); 318 } 319 320 adminRoot.setUserObject(STR_ADMIN_DISCONNECTED); 321 adminTreeModel.nodeChanged(adminRoot); 322 cleanupAdminTree(); 323 324 adminConnected = false; 325 adminConnectionStr = "Not connected"; 326 gui.adminControllerEvent(new ControllerEvent(ControllerEvent.ADMIN_DISCONNECTED)); 327 } 328 329 public void stopServer(ServerTreeNode stn) throws Exception { 330 AdminModule.stopServer(stn.getServerId()); 331 } 332 333 public void deleteServer(ServerTreeNode stn) throws Exception { 334 AdminModule.removeServer(stn.getServerId()); 335 adminTreeModel.removeNodeFromParent(stn); 336 } 337 338 public void deleteDomain(DomainTreeNode dtn) throws Exception { 339 AdminModule.removeDomain(dtn.getDomainName()); 340 adminTreeModel.removeNodeFromParent(dtn); 341 } 342 343 public void createConnectionFactory(String host, int port, 344 String name, String type) throws Exception 345 { 346 try 347 { 348 if (ctx.lookup(name) != null) 349 throw new Exception ("Name already bound in JNDI context"); 350 } 351 catch (NameNotFoundException exc) {} 352 353 Object factory = null; 354 355 if ("CF".equals(type)) 356 factory = TcpConnectionFactory.create(host, port); 357 if ("QCF".equals(type)) 358 factory = QueueTcpConnectionFactory.create(host, port); 359 if ("TCF".equals(type)) 360 factory = TopicTcpConnectionFactory.create(host, port); 361 if ("XCF".equals(type)) 362 factory = XATcpConnectionFactory.create(host, port); 363 if ("XQCF".equals(type)) 364 factory = XAQueueTcpConnectionFactory.create(host, port); 365 if ("XTCF".equals(type)) 366 factory = XATopicTcpConnectionFactory.create(host, port); 367 368 ctx.bind(name, factory); 369 370 JndiTreeNode node = new JndiTreeNode(this, ctx, new Binding(name, factory)); 371 insertJndiNode(node); 372 } 373 374 public void createDestination(ServerTreeNode serverNode, String name, String type) throws Exception 375 { 376 try 377 { 378 if (ctx.lookup(name) != null) 379 throw new Exception ("Name already bound in JNDI context"); 380 } 381 catch (NameNotFoundException exc) {} 382 383 Destination dest = null; 384 385 if ("Q".equals(type)) 386 dest = org.objectweb.joram.client.jms.Queue.create( 387 serverNode.getServerId(), name); 388 if ("T".equals(type)) 389 dest = org.objectweb.joram.client.jms.Topic.create( 390 serverNode.getServerId(), name); 391 if ("DMQ".equals(type)) 392 dest = org.objectweb.joram.client.jms.admin.DeadMQueue.create( 393 serverNode.getServerId(), name); 394 395 ctx.bind(name, dest); 396 397 JndiTreeNode node = new JndiTreeNode(this, ctx, new Binding(name, dest)); 398 insertJndiNode(node); 399 400 DestinationTreeNode destNode = new DestinationTreeNode(this, dest); 401 adminTreeModel.insertNodeInto(destNode, serverNode.getDestinationRoot(), 402 serverNode.getDestinationRoot().getChildCount()); 403 } 404 405 public void deleteObject(JndiTreeNode node) throws Exception 406 { 407 String name = node.getName(); 408 Object obj = ctx.lookup(name); 409 410 try 411 { 412 org.objectweb.joram.client.jms.Destination dest = 413 (org.objectweb.joram.client.jms.Destination) obj; 414 dest.delete(); 415 416 DestinationTreeNode dtn = findDestinationNode(adminRoot, dest); 417 if (dtn != null) 418 adminTreeModel.removeNodeFromParent(findDestinationNode(adminRoot, dest)); 419 } 420 catch (ClassCastException cce) {} 421 422 ctx.unbind(name); 423 424 jndiTreeModel.removeNodeFromParent(node); 425 } 426 427 public void createUser(ServerTreeNode serverNode, String name, String passwd) 428 throws Exception { 429 User user = User.create(name, passwd, serverNode.getServerId()); 430 UserTreeNode userNode = new UserTreeNode(this, user); 431 adminTreeModel.insertNodeInto(userNode, 432 serverNode.getUserRoot(), 433 serverNode.getUserRoot().getChildCount()); 434 } 435 436 public void createDomain(ServerTreeNode serverNode, String domainName, int port) 437 throws Exception { 438 AdminModule.addDomain(domainName, (short)serverNode.getServerId(), port); 439 DomainTreeNode dtn = new DomainTreeNode(this, domainName); 440 adminTreeModel.insertNodeInto(dtn, 441 serverNode.getDomainRoot(), 442 serverNode.getDomainRoot().getChildCount()); 443 } 444 445 public void updateUser(UserTreeNode userNode, String name, String passwd) 446 throws Exception { 447 userNode.getUser().update(name, passwd); 448 adminTreeModel.nodeChanged(userNode); 449 } 450 451 public void deleteUser(UserTreeNode node) 452 throws Exception { 453 node.getUser().delete(); 454 adminTreeModel.removeNodeFromParent(node); 455 } 456 457 public void deleteMessage(MessageTreeNode msgTn) 458 throws Exception { 459 DefaultMutableTreeNode parentTn = 460 (DefaultMutableTreeNode)msgTn.getParent(); 461 if (parentTn instanceof SubscriptionTreeNode) { 462 SubscriptionTreeNode subTn = 463 (SubscriptionTreeNode)parentTn; 464 SubscriptionRootTreeNode subRootTn = 465 (SubscriptionRootTreeNode)subTn.getParent(); 466 UserTreeNode userTn = 467 (UserTreeNode)subRootTn.getParent(); 468 ServerTreeNode serverTn = userTn.getParentServerTreeNode(); 469 userTn.getUser().deleteMessage( 470 subTn.getSubscription().getName(), 471 msgTn.getMessageId()); 472 } else { 473 MessageRootTreeNode msgRootTn = 474 (MessageRootTreeNode)parentTn; 475 QueueTreeNode queueTreeNode = 476 (QueueTreeNode)msgRootTn.getParent(); 477 queueTreeNode.getQueue().deleteMessage( 478 msgTn.getMessageId()); 479 } 480 adminTreeModel.removeNodeFromParent(msgTn); 481 } 482 483 public void clearSubscription(SubscriptionTreeNode subTn) 484 throws Exception { 485 SubscriptionRootTreeNode subRootTn = 486 (SubscriptionRootTreeNode)subTn.getParent(); 487 UserTreeNode userTn = (UserTreeNode)subRootTn.getParent(); 488 ServerTreeNode serverTn = userTn.getParentServerTreeNode(); 489 userTn.getUser().clearSubscription( 490 subTn.getSubscription().getName()); 491 while(subTn.getChildCount() > 0) { 492 MessageTreeNode msgTn = (MessageTreeNode)subTn.getChildAt(0); 493 adminTreeModel.removeNodeFromParent(msgTn); 494 } 495 } 496 497 public void clearQueue(QueueTreeNode queueTn) throws Exception { 498 queueTn.getQueue().clear(); 499 MessageRootTreeNode msgRootTn = queueTn.getMessageRootTreeNode(); 500 while(msgRootTn.getChildCount() > 0) { 501 MessageTreeNode msgTn = (MessageTreeNode)msgRootTn.getChildAt(0); 502 adminTreeModel.removeNodeFromParent(msgTn); 503 } 504 } 505 506 public int getPendingMessages(Queue q) throws Exception 507 { 508 return ((org.objectweb.joram.client.jms.Queue) q).getPendingMessages(); 509 } 510 511 public int getPendingRequests(Queue q) throws Exception 512 { 513 return ((org.objectweb.joram.client.jms.Queue) q).getPendingRequests(); 514 } 515 516 public int getSubscriptions(Topic t) throws Exception 517 { 518 return ((org.objectweb.joram.client.jms.Topic) t).getSubscriptions(); 519 } 520 521 public int getDefaultThreshold(int serverId) throws Exception 522 { 523 return AdminModule.getDefaultThreshold(serverId); 524 } 525 526 public void setDefaultThreshold(int serverId, int threshold) throws Exception 527 { 528 AdminModule.setDefaultThreshold(serverId, threshold); 529 } 530 531 public DeadMQueue getDefaultDMQ(int serverId) throws Exception 532 { 533 return AdminModule.getDefaultDMQ(serverId); 534 } 535 536 public void setDefaultDMQ(int serverId, DeadMQueue dmq) throws Exception 537 { 538 AdminModule.setDefaultDMQ(serverId, dmq); 539 } 540 541 public void unsetDefaultThreshold(int serverId) throws Exception 542 { 543 AdminModule.setDefaultThreshold(serverId, -1); 544 } 545 546 public void unsetDefaultDMQ(int serverId) throws Exception 547 { 548 AdminModule.setDefaultDMQ(serverId, null); 549 } 550 551 public int getUserThreshold(User user) throws Exception 552 { 553 return user.getThreshold(); 554 } 555 556 public void setUserThreshold(User user, int threshold) throws Exception 557 { 558 user.setThreshold(threshold); 559 } 560 561 public DeadMQueue getUserDMQ(User user) throws Exception 562 { 563 return user.getDMQ(); 564 } 565 566 public void setUserDMQ(User user, DeadMQueue dmq) throws Exception 567 { 568 user.setDMQ(dmq); 569 } 570 571 public void unsetUserThreshold(User user) throws Exception 572 { 573 user.setThreshold(-1); 574 } 575 576 public void unsetUserDMQ(User user) throws Exception 577 { 578 user.setDMQ(null); 579 } 580 581 public int getQueueThreshold(Queue queue) throws Exception 582 { 583 return ((org.objectweb.joram.client.jms.Queue) queue).getThreshold(); 584 } 585 586 public void setQueueThreshold(Queue queue, int threshold) throws Exception 587 { 588 ((org.objectweb.joram.client.jms.Queue) queue).setThreshold(threshold); 589 } 590 591 public DeadMQueue getDestinationDMQ(Destination dest) throws Exception 592 { 593 return ((org.objectweb.joram.client.jms.Destination) dest).getDMQ(); 594 } 595 596 public void setDestinationDMQ(Destination dest, DeadMQueue dmq) throws Exception 597 { 598 ((org.objectweb.joram.client.jms.Destination) dest).setDMQ(dmq); 599 } 600 601 public void unsetQueueThreshold(Queue queue) throws Exception 602 { 603 ((org.objectweb.joram.client.jms.Queue) queue).setThreshold(-1); 604 } 605 606 public void unsetDestinationDMQ(Destination dest) throws Exception 607 { 608 ((org.objectweb.joram.client.jms.Destination) dest).setDMQ(null); 609 } 610 611 public boolean isFreelyReadable(Destination dest) throws Exception 612 { 613 return ((org.objectweb.joram.client.jms.Destination) dest).isFreelyReadable(); 614 } 615 616 public boolean isFreelyWritable(Destination dest) throws Exception 617 { 618 return ((org.objectweb.joram.client.jms.Destination) dest).isFreelyWriteable(); 619 } 620 621 public void setFreeReading(Destination dest) throws Exception 622 { 623 ((org.objectweb.joram.client.jms.Destination) dest).setFreeReading(); 624 } 625 626 public void setFreeWriting(Destination dest) throws Exception 627 { 628 ((org.objectweb.joram.client.jms.Destination) dest).setFreeWriting(); 629 } 630 631 public void unsetFreeReading(Destination dest) throws Exception 632 { 633 ((org.objectweb.joram.client.jms.Destination) dest).unsetFreeReading(); 634 } 635 636 public void unsetFreeWriting(Destination dest) throws Exception 637 { 638 ((org.objectweb.joram.client.jms.Destination) dest).unsetFreeWriting(); 639 } 640 641 public List getAuthorizedReaders(Destination dest) throws Exception 642 { 643 return ((org.objectweb.joram.client.jms.Destination) dest).getReaders(); 644 } 645 646 public List getAuthorizedWriters(Destination dest) throws Exception 647 { 648 return ((org.objectweb.joram.client.jms.Destination) dest).getWriters(); 649 } 650 651 public void setReader(User user, Destination dest) throws Exception 652 { 653 ((org.objectweb.joram.client.jms.Destination) dest).setReader(user); 654 } 655 656 public void setWriter(User user, Destination dest) throws Exception 657 { 658 ((org.objectweb.joram.client.jms.Destination) dest).setWriter(user); 659 } 660 661 public void unsetReader(User user, Destination dest) throws Exception 662 { 663 ((org.objectweb.joram.client.jms.Destination) dest).unsetReader(user); 664 } 665 666 public void unsetWriter(User user, Destination dest) throws Exception 667 { 668 ((org.objectweb.joram.client.jms.Destination) dest).unsetWriter(user); 669 } 670 671 public String getAdminConnectionStatus() { return adminConnectionStr; } 672 673 public boolean isAdminConnected() { return adminConnected; } 674 675 public boolean isJndiConnected() { return jndiConnected; } 676 677 private void cleanupAdminTree() 678 { 679 while (adminRoot.getChildCount() > 0) 680 adminTreeModel.removeNodeFromParent((MutableTreeNode) adminRoot.getChildAt(0)); 681 } 682 683 private void cleanupJndiTree() 684 { 685 while (jndiRoot.getChildCount() > 0) 686 jndiTreeModel.removeNodeFromParent((MutableTreeNode) jndiRoot.getChildAt(0)); 687 } 688 689 private void insertJndiNode(JndiTreeNode n) 690 { 691 int i; 692 for (i = 0; i < jndiRoot.getChildCount(); i++) { 693 JndiTreeNode curr = (JndiTreeNode) jndiRoot.getChildAt(i); 694 if (n.getName().compareTo(curr.getName()) < 0) 695 break; 696 } 697 698 jndiTreeModel.insertNodeInto(n, jndiRoot, i); 699 } 700 701 private DestinationTreeNode findDestinationNode(TreeNode from, Destination dest) { 702 for (int i = 0; i < from.getChildCount(); i++) { 703 TreeNode current = from.getChildAt(i); 704 try { 705 DestinationTreeNode dtn = (DestinationTreeNode) current; 706 if (dtn.getDestination().equals(dest)) 707 return dtn; 708 } 709 catch (ClassCastException exc) { 710 if (current.getChildCount() > 0) 711 return findDestinationNode(current, dest); 712 } 713 } 714 715 return null; 716 } 717 718 protected String findDestinationJndiName(Destination dest) { 719 for (int i = 0; i < jndiRoot.getChildCount(); i++) { 720 JndiTreeNode current = (JndiTreeNode) jndiRoot.getChildAt(i); 721 Object obj = current.getObject(); 722 if (obj instanceof Destination && ((Destination) obj).equals(dest)) 723 return current.getName(); 724 } 725 726 return null; 727 } 728 729 protected void notifyListener(ControllerEvent e) 730 { 731 if (gui != null) 732 gui.adminControllerEvent(e); 733 } 734 735 736 } 737 | Popular Tags |