Esempio n. 1
0
  protected void store(String... fields) throws FactoryException {
    DataTypeFactory thisDataTypeFactory = this.getDataTypeFactory();
    Identifier identifierCategory = new IdentifierImpl(fields[0]);
    Identifier identifierAttribute = new IdentifierImpl(fields[1]);
    Identifier identifierDataType = new IdentifierImpl(fields[2]);
    String issuer = fields.length == 5 ? fields[3] : null;
    String value = fields[fields.length - 1];

    DataType<?> dataType = thisDataTypeFactory.getDataType(identifierDataType);
    if (dataType == null) {
      logger.error("Unknown data type " + identifierDataType.stringValue());
      return;
    }

    AttributeValue<?> attributeValue = null;
    try {
      attributeValue = dataType.createAttributeValue(value);
    } catch (DataTypeException ex) {
      throw new FactoryException("DataTypeException creating AttributeValue", ex);
    }
    Attribute attribute =
        new StdMutableAttribute(
            identifierCategory, identifierAttribute, attributeValue, issuer, false);
    this.listAttributes.add(attribute);
  }
Esempio n. 2
0
 protected DataTypeFactory getDataTypeFactory() throws FactoryException {
   if (this.dataTypeFactory == null) {
     this.dataTypeFactory = DataTypeFactory.newInstance();
   }
   return this.dataTypeFactory;
 }