com.xenonsoft.bridgetown.soa.impl
Class ContextCacheImpl

java.lang.Object
  extended bycom.xenonsoft.bridgetown.soa.impl.ContextCacheImpl
All Implemented Interfaces:
IContextCache, java.io.Serializable

public class ContextCacheImpl
extends java.lang.Object
implements IContextCache, java.io.Serializable

A cache that stores service bean instances by name and context configuration.

Version:
$Id: ContextCacheImpl.java,v 1.6 2005/03/17 02:37:22 peter_pilgrim Exp $
Author:
Peter Pilgrim, Aug 26, 2004 11:11:31 PM
See Also:
Serialized Form

Field Summary
protected  java.util.Map cacheMap
          the cache map
protected  ContextConfig contextConfig
          the context configuration
 
Constructor Summary
ContextCacheImpl(ContextConfig context)
          Standard constructor
 
Method Summary
 void clear()
          Clears the contents of the cache
 boolean contains(java.lang.String serviceId)
          Returns a boolean if the service bean id is stored in the cache
 java.lang.Object getBean(java.lang.String serviceId)
          Retrieves the service bean from the cache object by its name
 ContextConfig getContextConfig()
          Gets the contextConfig
 java.lang.String[] getServiceBeanNames()
          Retrieves a primitive array of service beans managed inside the cache by name
 void putBean(java.lang.String serviceId, java.lang.Object bean)
          Store the service bean in the cache by its name
 java.lang.Object removeBean(java.lang.String serviceId)
          Removes the service bean from the cache object by its name
protected  void setContextConfig(ContextConfig contextConfig)
          Sets the contextConfig
 int size()
          Returns the current size of the cache
 java.lang.String toString()
          Human debuggable output Implements / overrides toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

contextConfig

protected ContextConfig contextConfig
the context configuration


cacheMap

protected java.util.Map cacheMap
the cache map

Constructor Detail

ContextCacheImpl

public ContextCacheImpl(ContextConfig context)
Standard constructor

Parameters:
context - the context configuration
Method Detail

getContextConfig

public ContextConfig getContextConfig()
Gets the contextConfig

Specified by:
getContextConfig in interface IContextCache
Returns:
Returns the contextConfig.

setContextConfig

protected void setContextConfig(ContextConfig contextConfig)
Sets the contextConfig

Parameters:
contextConfig - the new value for contextConfig

clear

public void clear()
Clears the contents of the cache

Specified by:
clear in interface IContextCache

size

public int size()
Returns the current size of the cache

Specified by:
size in interface IContextCache
Returns:
the size

contains

public boolean contains(java.lang.String serviceId)
Returns a boolean if the service bean id is stored in the cache

Specified by:
contains in interface IContextCache
Parameters:
serviceId - the service bean name
Returns:
true if the bean is returned

getBean

public java.lang.Object getBean(java.lang.String serviceId)
Retrieves the service bean from the cache object by its name

Specified by:
getBean in interface IContextCache
Parameters:
serviceId - the service bean name
Returns:
the service bean or null

putBean

public void putBean(java.lang.String serviceId,
                    java.lang.Object bean)
Store the service bean in the cache by its name

Specified by:
putBean in interface IContextCache
Parameters:
serviceId - the service bean name
bean - the service bean

removeBean

public java.lang.Object removeBean(java.lang.String serviceId)
Removes the service bean from the cache object by its name

Specified by:
removeBean in interface IContextCache
Parameters:
serviceId - the service bean name
Returns:
the service bean that has been removed or null

getServiceBeanNames

public java.lang.String[] getServiceBeanNames()
Retrieves a primitive array of service beans managed inside the cache by name

Specified by:
getServiceBeanNames in interface IContextCache
Returns:
the array of service bean names

toString

public java.lang.String toString()
Human debuggable output Implements / overrides toString

Returns:
the debuggable string
See Also:
Object.toString()


Copyright © 2005 XeNoNSoFT.com. All Rights Reserved.