KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > classfile > ICodeBase


1 /*
2  * FindBugs - Find Bugs in Java programs
3  * Copyright (C) 2006, University of Maryland
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
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 edu.umd.cs.findbugs.classfile;
21
22 import java.io.Closeable JavaDoc;
23 import java.io.FileNotFoundException JavaDoc;
24 import java.io.IOException JavaDoc;
25 import java.io.InputStream JavaDoc;
26 import java.util.Iterator JavaDoc;
27
28 /**
29  * Interface for a basic code base in which we can look up resources
30  * but not necessarily scan for the list of all resources.
31  *
32  * @author David Hovemeyer
33  */

34 public interface ICodeBase {
35     /** Codebase was explicitly specified. */
36     public static final int SPECIFIED = 0;
37     
38     /** Codebase was discovered as a nested archive in another codebase. */
39     public static final int NESTED = 1;
40     
41     /** Codebase was referenced in the Class-Path attribute of a Jar manifest of another codebase. */
42     public static final int IN_JAR_MANIFEST = 2;
43     
44     /** Codebase was discovered in the system classpath. */
45     public static final int IN_SYSTEM_CLASSPATH = 3;
46
47     /**
48      * Get the codebase locator describing the location of this codebase.
49      *
50      * @return the ICodeBaseLocator
51      */

52     public ICodeBaseLocator getCodeBaseLocator();
53     
54     /**
55      * Look up a resource in this code base.
56      *
57      * @param resourceName name of the resource to look up
58      * @return ICodeBaseEntry representing the resource
59      * @throws ResourceNotFoundException if the resource cannot be found in this code base
60      */

61     public ICodeBaseEntry lookupResource(String JavaDoc resourceName) throws ResourceNotFoundException;
62
63     /**
64      * Designate this code base as an application codebase.
65      *
66      * @param isAppCodeBase true if this is an application codebase, false if not
67      */

68     public void setApplicationCodeBase(boolean isAppCodeBase);
69     
70     /**
71      * Return whether or not this codebase is an application codebase.
72      *
73      * @return true if this is an application codebase, false if not
74      */

75     public boolean isApplicationCodeBase();
76     
77     /**
78      * Set how this codebase was discovered.
79      *
80      * @param howDiscovered one of the constants SPECIFIED, NESTED,
81      * IN_JAR_MANIFEST, or IN_SYSTEM_CLASSPATH
82      */

83     public void setHowDiscovered(int howDiscovered);
84     
85     /**
86      * Return how this codebase was discovered.
87      *
88      * @return one of the constants SPECIFIED, NESTED, IN_JAR_MANIFEST, or IN_SYSTEM_CLASSPATH
89      */

90     public int getHowDiscovered();
91     
92     /**
93      * Return whether or not this code base contains any source files.
94      *
95      * @return true if the code base contains source file(s),
96      * false if it does not contain source files
97      */

98     public boolean containsSourceFiles() throws InterruptedException JavaDoc;
99
100     /**
101      * Get the filesystem pathname of this codebase.
102      *
103      * @return the filesystem pathname of this codebase,
104      * or null if this codebase is not accessible via the filesystem
105      */

106     public String JavaDoc getPathName();
107     
108     /**
109      * Set timestamp indicating the most recent time when any of the files
110      * in the codebase were modified.
111      *
112      * @param lastModifiedTime timestamp when any codebase files were most-recently modified
113      */

114     public void setLastModifiedTime(long lastModifiedTime);
115     
116     /**
117      * Get timestamp indicating the most recent time when any of the files
118      * in the codebase were modified.
119      * This information is only likely to be accurate if an
120      * ICodeBaseIterator has been used to scan the resources
121      * in the codebase (scannable codebases only, obviously).
122      *
123      * @return timestamp when any codebase files were most-recently modified,
124      * -1 if unknown
125      */

126     public long getLastModifiedTime();
127     
128     /**
129      * This method should be called when done using the code base.
130      */

131     public void close();
132 }
133
Popular Tags