diff options
author | Eike Stepper | 2010-09-04 05:34:10 +0000 |
---|---|---|
committer | Eike Stepper | 2010-09-04 05:34:10 +0000 |
commit | 65f4b0c0f7134da1b8853e37b01f3aebf8eaccdc (patch) | |
tree | 943ee4f5670e3fe1258b9a24ebdcd09f49cb5cd9 /plugins/org.eclipse.emf.cdo.efs | |
parent | 47f53cec07da2740c9127980f39ff750993ff94d (diff) | |
download | cdo-65f4b0c0f7134da1b8853e37b01f3aebf8eaccdc.tar.gz cdo-65f4b0c0f7134da1b8853e37b01f3aebf8eaccdc.tar.xz cdo-65f4b0c0f7134da1b8853e37b01f3aebf8eaccdc.zip |
*** empty log message ***
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.efs')
4 files changed, 9 insertions, 233 deletions
diff --git a/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDOFileRoot.java b/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDOFileRoot.java index 600640b171..eebb8bb9d6 100644 --- a/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDOFileRoot.java +++ b/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDOFileRoot.java @@ -50,8 +50,7 @@ public final class CDOFileRoot extends AbstractFileStore private transient CDOView view; - public CDOFileRoot(CDOFileSystem fileSystem, String authority, String repositoryName, IPath branchPath, - long timeStamp) + public CDOFileRoot(CDOFileSystem fileSystem, String authority, String repositoryName, IPath branchPath, long timeStamp) { this.fileSystem = fileSystem; this.authority = authority; diff --git a/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDOFileStore.java b/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDOFileStore.java index b8b12434e7..2682a9593b 100644 --- a/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDOFileStore.java +++ b/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDOFileStore.java @@ -52,9 +52,9 @@ public final class CDOFileStore extends AbstractFileStore private IPath path; - public CDOFileStore(CDOFileRoot rootStore, IPath path) + public CDOFileStore(CDOFileRoot root, IPath path) { - this.root = rootStore; + this.root = root; this.path = path; } diff --git a/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDOFileSystem.java b/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDOFileSystem.java index cdb7c31638..3dbe7a0dce 100644 --- a/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDOFileSystem.java +++ b/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDOFileSystem.java @@ -108,16 +108,16 @@ public abstract class CDOFileSystem extends FileSystem return root.getFileStore(path); } - public CDOView getView(CDOFileRoot rootStore) + public CDOView getView(CDOFileRoot root) { - URI uri = rootStore.toURI(); + URI uri = root.toURI(); CDOView view = views.get(uri); if (view == null) { - String authority = rootStore.getAuthority(); - String repositoryName = rootStore.getRepositoryName(); - String branchPath = rootStore.getBranchPath().toPortableString(); - long timeStamp = rootStore.getTimeStamp(); + String authority = root.getAuthority(); + String repositoryName = root.getRepositoryName(); + String branchPath = root.getBranchPath().toPortableString(); + long timeStamp = root.getTimeStamp(); CDOSession session = getSession(authority, repositoryName); CDOBranchManager branchManager = session.getBranchManager(); diff --git a/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDORootStore.java b/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDORootStore.java deleted file mode 100644 index c93ece100b..0000000000 --- a/plugins/org.eclipse.emf.cdo.efs/src/org/eclipse/emf/cdo/internal/efs/CDORootStore.java +++ /dev/null @@ -1,223 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation 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: - * IBM Corporation - initial API and implementation - * Martin Oberhuber (Wind River) - [294429] Avoid substring baggage in FileInfo - *******************************************************************************/ -package org.eclipse.emf.cdo.internal.efs; - -import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; -import org.eclipse.emf.cdo.eresource.CDOResourceNode; -import org.eclipse.emf.cdo.view.CDOView; - -import org.eclipse.net4j.util.ObjectUtil; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.core.filesystem.EFS; -import org.eclipse.core.filesystem.IFileInfo; -import org.eclipse.core.filesystem.IFileStore; -import org.eclipse.core.filesystem.provider.FileInfo; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; - -import java.io.InputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; - -/** - * @author Eike Stepper - */ -public final class CDORootStore extends AbstractFileStore -{ - private CDOFileSystem fileSystem; - - private String authority; - - private String repositoryName; - - private IPath branchPath; - - private long timeStamp; - - private transient CDOView view; - - public CDORootStore(CDOFileSystem fileSystem, String authority, String repositoryName, IPath branchPath, - long timeStamp) - { - this.fileSystem = fileSystem; - this.authority = authority; - this.repositoryName = repositoryName; - this.branchPath = branchPath; - this.timeStamp = timeStamp; - } - - @Override - public CDOFileSystem getFileSystem() - { - return fileSystem; - } - - public String getAuthority() - { - return authority; - } - - public String getRepositoryName() - { - return repositoryName; - } - - public IPath getBranchPath() - { - return branchPath; - } - - public long getTimeStamp() - { - return timeStamp; - } - - @Override - public IPath getPath() - { - return Path.EMPTY; - } - - @Override - public CDOView getView() - { - if (view == null) - { - view = fileSystem.getView(this); - } - - return view; - } - - @Override - protected CDOResourceNode doGetResourceNode() - { - return getView().getRootResource(); - } - - @Override - public IFileStore getParent() - { - return null; - } - - @Override - public String getName() - { - return ""; - } - - @Override - public IFileInfo fetchInfo(int options, IProgressMonitor monitor) - { - FileInfo info = new FileInfo(getName()); - info.setLastModified(EFS.NONE); - info.setExists(true); // Root resource is always present - info.setLength(EFS.NONE); - info.setDirectory(true); - info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, false); - return info; - } - - @Override - public IFileStore getChild(IPath path) - { - return new CDOFileStore(this, path); - } - - @Override - public IFileStore getChild(String name) - { - return getChild(new Path(name)); - } - - @Override - public String[] childNames(int options, IProgressMonitor monitor) throws CoreException - { - List<String> result = new ArrayList<String>(); - - for (EObject object : getView().getRootResource().getContents()) - { - if (object instanceof CDOResourceNode) - { - CDOResourceNode node = (CDOResourceNode)object; - result.add(node.getName()); - } - } - - return result.toArray(new String[result.size()]); - } - - @Override - public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException - { - throw new UnsupportedOperationException(); - } - - @Override - public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException - { - throw new UnsupportedOperationException(); - } - - @Override - public boolean equals(Object obj) - { - if (obj == this) - { - return true; - } - - if (obj.getClass() == CDORootStore.class) - { - CDORootStore that = (CDORootStore)obj; - if (view != null && view == that.view) - { - // Optimization - return true; - } - - return authority.equals(that.authority) && repositoryName.equals(that.repositoryName) - && branchPath.equals(that.branchPath) && timeStamp == that.timeStamp; - } - - return false; - } - - @Override - protected int createHashCode() - { - return authority.hashCode() ^ repositoryName.hashCode() ^ branchPath.hashCode() ^ ObjectUtil.hashCode(timeStamp); - } - - @Override - public void appendURI(StringBuilder builder) - { - builder.append(fileSystem.getScheme()); - builder.append("://"); - builder.append(authority); - builder.append("/"); - builder.append(repositoryName); - builder.append("/"); - builder.append(branchPath.toPortableString()); - builder.append("/@"); - if (timeStamp != CDOBranchPoint.UNSPECIFIED_DATE) - { - builder.append(timeStamp); - } - } -} |