Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Get locked_areas from CDO
[CDO] Get locked_areas from CDO [message #1006054] Tue, 29 January 2013 16:10 Go to next message
Tommaso De Sica is currently offline Tommaso De SicaFriend
Messages: 128
Registered: March 2012
Location: Italy
Senior Member

Goodevening,

I need to retrieve lock_areas from CDO DB, because I want to know the user associated with a particular ID.

Very thank you,
cheers!
Re: [CDO] Get locked_areas from CDO [message #1006064 is a reply to message #1006054] Tue, 29 January 2013 17:03 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 5574
Registered: July 2009
Senior Member
Am 29.01.2013 17:10, schrieb Tommaso De Sica:
> Goodevening,
>
> I need to retrieve lock_areas from CDO DB, because I want to know the user associated with a particular ID.
With "ID" are you referring to a durableLockingID like in CDOSession.openTransaction(String durableLockingID)?

Maybe you're looking for this server method:

org.eclipse.emf.cdo.common.lock.IDurableLockingManager.getLockArea(String)

You can find a usage example in org.eclipse.emf.cdo.internal.server.bundle.CDOCommandProvider.locks(CommandInterpreter):

protected void locks(final CommandInterpreter interpreter)
{
final InternalRepository repository = getRepository(interpreter,
"Syntax: cdo locks <repository-name> [<username-prefix>]");
final String userIDPrefix = nextArgument(interpreter, null);

new WithAccessor()
{
@Override
protected void doExecute(IStoreAccessor accessor)
{
repository.getLockingManager().getLockAreas(userIDPrefix, new IDurableLockingManager.LockArea.Handler()
{
public boolean handleLockArea(LockArea area)
{
interpreter.println(area.getDurableLockingID());
interpreter.println(INDENT + "userID = " + area.getUserID());
interpreter.println(INDENT + "branch = " + area.getBranch());
interpreter.println(INDENT + "timeStamp = " + CDOCommonUtil.formatTimeStamp(area.getTimeStamp()));
interpreter.println(INDENT + "readOnly = " + area.isReadOnly());
interpreter.println(INDENT + "locks = " + area.getLocks());
return true;
}
});
}
}.execute(repository);
}

If you need the infos at the client side you'll have to write a custom IQueryHandler and contribute it to the repository.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Get locked_areas from CDO [message #1006161 is a reply to message #1006064] Wed, 30 January 2013 10:00 Go to previous messageGo to next message
Tommaso De Sica is currently offline Tommaso De SicaFriend
Messages: 128
Registered: March 2012
Location: Italy
Senior Member

Thanks for fast reply.
But I can't understand how get repository from my client application. I have repositoryInfo in my session, but I need the repository for getLockingManager.

[Updated on: Wed, 30 January 2013 10:00]

Report message to a moderator

Re: [CDO] Get locked_areas from CDO [message #1006168 is a reply to message #1006161] Wed, 30 January 2013 10:30 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 5574
Registered: July 2009
Senior Member
Am 30.01.2013 11:00, schrieb Tommaso De Sica:
> Thank for fast reply.
> But I can't understand how get repository from my client application. I have repositoryInfo in my session, but I need
> the repository for getLockingManager.
You can't get access to the server-side IRepository (unless you use an embedded repository). I repeat my advice from the
previous reply:

If you need the infos at the client side you'll have to write a custom IQueryHandler and contribute it to the repository.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Previous Topic:[CDO] id generation client side & raw replication
Next Topic:Where can I find Ecore.ecore
Goto Forum:
  


Current Time: Fri Nov 21 02:34:28 GMT 2014

Powered by FUDForum. Page generated in 0.02795 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software