WebObjects 5.4.2

com.webobjects.directtoweb
Class D2WModel

java.lang.Object
  extended by com.webobjects.directtoweb.D2WModel
All Implemented Interfaces:
EOKeyValueArchiving
Direct Known Subclasses:
D2WFastModel

public class D2WModel
extends Object
implements EOKeyValueArchiving

The D2WModel class manages a set of rules for a Direct to Web application. It provides support for file input/output, as well as for the Web Assistant.

The implementation is subject to change in future releases.

See Also:
Rule

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.webobjects.eocontrol.EOKeyValueArchiving
EOKeyValueArchiving.Awaking, EOKeyValueArchiving.FinishInitialization, EOKeyValueArchiving.Support
 
Field Summary
static String ActionsKey
          The actions key.
static String AllMarker
          A constant that represents a wildcard, for example, "any task."
static String AllowCollapsingKey
          The allow collapsing key; the literal "allowCollapsing".
static String AlternateRowColorKey
          The alternate row color key; the literal "alternateRowColor".
static String AttributeKey
          The attribute key.
static String AttributeTypeKey
          The attribute type key; the literal "a".
static String BackgroundColorForPageKey
          The background-color-for-page key; the literal "backgroundColorForPage".
static String BackgroundColorForTableKey
          The background-color-for-table key; the literal "backgroundColorForTable".
static String BoldKey
          The bold key.
static String ColorKey
          The color key.
static String ComponentAvailableKey
          The component available key; the literal "componentAvailable".
static String ComponentNameKey
          The component name key; the literal "componentName".
static String ComponentsToShowAtEndKey
          The components-to-show-at-end-of-list key; the literal "componentsToShowAtEndOfList".
static String CustomTypeKey
          The custom type key; the literal "c".
static String DisplayNameForPropertyKey
          The display-name-for-property key; the literal "displayNameForProperty".
static String DisplayPropertyKeysKey
          The display-property-keys key; the literal "displayPropertyKeys".
static String DummyTrueKey
          The dummy-true key; the literal "dummyTrue"; for a rule without pre-conditions.
static String DynamicPageKey
          The dynamic page key; the literal "pageConfiguration".
static String EntityKey
          The entity key.
static String FormatterKey
          The formatter key.
static String FrameKey
          The frame key.
static String FramesActiveKey
          The frames active key; the literal "framesActive".
static String IsGeneratingKey
          The is generating key; the literal "isGenerating".
static String ItalicKey
          The italic key.
static String KeyPathTypeKey
          The key path type key; the literal "k".
static String KeyWhenRelationshipKey
          The key-when-relationship key; the literal "keyWhenRelationship".
static String LengthKey
          The length key.
static String LookKey
          The look key.
static String NoneMarker
          A constant that represents the lack of a selection.
static Integer One
          A constant that represents a logical true value.
static String PageAvailableKey
          The page available key; the literal "pageAvailable".
static String PageNameKey
          The page name key; the literal "pageName".
static String PropertyIsKeyPathKey
          The property-is-key path key; the literal "propertyIsKeyPath".
static String PropertyKey
          The property key.
static String PropertyKeyKey
          The property-key key; the literal "propertyKey".
static String PropertyKeyPortionInModelKey
          The property-key-portion-in-model key; the literal "propertyKeyPortionInModel".
static String PropertyTypeKey
          The property type key; the literal "propertyType".
static String ReadOnlyEntityNamesKey
          The read-only entity names key; the literal "readOnlyEntityNames".
static String RelationshipKey
          The relationship key.
static String RelationshipTypeKey
          The relationship type key; the literal "r".
static String RequiresEntityKey
          The requires entity key; the literal "requiresEntity".
static String SessionKey
          The session key.
static String ShowBannerKey
          The show banner key; the literal "showBanner".
static String StartupEntityNameKey
          The startup entity name key; the literal "startupEntityName".
static String StartupTaskKey
          The startup task key; the literal "startupTask".
static String TargetKey
          The target key.
static String TaskKey
          The task key.
static String VisibleEntityNamesKey
          The visible entity names key; the literal "visibleEntityNames".
static String WebAssistantPageNameKey
          The Web Assistant page name key; the literal "webAssistantPageName".
static Integer Zero
          A constant that represents a logical false value.
 
Constructor Summary
protected D2WModel(EOKeyValueUnarchiver unarchiver)
          Creates an instance of D2WModel with the specified unarchiver.
protected D2WModel(File f)
          Creates an instance of D2WModel with the specified file.
protected D2WModel(NSArray rules)
          Creates an instance of D2WModel with the specified rules.
protected D2WModel(URL url)
          Creates an instance of D2WModel from the contents of the specified URL.
 
Method Summary
protected  void addRule(Rule newRule)
          Adds the specified rule; dirties the model.
protected  void addRules(NSArray extraRules)
          Invokes the addRule method on each of the specified rules.
protected  void addRuleToItsBucket(Rule r)
          Adds the specified rule to the local rule caches.
protected  void addRuleTrace(Rule newRule)
          Invokes the addRule method and logs a trace.
protected  Vector candidates(String keyPath, D2WContext context)
          Gets rules from the local rule caches for the specified key path.
 boolean canSaveUserModel()
          Indicates whether the user model can be saved, that is, whether the user model is the project bundle.
 boolean checkPossibilityToSaveUserModel(boolean throwp)
          Calculates whether it is possible to save the user model.
 void checkRules()
          Checks the rules.
 Hashtable clientConfiguration()
          Gets the client configuration.
 Vector clientConfigurationFilesInBundles()
          Deprecated. Use clientConfigurationFilesPathURLsInBundles instead
 Vector clientConfigurationFilesPathURLsInBundles()
          Gets the client configuration files in bundles.
 Hashtable componentDefinitions()
          Gets the component definitions.
protected  void createWebAssistantRulesWithSettings(ServerSideSettings settings)
          Creates Web Assistant rules with the specified settings.
protected  Vector dataTypesInvolved()
          Gets the data types involved for the rules.
static D2WModel defaultModel()
          Gets the default model.
 boolean dirty()
          Indicates whether rules have been added to or removed from the model since the last merge or saving or reverting of the Web Assistant rules.
protected  Vector dynamicPages()
          Gets a list of all the dynamic pages found in the model.
 Hashtable editors()
          Gets the editors.
protected  NSDictionary encodeWebAssistantRulesWithKeyValueArchiver(EOKeyValueArchiver archiver)
          Encodes the Web Assistant rules with the specified key-value archiver.
 void encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
          Asks the receiver to archive its state into the EOKeyValueArchiver archiver.
protected  Vector fireAllRulesForKeyPathInContext(String keyPath, D2WContext context)
          Fires all candidate rules for the specified key path that can fire in the specified context; aggregates the results of all firings.
protected  Object fireRuleForKeyPathInContext(String keyPath, D2WContext context)
          Fires the first candidate rule for the specified key path that can fire in the specified context.
protected  Object fireSystemRuleForKeyPathInContext(String keyPath, D2WContext context)
          Fires the first candidate rule for the specified key path that can fire in the specified context but is not authored by the Web Assistant.
 Hashtable inferrableKeys()
          Gets the inferrable keys.
protected  void initializeClientConfiguration()
          Intializes the client configuration.
protected  void invalidateCaches()
          Clears the local caches of dynamic pages and rules.
 boolean isPageStatic(String pageName, D2WContext aContext)
          Indicates whether the page with the specified name is static in the specified context.
 void loadRules()
          Loads the rules.
protected  void mergeFile(File modelFile)
          Deprecated. Use mergePathURL instead
protected  void mergePathURL(URL modelPathURL)
          Adds the rules from the specified model file path URL; dirties the model.
 Vector modelFilesInBundles()
          Deprecated. Use modelFilesPathURLsInBundles instead
 Vector modelFilesPathURLsInBundles()
          Gets the model files in the bundles
static String nameFromFrameworkBundle(NSBundle bundle)
          Gets the name of the specified framework bundle.
protected  void newSettings(ServerSideSettings settings)
          Updates the model with the specified settings.
 Vector pageRuleKeysForPage(String pageName)
          Gets the page rule keys for the specified page.
 Vector pageRuleKeysFromClientConfiguration()
          Gets the page rule keys from the client configuration.
 Vector propertyRuleKeysForComponents(Vector componentsAvailable)
          Gets the property rule keys for the specified components.
 Vector propertyRuleKeysFromClientConfiguration()
          Gets the property rule keys from the client configuration.
protected  void removeAllWebAssistantRules()
          Removes all of the Web Assistant rules.
protected  void removeDynamicPage(ServerSideSettings settings)
          Removes the Web Assistant rules with the same context as the specified settings if the specified settings are for a dynamic page.
protected  void removeRule(Rule rule)
          Removes the specified rule; dirties the model.
protected  void removeWebAssistantRulesWithSameContextAsSettings(com.apple.client.directtoweb.common.Settings settings)
          Removes the Web Assistant rules that have the same context as the specified settings.
protected  void revertWebAssistantRules()
          Reverts the Web Assistant rules; un-dirties the model.
protected  NSArray rules()
          Gets the rules.
protected  void saveWebAssistantRulesIntoUsedModelFile()
          Saves Web Assistant rules in the used model file.
static void setDefaultModel(D2WModel newModel)
          Sets the default model to the specified value.
protected  void setDirty(boolean newValue)
          Sets whether the model is dirty to the specified value.
protected  void setRules(NSArray newRules)
          Sets the rules to the specified value; sorts the rules.
protected  void sortRules()
          Invalidates caches.
protected  Enumeration tasks()
          Get an enumeration of the tasks in the model.
protected  Vector taskVector()
          Gets a list of all tasks found in the model.
protected  void toFile(File f)
          Writes the dictionary of the key-value archiver to the specified file.
 String toString()
           
 String typeForRuleKey(String key)
          Gets the type for the specified rule key.
 void updateUserSettingsForNewPageAvailableRule(ServerSideSettings settings, String dtwComponentName)
          Updates user settings for a new page available rule.
 File userClientConfigurationFile()
          Deprecated. Use userClientConfigurationFilePathURL instead
 URL userClientConfigurationFilePathURL()
          Gets the user client configuration file.
 File userModelFile()
          Deprecated. Use userModelFilePathURL instead.
 URL userModelFilePathURL()
          Gets the user model file.
protected  NSArray webAssistantRulesForSave()
          Gets the Web Assistant rules for saving.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

Zero

public static final Integer Zero
A constant that represents a logical false value.

See Also:
D2WModel.One, BooleanAssignment

One

public static final Integer One
A constant that represents a logical true value.

See Also:
D2WModel.Zero, BooleanAssignment

AllMarker

public static final String AllMarker
A constant that represents a wildcard, for example, "any task."

See Also:
Rule.hasSameSettingsAs(Settings, boolean), Settings.AllMarker, Constant Field Values

NoneMarker

public static final String NoneMarker
A constant that represents the lack of a selection.

See Also:
D2WModel.AllMarker, Settings.NoneMarker, Constant Field Values

TaskKey

public static final String TaskKey
The task key.

See Also:
Constant Field Values

EntityKey

public static final String EntityKey
The entity key.

See Also:
Constant Field Values

IsGeneratingKey

public static final String IsGeneratingKey
The is generating key; the literal "isGenerating".

See Also:
Constant Field Values

FrameKey

public static final String FrameKey
The frame key.

See Also:
Constant Field Values

DynamicPageKey

public static final String DynamicPageKey
The dynamic page key; the literal "pageConfiguration".

See Also:
Constant Field Values

LookKey

public static final String LookKey
The look key.

See Also:
Constant Field Values

ComponentNameKey

public static final String ComponentNameKey
The component name key; the literal "componentName".

See Also:
Constant Field Values

WebAssistantPageNameKey

public static final String WebAssistantPageNameKey
The Web Assistant page name key; the literal "webAssistantPageName".

See Also:
Constant Field Values

ComponentAvailableKey

public static final String ComponentAvailableKey
The component available key; the literal "componentAvailable".

See Also:
Constant Field Values

ComponentsToShowAtEndKey

public static final String ComponentsToShowAtEndKey
The components-to-show-at-end-of-list key; the literal "componentsToShowAtEndOfList".

See Also:
Constant Field Values

PageAvailableKey

public static final String PageAvailableKey
The page available key; the literal "pageAvailable".

See Also:
Constant Field Values

PageNameKey

public static final String PageNameKey
The page name key; the literal "pageName".

See Also:
Constant Field Values

VisibleEntityNamesKey

public static final String VisibleEntityNamesKey
The visible entity names key; the literal "visibleEntityNames".

See Also:
Constant Field Values

ReadOnlyEntityNamesKey

public static final String ReadOnlyEntityNamesKey
The read-only entity names key; the literal "readOnlyEntityNames".

See Also:
Constant Field Values

RequiresEntityKey

public static final String RequiresEntityKey
The requires entity key; the literal "requiresEntity".

See Also:
Constant Field Values

PropertyKeyKey

public static final String PropertyKeyKey
The property-key key; the literal "propertyKey".

See Also:
Constant Field Values

PropertyKeyPortionInModelKey

public static final String PropertyKeyPortionInModelKey
The property-key-portion-in-model key; the literal "propertyKeyPortionInModel".

See Also:
Constant Field Values

PropertyKey

public static final String PropertyKey
The property key.

See Also:
Constant Field Values

SessionKey

public static final String SessionKey
The session key.

See Also:
Constant Field Values

DummyTrueKey

public static final String DummyTrueKey
The dummy-true key; the literal "dummyTrue"; for a rule without pre-conditions.

See Also:
ServerSideSettings.dummyTrueQualifier, Constant Field Values

AttributeKey

public static final String AttributeKey
The attribute key.

See Also:
Constant Field Values

RelationshipKey

public static final String RelationshipKey
The relationship key.

See Also:
Constant Field Values

TargetKey

public static final String TargetKey
The target key.

See Also:
Constant Field Values

DisplayPropertyKeysKey

public static final String DisplayPropertyKeysKey
The display-property-keys key; the literal "displayPropertyKeys".

See Also:
Constant Field Values

DisplayNameForPropertyKey

public static final String DisplayNameForPropertyKey
The display-name-for-property key; the literal "displayNameForProperty".

See Also:
Constant Field Values

KeyWhenRelationshipKey

public static final String KeyWhenRelationshipKey
The key-when-relationship key; the literal "keyWhenRelationship".

See Also:
Constant Field Values

FormatterKey

public static final String FormatterKey
The formatter key.

See Also:
Constant Field Values

AlternateRowColorKey

public static final String AlternateRowColorKey
The alternate row color key; the literal "alternateRowColor".

See Also:
Constant Field Values

LengthKey

public static final String LengthKey
The length key.

See Also:
Constant Field Values

BoldKey

public static final String BoldKey
The bold key.

See Also:
Constant Field Values

ItalicKey

public static final String ItalicKey
The italic key.

See Also:
Constant Field Values

ColorKey

public static final String ColorKey
The color key.

See Also:
Constant Field Values

BackgroundColorForTableKey

public static final String BackgroundColorForTableKey
The background-color-for-table key; the literal "backgroundColorForTable".

See Also:
Constant Field Values

BackgroundColorForPageKey

public static final String BackgroundColorForPageKey
The background-color-for-page key; the literal "backgroundColorForPage".

See Also:
Constant Field Values

AllowCollapsingKey

public static final String AllowCollapsingKey
The allow collapsing key; the literal "allowCollapsing".

See Also:
Constant Field Values

ActionsKey

public static final String ActionsKey
The actions key.

See Also:
Constant Field Values

FramesActiveKey

public static final String FramesActiveKey
The frames active key; the literal "framesActive".

See Also:
Constant Field Values

StartupTaskKey

public static final String StartupTaskKey
The startup task key; the literal "startupTask".

See Also:
Constant Field Values

StartupEntityNameKey

public static final String StartupEntityNameKey
The startup entity name key; the literal "startupEntityName".

See Also:
Constant Field Values

ShowBannerKey

public static final String ShowBannerKey
The show banner key; the literal "showBanner".

See Also:
Constant Field Values

PropertyIsKeyPathKey

public static final String PropertyIsKeyPathKey
The property-is-key path key; the literal "propertyIsKeyPath".

See Also:
Constant Field Values

PropertyTypeKey

public static final String PropertyTypeKey
The property type key; the literal "propertyType".

See Also:
Constant Field Values

RelationshipTypeKey

public static final String RelationshipTypeKey
The relationship type key; the literal "r".

See Also:
Constant Field Values

AttributeTypeKey

public static final String AttributeTypeKey
The attribute type key; the literal "a".

See Also:
Constant Field Values

CustomTypeKey

public static final String CustomTypeKey
The custom type key; the literal "c".

See Also:
Constant Field Values

KeyPathTypeKey

public static final String KeyPathTypeKey
The key path type key; the literal "k".

See Also:
Constant Field Values
Constructor Detail

D2WModel

protected D2WModel(File f)
Creates an instance of D2WModel with the specified file.

Parameters:
f - instance of java.io.File
See Also:
D2WModel.D2WModel(EOKeyValueUnarchiver)

D2WModel

protected D2WModel(URL url)
Creates an instance of D2WModel from the contents of the specified URL.

