/** * Returns normalized version of the Policy that is refered by self. The specified PolicyRegistry * is used to lookup for the Policy that is refered and <tt>dee</tt> indicates the level of * normalization fo the returning Policy. * * @param reg the PolicyRegistry that is used to resolved the Policy refered by self * @param deep the falg to indicate whether returning Policy should be fully normailized * @return the normalized version fo the Policy refered by self */ public PolicyComponent normalize(PolicyRegistry reg, boolean deep) { String key = getURI(); int pos = key.indexOf("#"); if (pos == 0) { key = key.substring(1); } else if (pos > 0) { key = key.substring(0, pos); } Policy policy = reg.lookup(key); if (policy == null) { policy = getRemoteReferencedPolicy(key); if (policy == null) { throw new RuntimeException(key + " can't be resolved"); } reg.register(key, policy); } return policy.normalize(reg, deep); }