taylor 2004/06/04 17:47:46
Added: jetspeed-api/src/java/org/apache/jetspeed/components/persistence/store
PersistenceStore.java Transaction.java
PersistenceStoreEventListener.java
TransactionEvent.java LockFailedException.java
TransactionEventListener.java
PersistenceStoreInitializationException.java
Filter.java PersistenceStoreEvent.java
jetspeed-api/src/java/org/apache/jetspeed/exception
JetspeedException.java RegistryException.java
JetspeedRuntimeException.java
Log:
Refactoring of Persistence Store component, moving interfaces and exceptions to
public Jetspeed API
CVS: ----------------------------------------------------------------------
CVS: PR:
CVS: If this change addresses a PR in the problem report tracking
CVS: database, then enter the PR number(s) here.
CVS: Obtained from:
CVS: If this change has been taken from another system, such as NCSA,
CVS: then name the system in this line, otherwise delete it.
CVS: Submitted by:
CVS: If this code has been contributed to Apache by someone else; i.e.,
CVS: they sent us a patch or a new module, then include their name/email
CVS: address here. If this is your work then delete this line.
CVS: Reviewed by:
CVS: If we are doing pre-commit code reviews and someone else has
CVS: reviewed your changes, include their name(s) here.
CVS: If you have not had it reviewed then delete this line.
Revision Changes Path
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/components/persistence/store/PersistenceStore.java
Index: PersistenceStore.java
===================================================================
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.apache.jetspeed.components.persistence.store;
import java.util.Collection;
import java.util.Iterator;
import org.apache.jetspeed.components.persistence.store.impl.LockFailedException;
/**
* <p>
* PersistenceStore
* </p>
*
* <p>
* The persistence store allows access to the persistent
* storage mechanism within the application.
* <br/>
* PersistenceStore instances <strong>ARE NOT</strong>
* thread safe. The best practices approach for using
* the persistence store is to use
* <code>PersistenceStoreContainer.getStoreForThread()</code>
* any time the store is to be accessed.
*
* </p>
*
* @
* @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
* @version $ $
*
*/
public interface PersistenceStore
{
/**
* No lock at all aka the object is read only changes WILL NOT be persisted
* at checkPoints or commits.
*/
int LOCK_NO_LOCK = 0;
/**
* changes to the object will be written to the database, in this case the lock
* will be automatically upgraded to the write lock on transaction
*/
int LOCK_READ = 1;
/**
* changes to the object will be written to the database.
*/
int LOCK_PESSIMISTIC = 2;
void addEventListener(PersistenceStoreEventListener listener);
void close();
void deletePersistent(Object obj) throws LockFailedException;
void deleteAll(Object query) throws LockFailedException;
Collection getCollectionByQuery(Object query);
Collection getCollectionByQuery(Object query, int lockLevel);
Object getObjectByQuery(Object query);
Object getObjectByQuery(Object query, int lockLevel);
Object getObjectByIdentity(Object object) throws LockFailedException;
Object getObjectByIdentity(Object object, int lockLevel) throws
LockFailedException;
int getCount(Object query);
Iterator getIteratorByQuery(Object query) ;
Iterator getIteratorByQuery(Object query, int lockLevel);
/**
*
* <p>
* isClosed
* </p>
* <p>
* indicates whether or not this <code>PersistenceStore</code>
* instance has been closed. A closed store will generally
* throw exceptions when any operation is performed upon it.
* </p>
*
* @return
*
*/
boolean isClosed();
/**
*
* <p>
* getTransaction
* </p>
* <p>
* Returns the current <code>Transaction</code> for thsis
* <code>PersistenceStore</code> instance. The transaction
* will always be the same for the lifetime of the
* <code>PersistenceStore</code> instance.
* </p>
*
* @return <code>Transaction</code> for this
* <code>PersistenceStore</code>
*
*/
Transaction getTransaction();
void invalidate(Object obj) throws LockFailedException;
void invalidateAll() throws LockFailedException;
void invalidateExtent(Class clazz) throws LockFailedException;
void invalidateByQuery(Object query) throws LockFailedException;
void lockForWrite(Object obj) throws LockFailedException;
void makePersistent(Object obj) throws LockFailedException;
Filter newFilter();
Object newQuery(Class clazz, Filter filter);
Collection getExtent(Class clazz);
Collection getExtent(Class clazz, int lockLevel);
}
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/components/persistence/store/Transaction.java
Index: Transaction.java
===================================================================
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.apache.jetspeed.components.persistence.store;
/**
* <p>
* Transaction
* </p>
*
*
* @
* @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
* @version $ $
*
*/
public interface Transaction
{
void begin();
void commit();
void rollback();
void checkpoint();
boolean isOpen();
Object getWrappedTransaction();
void addEventListener(TransactionEventListener listener);
}
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/components/persistence/store/PersistenceStoreEventListener.java
Index: PersistenceStoreEventListener.java
===================================================================
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.apache.jetspeed.components.persistence.store;
/**
* <p>
* PersistenceStoreEventListener
* </p>
*
*
* @
* @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
* @version $ $
*
*/
public interface PersistenceStoreEventListener extends TransactionEventListener
{
void afterLookup(PersistenceStoreEvent event);
void beforeLookup(PersistenceStoreEvent event);
void afterDeletePersistent(PersistenceStoreEvent event);
void beforeDeletePersistent(PersistenceStoreEvent event);
void afterMakePersistent(PersistenceStoreEvent event);
void beforeMakePersistent(PersistenceStoreEvent event);
void beforeClose(PersistenceStoreEvent event);
void afterClose(PersistenceStoreEvent event);
}
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/components/persistence/store/TransactionEvent.java
Index: TransactionEvent.java
===================================================================
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.apache.jetspeed.components.persistence.store;
/**
* <p>
* TransactionEvent
* </p>
*
*
* @
* @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
* @version $ $
*
*/
public interface TransactionEvent
{
Transaction getTransaction();
}
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/components/persistence/store/LockFailedException.java
Index: LockFailedException.java
===================================================================
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.apache.jetspeed.components.persistence.store.impl;
import org.apache.jetspeed.exception.JetspeedException;
/**
* <p>
* LockFailedException
* </p>
*
*
* @
* @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
* @version $ $
*
*/
public class LockFailedException extends JetspeedException
{
/**
*
*/
public LockFailedException()
{
super();
// TODO Auto-generated constructor stub
}
/**
* @param arg0
*/
public LockFailedException(String arg0)
{
super(arg0);
// TODO Auto-generated constructor stub
}
/**
* @param arg0
*/
public LockFailedException(Throwable arg0)
{
super(arg0);
// TODO Auto-generated constructor stub
}
/**
* @param arg0
* @param arg1
*/
public LockFailedException(String arg0, Throwable arg1)
{
super(arg0, arg1);
// TODO Auto-generated constructor stub
}
}
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/components/persistence/store/TransactionEventListener.java
Index: TransactionEventListener.java
===================================================================
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.apache.jetspeed.components.persistence.store;
/**
* <p>
* TransactionEventListener
* </p>
*
*
* @
* @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
* @version $ $
*
*/
public interface TransactionEventListener
{
void afterCommit(PersistenceStoreEvent event);
void beforeCommit(PersistenceStoreEvent event);
void afterRollback(PersistenceStoreEvent event);
void beforeRollback(PersistenceStoreEvent event);
void afterBegin(PersistenceStoreEvent event);
void beforeBegin(PersistenceStoreEvent event);
}
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/components/persistence/store/PersistenceStoreInitializationException.java
Index: PersistenceStoreInitializationException.java
===================================================================
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.apache.jetspeed.components.persistence.store;
import org.apache.commons.lang.exception.NestableException;
/**
* <p>
* PersistenceStoreInitializationException
* </p>
*
*
* @
* @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
* @version $ $
*
*/
public class PersistenceStoreInitializationException extends NestableException
{
/**
*
*/
public PersistenceStoreInitializationException()
{
super();
// TODO Auto-generated constructor stub
}
/**
* @param arg0
*/
public PersistenceStoreInitializationException(String arg0)
{
super(arg0);
// TODO Auto-generated constructor stub
}
/**
* @param arg0
*/
public PersistenceStoreInitializationException(Throwable arg0)
{
super(arg0);
// TODO Auto-generated constructor stub
}
/**
* @param arg0
* @param arg1
*/
public PersistenceStoreInitializationException(String arg0, Throwable arg1)
{
super(arg0, arg1);
// TODO Auto-generated constructor stub
}
}
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/components/persistence/store/Filter.java
Index: Filter.java
===================================================================
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.apache.jetspeed.components.persistence.store;
import java.util.Collection;
/**
* <p>
* Filter
* </p>
*
*
* @
* @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
* @version $ $
*
*/
public interface Filter
{
/**
* @see org.apache.ojb.broker.query.Criteria#addBetween(java.lang.String,
java.lang.Object, java.lang.Object)
*/
public abstract void addBetween(String arg0, Object arg1, Object arg2);
/**
* @see org.apache.ojb.broker.query.Criteria#addEqualTo(java.lang.String,
java.lang.Object)
*/
public abstract void addEqualTo(String arg0, Object arg1);
/**
* @see
org.apache.ojb.broker.query.Criteria#addGreaterOrEqualThan(java.lang.String,
java.lang.Object)
*/
public abstract void addGreaterOrEqualThan(String arg0, Object arg1);
/**
* @see org.apache.ojb.broker.query.Criteria#addGreaterThan(java.lang.String,
java.lang.Object)
*/
public abstract void addGreaterThan(String arg0, Object arg1);
/**
* @see org.apache.ojb.broker.query.Criteria#addIn(java.lang.String,
java.util.Collection)
*/
public abstract void addIn(String attribute, Collection values);
/**
* @see
org.apache.ojb.broker.query.Criteria#addLessOrEqualThan(java.lang.String,
java.lang.Object)
*/
public abstract void addLessOrEqualThan(String arg0, Object arg1);
/**
* @see org.apache.ojb.broker.query.Criteria#addLike(java.lang.Object,
java.lang.Object)
*/
public abstract void addLike(Object arg0, Object arg1);
/**
* @see org.apache.ojb.broker.query.Criteria#addNotBetween(java.lang.String,
java.lang.Object, java.lang.Object)
*/
public abstract void addNotBetween(String arg0, Object arg1, Object arg2);
/**
* @see org.apache.ojb.broker.query.Criteria#addNotEqualTo(java.lang.String,
java.lang.Object)
*/
public abstract void addNotEqualTo(String arg0, Object arg1);
/**
* @see org.apache.ojb.broker.query.Criteria#addNotLike(java.lang.String,
java.lang.Object)
*/
public abstract void addNotLike(String arg0, Object arg1);
/**
* @see org.apache.ojb.broker.query.Criteria#addNotNull(java.lang.String)
*/
public abstract void addNotNull(String arg0);
/**
* @see
org.apache.ojb.broker.query.Criteria#addOrCriteria(org.apache.ojb.broker.query.Criteria)
*/
public abstract void addOrFilter(Filter arg0);
/**
* @see
org.apache.ojb.broker.query.Criteria#addOrderByAscending(java.lang.String)
*/
public abstract void addOrderByAscending(String arg0);
/**
* @see
org.apache.ojb.broker.query.Criteria#addOrderByDescending(java.lang.String)
*/
public abstract void addOrderByDescending(String arg0);
}
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/components/persistence/store/PersistenceStoreEvent.java
Index: PersistenceStoreEvent.java
===================================================================
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.apache.jetspeed.components.persistence.store;
/**
* <p>
* PersistenceStoreEvent
* </p>
*
*
* @
* @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
* @version $ $
*
*/
public interface PersistenceStoreEvent extends TransactionEvent
{
PersistenceStore getPersistenceStore();
}
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/exception/JetspeedException.java
Index: JetspeedException.java
===================================================================
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.apache.jetspeed.exception;
import org.apache.commons.lang.exception.NestableException;
/**
* Occurs when anything unexpected happens within Jetspeed.Any defined exceptions
* within Jetspeed should always extend from this.
*
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id: JetspeedException.java,v 1.1 2004/06/05 00:47:46 taylor Exp $
**/
public class JetspeedException extends NestableException
{
public JetspeedException()
{
super();
}
public JetspeedException(String message)
{
super(message);
}
public JetspeedException(Throwable nested)
{
super(nested);
}
public JetspeedException(String msg, Throwable nested)
{
super(msg, nested);
}
}
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/exception/RegistryException.java
Index: RegistryException.java
===================================================================
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.apache.jetspeed.exception;
/**
Occurs when anything unexpected happens within Jetspeed and its Registry. Any
@author <a href="mailto:[EMAIL PROTECTED]">Kevin A. Burton</a>
@version $Id: RegistryException.java,v 1.1 2004/06/05 00:47:46 taylor Exp $
*/
public class RegistryException extends JetspeedException
{
public static final String REGISTRY_NOT_FOUND
= "The specified registry does not exist.";
public RegistryException()
{
super();
}
public RegistryException( String message )
{
super( message );
}
public RegistryException(Throwable nested)
{
super(nested);
}
public RegistryException(String msg, Throwable nested)
{
super(msg, nested);
}
}
1.1
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/exception/JetspeedRuntimeException.java
Index: JetspeedRuntimeException.java
===================================================================
/*
* Copyright 2000-2004 The Apache Software Foundation.
*
* Licensed 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.
*/
package org.apache.jetspeed.exception;
import org.apache.commons.lang.exception.NestableRuntimeException;
/**
* Base exception for all RuntimeExceptions defined within Jetspeed.
* @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
*/
public class JetspeedRuntimeException extends NestableRuntimeException
{
/**
*
*/
public JetspeedRuntimeException()
{
super();
}
/**
* @param arg0
*/
public JetspeedRuntimeException(String arg0)
{
super(arg0);
}
/**
* @param arg0
*/
public JetspeedRuntimeException(Throwable arg0)
{
super(arg0);
}
/**
* @param arg0
* @param arg1
*/
public JetspeedRuntimeException(String arg0, Throwable arg1)
{
super(arg0, arg1);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]