Package org.datanucleus.store.types

Examples of org.datanucleus.store.types.TypeManager


        ClassLoaderResolver clr = new JDOClassLoaderResolver();
        Properties props = new Properties();
        props.setProperty("bundle-check-action", "EXCEPTION");
        PluginManager pluginMgr = new PluginManager(null, clr, props);

        typeMgr = new TypeManager(null, pluginMgr, clr);
    }
View Full Code Here


        }

        // Initialise support for API, java types over the top of plugin support
        this.apiAdapter = ApiAdapterFactory.getInstance().getApiAdapter(apiName, pluginManager);
        config.setDefaultProperties(apiAdapter.getDefaultFactoryProperties());
        this.typeManager = new TypeManager(apiAdapter, this.pluginManager, getClassLoaderResolver(null));

        if (type == ContextType.PERSISTENCE)
        {
            // Register the StateManager class with JDOImplHelper for security
            AccessController.doPrivileged(new PrivilegedAction()
View Full Code Here

            // If we have a current value, use the actual type to define the wrapper type
            typeName = value.getClass().getName();
        }

        // Find the SCO wrapper type most suitable
        TypeManager typeMgr = ownerOP.getExecutionContext().getNucleusContext().getTypeManager();
        StoreManager storeMgr = ownerOP.getExecutionContext().getStoreManager();
        boolean fullWrapper = (storeMgr instanceof BackedSCOStoreManager);
        Class wrapperType = null;
        if (fullWrapper)
        {
            wrapperType = typeMgr.getWrappedTypeBackedForType(typeName);
        }
        else
        {
            wrapperType = typeMgr.getWrapperTypeForType(typeName);
        }

        if (wrapperType == null)
        {
            if (value != null && typeMgr.isSecondClassWrapper(typeName))
            {
                // The passed in value is a wrapper type already, so just return it!
                SCO sco = (SCO)value;
                if (replaceField)
                {
                    // Replace the field with this value
                    ownerOP.replaceField(fmd.getAbsoluteFieldNumber(), sco);
                }
                return sco;
            }
            else
            {
                // typeName not supported directly (no SCO wrapper for the precise type)
                if (instantiatedType != null)
                {
                    // Try the instantiated type
                    if (fullWrapper)
                    {
                        wrapperType = typeMgr.getWrappedTypeBackedForType(instantiatedType.getName());
                    }
                    else
                    {
                        wrapperType = typeMgr.getWrapperTypeForType(instantiatedType.getName());
                    }
                }
                if (wrapperType == null)
                {
                    // Try the declared type
                    if (fullWrapper)
                    {
                        wrapperType = typeMgr.getWrappedTypeBackedForType(declaredType.getName());
                    }
                    else
                    {
                        wrapperType = typeMgr.getWrapperTypeForType(declaredType.getName());
                    }
                }
            }
        }
        if (wrapperType == null)
View Full Code Here

          // User-defined TypeConverter
          TypeConverter conv = ec.getTypeManager().getTypeConverterForName(mmd.getTypeConverterName());
          value = conv.toMemberType(value);
        } else {
          // Perform any conversions from the stored-type to the field type
          TypeManager typeMgr = ec.getNucleusContext().getTypeManager();
          value = ((DatastoreManager) ec.getStoreManager()).getTypeConversionUtils()
              .datastoreValueToPojoValue(typeMgr, clr, value, mmd);
        }

        if (value != null && !(value instanceof SCO)) {
View Full Code Here

      // Basic field
      if (value == null) {
        checkSettingToNullValue(mmd, value);
      } else {
        // Perform any conversions from the field type to the stored-type
        TypeManager typeMgr = ec.getNucleusContext().getTypeManager();
        value = ((DatastoreManager) ec.getStoreManager())
            .getTypeConversionUtils()
            .pojoValueToDatastoreValue(typeMgr, clr, value, mmd);

        if (value instanceof SCO) {
View Full Code Here

        ClassLoaderResolver clr = new JDOClassLoaderResolver();
        PluginManager pluginMgr = new PluginManager(new PersistenceConfiguration() {}, clr);
        pluginMgr.registerExtensionPoints();
        pluginMgr.registerExtensions();
        pluginMgr.resolveConstraints();
        typeMgr = new TypeManager(api, pluginMgr, clr);
    }
View Full Code Here

        // Load up any default properties from the plugins
        persistenceConfig.setDefaultProperties(pluginManager);

        // Initialise support for API, java types
        this.apiAdapter = ApiAdapterFactory.getInstance().getApiAdapter(apiName, pluginManager);
        this.typeManager = new TypeManager(apiAdapter, this.pluginManager, getClassLoaderResolver(null));

        if (context == CONTEXT_PERSISTENCE)
        {
            // Initialise support for JMX, transactions, connections, and queries
            this.jmxManager = getJMXManager();
View Full Code Here

            // If we have a current value, use the actual type to define the wrapper type
            typeName = value.getClass().getName();
        }

        // Find the SCO wrapper type most suitable
        TypeManager typeMgr = fmd.getMetaDataManager().getOMFContext().getTypeManager();
        boolean fullWrapper = ownerSM.getStoreManager().getSupportedOptions().contains("BackedSCO");
        Class wrapperType = null;
        if (fullWrapper)
        {
            wrapperType = typeMgr.getWrappedTypeBackedForType(typeName);
        }
        else
        {
            wrapperType = typeMgr.getWrapperTypeForType(typeName);
        }

        if (wrapperType == null)
        {
            if (value != null && typeMgr.isSecondClassWrapper(typeName))
            {
                // The passed in value is a wrapper type already, so just return it!
                SCO sco = (SCO)value;
                if (replaceField)
                {
                    // Replace the field with this value
                    ownerSM.replaceField(fmd.getAbsoluteFieldNumber(), sco, false);
                }
                return sco;
            }
            else
            {
                // typeName not supported directly (no SCO wrapper for the precise type)
                if (instantiatedType != null)
                {
                    // Try the instantiated type
                    if (fullWrapper)
                    {
                        wrapperType = typeMgr.getWrappedTypeBackedForType(instantiatedType.getName());
                    }
                    else
                    {
                        wrapperType = typeMgr.getWrapperTypeForType(instantiatedType.getName());
                    }
                }
                if (wrapperType == null)
                {
                    // Try the declared type
                    if (fullWrapper)
                    {
                        wrapperType = typeMgr.getWrappedTypeBackedForType(declaredType.getName());
                    }
                    else
                    {
                        wrapperType = typeMgr.getWrapperTypeForType(declaredType.getName());
                    }
                }
            }
        }
        if (wrapperType == null)
View Full Code Here

        MappedType type = getMappedType(className);
        if (type == null)
        {
            // Check if this is a SCO wrapper
            TypeManager typeMgr = omfCtx.getTypeManager();
            Class cls = typeMgr.getTypeForSecondClassWrapper(className);
            if (cls != null)
            {
                // Supplied class is a SCO wrapper, so return the java type mapping for the underlying java type
                type = getMappedType(cls.getName());
                if (type != null)
View Full Code Here

TOP

Related Classes of org.datanucleus.store.types.TypeManager

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.