KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensugar > cube > simple > CubeWithoutPermissions


1 /*
2  * JEFFREE: Java(TM) Embedded Framework FREE
3  * Copyright (C) 1999-2003 - Opensugar
4  *
5  * The contents of this file are subject to the Jeffree Public License,
6  * as defined by the file JEFFREE_LICENSE.TXT
7  *
8  * You may not use this file except in compliance with the License.
9  * You may obtain a copy of the License on the Objectweb web site
10  * (www.objectweb.org).
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
14  * the specific terms governing rights and limitations under the License.
15  *
16  * The Original Code is JEFFREE, including the java package com.opensugar.cube,
17  * released January 1, 2003.
18  *
19  * The Initial Developer of the Original Code is Opensugar.
20  * The Original Code is Copyright Opensugar.
21  * All Rights Reserved.
22  *
23  * Initial developer(s): Pierre Scokaert (Opensugar)
24  * Contributor(s):
25  */

26
27 package com.opensugar.cube.simple;
28
29 import com.opensugar.cube.AbstractCube;
30 import com.opensugar.cube.BundleImpl;
31 import com.opensugar.cube.BundleClassLoader;
32 import com.opensugar.cube.NamedPropertySet;
33
34 import org.osgi.framework.Bundle;
35 import org.osgi.framework.BundleException;
36
37 import java.io.File JavaDoc;
38 import java.io.IOException JavaDoc;
39
40 // Cube without permission checks.
41
// Should work on any virtual machines that support Java 1.1 or above.
42
public class CubeWithoutPermissions extends AbstractCube {
43
44    public CubeWithoutPermissions() {
45       this( null );
46    }
47
48    public CubeWithoutPermissions( File JavaDoc baseDirectory ) {
49       super( baseDirectory );
50       log( LOG_INFO, "Permissions not supported" );
51    }
52
53    protected boolean enforcesPermissions() {
54       return false;
55    }
56
57    public void checkAdminPermission() {
58    }
59
60    public void checkFilePermission( String JavaDoc file, String JavaDoc permissionToCheck ) {
61    }
62
63    public void checkPackagePermission( NamedPropertySet[] packages, String JavaDoc permissionToCheck, Object JavaDoc codeSource ) {
64    }
65
66    public void checkPropertyPermission( String JavaDoc property, String JavaDoc permissionToCheck ) {
67    }
68
69    public void checkServicePermission( String JavaDoc className, String JavaDoc permissionToCheck ) {
70    }
71
72    public void checkServicePermissionForAll( String JavaDoc[] classNames, String JavaDoc permissionToCheck ) {
73    }
74
75    public void checkServicePermissionForAtLeastOne( String JavaDoc[] classNames, String JavaDoc permissionToCheck ) {
76    }
77
78    protected boolean hasPermission( BundleImpl bundle, Object JavaDoc permission ) {
79       return true;
80    }
81
82    protected BundleClassLoader createClassLoaderForBundle( BundleImpl bundle, File JavaDoc bundleJarFile, NamedPropertySet[] nativeLibraries, NamedPropertySet[] classPath ) throws IOException JavaDoc {
83       return SimpleBundleClassLoader.createClassLoader( bundle, bundleJarFile, nativeLibraries, classPath );
84    }
85
86 }
Popular Tags