/** * Adds a permission object to the current collection of permission objects. * * @param permission the Permission object to add. * * @exception SecurityException - if this PermissionCollection object * has been marked readonly */ public void add(Permission permission) { if (isReadOnly()) throw new IllegalArgumentException("Read only collection"); if (!(permission instanceof EJBMethodPermission)) throw new IllegalArgumentException("Wrong permission type"); EJBMethodPermission p = (EJBMethodPermission)permission; if (collection.contains(p)) return; else collection.add(p); addEJBMethodPermission(p); }
protected boolean methodImplies(HashMap<String, HashSet<String>> interfaces, EJBMethodPermission.MethodSpec spec) { if (interfaces == null) return false; String interfaceKey = (spec.methodInterface == null || spec.methodInterface.length() == 0? WILDCARD:spec.methodInterface); HashSet<String> parameters = interfaces.get(interfaceKey); if (interfaceImplies(parameters, spec)) return true; if (interfaceKey != WILDCARD) { return interfaceImplies(interfaces.get(WILDCARD), spec); } return false; }
/** * Checks to see if the specified permission is implied by * the collection of Permission objects held in this PermissionCollection. * * @param permission the Permission object to compare. * * @return true if "permission" is implied by the permissions in * the collection, false if not. */ public boolean implies(Permission permission) { if (!(permission instanceof EJBMethodPermission)) return false; EJBMethodPermission p = (EJBMethodPermission)permission; EJBMethodPermission.MethodSpec spec = p.methodSpec; HashMap<String, HashMap<String, HashSet<String>>> methods = permissions.get(p.getName()); if (methods == null) return false; if (methods == ALL_METHODS) return true; String methodKey = (spec.methodName == null || spec.methodName.length() == 0? WILDCARD:spec.methodName); HashMap<String, HashSet<String>> interfaces = methods.get(methodKey); if (methodImplies(interfaces, spec)) return true; if (methodKey != WILDCARD) { return methodImplies(methods.get(WILDCARD), spec); } return false; }
/** * Checks to see if the specified permission is implied by * the collection of Permission objects held in this PermissionCollection. * * @param permission the Permission object to compare. * * @return true if "permission" is implied by the permissions in * the collection, false if not. */ public boolean implies(Permission permission) { if (!(permission instanceof EJBMethodPermission)) return false; EJBMethodPermission p = (EJBMethodPermission)permission; EJBMethodPermission.MethodSpec spec = p.methodSpec; HashMap<String, HashMap<String, HashSet<String>>> methods = permissions.get(p.getName()); if (methods == null) return false; if (methods == ALL_METHODS) return true; String methodKey = (spec.methodName == null || spec.methodName.length() == 0? WILDCARD:spec.methodName); HashMap<String, HashSet<String>> interfaces = methods.get(methodKey); if (methodImplies(interfaces, spec)) return true; if (methodKey != WILDCARD) { return methodImplies(methods.get(WILDCARD), spec); } return false; }
/** * Checks to see if the specified permission is implied by * the collection of Permission objects held in this PermissionCollection. * * @param permission the Permission object to compare. * * @return true if "permission" is implied by the permissions in * the collection, false if not. */ public boolean implies(Permission permission) { if (!(permission instanceof EJBMethodPermission)) return false; EJBMethodPermission p = (EJBMethodPermission)permission; EJBMethodPermission.MethodSpec spec = p.methodSpec; HashMap<String, HashMap<String, HashSet<String>>> methods = permissions.get(p.getName()); if (methods == null) return false; if (methods == ALL_METHODS) return true; String methodKey = (spec.methodName == null || spec.methodName.length() == 0? WILDCARD:spec.methodName); HashMap<String, HashSet<String>> interfaces = methods.get(methodKey); if (methodImplies(interfaces, spec)) return true; if (methodKey != WILDCARD) { return methodImplies(methods.get(WILDCARD), spec); } return false; }
public PermissionCollection newPermissionCollection() { return new EJBMethodPermissionCollection(); }
/** * Adds a permission object to the current collection of permission objects. * * @param permission the Permission object to add. * * @exception SecurityException - if this PermissionCollection object * has been marked readonly */ public void add(Permission permission) { if (isReadOnly()) throw new IllegalArgumentException("Read only collection"); if (!(permission instanceof EJBMethodPermission)) throw new IllegalArgumentException("Wrong permission type"); EJBMethodPermission p = (EJBMethodPermission)permission; if (collection.contains(p)) return; else collection.add(p); addEJBMethodPermission(p); }
/** * Adds a permission object to the current collection of permission objects. * * @param permission the Permission object to add. * * @exception SecurityException - if this PermissionCollection object * has been marked readonly */ public void add(Permission permission) { if (isReadOnly()) throw new IllegalArgumentException("Read only collection"); if (!(permission instanceof EJBMethodPermission)) throw new IllegalArgumentException("Wrong permission type"); EJBMethodPermission p = (EJBMethodPermission)permission; if (collection.contains(p)) return; else collection.add(p); addEJBMethodPermission(p); }
public PermissionCollection newPermissionCollection() { return new EJBMethodPermissionCollection(); }
public PermissionCollection newPermissionCollection() { return new EJBMethodPermissionCollection(); }
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); permissions = new HashMap<String, HashMap<String, HashMap<String, HashSet<String>>>>(); for (Permission p: collection) { addEJBMethodPermission((EJBMethodPermission)p); } }
protected boolean methodImplies(HashMap<String, HashSet<String>> interfaces, EJBMethodPermission.MethodSpec spec) { if (interfaces == null) return false; String interfaceKey = (spec.methodInterface == null || spec.methodInterface.length() == 0? WILDCARD:spec.methodInterface); HashSet<String> parameters = interfaces.get(interfaceKey); if (interfaceImplies(parameters, spec)) return true; if (interfaceKey != WILDCARD) { return interfaceImplies(interfaces.get(WILDCARD), spec); } return false; }
protected boolean methodImplies(HashMap<String, HashSet<String>> interfaces, EJBMethodPermission.MethodSpec spec) { if (interfaces == null) return false; String interfaceKey = (spec.methodInterface == null || spec.methodInterface.length() == 0? WILDCARD:spec.methodInterface); HashSet<String> parameters = interfaces.get(interfaceKey); if (interfaceImplies(parameters, spec)) return true; if (interfaceKey != WILDCARD) { return interfaceImplies(interfaces.get(WILDCARD), spec); } return false; }
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); permissions = new HashMap<String, HashMap<String, HashMap<String, HashSet<String>>>>(); for (Permission p: collection) { addEJBMethodPermission((EJBMethodPermission)p); } }
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); permissions = new HashMap<String, HashMap<String, HashMap<String, HashSet<String>>>>(); for (Permission p: collection) { addEJBMethodPermission((EJBMethodPermission)p); } }