You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ch...@apache.org on 2005/06/22 00:03:52 UTC
svn commit: r191734 - in /lenya/trunk/src:
java/org/apache/lenya/cms/repository/ java/org/apache/lenya/cms/usecase/
java/org/apache/lenya/transaction/
webapp/lenya/pubs/default/lenya/usecases/webdav/
Author: chestnut
Date: Tue Jun 21 15:03:52 2005
New Revision: 191734
URL: http://svn.apache.org/viewcvs?rev=191734&view=rev
Log:
fixed problem of not allowing owner of lock on objects to lock again
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java
lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java
lenya/trunk/src/java/org/apache/lenya/transaction/Versionable.java
lenya/trunk/src/webapp/lenya/pubs/default/lenya/usecases/webdav/sitemap.xmap
Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java?rev=191734&r1=191733&r2=191734&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java Tue Jun 21 15:03:52 2005
@@ -40,6 +40,7 @@
import org.apache.lenya.transaction.IdentityMap;
import org.apache.lenya.transaction.Lock;
import org.apache.lenya.transaction.TransactionException;
+import org.apache.lenya.cms.rc.RCMLEntry;
/**
* A repository node.
@@ -114,6 +115,25 @@
}
/**
+ * @see org.apache.lenya.transaction.Transactionable#canCheckOut()
+ */
+ public boolean canCheckOut() throws TransactionException {
+ try {
+ RCMLEntry entry = getRevisionController().getRCML(getRCPath()).getLatestEntry();
+ if(!isCheckedOut())
+ return true;
+ else if(entry.getIdentity().equals(getUserId()))
+ return true;
+ else
+ return false;
+ } catch (TransactionException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new TransactionException(e);
+ }
+ }
+
+ /**
* @see org.apache.lenya.transaction.Transactionable#checkout()
*/
public void checkout() throws TransactionException {
@@ -286,8 +306,8 @@
* @see org.apache.lenya.transaction.Transactionable#lock()
*/
public void lock() throws TransactionException {
- if (isCheckedOut()) {
- throw new TransactionException("Cannot lock [" + this + "]: node is checked out.");
+ if (!canCheckOut()) {
+ throw new TransactionException("Cannot lock [" + this + "]: node is checked out.");
}
if (getLogger().isDebugEnabled()) {
getLogger().debug("Locking [" + this + "]");
Modified: lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java?rev=191734&r1=191733&r2=191734&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/usecase/AbstractUsecase.java Tue Jun 21 15:03:52 2005
@@ -642,8 +642,8 @@
boolean canExecute = true;
for (int i = 0; i < objects.length; i++) {
- if (objects[i].isCheckedOut()) {
- if (getLogger().isDebugEnabled())
+ if(!objects[i].canCheckOut()) {
+ if (getLogger().isDebugEnabled())
getLogger()
.debug("AbstractUsecase::lockInvolvedObjects() can not execute, object ["
+ objects[i] + "] is already checked out");
Modified: lenya/trunk/src/java/org/apache/lenya/transaction/Versionable.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/transaction/Versionable.java?rev=191734&r1=191733&r2=191734&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/transaction/Versionable.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/transaction/Versionable.java Tue Jun 21 15:03:52 2005
@@ -19,7 +19,7 @@
/**
* A versionable object.
*
- * @version $Id:$
+ * @version $Id$
*/
public interface Versionable extends Lockable {
@@ -40,6 +40,12 @@
* @throws TransactionException if an error occurs.
*/
boolean isCheckedOut() throws TransactionException;
+
+ /**
+ * @return if the object can be checked out
+ * @throws TransactionException if an error occurs.
+ */
+ boolean canCheckOut() throws TransactionException;
/**
* Checks if the object has been changed since it has been locked.
Modified: lenya/trunk/src/webapp/lenya/pubs/default/lenya/usecases/webdav/sitemap.xmap
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/lenya/usecases/webdav/sitemap.xmap?rev=191734&r1=191733&r2=191734&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/lenya/usecases/webdav/sitemap.xmap (original)
+++ lenya/trunk/src/webapp/lenya/pubs/default/lenya/usecases/webdav/sitemap.xmap Tue Jun 21 15:03:52 2005
@@ -222,10 +222,6 @@
</map:match>
<map:match pattern="PUT/**_*.html">
- <!--fixme: Have to checkin or we get "can not lock error" trying to put when file is already checked out-->
- <map:act type="reserved-checkin">
- <map:call function="put" />
- </map:act>
<map:call function="put" />
</map:match>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org
Re: svn commit: r191734 - in /lenya/trunk/src: java/org/apache/lenya/cms/repository/
java/org/apache/lenya/cms/usecase/ java/org/apache/lenya/transaction/
webapp/lenya/pubs/default/lenya/usecases/webdav/
Posted by Doug Chestnut <dh...@virginia.edu>.
Thanks Andreas,
I am still getting used to eclipse :)
--Doug
Andreas Hartmann wrote:
> chestnut@apache.org wrote:
>
> [...]
>
>> /**
>> + * @see org.apache.lenya.transaction.Transactionable#canCheckOut()
>> + */
>> + public boolean canCheckOut() throws TransactionException {
>> + try {
>> + RCMLEntry entry =
>> getRevisionController().getRCML(getRCPath()).getLatestEntry();
>> + if(!isCheckedOut())
>> + return true;
>> + else if(entry.getIdentity().equals(getUserId()))
>
>
> There are some tabstops in here. Would you mind configuring your IDE
> to use spaces? Sorry for getting on your nerves, but when I re-format
> a file which uses tabs with my IDE, we get differences on each of these
> lines :(
>
> More info: http://lenya.apache.org/1_2_x/misc/coding-guidelines.html
>
> Thanks!
>
> -- Andreas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
>
>
Re: svn commit: r191734 - in /lenya/trunk/src: java/org/apache/lenya/cms/repository/
java/org/apache/lenya/cms/usecase/ java/org/apache/lenya/transaction/
webapp/lenya/pubs/default/lenya/usecases/webdav/
Posted by Andreas Hartmann <an...@apache.org>.
chestnut@apache.org wrote:
[...]
> /**
> + * @see org.apache.lenya.transaction.Transactionable#canCheckOut()
> + */
> + public boolean canCheckOut() throws TransactionException {
> + try {
> + RCMLEntry entry = getRevisionController().getRCML(getRCPath()).getLatestEntry();
> + if(!isCheckedOut())
> + return true;
> + else if(entry.getIdentity().equals(getUserId()))
There are some tabstops in here. Would you mind configuring your IDE
to use spaces? Sorry for getting on your nerves, but when I re-format
a file which uses tabs with my IDE, we get differences on each of these
lines :(
More info: http://lenya.apache.org/1_2_x/misc/coding-guidelines.html
Thanks!
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org