Package com.sun.xacml.attr

Examples of com.sun.xacml.attr.AttributeValue


            throw new RuntimeException(e);
        }

        Set<Attribute> subjectAttributes = new HashSet<Attribute>(1 + role.getAttributes().size());

        AttributeValue roleAttributeValue = new AnyURIAttribute(roleURI);
        Attribute roleAttribute = new Attribute(XACMLConstants.RoleAttributeURI, null, null,
                roleAttributeValue);
        subjectAttributes.add(roleAttribute);

        for (Attribute attr : role.getAttributes()) {


                    if (value instanceof Geometry) {
                        if (((Geometry) value).getUserData() == null)
                            throw new RuntimeException("Property: " + propertyName
                                    + " : Geometry must have srs name as userdata");
                    }
                    AttributeValue attrValue = createAttributeValueFromObject(value);
                    Attribute xacmlAttr = new Attribute(attr.getId(), null, null, attrValue);
                    role.getAttributes().add(xacmlAttr);
                }
            }
        }

        }

    }

    protected AttributeValue createAttributeValueFromObject(Serializable object) {
        AttributeValue retVal = null;

        if (object instanceof String)
            retVal = new StringAttribute((String) object);
        if (object instanceof URI)
            retVal = new AnyURIAttribute((URI) object);

     */
    private Set<Attribute> getAttributes(String uri, String type, final String value)
            throws URISyntaxException {
        Set<Attribute> attrs = new HashSet<Attribute>();

        AttributeValue attrValues = new AttributeValue(new URI(type)) {
            @Override
            public String encode() {
                return value;
            }
        };

     * @throws URISyntaxException
     */
    private Attribute getAttribute(String uri, String type, final String value)
            throws URISyntaxException {

        AttributeValue attrValues = new AttributeValue(new URI(type)) {
            @Override
            public String encode() {
                return value;
            }
        };

            subject = context.getSubjectAttribute(new URI(StringAttribute.identifier), new URI(
                    "urn:oasis:names:tc:xacml:1.0:subject:subject-id"), subjectCategory);
            if (subject.getAttributeValue().isBag()) {
                BagAttribute attr = (BagAttribute) subject.getAttributeValue();
                for (Iterator iterator = attr.iterator(); iterator.hasNext();) {
                    AttributeValue val = (AttributeValue) iterator.next();
                    subjectId = val.encode();
                    if (log.isDebugEnabled()) {
                        log.debug(String.format("Finding attributes for the subject %1$s",
                                subjectId));
                    }
                    break;
                }

            }

            resource = context.getResourceAttribute(new URI(StringAttribute.identifier), new URI(
                    "urn:oasis:names:tc:xacml:1.0:resource:resource-id"), null);
            if (resource.getAttributeValue().isBag()) {
                BagAttribute attr = (BagAttribute) resource.getAttributeValue();
                for (Iterator iterator = attr.iterator(); iterator.hasNext();) {
                    AttributeValue val = (AttributeValue) iterator.next();
                    resourceId = val.encode();
                    if (log.isDebugEnabled()) {
                        log.debug(String.format("Finding attributes for the resource %1$s",
                                resourceId));
                    }
                    break;
                }

            }

            for (Iterator iterator = finders.iterator(); iterator.hasNext();) {
                PIPAttributeFinder pipAttributeFinder = (PIPAttributeFinder) iterator.next();
                if (log.isDebugEnabled()) {
                    log.debug(String.format(
                            "Finding attributes with the PIP attribute handler %1$s",
                            pipAttributeFinder.getClass()));
                }
                Set<String> attrs = pipAttributeFinder.getAttributeValues(subjectId, resourceId,
                        attributeId.toString());
                if (attrs != null) {
                    for (Iterator iterAttr = attrs.iterator(); iterAttr.hasNext();) {
                        final String attr = (String) iterAttr.next();
                        AttributeValue attribute = getAttribute(attr, attributeType.toString());
                        attrBag.add(attribute);
                    }
                }
            }

        }
        if (HexBinaryAttribute.identifier.equals(type)) {
            return new HexBinaryAttribute(value.getBytes());
        }

        return new AttributeValue(new URI(type)) {
            @Override
            public String encode() {
                return value;
            }
        };

  public Object getValueAt(int row, int col)
  {
    if(row == values.length)
      {return "";}
    final AttributeValue value = values[row][col];
    if(value == null)
      {return UNSPECIFIED;}
   
    final URI functionId = functions[row][col];
    if(functionId == null)
      {return UNSPECIFIED;}
    final String functionString = abbrev.getAbbreviatedTargetFunctionId(functionId, attributes[col].getType());
    if(functionString == null)
    {
      LOG.warn("Abbreviated function string was unexpectedly null.  FunctionId URI was '" + functionId + "' (Row " + row + ", column " + col + ")");
      return UNSPECIFIED;
    }
    final String stringValue = value.encode();
    if(stringValue == null)
    {
      LOG.warn("String representation of a non-null attribute value was unexpectedly null.  (Row " + row + ", column " + col + ")");
      return UNSPECIFIED;
    }

    for(int row = 0; row < values.length; ++row)
    {
      final List<TargetMatch> matches = new ArrayList<TargetMatch>(attributes.length);
      for(int col = 0; col < attributes.length; ++col)
      {
        final AttributeValue value = values[row][col];
        final URI functionId = functions[row][col];
        if(value != null && functionId != null)
        {
          Function f;
          try

     
  }
 
  public void setValue(int row, int col, TargetMatch match)
  {
    final AttributeValue value = match.getMatchValue();
    final URI functionId = match.getMatchFunction().getIdentifier();
    setValue(functionId, value, row, col);
  }

TOP

Related Classes of com.sun.xacml.attr.AttributeValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.