/**
  * Returns true if the passed <code>mdbClass</code> meets the requirements set by the EJB3 spec
  * about bean implementation classes. The passed <code>mdbClass</code> must not be an interface
  * and must be public and not final and not abstract. If it passes these requirements then this
  * method returns true. Else it returns false.
  *
  * @param mdbClass The MDB class
  * @return
  */
 private boolean assertMDBClassValidity(final ClassInfo mdbClass) {
   final short flags = mdbClass.flags();
   final String className = mdbClass.name().toString();
   // must *not* be a interface
   if (Modifier.isInterface(flags)) {
     EjbLogger.EJB3_LOGGER.mdbClassCannotBeAnInterface(className);
     return false;
   }
   // bean class must be public, must *not* be abstract or final
   if (!Modifier.isPublic(flags) || Modifier.isAbstract(flags) || Modifier.isFinal(flags)) {
     EjbLogger.EJB3_LOGGER.mdbClassMustBePublicNonAbstractNonFinal(className);
     return false;
   }
   // valid class
   return true;
 }
コード例 #2
0
 /**
  * Makes a dynamic stub class, if it does not already exist.
  *
  * @param myClass The class to create a stub for
  * @return The dynamic stub class
  */
 public static Class<?> makeStubClass(final Class<?> myClass) {
   final String stubClassName = myClass + "_Stub";
   ClassLoader cl = SecurityActions.getContextClassLoader();
   if (cl == null) {
     cl = myClass.getClassLoader();
   }
   if (cl == null) {
     throw EjbMessages.MESSAGES.couldNotFindClassLoaderForStub(stubClassName);
   }
   Class<?> theClass;
   try {
     theClass = cl.loadClass(stubClassName);
   } catch (ClassNotFoundException e) {
     try {
       final ClassFile clazz = IIOPStubCompiler.compile(myClass, stubClassName);
       theClass = clazz.define(cl);
     } catch (RuntimeException ex) {
       // there is a possibility that another thread may have defined the same class in the
       // meantime
       try {
         theClass = cl.loadClass(stubClassName);
       } catch (ClassNotFoundException e1) {
         EjbLogger.EJB3_LOGGER.dynamicStubCreationFailed(stubClassName, ex);
         throw ex;
       }
     }
   }
   return theClass;
 }
コード例 #3
0
 @Override
 public Boolean run() {
   boolean deleted = file.delete();
   if (!deleted) {
     EjbLogger.EJB3_LOGGER.cannotDeleteCacheFile(
         file.isDirectory() ? "directory" : " file", file.getName());
     file.deleteOnExit();
   }
   return deleted;
 }