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 2007/02/07 18:15:17 UTC
svn commit: r504622 [2/2] - in /incubator/roller/branches/roller_4.0: ./
apps/planet/ apps/planet/nbproject/ apps/planet/src/java/org/apache/roller/
apps/planet/src/java/org/apache/roller/planet/business/datamapper/
apps/planet/src/java/org/apache/roll...
Added: incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/hibernate/ThreadLocalSessionContextNoAutoClose.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/hibernate/ThreadLocalSessionContextNoAutoClose.java?view=auto&rev=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/hibernate/ThreadLocalSessionContextNoAutoClose.java (added)
+++ incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/hibernate/ThreadLocalSessionContextNoAutoClose.java Wed Feb 7 09:15:02 2007
@@ -0,0 +1,130 @@
+/*
+ * 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.business.hibernate;
+
+import org.hibernate.FlushMode;
+import org.hibernate.SessionFactory;
+import org.hibernate.classic.Session;
+import org.hibernate.context.ThreadLocalSessionContext;
+import org.hibernate.engine.SessionFactoryImplementor;
+
+
+/**
+ * This is a special Hibernate SessionContext which was taken from the Hibernate forums so that we can use it
+ * to provide a way to commit our transactions while keeping the Session open for further use. Details here ...
+ *
+ * http://forum.hibernate.org/viewtopic.php?t=958752
+ *
+ * ... which was found from a reference here ...
+ *
+ * http://forum.hibernate.org/viewtopic.php?t=957056
+ *
+ * Extends {@link ThreadLocalSessionContext} to allow for long conversations. It achieves this by setting every
+ * <code>Session</code> it produces to <code>FlushMode.NEVER</code> so that it won't flush unless explicitly asked
+ * to, and by preventing the session from auto-closing or unbinding from the thread after a <code>Transaction</code>
+ * commit. Note that this means the application code must do these functions manually as needed!
+ */
+public class ThreadLocalSessionContextNoAutoClose extends ThreadLocalSessionContext {
+
+ /**
+ * Create a new instance.
+ *
+ * @param factory The <code>SessionFactoryImplementor</code> required by the super constructor.
+ */
+ public ThreadLocalSessionContextNoAutoClose(SessionFactoryImplementor factory) {
+ super(factory);
+ }
+
+
+ /**
+ * Returns <code>false</code> to prevent auto closing.
+ *
+ * @return <code>false</code> to prevent auto closing.
+ */
+ protected boolean isAutoCloseEnabled() {
+ return false;
+ }
+
+
+ /**
+ * Returns <code>false</code> to prevent auto flushing.
+ *
+ * @return <code>false</code> to prevent auto flushing.
+ */
+ protected boolean isAutoFlushEnabled() {
+ return false;
+ }
+
+
+ /**
+ * Uses <code>super.buildOrObtainSession()</code>, then sets the resulting <code>Session</code>'s flush mode
+ * to <code>FlushMode.NEVER</code> to prevent auto-flushing.
+ *
+ * @return A session configured with <code>FlushMode.NEVER</code>.
+ */
+ protected Session buildOrObtainSession() {
+ Session s = super.buildOrObtainSession();
+ s.setFlushMode(FlushMode.NEVER);
+ return s;
+ }
+
+
+ /**
+ * Returns an instance of <code>CleanupSynch</code> which prevents auto closing and unbinding.
+ *
+ * @return A <code>CleanupSynch</code> which prevents auto closing and unbinding.
+ */
+ protected CleanupSynch buildCleanupSynch() {
+ return new NoCleanupSynch(factory);
+ }
+
+
+ /**
+ * A simple extension of <code>CleanupSynch</code> that prevents any cleanup from happening. No session closing or
+ * unbinding.
+ */
+ private static class NoCleanupSynch extends ThreadLocalSessionContext.CleanupSynch {
+
+ /**
+ * Creates a new instance based on the given factory.
+ *
+ * @param factory The required <code>SessionFactory</code> that is passed to the super constructor.
+ */
+ public NoCleanupSynch(SessionFactory factory) {
+ super(factory);
+ }
+
+ /**
+ * Does nothing, thus helping to prevent session closing and/or unbinding.
+ */
+ public void beforeCompletion() {
+ // do nothing
+ }
+
+ /**
+ * Does nothing, thus helping to prevent session closing and/or unbinding.
+ *
+ * @param i
+ */
+ public void afterCompletion(int i) {
+ // do nothing
+ }
+ }
+
+}
Added: incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPADynamicQueryImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPADynamicQueryImpl.java?view=auto&rev=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPADynamicQueryImpl.java (added)
+++ incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPADynamicQueryImpl.java Wed Feb 7 09:15:02 2007
@@ -0,0 +1,44 @@
+/*
+ * 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.business.jpa;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import org.apache.roller.business.jpa.*;
+
+/**
+ *
+ */
+public class JPADynamicQueryImpl extends JPAQueryImpl {
+
+ /**
+ * Creates a new instance of JPADynamicQueryImpl
+ */
+ public JPADynamicQueryImpl(EntityManager em, String queryString) {
+ super(em, queryString);
+ }
+
+ /**
+ * Create a Query for this instance
+ */
+ protected Query createQuery(String queryString) {
+ return em.createQuery(queryString);
+ }
+}
Added: incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPANamedQueryImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPANamedQueryImpl.java?view=auto&rev=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPANamedQueryImpl.java (added)
+++ incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPANamedQueryImpl.java Wed Feb 7 09:15:02 2007
@@ -0,0 +1,44 @@
+/*
+ * 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.business.jpa;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import org.apache.roller.business.jpa.*;
+
+/**
+ *
+ */
+public class JPANamedQueryImpl extends JPAQueryImpl {
+
+ /**
+ * Creates a new instance of JPANamedQueryImpl
+ */
+ public JPANamedQueryImpl(EntityManager em, String queryName) {
+ super(em, queryName);
+ }
+
+ /**
+ * Create a Query for this instance
+ */
+ protected Query createQuery(String queryName) {
+ return em.createNamedQuery(queryName);
+ }
+}
Added: incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPAPersistenceStrategy.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPAPersistenceStrategy.java?view=auto&rev=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPAPersistenceStrategy.java (added)
+++ incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPAPersistenceStrategy.java Wed Feb 7 09:15:02 2007
@@ -0,0 +1,327 @@
+
+/*
+ * 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.business.jpa;
+
+import java.util.Collection;
+import java.util.Properties;
+import java.util.Iterator;
+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.RollerException;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityManager;
+import javax.persistence.Persistence;
+import javax.persistence.PersistenceException;
+import org.apache.roller.business.datamapper.DatamapperPersistenceStrategy;
+import org.apache.roller.business.datamapper.DatamapperQuery;
+import org.apache.roller.business.datamapper.DatamapperRemoveQuery;
+
+/**
+ * JPAPersistenceStrategy is responsible for the lowest-level interaction with
+ * the JPA API.
+ */
+// TODO handle PersistenceExceptions!
+public class JPAPersistenceStrategy implements DatamapperPersistenceStrategy {
+
+ /**
+ * The thread local EntityManager.
+ */
+ private static 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.RollerException on any error
+ */
+ public JPAPersistenceStrategy(String puName) throws RollerException {
+ Properties emfProps = loadPropertiesFromResourceName(
+ "JPAEMF.properties", getContextClassLoader());
+ try {
+ this.emf =
+ Persistence.createEntityManagerFactory(puName, emfProps);
+ } catch (PersistenceException pe) {
+ throw new RollerException(pe);
+ }
+ }
+
+ /**
+ * Flush changes to the datastore, commit transaction, release em.
+ * @throws org.apache.roller.RollerException on any error
+ */
+ public void flush() throws RollerException {
+ try {
+ EntityManager em = getEntityManager(true);
+ em.getTransaction().commit();
+ } catch (PersistenceException pe) {
+ throw new RollerException(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.RollerException on any error
+ */
+ public Object store(Object obj) throws RollerException {
+ 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 RollerException on any error deleting object
+ */
+ public void remove(Class clazz, String id) throws RollerException {
+ 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.RollerException on any error
+ */
+ public void remove(Object po) throws RollerException {
+ EntityManager em = getEntityManager(true);
+ em.remove(po);
+ }
+
+ /**
+ * Remove object from persistence storage.
+ * @param pos the persistent objects to remove
+ * @throws org.apache.roller.RollerException on any error
+ */
+ public void removeAll(Collection pos) throws RollerException {
+ EntityManager em = getEntityManager(true);
+ for (Iterator iterator = pos.iterator(); iterator.hasNext();) {
+ Object obj = iterator.next();
+ em.remove(obj);
+ }
+ }
+
+ /**
+ * Remove objects from persistence storage.
+ * @param clazz the persistent from which to remove all objects
+ * @throws org.apache.roller.RollerException on any error
+ */
+ public void removeAll(Class clazz) throws RollerException {
+ // The only caller of this method is DatamapperAutoPingManagerImpl@removeAllAutoPings()
+ // Discuss with Craig to remove this method from interface
+
+ //Derive name of entity from class name
+ String fullyQualifiedClassName = clazz.getName();
+ int indexOfLastDot = fullyQualifiedClassName.lastIndexOf('.');
+ String className = fullyQualifiedClassName.substring(indexOfLastDot + 1);
+ String queryName = className + ".removeAll";
+ DatamapperRemoveQuery rq = newRemoveQuery(clazz, queryName);
+ rq.removeAll();
+ }
+
+ /**
+ * 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 RollerException on any error retrieving object
+ */
+ public Object load(Class clazz, String id)
+ throws RollerException {
+ 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);
+ }
+
+ /**
+ * Create query.
+ * @param clazz the class of instances to find
+ * @param queryName the name of the query
+ * @throws org.apache.roller.RollerException on any error
+ */
+ public DatamapperQuery newQuery(Class clazz, String queryName)
+ throws RollerException {
+ EntityManager em = getEntityManager(false);
+ return new JPANamedQueryImpl(em, queryName);
+ }
+
+ /**
+ * Create query used for bulk remove operations.
+ * @param clazz the class of instances to remove
+ * @param queryName the name of the query
+ * @throws org.apache.roller.RollerException on any error
+ */
+ public DatamapperRemoveQuery newRemoveQuery(Class clazz, String queryName)
+ throws RollerException {
+ EntityManager em = getEntityManager(true);
+ return new JPARemoveQueryImpl(em, clazz, queryName);
+ }
+
+ /**
+ * Create query used for bulk update operations.
+ * @param queryName the name of the query
+ * @throws org.apache.roller.RollerException on any error
+ */
+ public JPAUpdateQuery newUpdateQuery(String queryName)
+ throws RollerException {
+ EntityManager em = getEntityManager(true);
+ return new JPAUpdateQuery(em, queryName);
+ }
+
+ /**
+ * Create query from queryString
+ * @param queryString the quuery
+ * @throws org.apache.roller.RollerException on any error
+ */
+ public DatamapperQuery newDynamicQuery(String queryString)
+ throws RollerException {
+ EntityManager em = getEntityManager(false);
+ return new JPADynamicQueryImpl(em, queryString);
+ }
+
+
+ /**
+ * 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 RollerException
+ */
+ private static Properties loadPropertiesFromResourceName(
+ String resourceName, ClassLoader cl) throws RollerException {
+ Properties props = new Properties();
+ InputStream in = null;
+ in = cl.getResourceAsStream(resourceName);
+ if (in == null) {
+ //TODO: Check how i18n is done in roller
+ throw new RollerException(
+ "Could not locate properties to load " + resourceName);
+ }
+ try {
+ props.load(in);
+ } catch (IOException ioe) {
+ throw new RollerException(
+ "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();
+ }
+ });
+ }
+}
+
Added: incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPAQueryImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPAQueryImpl.java?view=auto&rev=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPAQueryImpl.java (added)
+++ incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPAQueryImpl.java Wed Feb 7 09:15:02 2007
@@ -0,0 +1,112 @@
+
+/*
+ * 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.business.jpa;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import javax.persistence.NoResultException;
+import javax.persistence.FlushModeType;
+
+import org.apache.roller.business.datamapper.DatamapperQuery;
+
+/**
+ *
+ */
+public abstract class JPAQueryImpl implements DatamapperQuery {
+
+ /** */
+ protected EntityManager em;
+
+ /** */
+ protected Query q;
+
+ private boolean singleResult = false;
+
+ /**
+ * Creates a new instance of JPAQueryImpl
+ */
+ protected JPAQueryImpl(EntityManager em, String arg) {
+ this.em = em;
+ q = createQuery(arg);
+ }
+
+ /**
+ * Create a Query for this instance.
+ * @param arg Can be the name of a named query or the actual query string
+ * for a dynamic query.
+ * @return Query object
+ */
+ protected abstract Query createQuery(String arg);
+
+ public Object execute() {
+ return executeQuery();
+ }
+
+ public Object execute(Object param) {
+ q.setParameter(1, param);
+ return executeQuery();
+ }
+
+ public Object execute(Object[] params) {
+ for (int i = 0; i < params.length ; i++) {
+ q.setParameter(i + 1, params[i]);
+ }
+ return executeQuery();
+ }
+
+ public DatamapperQuery setUnique() {
+ singleResult = true;
+ return this;
+ }
+
+ public DatamapperQuery setTypes(Object[] types) {
+ //TODO: Craig, a more natural fit is to pass types also with execute
+ return this;
+ }
+
+ public DatamapperQuery setRange(long fromIncl, long toExcl) {
+ //TODO: JPA takes these as int :(.
+ q.setFirstResult((int) fromIncl);
+ q.setMaxResults((int) toExcl);
+ return this;
+ }
+
+ /**
+ * Helper that calls q.getSingleResult vs. q.getResultList depending on
+ * value of singleResult.
+ */
+ private Object executeQuery() {
+ Object result = null;
+ //Never flush for queries. Roller code assumes this behavior
+ q.setFlushMode(FlushModeType.COMMIT);
+ if (singleResult) {
+ try {
+ result = q.getSingleResult();
+ } catch (NoResultException e) {
+ // Roller code expects a null for this condition
+ result = null;
+ }
+ } else {
+ result = q.getResultList();
+ }
+ return result;
+ }
+
+}
Added: incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPARemoveQueryImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPARemoveQueryImpl.java?view=auto&rev=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPARemoveQueryImpl.java (added)
+++ incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPARemoveQueryImpl.java Wed Feb 7 09:15:02 2007
@@ -0,0 +1,67 @@
+
+/*
+ * 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.business.jpa;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.roller.business.datamapper.DatamapperRemoveQuery;
+import org.apache.roller.business.jpa.*;
+
+/**
+ *
+ */
+public class JPARemoveQueryImpl implements DatamapperRemoveQuery {
+
+ /** */
+ protected EntityManager em;
+
+ /** */
+ protected Query q;
+
+ /**
+ * Creates a new instance of JPAQueryImpl
+ */
+ public JPARemoveQueryImpl(EntityManager em, Class clazz, String queryName) {
+ this.em = em;
+ q = em.createNamedQuery(queryName);
+ }
+
+ public void removeAll() {
+ q.executeUpdate();
+ }
+
+ public void removeAll(Object param) {
+ q.setParameter(1, param);
+ q.executeUpdate();
+ }
+
+ public void removeAll(Object[] params) {
+ for (int i = 0; i < params.length ; i++) {
+ q.setParameter(i + 1, params[i]);
+ }
+ q.executeUpdate();
+ }
+
+ public DatamapperRemoveQuery setTypes(Object[] types) {
+ return this;
+ }
+
+}
Added: incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPAUpdateQuery.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPAUpdateQuery.java?view=auto&rev=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPAUpdateQuery.java (added)
+++ incubator/roller/branches/roller_4.0/components/core/src/java/org/apache/roller/business/jpa/JPAUpdateQuery.java Wed Feb 7 09:15:02 2007
@@ -0,0 +1,59 @@
+/*
+ * 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.business.jpa;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import org.apache.roller.business.jpa.*;
+
+/**
+ * @author Mitesh Meswani
+ */
+public class JPAUpdateQuery {
+
+ protected EntityManager em;
+
+ protected Query q;
+
+ /**
+ * Creates a new instance of JPAQueryImpl
+ */
+ public JPAUpdateQuery(EntityManager em, String queryName) {
+ this.em = em;
+ q = em.createNamedQuery(queryName);
+ }
+
+ public int updateAll() {
+ return q.executeUpdate();
+ }
+
+ public int updateAll(Object param) {
+ q.setParameter(1, param);
+ return q.executeUpdate();
+ }
+
+ public int updateAll(Object[] params) {
+ for (int i = 0; i < params.length ; i++) {
+ q.setParameter(i + 1, params[i]);
+ }
+ return q.executeUpdate();
+ }
+
+}
Modified: incubator/roller/branches/roller_4.0/metadata/database/3xx-to-400-migration.vm
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/metadata/database/3xx-to-400-migration.vm?view=diff&rev=504622&r1=504621&r2=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/metadata/database/3xx-to-400-migration.vm (original)
+++ incubator/roller/branches/roller_4.0/metadata/database/3xx-to-400-migration.vm Wed Feb 7 09:15:02 2007
@@ -4,6 +4,13 @@
DON'T RUN THIS, IT'S NOT A DATABASE CREATION SCRIPT!!!
**#
+-- id creation needed for JPA backend
+create table roller_id_table (
+ pk int not null primary key,
+ value int not null
+);
+insert into roller_id_table (pk, value) values (1, 0);
+
-- remove old id column of group subscription table
alter table rag_group_subscription drop column id;
Modified: incubator/roller/branches/roller_4.0/metadata/database/createdb.vm
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/metadata/database/createdb.vm?view=diff&rev=504622&r1=504621&r2=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/metadata/database/createdb.vm (original)
+++ incubator/roller/branches/roller_4.0/metadata/database/createdb.vm Wed Feb 7 09:15:02 2007
@@ -9,6 +9,12 @@
-- *****************************************************
-- Create the tables and indices
+create table roller_id_table (
+ pk int not null primary key,
+ value int not null
+);
+insert into roller_id_table (pk, value) values (1, 0);
+
create table rolleruser (
id varchar(48) not null primary key,
username varchar(255) not null,
Modified: incubator/roller/branches/roller_4.0/nbproject/project.xml
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/nbproject/project.xml?view=diff&rev=504622&r1=504621&r2=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/nbproject/project.xml (original)
+++ incubator/roller/branches/roller_4.0/nbproject/project.xml Wed Feb 7 09:15:02 2007
@@ -4,14 +4,7 @@
<configuration>
<general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
<!--Do not use Project Properties customizer when editing this file manually.-->
- <name>roller_trunk</name>
- <!--
- <properties>
- <property name="src.dir">../src</property>
- <property name="test.dir">${project.dir}/tests</property>
- <property name="planetroller.test.dir">${project.dir}/sandbox/planetroller/test</property>
- </properties>
--->
+ <name>roller_4.0</name>
<folders>
<source-folder>
<label>web</label>
@@ -24,49 +17,24 @@
<location>src</location>
</source-folder>
<source-folder>
- <label>sandbox/standalone/src</label>
+ <label>components/core/src/java</label>
<type>java</type>
- <location>sandbox/standalone/src</location>
+ <location>components/core/src/java</location>
</source-folder>
<source-folder>
- <label>contrib/plugins/src</label>
- <type>java</type>
- <location>contrib/plugins/src</location>
- </source-folder>
- <source-folder>
- <label>tests</label>
- <type>java</type>
- <location>tests</location>
- </source-folder>
- <source-folder>
- <label>generated/web</label>
- <type>java</type>
- <location>build/generated/web</location>
- </source-folder>
- <source-folder>
- <label>generated/business</label>
+ <label>build/generated/business</label>
<type>java</type>
<location>build/generated/business</location>
</source-folder>
<source-folder>
- <label>sandbox/scripting/src</label>
- <type>java</type>
- <location>sandbox/scripting/src</location>
- </source-folder>
- <source-folder>
- <label>apps/planet/src/java</label>
- <type>java</type>
- <location>apps/planet/src/java</location>
- </source-folder>
- <source-folder>
- <label>apps/planet/test/java</label>
+ <label>build/generated/web</label>
<type>java</type>
- <location>apps/planet/test/java</location>
+ <location>build/generated/web</location>
</source-folder>
<source-folder>
- <label>sandbox/jdobackend/src</label>
+ <label>tests</label>
<type>java</type>
- <location>sandbox/jdobackend/src</location>
+ <location>tests</location>
</source-folder>
</folders>
<ide-actions>
@@ -128,40 +96,20 @@
<location>src</location>
</source-folder>
<source-folder style="packages">
- <label>sandbox/standalone/src</label>
- <location>sandbox/standalone/src</location>
+ <label>components/core/src/java</label>
+ <location>components/core/src/java</location>
</source-folder>
<source-folder style="packages">
- <label>contrib/plugins/src</label>
- <location>contrib/plugins/src</location>
- </source-folder>
- <source-folder style="packages">
- <label>tests</label>
- <location>tests</location>
- </source-folder>
- <source-folder style="packages">
- <label>generated/web</label>
- <location>build/generated/web</location>
- </source-folder>
- <source-folder style="packages">
- <label>generated/business</label>
+ <label>build/generated/business</label>
<location>build/generated/business</location>
</source-folder>
<source-folder style="packages">
- <label>sandbox/scripting/src</label>
- <location>sandbox/scripting/src</location>
- </source-folder>
- <source-folder style="packages">
- <label>apps/planet/src/java</label>
- <location>apps/planet/src/java</location>
- </source-folder>
- <source-folder style="packages">
- <label>apps/planet/test/java</label>
- <location>apps/planet/test/java</location>
+ <label>build/generated/web</label>
+ <location>build/generated/web</location>
</source-folder>
<source-folder style="packages">
- <label>sandbox/jdobackend/src</label>
- <location>sandbox/jdobackend/src</location>
+ <label>tests</label>
+ <location>tests</location>
</source-folder>
<source-file>
<location>build.xml</location>
@@ -180,18 +128,13 @@
</general-data>
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
<compilation-unit>
+ <package-root>components/core/src/java</package-root>
<package-root>src</package-root>
- <package-root>sandbox/standalone/src</package-root>
- <package-root>contrib/plugins/src</package-root>
- <package-root>tests</package-root>
- <package-root>build/generated/web</package-root>
<package-root>build/generated/business</package-root>
- <package-root>sandbox/scripting/src</package-root>
- <package-root>apps/planet/src/java</package-root>
- <package-root>apps/planet/test/java</package-root>
- <package-root>sandbox/jdobackend/src</package-root>
- <classpath mode="compile">tools/buildtime/junit-3.8.1.jar:tools/lib/commons-betwixt-1.0-beta-1.jar:tools/lib/commons-httpclient-2.0.2.jar:tools/lib/concurrent-1.3.2.jar:tools/lib/ekitapplet.jar:tools/lib/jazzy-core.jar:tools/lib/log4j-1.2.4.jar:tools/lib/lucene-1.4.3.jar:tools/lib/taglibs-string.jar:tools/lib/velocity-1.4.jar:tools/lib/velocity-dep-1.4.jar:tools/lib/velocity-tools-1.1.jar:tools/lib/xmlrpc-1.2-b1.jar:tools/struts-1.2.4/lib/antlr.jar:tools/struts-1.2.4/lib/commons-beanutils.jar:tools/struts-1.2.4/lib/commons-collections.jar:tools/struts-1.2.4/lib/commons-digester.jar:tools/struts-1.2.4/lib/commons-fileupload.jar:tools/struts-1.2.4/lib/commons-lang-2.0.jar:tools/struts-1.2.4/lib/commons-logging.jar:tools/struts-1.2.4/lib/commons-validator.jar:tools/struts-1.2.4/lib/jakarta-oro.jar:tools/struts-1.2.4/lib/struts-el.jar:tools/struts-1.2.4/lib/struts.jar:tools/buildtime/mockrunner-0.35/lib/mockrunner-servlet.jar:tools/buildtime/mockrunner-0.35/lib/m
ockrunner-struts.jar:tools/buildtime/mockrunner-0.35/lib/mockrunner.jar:tools/buildtime/mockrunner-0.35/lib/nekohtml.jar:tools/standard-1.0.3/lib/jaxen-full.jar:tools/standard-1.0.3/lib/jstl.jar:tools/standard-1.0.3/lib/standard.jar:tools/buildtime/tomcat-5.0.28/servlet-api.jar:tools/buildtime/tomcat-5.0.28/jsp-api.jar:tools/lib/jdom.jar:tools/spring-1.2/acegi-security-0.9.0.jar:tools/spring-1.2/spring.jar:tools/lib/rome-0.8.jar:tools/lib/rome-fetcher-0.8.jar:tools/lib/commons-codec-1.3.jar:tools/hibernate-3.1/hibernate3.jar:contrib/lib/textile4j-1.20.jar:tools/buildtime/derby.jar:tools/buildtime/ant-1.6.2/ant.jar:tools/buildtime/derbynet.jar:tools/lib/rome-0.9.jar:tools/lib/rome-fetcher-0.9.jar:tools/buildtime/activation.jar:tools/buildtime/mail.jar:tools/spring-1.2/acegi-security-1.0.1.jar:tools/spring-1.2/spring.jar</classpath>
- <source-level>1.4</source-level>
+ <package-root>build/generated/web</package-root>
+ <package-root>tests</package-root>
+ <classpath mode="compile">tools/lib/commons-betwixt-1.0-beta-1.jar:tools/lib/commons-codec-1.3.jar:tools/lib/commons-httpclient-2.0.2.jar:tools/lib/concurrent-1.3.2.jar:tools/lib/jaxen-full.jar:tools/lib/jdom.jar:tools/lib/log4j-1.2.11.jar:tools/lib/lucene-1.4.3.jar:tools/lib/rome-0.9.jar:tools/lib/rome-fetcher-0.9.jar:tools/lib/saxpath.jar:tools/lib/taglibs-string.jar:tools/lib/velocity-1.4.jar:tools/lib/velocity-dep-1.4.jar:tools/lib/xmlrpc-1.2-b1.jar:tools/hibernate-3.1/hibernate3.jar:tools/hibernate-3.1/lib/asm-attrs.jar:tools/hibernate-3.1/lib/asm.jar:tools/hibernate-3.1/lib/cglib-2.1.3.jar:tools/hibernate-3.1/lib/dom4j-1.6.1.jar:tools/hibernate-3.1/lib/ehcache-1.1.jar:tools/hibernate-3.1/lib/jdbc2_0-stdext.jar:tools/hibernate-3.1/lib/jta.jar:tools/spring-1.2/acegi-security-1.0.1.jar:tools/spring-1.2/spring.jar:tools/struts-1.2.4/lib/antlr.jar:tools/struts-1.2.4/lib/commons-beanutils.jar:tools/struts-1.2.4/lib/commons-collections.jar:tools/struts-1.2.4/l
ib/commons-digester.jar:tools/struts-1.2.4/lib/commons-fileupload.jar:tools/struts-1.2.4/lib/commons-lang-2.0.jar:tools/struts-1.2.4/lib/commons-logging.jar:tools/struts-1.2.4/lib/commons-validator.jar:tools/struts-1.2.4/lib/jakarta-oro.jar:tools/struts-1.2.4/lib/struts-el.jar:tools/struts-1.2.4/lib/struts.jar:tools/jpa/toplink-essentials.jar</classpath>
+ <source-level>1.5</source-level>
</compilation-unit>
</java-data>
<web-data xmlns="http://www.netbeans.org/ns/freeform-project-web/1">
Modified: incubator/roller/branches/roller_4.0/properties.xmlf
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/properties.xmlf?view=diff&rev=504622&r1=504621&r2=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/properties.xmlf (original)
+++ incubator/roller/branches/roller_4.0/properties.xmlf Wed Feb 7 09:15:02 2007
@@ -54,6 +54,7 @@
<!-- various libraries used by Roller -->
<property name="tools.struts" value="${ro.tools}/struts-1.2.4" />
<property name="tools.hibernate" value="${ro.tools}/hibernate-3.1" />
+<property name="tools.jpa" value="${ro.tools}/jpa" />
<property name="tools.spring" value="${ro.tools}/spring-1.2" />
<property name="tools.jstl" value="${ro.tools}/jakarta-taglibs-standard-1.1.2" />
<property name="tools.xdoclet" value="${ro.tools}/buildtime/xdoclet-1.2.3" />
@@ -132,6 +133,10 @@
<include name="hibernate3.jar"/>
</fileset>
+<fileset id="jpa.jars" dir="${tools.jpa}/lib">
+ <include name="*.jar"/>
+</fileset>
+
<fileset id="hibernate.jars" dir="${tools.hibernate}/lib">
<include name="*.jar"/>
</fileset>
@@ -140,6 +145,10 @@
<include name="*.jar"/>
</fileset>
+<fileset id="roller-core.jars" dir="${ro.tools}/roller-core">
+ <include name="*.jar"/>
+</fileset>
+
<fileset id="roller-planet.jars" dir="${ro.tools}/roller-planet">
<include name="*.jar"/>
</fileset>
@@ -153,6 +162,7 @@
<fileset refid="base.jars"/>
<fileset refid="mail.jars"/>
<fileset refid="commons.jars"/>
+ <fileset refid="roller-core.jars" />
<fileset refid="roller-planet.jars" />
</path>
Modified: incubator/roller/branches/roller_4.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPlanetImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPlanetImpl.java?view=diff&rev=504622&r1=504621&r2=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPlanetImpl.java (original)
+++ incubator/roller/branches/roller_4.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPlanetImpl.java Wed Feb 7 09:15:02 2007
@@ -23,6 +23,8 @@
import org.apache.roller.RollerException;
import org.apache.roller.planet.business.Planet;
import org.apache.roller.planet.business.PlanetManager;
+import org.apache.roller.planet.business.datamapper.DatamapperPlanetImpl;
+import org.apache.roller.planet.business.datamapper.DatamapperPlanetManagerImpl;
/**
* A Datamapper specific implementation of the Roller business layer.
Modified: incubator/roller/branches/roller_4.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPlanetManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPlanetManagerImpl.java?view=diff&rev=504622&r1=504621&r2=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPlanetManagerImpl.java (original)
+++ incubator/roller/branches/roller_4.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPlanetManagerImpl.java Wed Feb 7 09:15:02 2007
@@ -44,6 +44,7 @@
import org.apache.roller.RollerException;
import org.apache.roller.planet.business.PlanetManager;
+import org.apache.roller.planet.business.datamapper.DatamapperPlanetManagerImpl;
import org.apache.roller.planet.pojos.PlanetConfigData;
import org.apache.roller.planet.pojos.PlanetEntryData;
import org.apache.roller.planet.pojos.PlanetGroupData;
Modified: incubator/roller/branches/roller_4.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperRollerPlanetManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperRollerPlanetManagerImpl.java?view=diff&rev=504622&r1=504621&r2=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperRollerPlanetManagerImpl.java (original)
+++ incubator/roller/branches/roller_4.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperRollerPlanetManagerImpl.java Wed Feb 7 09:15:02 2007
@@ -40,6 +40,7 @@
import org.apache.roller.business.UserManager;
import org.apache.roller.business.WeblogManager;
import org.apache.roller.config.RollerRuntimeConfig;
+import org.apache.roller.planet.business.datamapper.DatamapperPlanetManagerImpl;
import org.apache.roller.planet.pojos.PlanetEntryData;
import org.apache.roller.planet.pojos.PlanetSubscriptionData;
import org.apache.roller.pojos.WeblogEntryData;
Modified: incubator/roller/branches/roller_4.0/sandbox/jdobackend/src/org/apache/roller/business/jpa/JPAPlanetImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/sandbox/jdobackend/src/org/apache/roller/business/jpa/JPAPlanetImpl.java?view=diff&rev=504622&r1=504621&r2=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/sandbox/jdobackend/src/org/apache/roller/business/jpa/JPAPlanetImpl.java (original)
+++ incubator/roller/branches/roller_4.0/sandbox/jdobackend/src/org/apache/roller/business/jpa/JPAPlanetImpl.java Wed Feb 7 09:15:02 2007
@@ -21,10 +21,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.roller.RollerException;
-import org.apache.roller.business.datamapper.DatamapperPlanetImpl;
-import org.apache.roller.business.datamapper.DatamapperPlanetManagerImpl;
+import org.apache.roller.planet.business.datamapper.DatamapperPlanetImpl;
+import org.apache.roller.planet.business.datamapper.DatamapperPlanetManagerImpl;
import org.apache.roller.planet.business.Planet;
import org.apache.roller.planet.business.PlanetManager;
+import org.apache.roller.planet.business.jpa.JPAPlanetImpl;
/**
* Implements Planet, the entry point interface for the Roller-Planet business
Modified: incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperAutoPingManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperAutoPingManagerImpl.java?view=diff&rev=504622&r1=504168&r2=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperAutoPingManagerImpl.java (original)
+++ incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperAutoPingManagerImpl.java Wed Feb 7 09:15:02 2007
@@ -29,6 +29,7 @@
import org.apache.roller.pojos.PingTargetData;
import org.apache.roller.pojos.WeblogEntryData;
import org.apache.roller.pojos.WebsiteData;
+import org.apache.roller.business.datamapper.DatamapperPersistenceStrategy;
import java.util.Collection;
import java.util.Collections;
Modified: incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperBookmarkManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperBookmarkManagerImpl.java?view=diff&rev=504622&r1=504168&r2=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperBookmarkManagerImpl.java (original)
+++ incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperBookmarkManagerImpl.java Wed Feb 7 09:15:02 2007
@@ -20,7 +20,6 @@
import java.io.StringReader;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import org.apache.commons.logging.Log;
@@ -28,17 +27,12 @@
import org.apache.roller.RollerException;
import org.apache.roller.business.BookmarkManager;
import org.apache.roller.business.RollerFactory;
-import org.apache.roller.business.hibernate.HibernatePersistenceStrategy;
import org.apache.roller.pojos.BookmarkData;
import org.apache.roller.pojos.FolderData;
import org.apache.roller.pojos.WebsiteData;
-import org.apache.roller.util.Utilities;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.input.SAXBuilder;
-import org.hibernate.Session;
-import org.hibernate.Criteria;
-import org.hibernate.criterion.Expression;
/*
* DatamapperBookmarkManagerImpl.java
Modified: incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperPingQueueManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperPingQueueManagerImpl.java?view=diff&rev=504622&r1=504168&r2=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperPingQueueManagerImpl.java (original)
+++ incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperPingQueueManagerImpl.java Wed Feb 7 09:15:02 2007
@@ -29,6 +29,8 @@
import org.apache.roller.business.pings.PingQueueManager;
import org.apache.roller.pojos.AutoPingData;
import org.apache.roller.pojos.PingQueueEntryData;
+import org.apache.roller.business.datamapper.DatamapperPersistenceStrategy;
+
/*
* DatamapperPingQueueManagerImpl.java
Modified: incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperPropertiesManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperPropertiesManagerImpl.java?view=diff&rev=504622&r1=504168&r2=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperPropertiesManagerImpl.java (original)
+++ incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperPropertiesManagerImpl.java Wed Feb 7 09:15:02 2007
@@ -38,6 +38,8 @@
import org.apache.roller.config.runtime.RuntimeConfigDefs;
import org.apache.roller.pojos.RollerConfigData;
import org.apache.roller.pojos.RollerPropertyData;
+import org.apache.roller.business.datamapper.DatamapperPersistenceStrategy;
+
/*
* DatamapperPropertiesManagerImpl.java
Modified: incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperRollerPlanetManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperRollerPlanetManagerImpl.java?view=diff&rev=504622&r1=504168&r2=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperRollerPlanetManagerImpl.java (original)
+++ incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperRollerPlanetManagerImpl.java Wed Feb 7 09:15:02 2007
@@ -40,6 +40,7 @@
import org.apache.roller.business.UserManager;
import org.apache.roller.business.WeblogManager;
import org.apache.roller.config.RollerRuntimeConfig;
+import org.apache.roller.planet.business.datamapper.DatamapperPlanetManagerImpl;
import org.apache.roller.planet.pojos.PlanetEntryData;
import org.apache.roller.planet.pojos.PlanetSubscriptionData;
import org.apache.roller.pojos.WeblogEntryData;
Modified: incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperWeblogManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperWeblogManagerImpl.java?view=diff&rev=504622&r1=504168&r2=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperWeblogManagerImpl.java (original)
+++ incubator/roller/branches/roller_4.0/src/org/apache/roller/business/datamapper/DatamapperWeblogManagerImpl.java Wed Feb 7 09:15:02 2007
@@ -37,7 +37,6 @@
import org.apache.roller.RollerException;
import org.apache.roller.business.RollerFactory;
-import org.apache.roller.business.WeblogManager;
import org.apache.roller.business.WeblogManagerImpl;
import org.apache.roller.pojos.CommentData;
import org.apache.roller.pojos.HitCountData;
Modified: incubator/roller/branches/roller_4.0/src/org/apache/roller/business/jpa/JPARollerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/src/org/apache/roller/business/jpa/JPARollerImpl.java?view=diff&rev=504622&r1=504168&r2=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/src/org/apache/roller/business/jpa/JPARollerImpl.java (original)
+++ incubator/roller/branches/roller_4.0/src/org/apache/roller/business/jpa/JPARollerImpl.java Wed Feb 7 09:15:02 2007
@@ -47,7 +47,7 @@
*/
protected JPARollerImpl() throws RollerException {
// set strategy used by Datamapper
- strategy = new JPAPersistenceStrategy();
+ strategy = new JPAPersistenceStrategy("RollerPU");
}
protected UserManager createDatamapperUserManager(DatamapperPersistenceStrategy strategy) {
Modified: incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/business/hibernate/HibernateRollerPlanetImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/business/hibernate/HibernateRollerPlanetImpl.java?view=diff&rev=504622&r1=504621&r2=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/business/hibernate/HibernateRollerPlanetImpl.java (original)
+++ incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/business/hibernate/HibernateRollerPlanetImpl.java Wed Feb 7 09:15:02 2007
@@ -25,7 +25,7 @@
import org.apache.roller.planet.config.PlanetConfig;
import org.apache.roller.planet.business.Planet;
import org.apache.roller.planet.business.PlanetManager;
-import org.apache.roller.planet.business.hibernate.HibernatePersistenceStrategy;
+import org.apache.roller.business.hibernate.HibernatePersistenceStrategy;
/**
Modified: incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/business/hibernate/HibernateRollerPlanetManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/business/hibernate/HibernateRollerPlanetManagerImpl.java?view=diff&rev=504622&r1=504621&r2=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/business/hibernate/HibernateRollerPlanetManagerImpl.java (original)
+++ incubator/roller/branches/roller_4.0/src/org/apache/roller/planet/business/hibernate/HibernateRollerPlanetManagerImpl.java Wed Feb 7 09:15:02 2007
@@ -37,7 +37,7 @@
import org.apache.roller.business.UserManager;
import org.apache.roller.business.WeblogManager;
import org.apache.roller.planet.business.hibernate.HibernatePlanetManagerImpl;
-import org.apache.roller.planet.business.hibernate.HibernatePersistenceStrategy;
+import org.apache.roller.business.hibernate.HibernatePersistenceStrategy;
import org.apache.roller.planet.pojos.PlanetEntryData;
import org.apache.roller.planet.pojos.PlanetSubscriptionData;
import org.apache.roller.pojos.WeblogEntryData;
Added: incubator/roller/branches/roller_4.0/tools/jpa/toplink-essentials.jar
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/tools/jpa/toplink-essentials.jar?view=auto&rev=504622
==============================================================================
Binary file - no diff available.
Propchange: incubator/roller/branches/roller_4.0/tools/jpa/toplink-essentials.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/roller/branches/roller_4.0/tools/roller-core/roller-core.jar
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/tools/roller-core/roller-core.jar?view=auto&rev=504622
==============================================================================
Binary file - no diff available.
Propchange: incubator/roller/branches/roller_4.0/tools/roller-core/roller-core.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/roller/branches/roller_4.0/web/WEB-INF/classes/JPAEMF.properties
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/web/WEB-INF/classes/JPAEMF.properties?view=auto&rev=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/web/WEB-INF/classes/JPAEMF.properties (added)
+++ incubator/roller/branches/roller_4.0/web/WEB-INF/classes/JPAEMF.properties Wed Feb 7 09:15:02 2007
@@ -0,0 +1,7 @@
+toplink.jdbc.driver=org.apache.derby.jdbc.ClientDriver
+#toplink.jdbc.url=jdbc:derby://localhost:3219/roller
+toplink.jdbc.url=jdbc:derby://localhost:1527/roller-jpa
+toplink.jdbc.user=APP
+toplink.jdbc.password=APP
+toplink.logging.level=FINE
+
Added: incubator/roller/branches/roller_4.0/web/WEB-INF/classes/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0/web/WEB-INF/classes/persistence.xml?view=auto&rev=504622
==============================================================================
--- incubator/roller/branches/roller_4.0/web/WEB-INF/classes/persistence.xml (added)
+++ incubator/roller/branches/roller_4.0/web/WEB-INF/classes/persistence.xml Wed Feb 7 09:15:02 2007
@@ -0,0 +1,38 @@
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
+
+ <persistence-unit name ="RollerPU" transaction-type = "RESOURCE_LOCAL">
+ <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
+ <mapping-file>org/apache/roller/pojos/AutoPingData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/BookmarkData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/CommentData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/EntryAttributeData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/FolderData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/HitCountData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/ObjectAuditData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/PermissionsData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/PingCategoryRestrictionData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/PingQueueEntryData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/PingTargetData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/RefererData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/RoleData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/RollerConfigData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/RollerPropertyData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/TaskLockData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/UserData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/WeblogCategoryData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/WeblogEntryData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/WeblogEntryTagAggregateData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/WeblogEntryTagData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/WeblogTemplate.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/WebsiteData.orm.xml </mapping-file>
+ </persistence-unit>
+
+ <persistence-unit name ="PlanetPU" transaction-type = "RESOURCE_LOCAL">
+ <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
+ <mapping-file>org/apache/roller/pojos/PlanetConfigData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/PlanetEntryData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/PlanetGroupData.orm.xml </mapping-file>
+ <mapping-file>org/apache/roller/pojos/PlanetSubscriptionData.orm.xml </mapping-file>
+ </persistence-unit>
+
+</persistence>