Formatted and cleaned up sources

This commit is contained in:
Patrick Gotthard 2014-05-13 19:28:43 +02:00
parent fbd2ee64b4
commit e99ccfef27
38 changed files with 84 additions and 94 deletions

View file

@ -1,10 +1,10 @@
/*
/*
* Copyright 2007 Sun Microsystems, Inc.
*
*
* 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
@ -16,11 +16,11 @@
package com.rometools.propono.atom.client;
import com.rometools.propono.utils.ProponoException;
import com.sun.syndication.io.impl.Atom10Parser;
/**
* Creates AtomService or ClientCollection based on username, password and end-point URI of Atom protocol service.
* Creates AtomService or ClientCollection based on username, password and end-point URI of Atom
* protocol service.
*/
public class AtomClientFactory {

View file

@ -17,6 +17,7 @@ package com.rometools.propono.atom.client;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethodBase;
import com.rometools.propono.utils.ProponoException;
public interface AuthStrategy {

View file

@ -17,8 +17,8 @@ package com.rometools.propono.atom.client;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethodBase;
import com.rometools.propono.utils.ProponoException;
import com.rometools.propono.utils.ProponoException;
import com.sun.syndication.io.impl.Base64;
public class BasicAuthStrategy implements AuthStrategy {

View file

@ -26,11 +26,11 @@ import org.apache.commons.httpclient.methods.GetMethod;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.input.SAXBuilder;
import com.rometools.propono.atom.common.AtomService;
import com.rometools.propono.utils.ProponoException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.rometools.propono.atom.common.AtomService;
import com.rometools.propono.utils.ProponoException;
import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.io.impl.Atom10Parser;

View file

@ -25,11 +25,13 @@ import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.JDOMException;
import org.jdom2.input.SAXBuilder;
import com.rometools.propono.atom.common.Categories;
import com.rometools.propono.utils.ProponoException;
/**
* Models an Atom protocol Categories element, which may contain ROME Atom {@link com.sun.syndication.feed.atom.Category} elements.
* Models an Atom protocol Categories element, which may contain ROME Atom
* {@link com.sun.syndication.feed.atom.Category} elements.
*/
public class ClientCategories extends Categories {
private ClientCollection clientCollection = null;

View file

@ -26,12 +26,12 @@ import org.apache.commons.httpclient.HttpMethodBase;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.methods.GetMethod;
import org.jdom2.Element;
import com.rometools.propono.atom.common.AtomService;
import com.rometools.propono.atom.common.Categories;
import com.rometools.propono.atom.common.Collection;
import com.rometools.propono.atom.common.Workspace;
import com.rometools.propono.utils.ProponoException;
import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.io.impl.Atom10Parser;

View file

@ -33,11 +33,11 @@ import org.apache.commons.httpclient.methods.EntityEnclosingMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import com.rometools.propono.utils.ProponoException;
import com.rometools.propono.utils.Utilities;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.rometools.propono.utils.ProponoException;
import com.rometools.propono.utils.Utilities;
import com.sun.syndication.feed.atom.Content;
import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.feed.atom.Link;

View file

@ -34,11 +34,11 @@ import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.jdom2.JDOMException;
import com.rometools.propono.utils.ProponoException;
import com.rometools.propono.utils.Utilities;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.rometools.propono.utils.ProponoException;
import com.rometools.propono.utils.Utilities;
import com.sun.syndication.feed.atom.Content;
import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.feed.atom.Link;

View file

@ -18,6 +18,7 @@ package com.rometools.propono.atom.client;
import java.util.List;
import org.jdom2.Element;
import com.rometools.propono.atom.common.AtomService;
import com.rometools.propono.atom.common.Workspace;
import com.rometools.propono.utils.ProponoException;

View file

@ -22,10 +22,10 @@ import java.util.NoSuchElementException;
import org.apache.commons.httpclient.methods.GetMethod;
import org.jdom2.Document;
import org.jdom2.input.SAXBuilder;
import com.rometools.propono.utils.ProponoException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.rometools.propono.utils.ProponoException;
import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.feed.atom.Feed;
import com.sun.syndication.feed.atom.Link;

View file

@ -19,6 +19,7 @@ import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethodBase;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.PostMethod;
import com.rometools.propono.utils.ProponoException;
public class GDataAuthStrategy implements AuthStrategy {

View file

@ -17,6 +17,7 @@ package com.rometools.propono.atom.client;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethodBase;
import com.rometools.propono.utils.ProponoException;
/**

View file

@ -34,6 +34,7 @@ import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.util.ParameterParser;
import com.rometools.propono.utils.ProponoException;
/**

View file

@ -23,6 +23,7 @@ import java.util.List;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.Namespace;
import com.rometools.propono.utils.ProponoException;
/**

View file

@ -21,8 +21,8 @@ import java.util.ArrayList;
import java.util.List;
import org.jdom2.Element;
import com.rometools.propono.utils.ProponoException;
import com.rometools.propono.utils.ProponoException;
import com.sun.syndication.io.impl.Atom10Parser;
/**

View file

@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.List;
import org.jdom2.Element;
import com.rometools.propono.utils.ProponoException;
/**

View file

@ -1,6 +1,6 @@
/*
* Copyright 2007 Apache Software Foundation
*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. The ASF licenses this file to You
* under the Apache License, Version 2.0 (the "License"); you may not

View file

@ -1,6 +1,6 @@
/*
* Copyright 2007 Apache Software Foundation
*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. The ASF licenses this file to You
* under the Apache License, Version 2.0 (the "License"); you may not
@ -21,16 +21,16 @@ package com.rometools.propono.atom.server;
import com.rometools.propono.atom.common.AtomService;
import com.rometools.propono.atom.common.Categories;
import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.feed.atom.Feed;
/**
* Interface for handling single Atom protocol requests.
*
*
* <p>
* To create your own Atom protocol implementation you must implement this interface and create a concrete sub-class of
* {@link com.sun.syndication.propono.atom.server.AtomHandlerFactory} which is capable of instantiating it.
* To create your own Atom protocol implementation you must implement this interface and create a
* concrete sub-class of {@link com.sun.syndication.propono.atom.server.AtomHandlerFactory} which is
* capable of instantiating it.
* </p>
*/
public interface AtomHandler {
@ -40,8 +40,10 @@ public interface AtomHandler {
public String getAuthenticatedUsername();
/**
* Return {@link com.sun.syndication.propono.atom.common.AtomService} object that contains the {@link com.sun.syndication.propono.atom.common.Workspace}
* objects available to the currently authenticated user and within those the {@link com.sun.syndication.propono.atom.common.Collection} avalaible.
* Return {@link com.sun.syndication.propono.atom.common.AtomService} object that contains the
* {@link com.sun.syndication.propono.atom.common.Workspace} objects available to the currently
* authenticated user and within those the
* {@link com.sun.syndication.propono.atom.common.Collection} avalaible.
*/
public AtomService getAtomService(AtomRequest req) throws AtomException;
@ -52,14 +54,15 @@ public interface AtomHandler {
/**
* Return collection or portion of collection specified by request.
*
*
* @param req Details of HTTP request
*/
public Feed getCollection(AtomRequest req) throws AtomException;
/**
* Store new entry in collection specified by request and return representation of entry as it is stored on server.
*
* Store new entry in collection specified by request and return representation of entry as it
* is stored on server.
*
* @param req Details of HTTP request
* @return Location URL of new entry
*/
@ -67,36 +70,36 @@ public interface AtomHandler {
/**
* Get entry specified by request.
*
*
* @param req Details of HTTP request
*/
public Entry getEntry(AtomRequest req) throws AtomException;
/**
* Get media resource specified by request.
*
*
* @param req Details of HTTP request
*/
public AtomMediaResource getMediaResource(AtomRequest req) throws AtomException;
/**
* Update entry specified by request and return new entry as represented on the server.
*
*
* @param req Details of HTTP request
*/
public void putEntry(AtomRequest req, Entry entry) throws AtomException;
/**
* Delete entry specified by request.
*
*
* @param req Details of HTTP request
*/
public void deleteEntry(AtomRequest req) throws AtomException;
/**
* Store media data in collection specified by request, create an Atom media-link entry to store metadata for the new media file and return that entry to
* the caller.
*
* Store media data in collection specified by request, create an Atom media-link entry to store
* metadata for the new media file and return that entry to the caller.
*
* @param req Details of HTTP request
* @param entry New entry initialzied with only title and content type
* @return Location URL of new media entry
@ -105,42 +108,42 @@ public interface AtomHandler {
/**
* Update the media file part of a media-link entry.
*
*
* @param req Details of HTTP request
*/
public void putMedia(AtomRequest req) throws AtomException;
/**
* Return true if specified request represents URI of a Service Document.
*
*
* @param req Details of HTTP request
*/
public boolean isAtomServiceURI(AtomRequest req);
/**
* Return true if specified request represents URI of a Categories Document.
*
*
* @param req Details of HTTP request
*/
public boolean isCategoriesURI(AtomRequest req);
/**
* Return true if specified request represents URI of a collection.
*
*
* @param req Details of HTTP request
*/
public boolean isCollectionURI(AtomRequest req);
/**
* Return true if specified request represents URI of an Atom entry.
*
*
* @param req Details of HTTP request
*/
public boolean isEntryURI(AtomRequest req);
/**
* Return true if specified patrequesthinfo represents media-edit URI.
*
*
* @param req Details of HTTP request
*/
public boolean isMediaEditURI(AtomRequest req);

View file

@ -1,10 +1,10 @@
/*
/*
* Copyright 2007 Sun Microsystems, Inc.
*
*
* 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

View file

@ -35,12 +35,12 @@ import javax.servlet.http.HttpServletResponse;
import org.jdom2.Document;
import org.jdom2.output.Format;
import org.jdom2.output.XMLOutputter;
import com.rometools.propono.atom.common.AtomService;
import com.rometools.propono.atom.common.Categories;
import com.rometools.propono.utils.Utilities;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.rometools.propono.atom.common.AtomService;
import com.rometools.propono.atom.common.Categories;
import com.rometools.propono.utils.Utilities;
import com.sun.syndication.feed.atom.Content;
import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.feed.atom.Feed;

View file

@ -22,6 +22,9 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.rometools.propono.atom.common.AtomService;
import com.rometools.propono.atom.common.Categories;
import com.rometools.propono.atom.server.AtomException;
@ -29,9 +32,6 @@ import com.rometools.propono.atom.server.AtomHandler;
import com.rometools.propono.atom.server.AtomMediaResource;
import com.rometools.propono.atom.server.AtomRequest;
import com.rometools.propono.atom.server.AtomServlet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.feed.atom.Feed;

View file

@ -30,14 +30,14 @@ import com.rometools.propono.utils.Utilities;
* <pre>
* # Define list of collections to be offered
* propono.atomserver.filebased.collections=entries,gifimages
*
*
* # Defines 'entries' collection, accepts entries
* propono.atomserver.filebased.collection.entries.title=Entries
* propono.atomserver.filebased.collection.entries.singular=entry
* propono.atomserver.filebased.collection.entries.plural=entries
* propono.atomserver.filebased.collection.entries.accept=application/atom+xml;type=entry
* propono.atomserver.filebased.collection.entries.categories=general,category1,category2
*
*
* # Defines 'gifimages' collection, accepts only GIF files
* propono.atomserver.filebased.collection.gifimages.title=GIF Images
* propono.atomserver.filebased.collection.gifimages.singular=gif

View file

@ -37,6 +37,7 @@ import javax.activation.MimetypesFileTypeMap;
import org.jdom2.Document;
import org.jdom2.output.XMLOutputter;
import com.rometools.propono.atom.common.Categories;
import com.rometools.propono.atom.common.Collection;
import com.rometools.propono.atom.common.rome.AppModule;
@ -45,7 +46,6 @@ import com.rometools.propono.atom.server.AtomException;
import com.rometools.propono.atom.server.AtomMediaResource;
import com.rometools.propono.atom.server.AtomNotFoundException;
import com.rometools.propono.utils.Utilities;
import com.sun.syndication.feed.WireFeed;
import com.sun.syndication.feed.atom.Category;
import com.sun.syndication.feed.atom.Content;

View file

@ -1,10 +1,10 @@
/*
/*
* 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
@ -20,8 +20,9 @@ import java.io.InputStream;
/**
* Represents a file that has been uploaded to a blog.
* <p />
* Resources are modeled as a type of BlogEntry, but be aware: not all servers can save resource metadata (i.e. title, category, author, etc.). MetaWeblog based
* servers can't save metadata at all and Atom protocol servers are not required to preserve uploaded file metadata.
* Resources are modeled as a type of BlogEntry, but be aware: not all servers can save resource
* metadata (i.e. title, category, author, etc.). MetaWeblog based servers can't save metadata at
* all and Atom protocol servers are not required to preserve uploaded file metadata.
*/
public interface BlogResource extends BlogEntry {

View file

@ -27,7 +27,6 @@ import com.rometools.propono.blogclient.Blog;
import com.rometools.propono.blogclient.BlogClientException;
import com.rometools.propono.blogclient.BlogEntry;
import com.rometools.propono.blogclient.BlogResource;
import com.sun.syndication.feed.atom.Category;
/**

View file

@ -26,7 +26,6 @@ import com.rometools.propono.blogclient.BaseBlogEntry;
import com.rometools.propono.blogclient.BlogClientException;
import com.rometools.propono.blogclient.BlogEntry;
import com.rometools.propono.utils.ProponoException;
import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.feed.atom.Link;
import com.sun.syndication.feed.module.Module;

View file

@ -17,12 +17,13 @@ package com.rometools.propono.blogclient.atomprotocol;
import java.util.Iterator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.rometools.propono.atom.client.ClientEntry;
import com.rometools.propono.atom.client.ClientMediaEntry;
import com.rometools.propono.blogclient.BlogClientException;
import com.rometools.propono.blogclient.BlogEntry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Atom protocol implementation of BlogClient entry iterator.

View file

@ -25,7 +25,6 @@ import com.rometools.propono.atom.client.ClientMediaEntry;
import com.rometools.propono.blogclient.BlogClientException;
import com.rometools.propono.blogclient.BlogEntry;
import com.rometools.propono.blogclient.BlogResource;
import com.sun.syndication.feed.atom.Link;
/**

View file

@ -28,6 +28,7 @@ import java.util.TreeMap;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import com.rometools.propono.blogclient.Blog;
import com.rometools.propono.blogclient.BlogClientException;
import com.rometools.propono.blogclient.BlogEntry;

View file

@ -25,6 +25,7 @@ import java.util.Map;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import com.rometools.propono.blogclient.Blog;
import com.rometools.propono.blogclient.BlogClientException;
import com.rometools.propono.blogclient.BlogConnection;

View file

@ -20,6 +20,7 @@ import java.util.HashMap;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import com.rometools.propono.blogclient.BlogClientException;
import com.rometools.propono.blogclient.BlogResource;

View file

@ -15,13 +15,6 @@
*/
package com.rometools.propono.atom.client;
import com.rometools.propono.atom.client.ClientCollection;
import com.rometools.propono.atom.client.ClientWorkspace;
import com.rometools.propono.atom.client.BasicAuthStrategy;
import com.rometools.propono.atom.client.ClientEntry;
import com.rometools.propono.atom.client.AtomClientFactory;
import com.rometools.propono.atom.client.ClientAtomService;
import com.rometools.propono.atom.client.ClientMediaEntry;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.List;
@ -31,12 +24,12 @@ import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.junit.Ignore;
import com.rometools.propono.atom.common.Categories;
import com.rometools.propono.atom.common.Collection;
import com.rometools.propono.utils.ProponoException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.rometools.propono.atom.common.Categories;
import com.rometools.propono.atom.common.Collection;
import com.rometools.propono.utils.ProponoException;
import com.sun.syndication.feed.atom.Category;
import com.sun.syndication.feed.atom.Content;

View file

@ -15,11 +15,6 @@
*/
package com.rometools.propono.atom.client;
import com.rometools.propono.atom.client.ClientCollection;
import com.rometools.propono.atom.client.GDataAuthStrategy;
import com.rometools.propono.atom.client.ClientEntry;
import com.rometools.propono.atom.client.AtomClientFactory;
import com.rometools.propono.atom.client.ClientAtomService;
import java.util.Iterator;
import junit.framework.Test;

View file

@ -15,10 +15,6 @@
*/
package com.rometools.propono.atom.common;
import com.rometools.propono.atom.common.Collection;
import com.rometools.propono.atom.common.Workspace;
import com.rometools.propono.atom.common.Categories;
import com.rometools.propono.atom.common.AtomService;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

View file

@ -15,7 +15,6 @@
*/
package com.rometools.propono.atom.common;
import com.rometools.propono.atom.common.Collection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

View file

@ -31,6 +31,9 @@ import org.mortbay.http.HttpContext;
import org.mortbay.http.HttpServer;
import org.mortbay.http.SocketListener;
import org.mortbay.jetty.servlet.ServletHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.rometools.propono.atom.client.AtomClientFactory;
import com.rometools.propono.atom.client.BasicAuthStrategy;
import com.rometools.propono.atom.client.ClientAtomService;
@ -42,9 +45,6 @@ import com.rometools.propono.atom.common.Categories;
import com.rometools.propono.atom.common.Collection;
import com.rometools.propono.atom.common.Workspace;
import com.rometools.propono.utils.ProponoException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.syndication.feed.atom.Category;
import com.sun.syndication.feed.atom.Content;

View file

@ -16,8 +16,6 @@
*/
package com.rometools.propono.atom.server;
import com.rometools.propono.atom.server.AtomHandlerFactory;
import com.rometools.propono.atom.server.AtomHandler;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

View file

@ -15,11 +15,6 @@
*/
package com.rometools.propono.blogclient;
import com.rometools.propono.blogclient.BlogEntry;
import com.rometools.propono.blogclient.BlogResource;
import com.rometools.propono.blogclient.BlogConnection;
import com.rometools.propono.blogclient.Blog;
import com.rometools.propono.blogclient.BlogConnectionFactory;
import java.io.File;
import java.util.Iterator;
@ -28,11 +23,11 @@ import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.junit.Ignore;
import com.rometools.propono.blogclient.Blog.Collection;
import com.rometools.propono.utils.Utilities;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.rometools.propono.blogclient.Blog.Collection;
import com.rometools.propono.utils.Utilities;
import com.sun.syndication.io.impl.Atom10Parser;
/**