示例#1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public String createEphemeralNode(String path, String value, org.apache.zookeeper.CreateMode createMode) throws InterruptedException, org.apache.zookeeper.KeeperException
		public override string createEphemeralNode(string path, string value, CreateMode createMode)
		{

			map[path] = value;

			return path;
		}
示例#2
0
 static CreateModeHolder()
 {
     CreateMode localCreateMode;
     try
     {
         //localCreateMode = CreateMode.valueOf("CONTAINER");
         localCreateMode = NON_CONTAINER_MODE;
     }
     catch ( Exception)
     {
         localCreateMode = NON_CONTAINER_MODE;
         log.Warn("The version of ZooKeeper being used doesn't support Container nodes. " +
                  "CreateMode.PERSISTENT will be used instead.");
     }
     containerCreateMode = localCreateMode;
 }
示例#3
0
        /// <summary>
        /// Creates the path in ZooKeeper, creating each node as necessary.
        ///
        /// e.g. If <code>path=/solr/group/node</code> and none of the nodes, solr,
        /// group, node exist, each will be created.
        ///
        /// skipPathParts will force the call to fail if the first skipPathParts do not exist already.
        ///
        /// Note: retryOnConnLoss is only respected for the final node - nodes
        /// before that are always retried on connection loss.
        /// </summary>
        /// <param name="path"></param>
        /// <param name="data"></param>
        /// <param name="createMode"></param>
        /// <param name="watcher"></param>
        /// <param name="failOnExists"></param>
        /// <param name="retryOnConnLoss"></param>
        /// <param name="skipPathParts"></param>
        /// <returns></returns>
        public async Task makePath(string path, byte[] data, CreateMode createMode,
                                   Watcher watcher, bool failOnExists, bool retryOnConnLoss, int skipPathParts)
        {
            //TODO: Log here
            //log.debug("makePath: {}", path);
            var retry = true;

            if (path.StartsWith("/"))
            {
                path = path.Substring(1, path.Length - 1);
            }
            var paths  = path.Split('/');
            var sbPath = new StringBuilder();

            for (var i = 0; i < paths.Length; i++)
            {
                var pathPiece = paths[i];
                sbPath.Append("/" + pathPiece);
                if (i < skipPathParts)
                {
                    continue;
                }
                byte[] bytes       = null;
                var    currentPath = sbPath.ToString();
                Stat   isExists    = await exists(currentPath, watcher, retryOnConnLoss);

                if (isExists == null || ((i == paths.Length - 1) && failOnExists))
                {
                    var mode = CreateMode.PERSISTENT;
                    if (i == paths.Length - 1)
                    {
                        mode  = createMode;
                        bytes = data;
                        if (!retryOnConnLoss)
                        {
                            retry = false;
                        }
                    }
                    try
                    {
                        if (retry)
                        {
                            var finalMode  = mode;
                            var finalBytes = bytes;
                            Console.WriteLine("Create: " + currentPath);
                            await _zkCmdExecutor.RetryOperation(async() =>
                            {
                                await keeper.createAsync(currentPath, finalBytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, finalMode);
                            });

                            Console.WriteLine("End: " + currentPath);
                        }
                        else
                        {
                            await keeper.createAsync(currentPath, bytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, mode);
                        }
                    }
                    catch (KeeperException.NodeExistsException e)
                    {
                        Console.WriteLine("EXCEPTION");
                        if (!failOnExists)
                        {
                            // TODO: version ? for now, don't worry about race
                            await setData(currentPath, data, -1, retryOnConnLoss);

                            // set new watch
                            await exists(currentPath, watcher, retryOnConnLoss);

                            return;
                        }

                        // ignore unless it's the last node in the path
                        if (i == paths.Length - 1)
                        {
                            throw e;
                        }
                    }
                    if (i == paths.Length - 1)
                    {
                        // set new watch
                        await exists(currentPath, watcher, retryOnConnLoss);
                    }
                }
                else if (i == paths.Length - 1)
                {
                    Console.WriteLine("Set: " + currentPath);
                    // TODO: version ? for now, don't worry about race
                    await setData(currentPath, data, -1, retryOnConnLoss);

                    // set new watch
                    await exists(currentPath, watcher, retryOnConnLoss);
                }
            }
        }
示例#4
0
        public NodeState CreateAddElements(NodeState parent, CreateMode mode,
                                           AdminShellPackageEnv package = null, AdminShell.File file = null)
        {
            // access
            if (parent == null)
            {
                return(null);
            }

            // for sake of complexity, differentiate early
            if (mode == CreateMode.Type)
            {
                var o = this.entityBuilder.CreateAddObject(
                    parent, "File", ReferenceTypeIds.HasComponent, ObjectTypeIds.FileType);
                return(o);
            }
            else
            {
                if (package == null || file == null)
                {
                    return(null);
                }

                var instData = new InstanceData();
                instData.packHandler = new AasUaPackageFileHandler(package, file);

                // containing element
                var o = this.entityBuilder.CreateAddObject(
                    parent, "File", ReferenceTypeIds.HasComponent, ObjectTypeIds.FileType);


                // this first information is to provide a "off-the-shelf" size information; a Open() will re-new this
                var fileLen = Convert.ToUInt64(package.GetStreamSizeFromPackage(file.value));

                // populate attributes from the spec
                this.entityBuilder.CreateAddPropertyState <string>(o, "MimeType",
                                                                   DataTypeIds.String, file.mimeType, ReferenceTypeIds.HasProperty, VariableTypeIds.PropertyType);
                instData.nodeOpenCount = this.entityBuilder.CreateAddPropertyState <UInt16>(o, "OpenCount",
                                                                                            DataTypeIds.UInt16, 0, ReferenceTypeIds.HasProperty, VariableTypeIds.PropertyType);
                instData.nodeSize = this.entityBuilder.CreateAddPropertyState <UInt64>(o, "Size",
                                                                                       DataTypeIds.UInt64, fileLen, ReferenceTypeIds.HasProperty, VariableTypeIds.PropertyType,
                                                                                       valueRank: -1);
                this.entityBuilder.CreateAddPropertyState <bool>(o, "UserWritable",
                                                                 DataTypeIds.Boolean, true, ReferenceTypeIds.HasProperty, VariableTypeIds.PropertyType);
                this.entityBuilder.CreateAddPropertyState <bool>(o, "Writable",
                                                                 DataTypeIds.Boolean, true, ReferenceTypeIds.HasProperty, VariableTypeIds.PropertyType);

                // Open
                instData.mOpen = this.entityBuilder.CreateAddMethodState(o, "Open",
                                                                         inputArgs: new[] {
                    new Argument("Mode", DataTypeIds.Byte, -1, "")
                },
                                                                         outputArgs: new[] {
                    new Argument("FileHandle", DataTypeIds.UInt32, -1, "")
                }, referenceTypeFromParentId: ReferenceTypeIds.HasComponent,
                                                                         methodDeclarationId: MethodIds.FileType_Open, onCalled: this.OnMethodCalled);

                this.entityBuilder.AddNodeStateAnnotation(instData.mOpen, instData);

                // Close
                instData.mClose = this.entityBuilder.CreateAddMethodState(o, "Close",
                                                                          inputArgs: new[] {
                    new Argument("FileHandle", DataTypeIds.UInt32, -1, "")
                },
                                                                          outputArgs: null,
                                                                          referenceTypeFromParentId: ReferenceTypeIds.HasComponent,
                                                                          methodDeclarationId: MethodIds.FileType_Close, onCalled: this.OnMethodCalled);

                this.entityBuilder.AddNodeStateAnnotation(instData.mClose, instData);

                // Read
                instData.mRead = this.entityBuilder.CreateAddMethodState(o, "Read",
                                                                         inputArgs: new[] {
                    new Argument("FileHandle", DataTypeIds.UInt32, -1, ""),
                    new Argument("Length", DataTypeIds.Int32, -1, "")
                },
                                                                         outputArgs: new[] {
                    new Argument("Data", DataTypeIds.ByteString, -1, "")
                }, referenceTypeFromParentId: ReferenceTypeIds.HasComponent,
                                                                         methodDeclarationId: MethodIds.FileType_Read, onCalled: this.OnMethodCalled);

                this.entityBuilder.AddNodeStateAnnotation(instData.mRead, instData);

                // Write
                instData.mWrite = this.entityBuilder.CreateAddMethodState(o, "Write",
                                                                          inputArgs: new[] {
                    new Argument("FileHandle", DataTypeIds.UInt32, -1, ""),
                    new Argument("Data", DataTypeIds.ByteString, -1, "")
                },
                                                                          outputArgs: null,
                                                                          referenceTypeFromParentId: ReferenceTypeIds.HasComponent,
                                                                          methodDeclarationId: MethodIds.FileType_Write, onCalled: this.OnMethodCalled);

                this.entityBuilder.AddNodeStateAnnotation(instData.mWrite, instData);

                // GetPosition
                instData.mGetPosition = this.entityBuilder.CreateAddMethodState(o, "GetPosition",
                                                                                inputArgs: new[] {
                    new Argument("FileHandle", DataTypeIds.UInt32, -1, ""),
                },
                                                                                outputArgs: new[] {
                    new Argument("Position", DataTypeIds.UInt64, -1, "")
                },
                                                                                referenceTypeFromParentId: ReferenceTypeIds.HasComponent,
                                                                                methodDeclarationId: MethodIds.FileType_GetPosition, onCalled: this.OnMethodCalled);

                this.entityBuilder.AddNodeStateAnnotation(instData.mGetPosition, instData);

                // SetPosition
                instData.mSetPosition = this.entityBuilder.CreateAddMethodState(o, "SetPosition",
                                                                                inputArgs: new[] {
                    new Argument("FileHandle", DataTypeIds.UInt32, -1, ""),
                    new Argument("Position", DataTypeIds.UInt64, -1, "")
                },
                                                                                outputArgs: null,
                                                                                referenceTypeFromParentId: ReferenceTypeIds.HasComponent,
                                                                                methodDeclarationId: MethodIds.FileType_SetPosition, onCalled: this.OnMethodCalled);

                this.entityBuilder.AddNodeStateAnnotation(instData.mSetPosition, instData);

                // result
                return(o);
            }
        }
