diff options
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server.lissome/src/org/eclipse/emf/cdo/server/internal/lissome/db/Table.java')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.server.lissome/src/org/eclipse/emf/cdo/server/internal/lissome/db/Table.java | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.lissome/src/org/eclipse/emf/cdo/server/internal/lissome/db/Table.java b/plugins/org.eclipse.emf.cdo.server.lissome/src/org/eclipse/emf/cdo/server/internal/lissome/db/Table.java new file mode 100644 index 0000000000..55654dc21e --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server.lissome/src/org/eclipse/emf/cdo/server/internal/lissome/db/Table.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.server.internal.lissome.db; + +import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation; +import org.eclipse.emf.cdo.server.internal.lissome.LissomeStore; +import org.eclipse.emf.cdo.spi.server.InternalRepository; + +import org.eclipse.net4j.db.DBType; +import org.eclipse.net4j.db.ddl.IDBField; +import org.eclipse.net4j.db.ddl.IDBTable; + +/** + * @author Eike Stepper + */ +public class Table +{ + protected Index index; + + protected IDBTable table; + + public Table(Index index, String name) + { + this.index = index; + table = index.addTable(name); + } + + public Index getIndex() + { + return index; + } + + public LissomeStore getStore() + { + return index.getStore(); + } + + public InternalRepository getRepository() + { + return getStore().getRepository(); + } + + public IDGenerationLocation getIDGenerationLocation() + { + return getRepository().getIDGenerationLocation(); + } + + public boolean isSupportingAudits() + { + return getRepository().isSupportingAudits(); + } + + public boolean isSupportingBranches() + { + return getRepository().isSupportingBranches(); + } + + @Override + public String toString() + { + return table.toString(); + } + + protected IDBField addCDOIDField(String name) + { + if (getIDGenerationLocation() == IDGenerationLocation.CLIENT) + { + return table.addField(name, DBType.BINARY, 64); + } + + return table.addField(name, DBType.BIGINT); + } +} |