com.novell.emframe.dev
Class PropertyBook

java.lang.Object
  extended bycom.novell.nps.gadgetManager.BaseGadgetInstance
      extended bycom.novell.emframe.dev.Task
          extended bycom.novell.emframe.dev.PropertyBook
All Implemented Interfaces:
com.novell.nps.configManager.ConfigurationComplete, com.novell.nps.gadgetManager.GadgetInstance, java.lang.Runnable, java.io.Serializable
Direct Known Subclasses:
DirPropertyBook

public abstract class PropertyBook
extends Task
implements java.lang.Runnable

Abstract class to implement to be a Property Book. Extends the Task interface so that property books can be launched like other tasks.

OutputData issue: In order to support both XSL and HTT in the name PropertyBook, this needs to support outputting data to either xml or properties. In the case of the frameset, menubar, and applybar we now these are currently implemented in htt, so we can output data directly to the resultStrings. However, when we are showing a page we do not now know if we will be showing an xml page or an htt page until after we call the previous page's cache method and the next page's show method (becuase one could throw an exception). Thus we output data using the outputData method. This creates a list of data items. This data is later put into the resultStrings or xml by calling the blastData method.

Moo limitations: Currently pages commit method does not get called if the writeData is being done on a seperate thread (which only happens in Moo - MultipleObjectOperations). The only way pages can participate in Moo is to through the PropertyBook.writeData method. For the DirPropertyBook this means using the MooManager object (NDSNamespace). This is a object specially designed to apply object operations to many eDirectory objects.

XML PropertyBook Params - things books can custimize by adding params to the install xml file.
Book.objectTypeDisplayNameKey urlparam displayName
Book.Icon.name urlparam icon on first page
Book.Icon.alt urlparam alt for icon on first page

eMFrameUtils.setMessage issue: these utilities output data directly to either the XML or Properties. The problem is that the PropertyBook doesn't know if the response will be XML or HTT when it calls this method.

See Also:
Serialized Form

Field Summary
protected  java.util.Vector m_allPages
          Vector containing all pages of the book (including disabled pages).
protected  java.util.Hashtable m_cache
          Hashtable cache used for sharing objects between PropertyBookPages.
protected  java.lang.String m_command
          Command to handle in the execute() method.
protected  TaskContext m_context
          TaskContent of the plug-in.
protected  int m_currentPageId
          Temporary store of current page.
 java.lang.String m_displayName
          Display name of the book.
protected  java.lang.String[] m_handledAttributeNames
          String array containing handled attribute names for use by the Other page.
 java.lang.String m_iconAlt
          Alt text of the icon.
 java.lang.String m_iconUrl
          URL to icon.
protected  java.lang.String m_id
          ID of this book.
protected  java.util.HashMap m_initialParams
          HashMap of initial parameters.
protected  org.jdom.Document[] m_pageDocs
          All inforamtion about a particular page.
protected  java.util.Vector m_pages
          Vector containing all pages of the book (excluding disabled pages).
protected  com.novell.webaccess.common.I18NServletRequest m_req
          I18NServletRequest.
 
Fields inherited from class com.novell.nps.gadgetManager.BaseGadgetInstance
CONFIGURABLE, gadgetAssignment, gadgetAssignmentDN, gadgetCode, gadgetInstanceID, GETDATA, HANDLE_ACTION_ERROR_STATE, helpURL, m_doc, m_JSPDataObject, m_moduleStylesheet, m_previousState, myLocale, PROCESSREQUEST, repeatable, resBundle, session, state, STATE_SHOW_USER_CONFIG, STATE_USER_CONFIG_COMPLETE, windowState
 
