org.siebengeisslein.server
Class LocalConnection

java.lang.Object
  extended by org.siebengeisslein.server.LocalConnection
All Implemented Interfaces:
Connection

public class LocalConnection
extends java.lang.Object
implements Connection


Field Summary
 
Fields inherited from interface org.siebengeisslein.server.Connection
NULL_LOCAL_REF, ROOT_OID
 
Constructor Summary
protected LocalConnection()
          Empty constructor onyly used for MockConnection.
  LocalConnection(ConnectionManager cm, Core core, ServerCallback callback)
           
 
Method Summary
 void abortTransaction(Transaction t)
           
 void addEntry(Transaction t, long oid, CoreEntry entry)
           
 void close()
          Might be called, even if Connection is already closed.
 void commitTransaction(Transaction t)
           
 Transaction createTransaction()
           
 void createUserLocal(Transaction t, long oid)
           
 void expireOIDs(long[] objID)
           
 void expireOids(java.util.Set<java.lang.Long> removed)
          This method is called, when the client determines, that some oids are not active anymore.
 java.util.Map<java.lang.Long,CoreEntry> getEntry(long oid)
          Returns the CoreEntry for he given oid.
 java.util.Set<java.lang.Integer> getReadGroups()
           
 long getRoot(java.lang.String name)
           
 CoreEntry getSingleEntry(long oid)
           
 int getUserId()
           
 long getUserLocal(long oid)
           
 UserScopeVar getUserScopeVar(long userLocalOid)
           
 java.util.Set<java.lang.Integer> getWriteGroups()
          Set of groups this connection is allowed to write to.
 boolean isActive(java.lang.Long oid)
           
 void removeRoot(Transaction t, java.lang.String name)
          The Client is responsible for aborting a transaction, that has called removeRoot(), if the ROOT_OID is expired.
 void setEntry(Transaction t, long oid, CoreEntry entry)
           
 void setGroups(java.util.Set<java.lang.Integer> readGroups, java.util.Set<java.lang.Integer> writeGroups)
           
 void setRoot(Transaction t, java.lang.String name, long oid)
          The Client is responsible for aborting a transaction, that has called setRoot(), if the ROOT_OID is expired.
 void setUserId(int userId)
           
 void setUserLocal(Transaction t, long userLocalOid, long valueOid)
           
 void shutdown()
           
 void updateObjIDs(java.util.Map<java.lang.Long,java.lang.Long> oidMap)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalConnection

protected LocalConnection()
Empty constructor onyly used for MockConnection.


LocalConnection

public LocalConnection(ConnectionManager cm,
                       Core core,
                       ServerCallback callback)
                throws CoreException
Throws:
CoreException
Method Detail

setGroups

public void setGroups(java.util.Set<java.lang.Integer> readGroups,
                      java.util.Set<java.lang.Integer> writeGroups)

getReadGroups

public java.util.Set<java.lang.Integer> getReadGroups()

getWriteGroups

public java.util.Set<java.lang.Integer> getWriteGroups()
Description copied from interface: Connection
Set of groups this connection is allowed to write to.

Specified by:
getWriteGroups in interface Connection

getRoot

public long getRoot(java.lang.String name)
             throws java.io.IOException,
                    CoreException,
                    UnknownRootException,
                    java.lang.InterruptedException
Specified by:
getRoot in interface Connection
Throws:
java.io.IOException
CoreException
UnknownRootException
java.lang.InterruptedException

setRoot

public void setRoot(Transaction t,
                    java.lang.String name,
                    long oid)
             throws java.io.IOException,
                    CoreException,
                    AccessControlException,
                    java.lang.InterruptedException
The Client is responsible for aborting a transaction, that has called setRoot(), if the ROOT_OID is expired.

Specified by:
setRoot in interface Connection
Throws:
java.lang.InterruptedException
java.io.IOException
CoreException
AccessControlException

removeRoot

public void removeRoot(Transaction t,
                       java.lang.String name)
                throws AccessControlException,
                       CoreException,
                       java.io.IOException,
                       java.lang.InterruptedException
The Client is responsible for aborting a transaction, that has called removeRoot(), if the ROOT_OID is expired.

