1 23 24 29 30 package com.sun.enterprise.deployment; 31 32 import java.util.Vector ; 33 import java.util.Iterator ; 34 import java.util.Collection ; 35 36 43 public class MethodPermissionDescriptor extends DescribableDescriptor { 44 45 Vector methods = new Vector (); 46 Vector mps = new Vector () ; 47 48 49 public MethodPermissionDescriptor() { 50 } 51 52 public void addMethod(MethodDescriptor aMethod) { 53 methods.add(aMethod); 54 } 55 56 public void addMethods(Collection methods) { 57 this.methods.addAll(methods); 58 } 59 60 public void addMethodPermission(MethodPermission mp) { 61 mps.add(mp); 62 } 63 64 public MethodDescriptor[] getMethods() { 65 MethodDescriptor[] array = new MethodDescriptor[methods.size()]; 66 methods.copyInto(array); 67 return array; 68 } 69 70 public MethodPermission[] getMethodPermissions() { 71 MethodPermission[] array = new MethodPermission[mps.size()]; 72 mps.copyInto(array); 73 return array; 74 } 75 76 public void print(StringBuffer toStringBuffer) { 77 StringBuffer buffer = toStringBuffer; 78 buffer.append("Method Permission " + (getDescription()==null?"":getDescription()) ); 79 buffer.append("\nFor the following Permissions "); 80 for (Iterator mpsIterator = mps.iterator();mpsIterator.hasNext();) { 81 MethodPermission mp = (MethodPermission) mpsIterator.next(); 82 mp.print(buffer); 83 buffer.append("\n"); 84 } 85 buffer.append("\nFor the following ").append(methods.size()).append(" methods\n"); 86 for (Iterator methodsIterator = methods.iterator();methodsIterator.hasNext();) { 87 MethodDescriptor md = (MethodDescriptor) methodsIterator.next(); 88 md.print(buffer); 89 buffer.append("\n"); 90 } 91 } 92 } 93 | Popular Tags |