Parameters:
url - instance of java.io.URL
Since:
5.2.2
See Also:
D2WModel.D2WModel(EOKeyValueUnarchiver)

D2WModel

protected D2WModel(EOKeyValueUnarchiver unarchiver)
Creates an instance of D2WModel with the specified unarchiver.

Parameters:
unarchiver - instance of EOKeyValueUnarchiver
See Also:
D2WModel.D2WModel(NSArray)

D2WModel

protected D2WModel(NSArray rules)
Creates an instance of D2WModel with the specified rules.

Parameters:
rules - instance of NSArray
See Also:
D2WModel.setRules(NSArray)
Method Detail

defaultModel

public static D2WModel defaultModel()
Gets the default model.

Returns:
instance of D2WModel
See Also:
D2WModel.setDefaultModel(D2WModel)

setDefaultModel

public static void setDefaultModel(D2WModel newModel)
Sets the default model to the specified value.

Parameters:
newModel - instance of D2WModel
See Also:
D2WModel.defaultModel()

initializeClientConfiguration

protected void initializeClientConfiguration()
Intializes the client configuration.

See Also:
D2WModel.clientConfiguration()

clientConfiguration

public Hashtable clientConfiguration()
Gets the client configuration.

Returns:
instance of java.util.Hashtable
See Also:
D2WModel.initializeClientConfiguration()

editors

public Hashtable editors()
Gets the editors.

Returns:
instance of java.util.Hashtable

componentDefinitions

public Hashtable componentDefinitions()
Gets the component definitions.

Returns:
instance of java.util.Hashtable

inferrableKeys

public Hashtable inferrableKeys()
Gets the inferrable keys.

Returns:
instance of java.util.Hashtable

propertyRuleKeysFromClientConfiguration

public Vector propertyRuleKeysFromClientConfiguration()
Gets the property rule keys from the client configuration.

The current implementation caches the keys.

The implementation is subject to change in future releases.

Returns:
instance of java.util.Vector
See Also:
D2WModel.editors()

propertyRuleKeysForComponents

public Vector propertyRuleKeysForComponents(Vector componentsAvailable)
Gets the property rule keys for the specified components.

Parameters:
componentsAvailable - instance of java.util.Vector
Returns:
instance of java.util.Vector
Throws:
IllegalStateException - if a component has not been defined in the client configuration property list file

pageRuleKeysFromClientConfiguration

public Vector pageRuleKeysFromClientConfiguration()
Gets the page rule keys from the client configuration.

Returns:
instance of java.util.Vector
See Also:
D2WModel.clientConfiguration(), D2WModel.editors()

pageRuleKeysForPage

public Vector pageRuleKeysForPage(String pageName)
Gets the page rule keys for the specified page.

Parameters:
pageName - the name of the page
Returns:
instance of java.util.Vector

checkPossibilityToSaveUserModel

public boolean checkPossibilityToSaveUserModel(boolean throwp)
Calculates whether it is possible to save the user model.

Parameters:
throwp - whether to forward or quietly log an exception
Returns:
true if the user model can be saved; false otherwise.
Throws:
IllegalStateException - if the web assistant is enabled, the user model is not in the project bundle, and throwp argument is true
See Also:
D2WModel.canSaveUserModel()

userModelFile

@Deprecated
public File userModelFile()
Deprecated. Use userModelFilePathURL instead.

Gets the user model file.

Returns:
instance of java.io.File

userModelFilePathURL

public URL userModelFilePathURL()
Gets the user model file.

Returns:
instance of java.net.URL
Since:
5.2.2

userClientConfigurationFile

@Deprecated
public File userClientConfigurationFile()
Deprecated. Use userClientConfigurationFilePathURL instead

Gets the user client configuration file.

Returns:
instance of java.io.File

userClientConfigurationFilePathURL

public URL userClientConfigurationFilePathURL()
Gets the user client configuration file.

Returns:
instance of java.net.URL
Since:
5.2.2

nameFromFrameworkBundle

public static String nameFromFrameworkBundle(NSBundle bundle)
Gets the name of the specified framework bundle.

Parameters:
bundle - instance of NSBundle
Returns:
the framework bundle name if the path ends with ".framework; null otherwise.

modelFilesInBundles

@Deprecated
public Vector modelFilesInBundles()
Deprecated. Use modelFilesPathURLsInBundles instead

Gets the model files in the bundles

