Store and load objects for the user

Eugen Mayer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 21, 2013

Hello i need a user-based storage for objects. I could use javax.xml.bind.annotation for a XML based serialization to store/load those objects, but what storage is intended to be used?

Bandana? ActiveObject?

For the purpose of those objects: They are stored temporary and removed after a specific ammount of time (timeout) or on a specific action.

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Eugen Mayer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2013

Well i have chosen bandana with a own user context for now:

public class UserContext implements KeyedBandanaContext {
    private String userName;
    public UserContext(String userName) {
        this.userName = userName;
    }

    @Override
    public String getContextKey() {
        return this.userName;
    }

    @Override
    public BandanaContext getParentContext() {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public boolean hasParentContext() {
        return false;  //To change body of implemented methods use File | Settings | File Templates.
    }
}

And using bandana with

User user = AuthenticatedUserThreadLocal.getUser();
UserContext userContext = new UserContext(user.name);

bandanaManager.getValue(userContext,"somekey");
bandanaManager.setValue(userContext,"somekey", "somevalue");

1 vote
Stefan Kleineikenscheidt _K15t_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2013

How long is 'temporary'?

Sounds like storing the data in the HTTP session might be a solution too.

Eugen Mayer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2013

hmm, well the livetime of the session is the maximum, thats for sure. So lets say the maximum ammount of time could be 3 hours (max).

Eugen Mayer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2013

how would i actually use the session as a storage, is there an API Stefan?

TAGS
AUG Leaders

Atlassian Community Events