Move rome files into a subdirectory

This commit is contained in:
mishako 2016-02-13 18:30:00 +01:00
parent 5a46ee161d
commit 14e8b2e2d1
371 changed files with 464 additions and 464 deletions

View file

View file

@ -1,40 +1,40 @@
package com.rometools.rome.feed.impl; package com.rometools.rome.feed.impl;
/** /**
* This class addresses some ClassLoader problems in OSGi environments. If you have ClassLoader * This class addresses some ClassLoader problems in OSGi environments. If you have ClassLoader
* problems, simply override the default ClassLoader by calling the * problems, simply override the default ClassLoader by calling the
* {@link #setClassLoader(ClassLoader)} method before calling any ROME code. Unfortunately I don't * {@link #setClassLoader(ClassLoader)} method before calling any ROME code. Unfortunately I don't
* know whether this works because I have absolutely no experience with OSGi. * know whether this works because I have absolutely no experience with OSGi.
* *
* @author Patrick Gotthard * @author Patrick Gotthard
* *
*/ */
public enum ConfigurableClassLoader { public enum ConfigurableClassLoader {
INSTANCE; INSTANCE;
private ClassLoader classLoader; private ClassLoader classLoader;
/** /**
* Get the configured ClassLoader. Returns * Get the configured ClassLoader. Returns
* *
* @return The configured ClassLoader. Returns the ClassLoader of this enum when the ClassLoader * @return The configured ClassLoader. Returns the ClassLoader of this enum when the ClassLoader
* was not overridden. * was not overridden.
*/ */
public ClassLoader getClassLoader() { public ClassLoader getClassLoader() {
if (classLoader == null) { if (classLoader == null) {
classLoader = ConfigurableClassLoader.class.getClassLoader(); classLoader = ConfigurableClassLoader.class.getClassLoader();
} }
return classLoader; return classLoader;
} }
/** /**
* Overrides the default ClassLoader (the ClassLoader of this enum). * Overrides the default ClassLoader (the ClassLoader of this enum).
* *
* @param classLoader The ClassLoader to set. * @param classLoader The ClassLoader to set.
*/ */
public void setClassLoader(final ClassLoader classLoader) { public void setClassLoader(final ClassLoader classLoader) {
this.classLoader = classLoader; this.classLoader = classLoader;
} }
} }

View file

@ -1,162 +1,162 @@
package com.rometools.rome.feed.synd; package com.rometools.rome.feed.synd;
import java.util.AbstractList; import java.util.AbstractList;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.rometools.rome.feed.module.DCSubject; import com.rometools.rome.feed.module.DCSubject;
/** /**
* List implementation for SyndCategoryImpl elements. To be directly used by the SyndFeedImpl and * List implementation for SyndCategoryImpl elements. To be directly used by the SyndFeedImpl and
* SyndEntryImpl classes only. * SyndEntryImpl classes only.
* <p> * <p>
* It acts as a facade on top of the DCSubjectImpl elements of the underlying list and remains in * It acts as a facade on top of the DCSubjectImpl elements of the underlying list and remains in
* synch with it. It is possible to work on either list, the categories one or the subjects one and * synch with it. It is possible to work on either list, the categories one or the subjects one and
* they remain in synch. * they remain in synch.
* <p> * <p>
* This is necessary because the SyndFeedImpl categories are just a convenience to access the * This is necessary because the SyndFeedImpl categories are just a convenience to access the
* DublinCore subjects. * DublinCore subjects.
* <P> * <P>
* All this mess to avoid making DCSubjectImpl implement SyndCategory (which it would be odd). * All this mess to avoid making DCSubjectImpl implement SyndCategory (which it would be odd).
* <p> * <p>
* *
* @author Alejandro Abdelnur * @author Alejandro Abdelnur
* *
*/ */
class SyndCategoryListFacade extends AbstractList<SyndCategory> { class SyndCategoryListFacade extends AbstractList<SyndCategory> {
private final List<DCSubject> subjects; private final List<DCSubject> subjects;
/** /**
* Default constructor. Creates and empty list. * Default constructor. Creates and empty list.
*/ */
public SyndCategoryListFacade() { public SyndCategoryListFacade() {
this(new ArrayList<DCSubject>()); this(new ArrayList<DCSubject>());
} }
/** /**
* Creates a facade list of categories on top the given subject list. * Creates a facade list of categories on top the given subject list.
* <P> * <P>
* *
* @param subjects the list of subjects to create the facade. * @param subjects the list of subjects to create the facade.
* *
*/ */
public SyndCategoryListFacade(final List<DCSubject> subjects) { public SyndCategoryListFacade(final List<DCSubject> subjects) {
this.subjects = subjects; this.subjects = subjects;
} }
/** /**
* Gets the category by index. * Gets the category by index.
* <p> * <p>
* *
* @param index the index position to retrieve the category. * @param index the index position to retrieve the category.
* @return the SyndCategoryImpl in position index, <b>null</b> if none. * @return the SyndCategoryImpl in position index, <b>null</b> if none.
* *
*/ */
@Override @Override
public SyndCategory get(final int index) { public SyndCategory get(final int index) {
return new SyndCategoryImpl(subjects.get(index)); return new SyndCategoryImpl(subjects.get(index));
} }
/** /**
* Returns the size of the list. * Returns the size of the list.
* <p> * <p>
* *
* @return the size of the list. * @return the size of the list.
* *
*/ */
@Override @Override
public int size() { public int size() {
return subjects.size(); return subjects.size();
} }
/** /**
* Sets a category in an existing position in the list. * Sets a category in an existing position in the list.
* <p> * <p>
* *
* @param index position to set the category. * @param index position to set the category.
* @param obj the SyndCategoryImpl object to set. * @param obj the SyndCategoryImpl object to set.
* @return the SyndCategoryImpl object that is being replaced, <b>null</b> if none. * @return the SyndCategoryImpl object that is being replaced, <b>null</b> if none.
* *
*/ */
@Override @Override
public SyndCategory set(final int index, final SyndCategory obj) { public SyndCategory set(final int index, final SyndCategory obj) {
final SyndCategoryImpl sCat = (SyndCategoryImpl) obj; final SyndCategoryImpl sCat = (SyndCategoryImpl) obj;
DCSubject subject; DCSubject subject;
if (sCat != null) { if (sCat != null) {
subject = sCat.getSubject(); subject = sCat.getSubject();
} else { } else {
subject = null; subject = null;
} }
subject = subjects.set(index, subject); subject = subjects.set(index, subject);
if (subject != null) { if (subject != null) {
return new SyndCategoryImpl(subject); return new SyndCategoryImpl(subject);
} else { } else {
return null; return null;
} }
} }
/** /**
* Adds a category to the list. * Adds a category to the list.
* <p> * <p>
* *
* @param index position to add the category. * @param index position to add the category.
* @param obj the SyndCategoryImpl object to add. * @param obj the SyndCategoryImpl object to add.
* *
*/ */
@Override @Override
public void add(final int index, final SyndCategory obj) { public void add(final int index, final SyndCategory obj) {
final SyndCategoryImpl sCat = (SyndCategoryImpl) obj; final SyndCategoryImpl sCat = (SyndCategoryImpl) obj;
DCSubject subject; DCSubject subject;
if (sCat != null) { if (sCat != null) {
subject = sCat.getSubject(); subject = sCat.getSubject();
} else { } else {
subject = null; subject = null;
} }
subjects.add(index, subject); subjects.add(index, subject);
} }
/** /**
* Removes a category element from a specific position. * Removes a category element from a specific position.
* <p> * <p>
* *
* @param index position to remove the category from. * @param index position to remove the category from.
* @return the SyndCategoryImpl being removed from position index, <b>null</b> if none. * @return the SyndCategoryImpl being removed from position index, <b>null</b> if none.
* *
*/ */
@Override @Override
public SyndCategory remove(final int index) { public SyndCategory remove(final int index) {
final DCSubject subject = subjects.remove(index); final DCSubject subject = subjects.remove(index);
if (subject != null) { if (subject != null) {
return new SyndCategoryImpl(subject); return new SyndCategoryImpl(subject);
} else { } else {
return null; return null;
} }
} }
/** /**
* Returns a list with the DCSubject elements of the SyndCategoryImpl list facade. To be used by * Returns a list with the DCSubject elements of the SyndCategoryImpl list facade. To be used by
* the SyndFeedImpl class only. * the SyndFeedImpl class only.
* <p> * <p>
* *
* @param cList the list with SyndCategoryImpl elements to convert to subject list. * @param cList the list with SyndCategoryImpl elements to convert to subject list.
* @return a list with DCSubject elements corresponding to the categories in the given list. * @return a list with DCSubject elements corresponding to the categories in the given list.
* *
*/ */
public static List<DCSubject> convertElementsSyndCategoryToSubject(final List<SyndCategory> cList) { public static List<DCSubject> convertElementsSyndCategoryToSubject(final List<SyndCategory> cList) {
List<DCSubject> sList = null; List<DCSubject> sList = null;
if (cList != null) { if (cList != null) {
sList = new ArrayList<DCSubject>(); sList = new ArrayList<DCSubject>();
for (int i = 0; i < cList.size(); i++) { for (int i = 0; i < cList.size(); i++) {
final SyndCategoryImpl sCat = (SyndCategoryImpl) cList.get(i); final SyndCategoryImpl sCat = (SyndCategoryImpl) cList.get(i);
DCSubject subject = null; DCSubject subject = null;
if (sCat != null) { if (sCat != null) {
subject = sCat.getSubject(); subject = sCat.getSubject();
} }
sList.add(subject); sList.add(subject);
} }
} }
return sList; return sList;
} }
} }

Some files were not shown because too many files have changed in this diff Show more