@SuppressWarnings("deprecation") private TransactionOptions createDatastoreTransactionOptionsPrototype( PersistenceConfiguration persistenceConfig) { // return TransactionOptions.Builder.withXG( return TransactionOptions.Builder.allowMultipleEntityGroups( persistenceConfig.getBooleanProperty(DATASTORE_ENABLE_XG_TXNS_PROPERTY)); }
/** * Creates an object manager with datastore credentials. * * @param omf the object manager factory * @param owner the owning persistence manager or entity manager * @param userName the username to the datastore * @param password the password to the datastore */ public ForceObjectManagerImpl(ObjectManagerFactoryImpl omf, Object owner, String userName, String password) { super(omf, owner, userName, password); this.allOrNothingEnabled = omf.getOMFContext().getPersistenceConfiguration().getBooleanProperty("force.AllOrNothing"); }
/** * Creates an object manager with datastore credentials. * * @param omf the object manager factory * @param owner the owning persistence manager or entity manager * @param userName the username to the datastore * @param password the password to the datastore */ public ForceObjectManagerImpl(ObjectManagerFactoryImpl omf, Object owner, String userName, String password) { super(omf, owner, userName, password); this.allOrNothingEnabled = omf.getOMFContext().getPersistenceConfiguration().getBooleanProperty("force.AllOrNothing"); }
private boolean getBooleanConfigProperty(String configProperty) { return metaDataManager.getNucleusContext().getPersistenceConfiguration().getBooleanProperty(configProperty); }
/** * Constructs a connection factory for the datastore. * Provides ManagedConnections to communicate with the datastore. * * @param storeMgr The store manager * @param resourceType Name of the resource ("appengine", "appengine-nontx") */ public DatastoreConnectionFactoryImpl(StoreManager storeMgr, String resourceType) { super(storeMgr, resourceType); PersistenceConfiguration conf = storeMgr.getNucleusContext().getPersistenceConfiguration(); if (conf.getProperty(DatastoreConnectionFactoryImpl.AUTO_CREATE_TXNS_PROPERTY) == null) { // User hasn't configured the "auto-create" property, so set it conf.setProperty(DatastoreConnectionFactoryImpl.AUTO_CREATE_TXNS_PROPERTY, Boolean.TRUE.toString()); } this.isAutoCreateTransaction = conf.getBooleanProperty(AUTO_CREATE_TXNS_PROPERTY); }
/** * Convenience method to throw the supplied exception. * If the supplied exception is a PersistenceException then also marks the current transaction for rollback. * @param re The exception */ private Object throwException(RuntimeException re) { if (re instanceof PersistenceException) { PersistenceConfiguration conf = om.getOMFContext().getPersistenceConfiguration(); boolean markForRollback = conf.getBooleanProperty("datanucleus.jpa.txnMarkForRollbackOnException"); if (markForRollback) { // The JPA spec says that all PersistenceExceptions thrown should mark the transaction for // rollback. Seems stupid to me. e.g you try to find an object with a particular id and it // doesn't exist so you then have to rollback the txn and start again. FFS. getTransaction().setRollbackOnly(); } } throw re; }
/** * Convenience method to throw the supplied exception. * If the supplied exception is a PersistenceException, also mark the current transaction for rollback. * @param re The exception */ private Object throwException(RuntimeException re) { if (re instanceof PersistenceException) { PersistenceConfiguration conf = om.getOMFContext().getPersistenceConfiguration(); boolean markForRollback = conf.getBooleanProperty("datanucleus.jpa.txnMarkForRollbackOnException"); if (markForRollback) { // The JPA spec says that all PersistenceExceptions thrown should mark the transaction for // rollback. Seems excessive to me. For example, you try to find an object with a particular id and it // doesn't exist so you then have to rollback the txn and start again. getTransaction().setRollbackOnly(); } } throw re; } }
/** * Convenience method to throw the supplied exception. * If the supplied exception is a PersistenceException, also mark the current transaction for rollback. * @param re The exception */ private Object throwException(RuntimeException re) { if (re instanceof PersistenceException) { PersistenceConfiguration conf = om.getOMFContext().getPersistenceConfiguration(); boolean markForRollback = conf.getBooleanProperty("datanucleus.jpa.txnMarkForRollbackOnException"); if (markForRollback) { // The JPA spec says that all PersistenceExceptions thrown should mark the transaction for // rollback. Seems excessive to me. For example, you try to find an object with a particular id and it // doesn't exist so you then have to rollback the txn and start again. getTransaction().setRollbackOnly(); } } throw re; } }
boolean loadClasses = omfCtx.getPersistenceConfiguration().getBooleanProperty("datanucleus.persistenceUnitLoadClasses"); if (loadClasses)
boolean autoCreateSchema = conf.getBooleanProperty("datanucleus.autoCreateSchema"); if (autoCreateSchema) { autoCreateTables = true; autoCreateColumns = true; } else { autoCreateTables = conf.getBooleanProperty("datanucleus.autoCreateTables"); autoCreateColumns = conf.getBooleanProperty("datanucleus.autoCreateColumns"); autoCreateWarnOnError = conf.getBooleanProperty("datanucleus.autoCreateWarnOnError"); forDelete = conf.getBooleanProperty("force.deleteSchema"); boolean purgeOnDelete = conf.getBooleanProperty("force.purgeOnDeleteSchema");
boolean autoCreateSchema = conf.getBooleanProperty("datanucleus.autoCreateSchema"); if (autoCreateSchema) { autoCreateTables = true; autoCreateColumns = true; } else { autoCreateTables = conf.getBooleanProperty("datanucleus.autoCreateTables"); autoCreateColumns = conf.getBooleanProperty("datanucleus.autoCreateColumns"); autoCreateWarnOnError = conf.getBooleanProperty("datanucleus.autoCreateWarnOnError"); forDelete = conf.getBooleanProperty("force.deleteSchema"); boolean purgeOnDelete = conf.getBooleanProperty("force.purgeOnDeleteSchema");
omfCtx.getPersistenceConfiguration().getBooleanProperty("datanucleus.metadata.allowLoadAtRuntime"); if (!allowMetadataLoad)
omfCtx.getPersistenceConfiguration().getBooleanProperty("datanucleus.metadata.allowLoadAtRuntime"); if (!allowMetadataLoad)
/** * Instantiates the connections to the Force.com service. It either reads the configs * from thread local (which would have been set from OAuth) or it gets the config from * the store manager. * {@inheritDoc} */ @Override public ManagedConnection createManagedConnection(Object poolKey, Map transactionOptions) { ForceStoreManager storeManager = (ForceStoreManager) omfContext.getStoreManager(); ForceServiceConnector connector = new ForceServiceConnector(); // A ConnectorConfig might have been set via OAuth in which case we should be // using that. ForceConnectorConfig tlConfig; if ((tlConfig = ForceServiceConnector.getThreadLocalConnectorConfig()) != null) { connector.setConnectorConfig(tlConfig); } else { connector.setConnectorConfig(storeManager.getConfig()); } connector.setConnectionName(omfContext.getPersistenceConfiguration().getStringProperty("force.ConnectionName")); connector.setClientId(ForceServiceConnector.API_USER_AGENT); connector.setTimeout(omfContext.getPersistenceConfiguration().getIntProperty("datanucleus.datastoreReadTimeout")); connector.setSkipCache(omfContext.getPersistenceConfiguration() .getBooleanProperty("force.skipConfigCache", false /* resultIfNotSet */)); return new ForceManagedConnection(connector); } }
/** * Instantiates the connections to the Force.com service. It either reads the configs * from thread local (which would have been set from OAuth) or it gets the config from * the store manager. * {@inheritDoc} */ @Override public ManagedConnection createManagedConnection(Object poolKey, Map transactionOptions) { ForceStoreManager storeManager = (ForceStoreManager) omfContext.getStoreManager(); ForceServiceConnector connector = new ForceServiceConnector(); // A ConnectorConfig might have been set via OAuth in which case we should be // using that. ForceConnectorConfig tlConfig; if ((tlConfig = ForceServiceConnector.getThreadLocalConnectorConfig()) != null) { connector.setConnectorConfig(tlConfig); } else { connector.setConnectorConfig(storeManager.getConfig()); } connector.setConnectionName(omfContext.getPersistenceConfiguration().getStringProperty("force.ConnectionName")); connector.setClientId(ForceServiceConnector.API_USER_AGENT); connector.setTimeout(omfContext.getPersistenceConfiguration().getIntProperty("datanucleus.datastoreReadTimeout")); connector.setSkipCache(omfContext.getPersistenceConfiguration() .getBooleanProperty("force.skipConfigCache", false /* resultIfNotSet */)); return new ForceManagedConnection(connector); } }