示例#1
0
        /// <summary>
        /// Creates interop cache store from a stream.
        /// </summary>
        /// <param name="memPtr">Memory pointer.</param>
        /// <param name="registry">The handle registry.</param>
        /// <returns>
        /// Interop cache store.
        /// </returns>
        internal static CacheStore CreateInstance(long memPtr, HandleRegistry registry)
        {
            using (var stream = IgniteManager.Memory.Get(memPtr).GetStream())
            {
                var reader = BinaryUtils.Marshaller.StartUnmarshal(stream);

                var convertBinary = reader.ReadBoolean();
                var factory       = reader.ReadObject <IFactory <ICacheStore> >();

                ICacheStore store;

                if (factory != null)
                {
                    store = factory.CreateInstance();
                }
                else
                {
                    var className   = reader.ReadString();
                    var propertyMap = reader.ReadDictionaryAsGeneric <string, object>();

                    store = IgniteUtils.CreateInstance <ICacheStore>(className, propertyMap);
                }


                return(new CacheStore(store, convertBinary, registry));
            }
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CacheStore" /> class.
        /// </summary>
        /// <param name="store">Store.</param>
        /// <param name="registry">The handle registry.</param>
        private CacheStore(ICacheStoreInternal store, HandleRegistry registry)
        {
            Debug.Assert(store != null);

            _store = store;

            _handle = registry.AllocateCritical(this);
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CacheStore" /> class.
        /// </summary>
        /// <param name="store">Store.</param>
        /// <param name="convertBinary">Whether to convert binary objects.</param>
        /// <param name="registry">The handle registry.</param>
        private CacheStore(ICacheStore store, bool convertBinary, HandleRegistry registry)
        {
            Debug.Assert(store != null);

            _store = store;
            _convertBinary = convertBinary;

            _sesProxy = new CacheStoreSessionProxy();

            ResourceProcessor.InjectStoreSession(store, _sesProxy);

            _handle = registry.AllocateCritical(this);
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CacheStore" /> class.
        /// </summary>
        /// <param name="store">Store.</param>
        /// <param name="convertBinary">Whether to convert binary objects.</param>
        /// <param name="registry">The handle registry.</param>
        private CacheStore(ICacheStore store, bool convertBinary, HandleRegistry registry)
        {
            Debug.Assert(store != null);

            _store         = store;
            _convertBinary = convertBinary;

            _sesProxy = new CacheStoreSessionProxy();

            ResourceProcessor.InjectStoreSession(store, _sesProxy);

            _handle = registry.AllocateCritical(this);
        }
示例#5
0
        /// <summary>
        /// Creates interop cache store from a stream.
        /// </summary>
        /// <param name="memPtr">Memory pointer.</param>
        /// <param name="registry">The handle registry.</param>
        /// <returns>
        /// Interop cache store.
        /// </returns>
        internal static CacheStore CreateInstance(long memPtr, HandleRegistry registry)
        {
            using (var stream = IgniteManager.Memory.Get(memPtr).GetStream())
            {
                var reader = BinaryUtils.Marshaller.StartUnmarshal(stream, BinaryMode.KeepBinary);

                var className     = reader.ReadString();
                var convertBinary = reader.ReadBoolean();
                var propertyMap   = reader.ReadDictionaryAsGeneric <string, object>();

                var store = IgniteUtils.CreateInstance <ICacheStore>(className);

                IgniteUtils.SetProperties(store, propertyMap);

                return(new CacheStore(store, convertBinary, registry));
            }
        }
示例#6
0
        /// <summary>
        /// Prepare callback invoked from Java.
        /// </summary>
        /// <param name="inStream">Intput stream with data.</param>
        /// <param name="outStream">Output stream.</param>
        /// <param name="handleRegistry">Handle registry.</param>
        internal static void OnPrepare(PlatformMemoryStream inStream, PlatformMemoryStream outStream,
                                       HandleRegistry handleRegistry)
        {
            try
            {
                PortableReaderImpl reader = PU.Marshaller.StartUnmarshal(inStream);

                PrepareConfiguration(reader.ReadObject <InteropDotNetConfiguration>());

                PrepareLifecycleBeans(reader, outStream, handleRegistry);
            }
            catch (Exception e)
            {
                _startup.Error = e;

                throw;
            }
        }
示例#7
0
        /// <summary>
        /// Prepare callback invoked from Java.
        /// </summary>
        /// <param name="inStream">Intput stream with data.</param>
        /// <param name="outStream">Output stream.</param>
        /// <param name="handleRegistry">Handle registry.</param>
        internal static void OnPrepare(PlatformMemoryStream inStream, PlatformMemoryStream outStream,
                                       HandleRegistry handleRegistry)
        {
            try
            {
                BinaryReader reader = BinaryUtils.Marshaller.StartUnmarshal(inStream);

                PrepareConfiguration(reader);

                PrepareLifecycleBeans(reader, outStream, handleRegistry);
            }
            catch (Exception e)
            {
                _startup.Error = e;

                throw;
            }
        }
示例#8
0
        /// <summary>
        /// Creates interop cache store from a stream.
        /// </summary>
        /// <param name="memPtr">Memory pointer.</param>
        /// <param name="registry">The handle registry.</param>
        /// <returns>
        /// Interop cache store.
        /// </returns>
        internal static CacheStore CreateInstance(long memPtr, HandleRegistry registry)
        {
            using (var stream = IgniteManager.Memory.Get(memPtr).Stream())
            {
                var reader = PortableUtils.Marshaller.StartUnmarshal(stream, PortableMode.KeepPortable);

                var assemblyName    = reader.ReadString();
                var className       = reader.ReadString();
                var convertPortable = reader.ReadBoolean();
                var propertyMap     = reader.ReadGenericDictionary <string, object>();

                var store = (ICacheStore)IgniteUtils.CreateInstance(assemblyName, className);

                IgniteUtils.SetProperties(store, propertyMap);

                return(new CacheStore(store, convertPortable, registry));
            }
        }
示例#9
0
        /// <summary>
        /// Prepare lifecycle beans.
        /// </summary>
        /// <param name="reader">Reader.</param>
        /// <param name="outStream">Output stream.</param>
        /// <param name="handleRegistry">Handle registry.</param>
        private static void PrepareLifecycleBeans(BinaryReader reader, PlatformMemoryStream outStream,
                                                  HandleRegistry handleRegistry)
        {
            IList <LifecycleBeanHolder> beans = new List <LifecycleBeanHolder>
            {
                new LifecycleBeanHolder(new InternalLifecycleBean())   // add internal bean for events
            };

            // 1. Read beans defined in Java.
            int cnt = reader.ReadInt();

            for (int i = 0; i < cnt; i++)
            {
                beans.Add(new LifecycleBeanHolder(CreateLifecycleBean(reader)));
            }

            // 2. Append beans definied in local configuration.
            ICollection <ILifecycleBean> nativeBeans = _startup.Configuration.LifecycleBeans;

            if (nativeBeans != null)
            {
                foreach (ILifecycleBean nativeBean in nativeBeans)
                {
                    beans.Add(new LifecycleBeanHolder(nativeBean));
                }
            }

            // 3. Write bean pointers to Java stream.
            outStream.WriteInt(beans.Count);

            foreach (LifecycleBeanHolder bean in beans)
            {
                outStream.WriteLong(handleRegistry.AllocateCritical(bean));
            }

            outStream.SynchronizeOutput();

            // 4. Set beans to STARTUP object.
            _startup.LifecycleBeans = beans;
        }
示例#10
0
        /// <summary>
        /// Prepare callback invoked from Java.
        /// </summary>
        /// <param name="inStream">Input stream with data.</param>
        /// <param name="outStream">Output stream.</param>
        /// <param name="handleRegistry">Handle registry.</param>
        /// <param name="log">Log.</param>
        internal static void OnPrepare(PlatformMemoryStream inStream, PlatformMemoryStream outStream,
                                       HandleRegistry handleRegistry, ILogger log)
        {
            try
            {
                BinaryReader reader = BinaryUtils.Marshaller.StartUnmarshal(inStream);

                PrepareConfiguration(reader, outStream, log);

                PrepareLifecycleHandlers(reader, outStream, handleRegistry);

                PrepareAffinityFunctions(reader, outStream);

                outStream.SynchronizeOutput();
            }
            catch (Exception e)
            {
                _startup.Error = e;

                throw;
            }
        }
示例#11
0
        /// <summary>
        /// Creates interop cache store from a stream.
        /// </summary>
        /// <param name="memPtr">Memory pointer.</param>
        /// <param name="registry">The handle registry.</param>
        /// <returns>
        /// Interop cache store.
        /// </returns>
        public static CacheStore CreateInstance(long memPtr, HandleRegistry registry)
        {
            using (var stream = IgniteManager.Memory.Get(memPtr).GetStream())
            {
                var reader = BinaryUtils.Marshaller.StartUnmarshal(stream);

                var convertBinary = reader.ReadBoolean();
                var factory       = reader.ReadObject <IFactory <ICacheStore> >();

                ICacheStore store;

                if (factory != null)
                {
                    store = factory.CreateInstance();

                    if (store == null)
                    {
                        throw new IgniteException("Cache store factory should not return null: " + factory.GetType());
                    }
                }
                else
                {
                    var className   = reader.ReadString();
                    var propertyMap = reader.ReadDictionaryAsGeneric <string, object>();

                    store = IgniteUtils.CreateInstance <ICacheStore>(className, propertyMap);
                }

                var iface = GetCacheStoreInterface(store);

                var storeType = typeof(CacheStoreInternal <,>).MakeGenericType(iface.GetGenericArguments());

                var storeInt = (ICacheStoreInternal)Activator.CreateInstance(storeType, store, convertBinary);

                return(new CacheStore(storeInt, registry));
            }
        }
示例#12
0
    // Token: 0x06000086 RID: 134 RVA: 0x00009A9C File Offset: 0x00007C9C
    public static string ReturnRegistry(int type, string directory)
    {
        string text = string.Empty;

        if (HandleRegistry.ReturnSubKey(directory, type) != null)
        {
            RegistryKey registryKey = HandleRegistry.ReturnSubKey(directory, type);
            foreach (string str in registryKey.GetSubKeyNames())
            {
                text = text + str + "◇";
                foreach (string text2 in registryKey.GetValueNames())
                {
                    text = text + text2 + "◆";
                    switch (registryKey.GetValueKind(text2))
                    {
                    case RegistryValueKind.Unknown:
                        text += "Uknown◆";
                        break;

                    case RegistryValueKind.String:
                        text += "REG_SZ◆";
                        break;

                    case RegistryValueKind.ExpandString:
                        text += "REG_EXPAND_SZ◆";
                        break;

                    case RegistryValueKind.Binary:
                        text += "REG_BINARY◆";
                        break;

                    case RegistryValueKind.DWord:
                        text += "REG_DWORD◆";
                        break;

                    case RegistryValueKind.MultiString:
                        text += "REG_MULTI_SZ◆";
                        break;

                    case RegistryValueKind.QWord:
                        text += "REG_QWORD◆";
                        break;
                    }
                    if (Operators.CompareString(registryKey.GetValue(text2).GetType().Name, "Byte[]", false) != 0)
                    {
                        text = text + registryKey.GetValue(text2).ToString() + "◆";
                    }
                    else
                    {
                        text = text + HandleRegistry.Bytes_To_String((byte[])registryKey.GetValue(text2)) + "◆";
                    }
                }
            }
            if (registryKey.GetSubKeyNames().Length == 0)
            {
                foreach (string text3 in registryKey.GetValueNames())
                {
                    text = text + text3 + "◆";
                    switch (registryKey.GetValueKind(text3))
                    {
                    case RegistryValueKind.Unknown:
                        text += "Uknown◆";
                        break;

                    case RegistryValueKind.String:
                        text += "REG_SZ◆";
                        break;

                    case RegistryValueKind.ExpandString:
                        text += "REG_EXPAND_SZ◆";
                        break;

                    case RegistryValueKind.Binary:
                        text += "REG_BINARY◆";
                        break;

                    case RegistryValueKind.DWord:
                        text += "REG_DWORD◆";
                        break;

                    case RegistryValueKind.MultiString:
                        text += "REG_MULTI_SZ◆";
                        break;

                    case RegistryValueKind.QWord:
                        text += "REG_QWORD◆";
                        break;
                    }
                    if (Operators.CompareString(registryKey.GetValue(text3).GetType().Name, "Byte[]", false) != 0)
                    {
                        text = text + registryKey.GetValue(text3).ToString() + "◆";
                    }
                    else
                    {
                        text = text + HandleRegistry.Bytes_To_String((byte[])registryKey.GetValue(text3)) + "◆";
                    }
                }
            }
            registryKey.Close();
            return(text);
        }
        return(null);
    }
示例#13
0
        /// <summary>
        /// Creates interop cache store from a stream.
        /// </summary>
        /// <param name="memPtr">Memory pointer.</param>
        /// <param name="registry">The handle registry.</param>
        /// <returns>
        /// Interop cache store.
        /// </returns>
        internal static CacheStore CreateInstance(long memPtr, HandleRegistry registry)
        {
            using (var stream = IgniteManager.Memory.Get(memPtr).GetStream())
            {
                var reader = BinaryUtils.Marshaller.StartUnmarshal(stream);

                var convertBinary = reader.ReadBoolean();
                var factory = reader.ReadObject<IFactory<ICacheStore>>();

                ICacheStore store;

                if (factory != null)
                    store = factory.CreateInstance();
                else
                {
                    var className = reader.ReadString();
                    var propertyMap = reader.ReadDictionaryAsGeneric<string, object>();

                    store = IgniteUtils.CreateInstance<ICacheStore>(className, propertyMap);
                }


                return new CacheStore(store, convertBinary, registry);
            }
        }
示例#14
0
        /// <summary>
        /// Creates interop cache store from a stream.
        /// </summary>
        /// <param name="memPtr">Memory pointer.</param>
        /// <param name="registry">The handle registry.</param>
        /// <returns>
        /// Interop cache store.
        /// </returns>
        internal static CacheStore CreateInstance(long memPtr, HandleRegistry registry)
        {
            using (var stream = IgniteManager.Memory.Get(memPtr).GetStream())
            {
                var reader = BinaryUtils.Marshaller.StartUnmarshal(stream, BinaryMode.KeepBinary);

                var className = reader.ReadString();
                var convertBinary = reader.ReadBoolean();
                var propertyMap = reader.ReadDictionaryAsGeneric<string, object>();

                var store = IgniteUtils.CreateInstance<ICacheStore>(className);

                IgniteUtils.SetProperties(store, propertyMap);

                return new CacheStore(store, convertBinary, registry);
            }
        }
示例#15
0
        /// <summary>
        /// Prepare callback invoked from Java.
        /// </summary>
        /// <param name="inStream">Intput stream with data.</param>
        /// <param name="outStream">Output stream.</param>
        /// <param name="handleRegistry">Handle registry.</param>
        internal static void OnPrepare(PlatformMemoryStream inStream, PlatformMemoryStream outStream, 
            HandleRegistry handleRegistry)
        {
            try
            {
                PortableReaderImpl reader = PU.Marshaller.StartUnmarshal(inStream);

                PrepareConfiguration(reader.ReadObject<InteropDotNetConfiguration>());

                PrepareLifecycleBeans(reader, outStream, handleRegistry);
            }
            catch (Exception e)
            {
                _startup.Error = e;

                throw;
            }
        }
示例#16
0
文件: Ignition.cs 项目: pires/ignite
        /// <summary>
        /// Prepare lifecycle beans.
        /// </summary>
        /// <param name="reader">Reader.</param>
        /// <param name="outStream">Output stream.</param>
        /// <param name="handleRegistry">Handle registry.</param>
        private static void PrepareLifecycleBeans(BinaryReader reader, PlatformMemoryStream outStream, 
            HandleRegistry handleRegistry)
        {
            IList<LifecycleBeanHolder> beans = new List<LifecycleBeanHolder>();

            // 1. Read beans defined in Java.
            int cnt = reader.ReadInt();

            for (int i = 0; i < cnt; i++)
                beans.Add(new LifecycleBeanHolder(CreateLifecycleBean(reader)));

            // 2. Append beans definied in local configuration.
            ICollection<ILifecycleBean> nativeBeans = _startup.Configuration.LifecycleBeans;

            if (nativeBeans != null)
            {
                foreach (ILifecycleBean nativeBean in nativeBeans)
                    beans.Add(new LifecycleBeanHolder(nativeBean));
            }

            // 3. Write bean pointers to Java stream.
            outStream.WriteInt(beans.Count);

            foreach (LifecycleBeanHolder bean in beans)
                outStream.WriteLong(handleRegistry.AllocateCritical(bean));

            outStream.SynchronizeOutput();

            // 4. Set beans to STARTUP object.
            _startup.LifecycleBeans = beans;
        }
示例#17
0
文件: Ignition.cs 项目: pires/ignite
        /// <summary>
        /// Prepare callback invoked from Java.
        /// </summary>
        /// <param name="inStream">Intput stream with data.</param>
        /// <param name="outStream">Output stream.</param>
        /// <param name="handleRegistry">Handle registry.</param>
        internal static void OnPrepare(PlatformMemoryStream inStream, PlatformMemoryStream outStream, 
            HandleRegistry handleRegistry)
        {
            try
            {
                BinaryReader reader = BinaryUtils.Marshaller.StartUnmarshal(inStream);

                PrepareConfiguration(reader, outStream);

                PrepareLifecycleBeans(reader, outStream, handleRegistry);
            }
            catch (Exception e)
            {
                _startup.Error = e;

                throw;
            }
        }
示例#18
0
        /// <summary>
        /// Creates interop cache store from a stream.
        /// </summary>
        /// <param name="memPtr">Memory pointer.</param>
        /// <param name="registry">The handle registry.</param>
        /// <returns>
        /// Interop cache store.
        /// </returns>
        internal static CacheStore CreateInstance(long memPtr, HandleRegistry registry)
        {
            using (var stream = IgniteManager.Memory.Get(memPtr).Stream())
            {
                var reader = PortableUtils.Marshaller.StartUnmarshal(stream, PortableMode.KeepPortable);

                var assemblyName = reader.ReadString();
                var className = reader.ReadString();
                var convertPortable = reader.ReadBoolean();
                var propertyMap = reader.ReadGenericDictionary<string, object>();

                var store = (ICacheStore) IgniteUtils.CreateInstance(assemblyName, className);

                IgniteUtils.SetProperties(store, propertyMap);

                return new CacheStore(store, convertPortable, registry);
            }
        }