Methods Summary |
---|
private void | addAllInterfaceMethodsIn(java.util.Collection methodDescriptors, java.lang.Class c)
Method[] methods = c.getMethods();
for (int i=0; i<methods.length; i++) {
methodDescriptors.add(methods[i]);
}
|
private void | addAllUniqueInterfaceMethodsIn(java.util.Collection methodDescriptors, java.lang.Class c)
Method[] methods = c.getMethods();
for (int i=0; i<methods.length; i++) {
if(findEquivalentMethod(methodDescriptors, methods[i]) == null)
methodDescriptors.add(methods[i]);
}
|
public void | addOneOneFinder(IASEjbCMPFinder finder)
arrOneOneFinders.add(finder);
|
public boolean | classesChanged()Called from EjbBundleDescriptor/EjbBundleArchivist
when some classes in this bean are updated.
/** No Implementation Yet
boolean superChanged = super.classesChanged();
boolean persChanged = pers.classesChanged();
// Send changed event only if parent didn't already do it.
if( !superChanged && persChanged ) {
changed();
}
return (superChanged || persChanged);
*/
return false;
|
private static java.util.Map | createConversionTable()This method returns the conversion table which maps the unqualified
name (e.g., String) of the java.lang classes to their fully qualified
name (e.g., java.lang.String)
HashMap conversionTable = new HashMap();
conversionTable.put("Boolean", "java.lang.Boolean"); //NOI18N
conversionTable.put("Byte", "java.lang.Byte"); //NOI18N
conversionTable.put("Character", "java.lang.Character"); //NOI18N
conversionTable.put("Double", "java.lang.Double"); //NOI18N
conversionTable.put("Float", "java.lang.Float"); //NOI18N
conversionTable.put("Integer", "java.lang.Integer"); //NOI18N
conversionTable.put("Long", "java.lang.Long"); //NOI18N
conversionTable.put("Number", "java.lang.Number"); //NOI18N
conversionTable.put("Short", "java.lang.Short"); //NOI18N
conversionTable.put("String", "java.lang.String"); //NOI18N
conversionTable.put("Object", "java.lang.Object"); //NOI18N
return conversionTable;
|
private java.lang.reflect.Method | findEquivalentMethod(java.util.Collection methods, java.lang.reflect.Method methodToMatch)
if(methods == null)
return null;
Method matchedMethod = null;
for(Iterator iter = methods.iterator(); iter.hasNext();) {
Method next = (Method) iter.next();
// Compare methods, ignoring declaring class.
if( methodsEqual(next, methodToMatch, false) ) {
matchedMethod = next;
break;
}
}
return matchedMethod;
|
private java.lang.String | generateKey(IASEjbCMPFinder finder, com.sun.enterprise.deployment.interfaces.QueryParser parser)
StringBuffer key = new StringBuffer();
key.append(finder.getMethodName()).append(LIST_START);
String queryParams = finder.getQueryParameterDeclaration();
Iterator iter = parser.parameterTypeIterator(queryParams);
while ( iter.hasNext() ) {
String type = ( String ) iter.next() ;
key.append(getFullyQualifiedType(type)) ;
if( iter.hasNext() ) {
key.append(LIST_SEPARATOR);
}
}
key.append(LIST_END);
return key.toString().intern();
|
public java.util.Collection | getAllMethods()
HashSet methods = new HashSet();
try {
if (isRemoteInterfacesSupported()) {
addAllInterfaceMethodsIn(methods, jcl.loadClass(getHomeClassName()));
addAllInterfaceMethodsIn(methods, jcl.loadClass(getRemoteClassName()));
}
if (isLocalInterfacesSupported()) {
addAllInterfaceMethodsIn(methods, jcl.loadClass(getLocalHomeClassName()));
addAllInterfaceMethodsIn(methods, jcl.loadClass(getLocalClassName()));
}
} catch (Throwable t) {
_logger.log( Level.WARNING,
"enterprise.deployment_error_loading_class_excp", t ); // NOI18N
throw new RuntimeException(t.getMessage());
}
return methods;
|
public java.util.Collection | getAllPersistentFields()
PersistenceDescriptor pers = getPersistenceDescriptor();
PersistentFieldInfo[] persFields = pers.getPersistentFieldInfo();
PersistentFieldInfo[] pkeyFields = pers.getPkeyFieldInfo();
HashMap fields = new HashMap();
for(int i=0; i<persFields.length; i++) {
fields.put(persFields[i].name, persFields[i]);
}
for(int i=0; i<pkeyFields.length; i++) {
fields.put(pkeyFields[i].name, pkeyFields[i]);
}
return fields.values();
|
public java.util.Collection | getAllUniqueMethods()
HashSet methods = new HashSet();
try {
if (isRemoteInterfacesSupported()) {
addAllUniqueInterfaceMethodsIn(methods, jcl.loadClass(getHomeClassName()));
addAllUniqueInterfaceMethodsIn(methods, jcl.loadClass(getRemoteClassName()));
}
if (isLocalInterfacesSupported()) {
addAllUniqueInterfaceMethodsIn(methods, jcl.loadClass(getLocalHomeClassName()));
addAllUniqueInterfaceMethodsIn(methods, jcl.loadClass(getLocalClassName()));
}
} catch (Throwable t) {
_logger.log( Level.WARNING,
"enterprise.deployment_error_loading_class_excp", t ); // NOI18N
throw new RuntimeException(t.getMessage());
}
return methods;
|
public java.lang.String | getBaseName(java.lang.String className)
if (className == null)
return null;
int dot = className.lastIndexOf(DOT);
if (dot == -1)
return className;
return className.substring(dot+1);
|
public java.lang.ClassLoader | getClassLoader()
return jcl;
|
public java.lang.String | getConcreteImplClassName()Returns the classname of the State class impl.
if (concreteImplClassName == null) {
/** The Ear may contain two jar files with beans with same ejb names
*/
concreteImplClassName = getUniqueName() + CONCRETE_IMPL;
}
return concreteImplClassName;
|
private java.lang.Class | getEjbClass()The method returns the class instance for the ejb class.
if (ejbClass == null) {
String ejbClassName = getEjbClassName();
if(_logger.isLoggable(Level.FINE))
_logger.fine("@@@@@@ Ejb name is "+ ejbClassName); //NOI18N
if (jcl == null) {
String msg = localStrings.getLocalString(
"enterprise.deployment.error_missing_classloader", //NOI18N
"IASEjbCMPEntityDescriptor.getEjbClass"); //NOI18N
_logger.log(Level.WARNING, msg);
throw new RuntimeException(msg);
}
try {
ejbClass=Class.forName(ejbClassName, true, jcl);
} catch(ClassNotFoundException e) {
String msg = localStrings.getLocalString(
"enterprise.deployment.error_cannot_find_ejbclass", //NOI18N
ejbClassName);
_logger.log(Level.WARNING, msg);
throw new RuntimeException(msg);
}
}
return ejbClass;
|
public java.lang.String | getEjbImplClassName()IASRI 4725194
Returns the Execution class, which is sam as the user-specified class
in case of Message, Session and Bean Managed Persistence Entity Beans
but is different for Container Mananged Persistence Entity Bean
Therefore, the implementation in the base class is to return
getEjbClassName() and the method is redefined in IASEjbCMPDescriptor.
if (ejbImplClassName == null) {
String packageName = getPackageName(getEjbClassName());
ejbImplClassName = getConcreteImplClassName();
if(packageName != null)
ejbImplClassName = packageName + DOT + ejbImplClassName;
}
return ejbImplClassName;
|
public java.util.Collection | getFinders()Returns a collection of finder method instances.
if (finders == null) {
String ejbClassName = getEjbClassName();
Class ejbClass = getEjbClass();
if ( super.isRemoteInterfacesSupported() ) {
Class remoteHomeIntf = null;
if(_logger.isLoggable(Level.FINE))
_logger.fine("@@@@@@ " + ejbClassName + //NOI18N
" : Remote Interface is supported "); //NOI18N
try {
remoteHomeIntf = ejbClass.getClassLoader().loadClass(
super.getHomeClassName());
} catch (ClassNotFoundException ex) {
_logger.log( Level.WARNING,
"enterprise.deployment_class_not_found", ex ); //NOI18N
return null;
}
finders = getFinders(remoteHomeIntf);
if(_logger.isLoggable(Level.FINE)) {
for(Iterator iter = finders.iterator(); iter.hasNext();) {
Method remoteHomeMethod=(Method)iter.next();
_logger.fine("@@@@ adding Remote interface method " + //NOI18N
remoteHomeMethod.getName() );
}
}
} //end of isRemoteInterfaceSupported
if ( super.isLocalInterfacesSupported() ) {
Class localHomeIntf = null;
if(_logger.isLoggable(Level.FINE))
_logger.fine("@@@@@@ " + ejbClassName + ": Local Interface is supported "); //NOI18N
try {
localHomeIntf = ejbClass.getClassLoader().loadClass(
super.getLocalHomeClassName());
} catch (ClassNotFoundException ex) {
_logger.log( Level.WARNING,
"enterprise.deployment_class_not_found", ex ); //NOI18N
return null;
}
Collection localFinders = getFinders(localHomeIntf);
if(finders == null) {
// if there were no finders specified in the remote
// home, the local finders are the finders
finders = localFinders;
} else if(localFinders != null) {
// Remove the Common Elements from the collections
// and keep only unique methods
if(_logger.isLoggable(Level.FINE))
_logger.fine("@@@@@@ Trying to remove the Common Elements from HashSet....... "); //NOI18N
for(Iterator iter = localFinders.iterator(); iter.hasNext();) {
Method localHomeMethod=(Method)iter.next();
if(findEquivalentMethod(finders, localHomeMethod) == null) {
if(_logger.isLoggable(Level.FINE))
_logger.fine("@@@@ adding local interface method " + //NOI18N
localHomeMethod.getName() );
finders.add(localHomeMethod);
}
}
}
} //end of isLocalInterfaceSupported
if (finders == null)
// still not initialized => empty set
finders = new HashSet();
}
return finders;
|
public java.util.Collection | getFinders(java.lang.Class homeIntf)Returns a collection of finder methods declared by the home
interface given by a class object.
Method[] methods = homeIntf.getMethods();
Collection finders = new HashSet();
for(int i=0; i<methods.length; i++) {
if(methods[i].getName().startsWith(FIND)) {
finders.add(methods[i]);
}
}
return finders;
|
private java.lang.String | getFullyQualifiedType(java.lang.String type)
String knownType=(String)conversionTable.get(type);
return knownType == null ? type : knownType;
|
public IASEjbCMPFinder | getIASEjbCMPFinder(java.lang.reflect.Method method)
//Checks if the given method is present in the interfaces.
if(findEquivalentMethod(getFinders(), method) == null ) {
return null;
}
String methodName = method.getName();
//key is of the form methodName(param0, param1, ....)
StringBuffer key = new StringBuffer();
key.append(methodName);
key.append(LIST_START);
Class paramList[] = method.getParameterTypes();
for (int index = 0 ; index < paramList.length ; index++ ) {
if(index>0) {
key.append(LIST_SEPARATOR);
}
key.append(paramList[index].getName());
}
key.append(LIST_END);
return (IASEjbCMPFinder)getOneOneFinders().get(key.toString());
|
public java.lang.String | getMappingProperties()Returns the classname of the State class impl.
return mappingProperties;
|
public java.lang.String | getModuleDir()Returns the Module root of this module.
//FIXME:this needs to be changed when the API is available.
if(moduleDir != null)
return moduleDir;
else
return null;
|
public java.util.Map | getOneOneFinders()Returns a Map which maps between a method signature and the
corresponding IASEjbCMPFinder instance. The key is the method
signature as a string and consists of methodName(type1, type2.....).
// update the oneOneFinders map if there are any entries pending in
// the array arrOneOneFinders.
if (!arrOneOneFinders.isEmpty()) {
if (queryParser == null) {
String msg = localStrings.getLocalString(
"enterprise.deployment.error_missing_queryparser", //NOI18N
"IASEjbCMPEntityDescriptor.getOneOneFinders"); //NOI18N
_logger.log(Level.WARNING, msg);
throw new RuntimeException(msg);
}
//parse the query declaration parameter and store the query object
for ( Iterator i = arrOneOneFinders.iterator(); i.hasNext(); ) {
IASEjbCMPFinder finder = ( IASEjbCMPFinder )i.next();
String key = generateKey(finder, queryParser);
oneOneFinders.put(key, finder);
}
arrOneOneFinders.clear();
}
return oneOneFinders;
|
public java.lang.String | getPackageName(java.lang.String className)
int dot = className.lastIndexOf(DOT);
if (dot == -1)
return null;
return className.substring(0, dot);
|
public java.lang.String | getPcImplClassName()
if (pcImplClassName == null) {
// Check for Null added
pcImplClassName = getUniqueName() + JDOSTATE;
String packageName = getPackageName(getEjbClassName());
if(packageName != null)
pcImplClassName = packageName + DOT + pcImplClassName;
if(_logger.isLoggable(Level.FINE))
_logger.fine("##### PCImplClass Name is " + pcImplClassName); // NOI18N
}
return pcImplClassName;
|
public java.util.Collection | getPersistentFields()
PersistenceDescriptor pers = getPersistenceDescriptor();
PersistentFieldInfo[] persFields = pers.getPersistentFieldInfo();
HashMap fields = new HashMap();
for(int i=0; i<persFields.length; i++) {
fields.put(persFields[i].name, persFields[i]);
}
return fields.values();
|
public PrefetchDisabledDescriptor | getPrefetchDisabledDescriptor()Getter for prefetch-disabled
return prefetchDisabledDescriptor;
|
public java.util.Collection | getPrimaryKeyFields()
PersistenceDescriptor pers = getPersistenceDescriptor();
PersistentFieldInfo[] pkeyFields = pers.getPkeyFieldInfo();
HashMap pkey = new HashMap();
for(int i=0; i<pkeyFields.length; i++) {
pkey.put(pkeyFields[i].name, pkeyFields[i]);
}
return pkey.values();
|
public com.sun.enterprise.deployment.interfaces.QueryParser | getQueryParser()Returns the query parser object
return queryParser;
|
public java.util.Collection | getSelectors()Returns a collection of selector methods.
if (selectors == null) {
selectors = new HashSet();
Class ejbClass = getEjbClass();
Method[] methods = ejbClass.getMethods();
for(int i=0; i<methods.length; i++) {
if(methods[i].getName().startsWith(EJB_SELECT)) { //NOI18N
selectors.add(methods[i]);
}
}
}
return selectors;
|
public java.lang.String | getUniqueName()
if(uniqueName == null) {
BundleDescriptor bundle = getEjbBundleDescriptor();
Application application = bundle.getApplication();
// Add ejb name and application name.
StringBuffer rc = new StringBuffer().
append(getName()).
append(NAME_CONCATENATOR).
append(application.getRegistrationName());
// If it's not just a module, add a module name.
if (!application.isVirtual()) {
rc.append(NAME_CONCATENATOR).
append(bundle.getModuleDescriptor().getArchiveUri());
}
uniqueName = getBaseName(getEjbClassName())
+ getUniqueNumber(rc.toString());
}
return uniqueName;
|
public java.lang.String | getUniqueNumber(java.lang.String num)
//Modified to decrease the possibility of collision
String newNum= "" + num.hashCode(); // NOI18N
newNum = newNum.replace('-", NAME_PART_SEPARATOR); // NOI18N
return newNum;
|
private boolean | methodsEqual(java.lang.reflect.Method m1, java.lang.reflect.Method m2, boolean compareDeclaringClass)Checks whether two methods that might have been loaded by
different class loaders are equal.
boolean equal = false;
do {
String m1Name = m1.getName();
String m2Name = m2.getName();
if( !m1Name.equals(m2Name) ) { break; }
String m1DeclaringClass = m1.getDeclaringClass().getName();
String m2DeclaringClass = m2.getDeclaringClass().getName();
if( compareDeclaringClass ) {
if( !m1DeclaringClass.equals(m2DeclaringClass) ) { break; }
}
Class[] m1ParamTypes = m1.getParameterTypes();
Class[] m2ParamTypes = m2.getParameterTypes();
if( m1ParamTypes.length != m2ParamTypes.length ) { break; }
equal = true;
for(int pIndex = 0; pIndex < m1ParamTypes.length; pIndex++) {
String m1ParamClass = m1ParamTypes[pIndex].getName();
String m2ParamClass = m2ParamTypes[pIndex].getName();
if( !m1ParamClass.equals(m2ParamClass) ) {
equal = false;
break;
}
}
} while(false);
return equal;
|
public void | setClassLoader(java.lang.ClassLoader jcl)
this.jcl = jcl;
|
public void | setConcreteImplClassName(java.lang.String name)Sets the State class implementation classname.
concreteImplClassName = name;
|
public void | setMappingProperties(java.lang.String mappingProperties)
this.mappingProperties = mappingProperties;
|
public void | setModuleDir(java.lang.String moduleRootDir)
moduleDir = moduleRootDir;
|
public void | setPcImplClassName(java.lang.String name)Sets the State class implementation classname.
pcImplClassName = name;
|
public void | setPrefetchDisabledDescriptor(PrefetchDisabledDescriptor prefetchDisabledDescriptor)Setter for prefetch-disabled
this.prefetchDisabledDescriptor = prefetchDisabledDescriptor;
|
public void | setQueryParser(com.sun.enterprise.deployment.interfaces.QueryParser inParser)This method sets the parser which would be used to parse the query
parameter declaration given in sun-ejb-jar.xml.
This method is called from JDOCodenerator class 's generate() method.
queryParser = inParser;
|