Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mobicents.slee.container.profile
Class SleeProfileManager  view SleeProfileManager download SleeProfileManager.java

java.lang.Object
  extended byorg.mobicents.slee.container.profile.SleeProfileManager

public class SleeProfileManager
extends java.lang.Object

This class is used by the SLEE to manage Profiles. It calls out to the jboss-cache that put everything into the backend storage


Nested Class Summary
private  class SleeProfileManager.ProfileCacheManager
           
private  class SleeProfileManager.ProfilePrepareAction
           
 
Field Summary
 java.lang.String DEFAULT_PROFILE_LOOKUP_PREFIX
          prefix for default profile names in a back-end storage
static java.lang.String INDEX_LOOKUP_PREFIX
          prefix for profile index names in a back-end storage
static java.lang.String JNDI_NAME
           
private static org.apache.log4j.Logger logger
           
private  javax.management.MBeanServer mbeanServer
           
private static java.lang.String PROFILE_INDEXES_SPEC_SUFFIX
           
private static java.lang.String PROFILE_TABLE_NAMES
           
private  SleeProfileManager.ProfileCacheManager profileCacheManager
           
private static java.lang.String PROFILEID_LOOKUP_NAME
           
static java.lang.String PROFILEID_LOOKUP_PREFIX
          prefix for profile names in a back-end storage
private  java.util.HashMap profileTableActivities
           
private static SleeProfileManager sleeProfileManager
           
private static java.lang.String tcache
           
 
Constructor Summary
private SleeProfileManager(javax.management.MBeanServer mbeanServer)
          Constructor
 
Method Summary
 void addProfileTable(java.lang.String profileTableName, ProfileSpecificationDescriptor profileSpecificationDescriptor)
          Adds a profile table for a specific ProfileSpecification It also creates the default profile and initializes it
 javax.management.ObjectName addProfileToProfileTable(java.lang.String profileTableName, java.lang.String newProfileName)
          Just creates a Profile MBean object, which has references to the information needed to create the actual profile.
 org.mobicents.slee.runtime.facilities.ProfileTableActivityImpl createProfileTableActivity(java.lang.String profileTableName)
          TODO -- put this in the transactional cache.
protected  void displayAllProfilePersistentInformation()
          Helper method to display all information related to profiles stored in the backend storage
 java.util.Collection findAllProfilesByTableName(java.lang.String profileTableName)
          Retrieve all profiles, except the default profile, stored under a profile table whose the name is given in parameter
 java.util.Collection findAllProfileTables()
          Retrieve a collection of ProfileSpecificationID of all the profile tables stored into the slee
 java.lang.Object findCommittedProfile(java.lang.String profileTableName, java.lang.String profileName)
          Retrieve from the backend store the wrapper profile object by table name and profile name
 java.lang.Object findDefaultProfile(java.lang.String profileTableName)
          Retrieve the wrapper object (from the back end storage) for the default profile by table name
 javax.management.ObjectName findProfileMBean(java.lang.String profileTableName, java.lang.String profileName)
          Lookup the profile MBean Object name.
 ProfileSpecificationID findProfileSpecId(java.lang.String profileTableName)
          Retrieve the profileSpecificationID of the profle Table whose the name is given in parameters
private  java.lang.String generateDefaultProfileKey(java.lang.String profileTableName)
          Generates the default profile key under which the profile is gonna be stored into the jboss cache
private  java.lang.String generateIndexKey(java.lang.String profileTableName, java.lang.String attributeName)
          Generates the index key under which the index is gonna be stored into the jboss cache
private  java.lang.String generateIndexKeyRoot(java.lang.String profileTableName)
          Generate the key under which all indices of the profile are stored.
private  java.lang.String generateProfileKey(java.lang.String profileTableName, java.lang.String profileName)
          Generates the profile key under which the profile is gonna be stored into the jboss cache
private  java.lang.String generateProfileTableKey(java.lang.String profileTableName)
          Generates the profile table key under which the profile is gonna be stored into the jboss cache
protected  void getAllProfiles()
           
