org.apache.lucene.gdata.storage.db4o
Class DB4oController

java.lang.Object
  extended by org.apache.lucene.gdata.storage.db4o.DB4oController
All Implemented Interfaces:
ScopeVisitor, ServerComponent, StorageController

public class DB4oController
extends Object
implements StorageController, ScopeVisitor

The DB4o StorageContorller can be used as a persitence component for the gdata-server. To use DB4o a third party jar needs to added to the lib directory of the project. If the jar is not available in the lib directory all db4o dependent class won't be included in the build.

If the jar is present in the lib directory this class can be configured as a ComponentType.STORAGECONTROLLER via the gdata-config.xml file. For detailed config documentation see the wiki page.

The DB4oController can run as a client or as a server to serve other running db4o clients in the network. To achive the best performance out of the db4o caching layer connections to the server will be reused in a connection pool. A connection will not be shared withing more than one thread. The controller release one connection per request and returns the connection when the request has been destroyed.

Author:
Simon Willnauer
See Also:
db4o website, Pool

Constructor Summary
DB4oController()
           
 
Method Summary
 void destroy()
          will be called when the registry is going down e.g.
 int getContainerPoolSize()
           
 String getFilePath()
           
 String getHost()
           
 String getPassword()
           
 int getPort()
           
 Storage getStorage()
          Creates Storage instances to access the underlaying storage component
 String getUser()
           
 void initialize()
          will be call when the component is registered.
 boolean isRunAsServer()
           
 boolean isUseWeakReferences()
           
 String releaseId()
          Releases a new unique ID
 void setContainerPoolSize(int containerPoolSize)
           
 void setFilePath(String filePath)
           
 void setHost(String host)
           
 void setPassword(String password)
           
 void setPort(int port)
           
 void setRunAsServer(boolean runAsServer)
           
 void setUser(String user)
           
 void setUseWeakReferences(boolean weakReferences)
           
 String toString()
           
 void visiteDestroy()
          Visites the destory of the scope
 void visiteInitialize()
          Visites the initialization of the scope
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DB4oController

public DB4oController()
               throws NoSuchAlgorithmException
Throws:
NoSuchAlgorithmException
Method Detail

destroy

public void destroy()
Description copied from interface: ServerComponent
will be called when the registry is going down e.g. when the GDataServerRegistry.destroy() method is called.

Specified by:
destroy in interface ServerComponent
Specified by:
destroy in interface StorageController
See Also:
StorageController.destroy()

getStorage

public Storage getStorage()
                   throws StorageException
Description copied from interface: StorageController
Creates Storage instances to access the underlaying storage component

Specified by:
getStorage in interface StorageController
Returns:
a storage instance
Throws:
StorageException - - if the storage instance can not be created
See Also:
StorageController.getStorage()

initialize

public void initialize()
Description copied from interface: ServerComponent
will be call when the component is registered. if this fails the server must not startup.

Specified by:
initialize in interface ServerComponent
See Also:
ServerComponent.initialize()

releaseId

public String releaseId()
Description copied from interface: StorageController
Releases a new unique ID

Specified by:
releaseId in interface StorageController
Returns:
- unique ID
See Also:
StorageController.releaseId()

visiteInitialize

public void visiteInitialize()
Description copied from interface: ScopeVisitor
Visites the initialization of the scope

Specified by:
visiteInitialize in interface ScopeVisitor
See Also:
ScopeVisitor.visiteInitialize()

visiteDestroy

public void visiteDestroy()
Description copied from interface: ScopeVisitor
Visites the destory of the scope

Specified by:
visiteDestroy in interface ScopeVisitor
See Also:
ScopeVisitor.visiteDestroy()

getFilePath

public String getFilePath()
Returns:
Returns the filePath.

setFilePath

public void setFilePath(String filePath)
Parameters:
filePath - The filePath to set.

getHost

public String getHost()
Returns:
Returns the host.

setHost

public void setHost(String host)
Parameters:
host - The host to set.

getPassword

public String getPassword()
Returns:
Returns the password.

setPassword

public void setPassword(String password)
Parameters:
password - The password to set.

getPort

public int getPort()
Returns:
Returns the port.

setPort

public void setPort(int port)
Parameters:
port - The port to set.

isRunAsServer

public boolean isRunAsServer()
Returns:
Returns the runAsServer.

setRunAsServer

public void setRunAsServer(boolean runAsServer)
Parameters:
runAsServer - The runAsServer to set.

getUser

public String getUser()
Returns:
Returns the user.

setUser

public void setUser(String user)
Parameters:
user - The user to set.

isUseWeakReferences

public boolean isUseWeakReferences()
Returns:
Returns the weakReferences.

setUseWeakReferences

public void setUseWeakReferences(boolean weakReferences)
Parameters:
weakReferences - The weakReferences to set.

getContainerPoolSize

public int getContainerPoolSize()
Returns:
Returns the containerPoolSize.

setContainerPoolSize

public void setContainerPoolSize(int containerPoolSize)
Parameters:
containerPoolSize - The containerPoolSize to set.

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.