/** * Checks for database events listener properties. */ protected void updateDatabaseEventListener(Map m, ClassLoader loader) { String listenerClassName = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.DATABASE_EVENT_LISTENER, m, this.session); if (listenerClassName != null) { if (listenerClassName.equalsIgnoreCase("DCN") || listenerClassName.equalsIgnoreCase("QCN")) { listenerClassName = "org.eclipse.persistence.platform.database.oracle.dcn.OracleChangeNotificationListener"; } Class cls = findClassForProperty(listenerClassName, PersistenceUnitProperties.DATABASE_EVENT_LISTENER, loader); DatabaseEventListener listener = null; try { Constructor constructor = cls.getConstructor(); listener = (DatabaseEventListener)constructor.newInstance(); } catch (Exception exception) { throw EntityManagerSetupException.failedToInstantiateProperty(listenerClassName, PersistenceUnitProperties.DATABASE_EVENT_LISTENER, exception); } getDatabaseSession().setDatabaseEventListener(listener); } }
/** * Load the projectCacheAccessor for JPA project caching */ protected void updateProjectCache(Map m, ClassLoader loader){ Object accessor = EntityManagerFactoryProvider.getConfigPropertyLogDebug(PersistenceUnitProperties.PROJECT_CACHE, m, session); if (accessor != null ) { if (accessor instanceof ProjectCache) { projectCacheAccessor = (ProjectCache)accessor; } else { String accessorType = (String)accessor; if (accessorType.equalsIgnoreCase("java-serialization")) { projectCacheAccessor = new FileBasedProjectCache(); } else { Class transportClass = findClassForProperty(accessorType, PersistenceUnitProperties.PROJECT_CACHE, loader); try { projectCacheAccessor = (ProjectCache)transportClass.newInstance(); } catch (Exception invalid) { session.handleException(EntityManagerSetupException.failedToInstantiateProperty(accessorType, PersistenceUnitProperties.METADATA_SOURCE,invalid)); } } } } }
/** * Check for a tuning property and run the tuner preDeploy. */ protected void updateTunerPreDeploy(Map m, ClassLoader loader) { String tuning = (String)EntityManagerFactoryProvider.getConfigPropertyLogDebug(PersistenceUnitProperties.TUNING, m, this.session); if (tuning != null) { SessionTuner tuner = null; if (tuning.equalsIgnoreCase("Safe")) { tuner = new SafeModeTuner(); } else if (tuning.equalsIgnoreCase("Standard")) { tuner = new StandardTuner(); } else { if (tuning.equalsIgnoreCase("ExaLogic")) { tuning = "oracle.toplink.exalogic.tuning.ExaLogicTuner"; } Class tunerClass = findClassForProperty(tuning, PersistenceUnitProperties.TUNING, loader); try { tuner = (SessionTuner)tunerClass.newInstance(); } catch (Exception invalid) { this.session.handleException(EntityManagerSetupException.failedToInstantiateProperty(tuning, PersistenceUnitProperties.TUNING, invalid)); } } getDatabaseSession().setTuner(tuner); tuner.tunePreDeploy(m); } }
/** * Load the Metadata Repository for Extensibility */ protected void updateMetadataRepository(Map m, ClassLoader loader){ Object metadataSource = EntityManagerFactoryProvider.getConfigPropertyLogDebug(PersistenceUnitProperties.METADATA_SOURCE, m, session); if (metadataSource != null && metadataSource instanceof MetadataSource){ processor.setMetadataSource((MetadataSource)metadataSource); } else { if (metadataSource!=null) { String repository = (String)metadataSource; if (repository.equalsIgnoreCase("XML")) { processor.setMetadataSource(new XMLMetadataSource()); } else { Class transportClass = findClassForProperty(repository, PersistenceUnitProperties.METADATA_SOURCE, loader); try { processor.setMetadataSource((MetadataSource)transportClass.newInstance()); } catch (Exception invalid) { session.handleException(EntityManagerSetupException.failedToInstantiateProperty(repository, PersistenceUnitProperties.METADATA_SOURCE,invalid)); } } } } }
policy = (MultitenantPolicy) constructor.newInstance(); } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { throw EntityManagerSetupException.failedToInstantiateProperty(tenantStrategy, PersistenceUnitProperties.MULTITENANT_STRATEGY, ex);
/** * Checks for partitioning properties. */ protected void updatePartitioning(Map m, ClassLoader loader) { // Partitioning String partitioning = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.PARTITIONING, m, this.session); if (partitioning != null) { PartitioningPolicy partitioningPolicy = this.session.getProject().getPartitioningPolicy(partitioning); if (partitioningPolicy == null) { throw DescriptorException.missingPartitioningPolicy(partitioning, null, null); } this.session.setPartitioningPolicy(partitioningPolicy); } String callbackClassName = getConfigPropertyAsStringLogDebug(PersistenceUnitProperties.PARTITIONING_CALLBACK, m, this.session); if (callbackClassName != null) { Class cls = findClassForProperty(callbackClassName, PersistenceUnitProperties.PARTITIONING_CALLBACK, loader); DataPartitioningCallback callback = null; try { Constructor constructor = cls.getConstructor(); callback = (DataPartitioningCallback)constructor.newInstance(); } catch (Exception exception) { throw EntityManagerSetupException.failedToInstantiateProperty(callbackClassName, PersistenceUnitProperties.PARTITIONING_CALLBACK, exception); } this.session.getLogin().setPartitioningCallback(callback); } }
throw new IllegalArgumentException(ExceptionLocalization.buildMessage("ejb30-illegal-property-value", new Object[]{PersistenceUnitProperties.BATCH_WRITING, batchWritingSettingString})); } else { throw EntityManagerSetupException.failedToInstantiateProperty(batchWritingSettingString, PersistenceUnitProperties.BATCH_WRITING, exception);
connector = (Connector)constructor.newInstance(); } catch (Exception exception) { throw EntityManagerSetupException.failedToInstantiateProperty((String)connectorValue, connectorProperty, exception);