Fields inherited from interface com.novell.nps.gadgetManager.GadgetInstance
FULLPAGE_BRANDING_AREA_MODE, FULLPAGE_DATA_MODE, FULLPAGE_REQUEST_PROPERTY, GADGET_DN, GADGET_INSTANCE_ARGS, GADGET_INSTANCE_CLASS, GADGET_INSTANCE_ID_PROPERTY, LAUNCH_TYPE_DELEGATE, LAUNCH_TYPE_LAUNCH, LIFECYCLE_TYPE_EXISTING, LIFECYCLE_TYPE_NEW, LIFECYCLE_TYPE_RECREATE, LIFECYCLE_TYPE_RESET, LIFECYCLE_TYPE_REUSE, PARAM_RETURN_STATUS, RETURN_STATUS_CANCEL, RETURN_STATUS_CANCEL_ABORT, RETURN_STATUS_CANCEL_CONTINUE, RETURN_STATUS_ERROR_ABORT, RETURN_STATUS_ERROR_CONTINUE, RETURN_STATUS_FINISHED, STATE_PROPERTY, TEXT_HTML, TEXT_XML, WINDOW_STATE_MAXIMIZED, WINDOW_STATE_MINIMIZED
 
Constructor Summary
PropertyBook()
           
 
Method Summary
protected  void abortMooUpdate()
          Aborts a Multiple Object Operations (Moo) update in the middle of processing objects.
protected  void addPage(PropertyBookPage page)
          Adds a page to this book.
protected  void canCommit()
          Overwrite this method if you want to perform checks before committing page changes.
protected  void doApply()
          Called when user clicks apply or ok.
protected abstract  void doSearch()
          Allows the user to select a target to be modified, such as an eDirectory object.
protected  void doShow()
          Displays the property book pages.
 boolean execute(TaskContext context, java.util.Properties resultStrings)
          Main method for the PropertyBook to read information from the request and output the correct .jsp file.
 java.util.Hashtable getCache()
          Gets a Hashtable cache used for sharing objects between PropertyBookPages.
 java.lang.String getDisplayName()
          Returns the localized display name of the book.
 java.lang.String[] getHandledAttributeNames()
          Returns a String array of all attributes that this page is going to take care of.
 java.lang.String getInitialParameter(java.lang.String key)
          Get initial parameters based on a specific key used to instanciate this book.
protected  PropertyBookPage getInstance(org.jdom.Document doc)
          Given an xml file this will create a page.
protected  PropertyBookPage getInstance(org.jdom.Document doc, boolean verifyDevice)
          Given an xml file this will create a page.
protected  PropertyBookPage getPage(int index)
          Gets pages by the index; index is determined by ordering.
 PropertyBookPage getPageById(java.lang.String pageId)
          Gets a page from its id as defined in the xml description of the page.
protected  java.lang.String getPrefrencesKey()
          Returns the key to use for storing and reading page orders to and from preferences.
 void init(PluginContext context, org.jdom.Document doc)
          Initial call when the PropertyBook is created.
protected  void instantiatePages()
          Creates pages and populates the m_pages member variable.
protected static void log(java.lang.String message)
          Log a message to the debug log.
protected static void log(java.lang.Throwable e)
          Log an exception to the debug log.
protected  void outputData(java.lang.String key, java.lang.String value)
          Puts all data in a list.
protected  void outputMisc()
          Called on every request to output general data to be used in JSP or XSL.
protected static void printErrorMessage(java.lang.String message)
          Prints an error message to the log.
protected abstract  boolean readData()
          Reads data from a data source and stores it in a temporary store.
protected  void refresh()
          Clears temporary data store (mooManager) after apply pressed.
 void release()
          Called by iManager when the task has been released and should be collected in the future.
 void run()
          This is the Runnable.run method.
protected  void setMerge(java.lang.String merge)
          Set the merge jsp file.
static void shouldRun(javax.servlet.http.HttpServletRequest req, java.lang.String sServiceName)
          Returns whether this PropertyBook should be able to run.
protected  boolean shouldThreadUpdate()
          Returns whether the thread should update.
protected  void updateMooProgressDialog()
          Updates the Multiple Object Operations (Moo) progress dialog with which object is currently being operated on.
protected abstract  void writeData()
          Writes data to a data source from a temporary store.
 
Methods inherited from class com.novell.emframe.dev.Task
buildQueryString, execute, execute, isInitialized, isPluginAvailable, setInitialized, setUIPage
 
