org.glite.ce.commonj.axis.handlers
Class AuthZConfiguration

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byorg.glite.ce.commonj.axis.handlers.AuthZConfiguration
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, javax.management.DynamicMBean, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, java.util.EventListener, javax.management.MBeanRegistration, javax.management.NotificationFilter, javax.management.NotificationListener, java.io.Serializable

public class AuthZConfiguration
extends org.xml.sax.helpers.DefaultHandler
implements javax.management.DynamicMBean, javax.management.MBeanRegistration, javax.management.NotificationListener, javax.management.NotificationFilter

This class is a Management Bean, as stated in Java Management Extensions specification. It contains any information about the configuration of a chain of the grid Java Authorization Framework (gJAF). The configuration items are parsed from an XML file and are stored into the servlet context. Several "slave" MBeans are created, one MBean for each plugin of the chain, containing the configuration of that plugin. The class exposes all methods required by a dynamic management bean, together with the methods dealing with MBean notification and registration.

See Also:
Serialized Form

Constructor Summary
AuthZConfiguration(javax.servlet.ServletContext ctx)
          The constructor of the class.
 
Method Summary
 void endElement(java.lang.String uri, java.lang.String name, java.lang.String qName)
          Method used by the internal XML parser.
 java.lang.Object getAttribute(java.lang.String attr)
          This method returns the value of a given configuration attribute.
 javax.management.AttributeList getAttributes(java.lang.String[] attrs)
          This method returns a list of configuration attributes matching the given list of attributes name.
 javax.management.MBeanInfo getMBeanInfo()
          It returns any information necessary to describe the current MBean behaviour
 void handleNotification(javax.management.Notification notification, java.lang.Object handback)
          This method is called by a JMX agent in order to notify a generic event.
 java.lang.Object invoke(java.lang.String operation, java.lang.Object[] params, java.lang.String[] signature)
          It allows the JMX agent to call an operation on the current MBean.
 boolean isNotificationEnabled(javax.management.Notification notification)
          Method used to filter notifications.
 void postDeregister()
          Method called by the JMX engine after the removal of the current MBean from an MBean server.
 void postRegister(java.lang.Boolean registrationDone)
          Method called by the JMX engine after the registration of the current MBean into an MBean server.
 void preDeregister()
          Method called by the JMX engine before the removal of the current MBean from an MBean server.
 javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
          Method called by the JMX engine before the registration of the current MBean into an MBean server.
 void setAttribute(javax.management.Attribute attr)
          Method used to set an attribute.
 javax.management.AttributeList setAttributes(javax.management.AttributeList attrs)
          Method used to set a list of attributes.
 void startElement(java.lang.String uri, java.lang.String name, java.lang.String qName, org.xml.sax.Attributes attributes)
          Method used by the internal XML parser.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthZConfiguration

public AuthZConfiguration(javax.servlet.ServletContext ctx)
                   throws AuthZConfigException
The constructor of the class. It reads the name of the configuration file from the naming service of tomcat via JNDI and parses it.

Parameters:
ctx - is the servlet context used to store information
Method Detail

startElement

