/*
(non-Javadoc)

@see com.impetus.kundera.configure.schema.api.AbstractSchemaManager#
exportSchema (java.lang.String, java.util.List)
760591
@Override
    public void exportSchema(String persistenceUnit, List<TableInfo> puToSchemaCol)
    {
        super.exportSchema(persistenceUnit, puToSchemaCol);
    }
431825
public void addSchema( String uri, IslandSchema s ) {
		if( schemata.containsKey(uri) )
			throw new IllegalArgumentException();
		schemata.put( uri, s );
	}
882732
function getSchema(key) {
	var matches = key.match(/^\[(.*)\]$/); // key in [] is optional
	if (matches) return [matches[1], exports[matches[1]].optional().allow(null)];
	return [key, exports[key]];
}
1006630
@Override
  public String getSchema() throws IOException {
    try {
      return this.kafkaSchemaRegistry.getLatestSchemaByTopic(this.topicName);
    } catch (SchemaRegistryException e) {
      throw new RuntimeException(e);
    }
  }
49233
public static StructType fromSchema(Schema schema) {
        StructField[] structFields = new StructField[schema.numColumns()];
        for (int i = 0; i < structFields.length; i++) {
            switch (schema.getColumnTypes().get(i)) {
                case Double:
                    structFields[i] = new StructField(schema.getName(i), DataTypes.DoubleType, false, Metadata.empty());
                    break;
                case Integer:
                    structFields[i] =
                                    new StructField(schema.getName(i), DataTypes.IntegerType, false, Metadata.empty());
                    break;
                case Long:
                    structFields[i] = new StructField(schema.getName(i), DataTypes.LongType, false, Metadata.empty());
                    break;
                case Float:
                    structFields[i] = new StructField(schema.getName(i), DataTypes.FloatType, false, Metadata.empty());
                    break;
                default:
                    throw new IllegalStateException(
                                    "This api should not be used with strings , binary data or ndarrays. This is only for columnar data");
            }
        }
        return new StructType(structFields);
    }
449597
function Schema(model) {
        var _this = this;
        /**
         * List of generated schemas.
         */
        this.schemas = {};
        this.model = model;
        var models = model.database().models();
        Object.keys(models).forEach(function (name) { _this.one(models[name]); });
    }
525666
public Schema schema(TableSchema schema) {
		tableSchema.clear();
		lastField = null;
		for (int i = 0; i < schema.getFieldCount(); i++) {
			field(schema.getFieldName(i).get(), schema.getFieldType(i).get());
		}
		return this;
	}
258658
function  getQueryTableSchema(tables, cb) {
	var  tableSchema = {};

	async.each(tables, function(t, callback) {
		var  tbName = t.name;
		schemaTool.getSchema(tbName, function(err, schema) {
			if (!err)  {
				tableSchema[tbName] = schema;
				if (t.alias)
					tableSchema[t.alias] = schema;
			}
			callback(err);
		});
	},
	function(err) {
		cb(err, tableSchema);
	});
}
217224
public void export(DatabaseMetaData md) throws SQLException {
        if (beanPackageName == null) {
            beanPackageName =  module.getPackageName();
        }
        if (beansTargetFolder == null) {
            beansTargetFolder = targetFolder;
        }
        module.bind(SQLCodegenModule.BEAN_PACKAGE_NAME, beanPackageName);

        if (spatial) {
            SpatialSupport.addSupport(module);
        }

        classes.clear();
        typeMappings = module.get(TypeMappings.class);
        queryTypeFactory = module.get(QueryTypeFactory.class);
        serializer = module.get(Serializer.class);
        beanSerializer = module.get(Serializer.class, SQLCodegenModule.BEAN_SERIALIZER);
        namingStrategy = module.get(NamingStrategy.class);
        configuration = module.get(Configuration.class);

        SQLTemplates templates = sqlTemplatesRegistry.getTemplates(md);
        if (templates != null) {
            configuration.setTemplates(templates);
        } else {
            logger.info("Found no specific dialect for " + md.getDatabaseProductName());
        }

        if (beanSerializer == null) {
            keyDataFactory = new KeyDataFactory(namingStrategy,  module.getPackageName(),
                    module.getPrefix(), module.getSuffix(), schemaToPackage);
        } else {
            keyDataFactory = new KeyDataFactory(namingStrategy, beanPackageName,
                    module.getBeanPrefix(), module.getBeanSuffix(), schemaToPackage);
        }

        String[] typesArray = null;

        if (tableTypesToExport != null && !tableTypesToExport.isEmpty()) {
            List<String> types = new ArrayList<String>();
            for (String tableType : tableTypesToExport.split(",")) {
                types.add(tableType.trim());
            }
            typesArray = types.toArray(new String[types.size()]);
        } else if (!exportAll) {
            List<String> types = new ArrayList<String>(2);
            if (exportTables) {
                types.add("TABLE");
            }
            if (exportViews) {
                types.add("VIEW");
            }
            typesArray = types.toArray(new String[types.size()]);
        }

        List<String> schemas = Arrays.asList(schemaPattern);
        if (schemaPattern != null && schemaPattern.contains(",")) {
            schemas = ImmutableList.copyOf(schemaPattern.split(","));
        }
        List<String> tables = Arrays.asList(tableNamePattern);
        if (tableNamePattern != null && tableNamePattern.contains(",")) {
            tables = ImmutableList.copyOf(tableNamePattern.split(","));
        }

        for (String schema : schemas) {
            schema = schema != null ? schema.trim() : null;
            for (String table : tables) {
                table = table != null ? table.trim() : null;
                handleTables(md, schema, table, typesArray);
            }
        }
    }