示例#5
0
        public String Create(string path, byte[] data, IEnumerable <Org.Apache.Zookeeper.Data.ACL> acl, CreateMode mode)
        {
            String name  = null;
            int    tries = retries;

            while ((tries--) > 0)
            {
                try
                {
                    name = zk.Create(path, data, acl, mode);
                    break;
                }
                catch (Exception ex)
                {
                    if (tries == 0)
                    {
                        Console.WriteLine("Create exception after #" + retries + " retries :\n" + ex.Message);
                        Console.WriteLine("Last retry, throwing exception");
                        throw ex;
                    }
                }
            }
            return(name);
        }
示例#6
0
 /// <summary>
 /// Creates the path in ZooKeeper, creating each node as necessary.
 ///
 /// e.g. If <code>path=/solr/group/node</code> and none of the nodes, solr,
 /// group, node exist, each will be created.
 /// </summary>
 /// <param name="path"></param>
 /// <param name="data">To set on the last zkNode</param>
 /// <param name="createMode"></param>
 /// <param name="retryOnConnLoss"></param>
 /// <returns></returns>
 public async Task makePath(string path, byte[] data, CreateMode createMode, bool retryOnConnLoss)
 {
     await makePath(path, data, createMode, null, retryOnConnLoss);
 }
示例#7
0
        internal static SqlDatabaseData DeserializeSqlDatabaseData(JsonElement element)
        {
            Optional <Models.Sku>        sku       = default;
            Optional <string>            kind      = default;
            Optional <string>            managedBy = default;
            IDictionary <string, string> tags      = default;
            AzureLocation                               location                          = default;
            ResourceIdentifier                          id                                = default;
            string                                      name                              = default;
            ResourceType                                type                              = default;
            SystemData                                  systemData                        = default;
            Optional <CreateMode>                       createMode                        = default;
            Optional <string>                           collation                         = default;
            Optional <long>                             maxSizeBytes                      = default;
            Optional <SampleSchemaName>                 sampleName                        = default;
            Optional <string>                           elasticPoolId                     = default;
            Optional <string>                           sourceDatabaseId                  = default;
            Optional <DatabaseStatus>                   status                            = default;
            Optional <Guid>                             databaseId                        = default;
            Optional <DateTimeOffset>                   creationDate                      = default;
            Optional <string>                           currentServiceObjectiveName       = default;
            Optional <string>                           requestedServiceObjectiveName     = default;
            Optional <string>                           defaultSecondaryLocation          = default;
            Optional <string>                           failoverGroupId                   = default;
            Optional <DateTimeOffset>                   restorePointInTime                = default;
            Optional <DateTimeOffset>                   sourceDatabaseDeletionDate        = default;
            Optional <string>                           recoveryServicesRecoveryPointId   = default;
            Optional <string>                           longTermRetentionBackupResourceId = default;
            Optional <string>                           recoverableDatabaseId             = default;
            Optional <string>                           restorableDroppedDatabaseId       = default;
            Optional <CatalogCollationType>             catalogCollation                  = default;
            Optional <bool>                             zoneRedundant                     = default;
            Optional <DatabaseLicenseType>              licenseType                       = default;
            Optional <long>                             maxLogSizeBytes                   = default;
            Optional <DateTimeOffset>                   earliestRestoreDate               = default;
            Optional <DatabaseReadScale>                readScale                         = default;
            Optional <int>                              highAvailabilityReplicaCount      = default;
            Optional <SecondaryType>                    secondaryType                     = default;
            Optional <Models.Sku>                       currentSku                        = default;
            Optional <int>                              autoPauseDelay                    = default;
            Optional <CurrentBackupStorageRedundancy>   currentBackupStorageRedundancy    = default;
            Optional <RequestedBackupStorageRedundancy> requestedBackupStorageRedundancy  = default;
            Optional <double>                           minCapacity                       = default;
            Optional <DateTimeOffset>                   pausedDate                        = default;
            Optional <DateTimeOffset>                   resumedDate                       = default;
            Optional <string>                           maintenanceConfigurationId        = default;
            Optional <bool>                             isLedgerOn                        = default;
            Optional <bool>                             isInfraEncryptionEnabled          = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sku = Models.Sku.DeserializeSku(property.Value);
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    kind = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("managedBy"))
                {
                    managedBy = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("createMode"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            createMode = new CreateMode(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("collation"))
                        {
                            collation = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("maxSizeBytes"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            maxSizeBytes = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("sampleName"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            sampleName = new SampleSchemaName(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("elasticPoolId"))
                        {
                            elasticPoolId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("sourceDatabaseId"))
                        {
                            sourceDatabaseId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("status"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            status = new DatabaseStatus(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("databaseId"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            databaseId = property0.Value.GetGuid();
                            continue;
                        }
                        if (property0.NameEquals("creationDate"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            creationDate = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("currentServiceObjectiveName"))
                        {
                            currentServiceObjectiveName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("requestedServiceObjectiveName"))
                        {
                            requestedServiceObjectiveName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("defaultSecondaryLocation"))
                        {
                            defaultSecondaryLocation = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("failoverGroupId"))
                        {
                            failoverGroupId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("restorePointInTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            restorePointInTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("sourceDatabaseDeletionDate"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            sourceDatabaseDeletionDate = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("recoveryServicesRecoveryPointId"))
                        {
                            recoveryServicesRecoveryPointId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("longTermRetentionBackupResourceId"))
                        {
                            longTermRetentionBackupResourceId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("recoverableDatabaseId"))
                        {
                            recoverableDatabaseId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("restorableDroppedDatabaseId"))
                        {
                            restorableDroppedDatabaseId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("catalogCollation"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            catalogCollation = new CatalogCollationType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("zoneRedundant"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            zoneRedundant = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("licenseType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            licenseType = new DatabaseLicenseType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("maxLogSizeBytes"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            maxLogSizeBytes = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("earliestRestoreDate"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            earliestRestoreDate = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("readScale"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            readScale = new DatabaseReadScale(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("highAvailabilityReplicaCount"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            highAvailabilityReplicaCount = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("secondaryType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            secondaryType = new SecondaryType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("currentSku"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            currentSku = Models.Sku.DeserializeSku(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("autoPauseDelay"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            autoPauseDelay = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("currentBackupStorageRedundancy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            currentBackupStorageRedundancy = new CurrentBackupStorageRedundancy(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("requestedBackupStorageRedundancy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            requestedBackupStorageRedundancy = new RequestedBackupStorageRedundancy(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("minCapacity"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            minCapacity = property0.Value.GetDouble();
                            continue;
                        }
                        if (property0.NameEquals("pausedDate"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            pausedDate = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("resumedDate"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            resumedDate = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("maintenanceConfigurationId"))
                        {
                            maintenanceConfigurationId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("isLedgerOn"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isLedgerOn = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("isInfraEncryptionEnabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isInfraEncryptionEnabled = property0.Value.GetBoolean();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new SqlDatabaseData(id, name, type, systemData, tags, location, sku.Value, kind.Value, managedBy.Value, Optional.ToNullable(createMode), collation.Value, Optional.ToNullable(maxSizeBytes), Optional.ToNullable(sampleName), elasticPoolId.Value, sourceDatabaseId.Value, Optional.ToNullable(status), Optional.ToNullable(databaseId), Optional.ToNullable(creationDate), currentServiceObjectiveName.Value, requestedServiceObjectiveName.Value, defaultSecondaryLocation.Value, failoverGroupId.Value, Optional.ToNullable(restorePointInTime), Optional.ToNullable(sourceDatabaseDeletionDate), recoveryServicesRecoveryPointId.Value, longTermRetentionBackupResourceId.Value, recoverableDatabaseId.Value, restorableDroppedDatabaseId.Value, Optional.ToNullable(catalogCollation), Optional.ToNullable(zoneRedundant), Optional.ToNullable(licenseType), Optional.ToNullable(maxLogSizeBytes), Optional.ToNullable(earliestRestoreDate), Optional.ToNullable(readScale), Optional.ToNullable(highAvailabilityReplicaCount), Optional.ToNullable(secondaryType), currentSku.Value, Optional.ToNullable(autoPauseDelay), Optional.ToNullable(currentBackupStorageRedundancy), Optional.ToNullable(requestedBackupStorageRedundancy), Optional.ToNullable(minCapacity), Optional.ToNullable(pausedDate), Optional.ToNullable(resumedDate), maintenanceConfigurationId.Value, Optional.ToNullable(isLedgerOn), Optional.ToNullable(isInfraEncryptionEnabled)));
        }
 /// <inheritdoc cref="IZooKeeperClient.CreateAsync"/>
 public static CreateResult Create(this IZooKeeperClient client, [NotNull] string path, CreateMode createMode, [CanBeNull] byte[] data = null) =>
 client.Create(new CreateRequest(path, createMode)
 {
     Data = data
 });
示例#9
0
 /// <summary>
 /// Instantiate scene content from JSON data. Return root node if successful.
 /// </summary>
 public Node InstantiateJson(MemoryBuffer source, Urho.Vector3 position, Urho.Quaternion rotation, CreateMode mode = CreateMode.Replicated)
 {
     Runtime.ValidateRefCounted(this);
     return(Runtime.LookupObject <Node> (Scene_InstantiateJSON_MemoryBuffer(handle, (object)source == null ? IntPtr.Zero : source.Handle, ref position, ref rotation, mode)));
 }
示例#10
0
			public ZooKeeperOperationAnonymousInnerClass(ProtocolSupport outerInstance, string path, sbyte[] data, IList<ACL> acl, CreateMode flags)
			{
				this.outerInstance = outerInstance;
				this.path = path;
				this.data = data;
				this.acl = acl;
				this.flags = flags;
			}
    //---------------------------------------------------------------

    public void setToRandomMode()
    {
        currentMode = CreateMode.Random;
    }
 public void setToEditedMode()
 {
     currentMode = CreateMode.Edited;
 }
示例#13
0
 /**
  * Ensures that the given path exists with the given data, ACL and flags
  * @param path
  * @param acl
  * @param flags
  */
 protected void EnsureExists(string path, byte[] data, List<ACL> acl, CreateMode flags)
 {
     try
     {
         RetryOperation(() =>
         {
             Stat stat = Zookeeper.Exists(path, false);
             if (stat != null)
             {
                 return true;
             }
             Zookeeper.Create(path, data, acl, flags);
             return true;
         });
     }
     catch (KeeperException e)
     {
         LOG.Warn("Caught: " + e, e);
     }
     catch (ThreadInterruptedException e)
     {
         LOG.Warn("Caught: " + e, e);
     }
 }
示例#14
0
 public static int nc_create_chunked(string path, CreateMode mode, out int ncidp, IntPtr size, IntPtr nelems, float preemption)
 {
     lock (namebuf)
     {
         var r = NetCDFDynamic.f_nc_set_chunk_cache.Invoke(size, nelems, preemption);
         if (0 == r)
             return NetCDFDynamic.f_nc_create.Invoke(path, mode, out ncidp);
         else
         { ncidp = 0; return r; }
     }
 }
示例#15
0
 public static int nc_create(string path, CreateMode mode, out int ncidp) { lock (namebuf) { return NetCDFDynamic.f_nc_create.Invoke(path, mode, out ncidp); } }
示例#16
0
文件: Node.cs 项目: elix22/Urho3D-1
 public T CreateComponent <T>(CreateMode mode = CreateMode.Replicated, uint id = 0) where T : Component
 {
     return((T)CreateComponent(typeof(T).Name, mode, id));
 }
示例#17
0
        public void SetMode(CreateMode mode)
        {
            AsimovLog.WriteLine("Setting mode to to {0}.", mode);

            this.communicator.ExecuteCommand("MODE {0}", mode.ToString().ToUpper());
        }
示例#18
0
 internal static extern IntPtr Scene_InstantiateXML1_File(IntPtr handle, IntPtr source, ref Urho.Vector3 position, ref Urho.Quaternion rotation, CreateMode mode);
示例#19
0
		/// <summary>
		/// Ensures that the given path exists with the given data, ACL and flags
		/// </summary>
		/// <param name="path"> </param>
		/// <param name="acl"> </param>
		/// <param name="flags"> </param>
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: protected void ensureExists(final String path, final byte[] data, final java.util.List<org.apache.zookeeper.data.ACL> acl, final org.apache.zookeeper.CreateMode flags)
		protected internal virtual void ensureExists(string path, sbyte[] data, IList<ACL> acl, CreateMode flags)
		{
			try
			{
				retryOperation(new ZooKeeperOperationAnonymousInnerClass(this, path, data, acl, flags));
			}
			catch (KeeperException e)
			{
				LOG.warn("Caught: " + e, e);
			}
			catch (InterruptedException e)
			{
				LOG.warn("Caught: " + e, e);
			}
		}
示例#20
0
 public static int nc_create(string path, CreateMode mode, out int ncidp) { lock (LockObject) { var r = NetCDFInterop.nc_create(path, mode, out ncidp); return r; } }
示例#21
0
 public Task<string> CreateAsync(string path, byte[] data, List<ACL> acl, CreateMode createMode)
 {
     return _zookeeper.createAsync(path, data, acl, createMode);
 }
示例#22
0
		/*
		 * 生成一个临时结点
		 */
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public String createEphemeralNode(String path, String value, org.apache.zookeeper.CreateMode createMode) throws Exception
		public virtual string createEphemeralNode(string path, string value, CreateMode createMode)
		{

			return store.createEphemeralNode(path, value, createMode);
		}
示例#23
0
文件: Scene.cs 项目: sami1971/urho
 /// <summary>
 /// Get free component ID, either non-local or local.
 /// </summary>
 public uint GetFreeComponentID(CreateMode mode)
 {
     Runtime.ValidateRefCounted(this);
     return(Scene_GetFreeComponentID(handle, mode));
 }
 /// <inheritdoc cref="IZooKeeperClient.CreateAsync"/>
 public static async Task <CreateResult> CreateAsync(this IZooKeeperClient client, [NotNull] string path, CreateMode createMode, [CanBeNull] byte[] data = null) =>
 await client.CreateAsync(new CreateRequest(path, createMode) { Data = data }).ConfigureAwait(false);
示例#25
0
 ///GENMHASH:A521981B274EF2B3D621C0705EFAA811:F997282671508A55A64229130D4ED37B
 public SqlDatabaseForElasticPoolImpl WithMode(CreateMode createMode)
 {
     this.sqlDatabase.WithMode(createMode);
     return(this);
 }
示例#26
0
 public String Create <T>(string path, T data, IEnumerable <Org.Apache.Zookeeper.Data.ACL> acl, CreateMode mode)
 {
     return(Create(path, ZNodesDataStructures.serialize(data), acl, mode));
 }
示例#27
0
        /// <summary>
        /// 创建节点。
        /// </summary>
        /// <param name="path">节点路径。</param>
        /// <param name="data">节点数据。</param>
        /// <param name="acls">权限。</param>
        /// <param name="createMode">创建模式。</param>
        /// <returns>节点路径。</returns>
        /// <remarks>
        /// 因为使用序列方式创建节点zk会修改节点name,所以需要返回真正的节点路径。
        /// </remarks>
        public async Task <string> CreateAsync(string path, byte[] data, List <ACL> acls, CreateMode createMode)
        {
            path = GetZooKeeperPath(path);

            var nodeEntry = GetOrAddNodeEntry(path);

            return(await RetryUntilConnected(async() => await nodeEntry.CreateAsync(data, acls, createMode)));
        }
示例#28
0
 public async Task makePath(string path, CreateMode createMode, bool retryOnConnLoss)
 {
     await makePath(path, null, createMode, retryOnConnLoss);
 }
    //绘制模式选择按钮
    void DrawModeChoose()
    {
        m_bShowChoosepng = EditorGUILayout.Foldout(m_bShowChoosepng, "选择生成点");
        switch (m_enCreateMode)
        {
        case CreateMode.enObstcale:
            ChangeTexture(ref m_ObstcalePng);
            break;

        case CreateMode.enScenePoint:
            ChangeTexture(ref m_ScenePointPng);
            break;

        case CreateMode.enRegionObj:
            ChangeTexture(ref m_RegionPng);
            break;

        case CreateMode.enPointObj:
            ChangeTexture(ref m_PointPng);
            break;

        case CreateMode.enPathPoint:
            ChangeTexture(ref m_PathPointPng);
            break;

        case CreateMode.enPatrolPoint:
            ChangeTexture(ref m_PatrolPng);
            break;

        default:
            break;
        }
        if (m_bShowChoosepng)
        {
            StartSpace(1);
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(m_ObstcalePng, GUILayout.Width(80), GUILayout.Height(80)))
            {
                m_enCreateMode = CreateMode.enObstcale;
            }
            if (GUILayout.Button(m_RegionPng, GUILayout.Width(80), GUILayout.Height(80)))
            {
                m_enCreateMode = CreateMode.enRegionObj;
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(m_PointPng, GUILayout.Width(80), GUILayout.Height(80)))
            {
                m_enCreateMode = CreateMode.enPointObj;
            }
            if (GUILayout.Button(m_ScenePointPng, GUILayout.Width(80), GUILayout.Height(80)))
            {
                m_enCreateMode = CreateMode.enScenePoint;
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();

            if (GUILayout.Button(m_PathPointPng, GUILayout.Width(80), GUILayout.Height(80)))
            {
                m_enCreateMode = CreateMode.enPathPoint;
            }

            if (GUILayout.Button(m_PatrolPng, GUILayout.Width(80), GUILayout.Height(80)))
            {
                m_enCreateMode = CreateMode.enPatrolPoint;
            }

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();

            EndSpace();
            GUILayout.EndHorizontal();
        }
    }
示例#30
0
 /// <summary>
 /// Creates the path in ZooKeeper, creating each node as necessary.
 ///
 /// e.g. If <code>path=/solr/group/node</code> and none of the nodes, solr,
 /// group, node exist, each will be created.
 /// </summary>
 /// <param name="path"></param>
 /// <param name="data">To set on the last zkNode</param>
 /// <param name="createMode"></param>
 /// <param name="watcher"></param>
 /// <param name="failOnExists"></param>
 /// <param name="retryOnConnLoss"></param>
 /// <returns></returns>
 public async Task makePath(string path, byte[] data, CreateMode createMode,
                            Watcher watcher, bool failOnExists, bool retryOnConnLoss)
 {
     await makePath(path, data, createMode, watcher, failOnExists, retryOnConnLoss, 0);
 }
 public static string ToSerialString(this CreateMode value) => value switch
 {
示例#32
0
 public async Task makePath(string zkPath, CreateMode createMode, Watcher watcher, bool retryOnConnLoss)
 {
     await makePath(zkPath, null, createMode, watcher, retryOnConnLoss);
 }
示例#33
0
 public ZKNode(string path, object data, CreateMode createMode)
 {
     this.path       = path;
     this.data       = data;
     this.createMode = createMode;
 }
示例#34
0
 public async Task <string> Create(string path, string data, CreateMode mode)
 {
     return(await RetryUntilConnected(async() => await _zk.createAsync(path, Encoding.UTF8.GetBytes(data), ZooDefs.Ids.OPEN_ACL_UNSAFE, mode)));
 }
示例#35
0
 public string Create(string path, byte[] data, CreateMode mode)
 {
     return(this._zk.Create(path, data, Ids.OPEN_ACL_UNSAFE, mode));
 }
示例#36
0
        internal static DatabaseAccountData DeserializeDatabaseAccountData(JsonElement element)
        {
            Optional <DatabaseAccountKind> kind       = default;
            Optional <ResourceIdentity>    identity   = default;
            Optional <SystemData>          systemData = default;
            IDictionary <string, string>   tags       = default;
            Location           location                    = default;
            ResourceIdentifier id                          = default;
            string             name                        = default;
            ResourceType       type                        = default;
            Optional <string>  provisioningState           = default;
            Optional <string>  documentEndpoint            = default;
            Optional <string>  databaseAccountOfferType    = default;
            Optional <IList <IpAddressOrRange> > ipRules   = default;
            Optional <bool> isVirtualNetworkFilterEnabled  = default;
            Optional <bool> enableAutomaticFailover        = default;
            Optional <ConsistencyPolicy> consistencyPolicy = default;
            Optional <IList <DatabaseAccountCapability> >       capabilities     = default;
            Optional <IReadOnlyList <DatabaseAccountLocation> > writeLocations   = default;
            Optional <IReadOnlyList <DatabaseAccountLocation> > readLocations    = default;
            Optional <IReadOnlyList <DatabaseAccountLocation> > locations        = default;
            Optional <IReadOnlyList <FailoverPolicy> >          failoverPolicies = default;
            Optional <IList <VirtualNetworkRule> > virtualNetworkRules           = default;
            Optional <IReadOnlyList <PrivateEndpointConnectionData> > privateEndpointConnections = default;
            Optional <bool>                           enableMultipleWriteLocations = default;
            Optional <bool>                           enableCassandraConnector     = default;
            Optional <ConnectorOffer>                 connectorOffer = default;
            Optional <bool>                           disableKeyBasedMetadataWriteAccess = default;
            Optional <string>                         keyVaultKeyUri                 = default;
            Optional <string>                         defaultIdentity                = default;
            Optional <PublicNetworkAccess>            publicNetworkAccess            = default;
            Optional <bool>                           enableFreeTier                 = default;
            Optional <ApiProperties>                  apiProperties                  = default;
            Optional <bool>                           enableAnalyticalStorage        = default;
            Optional <AnalyticalStorageConfiguration> analyticalStorageConfiguration = default;
            Optional <string>                         instanceId        = default;
            Optional <CreateMode>                     createMode        = default;
            Optional <RestoreParameters>              restoreParameters = default;
            Optional <BackupPolicy>                   backupPolicy      = default;
            Optional <IList <CorsPolicy> >            cors                        = default;
            Optional <NetworkAclBypass>               networkAclBypass            = default;
            Optional <IList <string> >                networkAclBypassResourceIds = default;
            Optional <bool>                           disableLocalAuth            = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    kind = new DatabaseAccountKind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("identity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    identity = JsonSerializer.Deserialize <ResourceIdentity>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("documentEndpoint"))
                        {
                            documentEndpoint = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("databaseAccountOfferType"))
                        {
                            databaseAccountOfferType = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("ipRules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <IpAddressOrRange> array = new List <IpAddressOrRange>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(IpAddressOrRange.DeserializeIpAddressOrRange(item));
                            }
                            ipRules = array;
                            continue;
                        }
                        if (property0.NameEquals("isVirtualNetworkFilterEnabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isVirtualNetworkFilterEnabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("enableAutomaticFailover"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableAutomaticFailover = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("consistencyPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            consistencyPolicy = ConsistencyPolicy.DeserializeConsistencyPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("capabilities"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <DatabaseAccountCapability> array = new List <DatabaseAccountCapability>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(DatabaseAccountCapability.DeserializeDatabaseAccountCapability(item));
                            }
                            capabilities = array;
                            continue;
                        }
                        if (property0.NameEquals("writeLocations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <DatabaseAccountLocation> array = new List <DatabaseAccountLocation>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(DatabaseAccountLocation.DeserializeDatabaseAccountLocation(item));
                            }
                            writeLocations = array;
                            continue;
                        }
                        if (property0.NameEquals("readLocations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <DatabaseAccountLocation> array = new List <DatabaseAccountLocation>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(DatabaseAccountLocation.DeserializeDatabaseAccountLocation(item));
                            }
                            readLocations = array;
                            continue;
                        }
                        if (property0.NameEquals("locations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <DatabaseAccountLocation> array = new List <DatabaseAccountLocation>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(DatabaseAccountLocation.DeserializeDatabaseAccountLocation(item));
                            }
                            locations = array;
                            continue;
                        }
                        if (property0.NameEquals("failoverPolicies"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <FailoverPolicy> array = new List <FailoverPolicy>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(FailoverPolicy.DeserializeFailoverPolicy(item));
                            }
                            failoverPolicies = array;
                            continue;
                        }
                        if (property0.NameEquals("virtualNetworkRules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <VirtualNetworkRule> array = new List <VirtualNetworkRule>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(VirtualNetworkRule.DeserializeVirtualNetworkRule(item));
                            }
                            virtualNetworkRules = array;
                            continue;
                        }
                        if (property0.NameEquals("privateEndpointConnections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <PrivateEndpointConnectionData> array = new List <PrivateEndpointConnectionData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PrivateEndpointConnectionData.DeserializePrivateEndpointConnectionData(item));
                            }
                            privateEndpointConnections = array;
                            continue;
                        }
                        if (property0.NameEquals("enableMultipleWriteLocations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableMultipleWriteLocations = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("enableCassandraConnector"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableCassandraConnector = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("connectorOffer"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            connectorOffer = new ConnectorOffer(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("disableKeyBasedMetadataWriteAccess"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            disableKeyBasedMetadataWriteAccess = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("keyVaultKeyUri"))
                        {
                            keyVaultKeyUri = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("defaultIdentity"))
                        {
                            defaultIdentity = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("publicNetworkAccess"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("enableFreeTier"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableFreeTier = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("apiProperties"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            apiProperties = ApiProperties.DeserializeApiProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("enableAnalyticalStorage"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableAnalyticalStorage = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("analyticalStorageConfiguration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            analyticalStorageConfiguration = AnalyticalStorageConfiguration.DeserializeAnalyticalStorageConfiguration(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("instanceId"))
                        {
                            instanceId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("createMode"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            createMode = new CreateMode(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("restoreParameters"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            restoreParameters = RestoreParameters.DeserializeRestoreParameters(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("backupPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            backupPolicy = BackupPolicy.DeserializeBackupPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("cors"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <CorsPolicy> array = new List <CorsPolicy>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(CorsPolicy.DeserializeCorsPolicy(item));
                            }
                            cors = array;
                            continue;
                        }
                        if (property0.NameEquals("networkAclBypass"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            networkAclBypass = property0.Value.GetString().ToNetworkAclBypass();
                            continue;
                        }
                        if (property0.NameEquals("networkAclBypassResourceIds"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            networkAclBypassResourceIds = array;
                            continue;
                        }
                        if (property0.NameEquals("disableLocalAuth"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            disableLocalAuth = property0.Value.GetBoolean();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new DatabaseAccountData(id, name, type, tags, location, Optional.ToNullable(kind), identity, systemData, provisioningState.Value, documentEndpoint.Value, databaseAccountOfferType.Value, Optional.ToList(ipRules), Optional.ToNullable(isVirtualNetworkFilterEnabled), Optional.ToNullable(enableAutomaticFailover), consistencyPolicy.Value, Optional.ToList(capabilities), Optional.ToList(writeLocations), Optional.ToList(readLocations), Optional.ToList(locations), Optional.ToList(failoverPolicies), Optional.ToList(virtualNetworkRules), Optional.ToList(privateEndpointConnections), Optional.ToNullable(enableMultipleWriteLocations), Optional.ToNullable(enableCassandraConnector), Optional.ToNullable(connectorOffer), Optional.ToNullable(disableKeyBasedMetadataWriteAccess), keyVaultKeyUri.Value, defaultIdentity.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(enableFreeTier), apiProperties.Value, Optional.ToNullable(enableAnalyticalStorage), analyticalStorageConfiguration.Value, instanceId.Value, Optional.ToNullable(createMode), restoreParameters.Value, backupPolicy.Value, Optional.ToList(cors), Optional.ToNullable(networkAclBypass), Optional.ToList(networkAclBypassResourceIds), Optional.ToNullable(disableLocalAuth)));
        }
示例#37
0
 public static async Task <string> CreateNode_(this ZooKeeper client, string path, CreateMode mode, byte[] data = null) =>
 await client.createAsync(path, data, Ids.OPEN_ACL_UNSAFE, mode);
示例#38
0
 internal static extern IntPtr Scene_InstantiateJSON_MemoryBuffer(IntPtr handle, IntPtr source, ref Urho.Vector3 position, ref Urho.Quaternion rotation, CreateMode mode);
示例#39
0
 public T CreateComponent <T>(CreateMode mode = CreateMode.Replicated, uint id = 0) where T : Component
 {
     return(GetManagedInstance <T>(
                Urho3D__Node__CreateComponent_Urho3D__StringHash_Urho3D__CreateMode_unsigned_int_(
                    NativeInstance, StringHash.Calculate(typeof(T).Name), mode, id), false));
 }
示例#40
0
 internal static extern uint Scene_GetFreeNodeID(IntPtr handle, CreateMode mode);
示例#41
0
 public static extern int nc_open(
     [In, MarshalAs(UnmanagedType.LPStr)]
     string path,
     CreateMode mode,
     out int ncidp);
示例#42
0
 public static extern int nc_create(string path, CreateMode mode, ref int ncidp);
示例#43
0
        //--------------------------------------------------------------------------------------------------

        public CreateSketchTool(CreateMode createMode = CreateMode.Interactive)
        {
            _InitialCreateMode = createMode;
        }
示例#44
0
 private void EvaluateMessages(CreateMode obj)
 {
     _editMode = obj;
 }
示例#45
0
		/// <param name="path"> </param>
		/// <param name="value">
		/// </param>
		/// <returns> void
		/// </returns>
		/// <exception cref="InterruptedException"> </exception>
		/// <exception cref="KeeperException">
		/// @Description: 创建一个临时结点,如果原本存在,则不新建, 如果存在,则更新值
		/// @author liaoqiqi
		/// @date 2013-6-14 </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public String createEphemeralNode(String path, String value, org.apache.zookeeper.CreateMode createMode) throws InterruptedException, org.apache.zookeeper.KeeperException
		public virtual string createEphemeralNode(string path, string value, CreateMode createMode)
		{

			int retries = 0;
			while (true)
			{

				try
				{

					Stat stat = zk.exists(path, false);

					if (stat == null)
					{

						return zk.create(path, value.GetBytes(CHARSET), Ids.OPEN_ACL_UNSAFE, createMode);

					}
					else
					{

						if (!string.ReferenceEquals(value, null))
						{
							zk.setData(path, value.GetBytes(CHARSET), stat.Version);
						}
					}

					return path;

				}
				catch (KeeperException.SessionExpiredException e)
				{

					throw e;

				}
				catch (KeeperException e)
				{

					LOGGER.warn("createEphemeralNode connect lost... will retry " + retries + "\t" + e.ToString());

					if (retries++ == MAX_RETRIES)
					{
						throw e;
					}
					// sleep then retry
					int sec = RETRY_PERIOD_SECONDS * retries;
					LOGGER.warn("sleep " + sec);
					TimeUnit.SECONDS.sleep(sec);
				}
			}
		}