static SleeProfileManager getInstance()
          Using Singleton pattern
 java.lang.Object getProfileAttributeValue(java.lang.String profileKey, java.lang.String profileAttributeName)
           
 java.util.Map getProfileIndexesSpec(java.lang.String profileTableName)
          Returns the profile indexes spec as provided by the profile specification at deployment time.
 java.util.Collection getProfilesByIndexedAttribute(java.lang.String profileTableName, java.lang.String attributeName, java.lang.Object attributeValue, boolean stopAtFirstMatch)
           
 java.util.HashMap getProfileTableActivities()
           
 ProfileTableActivityContextInterfaceFactory getProfileTableActivityContextInterfaceFactory()
           
private  java.lang.String getRootFqn()
           
 java.lang.Object getSbbCMPProfile(ProfileID profileID)
           
 org.mobicents.slee.container.SleeContainer getServiceContainer()
           
 org.mobicents.slee.runtime.transaction.SleeTransactionManager getTransactionManager()
           
private  void initializeProfiles()
          FIXME: This method has to be reworked once the cache is actually loaded from disk on startup.
 ProfileManagement instantiateLastCommittedProfile(java.lang.String profileTableName, java.lang.String profileName)
           
protected  javax.management.ObjectName instantiateProfile(java.lang.String cmpInterfaceName, java.lang.String profileTableName, java.lang.String profileName, boolean loadDataFromBackendStorage)
          Instantiates a new profile and its profileMbean and regsiter the latter with the mbean server
 boolean isProfileCommitted(java.lang.String profileTableName, java.lang.String profileName)
          Checks whether a profile has been committed, given its table name and profile name
 java.lang.Object lookupProfileByKey(java.lang.String key)
          Retrieve the wrapper object for a profile from the backend storage
 boolean profileExist(ProfileID profileID)
           
 boolean profileTableExists(java.lang.String profileTableName)
           
 void removeAllIndexedAttributesOfProfile(java.lang.String profileTableName, java.lang.String profileName)
          It removes all the indexed attribute of a profile
This method should be called within the context of a transaction
 void removeProfile(java.lang.String profileTableName, java.lang.String profileName)
          Remove a profile from a profile Table
 void removeProfileAfterTableActivityEnd(java.lang.String profileTableName)
          This is invoked after the activity end event is processed.
 void removeProfileTable(java.lang.String profileTableName)
          Removes a profile Table, its default profile, indexes and all other associated profiles
 void renameProfileTable(java.lang.String oldProfileTableName, java.lang.String newProfileTableName, ProfileSpecificationDescriptor profileSpecificationDescriptor)
           
static java.lang.String replace(java.lang.String str, java.lang.String strToReplace, java.lang.String newStr)
           
 void setProfileAttributeValue(java.lang.String profileKey, java.lang.String profileAttributeName, java.lang.Object profileAttributeValue)
           
static java.lang.String toValidJmxName(java.lang.String jmxName)
           
 void unregisterProfileMBean(java.lang.String profileKey)
           