Methods inherited from class com.novell.nps.gadgetManager.BaseGadgetInstance
addActionListener, callGetData, clearDocument, configureApply, configureCancel, configureComplete, createDocument, findURIForLocFile, getAction, getActionIcons, getAllowProcessRequestAsync, getConfig, getConfigObjectSetting, getConfigObjectSettings, getConfigSetting, getConfigSetting, getConfigSettings, getConfigSettingValue, getConfigSettingValues, getConfiguredUniqueID, getContainedGadgetInstanceStylesheets, getCustomizeQueryString, getData, getDataFromLastTry, getDocument, getFullPageMode, getGadgetAssignment, getGadgetAssignmentDN, getGadgetInstanceID, getGadgetXMLEndTag, getGadgetXMLStartTag, getHandleActionErrorStateData, getIntConfigSetting, getJSPDataObject, getJSPPage, getLangResourceURI, getLaunchType, getLifeCycleType, getLocale, getLocHelpURL, getLocResourceURI, getManagementServiceSet, getOriginalServiceName, getParam, getParentInstance, getPortalConnection, getPreferredDataType, getPreferredName, getPreferredName, getPrimary, getProxyServer, getRedirectionOrSelf, getRepeatParams, getResourceBundle, getResourcePathBase, getReturnStatus, getRootDelegator, getRootNodeName, getSession, getState, getStylesheetAndResourceSets, getStyleSheetName, getUserConfigCompleteData, getWindowState, handleAction, handlePostRequestActions, hasHelp, init, isConfigSettingCumulative, isConfigSettingOverwriteable, isForceRead, isTimedOut, onPageMaximize, onPageMinimize, onPortalInit, onShowUserConfigAction, onUserConfigCompleteAction, outputHTMLError, parseMultipartFormData, prepare, processRequest, processRequest, processSecondaryGadgetResults, removeActionListener, reset, returnToPrimary, setAllowProcessRequestAsync, setConfigSetting, setConfigSetting, setForceRead, setGadgetAssignment, setGadgetAssignmentDN, setGadgetInstanceID, setGetDataFromLastTry, setLaunchType, setLifeCycleType, setLocale, setModuleStylesheet, setParentInstance, setPrimary, setRedirectionOrSelf, setRepeatParams, setRequestedDataType, setResourceBundle, setRootDelegator, setSession, setState, setTimedOut, setWindowState, supportsDeviceCharacteristics, writeConfig, writeGadgetXMLEndTag, writeGadgetXMLStartTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_allPages

protected java.util.Vector m_allPages
Vector containing all pages of the book (including disabled pages).


m_cache

protected java.util.Hashtable m_cache
Hashtable cache used for sharing objects between PropertyBookPages.


m_command

protected java.lang.String m_command
Command to handle in the execute() method.


m_context

protected TaskContext m_context
TaskContent of the plug-in.


m_currentPageId

protected int m_currentPageId
Temporary store of current page.


m_displayName

public java.lang.String m_displayName
Display name of the book.


m_handledAttributeNames

protected java.lang.String[] m_handledAttributeNames
String array containing handled attribute names for use by the Other page.


m_iconAlt

public java.lang.String m_iconAlt
Alt text of the icon.


m_iconUrl

public java.lang.String m_iconUrl
URL to icon.


m_id

protected java.lang.String m_id
ID of this book.


m_initialParams

protected java.util.HashMap m_initialParams
HashMap of initial parameters.


m_pageDocs

protected org.jdom.Document[] m_pageDocs
All inforamtion about a particular page.


m_pages

protected java.util.Vector m_pages
Vector containing all pages of the book (excluding disabled pages).


m_req

protected com.novell.webaccess.common.I18NServletRequest m_req
I18NServletRequest.

Constructor Detail

PropertyBook

public PropertyBook()
Method Detail

abortMooUpdate

protected void abortMooUpdate()
                       throws BookException
