|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.pepper.platform.page.PepperPage
public class PepperPage
This class implements the Page interface. It manages page persistence, including encryption, indexing and external file references.
Page
Field Summary | |
---|---|
protected static org.apache.commons.logging.Log |
log
|
Constructor Summary | |
---|---|
protected |
PepperPage(File file)
Creates a PepperPage from the given File instance. |
protected |
PepperPage(InputStream in)
Creates a PepperPage from the given InputStream instance. |
protected |
PepperPage(String id,
String packageId)
Creates a PepperPage using the given parameters. |
protected |
PepperPage(String id,
String name,
com.pepper.platform.page.PageService pageService,
String template,
org.jdom.Document pageData)
Instantiates a new PepperPage using the given parameters. |
Method Summary | |
---|---|
boolean |
exists()
Returns true if the Page exists
either in the original jar file or on disk |
boolean |
getBackup()
Returns true if the Page is marked to
for backup. |
File |
getBaseDir()
Returns the base directory used when constructing absolute paths from a Page's name. |
Date |
getCreateDate()
Returns the page's create date. |
String |
getDefaultType()
Returns the defaultPageType of this page, usually a section. |
boolean |
getForceAutoSave()
Get the state of the forceAutoSave flag. |
String |
getId()
Returns the id of this Page . |
long |
getLastSaveTime()
Gets the timestamp that the Page was last saved via the save() method. |
String |
getName()
Returns the name of this Page . |
int |
getNoCache()
Get the value which controls how the page will be redisplayed when it has been previously loaded into a tab. |
String |
getPackageName()
Returns the package name of this Page . |
String |
getPackageVersion()
Returns the package version of this Page . |
org.jdom.Document |
getPageData()
Returns the application specific XML page data. |
boolean |
getProcessBody()
Returns a boolean indicating whether or not this page is setup to honor page processing attributes (eg index, secure, reference ) on an individual element basis. |
String |
getRootAttrValue(String attrName)
Returns the value of the specified attribute on the root element (ie page, section) in the document |
List |
getSupportedPageTypes()
Returns a list of supported page types that this page may contain. |
String |
getTemplate()
Returns the XSLT template of this Page . |
String |
getType()
Returns the type of this page. |
boolean |
isAutoSaveEnabled()
Returns true if the Page has autoSave enabled. |
boolean |
isDeletable()
Returns true if the Page is marked as
deletable. |
boolean |
isHidden()
Returns true if the Page is marked as
hidden. |
boolean |
isLoaded()
Returns true if the Page has been
loaded from disk, or has had it's XML page data set directly
by a call to setPageData() . |
boolean |
isPageTypeSupported(String pageType)
Indicates whether the specified page type may be contained by this page. |
boolean |
isReadOnly()
Returns true if the Page is marked as
read-only. |
boolean |
isSecure()
Returns true if the Page is marked as
secure. |
org.jdom.Document |
load()
Loads the Page from disk. |
void |
save()
Causes the Page to be serialized to disk. |
void |
setAutoSaveEnabled(boolean autoSaveEnabled)
Sets the state of the autoStateEnabled flag |
void |
setBackup(boolean backup)
Sets or clears the backup attribute. |
void |
setBaseDir(String baseDir)
Sets the base directory used when constructing absolute paths from a Page's name. |
void |
setClassLoader(ClassLoader cl)
Sets the class loader of this page. |
void |
setDefaultType(String type)
|
void |
setDeletable(boolean isDeletable)
Sets or clears the deletable attribute. |
void |
setForceAutoSave(boolean state)
If true, this will force the auto save and program framework to save the page the next time such an event is triggered, regardless if other criteria (such as modified components) is met or not. |
void |
setHidden(boolean isHidden)
Sets or clears the hidden attribute. |
void |
setId(String id)
Sets the id of this Page . |
void |
setLastSaveTime(long time)
Sets the timestamp when the page was last saved. |
void |
setName(String name)
Sets the name of this Page . |
void |
setNoCache(int options)
Set the value which controls how the page will be redisplayed when it has been previously loaded into a tab. |
void |
setPackageName(String name)
Sets the package name of this Page . |
void |
setPackageVersion(String version)
Sets the package version of this Page . |
void |
setPageData(org.jdom.Document pageData)
Sets the application specific XML page data. |
void |
setProcessBody(boolean processBody)
Sets the processBody attribute; a boolean value indicating whether or not element-specific page processing attributes ( eg index, secure, reference ) are enabled. |
void |
setReadOnly(boolean isReadOnly)
Sets or clears the read-only attribute. |
void |
setSecure(boolean isSecure)
Sets or clears the secure attribute. |
void |
setSupportedPageTypes(List supportedPageTypes)
Sets the supported page types this page may contain. |
void |
setTemplate(String template)
Sets the XSLT template of this Page . |
void |
setTemplateOverride(String template)
Sets a temporary template that overrides the value found in the Page. |
void |
setType(String type)
Sets the type element of this page. |
String |
toString()
Debug method to dump contents of Page . |
void |
unload()
Causes the page to unload it's page data so that it can be freed during GC. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static org.apache.commons.logging.Log log
Constructor Detail |
---|
protected PepperPage(String id, String packageId)
id
- The page id. Used to create the file name of the main XML output file
and any associated referenced files. Also used as to tie together all
indexed elements.packageId
- The packageId of the package requesting
the PepperPage creation. PackageId is used to look up
the AbstractPepperProgram from which the PageMgr can be found.
PageMgr is used for synchronization and locking.protected PepperPage(File file) throws IOException
File
instance.
file
- a File
instance.
IOException
protected PepperPage(InputStream in)
InputStream
instance.
in
- an InputStream
instance.protected PepperPage(String id, String name, com.pepper.platform.page.PageService pageService, String template, org.jdom.Document pageData)
id
- a String
specifying the id of the
new page; also used as the relative pathname of the
serialized version of the page.name
- a String
specifying the page name.pageService
- The PageService object associated with this
request. PackageName and PackageVersion will be obtained via
the PageService.template
- a String
specifying the relative path
of the page's XSLT template.pageData
- A JDOM Document
which represents the
current page's data.Method Detail |
---|
public void setId(String id)
Page
id
of this Page
. In serialized
form, the id
is stored as an attribute of the top-level
element of the page data.
setId
in interface Page
id
- a String
containing the id of the
page; id is also used as the relative path of the
serialized page on disk.Page
public String getId()
Page
id
of this Page
. In
serialized form, the id
is stored as an attribute
of the top-level element of the page data.
getId
in interface Page
String
containing the Page's id.Page
public void setName(String name)
Page
name
of this Page
. In serialized
form, the name
is stored as an attribute of the top-level
element of the page data.
setName
in interface Page
name
- a String
containing the name.Page
public String getName()
Page
name
of this Page
. In serialized
form, the name
is stored as an attribute of the top-level
element of the page data.
getName
in interface Page
String
containing the Page's name.Page
public void setType(String type)
Page
type
element of this page. In serialized form,
type
is stored as an attribute of the top-level
element of the page data.
setType
in interface Page
type
- a String
containing the the page type.Page
public String getType()
Page
type
of this page. In serialized form,
type
is stored as an attribute of the top-level
element of the page data.
getType
in interface Page
String
containing the value of the root
element's type attribute, or null
if the
the root element does not contain a type attribute.Page
public void setPackageName(String name)
Page
Page
.
setPackageName
in interface Page
name
- a String
containing the package name.Page
public String getPackageName()
Page
Page
.
getPackageName
in interface Page
String
containing the package name.Page
public void setPackageVersion(String version)
Page
Page
.
setPackageVersion
in interface Page
version
- a String
containing the name.Page
public String getPackageVersion()
Page
Page
.
getPackageVersion
in interface Page
String
containing the version.Page
public void setTemplate(String template)
Page
Page
.
setTemplate
in interface Page
template
- a String
containing the
the relative path of the page template.Page
public void setTemplateOverride(String template)
Page
setTemplateOverride
in interface Page
template
- a String
containing the
the relative path of the page template.Page
public long getLastSaveTime()
Page
getLastSaveTime
in interface Page
long
valuePage
public void setLastSaveTime(long time)
Page
setLastSaveTime
in interface Page
time
- a long
valuePage
public String getTemplate()
Page
Page
.
getTemplate
in interface Page
String
containing the relative
path of the template.Page
public void setDefaultType(String type)
Page
public String getDefaultType()
Page
defaultPageType
of this page, usually a section.
getDefaultType
in interface Page
String
containing the defaultPageTypePage
public boolean isPageTypeSupported(String pageType)
Page
isPageTypeSupported
in interface Page
pageType
- a String
containing the
specified page type.Page
public List getSupportedPageTypes()
Page
getSupportedPageTypes
in interface Page
List
containing the page types
this page may contain.Page
public void setSupportedPageTypes(List supportedPageTypes)
Page
setSupportedPageTypes
in interface Page
supportedPageTypes
- a List
containing the
the page types supported by this page.Page
public Date getCreateDate()
Page
getCreateDate
in interface Page
Date
specifying the create
date of the page.Page
public boolean getProcessBody()
boolean
indicating whether or
not this page processes element page attributes.public void setProcessBody(boolean processBody)
processBody
- a boolean
indicating whether or
not this page processes element-specific page attributes.public void setPageData(org.jdom.Document pageData)
Page
setPageData
in interface Page
pageData
- a JDOM Document
containing
the application specific XML page data. The Page
keeps a live reference to this Document
;
it is not copied.Page
public org.jdom.Document getPageData()
Page
getPageData
in interface Page
Document
containing the
application-specific XML page data. The
Document
returned is a live
document, and changes made to it will be
reflected in the Page's
copy.Page
public void setBaseDir(String baseDir)
Page
Page's
name.
setBaseDir
in interface Page
baseDir
- String representing the base directoryPage
public void unload()
Page
unload
in interface Page
Page
public File getBaseDir()
Page
Page's
name.
getBaseDir
in interface Page
File
object which points at the current
Page's
base directory.Page
public void setClassLoader(ClassLoader cl)
Page
setClassLoader
in interface Page
cl
- a ClassLoader
instance.Page
public boolean isLoaded()
Page
true
if the Page
has been
loaded from disk, or has had it's XML page data set directly
by a call to setPageData()
.
isLoaded
in interface Page
boolean
indicating whether or not the
Page's
XML page data has been loaded.Page
public boolean isDeletable()
Page
true
if the Page
is marked as
deletable. This indicates that the Page
can be deleted.
isDeletable
in interface Page
boolean
indicating whether or not the
Page
is deletable.Page
public void setDeletable(boolean isDeletable)
Page
setDeletable
in interface Page
isDeletable
- a boolean
indicating whether
or not the page is deletable.Page
public boolean getBackup()
Page
true
if the Page
is marked to
for backup.
getBackup
in interface Page
boolean
indicating whether or not the
Page
should be backed up.Page
public void setBackup(boolean backup)
Page
setBackup
in interface Page
backup
- a boolean
indicating whether
or not the page should be automatically backed up to a .bak file.Page
public boolean isAutoSaveEnabled()
Page
isAutoSaveEnabled
in interface Page
boolean
valuePage
public void setAutoSaveEnabled(boolean autoSaveEnabled)
Page
setAutoSaveEnabled
in interface Page
autoSaveEnabled
- a boolean
valuePage
public boolean getForceAutoSave()
Page
getForceAutoSave
in interface Page
boolean
valuePage
public void setForceAutoSave(boolean state)
Page
setForceAutoSave
in interface Page
state
- a boolean
valuePage
public boolean isReadOnly()
Page
true
if the Page
is marked as
read-only. This indicates that the Page
should not be modified. If save()
is called
on a page marked as read-only, the page will only be
saved if it does not yet exist on disk; all subsequent
save()
calls are no-ops.
isReadOnly
in interface Page
boolean
indicating whether or not the
Page
is read-only.Page
public void setReadOnly(boolean isReadOnly)
Page
true
, then this Page
will only be
saved to disk once, if it does not yet exist. Subsquent
calls to save()
will do nothing.
setReadOnly
in interface Page
isReadOnly
- a boolean
indicating whether
or not the page is read-only.Page
public boolean isHidden()
Page
true
if the Page
is marked as
hidden. This indicates that the Page
should never be shown
isHidden
in interface Page
boolean
indicating whether or not the
Page
is hidden.Page
public void setHidden(boolean isHidden)
Page
setHidden
in interface Page
isHidden
- a boolean
indicating whether
or not the page is hidden.Page
public boolean isSecure()
Page
true
if the Page
is marked as
secure. This indicates that the Page
<body> will be encrypted when saved to disk.
isSecure
in interface Page
boolean
indicating whether or not the
Page
is secure.Page
public void setSecure(boolean isSecure)
Page
true
, then the <body> of this page
will be encrypted before it is written to disk.
setSecure
in interface Page
isSecure
- a boolean
indicating whether
or not the page is secure.Page
public boolean exists()
Page
Page
exists
either in the original jar file or on disk
exists
in interface Page
Page
public String getRootAttrValue(String attrName)
Page
getRootAttrValue
in interface Page
Returns the value of the specified attribute
on the root element (ie page, section) in the document
public org.jdom.Document load() throws Exception
Page
Page
from disk.
load
in interface Page
Page's
page data JDOM
Document
, or null
if the
page has not yet been loaded.
Exception
- if the page data is corrupted, or if the file
cannot be read from disk.Page
public void save() throws Exception
Page
Page
to be serialized to disk. Any
elements with encrypt=true
attributes are encrypted,
and any elements with index=true
attributes are
indexed. The result is written to name.xml.
save
in interface Page
Exception
- if the Page
cannot be saved to disk.Page
public String toString()
Page
.
toString
in class Object
String
representing the page.public int getNoCache()
Page
getNoCache
in interface Page
Page
public void setNoCache(int options)
Page
setNoCache
in interface Page
options
- an int
value
0 = always use cached version of page if page not modified (default),
1 = never use cached version of page, force reload on display
2 = force re-init of JavaScript bridge on page displayPage
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |