Ozone Apirak | 9 Apr 2004 04:54
Picon

Re: My object disappear when I restart ozone.

:)

I don't know why but the problems came only when I use LocalConnection. 
I can't call my object after I restart my database (by ctrl-c). I can 
restart my application and it work well if I don't restart my db.

please, help me.
This is my simple code (only meta data part)

Attachment (testozone.tar.gz): application/x-gzip, 8 KiB

public class MetTest {
	
	private static MetCollection metc = null;
	private static OzoneInterface db = null;
	
	final String ObjName = "met50";
	
	public void init(OzoneInterface database){
		db = database;

		String name = MetCollectionImpl.class.getName();

		Object obj = null;

		try{

		  System.out.println("looking Object name "+ObjName+" from db");
		  obj = db.objectForName(ObjName);
		  metc = (MetCollection)obj;
		  System.out.println("get "+metc.getName()+" read ");
		  testRead();
		  testReadComplicate();
		  testDelete();

		}catch(Exception e){
		  try { //Create new DB
			  System.out.println("can't looking for object because: "+e);
			  obj = db.createObject(name, 0,ObjName);
			  System.out.println("create obj name:"+ obj);

			  metc = (MetCollection) obj;

			  metc.setName("OzoneMetBroker2");
			  System.out.println("ObjectDB name: "+metc.getName()+" was created 
by me");

			  testCreate();
		  } catch(Exception e2) {
			  System.out.println("Can't create DB: "+ e2);
		  }
		}
	}

....
...

	public static void main(String[] args) throws Exception{

	  System.out.println("Start Local");

	  String dbDir = "/java/testozone/ozon";
	  System.out.println("Opening database at "+ dbDir);

	  LocalDatabase database = new LocalDatabase();
	  if (!database.exists(dbDir)){
		database.create(dbDir);
	  }
	  database.open(dbDir, OzoneDebugLevel.ERROR_STR);

	  database.reloadClasses();
	  System.out.println("connect to ozone complete: "+database);

	  MetTest msi = new MetTest();
	  msi.init(database);

           database.close();
	  System.out.println("end test");
	}
}

Thank you.

Apirak Panatkool

e-mail bank <at> apirak.com
phone 01-4033320
On Apr 8, 2004, at 11:21 PM, Dr Brendan Gowing wrote:

>
>> I try 1.2rc already. It's still disappear for local.
>
> If you send me more of your code, the rest of the class shown below and
> the MetCollection class, I'll look into it for you. Otherwise it's 
> quite
> hard to determine what is going on but it would seem to be a 
> programming
> problem and not necessarilly an Ozone issue.
>
> -BG
>
>>
>> it return null when I call.
>>
>>            try { //Create new DB
>>                System.out.println("can't looking for object because:
>> "+e);
>>                obj = db.createObject(name, 0,ObjName);
> [...]
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
> _______________________________________________
> Ozone-users mailing list
> Ozone-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ozone-users

Gmane