public static EntityManagerSetupException missingProperty(String property) { Object[] args = { property }; EntityManagerSetupException setupException = new EntityManagerSetupException(ExceptionMessageGenerator.buildMessage(EntityManagerSetupException.class, MISSING_PROPERTY, args)); setupException.setErrorCode(MISSING_PROPERTY); return setupException; }
/** * INTERNAL: * EclipseLink exceptions should only be thrown by EclipseLink. */ protected EntityManagerSetupException(String message, Throwable internalException) { super(message); setInternalException(internalException); }
ClassLoader classLoaderToUse = null; if (state == STATE_DEPLOY_FAILED || state == STATE_UNDEPLOYED) { throw new PersistenceException(EntityManagerSetupException.cannotPredeploy(persistenceUnitInfo.getPersistenceUnitName(), state, persistenceException)); } else { throw new PersistenceException(EntityManagerSetupException.compositeMemberCannotBeUsedStandalone(persistenceUnitInfo.getPersistenceUnitName())); if (isComposite) { if (isSessionLoadedFromSessionsXML) { throw EntityManagerSetupException.compositeIncompatibleWithSessionsXml(persistenceUnitInfo.getPersistenceUnitName()); throw EntityManagerSetupException.sessionNameNeedBeSpecified(persistenceUnitInfo.getPersistenceUnitName(), sessionsXMLStr); throw EntityManagerSetupException.sessionLoadedFromSessionsXMLMustBeServerSession(persistenceUnitInfo.getPersistenceUnitName(), (String)predeployProperties.get(PersistenceUnitProperties.SESSIONS_XML), tempSession); predeployProperties.get(PersistenceUnitProperties.SCHEMA_DATABASE_MAJOR_VERSION) == null || predeployProperties.get(PersistenceUnitProperties.SCHEMA_DATABASE_MINOR_VERSION) == null) { throw EntityManagerSetupException.jtaPersistenceUnitInfoMissingJtaDataSource(persistenceUnitInfo.getPersistenceUnitName());
if (this.state != STATE_PREDEPLOYED && this.state != STATE_DEPLOYED && this.state != STATE_HALF_DEPLOYED) { if (mustBeCompositeMember()) { throw new PersistenceException(EntityManagerSetupException.compositeMemberCannotBeUsedStandalone(this.persistenceUnitInfo.getPersistenceUnitName())); throw new PersistenceException(EntityManagerSetupException.cannotDeployWithoutPredeploy(this.persistenceUnitInfo.getPersistenceUnitName(), this.state, this.persistenceException)); if (this.state == STATE_DEPLOY_FAILED) { if (exception == persistenceException) { persistenceEx = new PersistenceException(EntityManagerSetupException.cannotDeployWithoutPredeploy(this.persistenceUnitInfo.getPersistenceUnitName(), this.state, this.persistenceException)); } else {
private static Class findClassForPropertyInternal(String clsName, String propName, ClassLoader... loaders) { RuntimeException e = null; for (ClassLoader loader : loaders) { try { return findClass(clsName, loader); } catch (PrivilegedActionException exception1) { e = EntityManagerSetupException.classNotFoundForProperty(clsName, propName, exception1.getException()); } catch (ClassNotFoundException exception2) { e = EntityManagerSetupException.classNotFoundForProperty(clsName, propName, exception2); } } throw e; }
/** * Put the given session into the session manager so it can be looked up later */ protected void addSessionToGlobalSessionManager() { SessionManager sm = SessionManager.getManager(); ConcurrentMap<String,Session> sessions = sm.getSessions(); AbstractSession oldSession = (AbstractSession) sessions.get(session.getName()); if(oldSession != null) { throw new PersistenceException(EntityManagerSetupException.attemptedRedeployWithoutClose(session.getName())); } sm.addSession(session); }
public static EntityManagerSetupException failedToInstantiateProperty(String className, String property, Exception exception) { Object[] args = { className, property }; EntityManagerSetupException setupException = new EntityManagerSetupException(ExceptionMessageGenerator.buildMessage(EntityManagerSetupException.class, FAILED_TO_INSTANTIATE_PROPERTY, args), exception); setupException.setErrorCode(FAILED_TO_INSTANTIATE_PROPERTY); return setupException; }
/** * INTERNAL: * EclipseLink exceptions should only be thrown by EclipseLink. */ protected EntityManagerSetupException(String message, Throwable internalException) { super(message); setInternalException(internalException); }
public static EntityManagerSetupException classNotFoundWhileProcessingAnnotations(String className, Exception exception) { Object[] args = { className }; EntityManagerSetupException setupException = new EntityManagerSetupException(ExceptionMessageGenerator.buildMessage(EntityManagerSetupException.class, CLASS_NOT_FOUND_WHILE_PROCESSING_ANNOTATIONS, args), exception); setupException.setErrorCode(CLASS_NOT_FOUND_WHILE_PROCESSING_ANNOTATIONS); return setupException; }
/** * INTERNAL: * EclipseLink exceptions should only be thrown by EclipseLink. */ protected EntityManagerSetupException(String message, Throwable internalException) { super(message); setInternalException(internalException); }
public static EntityManagerSetupException sessionXMLValidationException(String sessionName, String xmlFileName, ValidationException exception) { Object[] args = { sessionName, xmlFileName }; EntityManagerSetupException setupException = new EntityManagerSetupException(ExceptionMessageGenerator.buildMessage(EntityManagerSetupException.class, SESSIONS_XML_VALIDATION_EXCEPTION, args), exception); setupException.setErrorCode(SESSIONS_XML_VALIDATION_EXCEPTION); return setupException; }
public static EntityManagerSetupException cannotPredeploy(String persistenceUnitName, String state, Exception exception) { Object[] args = { persistenceUnitName, state }; EntityManagerSetupException setupException = new EntityManagerSetupException(ExceptionMessageGenerator.buildMessage(EntityManagerSetupException.class, CANNOT_PREDEPLOY, args), exception); setupException.setErrorCode(CANNOT_PREDEPLOY); return setupException; }
public static EntityManagerSetupException attemptedRedeployWithoutClose(String sessionName) { Object[] args = { sessionName }; EntityManagerSetupException setupException = new EntityManagerSetupException(ExceptionMessageGenerator.buildMessage(EntityManagerSetupException.class, ATTEMPTED_REDEPLOY_WITHOUT_CLOSE, args)); setupException.setErrorCode(ATTEMPTED_REDEPLOY_WITHOUT_CLOSE); return setupException; }
public static EntityManagerSetupException classNotFoundWhileProcessingAnnotations(String className, Exception exception) { Object[] args = { className }; EntityManagerSetupException setupException = new EntityManagerSetupException(ExceptionMessageGenerator.buildMessage(EntityManagerSetupException.class, CLASS_NOT_FOUND_WHILE_PROCESSING_ANNOTATIONS, args), exception); setupException.setErrorCode(CLASS_NOT_FOUND_WHILE_PROCESSING_ANNOTATIONS); return setupException; }
public static EntityManagerSetupException deployFailed(String persistenceUnitName, RuntimeException exception) { Object[] args = { persistenceUnitName }; EntityManagerSetupException setupException = new EntityManagerSetupException(ExceptionMessageGenerator.buildMessage(EntityManagerSetupException.class, DEPLOY_FAILED, args), exception); setupException.setErrorCode(DEPLOY_FAILED); return setupException; }
public static EntityManagerSetupException sessionNameNeedBeSpecified(String PUName, String sessionsXML) { Object[] args = { PUName,sessionsXML }; EntityManagerSetupException setupException = new EntityManagerSetupException(ExceptionMessageGenerator.buildMessage(EntityManagerSetupException.class, ATTEMPTED_LOAD_SESSION_WITHOUT_NAME_PROVIDED, args)); setupException.setErrorCode(ATTEMPTED_LOAD_SESSION_WITHOUT_NAME_PROVIDED); return setupException; }
public static EntityManagerSetupException wrongPropertyValueType(String value, String expectedType, String propertyName) { Object[] args = { value, expectedType, propertyName }; EntityManagerSetupException setupException = new EntityManagerSetupException(ExceptionMessageGenerator.buildMessage(EntityManagerSetupException.class, WRONG_PROPERTY_VALUE_TYPE, args)); setupException.setErrorCode(WRONG_PROPERTY_VALUE_TYPE); return setupException; }
/** * INTERNAL: * Our OSGI persistence provider does not support a JavaEE-type deployment * @return */ public static EntityManagerSetupException createContainerEntityManagerFactoryNotSupportedInOSGi() { EntityManagerSetupException setupException = new EntityManagerSetupException(ExceptionMessageGenerator.buildMessage(// EntityManagerSetupException.class, CREATE_CONTAINER_EMF_NOT_SUPPORTED_IN_OSGI, new Object[] {})); setupException.setErrorCode(CREATE_CONTAINER_EMF_NOT_SUPPORTED_IN_OSGI); return setupException; }
public static EntityManagerSetupException classNotFoundForProperty(String className, String propertyName, Exception exception) { Object[] args = { className, propertyName }; EntityManagerSetupException setupException = new EntityManagerSetupException(ExceptionMessageGenerator.buildMessage(EntityManagerSetupException.class, CLASS_NOT_FOUND_FOR_PROPERTY, args), exception); setupException.setErrorCode(CLASS_NOT_FOUND_FOR_PROPERTY); return setupException; }
public static EntityManagerSetupException failedToInstantiateProperty(String className, String property, Exception exception) { Object[] args = { className, property }; EntityManagerSetupException setupException = new EntityManagerSetupException(ExceptionMessageGenerator.buildMessage(EntityManagerSetupException.class, FAILED_TO_INSTANTIATE_PROPERTY, args), exception); setupException.setErrorCode(FAILED_TO_INSTANTIATE_PROPERTY); return setupException; }