Java Doc for Db4oService.java in  » Database-DBMS » db4o-6.4 » com » db4o » osgi » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db4o 6.4 » com.db4o.osgi 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.db4o.osgi.Db4oService

All known Subclasses:   com.db4o.osgi.Db4oServiceImpl,
Db4oService
public interface Db4oService (Code)
This API is registered as an OSGi service by the db4o_osgi bundle. It can be accessed like this:

ServiceReference serviceRef = _context.getServiceReference(Db4oService.class.getName()); Db4oService db4oService = (Db4oService)bundleContext.getService(serviceRef);
Configuration config = db4oService.newConfiguration();
// ...
ObjectContainer database = db4oService.openFile(config,fileName);


Subsequently, the database reference can be handled like any other db4o instance.

The main purpose of this service is to configure an OSGi bundle aware reflector for the database instance, so classes that are owned by the client bundle are accessible to the db4o engine. To emulate this behavior when using db4o directly through the exported packages of the db4o_osgi plugin, db4o can be configured like this:

Configuration config = Db4o.newConfiguration();
config.reflectWith(new JdkReflector(SomeData.class.getClassLoader()));
// ...
ObjectContainer database = Db4o.openFile(config,fileName);


Access through the service is recommended over direct usage, though, as the service may implement further OSGi specific features in the future.
See Also:   Db4o
See Also:   com.db4o.reflect.Reflector
See Also:    "org.osgi.framework.BundleContext"




Method Summary
 ConfigurationnewConfiguration()
     Creates a fresh Configuration Configuration instance.
 ObjectContaineropenClient(String hostName, int port, String user, String password)
     Operates just like Db4o.openClient(ConfigurationStringintStringString) , but uses a newly created, vanilla Configuration Configuration context.
 ObjectContaineropenClient(Configuration config, String hostName, int port, String user, String password)
     opens an ObjectContainer ObjectContainer client and connects it to the specified named server and port.
 ObjectContaineropenFile(String databaseFileName)
     Operates just like Db4o.openFile(ConfigurationString) , but uses a newly created, vanilla Configuration Configuration context. opens an ObjectContainer ObjectContainer on the specified database file for local use.

A database file can only be opened once, subsequent attempts to open another ObjectContainer ObjectContainer against the same file will result in a DatabaseFileLockedException DatabaseFileLockedException .

Database files can only be accessed for readwrite access from one process (one Java VM) at one time.
 ObjectContaineropenFile(Configuration config, String databaseFileName)
     opens an ObjectContainer ObjectContainer on the specified database file for local use.

A database file can only be opened once, subsequent attempts to open another ObjectContainer ObjectContainer against the same file will result in a DatabaseFileLockedException DatabaseFileLockedException .

Database files can only be accessed for readwrite access from one process (one Java VM) at one time.
 ObjectServeropenServer(String databaseFileName, int port)
     Operates just like Db4o.openServer(ConfigurationStringint) , but uses a newly created, vanilla Configuration Configuration context.
 ObjectServeropenServer(Configuration config, String databaseFileName, int port)
     opens an ObjectServer ObjectServer on the specified database file and port.



Method Detail
newConfiguration
Configuration newConfiguration()(Code)
Creates a fresh Configuration Configuration instance. a fresh, independent configuration with all options set to their default values



openClient
ObjectContainer openClient(String hostName, int port, String user, String password) throws Db4oException(Code)
Operates just like Db4o.openClient(ConfigurationStringintStringString) , but uses a newly created, vanilla Configuration Configuration context. opens an ObjectContainer ObjectContainer client and connects it to the specified named server and port.

The server needs to ObjectServer.grantAccess allow access for the specified user and password.

A client ObjectContainer ObjectContainer can be cast to ExtClient ExtClient to use extended ExtObjectContainer ExtObjectContainer and ExtClient ExtClient methods.


Parameters:
  hostName - the host name
Parameters:
  port - the port the server is using
Parameters:
  user - the user name
Parameters:
  password - the user password an open ObjectContainer ObjectContainer
See Also:   ObjectServer.grantAccess
throws:
  Db4oException -



