com.sage.swt.client.ui.builder
Class GlobalCache

java.lang.Object
  extended by com.sage.swt.client.ui.builder.GlobalCache
All Implemented Interfaces:
ExternalConnectionDefinitionCache, ExternalDataDefinitionCache, ExternalScriptCache, ExternalStyleCache, TypeSchemaCache, UIDefinitionCache

public class GlobalCache
extends java.lang.Object
implements UIDefinitionCache, ExternalScriptCache, ExternalStyleCache, ExternalDataDefinitionCache, ExternalConnectionDefinitionCache

Global cache that stores downloaded and processed items for a SWT UI, so that we only need to download and process those items ones.

To hide irrelevant information, the global cache exposes itself to the various builders under different cache interfaces including UIDefinitionCache, ExternalScriptCache, ExternalStyleCache, and ExternalDataDefinitionCache (which itself can be exposed as TypeSchemaCache).


Constructor Summary
GlobalCache()
          Constructs an empty global cache.
 
Method Summary
 void addExternalConDefinition(URLKey conDefURLKey, ConnectionsDefinition externalConDefinition)
          Adds an external connections definition and its associated URL key to the cache.
 void addExternalDSDefinition(URLKey dsDefURLKey, DataSourcesDefinition externalDSDefinition)
          Adds an external datasources definition and its associated URL key to the cache.
 void addExternalScript(URLKey scriptURLKey, java.lang.String scriptContent)
          Adds an external script's content and its associated URL key to the cache.
 void addExternalStyle(URLKey styleURLKey, java.lang.String styleContent)
          Adds an external style's content and its associated URL key to the cache.
 void addTypeSchema(URLKey typeSchemaURLKey, TypeSchemaInfo typeSchema)
          Adds a type schema and its associated URL key to the cache.
 void addUIDefinition(URLKey uiDefURLKey, DefaultUIDefinition uiDefinition)
          Adds a UI definition and its associated URL key to the cache.
 boolean containsExternalConDefinition(URLKey conDefURLKey)
          Indicates whether or not the cache contains an external connections definition with the specified URL key.
 boolean containsExternalDSDefinition(URLKey dsDefURLKey)
          Indicates whether or not the cache contains an external datasources definition with the specified URL key.
 boolean containsExternalScript(URLKey scriptURLKey)
          Indicates whether or not the cache contains an external script with the specified URL key.
 boolean containsExternalStyle(URLKey styleURLKey)
          Indicates whether or not the cache contains an external style with the specified URL key.
 boolean containsTypeSchema(URLKey typeSchemaURLKey)
          Indicates whether or not the cache contains a type schema with the specified URL key.
 boolean containsUIDefintion(URLKey uiDefURLKey)
          Indicates whether or not the cache contains a UI definition with the specified URL key.
 ConnectionsDefinition getExternalConDefinition(URLKey conDefURLKey)
          Gets the external connections definition associated with the specified URL key, or null if there is no such entry in the cache.
 DataSourcesDefinition getExternalDSDefinition(URLKey dsDefURLKey)
          Gets the external datasources definition associated with the specified URL key, or null if there is no such entry in the cache.
 java.lang.String getExternalScript(URLKey scriptURLKey)
          Gets the external script content associated with the specified URL key, or null if there is no such entry in the cache.
 java.lang.String getExternalStyle(URLKey styleURLKey)
          Gets the external style content associated with the specified URL key, or null if there is no such entry in the cache.
 TypeSchemaInfo getTypeSchema(URLKey typeSchemaURLKey)
          Gets the type schema associated with the specified URL key, or null if there is no such entry in the cache.
 DefaultUIDefinition getUIDefinition(URLKey uiDefURLKey)
          Gets the UI definition associated with the specified URL key, or null if there is no such entry in the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlobalCache

public GlobalCache()
Constructs an empty global cache.

Method Detail

containsUIDefintion

public boolean containsUIDefintion(URLKey uiDefURLKey)
Indicates whether or not the cache contains a UI definition with the specified URL key.

Specified by:
containsUIDefintion in interface UIDefinitionCache
Parameters:
uiDefURLKey - The UI definition's URL key (which is created using the contract path and declarative definition name).
Returns:
Whether or not the cache contains a UI definition with the specified URL key.

getUIDefinition

public DefaultUIDefinition getUIDefinition(URLKey uiDefURLKey)
Gets the UI definition associated with the specified URL key, or null if there is no such entry in the cache.

Specified by:
getUIDefinition in interface UIDefinitionCache
Parameters:
uiDefURLKey - The UI definition's URL key (which is created using the contract path and declarative definition name).
Returns:
The UI definition associated with the specified URL key, or null if there is no such entry in the cache.

addUIDefinition

public void addUIDefinition(URLKey uiDefURLKey,
                            DefaultUIDefinition uiDefinition)
Adds a UI definition and its associated URL key to the cache. Duplicates and nulls are ignored.

Specified by:
addUIDefinition in interface UIDefinitionCache
Parameters:
uiDefURLKey - The UI definition's URL key (which is created using the contract path and declarative definition name).
uiDefinition - The built UI definition.

containsExternalScript

public boolean containsExternalScript(URLKey scriptURLKey)
Indicates whether or not the cache contains an external script with the specified URL key.

Specified by:
containsExternalScript in interface ExternalScriptCache
Parameters:
scriptURLKey - The external script's URL key.
Returns:
Whether or not the cache contains an external script with the specified URL key.

getExternalScript

public java.lang.String getExternalScript(URLKey scriptURLKey)
Gets the external script content associated with the specified URL key, or null if there is no such entry in the cache.

Specified by:
getExternalScript in interface ExternalScriptCache
Parameters:
scriptURLKey - The external script's URL key.
Returns:
The external script content associated with the specified URL key, or null if there is no such entry in the cache.

addExternalScript

public void addExternalScript(URLKey scriptURLKey,
                              java.lang.String scriptContent)
Adds an external script's content and its associated URL key to the cache. Duplicates and nulls are ignored (however, empty strings are not).

Specified by:
addExternalScript in interface ExternalScriptCache
Parameters:
scriptURLKey - The external script's URL key.
scriptContent - The external script's content.

containsExternalStyle

public boolean containsExternalStyle(URLKey styleURLKey)
Indicates whether or not the cache contains an external style with the specified URL key.

Specified by:
containsExternalStyle in interface ExternalStyleCache
Parameters:
styleURLKey - The external style's URL key.
Returns:
Whether or not the cache contains an external style with the specified URL key.

getExternalStyle

public java.lang.String getExternalStyle(URLKey styleURLKey)
Gets the external style content associated with the specified URL key, or null if there is no such entry in the cache.

Specified by:
getExternalStyle in interface ExternalStyleCache
Parameters:
styleURLKey - The external style's URL key.
Returns:
The external style content associated with the specified URL key, or null if there is no such entry in the cache.

addExternalStyle

public void addExternalStyle(URLKey styleURLKey,
                             java.lang.String styleContent)
Adds an external style's content and its associated URL key to the cache. Duplicates and nulls are ignored (however, empty strings are not).

Specified by:
addExternalStyle in interface ExternalStyleCache
Parameters:
styleURLKey - The external style's URL key.
styleContent - The external style's content.

containsExternalDSDefinition

public boolean containsExternalDSDefinition(URLKey dsDefURLKey)
Indicates whether or not the cache contains an external datasources definition with the specified URL key.

Specified by:
containsExternalDSDefinition in interface ExternalDataDefinitionCache
Parameters:
dsDefURLKey - The external datasources definition's URL key.
Returns:
Whether or not the cache contains an external datasources definition with the specified URL key.

getExternalDSDefinition

public DataSourcesDefinition getExternalDSDefinition(URLKey dsDefURLKey)
Gets the external datasources definition associated with the specified URL key, or null if there is no such entry in the cache.

Specified by:
getExternalDSDefinition in interface ExternalDataDefinitionCache
Parameters:
dsDefURLKey - The external datasources definition's URL key.
Returns:
The external datasources definition associated with the specified URL key, or null if there is no such entry in the cache.

addExternalDSDefinition

public void addExternalDSDefinition(URLKey dsDefURLKey,
                                    DataSourcesDefinition externalDSDefinition)
Adds an external datasources definition and its associated URL key to the cache. Duplicates and nulls are ignored.

Specified by:
addExternalDSDefinition in interface ExternalDataDefinitionCache
Parameters:
dsDefURLKey - The external datasources definition's URL key.
externalDSDefinition - The built external datasources definition.

containsTypeSchema

public boolean containsTypeSchema(URLKey typeSchemaURLKey)
Indicates whether or not the cache contains a type schema with the specified URL key.

Specified by:
containsTypeSchema in interface TypeSchemaCache
Parameters:
typeSchemaURLKey - The type schema's URL key.
Returns:
Whether or not the cache contains a type schema with the specified URL key.

getTypeSchema

public TypeSchemaInfo getTypeSchema(URLKey typeSchemaURLKey)
Gets the type schema associated with the specified URL key, or null if there is no such entry in the cache.

Specified by:
getTypeSchema in interface TypeSchemaCache
Parameters:
typeSchemaURLKey - The type schema's URL key.
Returns:
The type schema associated with the specified URL key, or null if there is no such entry in the cache.

addTypeSchema

public void addTypeSchema(URLKey typeSchemaURLKey,
                          TypeSchemaInfo typeSchema)
Adds a type schema and its associated URL key to the cache. Duplicates and nulls are ignored.

Specified by:
addTypeSchema in interface TypeSchemaCache
Parameters:
typeSchemaURLKey - The type schema's URL key.
typeSchema - The built type schema.

addExternalConDefinition

public void addExternalConDefinition(URLKey conDefURLKey,
                                     ConnectionsDefinition externalConDefinition)
Description copied from interface: ExternalConnectionDefinitionCache
Adds an external connections definition and its associated URL key to the cache. Duplicates and nulls are ignored.

Specified by:
addExternalConDefinition in interface ExternalConnectionDefinitionCache
Parameters:
conDefURLKey - The external connections definition's URL key.
externalConDefinition - The built external connections definition.

containsExternalConDefinition

public boolean containsExternalConDefinition(URLKey conDefURLKey)
Description copied from interface: ExternalConnectionDefinitionCache
Indicates whether or not the cache contains an external connections definition with the specified URL key.

Specified by:
containsExternalConDefinition in interface ExternalConnectionDefinitionCache
Parameters:
conDefURLKey - The external connections definition's URL key.
Returns:
Whether or not the cache contains an external connections definition with the specified URL key.

getExternalConDefinition

public ConnectionsDefinition getExternalConDefinition(URLKey conDefURLKey)
Description copied from interface: ExternalConnectionDefinitionCache
Gets the external connections definition associated with the specified URL key, or null if there is no such entry in the cache.

Specified by:
getExternalConDefinition in interface ExternalConnectionDefinitionCache
Parameters:
conDefURLKey - The external connections definition's URL key.
Returns:
The external connections definition associated with the specified URL key, or null if there is no such entry in the cache.


Copyright © 2011 Sage Software, Inc. All rights reserved.