Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jasig.portal
Class EntityTypes

    java.lang.Object
      org.jasig.portal.EntityTypes

    public class EntityTypes

extends java.lang.Object

This class provides access to the entity types used by `IBasicEntities` and the classes in `org.jasig.portal.groups` and `org.jasig.portal.concurrency`.

Each type is associated with an `Integer` used to represent the type in the portal data store. This class translates between the `Integer` and `Class` values.

Version:
  $Revision: 1.21 $
Author:
  Dan Ellentuck
See Also:
  `IBasicEntity`

Nested Class Summary
`private class` | `EntityTypes.EntityType`

Field Summary
`private static java.lang.String` | `DESCRIPTIVE_NAME_COLUMN`
`private static java.lang.String` | `ENTITY_TYPE_TABLE`
`private java.util.Map` | `entityTypesByID`
`private java.util.Map` | `entityTypesByType`
`static java.lang.Class` | `GROUP_ENTITY_TYPE`
`static java.lang.Class` | `LEAF_ENTITY_TYPE`
`private static org.apache.commons.logging.Log` | `log`
`static int` | `NULL_TYPE_ID`
`private static EntityTypes` | `singleton`
`private static java.lang.String` | `TYPE_ID_COLUMN`
`private static java.lang.String` | `TYPE_NAME_COLUMN`
`private java.lang.Object` | `updateLock`

Constructor Summary
`private` | `EntityTypes(javax.sql.DataSource ds)`

Method Summary
`private void` | `addEntityType(java.lang.Class newType, java.lang.String description)` Add the new type if it does not already exist in the cache.
`void` | `addEntityTypeIfNecessary(java.lang.Class newType, java.lang.String description)` Check if we have the type in our cache.
`static void` | `addIfNecessary(java.lang.Class newType, java.lang.String description)` Add the new type if it does not already exist.
`private java.util.Map` | `cloneHashMap(java.util.Map m)`
`void` | `deleteEntityType(java.lang.Class type)` Synchronize on update lock to serialize adds, deletes and updates while letting reads proceed.
`private void` | `deleteEntityType(EntityTypes.EntityType et)` delete EntityType from the store.
`private static java.lang.String` | `getAllColumnNames()`
`java.util.Iterator` | `getAllEntityTypeIDs()`
`java.util.Iterator` | `getAllEntityTypes()`
`private static java.lang.String` | `getDeleteEntityTypeSql()`
`static java.lang.String` | `getDescriptiveName(java.lang.Class type)` Interface to the entity types cache.
`java.lang.String` | `getDescriptiveNameForType(java.lang.Class type)` Interface to the entity types cache.
`java.lang.Integer` | `getEntityIDFromType(java.lang.Class type)` Interface to the entity types cache.
`static java.lang.Class` | `getEntityType(java.lang.Integer typeID)` Interface to the entity types cache.
`java.lang.Class` | `getEntityTypeFromID(java.lang.Integer id)` Interface to the entity types cache.
`static java.lang.Integer` | `getEntityTypeID(java.lang.Class type)` Interface to the entity types cache.
`private java.util.Map` | `getEntityTypesByID()`
`private java.util.Map` | `getEntityTypesByType()`
`private static java.lang.String` | `getInsertEntityTypeSql()`
`private int` | `getNextKey()`
`private static java.lang.String` | `getSelectEntityTypesSql()`
`private static java.lang.String` | `getUpdateEntityTypeSql()`
`private void` | `initialize()` Cache entityTypes.
`private void` | `initialize(java.sql.Connection conn)`
`private void` | `initialize(javax.sql.DataSource ds)`
`private void` | `initializeCaches()` Cache entityTypes.
`private void` | `insertEntityType(EntityTypes.EntityType et)` Cache entityTypes.
`private void` | `primAddEntityType(EntityTypes.EntityType et)` Copy on write to prevent ConcurrentModificationExceptions.
`private void` | `primRemoveEntityType(EntityTypes.EntityType et)` Copy on write to prevent ConcurrentModificationExceptions.
`static void` | `refresh()` Interface to the entity types cache.
`void` | `setEntityTypesByID(java.util.Map m)`
`void` | `setEntityTypesByType(java.util.Map m)`
`static EntityTypes` | `singleton()`
`static EntityTypes` | `singleton(javax.sql.DataSource ds)`
`void` | `updateEntityType(java.lang.Class type, java.lang.String newDescription)` Synchronize on update lock to serialize adds, deletes and updates while letting reads proceed.
`private void` | `updateEntityType(EntityTypes.EntityType et)` Cache entityTypes.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    private static final org.apache.commons.logging.Log log

### singleton

    private static EntityTypes singleton

### entityTypesByID

    private java.util.Map entityTypesByID

### entityTypesByType

    private java.util.Map entityTypesByType

### updateLock

    private java.lang.Object updateLock

### ENTITY_TYPE_TABLE

    private static java.lang.String ENTITY_TYPE_TABLE

### TYPE_ID_COLUMN

    private static java.lang.String TYPE_ID_COLUMN

### TYPE_NAME_COLUMN

    private static java.lang.String TYPE_NAME_COLUMN

### DESCRIPTIVE_NAME_COLUMN

    private static java.lang.String DESCRIPTIVE_NAME_COLUMN

### NULL_TYPE_ID

    public static int NULL_TYPE_ID

### GROUP_ENTITY_TYPE

    public static java.lang.Class GROUP_ENTITY_TYPE

### LEAF_ENTITY_TYPE

    public static java.lang.Class LEAF_ENTITY_TYPE

Constructor Detail