Returns:
instance of java.util.Vector
Throws:
IllegalStateException - if the model files in the Direct To Web framework cannot be found
See Also:
D2WModel.nameFromFrameworkBundle(NSBundle)

modelFilesPathURLsInBundles

public Vector modelFilesPathURLsInBundles()
Gets the model files in the bundles

Returns:
instance of java.util.Vector
Throws:
IllegalStateException - if the model files in the Direct To Web framework cannot be found
Since:
5.2.2
See Also:
D2WModel.nameFromFrameworkBundle(NSBundle)

clientConfigurationFilesInBundles

@Deprecated
public Vector clientConfigurationFilesInBundles()
Deprecated. Use clientConfigurationFilesPathURLsInBundles instead

Gets the client configuration files in bundles.

Returns:
instance of java.util.Vector
See Also:
D2WModel.nameFromFrameworkBundle(NSBundle)

clientConfigurationFilesPathURLsInBundles

public Vector clientConfigurationFilesPathURLsInBundles()
Gets the client configuration files in bundles.

Returns:
instance of java.util.Vector
Since:
5.2.2
See Also:
D2WModel.nameFromFrameworkBundle(NSBundle)

checkRules

public void checkRules()
Checks the rules. The rules have to be reloaded if the following files have been modified since the time that the files were last read:

loadRules

public void loadRules()
Loads the rules. Merges model files in the bundles, client configuration files, and the user model file.

See Also:
D2WModel.modelFilesInBundles(), D2WModel.mergeFile(File), D2WModel.clientConfigurationFilesInBundles(), D2WModel.userClientConfigurationFile(), D2WModel.userModelFile()

dataTypesInvolved

protected Vector dataTypesInvolved()
Gets the data types involved for the rules.

Returns:
instance of java.util.Vector
See Also:
D2WModel.rules(), Rule.dataTypesInvolved()

dirty

public boolean dirty()
Indicates whether rules have been added to or removed from the model since the last merge or saving or reverting of the Web Assistant rules.

Returns:
true if the model is dirty; false otherwise
See Also:
D2WModel.setDirty(boolean), D2WModel.mergeFile(File), D2WModel.addRule(Rule), D2WModel.removeRule(Rule), D2WModel.saveWebAssistantRulesIntoUsedModelFile(), D2WModel.revertWebAssistantRules(), D2WModel.removeWebAssistantRulesWithSameContextAsSettings(Settings)

setDirty

protected void setDirty(boolean newValue)
Sets whether the model is dirty to the specified value.

Parameters:
newValue - boolean
See Also:
D2WModel.dirty()

mergeFile

@Deprecated
protected void mergeFile(File modelFile)
Deprecated. Use mergePathURL instead

Adds the rules from the specified model file; dirties the model.

Parameters:
modelFile - instance of java.io.File
See Also:
D2WModel.addRules(NSArray), D2WModel.setDirty(boolean)

mergePathURL

protected void mergePathURL(URL modelPathURL)
Adds the rules from the specified model file path URL; dirties the model.

Parameters:
modelPathURL - instance of java.net.URL
Since:
5.2.2
See Also:
D2WModel.addRules(NSArray), D2WModel.setDirty(boolean)

rules

protected NSArray rules()
Gets the rules.

Returns:
instance of NSArray
See Also:
D2WModel.setRules(NSArray)

setRules

protected void setRules(NSArray newRules)
Sets the rules to the specified value; sorts the rules.

Parameters:
newRules - instance of NSArray
See Also:
D2WModel.rules(), D2WModel.sortRules()

addRule

protected void addRule(Rule newRule)
Adds the specified rule; dirties the model.

Parameters:
newRule - instance of Rule
See Also:
D2WModel.rules(), D2WModel.setDirty(boolean), D2WModel.removeRule(Rule)

addRuleTrace

protected void addRuleTrace(Rule newRule)
Invokes the addRule method and logs a trace.

Parameters:
newRule - instance of Rule
See Also:
D2WModel.addRule(Rule)

removeRule

protected void removeRule(Rule rule)
Removes the specified rule; dirties the model.

Parameters:
rule - instance of Rule
See Also:
D2WModel.rules(), D2WModel.setDirty(boolean), D2WModel.addRule(Rule)

addRules

protected void addRules(NSArray extraRules)
Invokes the addRule method on each of the specified rules.

Parameters:
extraRules - instance of NSArray
See Also:
D2WModel.addRule(Rule), D2WModel.mergeFile(File)

