1 17 package org.apache.ws.jaxme.sqls.db2; 18 19 import java.util.ArrayList ; 20 import java.util.Iterator ; 21 import java.util.List ; 22 23 import org.apache.ws.jaxme.sqls.impl.SQLFactoryImpl; 24 25 26 30 public class TableSpaceImpl implements TableSpace { 31 public static class NameImpl extends SQLFactoryImpl.IdentImpl 32 implements TableSpace.Name { 33 public NameImpl(String pName) { super(pName); } 34 } 35 36 public static class SystemManagedContainerImpl implements TableSpace.SystemManagedContainer { 37 private String file; 38 public boolean isSystemManaged() { return true; } 39 public boolean isDatabaseManaged() { return false; } 40 public String getFile() { return file; } 41 public void setFile(String pFile) { file = pFile; } 42 } 43 44 public static class DatabaseManagedContainerImpl implements TableSpace.DatabaseManagedContainer { 45 private String file; 46 private String device; 47 private long numPages; 48 public boolean isSystemManaged() { return false; } 49 public boolean isDatabaseManaged() { return true; } 50 public void setFile(String pFile) { file = pFile; } 51 public String getFile() { return file; } 52 public void setDevice(String pDevice) { device = pDevice; } 53 public String getDevice() { return device; } 54 public long getNumOfPages() { return numPages; } 55 public void setNumOfPages(long pNumOfPages) { numPages = pNumOfPages; } 56 } 57 58 private DB2SQLFactory sqlFactory; 59 private BufferPool bufferPool; 60 private TableSpace.Name name; 61 private TableSpace.Type type; 62 private List containers = new ArrayList (); 63 private Long extentSize, prefetchSize; 64 private PageSize pageSize; 65 private Number overhead, transferRate; 66 private Boolean droppedTableRecovery; 67 68 protected TableSpaceImpl(DB2SQLFactory pFactory, TableSpace.Name pName, 69 TableSpace.Type pType) { 70 sqlFactory = pFactory; 71 name = pName; 72 type = pType; 73 } 74 75 public DB2SQLFactory getSQLFactory() { return sqlFactory; } 76 public TableSpace.Name getName() { return name; } 77 public TableSpace.Type getType() { return type; } 78 public PageSize getPageSize() { 79 BufferPool bPool = getBufferPool(); 80 return bPool == null ? pageSize : bPool.getPageSize(); 81 } 82 public void setPageSize(PageSize pSize) { pageSize = pSize; } 83 public Long getExtentSize() { return extentSize; } 84 public void setExtentSize(Long pSize) { extentSize = pSize; } 85 public Long getPrefetchSize() { return prefetchSize; } 86 public void setPrefetchSize(Long pSize) { prefetchSize = pSize; } 87 public Number getOverhead() { return overhead; } 88 public void setOverhead(Number pOverhead) { overhead = pOverhead; } 89 public Number getTransferRate() { return transferRate; } 90 public void setTransferRate(Number pTransferRate) { transferRate = pTransferRate; } 91 public Boolean hasDroppedTableRecovery() { return droppedTableRecovery; } 92 public void setDroppedTableRecovery(Boolean pRecoverable) { droppedTableRecovery = pRecoverable; } 93 public boolean isPredefined() { return false; } 94 95 public Container newSystemManagedContainer(String pFile) { 96 SystemManagedContainerImpl container = new SystemManagedContainerImpl(); 97 container.setFile(pFile); 98 containers.add(container); 99 return container; 100 } 101 102 public Container newDatabaseManagedContainerInFile(String pFile, long pNumPages) { 103 DatabaseManagedContainerImpl container = new DatabaseManagedContainerImpl(); 104 container.setFile(pFile); 105 container.setNumOfPages(pNumPages); 106 containers.add(container); 107 return container; 108 } 109 110 public Container newDatabaseManagedContainerInDevice(String pDevice, long pNumPages) { 111 DatabaseManagedContainerImpl container = new DatabaseManagedContainerImpl(); 112 container.setDevice(pDevice); 113 container.setNumOfPages(pNumPages); 114 containers.add(container); 115 return container; 116 } 117 118 public Iterator getContainers() { 119 return containers.iterator(); 120 } 121 122 public void setBufferPool(BufferPool pBufferPool) { 123 bufferPool = pBufferPool; 124 } 125 126 public BufferPool getBufferPool() { 127 return bufferPool; 128 } 129 } 130 | Popular Tags |