001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. The ASF licenses this file to You
004: * under the Apache License, Version 2.0 (the "License"); you may not
005: * use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License. For additional information regarding
015: * copyright in this work, please see the NOTICE file in the top level
016: * directory of this distribution.
017: */
018: package org.apache.roller.planet.business;
019:
020: import java.io.Serializable;
021: import java.util.Date;
022: import java.util.Iterator;
023: import java.util.List;
024:
025: import org.apache.roller.RollerException;
026: import org.apache.roller.planet.pojos.PlanetConfigData;
027: import org.apache.roller.planet.pojos.PlanetEntryData;
028: import org.apache.roller.planet.pojos.PlanetGroupData;
029: import org.apache.roller.planet.pojos.PlanetSubscriptionData;
030:
031: /**
032: * Manages groups and subscriptions, can return aggregation for any group.
033: * @author David M Johnson
034: */
035: public interface PlanetManager extends Serializable {
036:
037: //------------------------------------------------------------------ create
038:
039: /**
040: * Save configration
041: */
042: public void saveConfiguration(PlanetConfigData config)
043: throws RollerException;
044:
045: /**
046: * Save new or update existing entry
047: */
048: public void saveEntry(PlanetEntryData entry) throws RollerException;
049:
050: /**
051: * Save new or update existing a group
052: */
053: public void saveGroup(PlanetGroupData sub) throws RollerException;
054:
055: /**
056: * Save or update a subscription
057: */
058: public void saveSubscription(PlanetSubscriptionData sub)
059: throws RollerException;
060:
061: //---------------------------------------------------------------- retrieve
062:
063: /**
064: * Get the one planet config object, config has default group
065: */
066: public PlanetConfigData getConfiguration() throws RollerException;
067:
068: /**
069: * Get handles for all defined groups
070: */
071: public List getGroupHandles() throws RollerException;
072:
073: /**
074: * Get list of group objects
075: */
076: public List getGroups() throws RollerException;
077:
078: /**
079: * Get group by handle, group has subscriptions
080: */
081: public PlanetGroupData getGroup(String handle)
082: throws RollerException;
083:
084: /**
085: * Get group by ID rather than handle.
086: */
087: public PlanetGroupData getGroupById(String id)
088: throws RollerException;
089:
090: /**
091: * Get subscription by feedUrl.
092: */
093: public PlanetSubscriptionData getSubscription(String feedUrl)
094: throws RollerException;
095:
096: /**
097: * Get subscription by ID rather than feedUrl.
098: */
099: public PlanetSubscriptionData getSubscriptionById(String id)
100: throws RollerException;
101:
102: /**
103: * Get all subscriptions.
104: */
105: public Iterator getAllSubscriptions() throws RollerException;
106:
107: /**
108: * Get total number of subscriptions.
109: */
110: public int getSubscriptionCount() throws RollerException;
111:
112: /**
113: * Get top X subscriptions.
114: */
115: public List getTopSubscriptions(int offset, int len)
116: throws RollerException;
117:
118: /**
119: * Get top X subscriptions, restricted by group.
120: */
121: public List getTopSubscriptions(String groupHandle, int offset,
122: int len) throws RollerException;
123:
124: /**
125: * Get entries in a single feed as list of PlanetEntryData objects.
126: */
127: public List getFeedEntries(String feedUrl, int offset, int len)
128: throws RollerException;
129:
130: //------------------------------------------------------------ aggregations
131:
132: /**
133: * Get agggration for group from cache, enries in reverse chonological order.
134: * Respects category constraints of group.
135: * @param group Restrict to entries from one subscription group.
136: * @param offset Offset into results (for paging)
137: * @param len Maximum number of results to return (for paging)
138: */
139: public List getAggregation(PlanetGroupData group, Date startDate,
140: Date endDate, int offset, int len) throws RollerException;
141:
142: public List getAggregation(int offset, int len)
143: throws RollerException;
144:
145: public List getAggregation(PlanetGroupData group, int offset,
146: int len) throws RollerException;
147:
148: /**
149: * Get agggration from cache, enries in reverse chonological order.
150: * @param offset Offset into results (for paging)
151: * @param len Maximum number of results to return (for paging)
152: */
153: public List getAggregation(Date startDate, Date endDate,
154: int offset, int len) throws RollerException;
155:
156: //------------------------------------------------------------------ update
157:
158: /** Refresh entry data by fetching and parsing feeds. */
159: public void refreshEntries(String cacheDirPath)
160: throws RollerException;
161:
162: //------------------------------------------------------------------ delete
163:
164: /** Delete group and any subscriptions that are orphaned. */
165: public void deleteGroup(PlanetGroupData group)
166: throws RollerException;
167:
168: /** Delete subscription, remove it from groups, cache, etc. */
169: public void deleteSubscription(PlanetSubscriptionData group)
170: throws RollerException;
171:
172: /** Delete entry. */
173: public void deleteEntry(PlanetEntryData entry)
174: throws RollerException;
175:
176: /** Clear any aggregations and update times that have been cached */
177: public void clearCachedAggregations();
178:
179: /** Get last update time for entries most recent 'all' aggregation */
180: public Date getLastUpdated();
181:
182: /** Get last updated time for entries in a specify group */
183: public Date getLastUpdated(PlanetGroupData group);
184: }
|