removeAllWebAssistantRules

protected void removeAllWebAssistantRules()
Removes all of the Web Assistant rules.

See Also:
D2WModel.rules(), D2WModel.setRules(NSArray), D2WModel.removeWebAssistantRulesWithSameContextAsSettings(Settings)

webAssistantRulesForSave

protected NSArray webAssistantRulesForSave()
Gets the Web Assistant rules for saving.

Returns:
instance of NSArray

addRuleToItsBucket

protected void addRuleToItsBucket(Rule r)
Adds the specified rule to the local rule caches.

Parameters:
r - instance of Rule
See Also:
D2WModel.sortRules(), D2WModel.createWebAssistantRulesWithSettings(ServerSideSettings)

invalidateCaches

protected void invalidateCaches()
Clears the local caches of dynamic pages and rules.

See Also:
D2WModel.dynamicPages(), D2WModel.addRuleToItsBucket(Rule), D2WModel.candidates(String, D2WContext)

sortRules

protected void sortRules()
Invalidates caches.

See Also:
D2WModel.invalidateCaches()

encodeWebAssistantRulesWithKeyValueArchiver

protected NSDictionary encodeWebAssistantRulesWithKeyValueArchiver(EOKeyValueArchiver archiver)
Encodes the Web Assistant rules with the specified key-value archiver.

Parameters:
archiver - instance of EOKeyValueArchiver
Returns:
instance of NSDictionary
See Also:
D2WModel.webAssistantRulesForSave()

toString

public String toString()
Overrides:
toString in class Object

toFile

protected void toFile(File f)
               throws IOException
Writes the dictionary of the key-value archiver to the specified file.

Parameters:
f - instance of java.io.File
Throws:
IOException - if the archive dictionary cannot be written
See Also:
D2WModel.encodeWithKeyValueArchiver(EOKeyValueArchiver)

updateUserSettingsForNewPageAvailableRule

public void updateUserSettingsForNewPageAvailableRule(ServerSideSettings settings,
                                                      String dtwComponentName)
Updates user settings for a new page available rule.

The current implementation adds the page available rule to the model, updates the client configuration property list file, and updates the memory caches so that the settings take effect.

The implementation is subject to change in future releases.

Parameters:
settings - instance of ServerSideSettings
dtwComponentName - name of the Direct to Web component
Throws:
NSForwardException - if there is an error reading from or writing to the client configuration property list file
See Also:
D2WModel.addRuleTrace(Rule), D2WModel.componentDefinitions(), D2WModel.clientConfiguration()

canSaveUserModel

public boolean canSaveUserModel()
Indicates whether the user model can be saved, that is, whether the user model is the project bundle.

Returns:
true if the user model can be saved; false otherwise
See Also:
D2WModel.checkPossibilityToSaveUserModel(boolean)

saveWebAssistantRulesIntoUsedModelFile

protected void saveWebAssistantRulesIntoUsedModelFile()
Saves Web Assistant rules in the used model file.


revertWebAssistantRules

protected void revertWebAssistantRules()
Reverts the Web Assistant rules; un-dirties the model.

The current implementation removes all Web Assistant rules, merges the user model file, and sorts the rules.

The implementation is subject to change in future releases.

See Also:
D2WModel.removeAllWebAssistantRules(), D2WModel.mergeFile(File), D2WModel.userModelFile(), D2WModel.sortRules(), D2WModel.setDirty(boolean)

candidates

protected Vector candidates(String keyPath,
                            D2WContext context)
Gets rules from the local rule caches for the specified key path.

Parameters:
keyPath - the key path
context - instance of D2WContext - ignored
Returns:
instance of java.util.Vector
See Also:
D2WModel.addRuleToItsBucket(Rule), D2WModel.invalidateCaches()

fireSystemRuleForKeyPathInContext

protected Object fireSystemRuleForKeyPathInContext(String keyPath,
                                                   D2WContext context)
Fires the first candidate rule for the specified key path that can fire in the specified context but is not authored by the Web Assistant.

Parameters:
keyPath - the key path
context - instance of D2WContext
Returns:
the result of firing if a rule fires; null otherwise
See Also:
D2WModel.fireRuleForKeyPathInContext(String, D2WContext)

fireRuleForKeyPathInContext

protected Object fireRuleForKeyPathInContext(String keyPath,
                                             D2WContext context)
Fires the first candidate rule for the specified key path that can fire in the specified context.

