org.xwiki.environment
Interface Environment


@Role
public interface Environment

Abstraction that represents an Environment (Java SE, Servlet, Portlet, etc) and provides API to access environment-related data.

Since:
3.5M1
Version:
$Id: 241eab130a55c9b7f8e33efd9af8189bcdcd0fcb $

Method Summary
 File getPermanentDirectory()
          Gets the root directory of a location for storing persisting data.
 URL getResource(String resourceName)
           
 InputStream getResourceAsStream(String resourceName)
           
 File getTemporaryDirectory()
          Gets the directory for storing temporary data.
 

Method Detail

getTemporaryDirectory

File getTemporaryDirectory()
Gets the directory for storing temporary data. The content of this directory may be deleted across restarts and thus is not a safe place to store permanent/important data.

Returns:
a File object pointing to a directory that the application can use for storing temporary files

getPermanentDirectory

File getPermanentDirectory()
Gets the root directory of a location for storing persisting data. Contrary to the Temporary Directory the content of this directory is guaranteed to persist across time.

Returns:
a File object pointing to the root folder of the permanent directory

getResource

URL getResource(String resourceName)
Parameters:
resourceName - the full name of the resource to access (eg "/somefile.properties")
Returns:
the resource location as a URL or null if not found

getResourceAsStream

InputStream getResourceAsStream(String resourceName)
Parameters:
resourceName - the full name of the resource to access (eg "/somefile.properties")
Returns:
the resource location as an InputStream


Copyright © 2004–2014 XWiki. All rights reserved.