0

I want to create some kind of grid of javaee applications. To identify each device i would generate an uuid on first start, but what is a good practice to store it?

i am using javaee 7 (wildfly) as platform. Is there probably a "native" javaee way or one specific to wildfly? I don't want to use database (jpa) for a single uuid. If there is a ways that don't need further configuration (set path, datasources, properties) it would be fine.

thanks in advance

dermoritz
  • 12,519
  • 25
  • 97
  • 185
  • Could you just use something like an md5 hash of modes node's ip address? – Will Tatam Jul 26 '15 at 16:20
  • No real alternative to everything you're eschewing. If you want durable storage, you're going to have to do the work. The JavaEE spec doesn't cater to storage (that I'm aware of anyway). – kolossus Jul 26 '15 at 17:26
  • Java EE spec does cover the storage - via JPA. But to store a single string jpa is too much isn't it? – dermoritz Jul 27 '15 at 06:56

1 Answers1

0

your major problem is to store the device id . And you don't want to use any kind of DB?

Cording to me use JSON or XML file for storing so you can use in memory object, which stores the new device id at the run time and while can write into the the a file every time the application is shutdown or the server is shutdown. If this doesn't seems effective as the server or the application can get shutdown due many reason and u need to take care of all those . So its better go with writing into file on the interval of certain time.

Next time when the application is restarted load the JSON or XML in the in memory object. and keep the file appending.

gauravprasad
  • 11
  • 1
  • 4
  • The problem with file is: there is no Java EE complient way to access files - i know about? I want not to bring any configuration need to the customer. – dermoritz Jul 27 '15 at 06:58
  • Very true , there is no java EE compliment way . But if i m not wrong the challenge will only be with class path of the file. But if we are to set the file path with code itself i don think we need any configurational change. This is my personal view try doing that . I don think we have to make any server specific change . I might be wrong . I will even try doing the same once. :) – gauravprasad Jul 27 '15 at 19:42
  • that is the core of my question: is there a path where i can store a file? A path writable on all machines and servers (in my case wildfly is sufficient). – dermoritz Jul 28 '15 at 06:41