Parameters:
keyPath - the key path
context - instance of D2WContext
Returns:
the result of firing if a rule fires; null otherwise
See Also:
D2WModel.fireSystemRuleForKeyPathInContext(String, D2WContext), D2WModel.fireAllRulesForKeyPathInContext(String, D2WContext)

fireAllRulesForKeyPathInContext

protected Vector fireAllRulesForKeyPathInContext(String keyPath,
                                                 D2WContext context)
Fires all candidate rules for the specified key path that can fire in the specified context; aggregates the results of all firings.

Parameters:
keyPath - the key path
context - instance of D2WContext
Returns:
instance of java.util.Vector
See Also:
D2WModel.candidates(String, D2WContext), D2WModel.fireRuleForKeyPathInContext(String, D2WContext), Rule.canFireInContext(D2WContext), Rule.fire(D2WContext)

taskVector

protected Vector taskVector()
Gets a list of all tasks found in the model.

Returns:
instance of java.util.Vector
See Also:
D2WModel.tasks()

tasks

protected Enumeration tasks()
Get an enumeration of the tasks in the model.

Returns:
instance of java.util.Enumeration
See Also:
D2WModel.taskVector()

dynamicPages

protected Vector dynamicPages()
Gets a list of all the dynamic pages found in the model.

The current implementation caches the values.

The implementation is subject to change in future releases.

Returns:
instance of java.util.Vector
See Also:
D2WModel.invalidateCaches()

removeWebAssistantRulesWithSameContextAsSettings

protected void removeWebAssistantRulesWithSameContextAsSettings(com.apple.client.directtoweb.common.Settings settings)
Removes the Web Assistant rules that have the same context as the specified settings. Dirties the model if a non-look rule is removed; un-dirties otherwise.

Parameters:
settings - instance of Settings
See Also:
D2WModel.rules(), D2WModel.setRules(NSArray), D2WModel.setDirty(boolean), D2WModel.removeAllWebAssistantRules()

removeDynamicPage

protected void removeDynamicPage(ServerSideSettings settings)
Removes the Web Assistant rules with the same context as the specified settings if the specified settings are for a dynamic page.

Parameters:
settings - instance of ServerSideSettings
See Also:
D2WModel.removeWebAssistantRulesWithSameContextAsSettings(Settings), Settings.forADynamicPage()

newSettings

protected void newSettings(ServerSideSettings settings)
Updates the model with the specified settings.

The current implementation sets the current rules and creates Web Assistant rules depending on the settings.

The implementation is subject to change in future releases.

Parameters:
settings - instance of ServerSideSettings
See Also:
D2WModel.rules(), D2WModel.setRules(NSArray), D2WModel.createWebAssistantRulesWithSettings(ServerSideSettings)

createWebAssistantRulesWithSettings

protected void createWebAssistantRulesWithSettings(ServerSideSettings settings)
Creates Web Assistant rules with the specified settings.

Parameters:
settings - instance of ServerSideSettings
See Also:
D2WModel.pageRuleKeysForPage(String), D2WModel.propertyRuleKeysForComponents(Vector), D2WModel.propertyRuleKeysFromClientConfiguration(), D2WModel.pageRuleKeysFromClientConfiguration()

typeForRuleKey

public final String typeForRuleKey(String key)
Gets the type for the specified rule key.

Parameters:
key - the key
Returns:
instance of String that represents the type for the rule key

isPageStatic

public boolean isPageStatic(String pageName,
                            D2WContext aContext)
Indicates whether the page with the specified name is static in the specified context.

The current implementation checks the client configuration; an entry implies the page is dynamic. Then checks pageAvailable rules, which refer to non-static pages. Finally checks whether the page is in the application wrapper which implies the page is static.

The implementation is subject to change in future releases.

Parameters:
pageName - the name of the page
aContext - instance of D2WContext
Returns:
true if the page is static; false otherwise.
Throws:
NullPointerException - if the client configuration information for components cannot be found
See Also:
D2WModel.candidates(String, D2WContext)

encodeWithKeyValueArchiver

public void encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
Description copied from interface: EOKeyValueArchiving
Asks the receiver to archive its state into the EOKeyValueArchiver archiver.

Specified by:
encodeWithKeyValueArchiver in interface EOKeyValueArchiving
Parameters:
archiver - the EOKeyValueArchiver
See Also:
EOKeyValueArchiver

Last updated June 2008

Copyright © 2000-2008 Apple Inc.