/** * Property string mapping field type names to value handler or field * mapping class names. For auto-configuration. */ public void setFieldStrategies(String fieldMapString) { Properties props = Configurations.parseProperties(fieldMapString); if (props != null) _fieldMap.putAll(props); }
public void setValidationPolicy(String policy) throws InstantiationException, IllegalAccessException { String name = Configurations.getClassName(policy); String props = Configurations.getProperties(policy); _validationPolicy = (ValidationPolicy) Configurations.newInstance(name, _conf, props, null); }
/** * Create and configure an instance with the given class name and * properties. */ public static Object newInstance(String clsName, Configuration conf, Properties props, ClassLoader loader) { Object obj = newInstance(clsName, null, conf, loader, true); configureInstance(obj, conf, props); return obj; }
public void setString(String str) { assertChangeable(); _name = Configurations.getClassName(str); _name = unalias(_name); _props = Configurations.getProperties(str); if (_singleton) set(null, true); valueChanged(); }
public static boolean needsPreload(OpenJPAConfiguration conf) { if (conf == null) return false; Options o = Configurations.parseProperties(Configurations.getProperties(conf.getMetaDataRepository())); if (o.getBooleanProperty(PRELOAD_STR) == true || o.getBooleanProperty(PRELOAD_STR.toLowerCase()) == true) { return true; } return false; }
PersistenceProductDerivation pd = new PersistenceProductDerivation(); try { Object poolValue = Configurations.removeProperty(EMF_POOL, m); ConfigurationProvider cp = pd.load(pui, m); if (cp == null) String ctOpts = (String) Configurations.getProperty (CLASS_TRANSFORMER_OPTIONS, pui.getProperties()); try { if (!Configurations.containsProperty(BrokerValue.KEY, cp.getProperties())) { cp.addProperty("openjpa." + BrokerValue.KEY,
OSGiPersistenceProductDerivation pd = new OSGiPersistenceProductDerivation(); try { Object poolValue = Configurations.removeProperty(EMF_POOL, m); if(classLoaderManager == null){ throw new PersistenceException("OSGiAwareClasssLoaderManager null.", null, null, true); Options o = Configurations.parseProperties(Configurations.getProperties(conf.getMetaDataRepository())); if(o.getBooleanProperty("Preload")){ conf.getMetaDataRepositoryInstance().preload();
/** * Run the tool. Returns false if invalid options were given. */ public static boolean run(JDBCConfiguration conf, String[] args, Options opts) throws Exception { String action = opts.removeProperty("action", "a", null); Configurations.populateConfiguration(conf, opts); return run(conf, args, action, null, null); }
/** * Configures the given object with the given properties by * matching the properties string to the object's setter * methods. Does not validate that setter methods exist for the properties. * * @throws RuntimeException on configuration error */ public static void configureInstance(Object obj, Configuration conf, Properties properties) { configureInstance(obj, conf, properties, null); }
/** * Run the tool. */ public static boolean run(JDBCConfiguration conf, String action) throws IOException, SQLException { // run the action TableSchemaFactory factory = new TableSchemaFactory(); String props = Configurations.getProperties(conf.getSchemaFactory()); Configurations.configureInstance(factory, conf, props); if (ACTION_DROP.equals(action)) factory.dropTable(); else if (ACTION_ADD.equals(action)) factory.refreshTable(); else return false; return true; } }
public void valueChanged(Value val) { if (_changeSupport == null && _props == null) return; String newString = val.getString(); if (_changeSupport != null) _changeSupport.firePropertyChange(val.getProperty(), null, newString); // keep cached props up to date if (_props != null) { if (newString == null) Configurations.removeProperty(val.getProperty(), _props); else if (Configurations.containsProperty(val, _props) || val.getDefault() == null || !val.getDefault().equals(newString)) setValue(_props, val); } }
/** * Run the tool. Returns false if invalid options given. Runs against all * the persistence units defined in the resource to parse. */ public static boolean run(final String[] args, Options opts) { return Configurations.runAgainstAllAnchors(opts, new Configurations.Runnable() { public boolean run(Options opts) throws IOException { OpenJPAConfiguration conf = new OpenJPAConfigurationImpl(); try { return PCEnhancer.run(conf, args, opts); } finally { conf.close(); } } }); }
/** * Return an internal factory pool key for the given configuration. * * @since 1.1.0 */ protected static Object toPoolKey(Map<String,Object> map) { Object key = Configurations.getProperty("Id", map); return ( key != null) ? key : map; }
public static void removeProperty(String partialKey, Map<?,?> remaining, Map<?,?> props) { if (removeProperty(partialKey, remaining) != null) { removeProperty(partialKey, props); } }
/** * Remove the property under the given partial key, prefixed with any * possible configuration prefix. */ public static Object removeProperty(String partialKey, Map props) { if (partialKey == null || props == null || props.isEmpty()) return null; if (containsProperty(partialKey, props)) return props.remove(ProductDerivations.getConfigurationKey(partialKey, props)); else return null; }
/** * Create the instance with the given class name, using the given * class loader. No configuration of the instance is performed by * this method. */ public static Object newInstance(String clsName, ClassLoader loader) { return newInstance(clsName, null, null, loader, true); }
public void setString(String str) { assertChangeable(); _name = Configurations.getClassName(str); _name = unalias(_name); _props = Configurations.getProperties(str); if (_singleton) set(null, true); valueChanged(); }
public static boolean needsPreload(OpenJPAConfiguration conf) { if (conf == null) return false; Options o = Configurations.parseProperties(Configurations.getProperties(conf.getMetaDataRepository())); if (o.getBooleanProperty(PRELOAD_STR) == true || o.getBooleanProperty(PRELOAD_STR.toLowerCase()) == true) { return true; } return false; }
public OpenJPAEntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo pui, Map m) { PersistenceProductDerivation pd = new PersistenceProductDerivation(); try { Object poolValue = Configurations.removeProperty(EMF_POOL, m); ConfigurationProvider cp = pd.load(pui, m); if (cp == null) String ctOpts = (String) Configurations.getProperty(CLASS_TRANSFORMER_OPTIONS, pui.getProperties()); try { pui.addTransformer(new ClassTransformerImpl(cp, ctOpts, if (!Configurations.containsProperty(BrokerValue.KEY, cp.getProperties())) { cp.addProperty("openjpa." + BrokerValue.KEY, getDefaultBrokerAlias());
/** * Run the tool. Returns false if invalid options were given. */ public static boolean run(JDBCConfiguration conf, String[] args, Options opts) throws Exception { String action = opts.removeProperty("action", "a", null); Configurations.populateConfiguration(conf, opts); return run(conf, args, action, null, null); }