Source code: com/lutris/multiServer/ActKeyValidation.java
1 /*
2 * Enhydra Java Application Server Project
3 *
4 * The contents of this file are subject to the Enhydra Public License
5 * Version 1.1 (the "License"); you may not use this file except in
6 * compliance with the License. You may obtain a copy of the License on
7 * the Enhydra web site ( http://www.enhydra.org/ ).
8 *
9 * Software distributed under the License is distributed on an "AS IS"
10 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11 * the License for the specific terms governing rights and limitations
12 * under the License.
13 *
14 * The Initial Developer of the Enhydra Application Server is Lutris
15 * Technologies, Inc. The Enhydra Application Server and portions created
16 * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17 * All Rights Reserved.
18 *
19 * Contributor(s):
20 *
21 * $Id: ActKeyValidation.java,v 1.3.4.1 2000/10/19 17:59:08 jasona Exp $
22 */
23
24 package com.lutris.multiServer;
25
26 import com.lutris.util.Config;
27 import com.lutris.logging.LogChannel;
28
29 /**
30 * This interface is provided so that some sort of key checking or
31 * validation on the right-to-run of a servlet is performed.
32 *
33 * Note that this isn't the most secure implementation of this schema;
34 * as the wily hacker who is trying to circumvent checking can
35 * just compile up their own version of whatever calls instantiations
36 * of this interface and put it before the original one in the classpath.
37 *
38 * This class can also be used as an initializer for a check or a set of
39 * checks that will be called in the performance of an application to
40 * see what level of survice the runner of the application has subscribed
41 * to.
42 *
43 * For instance, if the following class if defined:
44 *
45 * <pre>
46 * class Checkpoint implements com.lutris.multiServer.ActKeyValidation {
47 * ...
48 * boolean hasMinimalServiceContract() ...
49 * boolean hasExpensiveServiceContract() ...
50 * }
51 * </pre>
52 *
53 * Then other portions of the application can just call into that class's
54 * <code>hasMinimalServiceContract</code> and
55 * <code>hasExpensiveServiceContract</code> methods to find out if
56 * extra-charge portions of the application are allowed to run.
57 *
58 * @see org.enhydra.servlet.multiServer.MultiServer#readConfigFile
59 * @author Jason Abbott (jason@lutris.com)
60 */
61
62 public interface ActKeyValidation {
63
64 /**
65 * Classes of this instance will only be instanciated and then have
66 * this one function called to validate the currently running servlet's
67 * right-to-run. If the validation routine is to do anything short of
68 * halting the servlet then it should not throw an exception.
69 *
70 * @param config
71 * The Config structure of the configuration file. This will
72 * probably contain information you need in order to validate
73 * this servlet (such as an activation key or serial number).
74 * @param logChannel
75 * This LogChannel is where any error or warning should be
76 * written to.
77 * @exception ActKeyValidationException
78 * This Exception can be thrown if the servlet is detected as
79 * running an illegal copy. This will probably result in the
80 * catcher of this exception in halting the servlet.
81 */
82 public void validate(Config config,
83 LogChannel logChannel)
84 throws ActKeyValidationException;
85 }