'Constructor.
Args:
predicate: The name of this attribute - must look like a URL
(e.g. aff4:contains). Will be used to store the attribute.
attribute_type: The RDFValue type of this attributes.
description: A one line description of what this attribute represents.
name: A human readable name for the attribute to be used in filters.
_copy: Used internally to create a copy of this object without
registering.
default: A default value will be returned if the attribute is not set on
an object. This can be a constant or a callback which receives the fd
itself as an arg.
index: The name of the index to use for this attribute. If None, the
attribute will not be indexed.
versioned: Should this attribute be versioned? Non-versioned attributes
always overwrite other versions of the same attribute.
lock_protected: If True, this attribute may only be set if the object was
opened via OpenWithLock().
creates_new_object_version: If this is set, a write to this attribute
will also write a new version of the parent attribute. This should be
False for attributes where lots of entries are collected like logs.'

def __init__(self, predicate, attribute_type=rdfvalue.RDFString, description='', name=None, _copy=False, default=None, index=None, versioned=True, lock_protected=False, creates_new_object_version=True):

    self.name = name
    self.predicate = predicate
    self.attribute_type = attribute_type
    self.description = description
    self.default = default
    self.index = index
    self.versioned = versioned
    self.lock_protected = lock_protected
    self.creates_new_object_version = creates_new_object_version
    self.field_names = []
    if (not _copy):
        try:
            old_attribute = Attribute.PREDICATES[predicate]
            if (old_attribute.attribute_type != attribute_type):
                msg = ('Attribute    %s    defined    with    conflicting    types    (%s,    %s)' % (predicate, old_attribute.attribute_type.__class__.__name__, attribute_type.__class__.__name__))
                logging.error(msg)
                raise RuntimeError(msg)
        except KeyError:
            pass
        self.PREDICATES[predicate] = self
        if name:
            self.NAMES[name] = self
