Interface IResourceLocator
- All Known Implementing Classes:
DefaultResourceLocator
public interface IResourceLocator
Implements this interface to provide a custom file search algorithm. This
class defines the file search algorithm used to locate files referenced in
the design. For example, when parsing a design file and a library is
encountered, a file locator will be used to locate the library. This
interface is implemented differently for each environment. For example, the
GUI might have its own file search requirement, while the deployment
environment in application server has another.
The default file locator is
.
DefaultResourceLocator
The customized file search must be installed before opening designs. Set the
file locator using
SessionHandleImpl.setResourceLocator(IResourceLocator)
method.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The location mask which searches all the locations.static final String
Key for the location to search in appContext.static final int
The type of the cascading style sheet to search.static final String
The host name of the fragments where inner resources are located.static final int
The type of the images to searchstatic final int
The type for the jar file.static final int
The type of the libraries to searchstatic final int
The type for the message file.static final int
The other types.static final int
The location mask which searches in the resource bundle.static final int
The location mask which searches the file relative to design.static final int
The location mask which searches in the file system with path.static final int
The location mask which searches in the resource folder. -
Method Summary
Modifier and TypeMethodDescriptionfindResource
(ModuleHandle moduleHandle, String fileName, int type) Searches the file by the given file name.findResource
(ModuleHandle moduleHandle, String fileName, int type, Map appContext) Searches the file by the given file name and the given user's information.
-
Field Details
-
ALL_RESOURCE
static final int ALL_RESOURCEThe location mask which searches all the locations.- See Also:
-
FRAGMENT_RESOURCE_HOST
The host name of the fragments where inner resources are located.- See Also:
-
IMAGE
static final int IMAGEThe type of the images to search- See Also:
-
LIBRARY
static final int LIBRARYThe type of the libraries to search- See Also:
-
CASCADING_STYLE_SHEET
static final int CASCADING_STYLE_SHEETThe type of the cascading style sheet to search.- See Also:
-
JAR_FILE
static final int JAR_FILEThe type for the jar file. Includes .jar type.- See Also:
-
MESSAGE_FILE
static final int MESSAGE_FILEThe type for the message file.- See Also:
-
OTHERS
static final int OTHERSThe other types.- See Also:
-
BIRT_RESOURCELOCATOR_SEARCH_LOCATION
Key for the location to search in appContext.- See Also:
-
RESOURCE_FILEPATH
static final int RESOURCE_FILEPATHThe location mask which searches in the file system with path.- See Also:
-
RESOURCE_BUNDLE
static final int RESOURCE_BUNDLEThe location mask which searches in the resource bundle.- See Also:
-
RESOURCE_FOLDER
static final int RESOURCE_FOLDERThe location mask which searches in the resource folder.- See Also:
-
RESOURCE_DESIGN
static final int RESOURCE_DESIGNThe location mask which searches the file relative to design.- See Also:
-
-
Method Details
-
findResource
Searches the file by the given file name. The actual search algorithm will be different in different environment. The file type is just helpful when different file searching steps for different files are required. Because new file type will be added if design file includes new file, the default searching steps are encouraged for unknown file type to improve robustness.- Parameters:
moduleHandle
- The module to tell the search context. This could be null if the search algorithm does not need the design. It can be the instance of one ofReportDesignHandle
andLibraryHandle
.fileName
- The file name to be searched. This could be an absolute path or a relative path.type
- The type of the file to search. The value must be one ofIMAGE
,LIBRARY
,CASCADING_STYLE_SHEET
andMESSAGEFILE
.- Returns:
- The
URL
object.null
if the file can not be found.
-
findResource
Searches the file by the given file name and the given user's information. The actual search algorithm will be different in different environment. The file type is just helpful when different file searching steps for different files are required. Because new file type will be added if design file includes new file, the default searching steps are encouraged for unknown file type to improve robustness.- Parameters:
moduleHandle
- The module to tell the search context. This could be null if the search algorithm does not need the design. It can be the instance of one ofReportDesignHandle
andLibraryHandle
.fileName
- The file name to be searched. This could be an absolute path or a relative path.type
- The type of the file to search. The value must be one ofIMAGE
,LIBRARY
,CASCADING_STYLE_SHEET
andMESSAGEFILE
.appContext
- The map containing the user's information- Returns:
- The
URL
object.null
if the file can not be found.
-