FileDocCategorySizeDatePackage
EjbEntityDescriptor.javaAPI DocGlassfish v2 API8690Fri May 04 22:31:20 BST 2007com.sun.enterprise.deployment

EjbEntityDescriptor

public class EjbEntityDescriptor extends EjbDescriptor
This class contains deployment information for an EntityBean with bean-managed persistence. Subclasses contains additional information for EJB1.1/EJB2.0 CMP EntityBeans.
author
Danny Coward
author
Sanjeev Krishnan
author
Vivek Nagar

Fields Summary
public static final String
TYPE
public static final String
BEAN_PERSISTENCE
public static final String
CONTAINER_PERSISTENCE
public static final String
TRUE
public static final String
FALSE
protected String
persistenceType
protected boolean
isReentrant
protected String
primaryKeyClassName
private static com.sun.enterprise.util.LocalStringManagerImpl
localStrings
static Logger
_logger
Constructors Summary
public EjbEntityDescriptor()
The default constructor.

 

    
             
      
    
public EjbEntityDescriptor(EjbDescriptor other)
The copy constructor.

	super(other);
	if (other instanceof EjbEntityDescriptor) {
	    EjbEntityDescriptor entity = (EjbEntityDescriptor) other;
	    this.persistenceType = entity.persistenceType;
	    this.isReentrant = entity.isReentrant;
	    this.primaryKeyClassName = entity.primaryKeyClassName;
	}   
    
Methods Summary
public java.lang.StringgetPersistenceType()
Returns the persistence type for this entity bean. Defaults to BEAN_PERSISTENCE.

	if (this.persistenceType == null) {
	    this.persistenceType = BEAN_PERSISTENCE;
	}
	return this.persistenceType;
    
public java.lang.StringgetPrimaryKeyClassName()
Return the classname of the primary key for this bean, or the empty string if none has been set.

	if (this.primaryKeyClassName == null) {
	    this.primaryKeyClassName = Object.class.getName();
	}
	return this.primaryKeyClassName;
    
public java.lang.StringgetReentrant()

	if (this.isReentrant()) {
	    return TRUE;
	} else {
	    return FALSE;
	}
    
public java.lang.StringgetTransactionType()
Gets the container transaction type for this entity bean. Entity beans always have CONTAINER_TRANSACTION_TYPE transaction type.

	return super.transactionType;
    
public java.lang.StringgetType()
Returns the type of this bean. EjbEntityDescriptor.TYPE

	return TYPE;
    
public booleanisReentrant()
Return true if this entity bean is reentrant, false else.

	return this.isReentrant;
    
public voidprint(java.lang.StringBuffer toStringBuffer)
Return my formatted string representation.

	super.print(toStringBuffer);
	toStringBuffer.append("\n Entity descriptor");
	toStringBuffer.append("\n isReentrant ").append(isReentrant);
	toStringBuffer.append("\n primaryKeyClassName ").append(primaryKeyClassName);
	toStringBuffer.append("\n persistenceType ").append(persistenceType);
    
public voidreplaceEntityDescriptor(com.sun.enterprise.deployment.EjbEntityDescriptor oldEntityDesc)
Replace all pointers to the old EntityDescriptor in this app with myself. Used when user switches from BMP to CMP or vice versa in deploytool wizard.

	// first replace in bundleDesc
	EjbBundleDescriptor bundle = oldEntityDesc.getEjbBundleDescriptor();
	bundle.replaceEjb(oldEntityDesc, this);

	// now replace in all EjbReferences to the old Ejb in this app
	Iterator refs = oldEntityDesc.getAllEjbReferencers().iterator();
	while ( refs.hasNext() ) {
	    EjbReferenceDescriptor ref = (EjbReferenceDescriptor)refs.next();
	    ref.setEjbDescriptor(this);
	}
    
public voidsetPersistenceType(java.lang.String persistenceType)
Sets the persistence type for this entity bean. Allowable values are BEAN_PERSISTENCE or CONTAINER_PERSISTENCE, or else an IllegalArgumentException is thrown.

	boolean isValidChange = (BEAN_PERSISTENCE.equals(persistenceType) || CONTAINER_PERSISTENCE.equals(persistenceType));
	if (isValidChange || !this.isBoundsChecking()) {
	    this.persistenceType = persistenceType;
	    super.changed();
	} else {
	        //_logger.log(Level.FINE,"Warning " + persistenceType + " is not an allowed persistence type");
	    throw new IllegalArgumentException(localStrings.getLocalString(
									   "enterprise.deployment.exceptionpersistenceisnotallowedtype",
									   "{0} is not an allowed persistence type", new Object[] {persistenceType}));
	}
    
public voidsetPrimaryKeyClassName(java.lang.String primaryKeyClassName)
Set the classname of the primary key used by this bean.

	this.primaryKeyClassName = primaryKeyClassName;
	super.changed();
    
public voidsetReentrant(java.lang.String reentrantString)

	if (TRUE.equalsIgnoreCase(reentrantString)) {
	    this.setReentrant(true);
	    return;
	}
	if (FALSE.equalsIgnoreCase(reentrantString)) {
	    this.setReentrant(false);
	    return;
	}
	if (this.isBoundsChecking()) {
	    throw new IllegalArgumentException(localStrings.getLocalString(
									   "enterprise.deployment.exceptionstringnotlegalvalue",
									  "{0} is not a legal value for entity reentrancy", new Object[] {reentrantString}));
	}   
    
public voidsetReentrant(boolean isReentrant)
Sets the isReentrant flag for this bean.

	this.isReentrant = isReentrant;
	super.changed();
    
public voidsetTransactionType(java.lang.String transactionType)
Sets the transaction type for this entity bean. Throws an illegal argument exception if this type is not CONTAINER_TRANSACTION_TYPE.

	if (!CONTAINER_TRANSACTION_TYPE.equals(transactionType) 
		&& this.isBoundsChecking()) {
	    throw new IllegalArgumentException(localStrings.getLocalString(
	      "enterprise.deployment.exceptionentitybeancanonlyhavecntnrtxtype",
	      "Entity beans can only have Container transaction type. The type was being set to {0}", new Object[] {transactionType}));
	}
	super.transactionType = transactionType;
    
public voidsetType(java.lang.String type)
Sets my type String.

	throw new IllegalArgumentException(localStrings.getLocalString(
	       "enterprise.deployment.exceptioncannotsettypeonentitybean",
	       "Cannon set type on an entity bean"));