jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paco Avila <monk...@gmail.com>
Subject Re: Recovering open-scoped lock tokens
Date Tue, 02 Feb 2010 12:02:04 GMT
Well, there is an obscure way: to have to generate a new lock token
for the locked node and add it to the user session.

	public static String getLockToken(String id) {
		StringBuffer buf = new StringBuffer();
		buf.append(id.toString());
		buf.append('-');
		buf.append(getCheckDigit(id.toString()));
		return buf.toString();
	}

	private static char getCheckDigit(String uuid) {
        int result = 0;

        int multiplier = 36;
        for (int i = 0; i < uuid.length(); i++) {
            char c = uuid.charAt(i);
            if (c >= '0' && c <= '9') {
                int num = c - '0';
                result += multiplier * num;
                multiplier--;
            } else if (c >= 'A' && c <= 'F') {
                int num = c - 'A' + 10;
                result += multiplier * num;
                multiplier--;
            } else if (c >= 'a' && c <= 'f') {
                int num = c - 'a' + 10;
                result += multiplier * num;
                multiplier--;
            }
        }

        int rem = result % 37;
        if (rem != 0) {
            rem = 37 - rem;
        }
        if (rem >= 0 && rem <= 9) {
            return (char) ('0' + rem);
        } else if (rem >= 10 && rem <= 35) {
            return (char) ('A' + rem - 10);
        } else {
            return '+';
        }
    }

2010/2/2  <Sascha.Theves@innovations.de>:
> Nobody an idea?
>
> -----Urspr√ľngliche Nachricht-----
> Von: Sascha.Theves@innovations.de [mailto:Sascha.Theves@innovations.de]
> Gesendet: Montag, 1. Februar 2010 10:18
> An: users@jackrabbit.apache.org
> Betreff: Recovering open-scoped lock tokens
>
> Hi all,
>
>
>
> when I lock a node in jackrabbit (open-scoped) a lock token is returned.
> When I login to jackrabbit again (new session) I must put the former
> lock token to the session, so the user can unlock the node. What can I
> do if I have lost the lock token from jackrabbit. I do not get the lock
> token again if I call node.getLockToken(). Is there a recovering
> possibility?
>
>
>
> Thanks in advance
>
>
>
> Sascha
>
>



-- 
OpenKM
http://www.openkm.com
http://www.guia-ubuntu.org

Mime
View raw message