Attibutes are objects used to tag dedicated items to which a SEMPER service can be applied. In addition to its function with items, Attributes are used for tagging services. Attributes can be bundled in sets of attributes, AttributeSet.
At the moment, the following attributes are included in this package directly:
In addition, other layers may define their own attributes by implementing the interface Attribute.
At the moment there are the following user attributes:
Four services use Attributes up to now: The seccomm block, the context service of the txlayer, the transfer service of the txlayer and the the exchange service of the txlayer
The same attribute can have different meanings depending on the service being attributed. For example, confidentiality will modify the behavior of the secure communication and of TXContexts, but not the behaviour of TransferTransactions (see 235SR02).
The attribute determines the service options of the service applied to the item. Such an item is called attributable. Technically, this means that the item has to implement the 'Attributable' interface. The Attributable interface provides methods for
Each attributable item keeps its attributes in an AttributeSet. When implementing the Attributable interface, the attributed item can make restrictions on the combination of the attributes in its wrapping methods by controlling the access to its attribute set.
The Attributable interface is currently not used in the Transfer- and Exchangelayer.
This Interface is easiest to use if the class implementing it has a variable AttributeSet to map the interface method through to it. The interface has methods
This interface serves as a gathering concept for all the attributes.
This is a set with the constraint that it only contains attributes.
This is a Subclass of Attribute.
The attributes are, at the moment, the following:
To construct a set with the attributes 'Confidentiality' and 'Authenticity', there are several ways:
1. AttributeSet aSet = new AttibuteSet();
2. aSet.insert(new Confidentiality(A));
3. aSet.insert(new Authenticity());
All this can be done in one step:
1. AttributeSet aSet = new AttibuteSet(new Confidentiality(), new Authenticity());
To insert more than six attributes at once there is an array to pack and to pass as one parameter to the constructor.
An Attribute can be deleted from a set:
1. AttributeSet aSet = new AttributeSet(); 2. Attribute a = new Authenticity(); 3. aSet.insert(a); 4. aSet.delete(a);
There is a method to get the elements of the set for examining them:
Attributes[] aa = aSet.getArrayOfAttributes(); for(int i=0; i < aa.length; i++) { aa[i].doSth(_); }
Perhaps there will one day be an iterator for the Set class.
Giving attributes to an attributable item works this way:
Attributable x = new SomeAttributableClass(_); x.addAttribute(new Authenticity()); x.addAttribute(new Fairness());
If an Attributable denies to add an attribute an exception will be thrown. This will be implemented once later. Deleting an attribute works the in the same manner.