public void startElement(java.lang.String uri,
                         java.lang.String name,
                         java.lang.String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXParseException
Method used by the internal XML parser.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Parameters:
uri - is the namespace of the current element
name - is the name without prefix of the current element
qName - is the qualified name (with prefix) of the current element
attributes - is a list of attributes for the current element
Throws:
org.xml.sax.SAXParseException - Any SAX exception, possibly wrapping another exception

endElement

public void endElement(java.lang.String uri,
                       java.lang.String name,
                       java.lang.String qName)
Method used by the internal XML parser.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Parameters:
uri - is the namespace of the current element
name - is the name without prefix of the current element
qName - is the qualified name (with prefix) of the current element

getAttribute

public java.lang.Object getAttribute(java.lang.String attr)
                              throws javax.management.AttributeNotFoundException
This method returns the value of a given configuration attribute. At the moment the only attribute supported is "chain", i.e. the chain of PDP/PIP configured with the current MBean.

Specified by:
getAttribute in interface javax.management.DynamicMBean
Parameters:
attr - the name of the configuration attribute desired
Returns:
the value of the attribute required
Throws:
javax.management.AttributeNotFoundException - if the attribute doesn't exist.

getAttributes

public javax.management.AttributeList getAttributes(java.lang.String[] attrs)
This method returns a list of configuration attributes matching the given list of attributes name. At the moment the only attribute supported is "chain", i.e. the chain of PDP/PIP configured with the current MBean.

Specified by:
getAttributes in interface javax.management.DynamicMBean
Parameters:
attrs - the list of the configuration attribute desired
Returns:
a list, eventually empty, of required attributes.

getMBeanInfo

public javax.management.MBeanInfo getMBeanInfo()
It returns any information necessary to describe the current MBean behaviour

Specified by:
getMBeanInfo in interface javax.management.DynamicMBean
Returns:
a class containing any information about the MBean, such as attribute names, operations and notifications.

invoke

public java.lang.Object invoke(java.lang.String operation,
                               java.lang.Object[] params,
                               java.lang.String[] signature)
It allows the JMX agent to call an operation on the current MBean. At the moment the operations available are:

Specified by:
invoke in interface javax.management.DynamicMBean
Parameters:
operation - is the name of the operation required
params - an array of object representing the parameters of the operation
signature - is an array of decriptions for the given parameters
Returns:
the return object of the operation
Throws:
java.lang.IllegalArgumentException - if the operation is not well-specified
java.lang.UnsupportedOperationException - if the operation is not available

setAttribute

public void setAttribute(javax.management.Attribute attr)
Method used to set an attribute. At the moment all attributes are read-only, so the method doesn't modify the content of the current MBean.

Specified by:
setAttribute in interface javax.management.DynamicMBean
Parameters:
attr - the attribute to insert into the current MBean

setAttributes

public javax.management.AttributeList setAttributes(javax.management.AttributeList attrs)
Method used to set a list of attributes. At the moment all attributes are read-only, so the method doesn't modify the content of the current MBean.

Specified by:
setAttributes in interface javax.management.DynamicMBean
Parameters:
attrs - the list of attributes to insert into the current MBean
Returns:
the list of attributes inserted into the current MBean

postDeregister

public void postDeregister()
Method called by the JMX engine after the removal of the current MBean from an MBean server. No actions are performed during this step.

Specified by:
postDeregister in interface javax.management.MBeanRegistration

postRegister

public void postRegister(java.lang.Boolean registrationDone)
Method called by the JMX engine after the registration of the current MBean into an MBean server. It simply enables several notification mechanisms.

Specified by:
postRegister in interface javax.management.MBeanRegistration
Parameters:
registrationDone - "true" if the registration has been accomplished with success.

preDeregister

public void preDeregister()
Method called by the JMX engine before the removal of the current MBean from an MBean server. It simply disables any notification mechanism.

Specified by:
preDeregister in interface javax.management.MBeanRegistration

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                               javax.management.ObjectName name)
                                        throws javax.management.MalformedObjectNameException
Method called by the JMX engine before the registration of the current MBean into an MBean server. Usually the name used as key for registering the MBean is specified into the XML file, so the JMX engine doesn't propose any name.

Specified by:
preRegister in interface javax.management.MBeanRegistration
Parameters:
server - is the MBean server choosen for the registration
name - if specified is the key used to register the MBean into the MBean server.
Throws:
javax.management.MalformedObjectNameException

handleNotification

public void handleNotification(javax.management.Notification notification,
                               java.lang.Object handback)
This method is called by a JMX agent in order to notify a generic event. At the moment no notifications are handled.

Specified by:
handleNotification in interface javax.management.NotificationListener
Parameters:
notification - contains information about the event notified
handback - unused callback object

isNotificationEnabled

public boolean isNotificationEnabled(javax.management.Notification notification)
Method used to filter notifications.

Specified by:
isNotificationEnabled in interface javax.management.NotificationFilter
Parameters:
notification - contains information about the event notified
Returns:
true iff the MBean involved has a domain name equals to CEAuthZ, i.e. the domain for the authorization framework