Specified by:
removeRoot in interface Connection
Throws:
java.lang.InterruptedException
AccessControlException
CoreException
java.io.IOException

getEntry

public java.util.Map<java.lang.Long,CoreEntry> getEntry(long oid)
                                                 throws java.io.IOException,
                                                        CoreException,
                                                        UnknownOIDException,
                                                        AccessControlException,
                                                        java.lang.InterruptedException
Description copied from interface: Connection
Returns the CoreEntry for he given oid. The Connection may choose to return more CoreEntries than the requested one.

Specified by:
getEntry in interface Connection
Throws:
java.lang.InterruptedException
java.io.IOException
CoreException
UnknownOIDException
AccessControlException

getSingleEntry

public CoreEntry getSingleEntry(long oid)
                         throws java.io.IOException,
                                CoreException,
                                UnknownOIDException,
                                AccessControlException,
                                java.lang.InterruptedException
Throws:
java.io.IOException
CoreException
UnknownOIDException
AccessControlException
java.lang.InterruptedException

getUserScopeVar

public UserScopeVar getUserScopeVar(long userLocalOid)
                             throws java.io.IOException,
                                    java.lang.InterruptedException,
                                    CoreException
Throws:
java.io.IOException
java.lang.InterruptedException
CoreException

setEntry

public void setEntry(Transaction t,
                     long oid,
                     CoreEntry entry)
              throws CoreException,
                     java.io.IOException,
                     java.lang.InterruptedException
Specified by:
setEntry in interface Connection
Throws:
CoreException
java.io.IOException
java.lang.InterruptedException

createUserLocal

public void createUserLocal(Transaction t,
                            long oid)
                     throws CoreException,
                            java.io.IOException
Specified by:
createUserLocal in interface Connection
Throws:
CoreException
java.io.IOException

setUserLocal

public void setUserLocal(Transaction t,
                         long userLocalOid,
                         long valueOid)
                  throws CoreException,
                         java.io.IOException,
                         java.lang.InterruptedException
Specified by:
setUserLocal in interface Connection
valueOid - OID of an object or Connection.NULL_LOCAL_REF to set the user local to null for this user.
Throws:
CoreException
java.io.IOException
java.lang.InterruptedException

getUserLocal

public long getUserLocal(long oid)
                  throws CoreException,
                         java.io.IOException,
                         java.lang.InterruptedException
Specified by:
getUserLocal in interface Connection
Throws:
CoreException
java.io.IOException
java.lang.InterruptedException

addEntry

public void addEntry(Transaction t,
                     long oid,
                     CoreEntry entry)
              throws CoreException
Specified by:
addEntry in interface Connection
Throws:
CoreException

expireOIDs

public void expireOIDs(long[] objID)
                throws CoreException
Throws:
CoreException

updateObjIDs

public void updateObjIDs(java.util.Map<java.lang.Long,java.lang.Long> oidMap)
                  throws CoreException
Throws:
CoreException

shutdown

public void shutdown()

close

public void close()
Description copied from interface: Connection
Might be called, even if Connection is already closed.

Specified by:
close in interface Connection

createTransaction

public Transaction createTransaction()
                              throws CoreException
Specified by:
createTransaction in interface Connection
Throws:
CoreException

abortTransaction

public void abortTransaction(Transaction t)
                      throws CoreException
Specified by:
abortTransaction in interface Connection
Throws:
CoreException

commitTransaction

public void commitTransaction(Transaction t)
                       throws CoreException,
                              UnknownOIDException,
                              AccessControlException
Specified by:
commitTransaction in interface Connection
Throws:
CoreException
UnknownOIDException
AccessControlException

isActive

public boolean isActive(java.lang.Long oid)

expireOids

public void expireOids(java.util.Set<java.lang.Long> removed)
                throws java.io.IOException,
                       CoreException
Description copied from interface: Connection
This method is called, when the client determines, that some oids are not active anymore. In this case the server does not have to inform the client about changes to these objects anymore.

Specified by:
expireOids in interface Connection
Throws:
CoreException
java.io.IOException

setUserId

public void setUserId(int userId)

getUserId

public int getUserId()