All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.geosolutions.geoserver.rest.decoder.RESTMetadataList Maven / Gradle / Ivy

Go to download

GeoServer Manager is a library to interact with GeoServer The scope of this library is to have a simple API, and use as few external libs as possible.

There is a newer version: 1.8.7
Show newest version
/*
 *  GeoBatch - Open Source geospatial batch processing system
 *  https://github.com/nfms4redd/nfms-geobatch
 *  Copyright (C) 2007-2012 GeoSolutions S.A.S.
 *  http://www.geo-solutions.it
 *
 *  GPLv3 + Classpath exception
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see .
 */
package it.geosolutions.geoserver.rest.decoder;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

import org.jdom.Element;

/**
 * 

RESTMetadataList class.

* * @author DamianoG * @version $Id: $ */ public class RESTMetadataList implements Iterable { private final List metadataList; /** *

Constructor for RESTMetadataList.

* * @param list a {@link org.jdom.Element} object. */ protected RESTMetadataList(Element list) { List tmpList = new ArrayList(); for(Element el : (List)list.getChildren("entry")){ tmpList.add(el); } metadataList = Collections.unmodifiableList(tmpList); } /** *

size

* * @return a int. */ public int size() { return metadataList.size(); } /** *

isEmpty

* * @return a boolean. */ public boolean isEmpty() { return metadataList.isEmpty(); } /** *

get

* * @param index a int. * @return a {@link it.geosolutions.geoserver.rest.decoder.RESTMetadataList.RESTMetadataElement} object. */ public RESTMetadataElement get(int index) { return new RESTMetadataElement(metadataList.get(index)); } /* (non-Javadoc) * @see java.lang.Iterable#iterator() */ /** {@inheritDoc} */ @Override public Iterator iterator() { return new RESTMetadataIterator(metadataList); } private static class RESTMetadataIterator implements Iterator{ private final Iterator iter; /** * @param iter */ public RESTMetadataIterator(List orig) { this.iter = orig.iterator(); } /* (non-Javadoc) * @see java.util.Iterator#hasNext() */ @Override public boolean hasNext() { return iter.hasNext(); } /* (non-Javadoc) * @see java.util.Iterator#next() */ @Override public RESTMetadataElement next() { return new RESTMetadataElement(iter.next()); } /* (non-Javadoc) * @see java.util.Iterator#remove() */ @Override public void remove() { throw new UnsupportedOperationException("Not supported."); } } /** * Generic metadata Object * * @author DamianoG * */ public static class RESTMetadataElement { protected final Element metadataElem; public RESTMetadataElement(Element elem) { this.metadataElem = elem; } public String getKey() { return metadataElem.getAttributeValue("key"); } public Element getMetadataElem() { return metadataElem; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy