ObjectDB ObjectDB

Start ObjectDB inside java code.

#1

I am building an MMORPG with ObjectDB, and I use it both for the saving of character and inventory (permanent object), but also the storing of ability and maps information (object I load, use, and dispose and then reuse without having change anything). The problems is, as my server and client both run on the same machine and more than one client can be started, they all need access to this information without being able to share any thread, so am forced to use the server model.

Yet, I can't seem to find a way to automatically start the server mode, and i can't really expect the player to manually start the server, and I still need a way to do so. Is it my architecture that cause problem or am simply missing something?

edit
delete
#2

Since the ObjectDB server is a Java program, you should be able to run it also from your own code by calling the main method directly:

    com.objectdb.Server.main(...);

See also an option to use an embedded-server mode.

 

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
edit
delete
#3

Thanks! I can now start the server.

My next question might sound a bit amateur but how and where do i activate those line of code now? i mean where do i put the

<server>
        <connection port="6136" max="100" />
        <data path="$objectdb/db" />
        <embedded-server enabled="true" />
<server/>

I did try

String [] test = new String[1] ;
  test[0] = "start";

  com.objectdb.Server.main
  (test) ;

And it work, but as soon as i try something like :

 

String [] test = new String[2] ;
  test[0] = "connection port=6136 max=100" ;
  test[1] = "start";

  com.objectdb.Server.main
  (test) ;

It tell me : Invalid Server argument: Unknown server command or argument: connection port=6136 max=100 (error 531)

Am not sure this is the right place to ask the question and am sorry if not, but I don't seem to be able to find the require information.

 

edit
delete
#4

You still need a separate configuration file.

Only the path of that this configuration file is provided as argument to main (using -conf), not its content.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
edit
delete

Reply

To post on this website please sign in.