coverage.setSchema(schema); final SchemaType inputSchema = cov.getSchema(); schema.setAttributes(inputSchema.getAttributes()); schema.setName(inputSchema.getName());
if (coverageSchema != null) { imposedSchema = true; schemaAttributes = coverageSchema.getAttributes(); coverageSchemaRef = coverageSchema.getRef();
/** Create an instance of {@link SchemaType } */ public SchemaType createSchemaType() { return new SchemaType(); }
/** * Get the schema with the specified name * * @param name * @return */ public String getSchema(String name) { // return schema; SchemasType schemas = indexer.getSchemas(); if (schemas != null) { List<SchemaType> schemaList = schemas.getSchema(); for (SchemaType schema : schemaList) { if (schema.getName().equalsIgnoreCase(name)) { return schema.getAttributes(); } } } return null; }
/** * Create a Coverage indexer object with the specified set of properties * * @param coverageName name of the coverage * @param origName name of the underlying variable * @param schemaAttributes schema definition attributes * @param schemaName schema name * @return */ private Coverage createCoverate( String coverageName, String origName, String schemaAttributes, String schemaName) { SchemaType schema = OBJECT_FACTORY.createSchemaType(); Coverage coverage = OBJECT_FACTORY.createIndexerCoveragesCoverage(); coverage.setOrigName(origName); coverage.setName(coverageName); coverage.setSchema(schema); schema.setAttributes(schemaAttributes); schema.setName(schemaName); return coverage; }
public String getTypeName(String coverageName) { return coveragesMapping.get(coverageName).getSchema().getName(); }
public SimpleFeatureType getIndexSchema( Name coverageName, CoordinateSystem coordinateSystem, boolean isShared) throws Exception { // get the name for this variable to check his coveragename final String _coverageName = coverageName.toString(); // get the coverage definition for this variable, at this stage this exists otherwise we // would have skipped it! final Coverage coverage = ancillaryFileManager.coveragesMapping.get(_coverageName); // now check the schema creation SchemaType schema = coverage.getSchema(); String schemaDef = schema != null ? schema.getAttributes() : null; // no schema was defined yet, let's create a default one if (schema == null || schema.getAttributes() == null) { // TODO incapsulate in coveragedescriptor schemaDef = suggestSchemaFromCoordinateSystem(coverage, coordinateSystem, isShared); // set the schema name to be the coverageName ancillaryFileManager.setSchema(coverage, coverage.getName(), schemaDef); schema = coverage.getSchema(); } String variableName = ancillaryFileManager.variablesMap.get(coverageName); CoordinateReferenceSystem crs = georeferencing.getCoordinateReferenceSystem(variableName); // create featuretype, the name is the CoverageName final SimpleFeatureType indexSchema = NetCDFUtilities.createFeatureType(coverage.getName(), schemaDef, crs); // create forceSchemaCreation(indexSchema); // return return indexSchema; }
/** * Get a {@link SchemaType} element for the specified {@link Coverage}. The {@link Indexer} * object will be used in case of an externally referenced schema. * * @param indexer the main {@link Indexer} instance * @param coverage the {@link Coverage} element with the Schema to be returned. */ public static SchemaType getSchema(Indexer indexer, Coverage coverage) { Utilities.ensureNonNull("coverage", coverage); SchemaType schema = coverage.getSchema(); if (schema != null) { String schemaRef = schema.getRef(); if (schemaRef != null) { schema = getSchemaRef(indexer, schemaRef); if (schema != null) { return schema; } } return schema; } return null; }
/** * Add the default schema to this coverage * * @param coverage * @return */ public String setSchema(Coverage coverage, final String schemaName, final String schemaDef) { Utilities.ensureNonNull("coverage", coverage); Utilities.ensureNonNull("schemaName", schemaName); if (coverage != null) { SchemaType schema = coverage.getSchema(); if (schema == null) { schema = OBJECT_FACTORY.createSchemaType(); coverage.setSchema(schema); } schema.setName(schemaName); if (schemaDef != null) { schema.setAttributes(schemaDef); } return schemaName; } return null; }
/** * Retrieve basic indexer properties by scanning the indexer XML instance. * * @throws JAXBException */ protected void initIndexer() throws JAXBException { if (indexerFile.exists() && indexerFile.canRead()) { Unmarshaller unmarshaller = CONTEXT.createUnmarshaller(); if (unmarshaller != null) { indexer = (Indexer) unmarshaller.unmarshal(indexerFile); // indexed information about dimensions that supports multiple bands initMultipleBandsDimensionsInfo(indexer); // Parsing schemas final SchemasType schemas = indexer.getSchemas(); Map<String, String> schemaMapping = new HashMap<String, String>(); if (schemas != null) { // Map schema names to schema attributes string List<SchemaType> schemaElements = schemas.getSchema(); for (SchemaType schemaElement : schemaElements) { schemaMapping.put(schemaElement.getName(), schemaElement.getAttributes()); } } // Parsing properties collectors initPropertiesCollectors(); // Parsing coverages initCoverages(schemaMapping); } } }
private static SchemaType getSchemaRef(Indexer indexer, String schemaRef) { Utilities.ensureNonNull("schemaRef", schemaRef); Utilities.ensureNonNull("indexer", indexer); SchemasType schemas = indexer.getSchemas(); if (schemas != null) { List<SchemaType> schemaList = schemas.getSchema(); for (SchemaType schema : schemaList) { final String schemaName = schema.getName(); if (schemaName != null && schemaName.equalsIgnoreCase(schemaRef)) { return schema; } } } return null; }
schemaAttributes = schema.getAttributes(); } else if (schemas != null) { List<SchemaType> schemaList = schemas.getSchema(); schemaAttributes = schemaList.get(0).getAttributes();
coverage.setSchema(schema); final SchemaType inputSchema = cov.getSchema(); schema.setAttributes(inputSchema.getAttributes()); schema.setName(inputSchema.getName());
indexer.setSchemas(schemas); schemas.getSchema().add(schema); schema.setAttributes(props.getProperty(Utils.Prop.SCHEMA)); schema.setName(getParameter(Utils.Prop.INDEX_NAME, indexer));
/** * Retrieve basic indexer properties by scanning the indexer XML instance. * @throws JAXBException */ private void initIndexer() throws JAXBException { if (indexerFile.exists() && indexerFile.canRead()) { Unmarshaller unmarshaller = CONTEXT.createUnmarshaller(); if (unmarshaller != null) { indexer = (Indexer) unmarshaller.unmarshal(indexerFile); // Parsing schemas final SchemasType schemas = indexer.getSchemas(); Map<String, String> schemaMapping = new HashMap<String, String>(); if (schemas != null) { // Map schema names to schema attributes string List<SchemaType> schemaElements = schemas.getSchema(); for (SchemaType schemaElement: schemaElements) { schemaMapping.put(schemaElement.getName(), schemaElement.getAttributes()); } } // Parsing properties collectors initPropertiesCollectors(); // Parsing coverages initCoverages(schemaMapping); } } }
if (coverageSchema != null) { imposedSchema = true; schemaAttributes = coverageSchema.getAttributes(); coverageSchemaRef = coverageSchema.getRef();
if (schema != null) { String schName = schema.getName(); final CoverageSlicesCatalog catalog = reader.getCatalog(); if (catalog != null) {
public SimpleFeatureType getIndexSchema(Name coverageName, CoordinateSystem coordinateSystem) throws Exception { // get the name for this variable to check his coveragename final String _coverageName = coverageName.toString(); // get the coverage definition for this variable, at this stage this exists otherwise we would have skipped it! final Coverage coverage = ancillaryFileManager.coveragesMapping.get(_coverageName); // now check the schema creation SchemaType schema = coverage.getSchema(); String schemaDef=schema!=null?schema.getAttributes():null; // no schema was defined yet, let's create a default one if (schema == null||schema.getAttributes()==null) { // TODO incapsulate in coveragedescriptor schemaDef = suggestSchemaFromCoordinateSystem(coverage, coordinateSystem); //set the schema name to be the coverageName ancillaryFileManager.setSchema(coverage,coverage.getName(),schemaDef); schema = coverage.getSchema(); } // create featuretype, the name is the CoverageName final SimpleFeatureType indexSchema = UnidataUtilities.createFeatureType(coverage.getName(),schemaDef,UnidataCRSUtilities.WGS84); // create forceSchemaCreation(indexSchema); // return return indexSchema; }
CreditCardDocument creditCardDocument = new CreditCardDocumentImpl(new SchemaType());
coverage.setSchema(schema); final SchemaType inputSchema = cov.getSchema(); schema.setAttributes(inputSchema.getAttributes()); schema.setName(inputSchema.getName());