KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > commons > exception > ExoPermissionException


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.commons.exception;
6
7 import java.util.ResourceBundle JavaDoc;
8 import org.exoplatform.commons.utils.Formater;
9
10 /*
11  * @author: Tuan Nguyen
12  * @version: $Id: ExoPermissionException.java,v 1.1 2004/09/21 00:04:44 tuan08 Exp $
13  * @since: 0.0
14  * @email: tuan08@yahoo.com
15  */

16 public class ExoPermissionException extends ExoException {
17   private String JavaDoc action_ ;
18   private String JavaDoc requireRole_ ;
19   
20   public ExoPermissionException(String JavaDoc action , String JavaDoc requireRole) {
21     action_ = action;
22     requireRole_ = requireRole ;
23   }
24   
25   public String JavaDoc getAction() { return action_ ; }
26   
27   public String JavaDoc getRequireRole() { return requireRole_ ; }
28   
29   public String JavaDoc getExceptionDescription() {
30     return "Usually, this is not a critical exception. The exception is raised " +
31            "when the remote user is not authenticate or he do not have the right " +
32            "to access certain resource";
33   }
34   
35   public String JavaDoc getMessage(ResourceBundle JavaDoc res) {
36     Object JavaDoc[] args = {requireRole_ , action_ } ;
37     String JavaDoc s = res.getString("ExoPermissionException.msg.message") ;
38     return Formater.getDefaultFormater().format(s , args) ;
39   }
40   
41   public String JavaDoc getErrorCode() { return "EXO ERROR" ; }
42 }
Popular Tags