Aborts a Multiple Object Operations (Moo) update in the middle of processing objects. Not abstract, but any extend class should implement to support Multiple Object Operations (Moo).

Throws:
BookException - if there was a problem aborting the update

addPage

protected void addPage(PropertyBookPage page)
Adds a page to this book. Should only be called from instantiatePages.

Parameters:
page - The page to be added
See Also:
instantiatePages()

canCommit

protected void canCommit()
                  throws PluginException
Overwrite this method if you want to perform checks before committing page changes. By default, this method does nothing.

Throws:
PluginException - if the page changes should not be committed

doApply

protected void doApply()
                throws PluginException
Called when user clicks apply or ok. Should first cache the changes of the last page.

Throws:
PluginException - if there is a problem applying the changes

doSearch

protected abstract void doSearch()
Allows the user to select a target to be modified, such as an eDirectory object.


doShow

protected void doShow()
               throws BookException
Displays the property book pages.

doShow is called in two circumstances:

  1. To show the first page in the PropertyBook when it is first opened.
  2. When the user changes pages.

This method first calls the old page's cache method to save changes. It then displays the next page.

Throws:
BookException

execute

public boolean execute(TaskContext context,
                       java.util.Properties resultStrings)
Main method for the PropertyBook to read information from the request and output the correct .jsp file.

Specified by:
execute in class Task
Parameters:
context - TaskContext of the plug-in
resultStrings - Properties object containing setting names and values to be automatically added to the request.
Returns:
boolean true if execute was successful, false if otherwise
See Also:
Task.init(com.novell.emframe.dev.PluginContext, org.jdom.Document), Task.setUIPage(java.lang.String), PluginContext, eMFrameUtils

getCache

public java.util.Hashtable getCache()
Gets a Hashtable cache used for sharing objects between PropertyBookPages.

Returns:
Hashtable for sharing object between pages

getDisplayName

public java.lang.String getDisplayName()
Returns the localized display name of the book.

Returns:
String containing the localized display name

getHandledAttributeNames

public java.lang.String[] getHandledAttributeNames()
Returns a String array of all attributes that this page is going to take care of.

Returns:
String array of attribute names.

getInitialParameter

public java.lang.String getInitialParameter(java.lang.String key)
Get initial parameters based on a specific key used to instanciate this book.

Parameters:
key - Params passed across url to instanciate book
Returns:
String containing the value of the key

getInstance

protected PropertyBookPage getInstance(org.jdom.Document doc)
Given an xml file this will create a page. This can be used in the instantiatePages method to create the PropertyBook page object. Then call addPage. This call always checks the device type to make sure the page supports the current device.

Parameters:
doc - Document object containing the definition of the page
Returns:
PropertyBookPage containing the newly created page. Call addPage with this PropertyBookPage.
See Also:
addPage(com.novell.emframe.dev.PropertyBookPage)

getInstance

protected PropertyBookPage getInstance(org.jdom.Document doc,
                                       boolean verifyDevice)
Given an xml file this will create a page. This can be used in the instantiatePages method to create the PropertyBook page object. Then call addPage.

Parameters:
doc - Document object containing the definition of the page
verifyDevice - Check to see if the page supports the current device type
Returns:
PropertyBookPage containing the newly created page. Call addPage with this PropertyBookPage.
See Also:
addPage(com.novell.emframe.dev.PropertyBookPage)

getPage

protected PropertyBookPage getPage(int index)
Gets pages by the index; index is determined by ordering. Pages have an absolute ordering. This ordering is determined by the order they are added to the book in instantiatePages method.

Parameters:
index - The index number of the page requested.
Returns:
PropertyBookPage object containing the Page object requested

getPageById

public PropertyBookPage getPageById(java.lang.String pageId)
Gets a page from its id as defined in the xml description of the page.

Parameters:
pageId - String from the xml description of the page
Returns:
PropertyBookPage containing the specified page

getPrefrencesKey

protected java.lang.String getPrefrencesKey()
Returns the key to use for storing and reading page orders to and from preferences.

Returns:
String containing the key for storing/reading page orders to/from preferences

