You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2007/06/03 21:15:33 UTC
svn commit: r543966 [1/2] - in /roller/trunk/apps/planet:
src/java/org/apache/roller/ src/java/org/apache/roller/planet/
src/java/org/apache/roller/planet/business/
src/java/org/apache/roller/planet/business/hibernate/
src/java/org/apache/roller/planet...
Author: agilliland
Date: Sun Jun 3 12:15:31 2007
New Revision: 543966
URL: http://svn.apache.org/viewvc?view=rev&rev=543966
Log:
planet code should throw application specific PlanetException and not a generic RollerException. in order to do this we need the hibernate and jpa PersistenceStrategy classes to be application specific.
Added:
roller/trunk/apps/planet/src/java/org/apache/roller/planet/PlanetException.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPersistenceStrategy.java
Removed:
roller/trunk/apps/planet/src/java/org/apache/roller/RollerException.java
Modified:
roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/DatabaseProvider.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/FeedFetcher.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/Planet.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PlanetManager.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PropertiesManager.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/RomeFeedFetcher.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernateConnectionProvider.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePersistenceStrategy.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetImpl.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetManagerImpl.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePropertiesManagerImpl.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetImpl.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetManagerImpl.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPropertiesManagerImpl.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetEntryData.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetGroupData.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/tasks/RefreshPlanetTask.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/tasks/StaticPlanetModel.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/ConfigForm.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetForm.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetGroupForm.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetSubscriptionForm.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/core/PlanetContext.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/RenderingException.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/model/FeedModel.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/model/Model.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/model/ModelLoader.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/model/PageModel.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/model/PlanetGroupModel.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/model/PlanetURLModel.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/model/SiteModel.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/model/SiteURLModel.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/model/UtilitiesModel.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/servlets/FeedServlet.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/servlets/HomepageServlet.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/servlets/OpmlServlet.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/servlets/PageServlet.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/util/InvalidRequestException.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/util/PlanetGroupRequest.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/util/PlanetRequest.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/util/RegexUtil.java
roller/trunk/apps/planet/src/java/org/apache/roller/planet/util/URLUtilities.java
roller/trunk/apps/planet/src/java/org/apache/roller/util/ISO8601DateParser.java
roller/trunk/apps/planet/src/java/org/apache/roller/util/UtilitiesModel.java
roller/trunk/apps/planet/test/java/org/apache/roller/planet/TestUtils.java
Added: roller/trunk/apps/planet/src/java/org/apache/roller/planet/PlanetException.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/PlanetException.java?view=auto&rev=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/PlanetException.java (added)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/PlanetException.java Sun Jun 3 12:15:31 2007
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.roller.planet;
+
+import org.apache.roller.RollerException;
+
+
+/**
+ * A base exception class for Roller Planet.
+ */
+public class PlanetException extends RollerException {
+
+
+ public PlanetException() {
+ super();
+ }
+
+
+ /**
+ * Construct PlanetException with message string.
+ *
+ * @param s Error message string.
+ */
+ public PlanetException(String s) {
+ super(s);
+ }
+
+
+ /**
+ * Construct PlanetException, wrapping existing throwable.
+ *
+ * @param s Error message
+ * @param t Existing connection to wrap.
+ */
+ public PlanetException(String s, Throwable t) {
+ super(s, t);
+ }
+
+
+ /**
+ * Construct PlanetException, wrapping existing throwable.
+ *
+ * @param t Existing exception to be wrapped.
+ */
+ public PlanetException(Throwable t) {
+ super(t);
+ }
+
+}
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/DatabaseProvider.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/DatabaseProvider.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/DatabaseProvider.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/DatabaseProvider.java Sun Jun 3 12:15:31 2007
@@ -9,7 +9,7 @@
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.apache.roller.planet.config.PlanetConfig;
/**
@@ -52,7 +52,7 @@
* Reads configuraiton, loads driver or locates data-source and attempts
* to get test connecton so that we can fail early.
*/
- private DatabaseProvider() throws RollerException {
+ private DatabaseProvider() throws PlanetException {
String connectionTypeString =
PlanetConfig.getProperty("database.configurationType");
if ("jdbc".equals(connectionTypeString)) {
@@ -70,7 +70,7 @@
try {
Class.forName(jdbcDriverClass);
} catch (ClassNotFoundException ex) {
- throw new RollerException(
+ throw new PlanetException(
"Cannot load specified JDBC driver class [" +jdbcDriverClass+ "]", ex);
}
if (jdbcUsername != null || jdbcPassword != null) {
@@ -85,7 +85,7 @@
InitialContext ic = new InitialContext();
dataSource = (DataSource)ic.lookup(name);
} catch (NamingException ex) {
- throw new RollerException(
+ throw new PlanetException(
"ERROR looking up data-source with JNDI name: " + name, ex);
}
}
@@ -93,14 +93,14 @@
Connection testcon = getConnection();
testcon.close();
} catch (Throwable t) {
- throw new RollerException("ERROR unable to obtain connection", t);
+ throw new PlanetException("ERROR unable to obtain connection", t);
}
}
/**
* Get global database provider singlton, instantiating if necessary.
*/
- public static DatabaseProvider getDatabaseProvider() throws RollerException {
+ public static DatabaseProvider getDatabaseProvider() throws PlanetException {
if (singletonInstance == null) {
singletonInstance = new DatabaseProvider();
}
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/FeedFetcher.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/FeedFetcher.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/FeedFetcher.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/FeedFetcher.java Sun Jun 3 12:15:31 2007
@@ -18,7 +18,7 @@
package org.apache.roller.planet.business;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
/**
@@ -30,6 +30,6 @@
/**
* Refresh all subscriptions by fetching and parsing feeds.
*/
- public void refreshEntries(String cacheDirPath) throws RollerException;
+ public void refreshEntries(String cacheDirPath) throws PlanetException;
}
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/Planet.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/Planet.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/Planet.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/Planet.java Sun Jun 3 12:15:31 2007
@@ -18,7 +18,7 @@
package org.apache.roller.planet.business;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.apache.roller.planet.business.PropertiesManager;
@@ -66,7 +66,7 @@
/**
* Flush object states.
*/
- public void flush() throws RollerException;
+ public void flush() throws PlanetException;
/**
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PlanetManager.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PlanetManager.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PlanetManager.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PlanetManager.java Sun Jun 3 12:15:31 2007
@@ -22,7 +22,7 @@
import java.util.Date;
import java.util.Iterator;
import java.util.List;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.apache.roller.planet.pojos.PlanetData;
import org.apache.roller.planet.pojos.PlanetEntryData;
import org.apache.roller.planet.pojos.PlanetGroupData;
@@ -35,123 +35,123 @@
public interface PlanetManager extends Manager {
- public void savePlanet(PlanetData planet) throws RollerException;
+ public void savePlanet(PlanetData planet) throws PlanetException;
- public void deletePlanet(PlanetData planet) throws RollerException;
+ public void deletePlanet(PlanetData planet) throws PlanetException;
- public PlanetData getPlanet(String handle) throws RollerException;
+ public PlanetData getPlanet(String handle) throws PlanetException;
- public PlanetData getPlanetById(String id) throws RollerException;
+ public PlanetData getPlanetById(String id) throws PlanetException;
- public List getPlanets() throws RollerException;
+ public List getPlanets() throws PlanetException;
/**
* Save new or update existing a group
*/
- public void saveGroup(PlanetGroupData sub) throws RollerException;
+ public void saveGroup(PlanetGroupData sub) throws PlanetException;
/**
* Delete group and any subscriptions that are orphaned.
*/
- public void deleteGroup(PlanetGroupData group) throws RollerException;
+ public void deleteGroup(PlanetGroupData group) throws PlanetException;
- public PlanetGroupData getGroup(PlanetData planet, String handle) throws RollerException;
+ public PlanetGroupData getGroup(PlanetData planet, String handle) throws PlanetException;
/**
* Get group by ID rather than handle.
*/
- public PlanetGroupData getGroupById(String id) throws RollerException;
+ public PlanetGroupData getGroupById(String id) throws PlanetException;
/**
* Save or update a subscription
*/
- public void saveSubscription(PlanetSubscriptionData sub) throws RollerException;
+ public void saveSubscription(PlanetSubscriptionData sub) throws PlanetException;
/**
* Delete subscription, remove it from groups, cache, etc.
*/
- public void deleteSubscription(PlanetSubscriptionData group) throws RollerException;
+ public void deleteSubscription(PlanetSubscriptionData group) throws PlanetException;
/**
* Get subscription by feedUrl.
*/
- public PlanetSubscriptionData getSubscription(String feedUrl) throws RollerException;
+ public PlanetSubscriptionData getSubscription(String feedUrl) throws PlanetException;
/**
* Get subscription by ID rather than feedUrl.
*/
- public PlanetSubscriptionData getSubscriptionById(String id) throws RollerException;
+ public PlanetSubscriptionData getSubscriptionById(String id) throws PlanetException;
/**
* Get all subscriptions.
*/
- public List getSubscriptions() throws RollerException;
+ public List getSubscriptions() throws PlanetException;
/**
* Get total number of subscriptions.
*/
- public int getSubscriptionCount() throws RollerException;
+ public int getSubscriptionCount() throws PlanetException;
/**
* Get top X subscriptions.
*/
- public List getTopSubscriptions(int offset, int len) throws RollerException;
+ public List getTopSubscriptions(int offset, int len) throws PlanetException;
/**
* Get top X subscriptions, restricted by group.
*/
public List getTopSubscriptions(PlanetGroupData group, int offset, int len)
- throws RollerException;
+ throws PlanetException;
/**
* Save new or update existing entry
*/
- public void saveEntry(PlanetEntryData entry) throws RollerException;
+ public void saveEntry(PlanetEntryData entry) throws PlanetException;
/**
* Delete entry.
*/
- public void deleteEntry(PlanetEntryData entry) throws RollerException;
+ public void deleteEntry(PlanetEntryData entry) throws PlanetException;
/**
* Delete all entries for a subscription.
*
* @param subscription The subscription to delete entries from.
- * @throws RollerException If there is a problem doing the delete.
+ * @throws PlanetException If there is a problem doing the delete.
*/
- public void deleteEntries(PlanetSubscriptionData sub) throws RollerException;
+ public void deleteEntries(PlanetSubscriptionData sub) throws PlanetException;
/**
* Lookup an entry by id.
*/
- public PlanetEntryData getEntryById(String id) throws RollerException;
+ public PlanetEntryData getEntryById(String id) throws PlanetException;
/**
* Get entries in a single feed as list of PlanetEntryData objects.
*/
public List getEntries(PlanetSubscriptionData sub, int offset, int len)
- throws RollerException;
+ throws PlanetException;
/**
@@ -162,7 +162,7 @@
* @param len Maximum number of results to return (for paging)
*/
public List getEntries(PlanetGroupData group, int offset, int len)
- throws RollerException;
+ throws PlanetException;
/**
@@ -179,6 +179,6 @@
Date startDate,
Date endDate,
int offset,
- int len) throws RollerException;
+ int len) throws PlanetException;
}
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PropertiesManager.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PropertiesManager.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PropertiesManager.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/PropertiesManager.java Sun Jun 3 12:15:31 2007
@@ -19,7 +19,7 @@
package org.apache.roller.planet.business;
import java.util.Map;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.apache.roller.planet.pojos.PropertyData;
@@ -31,24 +31,24 @@
/**
* Save a single property
*/
- public void saveProperty(PropertyData property) throws RollerException;
+ public void saveProperty(PropertyData property) throws PlanetException;
/**
* Save a list of properties
*/
- public void saveProperties(Map properties) throws RollerException;
+ public void saveProperties(Map properties) throws PlanetException;
/**
* Retrieve a single property by name
*/
- public PropertyData getProperty(String name) throws RollerException;
+ public PropertyData getProperty(String name) throws PlanetException;
/**
* Retrieve a list of all properties
*/
- public Map getProperties() throws RollerException;
+ public Map getProperties() throws PlanetException;
}
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/RomeFeedFetcher.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/RomeFeedFetcher.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/RomeFeedFetcher.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/RomeFeedFetcher.java Sun Jun 3 12:15:31 2007
@@ -34,7 +34,7 @@
import java.util.TreeSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.apache.roller.planet.business.hibernate.HibernatePlanetManagerImpl;
import org.apache.roller.planet.config.PlanetRuntimeConfig;
import org.apache.roller.planet.pojos.PlanetEntryData;
@@ -54,7 +54,7 @@
// refresh Entries for all Subscriptions
- public void refreshEntries(String cacheDirPath) throws RollerException {
+ public void refreshEntries(String cacheDirPath) throws PlanetException {
PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
@@ -151,7 +151,7 @@
protected Set getNewEntries(PlanetSubscriptionData sub,
com.sun.syndication.fetcher.FeedFetcher feedFetcher,
FeedFetcherCache feedInfoCache)
- throws RollerException {
+ throws PlanetException {
Set newEntries = new TreeSet();
SyndFeed feed = null;
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernateConnectionProvider.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernateConnectionProvider.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernateConnectionProvider.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernateConnectionProvider.java Sun Jun 3 12:15:31 2007
@@ -5,7 +5,7 @@
import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.apache.roller.planet.business.DatabaseProvider;
import org.hibernate.HibernateException;
import org.hibernate.connection.ConnectionProvider;
@@ -29,7 +29,7 @@
public Connection getConnection() throws SQLException {
try {
return DatabaseProvider.getDatabaseProvider().getConnection();
- } catch (RollerException ex) {
+ } catch (PlanetException ex) {
// The DatabaseProvider should have been constructed long before
// we get to this point, so this should never ever happen
throw new RuntimeException("ERROR getting database provider", ex);
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePersistenceStrategy.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePersistenceStrategy.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePersistenceStrategy.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePersistenceStrategy.java Sun Jun 3 12:15:31 2007
@@ -27,7 +27,7 @@
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.hibernate.cfg.Environment;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
@@ -96,7 +96,7 @@
}
- public void flush() throws RollerException {
+ public void flush() throws PlanetException {
Session session = getSession();
try {
@@ -113,7 +113,7 @@
release();
// wrap and rethrow so caller knows something bad happened
- throw new RollerException(t);
+ throw new PlanetException(t);
}
}
@@ -164,10 +164,10 @@
/**
* Retrieve object. We return null if the object is not found.
*/
- public Object load(String id, Class clazz) throws RollerException {
+ public Object load(String id, Class clazz) throws PlanetException {
if(id == null || clazz == null) {
- throw new RollerException("Cannot load objects when value is null");
+ throw new PlanetException("Cannot load objects when value is null");
}
return (Object) getSession().get(clazz, id);
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetImpl.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetImpl.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetImpl.java Sun Jun 3 12:15:31 2007
@@ -20,7 +20,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.apache.roller.planet.business.FeedFetcher;
import org.apache.roller.planet.config.PlanetConfig;
import org.apache.roller.planet.business.Planet;
@@ -58,14 +58,14 @@
* Create HibernatePlanetImpl using Hibernate XML config file or config
* file plus JDBC overrides from planet-custom.properties.
*/
- public HibernatePlanetImpl() throws RollerException {
+ public HibernatePlanetImpl() throws PlanetException {
strategy = getStrategy();
try {
String feedFetchClass = PlanetConfig.getProperty("feedfetcher.classname");
if(feedFetchClass == null || feedFetchClass.trim().length() < 1) {
- throw new RollerException("No FeedFetcher configured!!!");
+ throw new PlanetException("No FeedFetcher configured!!!");
}
Class fetchClass = Class.forName(feedFetchClass);
@@ -75,11 +75,11 @@
setFeedFetcher(feedFetcher);
} catch (Exception e) {
- throw new RollerException("Error initializing feed fetcher", e);
+ throw new PlanetException("Error initializing feed fetcher", e);
}
}
- protected HibernatePersistenceStrategy getStrategy() throws RollerException {
+ protected HibernatePersistenceStrategy getStrategy() throws PlanetException {
try {
String dialect =
PlanetConfig.getProperty("hibernate.dialect");
@@ -91,7 +91,7 @@
} catch(Throwable t) {
// if this happens then we are screwed
log.fatal("Error initializing Hibernate", t);
- throw new RollerException(t);
+ throw new PlanetException(t);
}
}
@@ -99,7 +99,7 @@
/**
* Instantiates and returns an instance of HibernatePlanetImpl.
*/
- public static Planet instantiate() throws RollerException {
+ public static Planet instantiate() throws PlanetException {
if (me == null) {
log.debug("Instantiating HibernatePlanetImpl");
me = new HibernatePlanetImpl();
@@ -145,7 +145,7 @@
}
- public void flush() throws RollerException {
+ public void flush() throws PlanetException {
this.strategy.flush();
}
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetManagerImpl.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetManagerImpl.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetManagerImpl.java Sun Jun 3 12:15:31 2007
@@ -28,7 +28,7 @@
import org.hibernate.criterion.Order;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.apache.roller.planet.business.hibernate.HibernatePersistenceStrategy;
import org.apache.roller.planet.business.AbstractManagerImpl;
import org.apache.roller.planet.business.PlanetManager;
@@ -55,18 +55,18 @@
// save a Planet
- public void savePlanet(PlanetData planet) throws RollerException {
+ public void savePlanet(PlanetData planet) throws PlanetException {
strategy.store(planet);
}
// delete a Planet
- public void deletePlanet(PlanetData planet) throws RollerException {
+ public void deletePlanet(PlanetData planet) throws PlanetException {
strategy.remove(planet);
}
// lookup Planet by handle
- public PlanetData getPlanet(String handle) throws RollerException {
+ public PlanetData getPlanet(String handle) throws PlanetException {
PlanetData planet = null;
try {
Session session = ((HibernatePersistenceStrategy)strategy).getSession();
@@ -74,38 +74,38 @@
criteria.add(Expression.ilike("handle", handle));
planet = (PlanetData) criteria.uniqueResult();
} catch (HibernateException e) {
- throw new RollerException(e);
+ throw new PlanetException(e);
}
return planet;
}
// lookup Planet by id
- public PlanetData getPlanetById(String id) throws RollerException {
+ public PlanetData getPlanetById(String id) throws PlanetException {
return (PlanetData) strategy.load(id, PlanetData.class);
}
// lookup all Planets
- public List getPlanets() throws RollerException {
+ public List getPlanets() throws PlanetException {
try {
Session session = ((HibernatePersistenceStrategy)strategy).getSession();
Criteria criteria = session.createCriteria(PlanetData.class);
criteria.addOrder(Order.asc("title"));
return criteria.list();
} catch (HibernateException e) {
- throw new RollerException(e);
+ throw new PlanetException(e);
}
}
// save a Group
- public void saveGroup(PlanetGroupData group) throws RollerException {
+ public void saveGroup(PlanetGroupData group) throws PlanetException {
// TODO: move this check outside this method?
if (group.getId() == null || getGroupById(group.getId()) == null) {
// If new group, make sure hadnle is unique within Planet
if (getGroup(group.getPlanet(), group.getHandle()) != null) {
- throw new RollerException("ERROR group handle already exists in Planet");
+ throw new PlanetException("ERROR group handle already exists in Planet");
}
}
strategy.store(group);
@@ -113,17 +113,17 @@
// delete a Group
- public void deleteGroup(PlanetGroupData group) throws RollerException {
+ public void deleteGroup(PlanetGroupData group) throws PlanetException {
strategy.remove(group);
}
// lookup a Group by Planet & handle
public PlanetGroupData getGroup(PlanetData planet, String handle)
- throws RollerException {
+ throws PlanetException {
if(planet == null) {
- throw new RollerException("planet cannot be null");
+ throw new PlanetException("planet cannot be null");
}
try {
@@ -133,39 +133,39 @@
criteria.add(Expression.eq("handle", handle));
return (PlanetGroupData) criteria.uniqueResult();
} catch (HibernateException e) {
- throw new RollerException(e);
+ throw new PlanetException(e);
}
}
// lookup a Planet by id
- public PlanetGroupData getGroupById(String id) throws RollerException {
+ public PlanetGroupData getGroupById(String id) throws PlanetException {
return (PlanetGroupData) strategy.load(id, PlanetGroupData.class);
}
// save a Subscription
public void saveSubscription(PlanetSubscriptionData sub)
- throws RollerException {
+ throws PlanetException {
PlanetSubscriptionData existing = getSubscription(sub.getFeedURL());
if (existing == null || (existing.getId().equals(sub.getId()))) {
this.strategy.store(sub);
} else {
- throw new RollerException("ERROR: duplicate feed URLs not allowed");
+ throw new PlanetException("ERROR: duplicate feed URLs not allowed");
}
}
// delete a Subscription
public void deleteSubscription(PlanetSubscriptionData sub)
- throws RollerException {
+ throws PlanetException {
strategy.remove(sub);
}
// lookup a Subscription by url
public PlanetSubscriptionData getSubscription(String feedURL)
- throws RollerException {
+ throws PlanetException {
try {
Session session = ((HibernatePersistenceStrategy)strategy).getSession();
Criteria criteria =
@@ -173,21 +173,21 @@
criteria.add(Expression.eq("feedURL", feedURL));
return (PlanetSubscriptionData) criteria.uniqueResult();
} catch (HibernateException e) {
- throw new RollerException(e);
+ throw new PlanetException(e);
}
}
// lookup a Subscription by id
public PlanetSubscriptionData getSubscriptionById(String id)
- throws RollerException {
+ throws PlanetException {
return (PlanetSubscriptionData) strategy.load(id, PlanetSubscriptionData.class);
}
// lookup all Subscriptions
// TODO: make pageable
- public List getSubscriptions() throws RollerException {
+ public List getSubscriptions() throws PlanetException {
try {
Session session = ((HibernatePersistenceStrategy)strategy).getSession();
Criteria criteria =
@@ -195,20 +195,20 @@
criteria.addOrder(Order.asc("feedURL"));
return criteria.list();
} catch (Throwable e) {
- throw new RollerException("ERROR fetching subscription collection", e);
+ throw new PlanetException("ERROR fetching subscription collection", e);
}
}
// get subscriptions count
- public int getSubscriptionCount() throws RollerException {
+ public int getSubscriptionCount() throws PlanetException {
try {
Session session = ((HibernatePersistenceStrategy)strategy).getSession();
Integer count = (Integer)session.createQuery(
"select count(*) from org.apache.roller.planet.pojos.PlanetSubscriptionData").uniqueResult();
return count.intValue();
} catch (Throwable e) {
- throw new RollerException("ERROR fetching subscription count", e);
+ throw new PlanetException("ERROR fetching subscription count", e);
}
}
@@ -216,7 +216,7 @@
// get popular Subscriptions from all Planets & Groups
// TODO: test this method
public List getTopSubscriptions(int offset, int length)
- throws RollerException {
+ throws PlanetException {
return getTopSubscriptions(null, offset, length);
}
@@ -225,7 +225,7 @@
// get popular Subscriptions from a specific Group
// TODO: test this method
public List getTopSubscriptions(PlanetGroupData group, int offset, int length)
- throws RollerException {
+ throws PlanetException {
List ret = null;
try {
@@ -251,26 +251,26 @@
}
ret = query.list();
} catch (HibernateException e) {
- throw new RollerException(e);
+ throw new PlanetException(e);
}
return ret;
}
// save an Entry
- public void saveEntry(PlanetEntryData entry) throws RollerException {
+ public void saveEntry(PlanetEntryData entry) throws PlanetException {
strategy.store(entry);
}
// delete an Entry
- public void deleteEntry(PlanetEntryData entry) throws RollerException {
+ public void deleteEntry(PlanetEntryData entry) throws PlanetException {
strategy.remove(entry);
}
// delete all Entries from a Subscription
public void deleteEntries(PlanetSubscriptionData sub)
- throws RollerException {
+ throws PlanetException {
Iterator entries = sub.getEntries().iterator();
while(entries.hasNext()) {
strategy.remove(entries.next());
@@ -282,17 +282,17 @@
// lookup Entry by id
- public PlanetEntryData getEntryById(String id) throws RollerException {
+ public PlanetEntryData getEntryById(String id) throws PlanetException {
return (PlanetEntryData)strategy.load(id, PlanetEntryData.class);
}
// lookup Entries from a specific Subscription
public List getEntries(PlanetSubscriptionData sub, int offset, int length)
- throws RollerException {
+ throws PlanetException {
if(sub == null) {
- throw new RollerException("subscription cannot be null");
+ throw new PlanetException("subscription cannot be null");
}
try {
@@ -304,14 +304,14 @@
if (length != -1) criteria.setMaxResults(length);
return criteria.list();
} catch (HibernateException e) {
- throw new RollerException(e);
+ throw new PlanetException(e);
}
}
// lookup Entries from a specific Group
public List getEntries(PlanetGroupData group, int offset, int len)
- throws RollerException {
+ throws PlanetException {
return getEntries(group, null, null, offset, len);
}
@@ -319,10 +319,10 @@
// Lookup Entries from a specific group
public List getEntries(PlanetGroupData group, Date startDate, Date endDate,
int offset, int length)
- throws RollerException {
+ throws PlanetException {
if (group == null) {
- throw new RollerException("group cannot be null");
+ throw new PlanetException("group cannot be null");
}
List ret = null;
@@ -367,7 +367,7 @@
+((endTime-startTime)/1000.0)+" seconds");
} catch (Throwable e) {
- throw new RollerException(e);
+ throw new PlanetException(e);
}
return ret;
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePropertiesManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePropertiesManagerImpl.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePropertiesManagerImpl.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePropertiesManagerImpl.java Sun Jun 3 12:15:31 2007
@@ -27,7 +27,7 @@
import org.hibernate.Session;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.apache.roller.planet.business.hibernate.HibernatePersistenceStrategy;
import org.apache.roller.planet.business.AbstractManagerImpl;
import org.apache.roller.planet.business.PropertiesManager;
@@ -67,11 +67,11 @@
/**
* Retrieve a single property by name.
*/
- public PropertyData getProperty(String name) throws RollerException {
+ public PropertyData getProperty(String name) throws PlanetException {
try {
return (PropertyData) strategy.load(name, PropertyData.class);
} catch (HibernateException e) {
- throw new RollerException(e);
+ throw new PlanetException(e);
}
}
@@ -83,7 +83,7 @@
* uses the property name as the key and the PropertyData object
* as the value.
*/
- public Map getProperties() throws RollerException {
+ public Map getProperties() throws PlanetException {
HashMap props = new HashMap();
@@ -105,7 +105,7 @@
props.put(prop.getName(), prop);
}
} catch (HibernateException e) {
- throw new RollerException(e);
+ throw new PlanetException(e);
}
return props;
@@ -115,7 +115,7 @@
/**
* Save a single property.
*/
- public void saveProperty(PropertyData property) throws RollerException {
+ public void saveProperty(PropertyData property) throws PlanetException {
this.strategy.store(property);
}
@@ -124,7 +124,7 @@
/**
* Save all properties.
*/
- public void saveProperties(Map properties) throws RollerException {
+ public void saveProperties(Map properties) throws PlanetException {
// just go through the list and saveProperties each property
Iterator props = properties.values().iterator();
Added: roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPersistenceStrategy.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPersistenceStrategy.java?view=auto&rev=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPersistenceStrategy.java (added)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPersistenceStrategy.java Sun Jun 3 12:15:31 2007
@@ -0,0 +1,374 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.roller.planet.business.jpa;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.io.InputStream;
+import java.io.IOException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.roller.planet.PlanetException;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityManager;
+import javax.persistence.FlushModeType;
+import javax.persistence.Persistence;
+import javax.persistence.PersistenceException;
+import javax.persistence.Query;
+
+
+/**
+ * JPAPersistenceStrategy is responsible for the lowest-level interaction with
+ * the JPA API.
+ */
+// TODO handle PersistenceExceptions!
+public class JPAPersistenceStrategy {
+
+ /**
+ * The thread local EntityManager.
+ */
+ private final ThreadLocal threadLocalEntityManager = new ThreadLocal();
+
+ /**
+ * The EntityManagerFactory for this Roller instance.
+ */
+ private EntityManagerFactory emf = null;
+
+ /**
+ * The logger instance for this class.
+ */
+ private static Log logger = LogFactory.getFactory().getInstance(
+ JPAPersistenceStrategy.class);
+
+ /**
+ * Construct by finding JPA EntityManagerFactory.
+ * @throws org.apache.roller.planet.PlanetException on any error
+ */
+ public JPAPersistenceStrategy(
+ String puName,
+ String jndiName,
+ Properties properties) throws PlanetException {
+
+ // set strategy used by Datamapper
+ // You can configure JPA completely via the JPAEMF.properties file
+ Properties emfProps = loadPropertiesFromResourceName(
+ "JPAEMF.properties", getContextClassLoader());
+
+ // Add additional properties passed in
+ Enumeration keys = properties.keys();
+ while (keys.hasMoreElements()) {
+ String key = (String)keys.nextElement();
+ String value = properties.getProperty(key);
+ logger.info(key + ": " + value);
+ emfProps.setProperty(key, value);
+ }
+
+ emfProps.setProperty("openjpa.ConnectionFactoryName", jndiName);
+
+ try {
+ this.emf = Persistence.createEntityManagerFactory(puName, emfProps);
+ } catch (PersistenceException pe) {
+ logger.error("ERROR: creating entity manager", pe);
+ throw new PlanetException(pe);
+ }
+ }
+
+ /**
+ * Construct by finding JPA EntityManagerFactory.
+ * @throws org.apache.roller.planet.PlanetException on any error
+ */
+ public JPAPersistenceStrategy(
+ String puName,
+ String driverClass,
+ String connectonUrl,
+ String username,
+ String password,
+ Properties properties) throws PlanetException {
+
+ logger.info("driverClass: " + driverClass);
+ logger.info("connectionURL: " + connectonUrl);
+ logger.info("username: " + username);
+
+ // set strategy used by Datamapper
+ // You can configure JPA completely via the JPAEMF.properties file
+ Properties emfProps = loadPropertiesFromResourceName(
+ "JPAEMF.properties", getContextClassLoader());
+
+ // Add additional properties passed in
+ Enumeration keys = properties.keys();
+ while (keys.hasMoreElements()) {
+ String key = (String)keys.nextElement();
+ String value = properties.getProperty(key);
+ logger.info(key + ": " + value);
+ emfProps.setProperty(key, value);
+ }
+
+ // Try to please all the players
+ emfProps.setProperty("openjpa.ConnectionDriverName", driverClass);
+ emfProps.setProperty("openjpa.ConnectionURL", connectonUrl);
+ emfProps.setProperty("openjpa.ConnectionUserName", username);
+ emfProps.setProperty("openjpa.ConnectionPassword", password);
+
+ emfProps.setProperty("toplink.jdbc.driver", driverClass);
+ emfProps.setProperty("toplink.jdbc.url", connectonUrl);
+ emfProps.setProperty("toplink.jdbc.user", username);
+ emfProps.setProperty("toplink.jdbc.password", password);
+
+ emfProps.setProperty("hibernate.connection.driver_class",driverClass);
+ emfProps.setProperty("hibernate.connection.url", connectonUrl);
+ emfProps.setProperty("hibernate.connection.username", username);
+ emfProps.setProperty("hibernate.connection.password", password);
+
+ try {
+ this.emf = Persistence.createEntityManagerFactory(puName, emfProps);
+ } catch (PersistenceException pe) {
+ logger.error("ERROR: creating entity manager", pe);
+ throw new PlanetException(pe);
+ }
+ }
+
+ /**
+ * Flush changes to the datastore, commit transaction, release em.
+ * @throws org.apache.roller.planet.PlanetException on any error
+ */
+ public void flush() throws PlanetException {
+ try {
+ EntityManager em = getEntityManager(true);
+ em.getTransaction().commit();
+ } catch (PersistenceException pe) {
+ throw new PlanetException(pe);
+ }
+ }
+
+ /**
+ * Release database session, rolls back any uncommitted changes.
+ */
+ public void release() {
+ EntityManager em = getEntityManager(false);
+ if (isTransactionActive(em)) {
+ em.getTransaction().rollback();
+ }
+ em.close();
+ setThreadLocalEntityManager(null);
+ }
+
+ /**
+ * Store object using an existing transaction.
+ * @param obj the object to persist
+ * @return the object persisted
+ * @throws org.apache.roller.planet.PlanetException on any error
+ */
+ public Object store(Object obj) throws PlanetException {
+ EntityManager em = getEntityManager(true);
+ if (!em.contains(obj)) {
+ // If entity is not managed we can assume it is new
+ em.persist(obj);
+ }
+ return obj;
+ }
+
+ /**
+ * Remove object from persistence storage.
+ * @param clazz the class of object to remove
+ * @param id the id of the object to remove
+ * @throws PlanetException on any error deleting object
+ */
+ public void remove(Class clazz, String id) throws PlanetException {
+ EntityManager em = getEntityManager(true);
+ Object po = em.find(clazz, id);
+ em.remove(po);
+ }
+
+ /**
+ * Remove object from persistence storage.
+ * @param po the persistent object to remove
+ * @throws org.apache.roller.planet.PlanetException on any error
+ */
+ public void remove(Object po) throws PlanetException {
+ EntityManager em = getEntityManager(true);
+ em.remove(po);
+ }
+
+ /**
+ * Remove object from persistence storage.
+ * @param pos the persistent objects to remove
+ * @throws org.apache.roller.planet.PlanetException on any error
+ */
+ public void removeAll(Collection pos) throws PlanetException {
+ EntityManager em = getEntityManager(true);
+ for (Iterator iterator = pos.iterator(); iterator.hasNext();) {
+ Object obj = iterator.next();
+ em.remove(obj);
+ }
+ }
+
+ /**
+ * Retrieve object, no transaction needed.
+ * @param clazz the class of object to retrieve
+ * @param id the id of the object to retrieve
+ * @return the object retrieved
+ * @throws PlanetException on any error retrieving object
+ */
+ public Object load(Class clazz, String id)
+ throws PlanetException {
+ EntityManager em = getEntityManager(false);
+ return em.find(clazz, id);
+ }
+
+ /**
+ * Return true if a transaction is active on the current EntityManager.
+ * @param em the persistence manager
+ * @return true if the persistence manager is not null and has an active
+ * transaction
+ */
+ private boolean isTransactionActive(EntityManager em) {
+ if (em == null) {
+ return false;
+ }
+ return em.getTransaction().isActive();
+ }
+
+ /**
+ * Get the EntityManager associated with the current thread of control.
+ * @param isTransactionRequired true if a transaction is begun if not
+ * already active
+ * @return the EntityManager
+ */
+ private EntityManager getEntityManager(boolean isTransactionRequired) {
+ EntityManager em = getThreadLocalEntityManager();
+ if (isTransactionRequired && !em.getTransaction().isActive()) {
+ em.getTransaction().begin();
+ }
+ return em;
+ }
+
+ /**
+ * Get the current ThreadLocal EntityManager
+ */
+ private EntityManager getThreadLocalEntityManager() {
+ EntityManager em = (EntityManager) threadLocalEntityManager.get();
+ if (em == null) {
+ em = emf.createEntityManager();
+ threadLocalEntityManager.set(em);
+ }
+ return em;
+ }
+
+ /**
+ * Set the current ThreadLocal EntityManager
+ */
+ private void setThreadLocalEntityManager(Object em) {
+ threadLocalEntityManager.set(em);
+ }
+
+ /**
+ * Get named query with FlushModeType.COMMIT
+ * @param clazz the class of instances to find
+ * @param queryName the name of the query
+ * @throws org.apache.roller.planet.PlanetException on any error
+ */
+ public Query getNamedQuery(String queryName)
+ throws PlanetException {
+ EntityManager em = getEntityManager(false);
+ Query q = em.createNamedQuery(queryName);
+ // Never flush for queries. Roller code assumes this behavior
+ q.setFlushMode(FlushModeType.COMMIT);
+ return q;
+ }
+
+ /**
+ * Create query from queryString with FlushModeType.COMMIT
+ * @param queryString the quuery
+ * @throws org.apache.roller.planet.PlanetException on any error
+ */
+ public Query getDynamicQuery(String queryString)
+ throws PlanetException {
+ EntityManager em = getEntityManager(false);
+ Query q = em.createQuery(queryString);
+ // Never flush for queries. Roller code assumes this behavior
+ q.setFlushMode(FlushModeType.COMMIT);
+ return q;
+ }
+
+ /**
+ * Get named update query with default flush mode
+ * @param clazz the class of instances to find
+ * @param queryName the name of the query
+ * @throws org.apache.roller.planet.PlanetException on any error
+ */
+ public Query getNamedUpdate(String queryName)
+ throws PlanetException {
+ EntityManager em = getEntityManager(true);
+ Query q = em.createNamedQuery(queryName);
+ return q;
+ }
+
+ /**
+ * Loads properties from given resourceName using given class loader
+ * @param resourceName The name of the resource containing properties
+ * @param cl Classloeder to be used to locate the resouce
+ * @return A properties object
+ * @throws PlanetException
+ */
+ private static Properties loadPropertiesFromResourceName(
+ String resourceName, ClassLoader cl) throws PlanetException {
+ Properties props = new Properties();
+ InputStream in = null;
+ in = cl.getResourceAsStream(resourceName);
+ if (in == null) {
+ //TODO: Check how i18n is done in roller
+ throw new PlanetException(
+ "Could not locate properties to load " + resourceName);
+ }
+ try {
+ props.load(in);
+ } catch (IOException ioe) {
+ throw new PlanetException(
+ "Could not load properties from " + resourceName);
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException ioe) {
+ }
+ }
+ }
+
+ return props;
+ }
+
+ /**
+ * Get the context class loader associated with the current thread. This is
+ * done in a doPrivileged block because it is a secure method.
+ * @return the current thread's context class loader.
+ */
+ private static ClassLoader getContextClassLoader() {
+ return (ClassLoader) AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Object run() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+}
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetImpl.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetImpl.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetImpl.java Sun Jun 3 12:15:31 2007
@@ -23,11 +23,11 @@
import org.apache.roller.planet.business.DatabaseProvider;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.apache.roller.planet.business.URLStrategy;
import org.apache.roller.planet.business.Planet;
import org.apache.roller.planet.business.PlanetManager;
-import org.apache.roller.business.jpa.JPAPersistenceStrategy;
+import org.apache.roller.planet.business.jpa.JPAPersistenceStrategy;
import org.apache.roller.planet.business.FeedFetcher;
import org.apache.roller.planet.business.PropertiesManager;
import org.apache.roller.planet.config.PlanetConfig;
@@ -58,14 +58,14 @@
protected FeedFetcher feedFetcher = null;
- protected JPAPlanetImpl() throws RollerException {
+ protected JPAPlanetImpl() throws PlanetException {
strategy = getStrategy();
try {
String feedFetchClass = PlanetConfig.getProperty("feedfetcher.classname");
if(feedFetchClass == null || feedFetchClass.trim().length() < 1) {
- throw new RollerException("No FeedFetcher configured!!!");
+ throw new PlanetException("No FeedFetcher configured!!!");
}
Class fetchClass = Class.forName(feedFetchClass);
@@ -75,12 +75,12 @@
setFeedFetcher(feedFetcher);
} catch (Exception e) {
- throw new RollerException("Error initializing feed fetcher", e);
+ throw new PlanetException("Error initializing feed fetcher", e);
}
}
- protected JPAPersistenceStrategy getStrategy() throws RollerException {
+ protected JPAPersistenceStrategy getStrategy() throws PlanetException {
// Add OpenJPA, Toplink and Hibernate properties to Roller config.
Properties props = new Properties();
@@ -112,7 +112,7 @@
/**
* Instantiates and returns an instance of JPAPlanetImpl.
*/
- public static Planet instantiate() throws RollerException {
+ public static Planet instantiate() throws PlanetException {
if (me == null) {
log.debug("Instantiating JPAPlanetImpl");
me = new JPAPlanetImpl();
@@ -130,7 +130,7 @@
log.info("Using URLStrategy: " + urlStrategy.getClass().getName());
}
- public void flush() throws RollerException {
+ public void flush() throws PlanetException {
this.strategy.flush();
}
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetManagerImpl.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetManagerImpl.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetManagerImpl.java Sun Jun 3 12:15:31 2007
@@ -45,8 +45,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
-import org.apache.roller.business.jpa.JPAPersistenceStrategy;
+import org.apache.roller.planet.PlanetException;
+import org.apache.roller.planet.business.jpa.JPAPersistenceStrategy;
import org.apache.roller.planet.business.PlanetManager;
import org.apache.roller.planet.pojos.PlanetData;
import org.apache.roller.planet.pojos.PlanetEntryData;
@@ -78,39 +78,39 @@
this.strategy = strategy;
}
- public void saveGroup(PlanetGroupData group) throws RollerException {
+ public void saveGroup(PlanetGroupData group) throws PlanetException {
strategy.store(group);
}
- public void saveEntry(PlanetEntryData entry) throws RollerException {
+ public void saveEntry(PlanetEntryData entry) throws PlanetException {
strategy.store(entry);
}
public void saveSubscription(PlanetSubscriptionData sub)
- throws RollerException {
+ throws PlanetException {
PlanetSubscriptionData existing = getSubscription(sub.getFeedURL());
if (existing == null || (existing.getId().equals(sub.getId()))) {
strategy.store(sub);
} else {
- throw new RollerException("ERROR: duplicate feed URLs not allowed");
+ throw new PlanetException("ERROR: duplicate feed URLs not allowed");
}
}
- public void deleteEntry(PlanetEntryData entry) throws RollerException {
+ public void deleteEntry(PlanetEntryData entry) throws PlanetException {
strategy.remove(entry);
}
- public void deleteGroup(PlanetGroupData group) throws RollerException {
+ public void deleteGroup(PlanetGroupData group) throws PlanetException {
strategy.remove(group);
}
public void deleteSubscription(PlanetSubscriptionData sub)
- throws RollerException {
+ throws PlanetException {
strategy.remove(sub);
}
public PlanetSubscriptionData getSubscription(String feedUrl)
- throws RollerException {
+ throws PlanetException {
Query q = strategy.getNamedQuery("PlanetSubscriptionData.getByFeedURL");
q.setParameter(1, feedUrl);
try {
@@ -121,7 +121,7 @@
}
public PlanetSubscriptionData getSubscriptionById(String id)
- throws RollerException {
+ throws PlanetException {
return (PlanetSubscriptionData) strategy.load(
PlanetSubscriptionData.class, id);
}
@@ -136,13 +136,13 @@
}
}
- public int getSubscriptionCount() throws RollerException {
+ public int getSubscriptionCount() throws PlanetException {
Query q = strategy.getNamedQuery("PlanetSubscriptionData.getAll");
return q.getResultList().size();
}
public List getTopSubscriptions(int offset, int length)
- throws RollerException {
+ throws PlanetException {
return getTopSubscriptions(null, offset, length);
}
@@ -150,7 +150,7 @@
* Get top X subscriptions, restricted by group.
*/
public List getTopSubscriptions(
- PlanetGroupData group, int offset, int len) throws RollerException {
+ PlanetGroupData group, int offset, int len) throws PlanetException {
List result = null;
if (group != null) {
Query q = strategy.getNamedQuery(
@@ -169,7 +169,7 @@
return result;
}
- public PlanetGroupData getGroup(String handle) throws RollerException {
+ public PlanetGroupData getGroup(String handle) throws PlanetException {
Query q = strategy.getNamedQuery("PlanetGroupData.getByHandle");
q.setParameter(1, handle);
try {
@@ -179,18 +179,18 @@
}
}
- public PlanetGroupData getGroupById(String id) throws RollerException {
+ public PlanetGroupData getGroupById(String id) throws PlanetException {
return (PlanetGroupData) strategy.load(PlanetGroupData.class, id);
}
public void release() {}
- public void savePlanet(PlanetData planet) throws RollerException {
+ public void savePlanet(PlanetData planet) throws PlanetException {
strategy.store(planet);
}
- public PlanetData getPlanet(String handle) throws RollerException {
+ public PlanetData getPlanet(String handle) throws PlanetException {
Query q = strategy.getNamedQuery("PlanetData.getByHandle");
q.setParameter(1, handle);
try {
@@ -200,15 +200,15 @@
}
}
- public PlanetData getPlanetById(String id) throws RollerException {
+ public PlanetData getPlanetById(String id) throws PlanetException {
return (PlanetData)strategy.load(PlanetData.class, id);
}
- public List getPlanets() throws RollerException {
+ public List getPlanets() throws PlanetException {
return (List)strategy.getNamedQuery("PlanetData.getAll").getResultList();
}
- public List getGroupHandles(PlanetData planet) throws RollerException {
+ public List getGroupHandles(PlanetData planet) throws PlanetException {
List handles = new ArrayList();
Iterator list = getGroups(planet).iterator();
while (list.hasNext()) {
@@ -218,13 +218,13 @@
return handles;
}
- public List getGroups(PlanetData planet) throws RollerException {
+ public List getGroups(PlanetData planet) throws PlanetException {
Query q = strategy.getNamedQuery("PlanetGroupData.getByPlanet");
q.setParameter(1, planet.getHandle());
return q.getResultList();
}
- public PlanetGroupData getGroup(PlanetData planet, String handle) throws RollerException {
+ public PlanetGroupData getGroup(PlanetData planet, String handle) throws PlanetException {
Query q = strategy.getNamedQuery("PlanetGroupData.getByPlanetAndHandle");
q.setParameter(1, planet.getHandle());
q.setParameter(2, handle);
@@ -235,12 +235,12 @@
}
}
- public void deletePlanet(PlanetData planet) throws RollerException {
+ public void deletePlanet(PlanetData planet) throws PlanetException {
strategy.remove(planet);
}
public void deleteEntries(PlanetSubscriptionData sub)
- throws RollerException {
+ throws PlanetException {
Iterator entries = sub.getEntries().iterator();
while(entries.hasNext()) {
strategy.remove(entries.next());
@@ -250,18 +250,18 @@
sub.getEntries().clear();
}
- public List getSubscriptions() throws RollerException {
+ public List getSubscriptions() throws PlanetException {
Query q = strategy.getNamedQuery("PlanetSubscriptionData.getAllOrderByFeedURL");
return q.getResultList();
}
- public PlanetEntryData getEntryById(String id) throws RollerException {
+ public PlanetEntryData getEntryById(String id) throws PlanetException {
return (PlanetEntryData) strategy.load(PlanetEntryData.class, id);
}
- public List getEntries(PlanetSubscriptionData sub, int offset, int len) throws RollerException {
+ public List getEntries(PlanetSubscriptionData sub, int offset, int len) throws PlanetException {
if(sub == null) {
- throw new RollerException("subscription cannot be null");
+ throw new PlanetException("subscription cannot be null");
}
Query q = strategy.getNamedQuery("PlanetEntryData.getBySubscription");
q.setParameter(1, sub);
@@ -270,15 +270,15 @@
return q.getResultList();
}
- public List getEntries(PlanetGroupData group, int offset, int len) throws RollerException {
+ public List getEntries(PlanetGroupData group, int offset, int len) throws PlanetException {
return getEntries(group, null, null, offset, len);
}
- public List getEntries(PlanetGroupData group, Date startDate, Date endDate, int offset, int len) throws RollerException {
+ public List getEntries(PlanetGroupData group, Date startDate, Date endDate, int offset, int len) throws PlanetException {
StringBuffer queryString = new StringBuffer();
if(group == null) {
- throw new RollerException("group cannot be null or empty");
+ throw new PlanetException("group cannot be null or empty");
}
List ret = null;
@@ -323,7 +323,7 @@
+((endTime-startTime)/1000.0)+" seconds");
} catch (Throwable e) {
- throw new RollerException(e);
+ throw new PlanetException(e);
}
return ret;
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPropertiesManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPropertiesManagerImpl.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPropertiesManagerImpl.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPropertiesManagerImpl.java Sun Jun 3 12:15:31 2007
@@ -24,8 +24,8 @@
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
-import org.apache.roller.business.jpa.JPAPersistenceStrategy;
+import org.apache.roller.planet.PlanetException;
+import org.apache.roller.planet.business.jpa.JPAPersistenceStrategy;
import org.apache.roller.planet.business.AbstractManagerImpl;
import org.apache.roller.planet.business.PropertiesManager;
import org.apache.roller.planet.config.PlanetRuntimeConfig;
@@ -63,7 +63,7 @@
/**
* Retrieve a single property by name.
*/
- public PropertyData getProperty(String name) throws RollerException {
+ public PropertyData getProperty(String name) throws PlanetException {
return (PropertyData)strategy.load(PropertyData.class, name);
}
@@ -75,7 +75,7 @@
* uses the property name as the key and the PropertyData object
* as the value.
*/
- public Map getProperties() throws RollerException {
+ public Map getProperties() throws PlanetException {
HashMap props = new HashMap();
List list = strategy.getNamedQuery("PropertyData.getAll").getResultList();
@@ -100,7 +100,7 @@
/**
* Save a single property.
*/
- public void saveProperty(PropertyData property) throws RollerException {
+ public void saveProperty(PropertyData property) throws PlanetException {
strategy.store(property);
}
@@ -109,7 +109,7 @@
/**
* Save all properties.
*/
- public void saveProperties(Map properties) throws RollerException {
+ public void saveProperties(Map properties) throws PlanetException {
// just go through the list and saveProperties each property
Iterator props = properties.values().iterator();
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetEntryData.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetEntryData.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetEntryData.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetEntryData.java Sun Jun 3 12:15:31 2007
@@ -81,7 +81,7 @@
public PlanetEntryData(
WeblogEntryData rollerEntry,
PlanetSubscriptionData sub,
- Map pagePlugins) throws RollerException {
+ Map pagePlugins) throws PlanetException {
setSubscription(sub);
initFromRollerEntry(rollerEntry, pagePlugins);
}
@@ -150,7 +150,7 @@
*/
/*
private void initFromRollerEntry(WeblogEntryData rollerEntry, Map pagePlugins)
- throws RollerException {
+ throws PlanetException {
Roller roller = RollerFactory.getRoller();
PluginManager ppmgr = roller.getPagePluginManager();
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetGroupData.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetGroupData.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetGroupData.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetGroupData.java Sun Jun 3 12:15:31 2007
@@ -17,10 +17,13 @@
package org.apache.roller.planet.pojos;
import java.io.Serializable;
+import java.util.Collections;
+import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;
-import org.apache.roller.util.UUIDGenerator;
+import org.apache.roller.planet.business.PlanetFactory;
+import org.apache.roller.planet.business.PlanetManager;
/**
@@ -32,10 +35,8 @@
transient private String[] catArray = null;
- /** Database ID */
- private String id = UUIDGenerator.generateUUID();
-
// attributes
+ private String id = null;
private String handle = null;
private String title = null;
private String description = null;
@@ -177,6 +178,19 @@
public void setPlanet(PlanetData planet) {
this.planet = planet;
+ }
+
+
+ /**
+ * Return a list of the most recent 10 entries from this group.
+ */
+ public List getRecentEntries() {
+ PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
+ try {
+ return mgr.getEntries(this, 0, 10);
+ } catch(Exception e) {
+ return Collections.EMPTY_LIST;
+ }
}
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/tasks/RefreshPlanetTask.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/tasks/RefreshPlanetTask.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/tasks/RefreshPlanetTask.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/tasks/RefreshPlanetTask.java Sun Jun 3 12:15:31 2007
@@ -20,7 +20,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.apache.roller.planet.config.PlanetConfig;
import org.apache.roller.planet.business.Planet;
import org.apache.roller.planet.business.PlanetFactory;
@@ -48,7 +48,7 @@
planet.flush();
planet.release();
- } catch (RollerException e) {
+ } catch (PlanetException e) {
log.error("ERROR refreshing planet", e);
}
}
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/tasks/StaticPlanetModel.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/tasks/StaticPlanetModel.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/tasks/StaticPlanetModel.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/tasks/StaticPlanetModel.java Sun Jun 3 12:15:31 2007
@@ -22,7 +22,7 @@
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.apache.roller.planet.business.Planet;
import org.apache.roller.planet.business.PlanetFactory;
import org.apache.roller.planet.business.PlanetManager;
@@ -38,13 +38,13 @@
PlanetManager planetManager = null;
- public StaticPlanetModel() throws RollerException {
+ public StaticPlanetModel() throws PlanetException {
Planet planet = PlanetFactory.getPlanet();
planetManager = planet.getPlanetManager();
}
// TODO: replace this with something equivalent
-// public PlanetConfigData getConfiguration() throws RollerException {
+// public PlanetConfigData getConfiguration() throws PlanetException {
// return planetManager.getConfiguration();
// }
@@ -69,28 +69,28 @@
}
// removed now that groups must be part of a planet, this method no longer makes sense
-// public List getGroups() throws RollerException {
+// public List getGroups() throws PlanetException {
// return planetManager.getGroups();
// }
// removed now that groups must be part of a planet, this method no longer makes sense
-// public PlanetGroupData getGroup(String handle) throws RollerException {
+// public PlanetGroupData getGroup(String handle) throws PlanetException {
// return planetManager.getGroup(handle);
// }
public List getAggregation(
- PlanetGroupData group, int maxEntries) throws RollerException {
+ PlanetGroupData group, int maxEntries) throws PlanetException {
return planetManager.getEntries(group, 0, maxEntries);
}
- public Iterator getAllSubscriptions() throws RollerException {
+ public Iterator getAllSubscriptions() throws PlanetException {
return planetManager.getSubscriptions().iterator();
}
- public int getSubscriptionCount() throws RollerException {
+ public int getSubscriptionCount() throws PlanetException {
return planetManager.getSubscriptionCount();
}
}
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/ConfigForm.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/ConfigForm.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/ConfigForm.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/ConfigForm.java Sun Jun 3 12:15:31 2007
@@ -24,7 +24,7 @@
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.apache.roller.planet.business.PlanetFactory;
import org.apache.roller.planet.business.PropertiesManager;
import org.apache.roller.planet.pojos.PropertyData;
@@ -111,7 +111,7 @@
pMgr.saveProperties(this.properties);
PlanetFactory.getPlanet().flush();
- } catch (RollerException e) {
+ } catch (PlanetException e) {
log.error(e);
setError("ConfigForm.error.saveFailed");
}
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetForm.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetForm.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetForm.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetForm.java Sun Jun 3 12:15:31 2007
@@ -21,7 +21,7 @@
import com.opensymphony.xwork2.Preparable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.apache.roller.planet.business.PlanetFactory;
import org.apache.roller.planet.business.PlanetManager;
import org.apache.roller.planet.pojos.PlanetData;
@@ -88,7 +88,7 @@
// need to set planetid attribute
setPlanetid(this.planet.getId());
- } catch (RollerException ex) {
+ } catch (PlanetException ex) {
log.error("Error saving planet ", ex);
setError("PlanetForm.error.saveFailed");
return INPUT;
@@ -121,7 +121,7 @@
setSuccess("PlanetForm.message.groupDeleteSucceeded", group.getHandle());
return INPUT;
- } catch (RollerException ex) {
+ } catch (PlanetException ex) {
log.error("Error deleting planet group", ex);
setError("PlanetForm.error.groupDeleteFailed", getGroupid());
return INPUT;
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetGroupForm.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetGroupForm.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetGroupForm.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetGroupForm.java Sun Jun 3 12:15:31 2007
@@ -21,7 +21,7 @@
import com.opensymphony.xwork2.Preparable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.apache.roller.planet.business.PlanetFactory;
import org.apache.roller.planet.business.PlanetManager;
import org.apache.roller.planet.pojos.PlanetData;
@@ -67,7 +67,7 @@
group = new PlanetGroupData();
group.setPlanet(planet);
} else {
- throw new RollerException("could not determine planet "+getPlanetid());
+ throw new PlanetException("could not determine planet "+getPlanetid());
}
}
}
@@ -91,7 +91,7 @@
// call setGroupid() just in case this was a new group with no id yet
setGroupid(this.group.getId());
- } catch (RollerException ex) {
+ } catch (PlanetException ex) {
log.error("Error saving planet group", ex);
setError("PlanetGroupForm.error.saveFailed");
return INPUT;
@@ -126,7 +126,7 @@
setError("PlanetGroupForm.error.subscriptionNull");
return INPUT;
- } catch (RollerException ex) {
+ } catch (PlanetException ex) {
log.error("Unable to lookup planet group", ex);
setError("PlanetGroupForm.error.subscriptionDeleteFailed", getSubid());
return INPUT;
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetSubscriptionForm.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetSubscriptionForm.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetSubscriptionForm.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/admin/struts2/PlanetSubscriptionForm.java Sun Jun 3 12:15:31 2007
@@ -21,7 +21,7 @@
import com.opensymphony.xwork2.Preparable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.apache.roller.planet.business.PlanetFactory;
import org.apache.roller.planet.business.PlanetManager;
import org.apache.roller.planet.pojos.PlanetGroupData;
@@ -106,7 +106,7 @@
// flush changes
PlanetFactory.getPlanet().flush();
- } catch (RollerException ex) {
+ } catch (PlanetException ex) {
log.error("Error saving subscription", ex);
setError("PlanetSubscriptionForm.error.saveFailed");
return INPUT;
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/core/PlanetContext.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/core/PlanetContext.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/core/PlanetContext.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/core/PlanetContext.java Sun Jun 3 12:15:31 2007
@@ -23,7 +23,7 @@
import javax.servlet.ServletContextListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
import org.apache.roller.planet.business.FeedFetcher;
import org.apache.roller.planet.business.Planet;
import org.apache.roller.planet.business.PlanetFactory;
@@ -130,7 +130,7 @@
PlanetFactory.getPlanet().setURLStrategy(urlStrategy);
}
- private void upgradeDatabaseIfNeeded() throws RollerException {
+ private void upgradeDatabaseIfNeeded() throws PlanetException {
// try {
// Connection con = // get connection somehow
Modified: roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/RenderingException.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/RenderingException.java?view=diff&rev=543966&r1=543965&r2=543966
==============================================================================
--- roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/RenderingException.java (original)
+++ roller/trunk/apps/planet/src/java/org/apache/roller/planet/ui/rendering/RenderingException.java Sun Jun 3 12:15:31 2007
@@ -18,13 +18,13 @@
package org.apache.roller.planet.ui.rendering;
-import org.apache.roller.RollerException;
+import org.apache.roller.planet.PlanetException;
/**
* A generic Roller rendering exception.
*/
-public class RenderingException extends RollerException {
+public class RenderingException extends PlanetException {
public RenderingException(String s) {
super(s);