Package org.datanucleus

Examples of org.datanucleus.PersistenceConfiguration


     * be in effect.
     * @return properties and hints
     */
    public Set<String> getSupportedProperties()
    {
        PersistenceConfiguration conf =
            ((ObjectManagerFactoryImpl)pmf).getOMFContext().getPersistenceConfiguration();
        return conf.getSupportedOptions();
    }
View Full Code Here


        locationDefinition = ALL_JDO_LOCATIONS;

        // Do we want to use the JDO class initialisation listener ?
        boolean useMetadataListener = false;
        PersistenceConfiguration conf = ctxt.getPersistenceConfiguration();
        if (conf.getStringProperty("datanucleus.PersistenceUnitName") == null &&
            ctxt.getContext() == OMFContext.CONTEXT_PERSISTENCE &&
            conf.getBooleanProperty("datanucleus.metadata.autoregistration"))
        {
            useMetadataListener = true;
        }

        // Log the current configuration
View Full Code Here

    persistenceHandler = new DatastorePersistenceHandler(this);
    dba = new DatastoreAdapter();
    initialiseIdentifierFactory(omfContext);
    setCustomPluginManager();
    addTypeManagerMappings();
    PersistenceConfiguration persistenceConfig = omfContext.getPersistenceConfiguration();
    storageVersion = StorageVersion.fromConfig(persistenceConfig);
    logConfiguration();
  }
View Full Code Here

        pluginMgr, new DatastorePluginRegistry((PluginRegistry) registryField.get(pluginMgr)));
  }

  private static OMFContext addDefaultPropertyValues(OMFContext omfContext) {

    PersistenceConfiguration conf = omfContext.getPersistenceConfiguration();
    // There is only one datastore so set this to true no matter what.
    conf.setProperty("datanucleus.attachSameDatastore", Boolean.TRUE.toString());
    // Only set this if a value has not been provided
    if (conf.getProperty(DatastoreConnectionFactoryImpl.AUTO_CREATE_TXNS_PROPERTY) == null) {
      conf.setProperty(
          DatastoreConnectionFactoryImpl.AUTO_CREATE_TXNS_PROPERTY, Boolean.TRUE.toString());
    }
    // We'd like to respect the user's selection here, but the default value is 1.
    // This is problematic for us in the situation where, for example, an embedded object
    // gets updated more than once in a txn because we end up putting the same
    // entity twice.
    // TODO(maxr) Remove this once we support multiple puts
    conf.setProperty("datanucleus.datastoreTransactionFlushLimit", Integer.MAX_VALUE);
    /*
     * The DataNucleus query cache has a pretty nasty bug where it caches the symbol table along with
     * the compiled query.  The query cache uses weak references so it doesn't always happen, but if
     * you get a cache hit and your param values are different from the param values in the cached
     * symbol table, your query will execute with old param values and return incorrect results.
     */
    conf.setProperty("datanucleus.query.cached", false);
    return omfContext;
  }
View Full Code Here

   * Method to create the IdentifierFactory to be used by this store.
   * Relies on the datastore adapter existing before creation
   * @param omfContext ObjectManagerFactory context
   */
  protected void initialiseIdentifierFactory(OMFContext omfContext) {
    PersistenceConfiguration conf = omfContext.getPersistenceConfiguration();
    String idFactoryName = conf.getStringProperty("datanucleus.identifierFactory");
    String idFactoryClassName = omfContext.getPluginManager()
        .getAttributeValueForExtension("org.datanucleus.store_identifierfactory",
            "name", idFactoryName, "class-name");
    if (idFactoryClassName == null) {
      throw new FatalNucleusUserException(idFactoryName);
View Full Code Here

     * will initialise the "cache" field.
     */
    protected void initialiseQueryCache()
    {
        // Find the query cache class name from its plugin name
        PersistenceConfiguration conf = omfCtx.getPersistenceConfiguration();
        String queryCacheType = conf.getStringProperty("datanucleus.cache.query.type");
        if (queryCacheType != null && !queryCacheType.equalsIgnoreCase("none"))
        {
            String queryCacheClassName = omfCtx.getPluginManager().getAttributeValueForExtension(
                "org.datanucleus.cache_query", "name", queryCacheType, "class-name");
            if (queryCacheClassName == null)
View Full Code Here

public class JDOMetaDataHandlerTest extends TestCase
{
    public void testParseDefaultNamespace()
    {
        MetaDataParser parser = new MetaDataParser(new JDOMetaDataManager(new OMFContext(new PersistenceConfiguration(){})),true);
        MetaData md = parser.parseMetaDataURL(getClass().getResource("/org/datanucleus/metadata/xml/package1.jdo"), "jdo");
        assertNotNull(md);
    }
View Full Code Here

        assertNotNull(md);
    }

    public void testParseNamespace()
    {
        MetaDataParser parser = new MetaDataParser(new JDOMetaDataManager(new OMFContext(new PersistenceConfiguration(){})),true);
        MetaData md = parser.parseMetaDataURL(getClass().getResource("/org/datanucleus/metadata/xml/package2.jdo"), "jdo");
        assertNotNull(md);
    }
View Full Code Here

    /**
     * Test of the valid locations for a specified package.
     */
    public void testLocationsForPackage()
    {
        JDOMetaDataManager mgr = new JDOMetaDataManager(new OMFContext(new PersistenceConfiguration(){}));

        // Try typical JDO package name
        String packageName = "org.jpox.samples";
        List locations = mgr.getValidMetaDataLocationsForPackage("jdo", null, packageName);
        assertTrue("Locations returned from MetaData Manager was null!", locations != null);
View Full Code Here

    /**
     * Test of the valid locations for a specified class.
     */
    public void testLocationsForClass()
    {
        JDOMetaDataManager mgr = new JDOMetaDataManager(new OMFContext(new PersistenceConfiguration(){}));

        // Try typical JDO class name
        String className = "org.jpox.samples.store.Product";
        List locations = mgr.getValidMetaDataLocationsForClass("jdo", null, className);
        assertTrue("Locations returned from MetaData Manager was null!", locations != null);
View Full Code Here

TOP

Related Classes of org.datanucleus.PersistenceConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.