openClient
ObjectContainer openClient(Configuration config, String hostName, int port, String user, String password) throws Db4oException(Code)
opens an ObjectContainer ObjectContainer client and connects it to the specified named server and port.

The server needs to ObjectServer.grantAccess allow access for the specified user and password.

A client ObjectContainer ObjectContainer can be cast to ExtClient ExtClient to use extended ExtObjectContainer ExtObjectContainer and ExtClient ExtClient methods.


Parameters:
  config - a custom Configuration Configuration instance to be obtained via Db4o.newConfiguration
Parameters:
  hostName - the host name
Parameters:
  port - the port the server is using
Parameters:
  user - the user name
Parameters:
  password - the user password an open ObjectContainer ObjectContainer
See Also:   ObjectServer.grantAccess
throws:
  Db4oException -



openFile
ObjectContainer openFile(String databaseFileName) throws Db4oException(Code)
Operates just like Db4o.openFile(ConfigurationString) , but uses a newly created, vanilla Configuration Configuration context. opens an ObjectContainer ObjectContainer on the specified database file for local use.

A database file can only be opened once, subsequent attempts to open another ObjectContainer ObjectContainer against the same file will result in a DatabaseFileLockedException DatabaseFileLockedException .

Database files can only be accessed for readwrite access from one process (one Java VM) at one time. All versions except for db4o mobile edition use an internal mechanism to lock the database file for other processes.


Parameters:
  databaseFileName - an absolute or relative path to the database file an open ObjectContainer ObjectContainer
See Also:   Configuration.readOnly
See Also:   Configuration.encrypt
See Also:   Configuration.password
throws:
  Db4oException -



openFile
ObjectContainer openFile(Configuration config, String databaseFileName) throws Db4oException(Code)
opens an ObjectContainer ObjectContainer on the specified database file for local use.

A database file can only be opened once, subsequent attempts to open another ObjectContainer ObjectContainer against the same file will result in a DatabaseFileLockedException DatabaseFileLockedException .

Database files can only be accessed for readwrite access from one process (one Java VM) at one time. All versions except for db4o mobile edition use an internal mechanism to lock the database file for other processes.


Parameters:
  config - a custom Configuration Configuration instance to be obtained via Db4o.newConfiguration
Parameters:
  databaseFileName - an absolute or relative path to the database file an open ObjectContainer ObjectContainer
See Also:   Configuration.readOnly
See Also:   Configuration.encrypt
See Also:   Configuration.password
throws:
  Db4oException -



openServer
ObjectServer openServer(String databaseFileName, int port) throws Db4oException(Code)
Operates just like Db4o.openServer(ConfigurationStringint) , but uses a newly created, vanilla Configuration Configuration context. opens an ObjectServer ObjectServer on the specified database file and port.

If the server does not need to listen on a port because it will only be used in embedded mode with ObjectServer.openClient , specify '0' as the port number.
Parameters:
  databaseFileName - an absolute or relative path to the database file
Parameters:
  port - the port to be used, or 0, if the server should not open a port,because it will only be used with ObjectServer.openClient an ObjectServer ObjectServer listeningon the specified port.
See Also:   Configuration.readOnly
See Also:   Configuration.encrypt
See Also:   Configuration.password
throws:
  Db4oException -



openServer
ObjectServer openServer(Configuration config, String databaseFileName, int port) throws Db4oException(Code)
opens an ObjectServer ObjectServer on the specified database file and port.

If the server does not need to listen on a port because it will only be used in embedded mode with ObjectServer.openClient , specify '0' as the port number.
Parameters:
  config - a custom Configuration Configuration instance to be obtained via Db4o.newConfiguration
Parameters:
  databaseFileName - an absolute or relative path to the database file
Parameters:
  port - the port to be used, or 0, if the server should not open a port,because it will only be used with ObjectServer.openClient an ObjectServer ObjectServer listeningon the specified port.
See Also:   Configuration.readOnly
See Also:   Configuration.encrypt
See Also:   Configuration.password
throws:
  Db4oException -



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.