public class ServletContextPropertyIO extends AbstractPropertyIO
getServletContext().getRealPath(getResourceName())
. ServletContext.getRealPath(String)
,
Serialized FormConstructor and Description |
---|
ServletContextPropertyIO(javax.servlet.ServletContext servletContext,
String resourceName)
Minimum constructor where "cache" is set to
true and "readonly" is false . |
ServletContextPropertyIO(javax.servlet.ServletContext servletContext,
String resourceName,
boolean readonly)
Constructor where "cache" is set to
true . |
ServletContextPropertyIO(javax.servlet.ServletContext servletContext,
String resourceName,
boolean readonly,
boolean cache)
Main constructor with all the attributes.
|
Modifier and Type | Method and Description |
---|---|
protected File |
getFile()
The file that the servlet context has resolved the
resourceName to via the ServletContext.getRealPath(String) method. |
String |
getName()
A short descriptive name of the Property IO.
|
Properties |
getProperties()
Gets all the name,value pair in a Properties class instance.
|
String |
getResourceName()
The resource file the
ServletContextPropertyIO is looking for. |
javax.servlet.ServletContext |
getServletContext()
The servlet context that the
ServletContextPropertyIO has been initialized with. |
String |
getSource()
A detailed description of the source of the property data.
|
void |
reload()
Reloads the name,value pairs for the PropertyIO, or forces the values to reload when read next time.
|
void |
setValue(String propertyName,
String value)
Sets the name,value as String in the IO.
|
void |
validate()
Validates the PropertyIO.
|
backup, getCacheTime, getLastLoaded, getLastSaved, getLogger, getTypedProperties, getTypedValue, getValue, isCached, isReadonly, logPerformanceGetProperties, logPerformanceSetValue, setCacheTime, storeTypedValue, updateLastLoaded, updateLastSaved, validateWritable
public ServletContextPropertyIO(javax.servlet.ServletContext servletContext, String resourceName, boolean readonly, boolean cache)
servletContext
- the servletContext.resourceName
- the name of the file or part of the directory and name of the file, which servletContext will resolve to a file to be loaded.readonly
- is the ServletContextPropertyIO
to be read only.cache
- shall the values be cached in the PropertyIO
's.ServletContext.getRealPath(String)
public ServletContextPropertyIO(javax.servlet.ServletContext servletContext, String resourceName, boolean readonly)
true
.servletContext
- the servletContext.resourceName
- the name of the file or part of the directory and name of the file, which servletContext will resolve to a file to be loaded.readonly
- is the ServletContextPropertyIO
to be read only.ServletContext.getRealPath(String)
public ServletContextPropertyIO(javax.servlet.ServletContext servletContext, String resourceName)
true
and "readonly" is false
.servletContext
- the servletContext.resourceName
- the name of the file or part of the directory and name of the file, which servletContext will resolve to a file to be loaded.ServletContext.getRealPath(String)
public String getResourceName()
ServletContextPropertyIO
is looking for.public javax.servlet.ServletContext getServletContext()
ServletContextPropertyIO
has been initialized with.public String getName()
PropertyIO
public String getSource()
PropertyIO
protected File getFile()
resourceName
to via the ServletContext.getRealPath(String)
method.ServletContext.getRealPath(String)
public void setValue(String propertyName, String value) throws PropertyIOException
PropertyIO
propertyName
- the name of the propertyvalue
- the string value of the property.PropertyIOException
- if the IO is readonly or failed to write the value.public void validate() throws PropertyIOException
PropertyIO
PropertyIOException
public void reload()
PropertyIO
reload
in interface PropertyIO
reload
in class AbstractPropertyIO
public Properties getProperties()
PropertyIO
Properties