예제 #1
0
        private async Task CreateNewBlockchainPolicy(I2B_Request request)
        {
            BigInteger?nonce = null;

            if (_blockchain_settings.transaction_fire_and_forget)
            {
                nonce = _web3geth_service.BlockchainManager.GetMainAccountNonceForRawTransaction;
            }

            CreatePolicy create_policy = JsonConvert.DeserializeObject <CreatePolicy>(request.task.payload);
            string       tx_hash       = await _web3geth_service.Policy.CreateAsync(
                task_uuid : request.task_uuid,
                pid : create_policy.pid.ToString(),
                psn : create_policy.psn,
                tenant_id : create_policy.tenant_id.ToString(),
                start_date_time : create_policy.start_date_time.ToString(),
                end_date_time : create_policy.end_date_time.ToString(),
                start_date_time_local : create_policy.start_date_time_local,
                end_date_time_local : create_policy.end_date_time_local,
                nonce : nonce);

            if (_blockchain_settings.transaction_fire_and_forget)
            {
                // check transaction is pending
                await MakeSureTransactionIsPending(tx_hash);

                var fire_and_forget = BackgroundWaitTransactionResult(tx_hash, request);
            }
            else
            {
                await BackgroundWaitTransactionResult(tx_hash, request);
            }
        }
        protected override void OnInit()
        {
            base.OnInit();

            namedCache   = CacheFactory.GetCache("SossSessionState");
            createPolicy = new CreatePolicy(TimeSpan.FromMinutes(Timeout));
        }
예제 #3
0
        public static bool ConfigCreatePolicy(XmlElement xmlElem,
                                              string name, ref CreatePolicy createPolicy, bool compulsory)
        {
            XmlNode xmlNode;

            xmlNode = XMLReader.GetNode(xmlElem, name);
            if (xmlNode == null && compulsory == false)
            {
                return(false);
            }
            else if (xmlNode == null && compulsory == true)
            {
                throw new ConfigNotFoundException(name);
            }

            if (xmlNode.InnerText == "ALWAYS")
            {
                createPolicy = CreatePolicy.ALWAYS;
            }
            else if (xmlNode.InnerText == "IF_NEEDED")
            {
                createPolicy = CreatePolicy.IF_NEEDED;
            }
            else if (xmlNode.InnerText == "NEVER")
            {
                createPolicy = CreatePolicy.NEVER;
            }
            else
            {
                throw new InvalidConfigException(name);
            }

            return(true);
        }
예제 #4
0
        public static void ConfirmCreatePolicy(XmlElement xmlElem,
                                               string name, CreatePolicy createPolicy, bool compulsory)
        {
            XmlNode xmlNode;

            xmlNode = XMLReader.GetNode(xmlElem, name);
            if (xmlNode == null && compulsory == true)
            {
                throw new ConfigNotFoundException(name);
            }
            else if (xmlNode != null)
            {
                if (xmlNode.InnerText == "ALWAYS")
                {
                    Assert.IsTrue(createPolicy.Equals(CreatePolicy.ALWAYS));
                }
                else if (xmlNode.InnerText == "IF_NEEDED")
                {
                    Assert.IsTrue(createPolicy.Equals(CreatePolicy.IF_NEEDED));
                }
                else if (xmlNode.InnerText == "NEVER")
                {
                    Assert.IsTrue(createPolicy.Equals(CreatePolicy.NEVER));
                }
            }
        }
예제 #5
0
 /// <summary>
 /// Instantiate a new HashDatabaseConfig object
 /// </summary>
 public HashDatabaseConfig() {
     Duplicates = DuplicatesPolicy.NONE;
     HashComparison = null;
     fillFactorIsSet = false;
     nelemIsSet = false;
     Creation = CreatePolicy.NEVER;
 }
 /// <summary>
 /// Instantiate a new QueueDatabaseConfig object
 /// </summary>
 public QueueDatabaseConfig()
 {
     ConsumeInOrder = false;
     Append         = null;
     padIsSet       = false;
     extentIsSet    = false;
     Creation       = CreatePolicy.NEVER;
 }
예제 #7
0
파일: Di4.cs 프로젝트: olgatei/Di4
        /// <summary>
        /// Dynamic intervals incremental inverted index (Genometric.Di4)
        /// is an indexing system aimed at providing
        /// efficient means of processing the intervals
        /// it indexes for common information retrieval
        /// tasks.
        /// </summary>
        /// <param name="CSerializer"></param>
        /// <param name="comparer"></param>
        private Di4(
            string FileName,
            CreatePolicy createPolicy,
            ISerializer <C> CSerializer,
            IComparer <C> comparer,
            int avgKeySize,
            int avgValueSize,
            bool THIS_IS_THE_MOST_USED_ONE)
        {
            //bSerializer = new BSerializer();
            //var options = new BPlusTree<C, B>.OptionsV2(CSerializer, bSerializer, comparer);


            ////counted.CalcBTreeOrder(avgKeySize, avgValueSize); //24);
            //options.CreateFile = createPolicy;
            ////counted.ExistingLogAction = ExistingLogAction.ReplayAndCommit;
            //options.StoragePerformance = StoragePerformance.Fastest;


            //////// Multi-Threading 2nd pass test; was commented-out visa versa
            //counted.CachePolicy = CachePolicy.All;
            //options.CachePolicy = CachePolicy.Recent;


            //counted.FileBlockSize = 512;

            /*counted.MaximumChildNodes = 8;
             * counted.MinimumChildNodes = 2;
             *
             * counted.MaximumValueNodes = 8;
             * counted.MinimumValueNodes = 2;
             */


            /// There three lines added for multi-threading.
            //counted.CallLevelLock = new ReaderWriterLocking();
            /////counted.LockingFactory = new LockFactory<SimpleReadWriteLocking>(); //Test 1
            /////counted.LockingFactory = new LockFactory<WriterOnlyLocking>(); //Test 2
            //counted.LockingFactory = new LockFactory<ReaderWriterLocking>();
            //counted.LockTimeout = 10000;



            //options.MaximumChildNodes = 256;// 100;
            //options.MinimumChildNodes = 2;//2;//10;

            //options.MaximumValueNodes = 256; // 100;
            //options.MinimumValueNodes = 2;//2;//10;

            //if (createPolicy != CreatePolicy.Never)
            //options.FileName = FileName;

            //_di4_1R = new BPlusTree<C, B>(options);
            //SingleIndex = new SingleIndex<C, I, M>(_di4_1R);

            //_di4_1R.DebugSetValidateOnCheckpoint(false);
        }
예제 #8
0
        private void NewPolicy()
        {
            PolicyCreationModel policyCreationModel = new PolicyCreationModel();

            // Define model
            policyCreationModel.kp_policy = PolicyNameTextBox.Text;

            List <ListItem> policyCheck = new List <ListItem>();

            foreach (ListItem item in CheckBoxList1.Items)
            {
                if (item.Selected)
                {
                    if (item.Value == "kp_collison")
                    {
                        policyCreationModel.kp_collision = true;
                    }
                    if (item.Value == "kp_comprehensive")
                    {
                        policyCreationModel.kp_comprehensive = true;
                    }
                    if (item.Value == "kp_liability")
                    {
                        policyCreationModel.kp_liability = true;
                    }
                    if (item.Value == "kp_protected")
                    {
                        policyCreationModel.kp_protected = true;
                    }
                    if (item.Value == "kp_uninsured")
                    {
                        policyCreationModel.kp_uninsured = true;
                    }
                }
            }

            //policyCreationModel.kp_policyholder = Guid.Parse((string)Session["contactID"]);
            policyCreationModel.kp_policyholder = Guid.Parse(HttpContext.Current.Request.Cookies[0].Value);


            string preferredCurrency = (string)Session["transactioncurrencyid"];

            if (preferredCurrency == "CAD")
            {
                policyCreationModel.transactioncurrencyid = Guid.Parse("6f14ded1-1ca2-e911-a9aa-000d3a4025c7");
            }
            else if (preferredCurrency == "USD")
            {
                policyCreationModel.transactioncurrencyid = Guid.Parse("391b1ea8-0fa2-e911-a9b6-000d3a402766");
            }

            // Create Entity and submit it
            CreatePolicy newPolicy = new CreatePolicy();

            newPolicy.PolicyCreation(policyCreationModel);
            Response.Redirect("PolicyDisplay.aspx");
        }
예제 #9
0
        public async Task <Guid> CreatePolicy(Guid userId, Guid productId, string name)
        {
            CreatePolicy operation = new CreatePolicy(_authorityContext, userId, productId, name);
            Policy       policy    = await operation.Do();

            await operation.CommitAsync();

            return(policy.Id);
        }
예제 #10
0
 public Options(
     CreatePolicy CreatePolicy,
     ISerializer <C> CSerializer,
     IComparer <C> Comparer,
     string FileName = "none")
 {
     this.FileName     = FileName;
     this.CreatePolicy = CreatePolicy;
     this.CSerializer  = CSerializer;
     this.Comparer     = Comparer;
 }
예제 #11
0
 /// <summary>
 /// Instantiate a new RecnoDatabaseConfig object
 /// </summary>
 public RecnoDatabaseConfig()
 {
     Renumber       = false;
     Snapshot       = false;
     Append         = null;
     delimiterIsSet = false;
     lengthIsSet    = false;
     padIsSet       = false;
     BackingFile    = null;
     Creation       = CreatePolicy.NEVER;
 }
예제 #12
0
 public Di4Options(
     CreatePolicy CreatePolicy,
     ISerializer <C> CSerializer,
     IComparer <C> Comparer,
     string FileName = "none")
 {
     this.FileName     = FileName;
     this.CreatePolicy = CreatePolicy;
     this.CSerializer  = CSerializer;
     this.Comparer     = Comparer;
     ActiveIndexes     = IndexType.Both;
 }
예제 #13
0
        /// <summary>
        /// Create a new BTreeDatabaseConfig object
        /// </summary>
        public BTreeDatabaseConfig()
        {
            Duplicates         = DuplicatesPolicy.NONE;
            NoReverseSplitting = false;
            UseRecordNumbers   = false;

            BTreeCompare       = null;
            BTreePrefixCompare = null;

            minkeysIsSet = false;

            Creation = CreatePolicy.NEVER;
        }
예제 #14
0
 public object Post(CreatePolicy request)
 {
     // Submit and return the transaction hash of the broadcasted transaction
     return(AppServices.createSignPublishTransaction(
                AppModelConfig.POLICY.abi,
                AppServices.GetEcosystemAdr(request.ContractAdr).PolicyContractAdr,
                request.SigningPrivateKey,
                "createPolicy",
                request.AdjustorHash.HexToByteArray(),
                request.Owner,
                request.DocumentHash.HexToByteArray(),
                request.RiskPoints
                ));
 }
        public SossSessionStateItemCollection(string keyPrefix, int timeout)
        {
            this.keyPrefix = keyPrefix + "_";
            countIndex     = keyPrefix + ".Count";
            versionIndex   = keyPrefix + ".Version";
            createPolicy   = new CreatePolicy(TimeSpan.FromMinutes(timeout));
            infinitePolicy = new CreatePolicy(TimeSpan.Zero);

            namedCache                  = CacheFactory.GetCache("SossSessionState");
            keyPrefixIndexValue         = new IndexValue(this.keyPrefix);
            keyPrefixInternalIndexValue = new IndexValue(keyPrefix + ".");

            SyncRoot       = new object();
            IsSynchronized = true;
        }
예제 #16
0
        public async Task <IActionResult> Post([FromBody] CreatePolicy policy)
        {
            var id    = Guid.NewGuid();
            var appId = "9fa3d2ec-8495-4067-919d-a111d301df2b";

            var policyId = 2; //PS REST, create policy and return policyId.

            var dto = new PolicyServerMap(id, policyId, appId);

            var response = await _policyServerModelRepository.InsertAsync(dto);

            if (response.IsFailure)
            {
                return(BadRequest());
            }

            return(Ok());
        }
예제 #17
0
        private static void CollectLuaClassMembers()
        {
            //
            //初始化_lua_functions
            //
            _lua_functions.Clear();

            //收集需要注册到Lua环境的类成员函数信息
            var ttype = typeof(LT);

            foreach (MethodInfo method in ttype.GetMethods(BindingFlags.Static | BindingFlags.NonPublic))
            {
                foreach (LuaClassMethodAttribute attribute in method.GetCustomAttributes(typeof(LuaClassMethodAttribute), true))
                {
                    var name = attribute.HasName ? attribute.Name : method.Name;
                    var classMemberFunction = (LuaCFunction)Delegate.CreateDelegate(typeof(LuaCFunction), method);
                    if (!_lua_functions.ContainsKey(name))
                    {
                        _lua_functions.Add(name, classMemberFunction);
                    }
                }
            }

            //
            //搜集类型创建策略,默认为Factory
            //
            var singletonPolicy =
                ttype.GetCustomAttributes(typeof(LuaClassAttribute), true)
                .Select(attr => attr as LuaClassAttribute)
                .FirstOrDefault(attr => attr.CreatePolicy == CreatePolicy.Singleton);

            if (singletonPolicy == null)
            {
                _createPolicy  = CreatePolicy.Factory;
                _instancesDict = new SortedList <int, T>();
            }
            else
            {
                _createPolicy = CreatePolicy.Singleton;
                _instance     = new T();
            }
        }