private  void verifyProfileIndex(java.lang.String profileKey, java.lang.String profileAttributeName, java.lang.Object profileAttributeValue, org.mobicents.slee.runtime.transaction.SleeTransactionManager transactionManager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROFILE_INDEXES_SPEC_SUFFIX

private static final java.lang.String PROFILE_INDEXES_SPEC_SUFFIX
See Also:
Constant Field Values

PROFILEID_LOOKUP_NAME

private static final java.lang.String PROFILEID_LOOKUP_NAME
See Also:
Constant Field Values

JNDI_NAME

public static final java.lang.String JNDI_NAME
See Also:
Constant Field Values

PROFILEID_LOOKUP_PREFIX

public static final java.lang.String PROFILEID_LOOKUP_PREFIX
prefix for profile names in a back-end storage

See Also:
Constant Field Values

DEFAULT_PROFILE_LOOKUP_PREFIX

public final java.lang.String DEFAULT_PROFILE_LOOKUP_PREFIX
prefix for default profile names in a back-end storage

See Also:
Constant Field Values

INDEX_LOOKUP_PREFIX

public static final java.lang.String INDEX_LOOKUP_PREFIX
prefix for profile index names in a back-end storage

See Also:
Constant Field Values

sleeProfileManager

private static SleeProfileManager sleeProfileManager

mbeanServer

private javax.management.MBeanServer mbeanServer

logger

private static org.apache.log4j.Logger logger

profileTableActivities

private java.util.HashMap profileTableActivities

tcache

private static java.lang.String tcache

PROFILE_TABLE_NAMES

private static final java.lang.String PROFILE_TABLE_NAMES
See Also:
Constant Field Values

profileCacheManager

private SleeProfileManager.ProfileCacheManager profileCacheManager
Constructor Detail

SleeProfileManager

private SleeProfileManager(javax.management.MBeanServer mbeanServer)
Constructor

Method Detail

getRootFqn

private java.lang.String getRootFqn()

getInstance

public static SleeProfileManager getInstance()
Using Singleton pattern


getAllProfiles

protected void getAllProfiles()
                       throws javax.transaction.SystemException

initializeProfiles

private void initializeProfiles()
FIXME: This method has to be reworked once the cache is actually loaded from disk on startup. This method browses all the profiles existing in the backend storage through Jboss cache and instantiates and register with the mbean server each one of them


instantiateProfile

protected javax.management.ObjectName instantiateProfile(java.lang.String cmpInterfaceName,
                                                         java.lang.String profileTableName,
                                                         java.lang.String profileName,
                                                         boolean loadDataFromBackendStorage)
                                                  throws java.lang.Exception
Instantiates a new profile and its profileMbean and regsiter the latter with the mbean server


addProfileTable

public void addProfileTable(java.lang.String profileTableName,
                            ProfileSpecificationDescriptor profileSpecificationDescriptor)
                     throws java.lang.Exception
Adds a profile table for a specific ProfileSpecification It also creates the default profile and initializes it


removeProfileTable

public void removeProfileTable(java.lang.String profileTableName)
                        throws TransactionRequiredLocalException,
                               javax.transaction.SystemException,
                               UnrecognizedProfileTableNameException
Removes a profile Table, its default profile, indexes and all other associated profiles


addProfileToProfileTable

public javax.management.ObjectName addProfileToProfileTable(java.lang.String profileTableName,
                                                            java.lang.String newProfileName)
                                                     throws javax.transaction.SystemException,
                                                            SingleProfileException
Just creates a Profile MBean object, which has references to the information needed to create the actual profile. Nothing else is done to create the profile until the commitProfile() operation is called on the MBean. If something goes wrong, the profile MBean is not created and exception is thrown.


instantiateLastCommittedProfile

public ProfileManagement instantiateLastCommittedProfile(java.lang.String profileTableName,
                                                         java.lang.String profileName)
                                                  throws java.lang.Exception

removeProfile

public void removeProfile(java.lang.String profileTableName,
                          java.lang.String profileName)
                   throws javax.transaction.SystemException
Remove a profile from a profile Table


removeAllIndexedAttributesOfProfile

public void removeAllIndexedAttributesOfProfile(java.lang.String profileTableName,
                                                java.lang.String profileName)
                                         throws javax.transaction.SystemException
It removes all the indexed attribute of a profile
This method should be called within the context of a transaction


generateProfileTableKey

private java.lang.String generateProfileTableKey(java.lang.String profileTableName)
Generates the profile table key under which the profile is gonna be stored into the jboss cache


generateDefaultProfileKey

private java.lang.String generateDefaultProfileKey(java.lang.String profileTableName)
Generates the default profile key under which the profile is gonna be stored into the jboss cache


generateProfileKey

private java.lang.String generateProfileKey(java.lang.String profileTableName,
                                            java.lang.String profileName)
Generates the profile key under which the profile is gonna be stored into the jboss cache


generateIndexKeyRoot

private java.lang.String generateIndexKeyRoot(java.lang.String profileTableName)
Generate the key under which all indices of the profile are stored.


generateIndexKey

private java.lang.String generateIndexKey(java.lang.String profileTableName,
                                          java.lang.String attributeName)
Generates the index key under which the index is gonna be stored into the jboss cache


findProfileSpecId

public ProfileSpecificationID findProfileSpecId(java.lang.String profileTableName)
                                         throws javax.transaction.SystemException
Retrieve the profileSpecificationID of the profle Table whose the name is given in parameters


findAllProfileTables

public java.util.Collection findAllProfileTables()
Retrieve a collection of ProfileSpecificationID of all the profile tables stored into the slee


findProfileMBean

public javax.management.ObjectName findProfileMBean(java.lang.String profileTableName,
                                                    java.lang.String profileName)
Lookup the profile MBean Object name. It could be a non-committed profile view.


findCommittedProfile

public java.lang.Object findCommittedProfile(java.lang.String profileTableName,
                                             java.lang.String profileName)
                                      throws javax.transaction.SystemException
Retrieve from the backend store the wrapper profile object by table name and profile name


lookupProfileByKey

public java.lang.Object lookupProfileByKey(java.lang.String key)
                                    throws javax.transaction.SystemException
Retrieve the wrapper object for a profile from the backend storage


isProfileCommitted

public boolean isProfileCommitted(java.lang.String profileTableName,
                                  java.lang.String profileName)
                           throws javax.transaction.SystemException
Checks whether a profile has been committed, given its table name and profile name


findAllProfilesByTableName

public java.util.Collection findAllProfilesByTableName(java.lang.String profileTableName)
Retrieve all profiles, except the default profile, stored under a profile table whose the name is given in parameter


displayAllProfilePersistentInformation

protected void displayAllProfilePersistentInformation()
Helper method to display all information related to profiles stored in the backend storage


getProfilesByIndexedAttribute

public java.util.Collection getProfilesByIndexedAttribute(java.lang.String profileTableName,
                                                          java.lang.String attributeName,
                                                          java.lang.Object attributeValue,
                                                          boolean stopAtFirstMatch)
                                                   throws UnrecognizedAttributeException,
                                                          AttributeNotIndexedException,
                                                          AttributeTypeMismatchException,
                                                          javax.transaction.SystemException

getSbbCMPProfile

public java.lang.Object getSbbCMPProfile(ProfileID profileID)
                                  throws javax.transaction.SystemException

setProfileAttributeValue

public void setProfileAttributeValue(java.lang.String profileKey,
                                     java.lang.String profileAttributeName,
                                     java.lang.Object profileAttributeValue)
                              throws TransactionRequiredLocalException,
                                     javax.transaction.SystemException,
                                     ProfileVerificationException

verifyProfileIndex

private void verifyProfileIndex(java.lang.String profileKey,
                                java.lang.String profileAttributeName,
                                java.lang.Object profileAttributeValue,
                                org.mobicents.slee.runtime.transaction.SleeTransactionManager transactionManager)
                         throws javax.transaction.SystemException,
                                ProfileVerificationException

getProfileAttributeValue

public java.lang.Object getProfileAttributeValue(java.lang.String profileKey,
                                                 java.lang.String profileAttributeName)
                                          throws javax.transaction.SystemException

getProfileIndexesSpec

public java.util.Map getProfileIndexesSpec(java.lang.String profileTableName)
                                    throws javax.transaction.SystemException
Returns the profile indexes spec as provided by the profile specification at deployment time. This is static information that is available at a meta level and applies to all tables with the same profile spec.


profileExist

public boolean profileExist(ProfileID profileID)
                     throws javax.transaction.SystemException

getTransactionManager

public org.mobicents.slee.runtime.transaction.SleeTransactionManager getTransactionManager()

unregisterProfileMBean

public void unregisterProfileMBean(java.lang.String profileKey)
                            throws java.lang.Exception

renameProfileTable

public void renameProfileTable(java.lang.String oldProfileTableName,
                               java.lang.String newProfileTableName,
                               ProfileSpecificationDescriptor profileSpecificationDescriptor)
                        throws java.lang.Exception

toValidJmxName

public static java.lang.String toValidJmxName(java.lang.String jmxName)

replace

public static java.lang.String replace(java.lang.String str,
                                       java.lang.String strToReplace,
                                       java.lang.String newStr)

createProfileTableActivity

public org.mobicents.slee.runtime.facilities.ProfileTableActivityImpl createProfileTableActivity(java.lang.String profileTableName)
TODO -- put this in the transactional cache.


removeProfileAfterTableActivityEnd

public void removeProfileAfterTableActivityEnd(java.lang.String profileTableName)
This is invoked after the activity end event is processed.


profileTableExists

public boolean profileTableExists(java.lang.String profileTableName)
                           throws javax.transaction.SystemException

getServiceContainer

public org.mobicents.slee.container.SleeContainer getServiceContainer()

getProfileTableActivityContextInterfaceFactory

public ProfileTableActivityContextInterfaceFactory getProfileTableActivityContextInterfaceFactory()

getProfileTableActivities

public java.util.HashMap getProfileTableActivities()

findDefaultProfile

public java.lang.Object findDefaultProfile(java.lang.String profileTableName)
                                    throws javax.transaction.SystemException
Retrieve the wrapper object (from the back end storage) for the default profile by table name