
com.sun.syndication.propono.blogclient.atomprotocol.AtomEntryIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rome-propono Show documentation
Show all versions of rome-propono Show documentation
The ROME Propono subproject is a Java class library that
supports publishing protocols, specifically the Atom Publishing Protocol
and the legacy MetaWeblog API. Propono includes an Atom client library,
Atom server framework and a Blog client that supports both Atom protocol
and the MetaWeblog API.
The newest version!
/*
* Copyright 2007 Dave Johnson (Blogapps project)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sun.syndication.propono.blogclient.atomprotocol;
import com.sun.syndication.propono.atom.client.ClientEntry;
import com.sun.syndication.propono.atom.client.ClientMediaEntry;
import java.util.Iterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.sun.syndication.propono.blogclient.BlogClientException;
/**
* Atom protocol implementation of BlogClient entry iterator.
*/
public class AtomEntryIterator implements Iterator {
static final Log logger = LogFactory.getLog(AtomEntryIterator.class);
private Iterator iterator = null;
private AtomCollection collection = null;
AtomEntryIterator(AtomCollection collection) throws BlogClientException {
try {
this.collection = collection;
iterator = collection.getClientCollection().getEntries();
} catch (Exception e) {
throw new BlogClientException("ERROR fetching collection", e);
}
}
/**
* True if more entries are available.
*/
public boolean hasNext() {
return iterator.hasNext();
}
/**
* Get next entry.
*/
public Object next() {
try {
ClientEntry entry = (ClientEntry)iterator.next();
if (entry instanceof ClientMediaEntry) {
return new AtomResource(collection, (ClientMediaEntry)entry);
} else {
return new AtomEntry(collection, entry);
}
} catch (Exception e) {
logger.error("ERROR fetching entry", e);
}
return null;
}
/**
* Remove is not supported.
*/
public void remove() {
// optional method, not implemented
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy