You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2005/10/21 23:46:28 UTC
svn commit: r327589 [23/72] - in /incubator/roller/branches/roller_1.x: ./
contrib/ contrib/lib/ contrib/plugins/ contrib/plugins/src/
contrib/plugins/src/org/ contrib/plugins/src/org/roller/
contrib/plugins/src/org/roller/presentation/ contrib/plugins...
Added: incubator/roller/branches/roller_1.x/src/org/roller/config/RollerRuntimeConfig.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/config/RollerRuntimeConfig.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/config/RollerRuntimeConfig.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/config/RollerRuntimeConfig.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,154 @@
+/*
+ * RollerRuntimeConfig.java
+ *
+ * Created on May 4, 2005, 3:00 PM
+ */
+
+package org.roller.config;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringWriter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.roller.config.runtime.RuntimeConfigDefs;
+import org.roller.config.runtime.RuntimeConfigDefsParser;
+import org.roller.model.PropertiesManager;
+import org.roller.model.RollerFactory;
+
+/**
+ * This class acts as a convenience gateway for getting property values
+ * via the PropertiesManager. We do this because most calls to the
+ * PropertiesManager are just to get the value of a specific property and
+ * thus the caller doesn't need the full RollerPropertyData object.
+ *
+ * We also provide some methods for converting to different data types.
+ *
+ * @author Allen Gilliland
+ */
+public class RollerRuntimeConfig {
+
+ private static String runtime_config = "/rollerRuntimeConfigDefs.xml";
+ private static RuntimeConfigDefs configDefs = null;
+
+ private static Log mLogger =
+ LogFactory.getFactory().getInstance(RollerRuntimeConfig.class);
+
+
+ // prevent instantiations
+ private RollerRuntimeConfig() {}
+
+
+ /**
+ * Retrieve a single property from the PropertiesManager ... returns null
+ * if there is an error
+ **/
+ public static String getProperty(String name) {
+
+ String value = null;
+ try {
+ PropertiesManager pmgr = RollerFactory.getRoller().getPropertiesManager();
+ value = pmgr.getProperty(name).getValue();
+ } catch(Exception e) {
+ mLogger.warn("Trouble accessing property: "+name, e);
+ }
+
+ mLogger.debug("fetched property ["+name+"="+value+"]");
+
+ return value;
+ }
+
+
+ /**
+ * Retrieve a property as a boolean ... defaults to false if there is an error
+ **/
+ public static boolean getBooleanProperty(String name) {
+
+ // get the value first, then convert
+ String value = RollerRuntimeConfig.getProperty(name);
+
+ if(value == null)
+ return false;
+
+ return (new Boolean(value)).booleanValue();
+ }
+
+
+ /**
+ * Retrieve a property as an int ... defaults to -1 if there is an error
+ **/
+ public static int getIntProperty(String name) {
+
+ // get the value first, then convert
+ String value = RollerRuntimeConfig.getProperty(name);
+
+ if(value == null)
+ return -1;
+
+ int intval = -1;
+ try {
+ intval = Integer.parseInt(value);
+ } catch(Exception e) {
+ mLogger.warn("Trouble converting to int: "+name, e);
+ }
+
+ return intval;
+ }
+
+
+ public static RuntimeConfigDefs getRuntimeConfigDefs() {
+
+ if(configDefs == null) {
+
+ // unmarshall the config defs file
+ try {
+ InputStream is =
+ RollerRuntimeConfig.class.getResourceAsStream(runtime_config);
+
+ RuntimeConfigDefsParser parser = new RuntimeConfigDefsParser();
+ configDefs = parser.unmarshall(is);
+
+ } catch(Exception e) {
+ // error while parsing :(
+ mLogger.error("Error parsing runtime config defs", e);
+ }
+
+ }
+
+ return configDefs;
+ }
+
+
+ /**
+ * Get the runtime configuration definitions XML file as a string.
+ *
+ * This is basically a convenience method for accessing this file.
+ * The file itself contains meta-data about what configuration
+ * properties we change at runtime via the UI and how to setup
+ * the display for editing those properties.
+ */
+ public static String getRuntimeConfigDefsAsString() {
+
+ mLogger.debug("Trying to load runtime config defs file");
+
+ try {
+ InputStreamReader reader =
+ new InputStreamReader(RollerConfig.class.getResourceAsStream(runtime_config));
+ StringWriter configString = new StringWriter();
+
+ char[] buf = new char[8196];
+ int length = 0;
+ while((length = reader.read(buf)) > 0)
+ configString.write(buf, 0, length);
+
+ reader.close();
+
+ return configString.toString();
+ } catch(Exception e) {
+ mLogger.error("Error loading runtime config defs file", e);
+ }
+
+ return "";
+ }
+
+}
Added: incubator/roller/branches/roller_1.x/src/org/roller/config/package.html
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/config/package.html?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/config/package.html (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/config/package.html Fri Oct 21 14:27:36 2005
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <title></title>
+</head>
+<body>
+Classes for accessing Roller configuration.
+
+</body>
+</html>
Added: incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/ConfigDef.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/ConfigDef.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/ConfigDef.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/ConfigDef.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,62 @@
+/*
+ * ConfigDef.java
+ *
+ * Created on June 4, 2005, 1:10 PM
+ */
+
+package org.roller.config.runtime;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents a logic grouping of runtime configuration properties.
+ * Each ConfigDef may contain 0 or more DisplayGroups.
+ *
+ * @author Allen Gilliland
+ */
+public class ConfigDef {
+
+ private List displayGroups = null;
+ private String name = null;
+
+
+ public ConfigDef() {
+ this.displayGroups = new ArrayList();
+ }
+
+ public ConfigDef(List displaygroups) {
+ this.displayGroups = displaygroups;
+ }
+
+
+ public boolean addDisplayGroup(DisplayGroup group) {
+ return this.displayGroups.add(group);
+ }
+
+ public boolean removeDisplayGroup(DisplayGroup group) {
+ return this.displayGroups.remove(group);
+ }
+
+
+ public String toString() {
+ return name;
+ }
+
+ public List getDisplayGroups() {
+ return displayGroups;
+ }
+
+ public void setDisplayGroups(List displayGroups) {
+ this.displayGroups = displayGroups;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
Added: incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/DisplayGroup.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/DisplayGroup.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/DisplayGroup.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/DisplayGroup.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,72 @@
+/*
+ * DisplayGroup.java
+ *
+ * Created on June 4, 2005, 1:10 PM
+ */
+
+package org.roller.config.runtime;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents a single DisplayGroup.
+ * Each DisplayGroup may contain 0 or more PropertyDefs.
+ *
+ * @author Allen Gilliland
+ */
+public class DisplayGroup {
+
+ private List propertyDefs = null;
+ private String name = null;
+ private String key = null;
+
+
+ public DisplayGroup() {
+ this.propertyDefs = new ArrayList();
+ }
+
+ public DisplayGroup(List propdefs) {
+ this.propertyDefs = propdefs;
+ }
+
+
+ public boolean addPropertyDef(PropertyDef prop) {
+ return this.propertyDefs.add(prop);
+ }
+
+ public boolean removePropertyDef(PropertyDef prop) {
+ return this.propertyDefs.remove(prop);
+ }
+
+
+ public String toString() {
+ return name+","+key;
+ }
+
+ public List getPropertyDefs() {
+ return propertyDefs;
+ }
+
+ public void setPropertyDefs(List propertyDefs) {
+ this.propertyDefs = propertyDefs;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+
+}
Added: incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/PropertyDef.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/PropertyDef.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/PropertyDef.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/PropertyDef.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,105 @@
+/*
+ * PropertyDef.java
+ *
+ * Created on June 4, 2005, 1:13 PM
+ */
+
+package org.roller.config.runtime;
+
+/**
+ * Represents the definition of a single runtime property.
+ *
+ * Each property definition may contain these elements
+ * - name (required)
+ * - key (required)
+ * - type (required)
+ * - default-value (required)
+ * - rows (optional)
+ * - cols (options)
+ *
+ * @author Allen Gilliland
+ */
+public class PropertyDef {
+
+ private String name = null;
+ private String key = null;
+ private String type = null;
+ private String defaultValue = null;
+ private int rows = 5;
+ private int cols = 25;
+
+
+ /** Creates a new instance of PropertyDef */
+ public PropertyDef() {}
+
+ public String toString() {
+ return "["+name+","+key+","+type+","+defaultValue+","+rows+","+cols+"]";
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ public void setDefaultValue(String defaultvalue) {
+ this.defaultValue = defaultvalue;
+ }
+
+ public int getRows() {
+ return rows;
+ }
+
+ public void setRows(int rows) {
+ this.rows = rows;
+ }
+
+ public void setRows(String rows) {
+ //convert to int
+ try {
+ int r = Integer.parseInt(rows);
+ this.rows = r;
+ } catch(Exception e) {
+ // hmmm ... bogus value
+ }
+ }
+ public int getCols() {
+ return cols;
+ }
+
+ public void setCols(int cols) {
+ this.cols = cols;
+ }
+
+ public void setCols(String cols) {
+ //convert to int
+ try {
+ int c = Integer.parseInt(cols);
+ this.cols = c;
+ } catch(Exception e) {
+ // hmmm ... bogus value
+ }
+ }
+}
Added: incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/RuntimeConfigDefs.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/RuntimeConfigDefs.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/RuntimeConfigDefs.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/RuntimeConfigDefs.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,49 @@
+/*
+ * RuntimeConfigDefs.java
+ *
+ * Created on June 4, 2005, 1:06 PM
+ */
+
+package org.roller.config.runtime;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * Represents the collection of all ConfigDefs.
+ *
+ * @author Allen Gilliland
+ */
+public class RuntimeConfigDefs {
+
+ private List configDefs = null;
+
+
+ public RuntimeConfigDefs() {
+ this.configDefs = new ArrayList();
+ }
+
+ public RuntimeConfigDefs(List configs) {
+ this.configDefs = configs;
+ }
+
+
+ public boolean addConfigDef(ConfigDef config) {
+ return this.configDefs.add(config);
+ }
+
+ public boolean removeConfigDef(ConfigDef config) {
+ return this.configDefs.remove(config);
+ }
+
+
+ public List getConfigDefs() {
+ return configDefs;
+ }
+
+ public void setConfigDefs(List configDefs) {
+ this.configDefs = configDefs;
+ }
+
+}
Added: incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/RuntimeConfigDefsParser.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/RuntimeConfigDefsParser.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/RuntimeConfigDefsParser.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/RuntimeConfigDefsParser.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,114 @@
+/*
+ * RuntimeConfigDefsParser.java
+ *
+ * Created on June 4, 2005, 1:57 PM
+ */
+
+package org.roller.config.runtime;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.List;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.input.SAXBuilder;
+
+
+/**
+ * The parser for the rollerRuntimeConfigDefs.xml file.
+ * This class uses jdom to unmarshall the xml into a series of java objects.
+ *
+ * @author Allen Gilliland
+ */
+public class RuntimeConfigDefsParser {
+
+ /** Creates a new instance of RuntimeConfigDefsParser */
+ public RuntimeConfigDefsParser() {}
+
+
+ /**
+ * Unmarshall the given input stream into our defined
+ * set of Java objects.
+ **/
+ public RuntimeConfigDefs unmarshall(InputStream instream)
+ throws IOException, JDOMException {
+
+ if(instream == null)
+ throw new IOException("InputStream is null!");
+
+ RuntimeConfigDefs configs = new RuntimeConfigDefs();
+
+ SAXBuilder builder = new SAXBuilder();
+ Document doc = builder.build(instream);
+
+ Element root = doc.getRootElement();
+ List configdefs = root.getChildren("config-def");
+ Iterator iter = configdefs.iterator();
+ while (iter.hasNext()) {
+ Element e = (Element) iter.next();
+ configs.addConfigDef(this.elementToConfigDef(e));
+ }
+
+ return configs;
+ }
+
+
+ private ConfigDef elementToConfigDef(Element element) {
+
+ ConfigDef configdef = new ConfigDef();
+
+ configdef.setName(element.getAttributeValue("name"));
+
+ List displaygroups = element.getChildren("display-group");
+ Iterator iter = displaygroups.iterator();
+ while (iter.hasNext())
+ {
+ Element e = (Element) iter.next();
+ configdef.addDisplayGroup(this.elementToDisplayGroup(e));
+ }
+
+ return configdef;
+ }
+
+
+ private DisplayGroup elementToDisplayGroup(Element element) {
+
+ DisplayGroup displaygroup = new DisplayGroup();
+
+ displaygroup.setName(element.getAttributeValue("name"));
+ displaygroup.setKey(element.getAttributeValue("key"));
+
+ List displaygroups = element.getChildren("property-def");
+ Iterator iter = displaygroups.iterator();
+ while (iter.hasNext())
+ {
+ Element e = (Element) iter.next();
+ displaygroup.addPropertyDef(this.elementToPropertyDef(e));
+ }
+
+ return displaygroup;
+ }
+
+
+ private PropertyDef elementToPropertyDef(Element element) {
+
+ PropertyDef prop = new PropertyDef();
+
+ prop.setName(element.getAttributeValue("name"));
+ prop.setKey(element.getAttributeValue("key"));
+ prop.setType(element.getChildText("type"));
+ prop.setDefaultValue(element.getChildText("default-value"));
+
+ // optional elements
+ if(element.getChild("rows") != null)
+ prop.setRows(element.getChildText("rows"));
+
+ if(element.getChild("cols") != null)
+ prop.setCols(element.getChildText("cols"));
+
+ return prop;
+ }
+
+}
Added: incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/package.html
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/package.html?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/package.html (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/config/runtime/package.html Fri Oct 21 14:27:36 2005
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <title></title>
+</head>
+<body>
+Classes for parsing Roller configuration definition files.
+
+</body>
+</html>
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/AutoPingManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/AutoPingManager.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/AutoPingManager.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/AutoPingManager.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2005
+ * Anil R. Gangolli. All rights reserved.
+ *
+ * Distributed with the Roller Weblogger Project under the terms of the Roller Software
+ * License
+ */
+
+package org.roller.model;
+
+import org.roller.pojos.AutoPingData;
+import org.roller.pojos.PingTargetData;
+import org.roller.pojos.WebsiteData;
+import org.roller.pojos.WeblogEntryData;
+import org.roller.RollerException;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Manages autoping storage/retrieval, queries and queue.
+ */
+public interface AutoPingManager extends Serializable
+{
+ /**
+ * Release all resources associated with Roller session.
+ */
+ public void release();
+
+ /**
+ * Create an auto ping configuration specifying that the given ping target is to be pinged when the given website
+ * changes.
+ * @param pingTarget target to ping
+ * @param website website whose changes should trigger the ping
+ * @return new auto ping configuration
+ * @throws RollerException
+ */
+ public AutoPingData createAutoPing(PingTargetData pingTarget, WebsiteData website)
+ throws RollerException;
+
+ /*
+ * Create an auto ping configuration specifying that the given pingTarget is to be pinged when the
+ * given website changes, but only for changes on one of the specified categories of that website.
+ * If the collection of categories is empty, this has the same effect as creating an unrestricted
+ * auto ping configuration.
+ *
+ * @param pingTarget
+ * @param website website whose changes should trigger the ping (subject to category restrictions)
+ * @param categories categories in which changes should trigger the ping
+ * @return new auto ping configuration
+ * @throws RollerException
+
+ public AutoPingData createAutoPing(PingTargetData pingTarget,
+ WebsiteData website,
+ Collection categories) throws RollerException;
+ */
+
+ /**
+ * Retrieve an auto ping configuration by id.
+ *
+ * @param id the id of the auto ping configuration to retrieve.
+ * @return the auto ping configuration with specified id or null if not found
+ * @throws RollerException
+ */
+ public AutoPingData retrieveAutoPing(String id) throws RollerException;
+
+ /**
+ * Store an auto ping configuration.
+ *
+ * @param autoPing the auto ping configuration
+ * @throws RollerException
+ */
+ public void storeAutoPing(AutoPingData autoPing) throws RollerException;
+
+ /**
+ * Remove the auto ping configuration with given id.
+ *
+ * @param id the id of the auto ping configuration to remove
+ * @throws RollerException
+ */
+ public void removeAutoPing(String id) throws RollerException;
+
+ /**
+ * Remove the auto ping configuration with given id.
+ *
+ * @param autoPing the auto ping configuration to remove
+ * @throws RollerException
+ */
+ public void removeAutoPing(AutoPingData autoPing) throws RollerException;
+
+ /**
+ * Remove the auto ping configuration for the given ping target and website, if one exists. Returns silently if it
+ * doesn't exist.
+ *
+ * @param pingTarget the ping target
+ * @param website the website
+ * @throws RollerException
+ */
+ public void removeAutoPing(PingTargetData pingTarget, WebsiteData website) throws RollerException;
+
+ /**
+ * Remove a collection of auto ping configurations.
+ *
+ * @param autopings a <code>Collection</code> of <code>AutoPingData</code> objects
+ * @throws RollerException
+ */
+ public void removeAutoPings(Collection autopings) throws RollerException;
+
+ /**
+ * Remove all auto ping configurations for all websites.
+ *
+ * @throws RollerException
+ */
+ public void removeAllAutoPings() throws RollerException;
+
+ /**
+ * Get all of the auto ping configurations for the given website.
+ *
+ * @param website
+ * @return a list of auto ping configurations for the given website as <code>AutoPingData</code> objects.
+ */
+ public List getAutoPingsByWebsite(WebsiteData website) throws RollerException;
+
+ /**
+ * Get all of the auto ping configurations for a given target (across all websites).
+ *
+ * @param pingTarget
+ * @return a list of auto ping configurations for the given target as <code>AutoPingData</code> objects.
+ */
+ public List getAutoPingsByTarget(PingTargetData pingTarget) throws RollerException;
+
+ /**
+ * Get the category restrictions on the given auto ping configuration.
+ *
+ * @param autoPing
+ * @return the category restrictions as a collection of <code>WeblogCategoryData</code> objects. This collection
+ * will be empty if there are no restrictions (meaning that the auto ping configuration applies to changes
+ * in any category of the website).
+ */
+ public List getCategoryRestrictions(AutoPingData autoPing) throws RollerException;
+
+ /**
+ * Set the category restrictions on the given ping configuration to the specified ones. If the new collection is
+ * empty, all category restrictions are removed.
+ *
+ * @param autoPing auto ping configuration to change
+ * @param newCategories a collection of <code>WeblogCategoryData</code> objects for the new category restrictions
+ */
+ public void setCategoryRestrictions(AutoPingData autoPing,
+ Collection newCategories);
+
+ /**
+ * Get the auto ping configurations that should be pinged upon creation/change of the given weblog entry.
+ *
+ * @param changedWeblogEntry the entry that has been created or changed
+ * @return a list of the ping configurations that should be applied due to this change
+ */
+ public List getApplicableAutoPings(WeblogEntryData changedWeblogEntry) throws RollerException;
+
+ /**
+ * Queue the auto ping configurations that should be pinged upon change to the given weblog entry. This calls the
+ * {@link PingQueueManager} to queue ping requests for each ping configuration that should be applied on change to
+ * the given weblog entry. If ping processing is suspended, this returns without doing anything.
+ *
+ * @param changedWeblogEntry the entry that has been created or changed
+ */
+ public void queueApplicableAutoPings(WeblogEntryData changedWeblogEntry) throws RollerException;
+}
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/BookmarkManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/BookmarkManager.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/BookmarkManager.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/BookmarkManager.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,189 @@
+
+package org.roller.model;
+
+import org.roller.RollerException;
+import org.roller.pojos.Assoc;
+import org.roller.pojos.BookmarkData;
+import org.roller.pojos.FolderData;
+import org.roller.pojos.WebsiteData;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+/**
+ * Interface to Bookmark Management. Provides methods for retrieving, storing,
+ * moving, removing and querying for folders and bookmarks.
+ *
+ * @author David M Johnson
+ */
+public interface BookmarkManager extends Serializable
+{
+ //---------------------------------------------------------- Bookmark CRUD
+
+ /** Create new bookmark, NOT a persistent instance. */
+ public BookmarkData createBookmark();
+
+ /** Create new bookmark, NOT a persistent instance. */
+ public BookmarkData createBookmark(
+ FolderData parent,
+ String name,
+ String desc,
+ String url,
+ String feedUrl,
+ Integer weight,
+ Integer priority,
+ String image) throws RollerException;
+
+ /** Retrieve bookmark by ID, a persistent instance. */
+ public BookmarkData retrieveBookmark(String id) throws RollerException;
+
+ /** Update or store bookmark object, becomes a persistent instance. */
+ //public void storeBookmark(BookmarkData data) throws RollerException;
+
+ /** Delete bookmark by ID. */
+ public void removeBookmark(String id) throws RollerException;
+
+ //------------------------------------------------------------ Folder CRUD
+
+ /** Create new folder, NOT a persistent instance. */
+ public FolderData createFolder();
+
+ /** Create new folder, NOT a persistent instance. */
+ public FolderData createFolder(
+ FolderData parent,
+ String name,
+ String desc,
+ WebsiteData website) throws RollerException;
+
+ /** Retrieve folder by ID, a persistent instance. */
+ public FolderData retrieveFolder(String id) throws RollerException;
+
+ /**
+ * Determine if folder is in use. A folder is <em>in use</em> if it contains any bookmarks
+ * or has any children.
+ * @param folder
+ * @return true if the folder contains bookmarks or has children, false otherwise.
+ * @throws RollerException
+ */
+ public boolean isFolderInUse(FolderData folder) throws RollerException;
+
+ /** Store folder object, becomes a persistent instance. */
+ //public void storeFolder(FolderData data) throws RollerException;
+
+ /**
+ * Remove folder by ID, does not cascade to subfolders and bookmarks.
+ * You should instead use FolderData.remove() to remove a folder.
+ */
+ //public void removeFolder(String id) throws RollerException;
+
+ //------------------------------------------------------------- Operations
+
+ /** Import bookmarks from OPML string into specified folder.
+ * @param site Website.
+ * @param folder Name of folder to hold bookmarks.
+ * @param opml OPML data to be imported.
+ */
+ public void importBookmarks(WebsiteData site, String folder, String opml)
+ throws RollerException;
+
+ /** Move contents of folder to another folder.
+ * @param src Source folder.
+ * @param dest Destination folder.
+ */
+ public void moveFolderContents(FolderData src, FolderData dest)
+ throws RollerException;
+
+ /**
+ * Delete contents of specified folder.
+ */
+ public void deleteFolderContents(FolderData src) throws RollerException;
+
+ //---------------------------------------------------------------- Queries
+
+ /** Get all folders for a website.
+ * @param website Website.
+ */
+ public List getAllFolders(WebsiteData wd) throws RollerException;
+
+ /** Get top level folders for a website.
+ * @param website Website.
+ */
+ public FolderData getRootFolder(WebsiteData website)
+ throws RollerException;
+
+ /** Get folder specified by website and folderPath.
+ * @param website Website of folder.
+ * @param folderPath Path of folder, relative to folder root.
+ */
+ public FolderData getFolder(WebsiteData website, String folderPath)
+ throws RollerException;
+
+ /**
+ * Get absolute path to folder, appropriate for use by getFolderByPath().
+ * @param folder Folder.
+ * @return Forward slash separated path string.
+ */
+ public String getPath(FolderData folder) throws RollerException;
+
+ /**
+ * Get subfolder by path relative to specified folder.
+ * @param folder Root of path or null to start at top of folder tree.
+ * @param path Path of folder to be located.
+ * @param website Website of folders.
+ * @return FolderData specified by path or null if not found.
+ */
+ public FolderData getFolderByPath(
+ WebsiteData wd, FolderData folder, String string)
+ throws RollerException;
+
+ /**
+ * @param folder
+ * @param ancestor
+ * @param relation
+ * @return
+ */
+ public Assoc createFolderAssoc(
+ FolderData folder, FolderData ancestor, String relation)
+ throws RollerException;
+
+ /**
+ * @param data
+ * @param subfolders
+ * @return
+ */
+ public List retrieveBookmarks(FolderData data, boolean subfolders)
+ throws RollerException;
+
+ /**
+ * Check duplicate folder name.
+ */
+ public boolean isDuplicateFolderName(FolderData data) throws RollerException;
+
+ /**
+ */
+ public Assoc getFolderParentAssoc(FolderData data) throws RollerException;
+
+ /**
+ */
+ public List getFolderChildAssocs(FolderData data) throws RollerException;
+
+ /**
+ */
+ public List getAllFolderDecscendentAssocs(FolderData data) throws RollerException;
+
+ /**
+ */
+ public List getFolderAncestorAssocs(FolderData data) throws RollerException;
+
+ /**
+ * Release all resources associated with Roller session.
+ */
+ public void release();
+
+ /**
+ * Determines if folder is descendent of folder.
+ */
+ public boolean isDescendentOf(FolderData data, FolderData ancestor) throws RollerException;
+}
+
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/ConfigManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/ConfigManager.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/ConfigManager.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/ConfigManager.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,17 @@
+/*
+ * Created on Feb 4, 2004
*/
package org.roller.model;
import org.roller.RollerException;
import org.roller.pojos.RollerConfigData;
import java.io.Serializable;
/**
+ * Manages Roller configuration
+ * @deprecated Replaced by {@link RollerProperties}.
+ */
public interface ConfigManager extends Serializable
{
/**
+ * Release all resources associated with Roller session.
+ */
public void release(); /**
+ * Store
+ */
+
public void storeRollerConfig( RollerConfigData data ) throws RollerException;
/**
+ * Get single RollerConfig object in system.
+ * @deprecated
+ */
+
public RollerConfigData getRollerConfig() throws RollerException;
/**
+ * Read RollerConfig from XML file.
+ */
+
public RollerConfigData readFromFile(String filePath) throws RollerException;
}
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/FileManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/FileManager.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/FileManager.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/FileManager.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,53 @@
+package org.roller.model;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.Serializable;
+
+import org.roller.RollerException;
+import org.roller.pojos.WebsiteData;
+import org.roller.util.RollerMessages;
+
+/**
+ * Interface for managing files uploaded to Roller.
+ *
+ * NOTE: this should probably be renamed "ResourceManager" or similar
+ * since the real jobe here is managing resources, not just files. We should
+ * then extend this a bit more to include the notion of not only user uploaded
+ * resources, but also other resources the system stores, such as the blacklist.
+ *
+ * @author dave
+ */
+public interface FileManager extends Serializable
+{
+ /** Determine if file can be saved in website's file space. */
+ public boolean canSave(
+ WebsiteData site, String name, long size, RollerMessages msgs)
+ throws RollerException;
+
+ /** Get website's files */
+ public File[] getFiles(WebsiteData site)
+ throws RollerException;
+
+ /** Delete specified file from website's file space. */
+ public void deleteFile(WebsiteData site, String name)
+ throws RollerException;
+
+ /** Save file in website's file space or throw exception if rules violated. */
+ public void saveFile(WebsiteData site, String name, long size, InputStream is)
+ throws RollerException;
+
+ /**
+ * Get directory in which uploaded files are stored
+ */
+ public String getUploadDir();
+ /**
+ * Get base URL where uploaded files are made available.
+ */
+ public String getUploadUrl();
+
+ /**
+ * Release all resources associated with Roller session.
+ */
+ public void release();
+}
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/IndexManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/IndexManager.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/IndexManager.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/IndexManager.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,42 @@
+package org.roller.model;
+
+import org.roller.RollerException;
+import org.roller.business.search.operations.IndexOperation;
+import org.roller.pojos.UserData;
+import org.roller.pojos.WeblogEntryData;
+
+/**
+ * Interface to Roller's Lucene-based search facility.
+ * @author Dave Johnson
+ */
+public interface IndexManager
+{
+ /** Does index need to be rebuild */
+ public abstract boolean isInconsistentAtStartup();
+
+ /** Rebuild index, returns immediately and operates in background */
+ public void rebuildUserIndex() throws RollerException;
+
+ /** Remove user from index, returns immediately and operates in background */
+ public void removeUserIndex(UserData user) throws RollerException;
+
+ /** Remove entry from index, returns immediately and operates in background */
+ public void removeEntryIndexOperation(WeblogEntryData entry) throws RollerException;
+
+ /** Add entry to index, returns immediately and operates in background */
+ public void addEntryIndexOperation(WeblogEntryData entry) throws RollerException;
+
+ /** R-index entry, returns immediately and operates in background */
+ public void addEntryReIndexOperation(WeblogEntryData entry) throws RollerException;
+
+ /** Execute operation immediately */
+ public abstract void executeIndexOperationNow(final IndexOperation op);
+
+ /**
+ * Release all resources associated with Roller session.
+ */
+ public abstract void release();
+
+ /** Shutdown to be called on application shutdown */
+ public abstract void shutdown();
+}
\ No newline at end of file
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/ParsedRequest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/ParsedRequest.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/ParsedRequest.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/ParsedRequest.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,32 @@
+
+package org.roller.model;
+import org.roller.pojos.WeblogEntryData;
+import org.roller.pojos.WebsiteData;
+
+/**
+ * Servlet API free interface that represents an incoming web request.
+ * @author David M Johnson
+ */
+public interface ParsedRequest
+{
+ /** Get date specified by request as YYYYMMDD, or null */
+ public String getDateString();
+
+ /** Get refering URL, or null. */
+ public String getRefererURL();
+
+ /** Get request URL. */
+ public String getRequestURL();
+
+ /** Get website specified by request, or null. */
+ public WebsiteData getWebsite();
+
+ /** Get weblog entry specified by request, or null. */
+ public WeblogEntryData getWeblogEntry();
+
+ /** Was date specified by request URL? */
+ public boolean isDateSpecified();
+
+ /** True if Linkback extraction is enabled */
+ public boolean isEnableLinkback();
+}
\ No newline at end of file
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/PersistenceSession.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/PersistenceSession.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/PersistenceSession.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/PersistenceSession.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,23 @@
+package org.roller.model;
+
+import org.roller.pojos.UserData;
+
+/**
+ * Represents a persistence session; this is the object that a PersistenceStrategy
+ * stores in thread local storage.
+ * @author David M Johnson
+ */
+public interface PersistenceSession
+{
+ /** Get underlying persistence session object (e.g. a Hibernate Session) */
+ public Object getSessionObject();
+
+ /** Set underlying persistence session object */
+ public void setSessionObject(Object newSession);
+
+ /** Get user associated with this session */
+ public UserData getUser();
+
+ /** Set user assoicated with this session */
+ public void setUser(UserData user);
+}
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/PingQueueManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/PingQueueManager.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/PingQueueManager.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/PingQueueManager.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2005
+ * Anil R. Gangolli. All rights reserved.
+ *
+ * Distributed with the Roller Weblogger Project under the terms of the Roller Software
+ * License
+ */
+
+package org.roller.model;
+
+import org.roller.RollerException;
+import org.roller.pojos.AutoPingData;
+import org.roller.pojos.PingQueueEntryData;
+import org.roller.pojos.WebsiteData;
+import org.roller.pojos.PingTargetData;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * PingQueueManager. This interface describes the manager for the weblog update ping request queue. The queue is
+ * processed by the <code>PingQueueProcesssor</code> and <code>PingQueueTask</code> components in the application
+ * layer.
+ */
+public interface PingQueueManager extends Serializable
+{
+ /**
+ * Release all resources associated with Roller session.
+ */
+ public void release();
+
+ /**
+ * Add a new persistent entry to the queue. If the queue already contains an entry for the ping target and website
+ * specified by this auto ping configuration, a new one will not be added.
+ *
+ * @param autoPing auto ping configuration for the ping request to be queued.
+ */
+ public void addQueueEntry(AutoPingData autoPing) throws RollerException;
+
+ /**
+ * Retrieve an entry from the queue.
+ *
+ * @param id the unique id of the entry.
+ * @return the queue entry with the specified id.
+ * @throws RollerException
+ */
+ public PingQueueEntryData retrieveQueueEntry(String id) throws RollerException;
+
+ /**
+ * Store the given queue entry.
+ *
+ * @param pingQueueEntry update the given queue entry
+ * @throws RollerException
+ */
+ public void storeQueueEntry(PingQueueEntryData pingQueueEntry) throws RollerException;
+
+ /**
+ * Remove a queue entry by id.
+ *
+ * @param id the unique id of the entry to be removed.
+ * @throws RollerException
+ */
+ public void removeQueueEntry(String id) throws RollerException;
+
+ /**
+ * Remove a queue entry.
+ *
+ * @param pingQueueEntry the entry to be removed.
+ * @throws RollerException
+ */
+ public void removeQueueEntry(PingQueueEntryData pingQueueEntry) throws RollerException;
+
+ /**
+ * Drop the queue. Removes all elements from the queue.
+ *
+ * @throws RollerException
+ */
+ public void dropQueue() throws RollerException;
+
+ /**
+ * Get all of the queue entries.
+ *
+ * @return the queue as a <code>List</code> of {@link PingQueueEntryData} objects.
+ * @throws RollerException
+ */
+ public List getAllQueueEntries() throws RollerException;
+
+ /**
+ * Remove all of the queue entries that reference the given ping target. This is used when the ping target is being
+ * deleted (application-level cascading).
+ *
+ * @param pingTarget the ping target for which queue entries are to be removed
+ */
+ public void removeQueueEntriesByPingTarget(PingTargetData pingTarget) throws RollerException;
+
+ /**
+ * Remove all of the queue entries that reference the given website. This is used when the website is being deleted
+ * (application-level cascading).
+ *
+ * @param website the website for which queue entreis are to be removed
+ */
+ public void removeQueueEntriesByWebsite(WebsiteData website) throws RollerException;
+}
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/PingTargetManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/PingTargetManager.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/PingTargetManager.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/PingTargetManager.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2005
+ * Anil R. Gangolli. All rights reserved.
+ *
+ * Distributed with the Roller Weblogger Project under the terms of the Roller Software
+ * License
+ */
+
+package org.roller.model;
+
+import org.roller.pojos.PingTargetData;
+import org.roller.pojos.WebsiteData;
+import org.roller.RollerException;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Manages ping targets.
+ */
+public interface PingTargetManager extends Serializable
+{
+ /**
+ * Release all resources associated with Roller session.
+ */
+ public void release();
+
+ /**
+ * Create a common (shared) ping target. This method does not persist the new instance.
+ *
+ * @param name
+ * @param pingUrl
+ * @return the new ping target.
+ * @throws RollerException
+ */
+ public PingTargetData createCommonPingTarget(String name, String pingUrl) throws RollerException;
+
+ /**
+ * Create a custom ping target for the specified website. This method does not persist the new instance.
+ *
+ * @param name a short descriptive name of the ping target
+ * @param pingUrl the URL to which to send pings
+ * @param website the website for which the custom target is created.
+ * @return the new ping target.
+ * @throws RollerException
+ */
+ public PingTargetData createCustomPingTarget(String name, String pingUrl,
+ WebsiteData website) throws RollerException;
+
+ /**
+ * Store a ping target.
+ *
+ * @param pingTarget ping target data object.
+ * @throws RollerException
+ */
+ public void storePingTarget(PingTargetData pingTarget) throws RollerException;
+
+ /**
+ * Retrieve a specific ping target by id.
+ *
+ * @param id id of the ping target to be retrieved.
+ * @return the ping target whose id is specified.
+ * @throws RollerException
+ */
+ public PingTargetData retrievePingTarget(String id) throws RollerException;
+
+ /**
+ * Remove a ping target by id.
+ *
+ * @param id id of the ping target to be removed
+ * @throws RollerException
+ */
+ public void removePingTarget(String id) throws RollerException;
+
+ /**
+ * Get a list of the common (shared) ping targets.
+ *
+ * @return the list of common ping targets as a <code>List</code> of {@link PingTargetData} objects
+ * @throws RollerException
+ */
+ public List getCommonPingTargets() throws RollerException;
+
+ /**
+ * Get a list of the custom ping targets for the given website.
+ *
+ * @param website the website whose custom targets should be returned.
+ * @return the list of custom ping targets for the given website as a <code>List</code> of {@link PingTargetData}
+ * objects
+ * @throws RollerException
+ */
+ public List getCustomPingTargets(WebsiteData website) throws RollerException;
+
+ /**
+ * Remove all of the custom ping targets for the given website.
+ *
+ * @param website the website whose custom ping targets should be removed
+ * @throws RollerException
+ */
+ public void removeCustomPingTargets(WebsiteData website) throws RollerException;
+
+ /**
+ * Remove all custom targets (regardless of website).
+ */
+ public void removeAllCustomPingTargets() throws RollerException;
+
+
+ /**
+ * Check if the ping target has a name that is unique in the appropriate set. If the ping target has no website id
+ * (is common), then this checks if the name is unique amongst common targets, and if custom then unique amongst
+ * custom targets. If the target has a non-null id, then it is allowed to have the same name as tha existing stored
+ * target with the same id.
+ *
+ * @param pingTarget
+ * @return true if the name is unique in the appropriate set (custom or common) ping targets.
+ * @throws RollerException
+ */
+ public boolean isNameUnique(PingTargetData pingTarget) throws RollerException;
+
+ /**
+ * Check if the url of the ping target is well-formed. For this test, it must parse as a <code>java.net.URL</code>,
+ * with protocol <code>http</code> and a non-empty <code>host</code> portion.
+ *
+ * @param pingTarget
+ * @return true if the <code>pingUrl</code> property of the ping target is a well-formed url.
+ * @throws RollerException
+ */
+ public boolean isUrlWellFormed(PingTargetData pingTarget) throws RollerException;
+
+ /**
+ * Check if the host portion of the url of the ping target is known, meaning it is either a well-formed IP address
+ * or a hostname that resolves from the server. The ping target url must parse as a <code>java.net.URL</code> in
+ * order for the hostname to be extracted for this test. This will return false if that parsing fails.
+ *
+ * @param pingTarget
+ * @return true if the <code>pingUrl</code> (is well-formed and) the <code>host</code> portion of the url of the
+ * ping target is a valid IP address or a hostname that can be resolved on the server.
+ * @throws RollerException
+ */
+ public boolean isHostnameKnown(PingTargetData pingTarget) throws RollerException;
+
+}
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/PlanetManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/PlanetManager.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/PlanetManager.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/PlanetManager.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,148 @@
+package org.roller.model;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import org.roller.RollerException;
+import org.roller.pojos.PlanetConfigData;
+import org.roller.pojos.PlanetEntryData;
+import org.roller.pojos.PlanetGroupData;
+import org.roller.pojos.PlanetSubscriptionData;
+
+/**
+ * Manages groups and subscriptions, can return aggregation for any group.
+ * @author David M Johnson
+ */
+public interface PlanetManager extends Serializable
+{
+ //------------------------------------------------------------------ create
+
+ /**
+ * Save configration
+ */
+ public void saveConfiguration(PlanetConfigData config)
+ throws RollerException;
+
+ /**
+ * Save new or update existing entry
+ */
+ public void saveEntry(PlanetEntryData entry) throws RollerException;
+
+ /**
+ * Save new or update existing a group
+ */
+ public void saveGroup(PlanetGroupData sub) throws RollerException;
+
+ /**
+ * Save or update a subscription
+ */
+ public void saveSubscription(PlanetSubscriptionData sub)
+ throws RollerException;
+
+ //---------------------------------------------------------------- retrieve
+
+ /**
+ * Get the one planet config object, config has default group
+ */
+ public PlanetConfigData getConfiguration() throws RollerException;
+
+ /**
+ * Get handles for all defined groups
+ */
+ public List getGroupHandles() throws RollerException;
+
+ /**
+ * Get list of group objects
+ */
+ public List getGroups() throws RollerException;
+
+ /**
+ * Get group by handle, group has subscriptions
+ */
+ public PlanetGroupData getGroup(String handle) throws RollerException;
+
+ /**
+ * Get group by ID rather than handle.
+ */
+ public PlanetGroupData getGroupById(String id) throws RollerException;
+
+ /**
+ * Get subscription by feedUrl.
+ */
+ public PlanetSubscriptionData getSubscription(String feedUrl)
+ throws RollerException;
+
+ /**
+ * Get subscription by ID rather than feedUrl.
+ */
+ public PlanetSubscriptionData getSubscriptionById(String id)
+ throws RollerException;
+
+ /**
+ * Get all subscriptions.
+ */
+ public Iterator getAllSubscriptions() throws RollerException;
+
+ /**
+ * Get total number of subscriptions.
+ */
+ public int getSubscriptionCount() throws RollerException;
+
+ /**
+ * Get top X subscriptions.
+ */
+ public List getTopSubscriptions(int max) throws RollerException;
+
+ /**
+ * Get top X subscriptions, restricted by group.
+ */
+ public List getTopSubscriptions(
+ PlanetGroupData group, int max) throws RollerException;
+
+ //------------------------------------------------------------ aggregations
+
+ /**
+ * Get agggration for group from cache, enries in
+ * reverse chonological order.
+ * Respects category constraints of group.
+ * @param group
+ * @param maxEntries Maximum number of entries to return.
+ */
+ public List getAggregation(
+ PlanetGroupData group, int maxEntries) throws RollerException;
+
+ /**
+ * Get agggration from cache, enries in reverse chonological order.
+ * @param maxEntries Maximum number of entries to return.
+ */
+ public List getAggregation(int maxEntries) throws RollerException;
+
+ //------------------------------------------------------------------ update
+
+ /** Refresh entry data by fetching and parsing feeds. */
+ public void refreshEntries() throws RollerException;
+
+ //------------------------------------------------------------------ delete
+
+ /** Delete group and any subscriptions that are orphaned. */
+ public void deleteGroup(PlanetGroupData group) throws RollerException;
+
+ /** Delete subscription, remove it from groups, cache, etc. */
+ public void deleteSubscription(PlanetSubscriptionData group)
+ throws RollerException;
+
+ /** Delete entry. */
+ public void deleteEntry(PlanetEntryData entry) throws RollerException;
+
+ /** Clear any aggregations and update times that have been cached */
+ public void clearCachedAggregations();
+
+ /** Get last update time for entries most recent 'all' aggregation */
+ public Date getLastUpdated();
+
+ /** Get last updated time for entries in a specify group */
+ public Date getLastUpdated(PlanetGroupData group);
+}
+
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/PropertiesManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/PropertiesManager.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/PropertiesManager.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/PropertiesManager.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,38 @@
+/*
+ * PropertiesManager.java
+ *
+ * Created on April 21, 2005, 10:34 AM
+ */
+
+package org.roller.model;
+
+import java.io.Serializable;
+import java.util.Map;
+import org.roller.RollerException;
+import org.roller.pojos.RollerPropertyData;
+
+/**
+ *
+ * @author Allen Gilliland
+ */
+public interface PropertiesManager extends Serializable
+{
+
+ /**
+ * Release all resources associated with Roller session.
+ */
+ public void release();
+
+ /** Save a single property */
+ public void store(RollerPropertyData property) throws RollerException;
+
+ /** Save a list of properties */
+ public void store(Map properties) throws RollerException;
+
+ /** Retrieve a single property by name */
+ public RollerPropertyData getProperty(String name) throws RollerException;
+
+ /** Retrieve a list of all properties */
+ public Map getProperties() throws RollerException;
+
+}
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/RefererManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/RefererManager.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/RefererManager.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/RefererManager.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,138 @@
+
+package org.roller.model;
+import org.roller.RollerException;
+import org.roller.business.ThreadManagerImpl;
+import org.roller.pojos.RefererData;
+import org.roller.pojos.WebsiteData;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+/////////////////////////////////////////////////////////////////////////////
+/**
+ * Interface to Referer management.
+ * @author David M Johnson
+ */
+public interface RefererManager extends Serializable
+{
+ //------------------------------------------ Access to Referer information
+
+ /**
+ * Get all referers for specified user.
+ * @param userName
+ * @return List of type RefererData
+ * @throws RollerException
+ */
+ public List getReferers(WebsiteData website)
+ throws RollerException;
+
+ /**
+ * Get all referers for specified user that were made today.
+ * @param userName Name of user.
+ * @return List of type RefererData
+ * @throws RollerException
+ */
+ public List getTodaysReferers(WebsiteData website)
+ throws RollerException;
+
+ /**
+ * Get referers for a specified date.
+ * @param userName Name of user.
+ * @param date YYYYMMDD format of day's date.
+ * @return List of type RefererData.
+ * @throws RollerException
+ */
+ public List getReferersToDate(WebsiteData website, String date)
+ throws RollerException;
+
+ /**
+ * Get most popular websites based on referer day hits.
+ * @return List of WebsiteDisplayData objects.
+ */
+ public List getDaysPopularWebsites(int max) throws RollerException;
+
+ /**
+ * Get referers that refer to a specific weblog entry.
+ * @param entryid Weblog entry ID
+ * @return List of RefererData objects.
+ * @throws RollerException
+ */
+ public List getReferersToEntry(String entryid)
+ throws RollerException;
+
+ /**
+ * Remove all referers for the specific weblog entry.
+ * @param entryId Weblog entry ID
+ * @throws RollerException
+ */
+ public void removeReferersForEntry(String entryid) throws RollerException;
+
+ /**
+ * Apply ignoreWord/spam filters to all referers in system.
+ */
+ public void applyRefererFilters() throws RollerException;
+
+ /**
+ * Apply ignoreWord/spam filters to all referers in website.
+ */
+ public void applyRefererFilters(WebsiteData website) throws RollerException;
+
+ /**
+ * Get referers that refer to a specific weblog entry.
+ * @param entryId Weblog entry ID
+ * @param authorized Is the current user authorized to edit these Referers.
+ * @return List of RefererData objects.
+ * @throws RollerException
+ */
+ public List getEntryReferers(String entryId, boolean authorized)
+ throws RollerException;
+
+ /** Get user's day hits */
+ public int getDayHits(WebsiteData website) throws RollerException;
+
+ /** Get user's all-time total hits */
+ public int getTotalHits(WebsiteData website) throws RollerException;
+
+ //--------------------------------------------- Referer processing methods
+
+ /**
+ * Process request for incoming referers.
+ * @param request Request to be processed.
+ * @return boolean True if the referer header contains an ignore/spam word.
+ */
+ public boolean processRequest(ParsedRequest request);
+
+ //---------------------------------------------- Referer tracking turnover
+
+ /**
+ * Force refer of referer hit counts and deletes all referers that do nto have excerpts.
+ */
+ public void forceTurnover(String websiteId) throws RollerException;
+
+ /**
+ * Check to see if it's time for turnover.
+ */
+ public void checkForTurnover(boolean forceTurnover, String websiteId)
+ throws RollerException;
+
+ //----------------------------------------------- Standard manager methods
+
+ /**
+ * Retrieve referer specifie by ID.
+ */
+ public RefererData retrieveReferer(String id)
+ throws RollerException;
+
+ /**
+ * Remove referer specified by ID.
+ */
+ public void removeReferer( String id )
+ throws RollerException;
+
+ /**
+ * Release all resources associated with Roller session.
+ */
+ public void release();
+}
+
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/Roller.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/Roller.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/Roller.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/Roller.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,140 @@
+
+package org.roller.model;
+import java.io.Serializable;
+import java.sql.Connection;
+
+import org.roller.RollerException;
+import org.roller.business.PersistenceStrategy;
+import org.roller.pojos.UserData;
+
+/** The main entry point interface of the Roller business tier.
+ * @author David M Johnson
+ */
+public interface Roller extends Serializable
+{
+ /** Get UserManager associated with this Roller instance.
+ * @return UserManager associated with this Roller instance.
+ * @throws RollerException If unable to create or return UserManager.
+ */
+ public UserManager getUserManager() throws RollerException;
+
+ /** Get BookmarkManager associated with this Roller instance.
+ * @return BookmarkManager associated with this Roller instance.
+ * @throws RollerException If unable to create or return BookmarkManager.
+ */
+ public BookmarkManager getBookmarkManager() throws RollerException;
+
+ /** Get WeblogManager associated with this Roller instance.
+ * @return WeblogManager associated with this Roller instance.
+ * @throws RollerException If unable to create or return WeblogManager.
+ */
+ public WeblogManager getWeblogManager() throws RollerException;
+
+ /** Get RefererManager associated with this Roller instance.
+ * @return RefererManager associated with this Roller instance.
+ * @throws RollerException If unable to create or return RefererManager.
+ */
+ public RefererManager getRefererManager() throws RollerException;
+
+ /** Get RefererManager associated with this Roller instance.
+ * @return RefererManager associated with this Roller instance.
+ * @throws RollerException If unable to create or return RefererManager.
+ */
+ public ConfigManager getConfigManager() throws RollerException;
+
+ /**
+ * Get the AutoPingManager associated with this Roller instance.
+ * @return the AutoPingManager associated with this Roller instance.
+ * @throws RollerException
+ */
+ public AutoPingManager getAutopingManager() throws RollerException;
+
+ /**
+ * Get the PingTargetManager associated with this Roller instance.
+ * @return the PingTargetManager associated with this Roller instance.
+ * @throws RollerException
+ */
+ public PingTargetManager getPingTargetManager() throws RollerException;
+
+ /**
+ * Get the PingQueueManager associated with this Roller instance.
+ * @return the PingQueueManager associated with this Roller instance.
+ * @throws RollerException
+ */
+ public PingQueueManager getPingQueueManager() throws RollerException;
+
+ /** Get PropertiesManager associated with this Roller instance.
+ * @return PropertiesManager associated with this Roller instance.
+ * @throws RollerException If unable to create or return PropertiesManager.
+ */
+ public PropertiesManager getPropertiesManager() throws RollerException;
+
+ /** Get FileManager associated with this Roller instance.
+ * @return FileManager associated with this Roller instance.
+ * @throws RollerException If unable to create or return FileManager.
+ */
+ public FileManager getFileManager() throws RollerException;
+
+ /**
+ * Get ThreadManager associated with this Roller instance.
+ */
+ public ThreadManager getThreadManager() throws RollerException;
+
+ /**
+ * Get IndexManager associated with this Roller instance.
+ */
+ public IndexManager getIndexManager() throws RollerException;
+
+ /**
+ * Get PlanetManager associated with this Roller instance.
+ */
+ public PlanetManager getPlanetManager() throws RollerException;
+
+ /**
+ * Get ThemeManager associated with this Roller instance.
+ */
+ public ThemeManager getThemeManager() throws RollerException;
+
+ /** Begin transaction for a thread.
+ */
+ public void begin() throws RollerException;
+ /**
+ * Start Roller session on behalf of specified user.
+ */
+ public void begin(UserData user) throws RollerException;
+ /**
+ * Set user for Roller session.
+ */
+ public void setUser(UserData user) throws RollerException;
+ /**
+ * Get user associated with Roller session.
+ */
+ public UserData getUser() throws RollerException;
+
+ /** Commit transaction for a thread.
+ * @throws RollerException If database error is thrown.
+ */
+ public void commit() throws RollerException;
+
+ /** Rollback uncommitted changes for a thread.
+ */
+ public void rollback();
+
+ /**
+ * Release all resources associated with Roller session.
+ */
+ public void release();
+
+ /** Get persistence strategy used by managers and POJOs. */
+ public PersistenceStrategy getPersistenceStrategy();
+
+ /** Repair websites if needed. */
+ public void upgradeDatabase(Connection con) throws RollerException;
+
+ /**
+ * Release all resources necessary for this instance
+ * of Roller.
+ */
+ public void shutdown();
+}
+
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/RollerFactory.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/RollerFactory.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/RollerFactory.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/RollerFactory.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,133 @@
+package org.roller.model;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.roller.RollerException;
+import org.roller.config.RollerConfig;
+import org.roller.util.StringUtils;
+
+/**
+ * This is primarily a static holder for whatever Roller implementation is
+ * being used. RollerContext should call setRoller(ServletContext) during its
+ * initialization so that the Roller implementation can be instantiated.
+ * Likewise, RollerContext.getRoller() should be replaced with calls to
+ * RollerFactory.getRoller(). This should prevent us any direct ties to
+ * Castor and permit for experimentation* with other persistence frameworks.
+ *
+ * @author llavandowska
+ * @author Allen Gilliland
+ */
+public abstract class RollerFactory
+{
+ private static final String DEFAULT_IMPL =
+ "org.roller.business.hibernate.HibernateRollerImpl";
+
+ private static Roller rollerInstance = null;
+
+ private static Log mLogger =
+ LogFactory.getFactory().getInstance(RollerFactory.class);
+
+ /**
+ * Let's just be doubling certain this class cannot be instantiated.
+ * @see java.lang.Object#Object()
+ */
+ private RollerFactory()
+ {
+ // hello all you beautiful people
+ }
+
+ /**
+ * Static accessor for the instance of Roller
+ * held by this class.
+ *
+ * @return Roller
+ */
+ public static Roller getRoller()
+ {
+ // check to see if we need to instantiate
+ if(rollerInstance == null) {
+ // lookup value for the roller classname to use
+ String roller_classname =
+ RollerConfig.getProperty("persistence.roller.classname");
+
+ // now call setRoller ourselves
+ RollerFactory.setRoller(roller_classname);
+ }
+
+ return rollerInstance;
+ }
+
+
+ /**
+ * Construct the actual Roller implemenation for this instance.
+ *
+ * Use reflection to call the implementation's instantiate() method.
+ * Should this fail (either no implementation is specified or
+ * instantiate() throws an Exception) then the DEFAULT_IMPL will be tried.
+ * If this should fail then we are in trouble :/
+ *
+ * @param roller_classname The name of the Roller implementation class
+ * to instantiate.
+ */
+ public static void setRoller(String roller_classname)
+ {
+
+ if (StringUtils.isEmpty( roller_classname ))
+ roller_classname = DEFAULT_IMPL;
+
+ try
+ {
+ Class rollerClass = Class.forName(roller_classname);
+ java.lang.reflect.Method instanceMethod =
+ rollerClass.getMethod("instantiate", (Class[])null);
+
+ // do the invocation
+ rollerInstance = (Roller)
+ instanceMethod.invoke(rollerClass, (Class[])null);
+
+ mLogger.info("Using Roller Impl: " + roller_classname);
+ }
+ catch (Exception e)
+ {
+ // uh oh
+ mLogger.error("Error instantiating " + roller_classname, e);
+ try
+ {
+ // if we didn't already try DEFAULT_IMPL then try it now
+ if( ! DEFAULT_IMPL.equals(roller_classname))
+ {
+ mLogger.info("** Trying DEFAULT_IMPL "+DEFAULT_IMPL+" **");
+
+ Class rollerClass = Class.forName(DEFAULT_IMPL);
+ java.lang.reflect.Method instanceMethod =
+ rollerClass.getMethod("instantiate", (Class[])null);
+
+ // do the invocation
+ rollerInstance = (Roller)
+ instanceMethod.invoke(rollerClass, (Class[])null);
+ }
+ else
+ {
+ // we just do this so that the logger gets the message
+ throw new Exception("Doh! Couldn't instantiate a roller class");
+ }
+
+ }
+ catch (Exception re)
+ {
+ mLogger.fatal("Failed to instantiate fallback roller impl", re);
+ }
+ }
+
+ }
+
+
+ /**
+ * Set Roller to be returned by factory.
+ */
+ public static void setRoller(Roller roller)
+ {
+ if (roller != null) rollerInstance = roller;
+ }
+}
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/RollerSpellCheck.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/RollerSpellCheck.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/RollerSpellCheck.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/RollerSpellCheck.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,117 @@
+package org.roller.model;
+
+import com.swabunga.spell.engine.SpellDictionary;
+import com.swabunga.spell.event.SpellCheckEvent;
+import com.swabunga.spell.event.SpellCheckListener;
+import com.swabunga.spell.event.SpellChecker;
+import com.swabunga.spell.event.StringWordTokenizer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.roller.RollerException;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+/**
+ * Since this class cannot be thread-safe due to the
+ * SpellCheckListener interface, first a "canonical"
+ * SpellDictionary must be instantiated with the path
+ * to the dictionary. Subsequently, call getInstance()
+ * which will return a new instance of RollerSpellCheck
+ * using the "precompiled" SpellDictionary, or will throw
+ * a NullPointerException. A better way can
+ * probably be found.
+ **/
+public class RollerSpellCheck implements SpellCheckListener
+{
+ private static Log mLogger =
+ LogFactory.getFactory().getInstance(RollerSpellCheck.class);
+
+ private static SpellDictionary dictionary = null;
+
+ private SpellChecker spellCheck = null;
+ private ArrayList spellCheckEvents = new ArrayList();
+
+ /**
+ * Initializer which takes an InputStream for
+ * /WEB-INF/english.0 to load the SpellDictionary.
+ * Building the SpellDictionary, and thus the SpellChecker
+ * is an expensive operation.
+ * You can get this InputStream with ServletContext.getResource(
+ * "/WEB-INF/english.0"). Throws a RollerException if
+ * SpellDictionary cannot be instantiated.
+ **/
+ public static void init(InputStream in) throws RollerException
+ {
+ try {
+ InputStreamReader inR = new InputStreamReader( in );
+ RollerSpellCheck.dictionary = new SpellDictionary( inR );
+
+ } catch (IOException ioe) {
+ mLogger.error("RollerSpellCheck unable to load SpellDictionary",
+ ioe);
+ throw new RollerException(ioe);
+ }
+ }
+
+ /**
+ * Private constructor taking a prebuilt SpellChecker
+ * as an argument.
+ **/
+ private RollerSpellCheck()
+ {
+ spellCheck = new SpellChecker(dictionary);
+ spellCheck.addSpellCheckListener(this);
+ }
+
+ /**
+ * Returns a new instance of RollerSpellCheck, using
+ * the (hopefully) prebuilt SpellChecker.
+ **/
+ public static RollerSpellCheck getInstance() throws RollerException
+ {
+ if (RollerSpellCheck.dictionary == null)
+ {
+ throw new RollerException(
+ "RollerSpellCheck.SpellDictionary has not been defined");
+ }
+
+ return new RollerSpellCheck();
+ }
+
+ /**
+ * Fulfills interface SpellCheckListener.
+ * SpellCheckEvent is placed into the ArrayList
+ * spellCheckEvents held by this RollerSpellCheck.
+ **/
+ public void spellingError(SpellCheckEvent event)
+ {
+ spellCheckEvents.add( event );
+ }
+
+ /**
+ * This is the method to check spelling.
+ * The submitted String is "parsed" by SpellChecker,
+ * SpellCheckEvents are placed into an ArrayList, which
+ * is returned to the caller. A SpellCheckEvent contains
+ * the "suspect" word, and a LinkedList of suggested replacements.
+ */
+ public ArrayList checkSpelling(String str) throws RollerException
+ {
+ spellCheck.checkSpelling( new StringWordTokenizer(str) );
+ return spellCheckEvents;
+ }
+
+ /**
+ * Convenience method. Creates a RollerSpellCheck object
+ * and calls checkSpelling(str) on it, returning the ArrayList.
+ */
+ public static ArrayList getSpellingErrors(String str) throws RollerException
+ {
+ RollerSpellCheck rCheck = RollerSpellCheck.getInstance();
+ return rCheck.checkSpelling(str);
+ }
+}
\ No newline at end of file
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/ScheduledTask.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/ScheduledTask.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/ScheduledTask.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/ScheduledTask.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,15 @@
+package org.roller.model;
+
+import org.roller.RollerException;
+
+/**
+ * Interface for pluggable scheduled task.
+ * @author David M Johnson
+ */
+public interface ScheduledTask
+{
+ /**
+ * Initialized scheduled task with Roller instance and real-path to Roller context.
+ */
+ public void init(Roller roller, String realPath) throws RollerException;
+}
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/ThemeManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/ThemeManager.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/ThemeManager.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/ThemeManager.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,99 @@
+/*
+ * ThemeManager.java
+ *
+ * Created on June 27, 2005, 12:49 PM
+ */
+
+package org.roller.model;
+
+import java.util.List;
+import org.roller.RollerException;
+import org.roller.ThemeNotFoundException;
+import org.roller.pojos.Theme;
+import org.roller.pojos.ThemeTemplate;
+
+
+/**
+ * Manager interface for accessing Theme related objects.
+ *
+ * @author Allen Gilliland
+ */
+public interface ThemeManager {
+
+ /**
+ * Get the Theme object with the given name.
+ *
+ * @throws ThemeNotFoundException If the named theme cannot be found.
+ * @throws RollerException If there is some kind of fatal backend error.
+ **/
+ public Theme getTheme(String name)
+ throws ThemeNotFoundException, RollerException;
+
+
+ /**
+ * Get the Theme object with the given theme id.
+ *
+ * @throws ThemeNotFoundException If the named theme cannot be found.
+ * @throws RollerException If there is some kind of fatal backend error.
+ */
+ public Theme getThemeById(String theme_id)
+ throws ThemeNotFoundException, RollerException;
+
+
+ /**
+ * Get a list of all available themes.
+ * This list is ordered alphabetically by default.
+ *
+ * NOTE: this only returns a list of theme names, not actual Theme objects.
+ **/
+ public List getThemesList();
+
+
+ /**
+ * Get a list of all theme names that are currently enabled.
+ * This list is ordered alphabetically by default.
+ *
+ * NOTE: this only returns a list of theme names, not actual Theme objects.
+ */
+ public List getEnabledThemesList();
+
+
+ /**
+ * Get the template from a given theme.
+ *
+ * @throws ThemeNotFoundException If the named theme cannot be found.
+ * @throws RollerException If there is some kind of fatal backend error.
+ */
+ public ThemeTemplate getTemplate(String theme_name, String template_name)
+ throws ThemeNotFoundException, RollerException;
+
+
+ /**
+ * Get the template from a given theme using the template id.
+ *
+ * Theme templates use a special id value when they come off the filesystem.
+ * When a theme is read off the filesystem it's templates are given an id
+ * like ... <theme name>:<template name>
+ *
+ * @throws ThemeNotFoundException If the named theme cannot be found.
+ * @throws RollerException If there is some kind of fatal backend error.
+ */
+ public ThemeTemplate getTemplateById(String template_id)
+ throws ThemeNotFoundException, RollerException;
+
+
+ /**
+ * Get the template from a given theme using the template link value.
+ *
+ * Note that for themes we enforce the rule that
+ * Theme.name == Theme.link
+ *
+ * So doing a lookup by link is the same as doing a lookup by name.
+ *
+ * @throws ThemeNotFoundException If the named theme cannot be found.
+ * @throws RollerException If there is some kind of fatal backend error.
+ */
+ public ThemeTemplate getTemplateByLink(String theme_name, String template_link)
+ throws ThemeNotFoundException, RollerException;
+
+}
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/ThreadManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/ThreadManager.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/ThreadManager.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/ThreadManager.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,51 @@
+package org.roller.model;
+
+import java.util.TimerTask;
+import java.sql.Date;
+
+/**
+ * Thread management for executing scheduled and asynchronous tasks.
+ */
+public interface ThreadManager
+{
+ public static final long MIN_RATE_INTERVAL_MINS = 1;
+
+ /**
+ * Execute runnable in background (asynchronously).
+ * @param runnable
+ * @throws java.lang.InterruptedException
+ */
+ public void executeInBackground(Runnable runnable)
+ throws InterruptedException;
+
+ /**
+ * Execute runnable in foreground (synchronously).
+ */
+ public void executeInForeground(Runnable runnable)
+ throws InterruptedException;
+
+ /**
+ * Schedule task to run once a day.
+ */
+ public void scheduleDailyTimerTask(TimerTask task);
+
+ /**
+ * Schedule task to run once per hour.
+ */
+ public void scheduleHourlyTimerTask(TimerTask task);
+
+ /**
+ * Schedule task to run at fixed rate.
+ */
+ public void scheduleFixedRateTimerTask(TimerTask task, long delayMins, long periodMins);
+
+ /**
+ * Shutdown
+ */
+ public void shutdown();
+
+ /**
+ * Release all resources associated with Roller session.
+ */
+ public void release();
+}
\ No newline at end of file
Added: incubator/roller/branches/roller_1.x/src/org/roller/model/UserManager.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_1.x/src/org/roller/model/UserManager.java?rev=327589&view=auto
==============================================================================
--- incubator/roller/branches/roller_1.x/src/org/roller/model/UserManager.java (added)
+++ incubator/roller/branches/roller_1.x/src/org/roller/model/UserManager.java Fri Oct 21 14:27:36 2005
@@ -0,0 +1,181 @@
+
+package org.roller.model;
+
+import org.roller.RollerException;
+import org.roller.pojos.WeblogTemplate;
+import org.roller.pojos.RoleData;
+import org.roller.pojos.UserData;
+import org.roller.pojos.WebsiteData;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.List;
+
+
+/**
+ * Manages storage, retrieval, and querying of user, website, and page data.
+ *
+ * @author David M Johnson
+ */
+public interface UserManager extends Serializable
+{
+ /**
+ * Release all resources associated with Roller session.
+ */
+ public void release();
+
+ //--------------------------------------------------------------- UserData
+
+ /** Get all enabled users */
+ public List getUsers() throws RollerException;
+
+ /** Get all users, optionally include dis-enabled users */
+ public List getUsers(boolean enabledOnly) throws RollerException;
+
+ /** Get user object by user name (only enabled users) */
+ public UserData getUser( String userName ) throws RollerException;
+
+ /** Get user object by user name, optionally include dis-enabled users */
+ public UserData getUser( String userName, boolean enabledOnly ) throws RollerException;
+
+ /** Add a new user with pages, bookmarks, folders...
+ * @param user New user object to be added to database
+ * @param themeDir Directory containing theme for user
+ */
+ public void addUser( UserData user, Map page, String theme,
+ String locale, String timezone)
+ throws RollerException;
+
+ /**
+ * Get user by ID
+ */
+ public UserData retrieveUser(String id)throws RollerException;
+ /**
+ * Store user.
+ */
+ public void storeUser( UserData data ) throws RollerException;
+
+ /**
+ * Get all user roles.
+ */
+ public List getUserRoles(UserData user) throws RollerException;
+ /**
+ * Get role by ID
+ */
+ public RoleData retrieveRole(String id) throws RollerException;
+ /**
+ * Store role.
+ */
+ public void storeRole( RoleData data ) throws RollerException;
+ /**
+ * Remove role by ID.
+ */
+ public void removeRole( String id ) throws RollerException;
+
+ //------------------------------------------------------------ WebsiteData
+
+ /** Get website object by user name */
+ public WebsiteData getWebsite(String userName) throws RollerException;
+ /**
+ * Get website by username.
+ * @param userName Username of website's owner
+ * @param enabledOnly Only return enabled websites.
+ * @throws org.roller.RollerException
+ * @return
+ */
+ public WebsiteData getWebsite(String userName, boolean enabledOnly) throws RollerException;
+
+ /**
+ * Get website by ID
+ */
+ public WebsiteData retrieveWebsite(String id) throws RollerException;
+ /**
+ * Store website
+ */
+ public void storeWebsite(WebsiteData data) throws RollerException;
+ /**
+ * Remove website by ID.
+ */
+ public void removeWebsite(String id) throws RollerException;
+
+ //--------------------------------------------------------------- WeblogTemplate
+
+ /** Get user's page by name */
+ public WeblogTemplate getPageByName(WebsiteData w, String p) throws RollerException;
+
+ /** Get user's page by link */
+ public WeblogTemplate getPageByLink(WebsiteData w, String p) throws RollerException;
+
+ /** Fix page link using page name */
+ public String fixPageLink(WeblogTemplate data) throws RollerException;
+
+ /** Get users pages */
+ public List getPages(WebsiteData w) throws RollerException;
+
+ /**
+ * Get page by ID
+ */
+ public WeblogTemplate retrievePage(String id) throws RollerException;
+ /**
+ * Store page
+ */
+ public void storePage(WeblogTemplate data) throws RollerException;
+ /**
+ * Remove page by ID
+ */
+ public void removePage(String id) throws RollerException;
+
+
+ /**
+ * Remove page safely. This will throw an exception on attempts to remove mandatory website pages such as the
+ * website's default page.
+ * @param id id of the page to be removed
+ * @throws RollerException with root cause <code>IllegalArgumentException</code> if the page id is that of
+ * a page that will not be removed by this method.
+ */
+ public void removePageSafely(String id) throws RollerException;
+
+ /**
+ * Retrieve the Page in read-only mode (does hibernate support this?).
+ */
+ public WeblogTemplate retrievePageReadOnly(String id) throws RollerException;
+
+ /**
+ * Validates a user based on a cookie value. If successful, it returns
+ * a new cookie String. If not, then it returns null.
+ *
+ * @param value (in format username|guid)
+ * @return indicator that this is a valid login
+ * @throws Exception
+ */
+ public String checkLoginCookie(String value) throws RollerException;
+
+ /**
+ * Creates a cookie string using a username - designed for use when
+ * a user logs in and wants to be remembered.
+ *
+ * @param username
+ * @return String to put in a cookie for remembering user
+ * @throws Exception
+ */
+ public String createLoginCookie(String username) throws RollerException;
+
+ /**
+ * Deletes all cookies for user.
+ * @param username
+ */
+ public void removeLoginCookies(String username) throws RollerException;
+
+ /**
+ * Remove website(s) associated with user.
+ */
+ public void removeUserWebsites(UserData data) throws RollerException;
+
+ /**
+ * Remove contents of website.
+ */
+ public void removeWebsiteContents(WebsiteData data) throws RollerException;
+}
+
+
+