SAP NetWeaver '04

com.sapportals.wcm.rendering.base
Class ResourcePropertyAmalgamation

[contained in: com.sap.km.cm.ui.flex.par - km.shared.ui.flex.base_api.jar]
java.lang.Object
  |
  +--com.sapportals.wcm.rendering.base.ResourcePropertyAmalgamation

public final class ResourcePropertyAmalgamation
extends java.lang.Object

acts as a layer between the repository framework and its caching mechanism for access by many Threads and the different rendering classes involved in the rendering of a single iView. This class must not be persisted via HttpRequests but rather be refilled for every request-cycle. It is only intended to speed up parallel calls to the repository framework by centralizing all calls for IPropertys of an IResource by first checking, if this property has already been retrieved from the RF and - if so - returning it instead of passing the call again to the RF. It also checks if an earlier call to the RF has been unsuccessful. If so, it will simply return null and not try again to retrieve this property. This mechanism must only be used for the display of information. Any decision to edit the underlying IResource must only be made using the original properties retrieved by the IResource's method getProperties or the like.

Since:
EP5, SP6 or EP6, SP1

Inner Class Summary
static class ResourcePropertyAmalgamation.Mode
           
 class ResourcePropertyAmalgamation.UnavailableEntries
          wraps a map to allow simpler access to an IResource as the key to a map entry and the Set of IPropertyName elements as value of the entry.
 
Field Summary
static ResourcePropertyAmalgamation.Mode ADD
           
static ResourcePropertyAmalgamation.Mode UPDATE
           
 
Constructor Summary
ResourcePropertyAmalgamation()
           
 
Method Summary
 void add(IResource resource, IPropertyMap map, ResourcePropertyAmalgamation.Mode mode)
          adds the given IPropertyMap to the map of available properties for the given IResource.
 void add(IResource resource, IProperty prop, ResourcePropertyAmalgamation.Mode mode)
          adds the given IProperty to the map of available properties for the given IResource.
 boolean declareUnavailable(IResource resource, IPropertyName name)
          marks the given property name as unavailable from the framework so that no calls to the framework will be made to retrieve it.
 IPropertyNameList declareUnavailable(IResource resource, IPropertyNameList list)
          marks the given property names as unavailable from the framework so that no calls to the framework will be made to retrieve them.
 IPropertyMap getProperties(IResource resource)
          returns all properties available from the framework.
 IPropertyMap getProperties(IResource resource, IPropertyNameList list)
          returns the properties defined for the given resource which are accessed through the given list.
 IProperty getProperty(IResource resource, IPropertyName name)
          returns the property defined for the given resource that is accessed through the given name.
 void readProperties(IResourceList resources, IPropertyNameList names)
           
 void remove(IResource resource)
          removes the resource and all its properties retrieved from the internal data structures from this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADD

public static final ResourcePropertyAmalgamation.Mode ADD

UPDATE

public static final ResourcePropertyAmalgamation.Mode UPDATE
Constructor Detail

ResourcePropertyAmalgamation

public ResourcePropertyAmalgamation()
Method Detail

add

public void add(IResource resource,
                IProperty prop,
                ResourcePropertyAmalgamation.Mode mode)
adds the given IProperty to the map of available properties for the given IResource. If the mode is ADD, the property will only be added, if no property with this key already exists for this resource in this class. If the mode is UPDATE, an eventually already existing value will be replaced with the given property. A NullPointerException is thrown, if one of the parameters is null
Parameters:
resource - Description of the Parameter
prop - Description of the Parameter
mode - Description of the Parameter

readProperties

public void readProperties(IResourceList resources,
                           IPropertyNameList names)

add

public void add(IResource resource,
                IPropertyMap map,
                ResourcePropertyAmalgamation.Mode mode)
adds the given IPropertyMap to the map of available properties for the given IResource. If the mode is ADD, the properties of the given map will only be added, if no property with this key already exist for this resource in this class. If the mode is UPDATE, an eventually already existing value will be replaced with the property in the given map. A NullPointerException is thrown, if one of the parameters is null .
Parameters:
resource - Description of the Parameter
map - Description of the Parameter
mode - Description of the Parameter

getProperties

public IPropertyMap getProperties(IResource resource)
returns all properties available from the framework. If additional properties have been defined for the resource by the add method, these properties will be returned as well. If an exception occurs when trying to load the properties from the framework, it will be shown in the logging as a warning. An empty IPropertyMap will be returned. Additional calls of this method will not be routed to the framework.
Parameters:
resource - Description of the Parameter
Returns:
The properties value

getProperty

public IProperty getProperty(IResource resource,
                             IPropertyName name)
returns the property defined for the given resource that is accessed through the given name. If the name is not in the internal map of properties for this resource (or if no map exists up to this point), a call to the RepositoryFramework is done. If this call fails to retrieve the property, this information will be logged (as a debug or a warning, depending if an exception was thrown by the RepositoryFramework), null will be returned. At the same time, this resource/name tuple will be marked as an unavailable property. If the same combination is requested at a later time, no call to the framework is done. If one of the parameters is null, a NullPointerException will be thrown
Parameters:
resource - Description of the Parameter
name - Description of the Parameter
Returns:
the valid property or null

getProperties

public IPropertyMap getProperties(IResource resource,
                                  IPropertyNameList list)
returns the properties defined for the given resource which are accessed through the given list. All properties not yet retrieved from the RepositoryFramework will be retrieved here, unless they are marked as an unavailable tuple. If one of the parameters is null, a NullPointerException will be thrown
Parameters:
resource - Description of the Parameter
list - Description of the Parameter
Returns:
The properties value

remove

public void remove(IResource resource)
removes the resource and all its properties retrieved from the internal data structures from this class.
Parameters:
resource - Description of the Parameter

declareUnavailable

public IPropertyNameList declareUnavailable(IResource resource,
                                            IPropertyNameList list)
marks the given property names as unavailable from the framework so that no calls to the framework will be made to retrieve them. If a property has already been set by another class that uses this amalgamation, this property's name will be included in the returned property name list. Both given parameters must not be null, or a NullPointerException is thrown
Parameters:
resource - the resource for which the properties are to be declared unavailable
list - the properties that are to be declared unavailable
Returns:
the list of properties that are already available for this resource and were to be declared unavailable. Might be an empty list, but never null.

declareUnavailable

public boolean declareUnavailable(IResource resource,
                                  IPropertyName name)
marks the given property name as unavailable from the framework so that no calls to the framework will be made to retrieve it. If the property has already been set by another class that uses this amalgamation, the method will return false. Both given parameters must not be null, or a NullPointerException is thrown
Parameters:
resource - the resource for which the property is to be declared unavailable
name - the property that is to be declared unavailable
Returns:
flag stating if the property was declared unavailable or not.

SAP NetWeaver '04

Copyright © 2004 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.