1 10 11 package com.triactive.jdo.store; 12 13 import java.sql.Connection ; 14 import java.sql.SQLException ; 15 import java.util.List ; 16 import javax.jdo.JDOFatalInternalException; 17 18 19 class JDOView extends View implements JDOTable 20 { 21 protected final int tableID; 22 protected final String javaName; 23 24 private int nextHiValue = -1; 25 private int nextLoValue = -1; 26 27 28 JDOView(TableMetadata tmd, StoreManager storeMgr) 29 { 30 super(tmd.tableName, storeMgr); 31 32 this.tableID = tmd.tableID; 33 this.javaName = tmd.javaName; 34 } 35 36 37 public void initialize() 38 { 39 assertIsUninitialized(); 40 41 state = TABLE_STATE_INITIALIZED; 42 } 43 44 45 protected List getSQLCreateStatements() 46 { 47 throw new JDOFatalInternalException("Cannot create view for a generic JDOView object"); 48 } 49 50 51 public int getTableID() 52 { 53 return tableID; 54 } 55 56 57 public String getJavaName() 58 { 59 return javaName; 60 } 61 62 63 public synchronized final OID newOID() 64 { 65 if (nextHiValue < 0) 66 { 67 nextHiValue = 0; 68 nextLoValue = 0; 69 } 70 71 OID id = new OID(tableID, nextHiValue, nextLoValue); 72 73 if (nextLoValue == OID.MAX_OBJIDLO) 74 nextHiValue = nextLoValue = -1; 75 else 76 ++nextLoValue; 77 78 return id; 79 } 80 } 81 | Popular Tags |