Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » User control in CDO
User control in CDO [message #952799] Sun, 21 October 2012 20:00 Go to next message
UmaShankar Subramani is currently offline UmaShankar Subramani
Messages: 143
Registered: December 2011
Location: SWEDEN
Senior Member
Hi,

How difficult it would be to introduce some sort of User Control into CDO. For example, if there are 3 concurrent clients client-1, client-2 and client-3. Three colors are given for all three clients, for example client-1(blue) client-2(red) client-3(orange). If the client-1 locks a model, for everyone else, the lock should be shown in blue color. So that, everyone knows that it is locked by client-1.

To implement such thing, should I do it from scratch or, CDO has some in-built support for this?
Re: User control in CDO [message #952838 is a reply to message #952799] Sun, 21 October 2012 20:45 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5545
Registered: July 2009
Senior Member
Am 21.10.2012 22:00, schrieb UmaShankar Subramani:
> Hi,
>
> How difficult it would be to introduce some sort of User Control into CDO. For example, if there are 3 concurrent
> clients client-1, client-2 and client-3. Three colors are given for all three clients, for example client-1(blue)
> client-2(red) client-3(orange). If the client-1 locks a model, for everyone else, the lock should be shown in blue
> color. So that, everyone knows that it is locked by client-1.
>
> To implement such thing, should I do it from scratch or, CDO has some in-built support for this?
I'm off for the EclipseCon now. I'll keep a flag on this thread and answer next week.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: User control in CDO [message #960352 is a reply to message #952838] Sat, 27 October 2012 11:56 Go to previous messageGo to next message
UmaShankar Subramani is currently offline UmaShankar Subramani
Messages: 143
Registered: December 2011
Location: SWEDEN
Senior Member
Hi Eike,

Could you please answer this now?
Re: User control in CDO [message #961264 is a reply to message #952799] Sun, 28 October 2012 05:49 Go to previous message
Eike Stepper is currently offline Eike Stepper
Messages: 5545
Registered: July 2009
Senior Member
Am 21.10.2012 22:00, schrieb UmaShankar Subramani:
> Hi,
>
> How difficult it would be to introduce some sort of User Control into CDO. For example, if there are 3 concurrent
> clients client-1, client-2 and client-3. Three colors are given for all three clients, for example client-1(blue)
> client-2(red) client-3(orange). If the client-1 locks a model, for everyone else, the lock should be shown in blue
> color. So that, everyone knows that it is locked by client-1.
>
> To implement such thing, should I do it from scratch or, CDO has some in-built support for this?
CDO has strong support for locking and lock notifications which you've found out already:

/**
* A client-side representation of <i>all</i> the locks on a single CDOObject.
* <p>
* As an individual lock is always owned by view, which in turn is owned by a session, the methods on this interface
* return instances of {@link CDOLockOwner} which carry that information.
* <p>
*
* @author Caspar De Groot
* @since 4.1
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
* @apiviz.landmark
* @apiviz.has {@link java.lang.Object} oneway - - lockedObject
* @apiviz.owns {@link CDOLockOwner} - - readLockOwners
* @apiviz.has {@link CDOLockOwner} oneway - - writeLockOwner
* @apiviz.has {@link CDOLockOwner} oneway - - writeOptionOwner
*/
public interface CDOLockState
{
/**
* Gets a unique identifier for the object that is locked; typically a {@link CDOID} or a {@link CDOIDAndBranch},
* depending on whether branching support is enabled or not
*
* @return the identifier
*/
public Object getLockedObject();

/**
* If the 'others' argument is <code>false</code>, this method returns <code>true</code> if this lock is currently
* held by the <i>requesting</i> CDOView, <code>false</code> otherwise.
* <p>
* If the 'others' argument is <code>true</code>, this method returns <code>true</code> if this lock is currently held
* by <i>another</i> view (i.e. any view different from the requesting one), <code>false</code> otherwise.
*/
public boolean isLocked(LockType lockType, CDOLockOwner lockOwner, boolean others);

public Set<CDOLockOwner> getReadLockOwners();

public CDOLockOwner getWriteLockOwner();

public CDOLockOwner getWriteOptionOwner();
}

With the CDORemoteSessionManager you can find out the user of another session:

/**
* Represents a remote session that is connected to the same repository as the
* {@link CDORemoteSessionManager#getLocalSession() local session} that the {@link #getManager() remote session manager}
* points to.
*
* @author Eike Stepper
* @since 2.0
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface CDORemoteSession extends Comparable<CDORemoteSession>
{
/**
* Returns the remote session manager that manages this remote session.
*/
public CDORemoteSessionManager getManager();

/**
* Returns the session ID of this remote session.
*/
public int getSessionID();

/**
* Returns the user ID of this remote session.
*/
public String getUserID();

/**
* Returns <code>true</code> if this remote session is subscribed to changes in the set of remote sessions and
* delivers {@link MessageReceived custom data events}, <code>false</code> otherwise.
*/
public boolean isSubscribed();

/**
* Sends a unicast message to this remote session if it is subscribed.
*
* @return <code>true</code> if the server received the custom data message, <code>false</code> otherwise.
* <b>Note:</b> No assumption must be made on whether the recipient session received the message and was able
* to handle it adequately!
* @throws CDOException
* if this remote session is not subscribed.
* @see #isSubscribed()
* @since 3.0
*/
public boolean sendMessage(CDORemoteSessionMessage message);
}

There's also support for security/access control:

<!-- Example http://bugs.eclipse.org/380629
<securityManager type="default" realmPath="/security"/>
<securityManager type="annotation" realmPath="/security"/>
-->

It's up to you how you use these mechanisms in your user interface.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: User control in CDO [message #961271 is a reply to message #952799] Sun, 28 October 2012 05:49 Go to previous message
Eike Stepper is currently offline Eike Stepper
Messages: 5545
Registered: July 2009
Senior Member
Am 21.10.2012 22:00, schrieb UmaShankar Subramani:
> Hi,
>
> How difficult it would be to introduce some sort of User Control into CDO. For example, if there are 3 concurrent
> clients client-1, client-2 and client-3. Three colors are given for all three clients, for example client-1(blue)
> client-2(red) client-3(orange). If the client-1 locks a model, for everyone else, the lock should be shown in blue
> color. So that, everyone knows that it is locked by client-1.
>
> To implement such thing, should I do it from scratch or, CDO has some in-built support for this?
CDO has strong support for locking and lock notifications which you've found out already:

/**
* A client-side representation of <i>all</i> the locks on a single CDOObject.
* <p>
* As an individual lock is always owned by view, which in turn is owned by a session, the methods on this interface
* return instances of {@link CDOLockOwner} which carry that information.
* <p>
*
* @author Caspar De Groot
* @since 4.1
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
* @apiviz.landmark
* @apiviz.has {@link java.lang.Object} oneway - - lockedObject
* @apiviz.owns {@link CDOLockOwner} - - readLockOwners
* @apiviz.has {@link CDOLockOwner} oneway - - writeLockOwner
* @apiviz.has {@link CDOLockOwner} oneway - - writeOptionOwner
*/
public interface CDOLockState
{
/**
* Gets a unique identifier for the object that is locked; typically a {@link CDOID} or a {@link CDOIDAndBranch},
* depending on whether branching support is enabled or not
*
* @return the identifier
*/
public Object getLockedObject();

/**
* If the 'others' argument is <code>false</code>, this method returns <code>true</code> if this lock is currently
* held by the <i>requesting</i> CDOView, <code>false</code> otherwise.
* <p>
* If the 'others' argument is <code>true</code>, this method returns <code>true</code> if this lock is currently held
* by <i>another</i> view (i.e. any view different from the requesting one), <code>false</code> otherwise.
*/
public boolean isLocked(LockType lockType, CDOLockOwner lockOwner, boolean others);

public Set<CDOLockOwner> getReadLockOwners();

public CDOLockOwner getWriteLockOwner();

public CDOLockOwner getWriteOptionOwner();
}

With the CDORemoteSessionManager you can find out the user of another session:

/**
* Represents a remote session that is connected to the same repository as the
* {@link CDORemoteSessionManager#getLocalSession() local session} that the {@link #getManager() remote session manager}
* points to.
*
* @author Eike Stepper
* @since 2.0
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface CDORemoteSession extends Comparable<CDORemoteSession>
{
/**
* Returns the remote session manager that manages this remote session.
*/
public CDORemoteSessionManager getManager();

/**
* Returns the session ID of this remote session.
*/
public int getSessionID();

/**
* Returns the user ID of this remote session.
*/
public String getUserID();

/**
* Returns <code>true</code> if this remote session is subscribed to changes in the set of remote sessions and
* delivers {@link MessageReceived custom data events}, <code>false</code> otherwise.
*/
public boolean isSubscribed();

/**
* Sends a unicast message to this remote session if it is subscribed.
*
* @return <code>true</code> if the server received the custom data message, <code>false</code> otherwise.
* <b>Note:</b> No assumption must be made on whether the recipient session received the message and was able
* to handle it adequately!
* @throws CDOException
* if this remote session is not subscribed.
* @see #isSubscribed()
* @since 3.0
*/
public boolean sendMessage(CDORemoteSessionMessage message);
}

There's also support for security/access control:

<!-- Example http://bugs.eclipse.org/380629
<securityManager type="default" realmPath="/security"/>
<securityManager type="annotation" realmPath="/security"/>
-->

It's up to you how you use these mechanisms in your user interface.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: User control in CDO [message #961279 is a reply to message #952799] Sun, 28 October 2012 05:49 Go to previous message
Eike Stepper is currently offline Eike Stepper
Messages: 5545
Registered: July 2009
Senior Member
Am 21.10.2012 22:00, schrieb UmaShankar Subramani:
> Hi,
>
> How difficult it would be to introduce some sort of User Control into CDO. For example, if there are 3 concurrent
> clients client-1, client-2 and client-3. Three colors are given for all three clients, for example client-1(blue)
> client-2(red) client-3(orange). If the client-1 locks a model, for everyone else, the lock should be shown in blue
> color. So that, everyone knows that it is locked by client-1.
>
> To implement such thing, should I do it from scratch or, CDO has some in-built support for this?
CDO has strong support for locking and lock notifications which you've found out already:

/**
* A client-side representation of <i>all</i> the locks on a single CDOObject.
* <p>
* As an individual lock is always owned by view, which in turn is owned by a session, the methods on this interface
* return instances of {@link CDOLockOwner} which carry that information.
* <p>
*
* @author Caspar De Groot
* @since 4.1
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
* @apiviz.landmark
* @apiviz.has {@link java.lang.Object} oneway - - lockedObject
* @apiviz.owns {@link CDOLockOwner} - - readLockOwners
* @apiviz.has {@link CDOLockOwner} oneway - - writeLockOwner
* @apiviz.has {@link CDOLockOwner} oneway - - writeOptionOwner
*/
public interface CDOLockState
{
/**
* Gets a unique identifier for the object that is locked; typically a {@link CDOID} or a {@link CDOIDAndBranch},
* depending on whether branching support is enabled or not
*
* @return the identifier
*/
public Object getLockedObject();

/**
* If the 'others' argument is <code>false</code>, this method returns <code>true</code> if this lock is currently
* held by the <i>requesting</i> CDOView, <code>false</code> otherwise.
* <p>
* If the 'others' argument is <code>true</code>, this method returns <code>true</code> if this lock is currently held
* by <i>another</i> view (i.e. any view different from the requesting one), <code>false</code> otherwise.
*/
public boolean isLocked(LockType lockType, CDOLockOwner lockOwner, boolean others);

public Set<CDOLockOwner> getReadLockOwners();

public CDOLockOwner getWriteLockOwner();

public CDOLockOwner getWriteOptionOwner();
}

With the CDORemoteSessionManager you can find out the user of another session:

/**
* Represents a remote session that is connected to the same repository as the
* {@link CDORemoteSessionManager#getLocalSession() local session} that the {@link #getManager() remote session manager}
* points to.
*
* @author Eike Stepper
* @since 2.0
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface CDORemoteSession extends Comparable<CDORemoteSession>
{
/**
* Returns the remote session manager that manages this remote session.
*/
public CDORemoteSessionManager getManager();

/**
* Returns the session ID of this remote session.
*/
public int getSessionID();

/**
* Returns the user ID of this remote session.
*/
public String getUserID();

/**
* Returns <code>true</code> if this remote session is subscribed to changes in the set of remote sessions and
* delivers {@link MessageReceived custom data events}, <code>false</code> otherwise.
*/
public boolean isSubscribed();

/**
* Sends a unicast message to this remote session if it is subscribed.
*
* @return <code>true</code> if the server received the custom data message, <code>false</code> otherwise.
* <b>Note:</b> No assumption must be made on whether the recipient session received the message and was able
* to handle it adequately!
* @throws CDOException
* if this remote session is not subscribed.
* @see #isSubscribed()
* @since 3.0
*/
public boolean sendMessage(CDORemoteSessionMessage message);
}

There's also support for security/access control:

<!-- Example http://bugs.eclipse.org/380629
<securityManager type="default" realmPath="/security"/>
<securityManager type="annotation" realmPath="/security"/>
-->

It's up to you how you use these mechanisms in your user interface.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Previous Topic:[CDO] CDO Model Repository Test dependency issue
Next Topic:Understanding CDO
Goto Forum:
  


Current Time: Sat Oct 25 01:46:25 GMT 2014

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

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