dekoh.portal.fwk
Class PortalApplicationContext
java.lang.Object
dekoh.portal.fwk.PortalApplicationContext
public class PortalApplicationContext
- extends Object
PortalApplicationContext is the run-time repository for storing end-user's preferences for applications
deployed on Dekoh.
There will be one instance of PortalApplicationContext per application. This instance can be obtained by
calling PortalApplicationContext.getContext(String) and passing the application id as it is written in the
componenet.xml of that applicaiton.
End-User preference can be set by calling setUserPreference() and can be retrieved using getUserPreference().
Application wide preferences that are applicable to all its users can be stored and retrieved by using setApplicationPreference() and getApplicationPreference() methods. Context Path and deployment Id assigned by Dekoh to each application can also be
obtained using this object.
- Since:
- Mar 28, 2007
PREFERENCES_FILE_NAME
public static final String PREFERENCES_FILE_NAME
- See Also:
- Constant Field Values
APP_PREFERENCES_FILE_NAME
public static final String APP_PREFERENCES_FILE_NAME
- See Also:
- Constant Field Values
getContext
public static PortalApplicationContext getContext(String applicationId)
throws IOException
- Parameters:
applicationId -
- Returns:
-
- Throws:
IOException - when directory to store the file of user preferences could not be created, when no
application with given id is deployed.
NullPointerException - is applicationId is null
getCurrentContext
public static PortalApplicationContext getCurrentContext()
- Returns:
- PortalApplicationContext of the current web request.
- Throws:
RuntimeException - wrapping any IOException thrown by PortalApplicationContext.getContext(String)
getRootContext
public static PortalApplicationContext getRootContext()
getComponentId
public String getComponentId()
getServletContext
public ServletContext getServletContext()
- Returns:
- null if application is undeployed
getContextPath
public String getContextPath()
getApplicationDataDirectory
public File getApplicationDataDirectory()
- See Also:
PortalApplicationContext.getApplicationPreference(String),
PortalApplicationContext.setApplicationPreference(String,String)
getApplicationVersionString
public String getApplicationVersionString()
getApplicationVersion
public Version getApplicationVersion()
getUserDataDirectory
public File getUserDataDirectory(HttpServletRequest request)
throws IOException
- Throws:
IOException
getUserDataDirectory
public File getUserDataDirectory(String dekohUserId)
throws IOException
- Throws:
IOException
getUserPreference
public String getUserPreference(HttpServletRequest request,
String preferenceName)
throws IOException
- Gets the preference value for the given application and for given user. If not found will return null.
- Parameters:
request - preferenceName - Preference Name @return user preference return null if not found
- Throws:
IOException - when couldn't create the application preferences file
getUserPreference
public String getUserPreference(String userId,
String preferenceName)
throws IOException
- Throws:
IOException
setUserPreference
public void setUserPreference(String userName,
String propName,
String propValue)
throws IOException
- Throws:
IOException
getApplicationPreference
public String getApplicationPreference(String name)
- Use this method tp get an application wide preference.
- Parameters:
name - name of the preference
- Returns:
- value of the application wide preference if previously set. null if the name is passed null or
if no such property is previously stored.
- Since:
- 0.5.3
setApplicationPreference
public void setApplicationPreference(String name,
String value)
throws IOException
- Creates or changes existing application wide preference given the name.
- Parameters:
name - preference name. if null this method is equal to a no-opvalue - value of the preference. if null this method is equal to a no-op
- Throws:
IOException - any IOException thrown when storing the preference to file.- Since:
- 0.5.3
- See Also:
setUserPreference : if you want to store a preference for each user
of application
setUserPreference
public void setUserPreference(HttpServletRequest request,
String propName,
String propValue)
throws IOException
- Throws:
IOException
getPortalDataSource
public PortalDataSource getPortalDataSource()
getDatabaseProperties
public Properties getDatabaseProperties()
equals
public boolean equals(Object o)
- Overrides:
equals in class Object
hashCode
public int hashCode()
- Overrides:
hashCode in class Object
© 2009 Pramati Technologies - Dekoh - Portal for Developers