KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > za > org > coefficient > interceptors > ConfigurationInterceptor


1 /*
2  * Coefficient - facilitates project based collaboration
3  * Copyright (C) 2003, Dylan Etkin, CSIR icomtek
4  * PO Box 395
5  * Pretoria 0001, RSA
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 package za.org.coefficient.interceptors;
21
22 import za.org.coefficient.core.CoefficientInterceptor;
23 import za.org.coefficient.core.Constants;
24 import za.org.coefficient.interfaces.CoefficientContext;
25 import za.org.coefficient.util.common.InvokerFactory;
26
27 /**
28  *
29  * @version $Revision: 1.4 $ $Date: 2004/10/20 08:17:28 $
30  * @author <a HREF="mailto:detkin@csir.co.za">Dylan Etkin</a>
31  */

32 public class ConfigurationInterceptor extends CoefficientInterceptor {
33     //~ Methods ================================================================
34

35     protected int handleInvoke(CoefficientContext ctx) throws Exception JavaDoc {
36         int retVal = INVOKE_PROCESS_CHILD;
37
38         String JavaDoc mod = ctx.getParameter("module");
39         String JavaDoc op = ctx.getParameter("op");
40         if (!Constants.hasRequiredFields()) {
41             if (! "Configuration".equals(mod) && !"Save".equals(op)) {
42                 // Kill the other interceptors and invoke the Configuration mod
43
retVal = INVOKE_ABORT_GLOBAL;
44                 Object JavaDoc context = InvokerFactory.getRemoteInvoker()
45                     .invokeOpOnModule("Configuration", null, ctx);
46                 if(context instanceof CoefficientContext) {
47                     ctx = (CoefficientContext)context;
48                 }
49             }
50         }
51         return retVal;
52     }
53 }
54
Popular Tags