1 23 24 package com.sun.enterprise.cli.commands; 25 26 import com.sun.enterprise.cli.framework.*; 27 28 import java.util.Vector ; 29 import javax.naming.NameClassPair ; 30 import java.util.Iterator ; 31 import java.util.ArrayList ; 32 import javax.management.MBeanServerConnection ; 33 import javax.management.ObjectName ; 34 35 36 public class ListJNDIEntriesCommand extends GenericCommand 37 { 38 39 private static final String CONTEXT_OPTION = "context"; 40 41 public void displayExceptionMessage(Exception e) throws CommandException 42 { 43 Throwable t = e.getCause(); 44 45 if(t != null) 46 CLILogger.getInstance().printDetailMessage(t.getMessage()); 47 else if(e != null) 48 CLILogger.getInstance().printDetailMessage(e.getMessage()); 49 50 throw new CommandException(getLocalizedString("CommandUnSuccessful", 51 new Object [] {name} ), e); 52 } 53 54 55 protected void handleReturnValue(Object retVal) 56 { 57 final ArrayList list =(ArrayList )retVal; 58 59 if (!list.isEmpty()) 60 { 61 CLILogger.getInstance().printDetailMessage(getLocalizedString( 62 "JndiEntries", new Object [] 63 {(String ) getOperands().get(0), 64 getOption(CONTEXT_OPTION)==null? 65 "root":getOption(CONTEXT_OPTION)}) ); 66 67 final Iterator iterator= list.iterator(); 68 while (iterator.hasNext()) 69 { 70 final NameClassPair nameClassPair = (NameClassPair ) iterator.next(); 71 72 CLILogger.getInstance().printMessage(getLocalizedString("NameClassPair", new Object []{nameClassPair.getName(), nameClassPair.getClassName()})); 73 } 74 } 75 } 76 } 77 | Popular Tags |