1318105
private List<SchemaDescriptor> createSchemas(Catalog catalog, Store store) throws IOException {
        List<SchemaDescriptor> schemaDescriptors = new ArrayList<>();
        Map<String, ColumnTypeDescriptor> columnTypes = new HashMap<>();
        Map<Column, ColumnDescriptor> allColumns = new HashMap<>();
        Set<ForeignKey> allForeignKeys = new HashSet<>();
        for (Schema schema : catalog.getSchemas()) {
            SchemaDescriptor schemaDescriptor = store.create(SchemaDescriptor.class);
            schemaDescriptor.setName(schema.getName());
            // Tables
            createTables(catalog, schema, schemaDescriptor, columnTypes, allColumns, allForeignKeys, store);
            // Sequences
            createSequences(catalog.getSequences(schema), schemaDescriptor, store);
            // Procedures and Functions
            createRoutines(catalog.getRoutines(schema), schemaDescriptor, columnTypes, store);
            schemaDescriptors.add(schemaDescriptor);
        }
        // Foreign keys
        createForeignKeys(allForeignKeys, allColumns, store);
        return schemaDescriptors;
    }
793415
@Override
  public JsonArray convertSchema(String inputSchema, WorkUnitState workUnit)
      throws SchemaConversionException {
    this.unpackComplexSchemas =
        workUnit.getPropAsBoolean(UNPACK_COMPLEX_SCHEMAS_KEY, DEFAULT_UNPACK_COMPLEX_SCHEMAS_KEY);

    JsonParser jsonParser = new JsonParser();
    log.info("Schema: " + inputSchema);
    JsonElement jsonSchema = jsonParser.parse(inputSchema);
    return jsonSchema.getAsJsonArray();
  }
617658
public String getValueSchema() throws IOException {
        Schema schema = getInputPathAvroSchema();
        String valueSchema = schema.getField(valueFieldName).schema().toString();
        return valueSchema;
    }
140574
function array_jsonSchema(name) {
  var result = {};
  var itemName;

  itemName = 'itemOf_' + name;

  result.type = 'array';
  if (this.options.required) result.__required = true;

  if (this.schema) {
    result.items = this.schema.jsonSchema(itemName);
  } else {
    result.items = this.caster.jsonSchema(itemName);
  }

  if (result.items.__required) {
    result.minItems = 1;
  }

  __processOptions(result, this.options);
  delete result.items.__required;

  return result;
}
1181033
public void setSchema(String schema) throws SQLException {
        Transaction suspendTx = null;

        if (mcf.beforeJDBCVersion(JDBCRuntimeVersion.VERSION_4_1))
            throw new SQLFeatureNotSupportedException();

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(this, tc, "Set Schema to " + schema);
        // Global trans must be suspended for jdbc-4.1 getters and setters on zOS 
        if (AdapterUtil.isZOS() && isGlobalTransactionActive())
            suspendTx = suspendGlobalTran();

        try {
            mcf.jdbcRuntime.doSetSchema(sqlConn, schema);
            currentSchema = schema;
            connectionPropertyChanged = true;
        } catch (SQLException sqle) {
            throw sqle;
        } finally {
            if (suspendTx != null)
                resumeGlobalTran(suspendTx);
        }
    }
434068
@Override
  public OperationHandle getSchemas(SessionHandle sessionHandle, String catalogName,
      String schemaName) throws HiveSQLException {
    return cliService.getSchemas(sessionHandle, catalogName, schemaName);
  }
501790
public Json jsonSchema(String jsonSchema) {
		Preconditions.checkNotNull(jsonSchema);
		this.jsonSchema = jsonSchema;
		this.schema = null;
		this.deriveSchema = null;
		return this;
	}
658815
@Override
  public OperationHandle getSchemas(SessionHandle sessionHandle,
      String catalogName, String schemaName)
          throws HiveSQLException {
    OperationHandle opHandle = sessionManager.getSession(sessionHandle)
        .getSchemas(catalogName, schemaName);
    LOG.debug(sessionHandle + ": getSchemas()");
    return opHandle;
  }