001: /***** BEGIN LICENSE BLOCK *****
002: * Version: CPL 1.0/GPL 2.0/LGPL 2.1
003: *
004: * The contents of this file are subject to the Common Public
005: * License Version 1.0 (the "License"); you may not use this file
006: * except in compliance with the License. You may obtain a copy of
007: * the License at http://www.eclipse.org/legal/cpl-v10.html
008: *
009: * Software distributed under the License is distributed on an "AS
010: * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
011: * implied. See the License for the specific language governing
012: * rights and limitations under the License.
013: *
014: * Copyright (C) 2006 Ola Bini <ola@ologix.com>
015: *
016: * Alternatively, the contents of this file may be used under the terms of
017: * either of the GNU General Public License Version 2 or later (the "GPL"),
018: * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
019: * in which case the provisions of the GPL or the LGPL are applicable instead
020: * of those above. If you wish to allow use of your version of this file only
021: * under the terms of either the GPL or the LGPL, and not to allow others to
022: * use your version of this file under the terms of the CPL, indicate your
023: * decision by deleting the provisions above and replace them with the notice
024: * and other provisions required by the GPL or the LGPL. If you do not delete
025: * the provisions above, a recipient may use your version of this file under
026: * the terms of any one of the CPL, the GPL or the LGPL.
027: ***** END LICENSE BLOCK *****/package org.jruby;
028:
029: /**
030: * @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
031: */
032: public interface Profile {
033: Profile ALL = new Profile() {
034: public boolean allowBuiltin(String name) {
035: return true;
036: }
037:
038: public boolean allowClass(String name) {
039: return true;
040: }
041:
042: public boolean allowModule(String name) {
043: return true;
044: }
045:
046: public boolean allowLoad(String name) {
047: return true;
048: }
049:
050: public boolean allowRequire(String name) {
051: return true;
052: }
053: };
054: Profile DEBUG_ALLOW = new Profile() {
055: public boolean allowBuiltin(String name) {
056: System.err.println("allowBuiltin(" + name + ")");
057: return true;
058: }
059:
060: public boolean allowClass(String name) {
061: System.err.println("allowClass(" + name + ")");
062: return true;
063: }
064:
065: public boolean allowModule(String name) {
066: System.err.println("allowModule(" + name + ")");
067: return true;
068: }
069:
070: public boolean allowLoad(String name) {
071: System.err.println("allowLoad(" + name + ")");
072: return true;
073: }
074:
075: public boolean allowRequire(String name) {
076: System.err.println("allowRequire(" + name + ")");
077: return true;
078: }
079: };
080: Profile NO_FILE_CLASS = new Profile() {
081: public boolean allowBuiltin(String name) {
082: return true;
083: }
084:
085: public boolean allowClass(String name) {
086: return !name.equals("File");
087: }
088:
089: public boolean allowModule(String name) {
090: return true;
091: }
092:
093: public boolean allowLoad(String name) {
094: return true;
095: }
096:
097: public boolean allowRequire(String name) {
098: return true;
099: }
100: };
101: Profile ANY = ALL;
102: Profile DEFAULT = ALL;
103:
104: boolean allowBuiltin(String name);
105:
106: boolean allowClass(String name);
107:
108: boolean allowModule(String name);
109:
110: boolean allowLoad(String name);
111:
112: boolean allowRequire(String name);
113: }// Profile
|