import java.util.*;

import jet.server.api.admin.security.JGroup;
import jet.server.api.admin.security.JRole;
import jet.server.api.admin.security.JUser;


public  class CatchInfo {
	

	public void printArray(String tt, Object[] aa) {
		printTitle(tt);
		if (aa == null) {
		} else {	
			for (int i = 0; i < aa.length ; i++) {
				System.out.println(aa[i].toString());
			}
		}	
	}

	public void printList(String tt, List aa) {
		printTitle(tt);
		if (aa == null) {
		} else {	
			for (int i = 0; i < aa.size() ; i++) {
				System.out.println(aa.get(i).toString());
			}
		}	
	}

	 public void printEnumeration(String tt, Enumeration e) {
			printTitle(tt);
			while(e.hasMoreElements())
				System.out.println(
			e.nextElement().toString());
	 }
	 
	 public Vector getVectorFromEnumeration(Enumeration e){
		 Vector vv = null;
		 vv=new Vector();
			while(e.hasMoreElements())
			vv.add(e.nextElement().toString());
			
		return vv;	
		 
		 
	 }
	 public void printTitle(String tt) {
		System.out.println(tt + ":................");		 
	 }

	 public void printSring(String tt, String info) {
		 printTitle(tt);
		 System.out.println(tt + ":................");		 
      }
	 
		public void JgroupPrint(JGroup JgroupNames) {
			JGroup jpn = null;
			String[] parentgroups, rolenames, subgroupnames, usernames;		
			jpn = JgroupNames;
			parentgroups = jpn.getParentGroupNames();
			printArray("parent groups", parentgroups);
			rolenames = jpn.getRoleNames();
			printArray("role names", rolenames);
			subgroupnames = jpn.getSubGroupNames();
			printArray("sub group names", subgroupnames);
			usernames = jpn.getUserNames();			
			printArray("user names", usernames);
		}
		
		public void JRolePrint(JRole JgroupNames) {
			JRole jpn = null;
			String[] parentgroups, groupnames, subgroupnames, usernames;		
			jpn = JgroupNames;
			parentgroups = jpn.getParentRoleNames();
			printArray("parent groups", parentgroups);
			groupnames = jpn.getGroupNames();
			printArray("group names", groupnames);
			subgroupnames = jpn.getSubRoleNames();
			printArray("sub group names", subgroupnames);
			usernames = jpn.getUserNames();			
			printArray("user names", usernames);
		}

		public void JUserPrint(JUser JUser) {
			JUser ju = null;
			String[] rolenames, groupnames;
			groupnames = ju.getGroupNames();
			printArray("group names", groupnames);
			rolenames = ju.getRoleNames();
			printArray("Role names", rolenames);
			printSring("user name:", ju.getName());
			printSring("user full name:", ju.getFullName());
			
		}
		
		public void printHash(Hashtable ht){    		    
			  Enumeration key=ht.keys();
			  Enumeration allvalue=ht.elements(); 
			  while(key.hasMoreElements())
			  {    
			  Object str=key.nextElement();
			  Object strv=allvalue.nextElement();
			  System.out.println(str.toString()+" : "+strv.toString());
			  }    
		}		  
}	