1 22 23 28 29 package org.xquark.mapper.metadata; 30 31 import org.xquark.mapper.dbms.TableSpecLoader; 32 33 35 36 public class RepositoryInfo implements Cloneable 37 { 38 private static final String RCSRevision = "$Revision: 1.1 $"; 39 private static final String RCSName = "$Name: $"; 40 41 43 protected String name = "XQuark"; 44 45 protected byte colIDSize = RepositoryConstants.CID_SIZE_DEFAULT_VALUE; 46 47 protected String version = TableSpecLoader.REPOSITORY_DATA_VERSION; 48 49 public RepositoryInfo() 50 { 51 } 52 53 public RepositoryInfo(String name, byte colIDSize) 54 { 55 this.name = name; 56 setColIDSize(colIDSize); 57 } 58 59 62 public String toString() 63 { 64 StringBuffer buffer = new StringBuffer (); 65 66 buffer.append("\nName :\t"); 67 buffer.append(name); 68 buffer.append("\nCollection ID size in bits:\t"); 69 buffer.append(colIDSize); 70 buffer.append("\nModel version :\t"); 71 buffer.append(version); 72 buffer.append("\n"); 73 74 return buffer.toString(); 75 } 76 77 80 public Object clone() 81 { 82 Object copy = null; 83 try { 84 copy = super.clone(); 85 } 86 catch(CloneNotSupportedException e) { 87 } 88 return copy; 89 } 90 91 public String getName() 92 { 93 return name; 94 } 95 96 public String getVersion() 97 { 98 return version; 99 } 100 101 public byte getColIDSize() 102 { 103 return colIDSize; 104 } 105 106 public short getColIDMaxValue() 107 { 108 return (short)((1 << colIDSize) - 1); 109 } 110 111 public void setName(String name) 112 { 113 this.name = name; 114 } 115 116 public void setVersion(String version) 117 { 118 this.version = version; 119 } 120 121 public void setColIDSize(byte colSize) 122 { 123 if (colSize < RepositoryConstants.CID_SIZE_MIN_VALUE) 124 colIDSize = RepositoryConstants.CID_SIZE_MIN_VALUE; 125 else if (colSize > RepositoryConstants.CID_SIZE_MAX_VALUE) 126 colIDSize = RepositoryConstants.CID_SIZE_MAX_VALUE; 127 else 128 colIDSize = colSize; 129 } 130 } 131 | Popular Tags |