org.apache.muse.ws.resource.metadata.impl
Class ExternalChangeApprover

java.lang.Object
  extended by org.apache.muse.ws.resource.properties.listeners.AbstractChangeApprover
      extended by org.apache.muse.ws.resource.metadata.impl.ExternalChangeApprover
All Implemented Interfaces:
PropertyChangeApprover

public class ExternalChangeApprover
extends AbstractChangeApprover

ExternalChangeApprover is a PropertyChangeApprover that throws an exception if an external client tries to change a read-only property. This approver can enforce behavior such as read-only, mutable properties (properties that a user cannot change but which change on their own or through side effects); it also allows programmers to prevent the modification of properties through the generic WS-RP SetResourceProperties.

In this class, the concept of "read-only" is meant to imply external privileges - it may be the case that internal components can modify the property in order to reflect its actual value. An example of such a scenario would be free disk space - a user cannot just change the amount of free disk space directly, but it will change on its own as a result of operations on the file system.

Author:
Dan Jemiolo (danj)

Constructor Summary
ExternalChangeApprover(QName qname, boolean isReadOnly)
          Creates a new approver for the property with the given name.
 
Method Summary
 boolean isReadOnly()
           
 void validateChange(Element oldValue, Element newValue, Object token)
          Throws an exception if the property is read-only and the given security token does not match the one held by the approver.
 
Methods inherited from class org.apache.muse.ws.resource.properties.listeners.AbstractChangeApprover
getPropertyName, isSecure, setSecurityToken
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalChangeApprover

public ExternalChangeApprover(QName qname,
                              boolean isReadOnly)
Creates a new approver for the property with the given name. The approver will throw an exception if the second parameter is "true" and the change request comes from an external client.

Parameters:
qname - The name of the property to monitor.
isReadOnly - True if the property cannot be modified by external clients.
Method Detail

isReadOnly

public boolean isReadOnly()
Returns:
True if the property being monitored cannot be changed by external clients.

validateChange

public void validateChange(Element oldValue,
                           Element newValue,
                           Object token)
                    throws BaseFault
Throws an exception if the property is read-only and the given security token does not match the one held by the approver.

Parameters:
oldValue - The current (about to be "old") value of the resource property. This should be null if the change is a WS-RP Insert.
newValue - The potential new value of the resource property. This should be null if the change is a WS-RP Delete.
token - The security token provided by the caller who wishes to make the property change.
Throws:
BaseFault -
  • If the modification is not allowed for any reason.


Copyright © 2005-2011 Apache Web Services - Muse. All Rights Reserved.