diff options
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf')
3 files changed, 408 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/AbstractRepositoryProperties.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/AbstractRepositoryProperties.java new file mode 100644 index 0000000000..d4ac2b1c6a --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/AbstractRepositoryProperties.java @@ -0,0 +1,324 @@ +/* + * Copyright (c) 2011-2013, 2015, 2016 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 + * Christian W. Damus (CEA LIST) - bug 418452 + */ +package org.eclipse.emf.cdo.internal.common; + +import org.eclipse.emf.cdo.common.CDOCommonRepository; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.id.CDOID.ObjectType; +import org.eclipse.emf.cdo.common.util.CDOCommonUtil; +import org.eclipse.emf.cdo.internal.common.messages.Messages; + +import org.eclipse.net4j.util.AdapterUtil; +import org.eclipse.net4j.util.properties.Properties; +import org.eclipse.net4j.util.properties.Property; + +import org.eclipse.core.runtime.IProgressMonitor; + +import java.util.Set; + +/** + * @author Eike Stepper + */ +public abstract class AbstractRepositoryProperties<RECEIVER> extends Properties<RECEIVER> implements CDOCommonRepository +{ + private static final String CATEGORY_REPOSITORY = "Repository"; //$NON-NLS-1$ + + public AbstractRepositoryProperties(Class<RECEIVER> receiverType) + { + super(receiverType); + initProperties(); + } + + protected abstract CDOCommonRepository getRepository(RECEIVER receiver); + + protected void initProperties() + { + add(new Property<RECEIVER>("repositoryName", Messages.getString("RepositoryPropertyTester_10"), // + Messages.getString("RepositoryPropertyTester_11"), //$NON-NLS-1$ + CATEGORY_REPOSITORY) + { + @Override + protected Object eval(RECEIVER receiver) + { + return getRepository(receiver).getName(); + } + }); + + add(new Property<RECEIVER>("repositoryUUID", Messages.getString("RepositoryPropertyTester_12"), // + Messages.getString("RepositoryPropertyTester_13"), //$NON-NLS-1$ + CATEGORY_REPOSITORY) + { + @Override + protected Object eval(RECEIVER receiver) + { + return getRepository(receiver).getUUID(); + } + }); + + add(new Property<RECEIVER>("repositoryType", Messages.getString("RepositoryPropertyTester_14"), // + Messages.getString("RepositoryPropertyTester_15"), //$NON-NLS-1$ + CATEGORY_REPOSITORY) + { + @Override + protected Object eval(RECEIVER receiver) + { + return getRepository(receiver).getType(); + } + }); + + add(new Property<RECEIVER>("repositoryState", Messages.getString("RepositoryPropertyTester_16"), // + Messages.getString("RepositoryPropertyTester_17"), //$NON-NLS-1$ + CATEGORY_REPOSITORY) + { + @Override + protected Object eval(RECEIVER receiver) + { + return getRepository(receiver).getState(); + } + }); + + add(new Property<RECEIVER>("repositoryCreationTime", Messages.getString("RepositoryPropertyTester_18"), // + Messages.getString("RepositoryPropertyTester_19"), //$NON-NLS-1$ + CATEGORY_REPOSITORY) + { + @Override + protected Object eval(RECEIVER receiver) + { + return CDOCommonUtil.formatTimeStamp(getRepository(receiver).getCreationTime()); + } + }); + + add(new Property<RECEIVER>("authenticating", Messages.getString("RepositoryPropertyTester_40"), // + Messages.getString("RepositoryPropertyTester_41"), //$NON-NLS-1$ + CATEGORY_REPOSITORY) + { + @Override + protected Object eval(RECEIVER receiver) + { + return getRepository(receiver).isAuthenticating(); + } + }); + + add(new Property<RECEIVER>("supportingAudits", Messages.getString("RepositoryPropertyTester_20"), // + Messages.getString("RepositoryPropertyTester_21"), //$NON-NLS-1$ + CATEGORY_REPOSITORY) + { + @Override + protected Object eval(RECEIVER receiver) + { + return getRepository(receiver).isSupportingAudits(); + } + }); + + add(new Property<RECEIVER>("supportingBranches", Messages.getString("RepositoryPropertyTester_22"), // + Messages.getString("RepositoryPropertyTester_23"), //$NON-NLS-1$ + CATEGORY_REPOSITORY) + { + @Override + protected Object eval(RECEIVER receiver) + { + return getRepository(receiver).isSupportingBranches(); + } + }); + + add(new Property<RECEIVER>("supportingUnits", Messages.getString("RepositoryPropertyTester_28"), // + Messages.getString("RepositoryPropertyTester_29"), //$NON-NLS-1$ + CATEGORY_REPOSITORY) + { + @Override + protected Object eval(RECEIVER receiver) + { + return getRepository(receiver).isSupportingBranches(); + } + }); + + add(new Property<RECEIVER>("serializeCommits", Messages.getString("RepositoryPropertyTester_38"), // + Messages.getString("RepositoryPropertyTester_39"), //$NON-NLS-1$ + CATEGORY_REPOSITORY) + { + @Override + protected Object eval(RECEIVER receiver) + { + return getRepository(receiver).isSerializingCommits(); + } + }); + + add(new Property<RECEIVER>("ensureReferentialIntegrity", Messages.getString("RepositoryPropertyTester_30"), // + Messages.getString("RepositoryPropertyTester_31"), //$NON-NLS-1$ + CATEGORY_REPOSITORY) + { + @Override + protected Object eval(RECEIVER receiver) + { + return getRepository(receiver).isEnsuringReferentialIntegrity(); + } + }); + + add(new Property<RECEIVER>("idGenerationLocation", Messages.getString("RepositoryPropertyTester_32"), // + Messages.getString("RepositoryPropertyTester_33"), //$NON-NLS-1$ + CATEGORY_REPOSITORY) + { + @Override + protected Object eval(RECEIVER receiver) + { + return getRepository(receiver).getIDGenerationLocation(); + } + }); + + add(new Property<RECEIVER>("commitInfoStorage", Messages.getString("RepositoryPropertyTester_42"), // + Messages.getString("RepositoryPropertyTester_43"), //$NON-NLS-1$ + CATEGORY_REPOSITORY) + { + @Override + protected Object eval(RECEIVER receiver) + { + return getRepository(receiver).getCommitInfoStorage(); + } + }); + + add(new Property<RECEIVER>("storeType", Messages.getString("RepositoryPropertyTester_24"), // + Messages.getString("RepositoryPropertyTester_25"), //$NON-NLS-1$ + CATEGORY_REPOSITORY) + { + @Override + protected Object eval(RECEIVER receiver) + { + return getRepository(receiver).getStoreType(); + } + }); + + add(new Property<RECEIVER>("objectIDTypes", Messages.getString("RepositoryPropertyTester_26"), // + Messages.getString("RepositoryPropertyTester_27"), //$NON-NLS-1$ + CATEGORY_REPOSITORY) + { + @Override + protected Object eval(RECEIVER receiver) + { + StringBuilder builder = new StringBuilder(); + CDOCommonRepository repository = getRepository(receiver); + for (CDOID.ObjectType objectIDType : repository.getObjectIDTypes()) + { + if (builder.length() != 0) + { + builder.append(", "); //$NON-NLS-1$ + } + + builder.append(objectIDType); + } + + return builder; + } + }); + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + public Object getAdapter(Class adapter) + { + return AdapterUtil.adapt(this, adapter, false); + } + + public long getTimeStamp() + { + throw new UnsupportedOperationException(); + } + + public String getName() + { + throw new UnsupportedOperationException(); + } + + public String getUUID() + { + throw new UnsupportedOperationException(); + } + + public Type getType() + { + throw new UnsupportedOperationException(); + } + + public State getState() + { + throw new UnsupportedOperationException(); + } + + public long getCreationTime() + { + throw new UnsupportedOperationException(); + } + + public String getStoreType() + { + throw new UnsupportedOperationException(); + } + + public Set<ObjectType> getObjectIDTypes() + { + throw new UnsupportedOperationException(); + } + + public IDGenerationLocation getIDGenerationLocation() + { + throw new UnsupportedOperationException(); + } + + public CommitInfoStorage getCommitInfoStorage() + { + throw new UnsupportedOperationException(); + } + + public CDOID getRootResourceID() + { + throw new UnsupportedOperationException(); + } + + public boolean isAuthenticating() + { + throw new UnsupportedOperationException(); + } + + public boolean isSupportingAudits() + { + throw new UnsupportedOperationException(); + } + + public boolean isSupportingBranches() + { + throw new UnsupportedOperationException(); + } + + public boolean isSupportingUnits() + { + throw new UnsupportedOperationException(); + } + + @Deprecated + public boolean isSupportingEcore() + { + throw new UnsupportedOperationException(); + } + + public boolean isSerializingCommits() + { + throw new UnsupportedOperationException(); + } + + public boolean isEnsuringReferentialIntegrity() + { + throw new UnsupportedOperationException(); + } + + public boolean waitWhileInitial(IProgressMonitor monitor) + { + throw new UnsupportedOperationException(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/RepositoryProperties.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/RepositoryProperties.java new file mode 100644 index 0000000000..458ae7461c --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/RepositoryProperties.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2011-2013, 2015, 2016 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 + * Christian W. Damus (CEA LIST) - bug 418452 + */ +package org.eclipse.emf.cdo.internal.common; + +import org.eclipse.emf.cdo.common.CDOCommonRepository; + +import org.eclipse.net4j.util.properties.DefaultPropertyTester; +import org.eclipse.net4j.util.properties.IProperties; + +/** + * @author Eike Stepper + */ +public class RepositoryProperties extends AbstractRepositoryProperties<CDOCommonRepository> +{ + public static final IProperties<CDOCommonRepository> INSTANCE = new RepositoryProperties(); + + private RepositoryProperties() + { + super(CDOCommonRepository.class); + } + + @Override + protected CDOCommonRepository getRepository(CDOCommonRepository receiver) + { + return receiver; + } + + public static void main(String[] args) + { + new Tester().dumpContributionMarkup(); + } + + /** + * @author Eike Stepper + */ + public static final class Tester extends DefaultPropertyTester<CDOCommonRepository> + { + public static final String NAMESPACE = "org.eclipse.emf.cdo.repository"; + + public Tester() + { + super(NAMESPACE, INSTANCE); + } + } +} diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/messages.properties b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/messages.properties index 660a655580..1120c649cf 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/messages.properties +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/messages.properties @@ -38,3 +38,33 @@ DLRevisionList.3=Holder {0} is still linked in different list DLRevisionList.5=Holder {0} does not belong to this list LRURevisionHolder.0=Not a {0}: {1} MEMRevisionCache.1=Invalid referenceType: {0} +RepositoryPropertyTester_10=Name +RepositoryPropertyTester_11=The name of the repository. +RepositoryPropertyTester_12=UUID +RepositoryPropertyTester_13=The UUID of the repository. +RepositoryPropertyTester_14=Type +RepositoryPropertyTester_15=The type of the repository. One of MASTER, BACKUP, CLONE. +RepositoryPropertyTester_16=State +RepositoryPropertyTester_17=The state of the repository. One of OFFLINE, SYNCING, ONLINE. +RepositoryPropertyTester_18=Creation Time +RepositoryPropertyTester_19=The creation time of the repository. +RepositoryPropertyTester_20=Supporting Audits +RepositoryPropertyTester_21=Whether the repository supports auditing. +RepositoryPropertyTester_22=Supporting Branches +RepositoryPropertyTester_23=Whether the repository supports branching. +RepositoryPropertyTester_24=Store Type +RepositoryPropertyTester_25=The type of the store that backs the repository. +RepositoryPropertyTester_26=Object ID Types +RepositoryPropertyTester_27=The types of object IDs created by the store that backs the repository. +RepositoryPropertyTester_28=Supporting Units +RepositoryPropertyTester_29=Whether the repository supports units. +RepositoryPropertyTester_30=Ensure Referential Integrity +RepositoryPropertyTester_31=Whether the repository is ensuring referential integrity. +RepositoryPropertyTester_32=ID Generation Location +RepositoryPropertyTester_33=One of STORE, CLIENT. +RepositoryPropertyTester_38=Serialize Commits +RepositoryPropertyTester_39=Whether the repository is serializing commits. +RepositoryPropertyTester_40=Authenticating +RepositoryPropertyTester_41=Whether the repository is authenticating users. +RepositoryPropertyTester_42=Commit Info Storage +RepositoryPropertyTester_43=One of NO, YES, WITH_MERGE_SOURCE. |