### EntityTypes

    private EntityTypes(javax.sql.DataSource ds)

Method Detail

### addIfNecessary

    public static void addIfNecessary(java.lang.Class newType,
                                      java.lang.String description)
                               throws java.lang.Exception

  Add the new type if it does not already exist.

  Throws:
    `java.lang.Exception`

### addEntityType

    private void addEntityType(java.lang.Class newType,
                               java.lang.String description)
                        throws java.lang.Exception

  Add the new type if it does not already exist in the cache.

  Throws:
    `java.lang.Exception`

### addEntityTypeIfNecessary

    public void addEntityTypeIfNecessary(java.lang.Class newType,
                                         java.lang.String description)
                                  throws java.lang.Exception

  Check if we have the type in our cache. If not, re-retrieve. Someone might have added it since we last retrieved. If the type is not found, try to add it to the store. If the add is not successful, re-retrieve again. If the type is still not found, rethrow the SQLException. Synchronize on update lock to serialize adds, deletes and updates while letting reads proceed.

  Throws:
    `java.lang.Exception`

### deleteEntityType

    public void deleteEntityType(java.lang.Class type)
                          throws java.sql.SQLException

  Synchronize on update lock to serialize adds, deletes and updates while letting reads proceed.

  Throws:
    `java.sql.SQLException`

### deleteEntityType

    private void deleteEntityType(EntityTypes.EntityType et)
                           throws java.sql.SQLException

  delete EntityType from the store.

  Throws:
    `java.sql.SQLException`

### getAllColumnNames

    private static java.lang.String getAllColumnNames()

  Returns:
    java.lang.String

### getAllEntityTypeIDs

    public java.util.Iterator getAllEntityTypeIDs()

  Returns:
    java.util.Iterator

### getAllEntityTypes

    public java.util.Iterator getAllEntityTypes()

  Returns:
    java.util.Iterator

### getDeleteEntityTypeSql

    private static java.lang.String getDeleteEntityTypeSql()

  Returns:
    java.lang.String

### getDescriptiveName

    public static java.lang.String getDescriptiveName(java.lang.Class type)

  Interface to the entity types cache.

  Returns:
    java.lang.String

### getDescriptiveNameForType

    public java.lang.String getDescriptiveNameForType(java.lang.Class type)

  Interface to the entity types cache.

  Returns:
    java.lang.String

### getEntityIDFromType

    public java.lang.Integer getEntityIDFromType(java.lang.Class type)

  Interface to the entity types cache.

  Returns:
    java.lang.Integer

### getEntityType

    public static java.lang.Class getEntityType(java.lang.Integer typeID)

  Interface to the entity types cache.

  Returns:
    java.lang.Class

### getEntityTypeFromID

    public java.lang.Class getEntityTypeFromID(java.lang.Integer id)

  Interface to the entity types cache.

  Returns:
    java.lang.Class

### getEntityTypeID

    public static java.lang.Integer getEntityTypeID(java.lang.Class type)

  Interface to the entity types cache.

  Returns:
    java.lang.Class

### getEntityTypesByID

    private java.util.Map getEntityTypesByID()

  Returns:
    java.util.Map

### cloneHashMap

    private java.util.Map cloneHashMap(java.util.Map m)

### getEntityTypesByType

    private java.util.Map getEntityTypesByType()

  Returns:
    java.util.Map

### getInsertEntityTypeSql

    private static java.lang.String getInsertEntityTypeSql()

  Returns:
    java.lang.String

### getNextKey

    private int getNextKey()
                    throws java.lang.Exception

  Returns:
    int
  Throws:
    `java.lang.Exception`

### getSelectEntityTypesSql

    private static java.lang.String getSelectEntityTypesSql()

  Returns:
    java.lang.String

### getUpdateEntityTypeSql

    private static java.lang.String getUpdateEntityTypeSql()

  Returns:
    java.lang.String

### initialize

    private void initialize(javax.sql.DataSource ds)

### initialize

    private void initialize(java.sql.Connection conn)

### initialize

    private void initialize()

  Cache entityTypes.

### initializeCaches

    private void initializeCaches()

  Cache entityTypes.

### insertEntityType

    private void insertEntityType(EntityTypes.EntityType et)
                           throws java.sql.SQLException

  Cache entityTypes.

  Throws:
    `java.sql.SQLException`

### primAddEntityType

    private void primAddEntityType(EntityTypes.EntityType et)

  Copy on write to prevent ConcurrentModificationExceptions.

### primRemoveEntityType

    private void primRemoveEntityType(EntityTypes.EntityType et)

  Copy on write to prevent ConcurrentModificationExceptions.

### refresh

    public static void refresh()

  Interface to the entity types cache.

### setEntityTypesByID

    public void setEntityTypesByID(java.util.Map m)

### setEntityTypesByType

    public void setEntityTypesByType(java.util.Map m)

### singleton

    public static EntityTypes singleton()

  Returns:
    org.jasig.portal.EntityTypes

### singleton

    public static EntityTypes singleton(javax.sql.DataSource ds)

  Returns:
    org.jasig.portal.EntityTypes

### updateEntityType

    public void updateEntityType(java.lang.Class type,
                                 java.lang.String newDescription)
                          throws java.lang.Exception

  Synchronize on update lock to serialize adds, deletes and updates while letting reads proceed.

  Throws:
    `java.lang.Exception`

### updateEntityType

    private void updateEntityType(EntityTypes.EntityType et)
                           throws java.sql.SQLException

  Cache entityTypes.

  Throws:
    `java.sql.SQLException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD