1 26 27 package org.objectweb.openccm.pss.runtime.hibernate.lib; 28 29 36 37 public abstract class StorageObjectBase 38 extends org.objectweb.openccm.pss.runtime.common.lib.StorageObjectBase 39 implements org.objectweb.openccm.pss.runtime.hibernate.api.StorageObject 40 { 41 47 53 56 public StorageObjectBase() 57 { 58 super(); 59 } 60 61 69 private String 70 create_short_pid() 71 { 72 org.objectweb.openccm.pss.runtime.hibernate.api.CatalogBase catalog = null; 73 net.sf.hibernate.Session session = null; 74 75 catalog = (org.objectweb.openccm.pss.runtime.hibernate.api.CatalogBase) 77 get_storage_home().get_catalog(); 78 session = catalog.get_hibernate_session(); 79 80 try { 81 return session.getIdentifier(this).toString(); 82 } catch (net.sf.hibernate.HibernateException ex) { 83 throw new RuntimeException (ex); 84 } 85 } 86 87 88 94 100 103 public void 104 destroy_object() 105 { 106 org.objectweb.openccm.pss.runtime.hibernate.api.CatalogBase catalog = null; 107 net.sf.hibernate.Session session = null; 108 109 catalog = (org.objectweb.openccm.pss.runtime.hibernate.api.CatalogBase) 111 get_storage_home().get_catalog(); 112 session = catalog.get_hibernate_session(); 113 114 catalog.begin_tx(); 116 try { 117 session.delete(this); 118 } catch (net.sf.hibernate.HibernateException ex) { 119 throw new RuntimeException (ex); 120 } 121 catalog.commit_tx(); 122 } 123 124 132 public byte[] 133 get_pid() 134 { 135 if (_pid == null) 136 { 137 org.objectweb.openccm.pss.runtime.hibernate.api.StorageHomeBase sh = null; 138 139 sh = (org.objectweb.openccm.pss.runtime.hibernate.api.StorageHomeBase) get_storage_home(); 140 _pid = sh.create_pid( create_short_pid() ); 141 } 142 return _pid; 143 } 144 145 146 152 } 153 | Popular Tags |