/** * @param varName * @return */ public boolean acceptsVariable(String varName) { Utilities.ensureNonNull("varName", varName); if (indexer == null || indexer.getCoverages() == null) { return true; } for (Coverage filteringCoverage : indexer.getCoverages().getCoverage()) { if (varName.equalsIgnoreCase(filteringCoverage.getName()) || varName.equalsIgnoreCase(filteringCoverage.getOrigName())) { return true; } } return false; }
/** * 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; }
/** * Utility method that wil retrieve from the indexer file information about multiple bands * dimensions and will parse that information and index it by the dimensions names. */ private void initMultipleBandsDimensionsInfo(Indexer indexer) { if (indexer.getMultipleBandsDimensions() == null || indexer.getMultipleBandsDimensions().getMultipleBandsDimension() == null) { // no multiple bands dimensions in the data set return; } for (Indexer.MultipleBandsDimensions.MultipleBandsDimension multipleBandsDimension : indexer.getMultipleBandsDimensions().getMultipleBandsDimension()) { // multiple bands dimensions are ignored by default NetCDFUtilities.addIgnoredDimension(multipleBandsDimension.getName()); // index by the dimensions name the multiple bands information multipleBandsDimensionsInfo.put( multipleBandsDimension.getName(), new MultipleBandsDimensionInfo(multipleBandsDimension.getBandsNames())); } }
final String coverageName, final String domainName, final Indexer indexer) { if (indexer != null) { final Coverages coverages = indexer.getCoverages(); final DomainsType refDomains = indexer.getDomains(); if (coverages != null) { final List<Coverage> coverageList = coverages.getCoverage();
/** * Setup default params to the indexer. * * @param params * @param indexer */ private static void copyDefaultParams(ParametersType params, Indexer indexer) { if (params != null) { List<Parameter> defaultParamList = params.getParameter(); if (defaultParamList != null && !defaultParamList.isEmpty()) { ParametersType parameters = indexer.getParameters(); if (parameters == null) { parameters = Utils.OBJECT_FACTORY.createParametersType(); indexer.setParameters(parameters); } List<Parameter> parameterList = parameters.getParameter(); for (Parameter defaultParameter : defaultParamList) { final String defaultParameterName = defaultParameter.getName(); if (getParameter(defaultParameterName, indexer) == null) { setParam(parameterList, defaultParameterName, defaultParameter.getValue()); } } } } }
public boolean getParameterAsBoolean(String parameterKey) { ParametersType indexerParams = indexer != null ? indexer.getParameters() : null; String param = IndexerUtils.getParam(indexerParams, parameterKey); return Boolean.valueOf(param); }
final Collectors collectors = indexer.getCollectors(); if (collectors != null) { List<Collector> collectorList = collectors.getCollector();
private static Indexer createIndexer(Properties props, ParametersType params) { indexer.setParameters( params != null ? params : Utils.OBJECT_FACTORY.createParametersType()); Coverages coverages = Utils.OBJECT_FACTORY.createIndexerCoverages(); indexer.setCoverages(coverages); List<Coverage> coverageList = coverages.getCoverage(); coverageList.add(coverage); indexer.setParameters(params); List<Parameter> parameters = params.getParameter(); SchemasType schemas = Utils.OBJECT_FACTORY.createSchemasType(); SchemaType schema = Utils.OBJECT_FACTORY.createSchemaType(); indexer.setSchemas(schemas); schemas.getSchema().add(schema); schema.setAttributes(props.getProperty(Utils.Prop.SCHEMA));
indexer.setCoverages(coverages);
String rootMosaicDir = null; if (defaultIndexer != null) { params = defaultIndexer.getParameters(); rootMosaicDir = IndexerUtils.getParam(params, Prop.ROOT_MOSAIC_DIR); Indexer indexer = IndexerUtils.initializeIndexer(params, parent); if (indexer != null) { indexerFile = indexer.getIndexerFile();
/** Create an instance of {@link Indexer } */ public Indexer createIndexer() { return new Indexer(); }
/** * Return the parameter string value of the specified parameter name from the provided indexer * * @param parameterName * @param indexer * @return */ public static String getParameter(String parameterName, Indexer indexer) { final ParametersType params = indexer.getParameters(); return getParam(params, parameterName); }
Collectors collectors = indexer.getCollectors();
indexer.setCoverages(coverages);
/** * Return an indexer {@link Coverage} object from the specified {@link Indexer}, referring to * the requested name. * * @param indexer the main {@link Indexer} instance * @param name the name of the {@link Coverage} element to be retrieved. * @return the {@link Coverage} element for the specified name (if any). */ public static Coverage getCoverage(Indexer indexer, String name) { Coverages coverages = indexer.getCoverages(); if (coverages != null) { List<Coverage> coverageList = coverages.getCoverage(); for (Coverage coverage : coverageList) { String coverageName = coverage.getName(); if (coverageName != null && coverageName.equalsIgnoreCase(name)) { return coverage; } } } 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); } } }
public String getParameter(String parameterKey) { ParametersType indexerParams = indexer != null ? indexer.getParameters() : null; return IndexerUtils.getParam(indexerParams, parameterKey); }
final Collectors collectors = indexer.getCollectors(); if (collectors != null) { List<Collector> collectorList = collectors.getCollector();
indexer.setCoverages(coverages);
if (indexer.getMultipleBandsDimensions() != null && indexer.getMultipleBandsDimensions().getMultipleBandsDimension() != null && !indexer.getMultipleBandsDimensions() .getMultipleBandsDimension() .isEmpty()) { indexer.getMultipleBandsDimensions().getMultipleBandsDimension(); if (multipleBandsDimensions.size() != 1) {