예제 #18
0
 /// <summary>
 /// Instantiate a new HeapDatabaseConfig object
 /// </summary>
 public HeapDatabaseConfig()
 {
     Creation = CreatePolicy.NEVER;
 }
예제 #19
0
 /// <summary>
 /// Instantiate a new HeapDatabaseConfig object
 /// </summary>
 public HeapDatabaseConfig()
 {
     Creation = CreatePolicy.NEVER;
 }
예제 #20
0
 /// <summary>
 /// Instantiate a new HashDatabaseConfig object
 /// </summary>
 public HashDatabaseConfig() {
     blobThresholdIsSet = false;
     Duplicates = DuplicatesPolicy.NONE;
     HashComparison = null;
     fillFactorIsSet = false;
     nelemIsSet = false;
     Creation = CreatePolicy.NEVER;
 }
예제 #21
0
 /// <summary>
 /// Instantiate a new QueueDatabaseConfig object
 /// </summary>
 public QueueDatabaseConfig()
 {
     ConsumeInOrder = false;
     Append = null;
     padIsSet = false;
     extentIsSet = false;
     Creation = CreatePolicy.NEVER;
 }
예제 #22
0
 /// <summary>
 /// Instantiate a new HeapDatabaseConfig object
 /// </summary>
 public HeapDatabaseConfig()
 {
     blobThresholdIsSet = false;
     Creation = CreatePolicy.NEVER;
 }
예제 #23
0
 /// <summary>
 /// Instantiate a new RecnoDatabaseConfig object
 /// </summary>
 public RecnoDatabaseConfig()
 {
     Renumber = false;
     Snapshot = false;
     Append = null;
     delimiterIsSet = false;
     lengthIsSet = false;
     padIsSet = false;
     BackingFile = null;
     Creation = CreatePolicy.NEVER;
 }
예제 #24
0
 /// <summary>
 /// Instantiate a new HeapDatabaseConfig object
 /// </summary>
 public HeapDatabaseConfig()
 {
     blobThresholdIsSet = false;
     Creation           = CreatePolicy.NEVER;
 }
예제 #25
0
 public LuaClassAttribute(CreatePolicy policy)
 {
     CreatePolicy = policy;
 }
예제 #26
0
 public LuaClassAttribute(CreatePolicy policy)
 {
     CreatePolicy = policy;
 }
예제 #27
0
        public static void ConfirmCreatePolicy(XmlElement xmlElem,
		    string name, CreatePolicy createPolicy, bool compulsory)
        {
            XmlNode xmlNode;

            xmlNode = XMLReader.GetNode(xmlElem, name);
            if (xmlNode == null && compulsory == true)
                throw new ConfigNotFoundException(name);
            else if (xmlNode != null)
            {
                if (xmlNode.InnerText == "ALWAYS")
                    Assert.IsTrue(createPolicy.Equals(CreatePolicy.ALWAYS));
                else if (xmlNode.InnerText == "IF_NEEDED")
                    Assert.IsTrue(createPolicy.Equals(CreatePolicy.IF_NEEDED));
                else if (xmlNode.InnerText == "NEVER")
                    Assert.IsTrue(createPolicy.Equals(CreatePolicy.NEVER));
            }
        }
예제 #28
0
        /// <summary>
        /// Create a new BTreeDatabaseConfig object
        /// </summary>
        public BTreeDatabaseConfig()
        {
            Duplicates = DuplicatesPolicy.NONE;
            NoReverseSplitting = false;
            UseRecordNumbers = false;

            BTreeCompare = null;
            BTreePrefixCompare = null;

            minkeysIsSet = false;

            Creation = CreatePolicy.NEVER;
        }
예제 #29
0
        public static bool ConfigCreatePolicy(XmlElement xmlElem,
		    string name, ref CreatePolicy createPolicy, bool compulsory)
        {
            XmlNode xmlNode;

            xmlNode = XMLReader.GetNode(xmlElem, name);
            if (xmlNode == null && compulsory == false)
                return false;
            else if (xmlNode == null && compulsory == true)
                throw new ConfigNotFoundException(name);

            if (xmlNode.InnerText == "ALWAYS")
                createPolicy = CreatePolicy.ALWAYS;
            else if (xmlNode.InnerText == "IF_NEEDED")
                createPolicy = CreatePolicy.IF_NEEDED;
            else if (xmlNode.InnerText == "NEVER")
                createPolicy = CreatePolicy.NEVER;
            else
                throw new InvalidConfigException(name);

            return true;
        }