KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > impl > internal > notifications > SecurityNotification


1 /*
2  * $Id: SecurityNotification.java 3798 2006-11-04 04:07:14Z aperepel $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.impl.internal.notifications;
12
13 import org.mule.umo.manager.UMOServerNotification;
14
15 /**
16  * <code>SecurityNotification</code> is fired when a request for authorisation
17  * occurs. The event may denote successful access or denied access depending on the
18  * type of event. Subscribing to these notifications developers can maintain an
19  * access log, block clients, etc.
20  *
21  * @see org.mule.MuleManager
22  * @see org.mule.umo.manager.UMOManager
23  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
24  * @version $Revision: 3798 $
25  */

26 public class SecurityNotification extends UMOServerNotification
27 {
28     /**
29      * Serial version
30      */

31     private static final long serialVersionUID = 5951835321289699941L;
32
33     public static final int SECURITY_AUTHENTICATION_FAILED = SECURITY_EVENT_ACTION_START_RANGE + 1;
34
35     private static final transient String JavaDoc[] ACTIONS = new String JavaDoc[]{"authentication failed"};
36
37     public SecurityNotification(org.mule.umo.security.SecurityException message, int action)
38     {
39         super(message, action);
40         resourceIdentifier = message.toString();
41     }
42
43     protected String JavaDoc getPayloadToString()
44     {
45         return source.toString();
46     }
47
48     protected String JavaDoc getActionName(int action)
49     {
50         int i = action - SECURITY_EVENT_ACTION_START_RANGE;
51         if (i - 1 > ACTIONS.length)
52         {
53             return String.valueOf(action);
54         }
55         return ACTIONS[i - 1];
56     }
57
58     public String JavaDoc getType()
59     {
60         return TYPE_WARNING;
61     }
62 }
63
Popular Tags