org.entityfs.cap.entityattrs.impl
Class UidGidEntityOwnershipSetter<T extends UidGidAttributes>

java.lang.Object
  extended by org.entityfs.support.lang.ObjectProxySupport<EntityAttributesPreparer<T>>
      extended by org.entityfs.cap.entityattrs.impl.UidGidEntityOwnershipSetter<T>
All Implemented Interfaces:
EntityAttributesPreparer<T>

public class UidGidEntityOwnershipSetter<T extends UidGidAttributes>
extends ObjectProxySupport<EntityAttributesPreparer<T>>
implements EntityAttributesPreparer<T>

This implementation of EntityAttributesPreparer tries to use the calling thread's AccessController's current Subject (which must be a UidGidSubject) to set the owner of the new entity. If it cannot determine the UID and GID of the current Subject, it sets a default UID and GID.

Since:
1.0
Author:
Karl Gustafsson
In_jar:
entityfs-entity_attributes

Constructor Summary
UidGidEntityOwnershipSetter(EntityAttributesPreparer<T> proxied, int defaultUid, int defaultGid, LogAdapterHolder lah, AccessController ac)
          Create a new ownership setter.
 
Method Summary
 T prepareEntityAttributes(String name, T attr)
          Prepare the entity attributes for the new entity.
 
Methods inherited from class org.entityfs.support.lang.ObjectProxySupport
equals, getProxied, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UidGidEntityOwnershipSetter

public UidGidEntityOwnershipSetter(EntityAttributesPreparer<T> proxied,
                                   int defaultUid,
                                   int defaultGid,
                                   LogAdapterHolder lah,
                                   AccessController ac)
Create a new ownership setter.

Parameters:
proxied - A proxied preparer. This preparer is called before this preparer prepares the entity attributes. May be null.
defaultUid - The default UID to use if the UID of the thread creating the entity cannot be determined.
defaultGid - The default GID to use if the GID of the thread creating the entity cannot be determined.
lah - The file system's LogAdapterHolder.
ac - The file system's AccessController.
Method Detail

prepareEntityAttributes

public T prepareEntityAttributes(String name,
                                 T attr)
Description copied from interface: EntityAttributesPreparer
Prepare the entity attributes for the new entity.

This method does not have to save the new attributes. That is the responsibility of the caller.

Specified by:
prepareEntityAttributes in interface EntityAttributesPreparer<T extends UidGidAttributes>
Parameters:
name - The name of the new entity.
attr - The attributes object.
Returns:
The modified attributes instance, (attr).