/** * Assert that the given strategy is supported by the current runtime. */ public static void assertSupported(int strategy, MetaDataContext context, String attributeName) { OpenJPAConfiguration conf = context.getRepository().getConfiguration(); boolean supported = true; switch (strategy) { case AUTOASSIGN: supported = conf.supportedOptions().contains (OpenJPAConfiguration.OPTION_VALUE_AUTOASSIGN); break; case INCREMENT: supported = conf.supportedOptions().contains (OpenJPAConfiguration.OPTION_VALUE_INCREMENT); break; case NATIVE: supported = context instanceof ClassMetaData; break; } if (!supported) throw new MetaDataException(_loc.get("unsupported-value-strategy", context, getName(strategy), attributeName)); } }
/** * Assert that the given strategy is supported by the current runtime. */ public static void assertSupported(int strategy, MetaDataContext context, String attributeName) { OpenJPAConfiguration conf = context.getRepository().getConfiguration(); boolean supported = true; switch (strategy) { case AUTOASSIGN: supported = conf.supportedOptions().contains (OpenJPAConfiguration.OPTION_VALUE_AUTOASSIGN); break; case INCREMENT: supported = conf.supportedOptions().contains (OpenJPAConfiguration.OPTION_VALUE_INCREMENT); break; case NATIVE: supported = context instanceof ClassMetaData; break; } if (!supported) throw new MetaDataException(_loc.get("unsupported-value-strategy", context, getName(strategy), attributeName)); } }
public Object getConnection() { assertOpen(); if (!_conf.supportedOptions().contains (OpenJPAConfiguration.OPTION_DATASTORE_CONNECTION)) throw new UnsupportedException(_loc.get("conn-not-supported")); return _store.getClientConnection(); }
public Object getConnection() { assertOpen(); if (!_conf.supportedOptions().contains (OpenJPAConfiguration.OPTION_DATASTORE_CONNECTION)) throw new UnsupportedException(_loc.get("conn-not-supported")); return _store.getClientConnection(); }
public Object getConnection() { assertOpen(); if (!_conf.supportedOptions().contains (_conf.OPTION_DATASTORE_CONNECTION)) throw new UnsupportedException(_loc.get("conn-not-supported")); return _store.getClientConnection(); }
public Object getConnection() { assertOpen(); if (!_conf.supportedOptions().contains (OpenJPAConfiguration.OPTION_DATASTORE_CONNECTION)) throw new UnsupportedException(_loc.get("conn-not-supported")); return _store.getClientConnection(); }
public Object getConnection() { assertOpen(); if (!_conf.supportedOptions().contains (OpenJPAConfiguration.OPTION_DATASTORE_CONNECTION)) throw new UnsupportedException(_loc.get("conn-not-supported")); return _store.getClientConnection(); }
public void setNontransactionalRead(boolean val) { assertOpen(); if ((_flags & FLAG_PRESTORING) != 0) throw new UserException(_loc.get("illegal-op-in-prestore")); // make sure the runtime supports it if (val && !_conf.supportedOptions().contains (OpenJPAConfiguration.OPTION_NONTRANS_READ)) throw new UnsupportedException(_loc.get ("nontrans-read-not-supported")); _nontransRead = val; }
public void setNontransactionalRead(boolean val) { assertOpen(); if ((_flags & FLAG_PRESTORING) != 0) throw new UserException(_loc.get("illegal-op-in-prestore")); // make sure the runtime supports it if (val && !_conf.supportedOptions().contains (OpenJPAConfiguration.OPTION_NONTRANS_READ)) throw new UnsupportedException(_loc.get ("nontrans-read-not-supported")); _nontransRead = val; }
public void setNontransactionalRead(boolean val) { assertOpen(); if ((_flags & FLAG_PRESTORING) != 0) throw new UserException(_loc.get("illegal-op-in-prestore")); // make sure the runtime supports it if (val && !_conf.supportedOptions().contains (_conf.OPTION_NONTRANS_READ)) throw new UnsupportedException(_loc.get ("nontrans-read-not-supported")); _nontransRead = val; }
public void setOptimistic(boolean val) { assertOpen(); if ((_flags & FLAG_ACTIVE) != 0) throw new InvalidStateException(_loc.get("trans-active", "Optimistic")); // make sure the runtime supports it if (val && !_conf.supportedOptions().contains(OpenJPAConfiguration.OPTION_OPTIMISTIC)) throw new UnsupportedException(_loc.get ("optimistic-not-supported")); _optimistic = val; }
public void setOptimistic(boolean val) { assertOpen(); if ((_flags & FLAG_ACTIVE) != 0) throw new InvalidStateException(_loc.get("trans-active", "Optimistic")); // make sure the runtime supports it if (val && !_conf.supportedOptions().contains(OpenJPAConfiguration.OPTION_OPTIMISTIC)) throw new UnsupportedException(_loc.get ("optimistic-not-supported")); _optimistic = val; }
public void setOptimistic(boolean val) { assertOpen(); if ((_flags & FLAG_ACTIVE) != 0) throw new InvalidStateException(_loc.get("trans-active", "Optimistic")); // make sure the runtime supports it if (val && !_conf.supportedOptions().contains(OpenJPAConfiguration.OPTION_OPTIMISTIC)) throw new UnsupportedException(_loc.get ("optimistic-not-supported")); _optimistic = val; }
public void setNontransactionalRead(boolean val) { assertOpen(); if ((_flags & FLAG_PRESTORING) != 0) throw new UserException(_loc.get("illegal-op-in-prestore")); // make sure the runtime supports it if (val && !_conf.supportedOptions().contains (OpenJPAConfiguration.OPTION_NONTRANS_READ)) throw new UnsupportedException(_loc.get ("nontrans-read-not-supported")); _nontransRead = val; }
public void setOptimistic(boolean val) { assertOpen(); if ((_flags & FLAG_ACTIVE) != 0) throw new InvalidStateException(_loc.get("trans-active", "Optimistic")); // make sure the runtime supports it if (val && !_conf.supportedOptions().contains(OpenJPAConfiguration.OPTION_OPTIMISTIC)) throw new UnsupportedException(_loc.get ("optimistic-not-supported")); _optimistic = val; }
public void setOptimistic(boolean val) { assertOpen(); if ((_flags & FLAG_ACTIVE) != 0) throw new InvalidStateException(_loc.get("trans-active", "Optimistic")); // make sure the runtime supports it if (val && !_conf.supportedOptions().contains(_conf.OPTION_OPTIMISTIC)) throw new UnsupportedException(_loc.get ("optimistic-not-supported")); _optimistic = val; }
public void setNontransactionalRead(boolean val) { assertOpen(); if ((_flags & FLAG_PRESTORING) != 0) throw new UserException(_loc.get("illegal-op-in-prestore")); // make sure the runtime supports it if (val && !_conf.supportedOptions().contains (OpenJPAConfiguration.OPTION_NONTRANS_READ)) throw new UnsupportedException(_loc.get ("nontrans-read-not-supported")); _nontransRead = val; }
/** * Factory method for constructing a {@link BrokerFactory} * from properties. Invoked from {@link Bootstrap#newBrokerFactory()}. */ public static AbstractStoreBrokerFactory newInstance (ConfigurationProvider cp) { // use a tmp store manager to get metadata about the capabilities of // this runtime Map map = cp.getProperties(); String storePlugin = (String) map.get(ProductDerivations .getConfigurationKey(PROP_ABSTRACT_STORE, map)); String storeCls = Configurations.getClassName(storePlugin); String storeProps = Configurations.getProperties(storePlugin); AbstractStoreManager store = createStoreManager(storeCls, storeProps); // populate configuration OpenJPAConfiguration conf = store.newConfiguration(); cp.setInto(conf); conf.supportedOptions().removeAll(store.getUnsupportedOptions()); // create and pool a new factory return new AbstractStoreBrokerFactory(conf, storeCls, storeProps, store.getPlatform()); }
/** * Factory method for constructing a {@link BrokerFactory} * from properties. Invoked from {@link Bootstrap#newBrokerFactory()}. */ public static AbstractStoreBrokerFactory newInstance (ConfigurationProvider cp) { // use a tmp store manager to get metadata about the capabilities of // this runtime Map map = cp.getProperties(); String storePlugin = (String) map.get(ProductDerivations .getConfigurationKey(PROP_ABSTRACT_STORE, map)); String storeCls = Configurations.getClassName(storePlugin); String storeProps = Configurations.getProperties(storePlugin); AbstractStoreManager store = createStoreManager(storeCls, storeProps); // populate configuration OpenJPAConfiguration conf = store.newConfiguration(); cp.setInto(conf); conf.supportedOptions().removeAll(store.getUnsupportedOptions()); // create and pool a new factory return new AbstractStoreBrokerFactory(conf, storeCls, storeProps, store.getPlatform()); }
/** * Factory method for constructing a {@link BrokerFactory} * from properties. Invoked from {@link Bootstrap#newBrokerFactory()}. */ public static AbstractStoreBrokerFactory newInstance (ConfigurationProvider cp) { // use a tmp store manager to get metadata about the capabilities of // this runtime Map map = cp.getProperties(); String storePlugin = (String) map.get(ProductDerivations .getConfigurationKey(PROP_ABSTRACT_STORE, map)); String storeCls = Configurations.getClassName(storePlugin); String storeProps = Configurations.getProperties(storePlugin); AbstractStoreManager store = createStoreManager(storeCls, storeProps); // populate configuration OpenJPAConfiguration conf = store.newConfiguration(); cp.setInto(conf); conf.supportedOptions().removeAll(store.getUnsupportedOptions()); // create and pool a new factory return new AbstractStoreBrokerFactory(conf, storeCls, storeProps, store.getPlatform()); }