init

public void init(PluginContext context,
                 org.jdom.Document doc)
Initial call when the PropertyBook is created. Reads configuration data from the xml description of the book.

Overrides:
init in class Task
Parameters:
context - PluginContext of the plug-in
doc - Document to read configuration data from

instantiatePages

protected void instantiatePages()
                         throws BookException
Creates pages and populates the m_pages member variable.

instantiatePages is called by execute and reads the pages from the XML document passed to the init method.

Throws:
BookException - if unable to create pages or no pages exist.
See Also:
execute(com.novell.emframe.dev.TaskContext, java.util.Properties), init(com.novell.emframe.dev.PluginContext, org.jdom.Document)

log

protected static void log(java.lang.String message)
Log a message to the debug log.

Parameters:
message - String containing the message to log

log

protected static void log(java.lang.Throwable e)
Log an exception to the debug log.

Parameters:
e - Throwable containing the exception to log

outputData

protected final void outputData(java.lang.String key,
                                java.lang.String value)
Puts all data in a list. Blasted to xml or proerties just before execute exits.

Parameters:
key - String containing the key to put as an attribute on the HttpServletRequest
value - Value of the key

outputMisc

protected void outputMisc()
                   throws BookException
Called on every request to output general data to be used in JSP or XSL.

Throws:
BookException

printErrorMessage

protected static void printErrorMessage(java.lang.String message)
Prints an error message to the log.

Parameters:
message - String containing the message to log

readData

protected abstract boolean readData()
                             throws BookException
Reads data from a data source and stores it in a temporary store. For example, readData might read data from eDirectory and store it in an NSObject.

Returns:
boolean true if read was successful, false if otherwise
Throws:
BookException - if there was a problem reading

refresh

protected void refresh()
                throws BookException
Clears temporary data store (mooManager) after apply pressed. Not abstract, but any extend class should implement to support Multiple Object Operations (Moo).

Throws:
BookException - if there was a problem refreshing

release

public void release()
Called by iManager when the task has been released and should be collected in the future. Used to release resources.

Note: Tasks that have registered with the Authbroker or other tasks for events should use this to remove themselves as well as releasing any resources they may be holding.
This is a place holder for the interface required method.

Specified by:
release in interface com.novell.nps.gadgetManager.GadgetInstance
Overrides:
release in class Task

run

public void run()
This is the Runnable.run method. It is used to writeChanges to the datasource on a seperate thread. Only calls writeData.

Specified by:
run in interface java.lang.Runnable

setMerge

protected final void setMerge(java.lang.String merge)
Set the merge jsp file.

Parameters:
merge - String containing the next .jsp file to use

shouldRun

public static void shouldRun(javax.servlet.http.HttpServletRequest req,
                             java.lang.String sServiceName)
                      throws java.lang.Exception
Returns whether this PropertyBook should be able to run.

Parameters:
req - HttpServletRequest
sServiceName - String containing the id of this PropertyBook
Throws:
java.lang.Exception - if this PropertyBook cannot run

shouldThreadUpdate

protected boolean shouldThreadUpdate()
Returns whether the thread should update. If not overwritten, this method always returns false. Not abstract, but any extend class should implement to support Multiple Object Operations (Moo).

Returns:
boolean: true if the thread should update, false if otherwise. If not overwritten, this method always returns false.

updateMooProgressDialog

protected void updateMooProgressDialog()
                                throws BookException
Updates the Multiple Object Operations (Moo) progress dialog with which object is currently being operated on. Not abstract, but any extend class should implement to support Multiple Object Operations (Moo).

Throws:
BookException - if there was a problem updating the dialog

writeData

protected abstract void writeData()
                           throws BookException
Writes data to a data source from a temporary store. For example, writeData might writed data that it retrieves from an NSObject to eDirectory.

Throws:
BookException - if there was a problem writing


API Documentation Copyright © 1998-2004 Novell, Inc. All rights reserved.
NDS is a registered trademark of Novell, Inc. in the United States and other countries.
Generated September 2 2004 0111.