/** * Sets Specification from the given String. * * @param spec should be encoded in the format specified in {@link * Specification}. */ public void setSpecification(String spec) { specification.setString(spec); }
public CacheDistributionPolicy getCacheDistributionPolicyInstance() { CacheDistributionPolicy policy = (CacheDistributionPolicy) cacheDistributionPolicyPlugin.get(); if (policy == null) { policy = (CacheDistributionPolicy) cacheDistributionPolicyPlugin.instantiate(CacheDistributionPolicy.class, this); } return policy; }
public String getDataCacheManager() { return dataCacheManagerPlugin.getString(); }
public void setLifecycleEventManager(String lem) { if (_allowSetLifeCycleEventManager) { _allowSetLifeCycleEventManager = false; // Only allow this to be called once even if the configuration is frozen. This can happen if a configuration // is eagerly initialized and validation is being used. lifecycleEventManager.setDynamic(true); lifecycleEventManager.setString(lem); lifecycleEventManager.setDynamic(false); } else { // If the configuration is frozen this will result in a warning message and/or an exception. lifecycleEventManager.setString(lem); } }
public Object getConnectionFactory2() { if (connectionFactory2.get() == null) connectionFactory2.set( lookupConnectionFactory(getConnectionFactory2Name(), connectionFactory2.getProperty()), false); return connectionFactory2.get(); }
/** * Constructor. * * @param loadGlobals whether to attempt to load the global properties */ public ConfigurationImpl(boolean loadGlobals) { setProductName("openjpa"); logFactoryPlugin = addPlugin("Log", true); String[] aliases = new String[]{ "true", LogFactoryImpl.class.getName(), "openjpa", LogFactoryImpl.class.getName(), "commons", "org.apache.openjpa.lib.log.CommonsLogFactory", "log4j", "org.apache.openjpa.lib.log.Log4JLogFactory", "none", NoneLogFactory.class.getName(), "false", NoneLogFactory.class.getName(), }; logFactoryPlugin.setAliases(aliases); logFactoryPlugin.setDefault(aliases[0]); logFactoryPlugin.setString(aliases[0]); logFactoryPlugin.setInstantiatingGetter("getLogFactory"); id = addString("Id"); if (loadGlobals) loadGlobals(); }
@Override public boolean afterSpecificationSet(Configuration c) { if (!(c instanceof JDBCConfigurationImpl)) return false; JDBCConfigurationImpl conf = (JDBCConfigurationImpl) c; String jpa = PersistenceProductDerivation.SPEC_JPA; if (!jpa.equals(conf.getSpecification())) return false; conf.mappingDefaultsPlugin.setDefault(jpa); conf.mappingDefaultsPlugin.setString(jpa); return true; } }
conf.validationGroupPreRemove.setDynamic(true); conf.validationFactory.setInstantiatingGetter("getValidationFactoryInstance"); conf.validationFactory.setDynamic(true); conf.validator.setInstantiatingGetter("getValidatorInstance"); conf.validator.setDynamic(true); conf.validator.makePrivate();
protected void setInternalString(String str) { if (str == null) set(null); else throw new IllegalArgumentException(_loc.get("cant-set-string", getProperty()).getMessage()); }
/** * The internal value. */ public void set(Object obj) { set(obj, false); }
/** * * @param conf * @return */ public boolean beforeConfigurationLoad(Configuration conf) { if (conf instanceof OpenJPAConfiguration) { OpenJPAConfigurationImpl oconf = (OpenJPAConfigurationImpl) conf; oconf.dataCacheManagerPlugin.setAlias(EHCACHE, EhCacheDataCacheManager.class.getName()); oconf.dataCachePlugin.setAlias(EHCACHE, EhCacheDataCache.class.getName()); oconf.queryCachePlugin.setAlias(EHCACHE, EhCacheQueryCache.class.getName()); oconf.remoteProviderPlugin.setAlias("none", NoOpRemoteCommitProvider.class.getName()); } return false; }
/** * Constructor. * * @param loadGlobals whether to attempt to load the global properties */ public ConfigurationImpl(boolean loadGlobals) { setProductName("openjpa"); logFactoryPlugin = addPlugin("Log", true); String[] aliases = new String[]{ "true", LogFactoryImpl.class.getName(), "openjpa", LogFactoryImpl.class.getName(), "commons", "org.apache.openjpa.lib.log.CommonsLogFactory", "log4j", "org.apache.openjpa.lib.log.Log4JLogFactory", "slf4j", "org.apache.openjpa.lib.log.SLF4JLogFactory", "none", NoneLogFactory.class.getName(), "false", NoneLogFactory.class.getName(), }; logFactoryPlugin.setAliases(aliases); logFactoryPlugin.setDefault(aliases[0]); logFactoryPlugin.setString(aliases[0]); logFactoryPlugin.setInstantiatingGetter("getLogFactory"); id = addString("Id"); if (loadGlobals) loadGlobals(); }
/** * Default constructor. */ public XMLConfiguration() { super(false, false); // override the default and the current value of lock manager plugin // from our superclass to use the single-jvm lock manager lockManagerPlugin.setDefault("version"); lockManagerPlugin.setString("version"); ProductDerivations.beforeConfigurationLoad(this); loadGlobals(); }
public Object getConnectionFactory() { if (connectionFactory.get() == null) connectionFactory.set( lookupConnectionFactory(getConnectionFactoryName(), connectionFactory.getProperty()), true); return connectionFactory.get(); }
conf.validationGroupPreRemove.setDynamic(true); conf.validationFactory.setInstantiatingGetter("getValidationFactoryInstance"); conf.validationFactory.setDynamic(true); conf.validator.setInstantiatingGetter("getValidatorInstance"); conf.validator.setDynamic(true); conf.validator.makePrivate();
public void setLifecycleEventManager(String lem) { if (_allowSetLifeCycleEventManager) { _allowSetLifeCycleEventManager = false; // Only allow this to be called once even if the configuration is frozen. This can happen if a configuration // is eagerly initialized and validation is being used. lifecycleEventManager.setDynamic(true); lifecycleEventManager.setString(lem); lifecycleEventManager.setDynamic(false); } else { // If the configuration is frozen this will result in a warning message and/or an exception. lifecycleEventManager.setString(lem); } }
protected void setInternalString(String str) { if (str == null) set(null); else throw new IllegalArgumentException(_loc.get("cant-set-string", getProperty()).getMessage()); }
/** * The internal value. */ public void set(Object obj) { set(obj, false); }
@Override public boolean beforeConfigurationLoad(Configuration c) { if (c instanceof OpenJPAConfiguration) { ((OpenJPAConfiguration) c).getStoreFacadeTypeRegistry(). registerImplementation(FetchPlan.class, JDBCStoreManager.class, JDBCFetchPlanImpl.class); } if (!(c instanceof JDBCConfigurationImpl)) return false; JDBCConfigurationImpl conf = (JDBCConfigurationImpl) c; String jpa = PersistenceProductDerivation.SPEC_JPA; String ejb = PersistenceProductDerivation.ALIAS_EJB; conf.metaFactoryPlugin.setAlias(ejb, PersistenceMappingFactory.class.getName()); conf.metaFactoryPlugin.setAlias(jpa, PersistenceMappingFactory.class.getName()); conf.mappingFactoryPlugin.setAlias(ejb, PersistenceMappingFactory.class.getName()); conf.mappingFactoryPlugin.setAlias(jpa, PersistenceMappingFactory.class.getName()); conf.mappingDefaultsPlugin.setAlias(ejb, PersistenceMappingDefaults.class.getName()); conf.mappingDefaultsPlugin.setAlias(jpa, PersistenceMappingDefaults.class.getName()); return true; }