org.sandev.basics.util
Interface Authorizer

All Known Implementing Classes:
AuthorizerNode

public interface Authorizer

The Authorizer interface identifies a node as being able to perform the special purpose functions required for secure processing. These functions are integral to secure messaging.

The messaging configuration for an authorizer is determined from the configuration of other nodes, so it does not declare any messaging parameters itself.


Method Summary
 void deliver(SandMessage msg)
          An authorizer must provide a deliver method.
 AuthFilter getAuthFilter()
          An authorizer works with an AuthFilter, and must provide access to it for use elsewhere.
 SandMessage query(SandMessage msg, java.lang.String recipient, int optimize)
          An authorizer must provide a query method.
 SandMessage receive(SandMessage msg)
          An authorizer must provide a recieve method.
 void registerDelivery(java.lang.String msgClass, Messageable node)
          Register this node as a receiver for all messages of this class that are delivered.
 void registerReceive(java.lang.String messageClass, Messageable node)
          Register the given node as the processor for all queries of this message class that are received.
 void send(SandMessage msg, int optimize)
          An authorizer must provide a send method.
 void unregisterDelivery(java.lang.String msgClass, Messageable node)
          Unregister this node as a receiver for all messages of this class that are delivered.
 

Method Detail

registerDelivery

public void registerDelivery(java.lang.String msgClass,
                             Messageable node)
                      throws MessagerException
Register this node as a receiver for all messages of this class that are delivered.

Throws:
MessagerException

unregisterDelivery

public void unregisterDelivery(java.lang.String msgClass,
                               Messageable node)
                        throws MessagerException
Unregister this node as a receiver for all messages of this class that are delivered.

Throws:
MessagerException

deliver

public void deliver(SandMessage msg)
             throws SandException
An authorizer must provide a deliver method. This method must reject anything which is not an AuthWrapper, unwrap the contents of an incoming AuthWrapper, and deliver the contents directly to those nodes registered for the message type.

Throws:
SandException

send

public void send(SandMessage msg,
                 int optimize)
          throws MessagerException
An authorizer must provide a send method. This method will wrap the given message into an AuthWrapper, then send it via unsecure (direct) messaging.

Throws:
MessagerException

query

public SandMessage query(SandMessage msg,
                         java.lang.String recipient,
                         int optimize)
                  throws MessagerException
An authorizer must provide a query method. This method will wrap the given message into an AuthWrapper, then query the recipient via unsecure (direct) messaging.

Throws:
MessagerException

registerReceive

public void registerReceive(java.lang.String messageClass,
                            Messageable node)
                     throws MessagerException
Register the given node as the processor for all queries of this message class that are received. It is an error for the system to attempt to register more than one node for a given class.

Throws:
MessagerException

receive

public SandMessage receive(SandMessage msg)
                    throws SandException
An authorizer must provide a recieve method. This method will reject anything that is not an AuthWrapper, unwrap the contained message, lookup the registered recipient, and call through to it directly, returning the result.

The appropriate recipient will have been registered already. If no appropriate recipient is found, this method should throw an exception.

Throws:
SandException

getAuthFilter

public AuthFilter getAuthFilter()
                         throws SandException
An authorizer works with an AuthFilter, and must provide access to it for use elsewhere. This method is typically used by the UI, which needs to coordinate the display to match what is allowed.

Throws:
SandException