Package com.db4o.cs.internal
Class ObjectServerImpl
- java.lang.Object
-
- com.db4o.cs.internal.ObjectServerImpl
-
- All Implemented Interfaces:
ObjectServerEvents
,ExtObjectServer
,ObjectServer
,TransientClass
,java.lang.Runnable
public class ObjectServerImpl extends java.lang.Object implements ObjectServerEvents, ObjectServer, ExtObjectServer, java.lang.Runnable, TransientClass
-
-
Constructor Summary
Constructors Constructor Description ObjectServerImpl(LocalObjectContainer container, ServerConfiguration serverConfig, int port)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCommittedInfoMsg(MCommittedInfo message)
void
backup(java.lang.String path)
backs up the database file used by the ObjectServer.void
broadcastMsg(Msg message, BroadcastFilter filter)
void
broadcastReplicationCommit(long timestamp, java.util.List concurrentTimestamps)
boolean
caresAboutCommitted()
void
checkCaresAboutCommitted()
ClassInfoHelper
classInfoHelper()
Event4<ClientConnectionEventArgs>
clientConnected()
int
clientCount()
returns the number of connected clients.Event4<StringEventArgs>
clientDisconnected()
boolean
close()
Closes theObjectServer
and writes all cached data.boolean
close(ShutdownMode mode)
Event4<ServerClosedEventArgs>
closed()
Configuration
configure()
returns theConfiguration
context for this ObjectServer.void
dispose()
System.IDisposable.Dispose()ExtObjectServer
ext()
Returns anExtObjectServer
with extended functionality.User
getUser(java.lang.String userName)
void
grantAccess(java.lang.String userName, java.lang.String password)
Grants client access to the specified user with the specified password.Iterator4
iterateDispatchers()
ObjectContainer
objectContainer()
returns the ObjectContainer used by the server.ObjectContainer
openClient()
Opens a client against this server.int
port()
void
revokeAccess(java.lang.String userName)
removes client access permissions for the specified user.void
run()
int
transactionCount()
-
-
-
Constructor Detail
-
ObjectServerImpl
public ObjectServerImpl(LocalObjectContainer container, ServerConfiguration serverConfig, int port)
-
-
Method Detail
-
backup
public void backup(java.lang.String path) throws java.io.IOException
Description copied from interface:ExtObjectServer
backs up the database file used by the ObjectServer.
While the backup is running, the ObjectServer can continue to be used. Changes that are made while the backup is in progress, will be applied to the open ObjectServer and to the backup.
While the backup is running, the ObjectContainer should not be closed.
If a file already exists at the specified path, it will be overwritten.- Specified by:
backup
in interfaceExtObjectServer
- Parameters:
path
- a fully qualified path- Throws:
java.io.IOException
-
dispose
public void dispose()
System.IDisposable.Dispose()
-
close
public boolean close()
Description copied from interface:ObjectServer
- Specified by:
close
in interfaceObjectServer
- Returns:
- true - denotes that the last instance connected to the used database file was closed.
-
close
public boolean close(ShutdownMode mode)
-
iterateDispatchers
public Iterator4 iterateDispatchers()
-
configure
public Configuration configure()
Description copied from interface:ExtObjectServer
- Specified by:
configure
in interfaceExtObjectServer
- Returns:
- the Configuration context for this ObjectServer
-
ext
public ExtObjectServer ext()
Description copied from interface:ObjectServer
Returns anExtObjectServer
with extended functionality.
Use this method to conveniently access extended methods.
The functionality is split to two interfaces to allow newcomers to focus on the essential methods.- Specified by:
ext
in interfaceObjectServer
-
grantAccess
public void grantAccess(java.lang.String userName, java.lang.String password)
Description copied from interface:ObjectServer
Grants client access to the specified user with the specified password.
If the user already exists, the password is changed to the specified password.- Specified by:
grantAccess
in interfaceObjectServer
- Parameters:
userName
- the name of the userpassword
- the password to be used
-
getUser
public User getUser(java.lang.String userName)
-
objectContainer
public ObjectContainer objectContainer()
Description copied from interface:ExtObjectServer
returns the ObjectContainer used by the server.- Specified by:
objectContainer
in interfaceExtObjectServer
- Returns:
- the ObjectContainer used by the server
-
openClient
public ObjectContainer openClient()
Description copied from interface:ObjectServer
Opens a client against this server.
A client opened with this method operates within the same VM as the server. Since an embedded client use direct communication, without an in-between socket connection, performance will be better than a client opened withDb4oClientServer#openClient(java.lang.String, int, java.lang.String, java.lang.String)
Every client has it's own transaction and uses it's own cache for it's own version of all persistent objects.- Specified by:
openClient
in interfaceObjectServer
-
revokeAccess
public void revokeAccess(java.lang.String userName)
Description copied from interface:ExtObjectServer
removes client access permissions for the specified user.- Specified by:
revokeAccess
in interfaceExtObjectServer
- Parameters:
userName
- the name of the user
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
addCommittedInfoMsg
public void addCommittedInfoMsg(MCommittedInfo message)
-
broadcastReplicationCommit
public void broadcastReplicationCommit(long timestamp, java.util.List concurrentTimestamps)
-
broadcastMsg
public void broadcastMsg(Msg message, BroadcastFilter filter)
-
caresAboutCommitted
public boolean caresAboutCommitted()
-
checkCaresAboutCommitted
public void checkCaresAboutCommitted()
-
port
public int port()
- Specified by:
port
in interfaceExtObjectServer
- Returns:
- The local port this server uses, 0 if disconnected or in embedded mode
-
clientCount
public int clientCount()
Description copied from interface:ExtObjectServer
returns the number of connected clients.- Specified by:
clientCount
in interfaceExtObjectServer
-
classInfoHelper
public ClassInfoHelper classInfoHelper()
-
clientConnected
public Event4<ClientConnectionEventArgs> clientConnected()
- Specified by:
clientConnected
in interfaceObjectServerEvents
-
clientDisconnected
public Event4<StringEventArgs> clientDisconnected()
- Specified by:
clientDisconnected
in interfaceObjectServerEvents
- Returns:
- an event that provides the name of the client being disconnected.
-
closed
public Event4<ServerClosedEventArgs> closed()
- Specified by:
closed
in interfaceObjectServerEvents
-
transactionCount
public int transactionCount()
-
-