Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-09-06 11:47:08 +0000
committerEike Stepper2012-09-06 11:47:08 +0000
commitcfdef9afcf736cd872cd784647c25c52b653a7bb (patch)
tree07c9bb370e7cea69c0eb8e06737a74bd70d534f7 /plugins/org.eclipse.emf.cdo.transfer/src
parent3224388d98796036d49cc879878e418aef6e6d5d (diff)
downloadcdo-cfdef9afcf736cd872cd784647c25c52b653a7bb.tar.gz
cdo-cfdef9afcf736cd872cd784647c25c52b653a7bb.tar.xz
cdo-cfdef9afcf736cd872cd784647c25c52b653a7bb.zip
388928: Develop a resource transfer framework
https://bugs.eclipse.org/bugs/show_bug.cgi?id=388928
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.transfer/src')
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/internal/transfer/bundle/OM.java44
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/spi/transfer/FileSystemTransferSystem.java203
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransfer.java515
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferElement.java170
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferMapping.java78
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferMappingImpl.java321
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferSystem.java78
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferType.java148
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/TransferTest.java73
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/package-info.java17
10 files changed, 1647 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/internal/transfer/bundle/OM.java b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/internal/transfer/bundle/OM.java
new file mode 100644
index 0000000000..1801e35b1d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/internal/transfer/bundle/OM.java
@@ -0,0 +1,44 @@
+/*
+ * 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.internal.transfer.bundle;
+
+import org.eclipse.net4j.util.om.OMBundle;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.OSGiActivator;
+import org.eclipse.net4j.util.om.log.OMLogger;
+import org.eclipse.net4j.util.om.trace.OMTracer;
+
+/**
+ * The <em>Operations & Maintenance</em> class of this bundle.
+ *
+ * @author Eike Stepper
+ */
+public abstract class OM
+{
+ public static final String BUNDLE_ID = "org.eclipse.emf.cdo.transfer"; //$NON-NLS-1$
+
+ public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
+
+ public static final OMLogger LOG = BUNDLE.logger();
+
+ public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Activator extends OSGiActivator
+ {
+ public Activator()
+ {
+ super(BUNDLE);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/spi/transfer/FileSystemTransferSystem.java b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/spi/transfer/FileSystemTransferSystem.java
new file mode 100644
index 0000000000..fe255280a1
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/spi/transfer/FileSystemTransferSystem.java
@@ -0,0 +1,203 @@
+/*
+ * 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.spi.transfer;
+
+import org.eclipse.emf.cdo.transfer.CDOTransferElement;
+import org.eclipse.emf.cdo.transfer.CDOTransferSystem;
+
+import org.eclipse.net4j.util.io.IOUtil;
+
+import org.eclipse.emf.common.util.URI;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Writer;
+
+/**
+ * @author Eike Stepper
+ * @since 4.2
+ */
+public class FileSystemTransferSystem extends CDOTransferSystem
+{
+ public static final String TYPE = "fs";
+
+ public FileSystemTransferSystem()
+ {
+ super(false);
+ }
+
+ @Override
+ public String getType()
+ {
+ return TYPE;
+ }
+
+ @Override
+ public URI getURI(IPath path)
+ {
+ return URI.createFileURI(path.toOSString());
+ }
+
+ @Override
+ public CDOTransferElement getElement(IPath path)
+ {
+ File file = getFile(path);
+ if (file.exists())
+ {
+ return new Element(this, file);
+ }
+
+ return null;
+ }
+
+ @Override
+ public void createFolder(IPath path) throws IOException
+ {
+ File file = getFile(path);
+ mkDir(file);
+ }
+
+ @Override
+ public void createBinary(IPath path, InputStream source) throws IOException
+ {
+ File file = getFile(path);
+ mkParent(file);
+
+ OutputStream target = new FileOutputStream(file);
+
+ try
+ {
+ IOUtil.copy(source, target);
+ }
+ finally
+ {
+ IOUtil.close(target);
+ }
+ }
+
+ @Override
+ public void createText(IPath path, InputStream source, String encoding) throws IOException
+ {
+ File file = getFile(path);
+ mkParent(file);
+
+ Writer target = new FileWriter(file);
+
+ try
+ {
+ IOUtil.copyCharacter(new InputStreamReader(source, encoding), target);
+ }
+ finally
+ {
+ IOUtil.close(target);
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return "File System";
+ }
+
+ protected File getFile(IPath path)
+ {
+ return new File(path.toOSString());
+ }
+
+ protected void mkParent(File file) throws IOException
+ {
+ File parent = file.getParentFile();
+ if (parent != null)
+ {
+ mkDir(parent);
+ }
+ }
+
+ protected void mkDir(File file) throws IOException
+ {
+ if (file.exists())
+ {
+ if (!file.isDirectory())
+ {
+ throw new IOException("Not a folder " + file);
+ }
+ }
+ else
+ {
+ if (!file.mkdirs())
+ {
+ throw new IOException("Could not create folder " + file);
+ }
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static class Element extends CDOTransferElement
+ {
+ private File file;
+
+ public Element(CDOTransferSystem system, File file)
+ {
+ super(system);
+ this.file = file.getAbsoluteFile();
+ }
+
+ @Override
+ public Object getNativeObject()
+ {
+ return file;
+ }
+
+ @Override
+ public IPath getPath()
+ {
+ return new Path(file.getPath());
+ }
+
+ @Override
+ public boolean isDirectory()
+ {
+ return file.isDirectory();
+ }
+
+ @Override
+ protected CDOTransferElement[] doGetChildren() throws IOException
+ {
+ File[] children = file.listFiles();
+ CDOTransferElement[] result = new Element[children.length];
+
+ for (int i = 0; i < children.length; i++)
+ {
+ File child = children[i];
+ result[i] = new Element(getSystem(), child);
+ }
+
+ return result;
+ }
+
+ @Override
+ protected InputStream doOpenInputStream() throws IOException
+ {
+ return new FileInputStream(file);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransfer.java b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransfer.java
new file mode 100644
index 0000000000..b3fb4273e6
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransfer.java
@@ -0,0 +1,515 @@
+/*
+ * 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.transfer;
+
+import org.eclipse.net4j.util.event.Event;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.event.INotifier;
+import org.eclipse.net4j.util.event.Notifier;
+import org.eclipse.net4j.util.io.IOUtil;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.Resource.Factory;
+import org.eclipse.emf.ecore.resource.Resource.Factory.Registry;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceFactoryRegistryImpl;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ * @since 4.2
+ */
+public class CDOTransfer implements INotifier
+{
+ protected final Notifier notifier = new Notifier();
+
+ private final CDOTransferSystem sourceSystem;
+
+ private final CDOTransferSystem targetSystem;
+
+ private final CDOTransferMapping rootMapping = new CDOTransferMappingImpl(this);
+
+ private final Map<CDOTransferElement, CDOTransferMapping> mappings = new HashMap<CDOTransferElement, CDOTransferMapping>();
+
+ private CDOTransferType defaultTransferType = CDOTransferType.UNKNOWN;
+
+ private ResourceSet sourceResourceSet;
+
+ private ResourceSet targetResourceSet;
+
+ private Set<Resource> resourcesToSave = new HashSet<Resource>();
+
+ public CDOTransfer(CDOTransferSystem sourceSystem, CDOTransferSystem targetSystem)
+ {
+ this.sourceSystem = sourceSystem;
+ this.targetSystem = targetSystem;
+ }
+
+ public void addListener(IListener listener)
+ {
+ notifier.addListener(listener);
+ }
+
+ public void removeListener(IListener listener)
+ {
+ notifier.removeListener(listener);
+ }
+
+ public boolean hasListeners()
+ {
+ return notifier.hasListeners();
+ }
+
+ public IListener[] getListeners()
+ {
+ return notifier.getListeners();
+ }
+
+ public final CDOTransferSystem getSourceSystem()
+ {
+ return sourceSystem;
+ }
+
+ public final CDOTransferSystem getTargetSystem()
+ {
+ return targetSystem;
+ }
+
+ public final ResourceSet getSourceResourceSet()
+ {
+ if (sourceResourceSet == null)
+ {
+ sourceResourceSet = sourceSystem.provideResourceSet();
+ if (sourceResourceSet == null)
+ {
+ sourceResourceSet = createResourceSet(sourceSystem);
+ }
+ }
+
+ return sourceResourceSet;
+ }
+
+ public final ResourceSet getTargetResourceSet()
+ {
+ if (targetResourceSet == null)
+ {
+ targetResourceSet = targetSystem.provideResourceSet();
+ if (targetResourceSet == null)
+ {
+ targetResourceSet = createResourceSet(targetSystem);
+ }
+ }
+
+ return targetResourceSet;
+ }
+
+ protected ResourceSet createResourceSet(CDOTransferSystem system)
+ {
+ Resource.Factory.Registry registry = new ResourceFactoryRegistryImpl()
+ {
+ {
+ getProtocolToFactoryMap().putAll(Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap());
+ getExtensionToFactoryMap().putAll(Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap());
+ getContentTypeToFactoryMap().putAll(Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap());
+
+ getExtensionToFactoryMap().remove(Resource.Factory.Registry.DEFAULT_EXTENSION);
+ getContentTypeToFactoryMap().remove(Resource.Factory.Registry.DEFAULT_CONTENT_TYPE_IDENTIFIER);
+ }
+
+ @Override
+ protected Factory delegatedGetFactory(URI uri, String contentTypeIdentifier)
+ {
+ return null;
+ }
+ };
+
+ ResourceSet resourceSet = new ResourceSetImpl();
+ resourceSet.setResourceFactoryRegistry(registry);
+ return resourceSet;
+ }
+
+ public final CDOTransferMapping getRootMapping()
+ {
+ return rootMapping;
+ }
+
+ public final CDOTransferType getDefaultTransferType()
+ {
+ return defaultTransferType;
+ }
+
+ public final void setDefaultTransferType(CDOTransferType defaultTransferType)
+ {
+ if (defaultTransferType == CDOTransferType.FOLDER)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ this.defaultTransferType = defaultTransferType;
+ }
+
+ public Set<CDOTransferType> getUsedTransferTypes()
+ {
+ final Set<CDOTransferType> result = new HashSet<CDOTransferType>();
+ rootMapping.accept(new CDOTransferMapping.Visitor()
+ {
+ public boolean visit(CDOTransferMapping mapping)
+ {
+ result.add(mapping.getTransferType());
+ return true;
+ }
+ });
+
+ return result;
+ }
+
+ public CDOTransferMapping map(IPath sourcePath) throws IOException
+ {
+ CDOTransferElement source = sourceSystem.getElement(sourcePath);
+ return map(source);
+ }
+
+ public CDOTransferMapping map(String sourcePath) throws IOException
+ {
+ return map(new Path(sourcePath));
+ }
+
+ public CDOTransferMapping map(CDOTransferElement source) throws IOException
+ {
+ return map(source, rootMapping);
+ }
+
+ protected CDOTransferMapping map(CDOTransferElement source, CDOTransferMapping parent) throws IOException
+ {
+ CDOTransferMapping mapping = mappings.get(source);
+ if (mapping == null)
+ {
+ mapping = createMapping(source, parent);
+ mappings.put(source, mapping);
+ }
+ else
+ {
+ if (mapping.getParent() != parent)
+ {
+ throw new IllegalStateException();
+ }
+ }
+
+ return mapping;
+ }
+
+ protected CDOTransferMapping createMapping(CDOTransferElement source, CDOTransferMapping parent) throws IOException
+ {
+ return new CDOTransferMappingImpl(this, source, parent);
+ }
+
+ protected void unmap(CDOTransferMapping mapping)
+ {
+ mappings.remove(mapping.getSource());
+ mapping.getChildren();
+ }
+
+ protected boolean hasResourceFactory(CDOTransferElement source)
+ {
+ URI uri = source.getURI();
+ // TODO Derive resourceSet from element.getSystem()?
+ Registry registry = getSourceResourceSet().getResourceFactoryRegistry();
+ return registry.getFactory(uri) != null;
+ }
+
+ protected CDOTransferType getTransferType(CDOTransferElement source)
+ {
+ CDOTransferType type = source.getSystem().getDefaultTransferType(source);
+ if (type == CDOTransferType.UNKNOWN)
+ {
+ if (hasResourceFactory(source))
+ {
+ return CDOTransferType.MODEL;
+ }
+ }
+
+ if (type == CDOTransferType.UNKNOWN)
+ {
+ type = getDefaultTransferType();
+ }
+
+ return type;
+ }
+
+ protected Resource getSourceResource(CDOTransferMapping mapping)
+ {
+ URI uri = mapping.getSource().getURI();
+ ResourceSet sourceResourceSet = getSourceResourceSet();
+ return sourceResourceSet.getResource(uri, true);
+ }
+
+ protected Resource getTargetResource(CDOTransferMapping mapping) throws IOException
+ {
+ IPath path = mapping.getFullPath();
+ ResourceSet targetResourceSet = getTargetResourceSet();
+ return targetSystem.createModel(targetResourceSet, path);
+ }
+
+ protected void validate(CDOTransferMapping mapping)
+ {
+ if (mapping.getStatus() == CDOTransferMapping.Status.CONFLICT)
+ {
+ throw new IllegalStateException("Conflict: " + mapping);
+ }
+
+ for (CDOTransferMapping child : mapping.getChildren())
+ {
+ validate(child);
+ }
+ }
+
+ public void perform() throws IOException
+ {
+ validate(rootMapping);
+ perform(rootMapping);
+
+ for (Resource resource : resourcesToSave)
+ {
+ resource.save(null);
+ }
+
+ resourcesToSave.clear();
+ }
+
+ protected void perform(CDOTransferMapping mapping) throws IOException
+ {
+ CDOTransferType transferType = mapping.getTransferType();
+ if (transferType == CDOTransferType.FOLDER)
+ {
+ performFolder(mapping);
+ }
+ else if (transferType == CDOTransferType.MODEL)
+ {
+ performModel(mapping);
+ }
+ else if (transferType == CDOTransferType.BINARY)
+ {
+ performBinary(mapping);
+ }
+ else if (transferType instanceof CDOTransferType.Text)
+ {
+ String encoding = ((CDOTransferType.Text)transferType).getEncoding();
+ performText(mapping, encoding);
+ }
+ }
+
+ protected void performFolder(CDOTransferMapping mapping) throws IOException
+ {
+ if (mapping.getStatus() == CDOTransferMapping.Status.NEW)
+ {
+ targetSystem.createFolder(mapping.getFullPath());
+ }
+
+ for (CDOTransferMapping child : mapping.getChildren())
+ {
+ perform(child);
+ }
+ }
+
+ protected void performModel(CDOTransferMapping mapping) throws IOException
+ {
+ Resource sourceResource = getSourceResource(mapping);
+ Resource targetResource = getTargetResource(mapping);
+
+ EList<EObject> sourceContents = sourceResource.getContents();
+ Collection<EObject> targetContents = EcoreUtil.copyAll(sourceContents);
+
+ EList<EObject> contents = targetResource.getContents();
+ contents.addAll(targetContents);
+ resourcesToSave.add(targetResource);
+ }
+
+ protected void performBinary(CDOTransferMapping mapping) throws IOException
+ {
+ IPath path = mapping.getFullPath();
+ InputStream source = mapping.getSource().openInputStream();
+
+ try
+ {
+ targetSystem.createBinary(path, source);
+ }
+ finally
+ {
+ IOUtil.close(source);
+ }
+ }
+
+ protected void performText(CDOTransferMapping mapping, String encoding) throws IOException
+ {
+ IPath path = mapping.getFullPath();
+ InputStream source = mapping.getSource().openInputStream();
+
+ try
+ {
+ targetSystem.createText(path, source, encoding);
+ }
+ finally
+ {
+ IOUtil.close(source);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static abstract class MappingEvent extends Event
+ {
+ private static final long serialVersionUID = 1L;
+
+ private CDOTransferMapping mapping;
+
+ private MappingEvent(CDOTransferMapping mapping)
+ {
+ super(mapping.getTransfer());
+ this.mapping = mapping;
+ }
+
+ public CDOTransferMapping getMapping()
+ {
+ return mapping;
+ }
+
+ public abstract boolean hasTreeImpact();
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class ChildrenChangedEvent extends MappingEvent
+ {
+ private static final long serialVersionUID = 1L;
+
+ private CDOTransferMapping child;
+
+ private Kind kind;
+
+ ChildrenChangedEvent(CDOTransferMapping mapping, CDOTransferMapping child, Kind kind)
+ {
+ super(mapping);
+ this.child = child;
+ this.kind = kind;
+ }
+
+ @Override
+ public boolean hasTreeImpact()
+ {
+ return true;
+ }
+
+ public CDOTransferMapping getChild()
+ {
+ return child;
+ }
+
+ public Kind getKind()
+ {
+ return kind;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public enum Kind
+ {
+ MAPPED, UNMAPPED
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class RelativePathChangedEvent extends MappingEvent
+ {
+ private static final long serialVersionUID = 1L;
+
+ private IPath oldPath;
+
+ private IPath newPath;
+
+ RelativePathChangedEvent(CDOTransferMapping mapping, IPath oldPath, IPath newPath)
+ {
+ super(mapping);
+ this.oldPath = oldPath;
+ this.newPath = newPath;
+ }
+
+ @Override
+ public boolean hasTreeImpact()
+ {
+ return true;
+ }
+
+ public IPath getOldPath()
+ {
+ return oldPath;
+ }
+
+ public IPath getNewPath()
+ {
+ return newPath;
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class TransferTypeChangedEvent extends MappingEvent
+ {
+ private static final long serialVersionUID = 1L;
+
+ private CDOTransferType oldType;
+
+ private CDOTransferType newType;
+
+ TransferTypeChangedEvent(CDOTransferMapping mapping, CDOTransferType oldType, CDOTransferType newType)
+ {
+ super(mapping);
+ this.oldType = oldType;
+ this.newType = newType;
+ }
+
+ @Override
+ public boolean hasTreeImpact()
+ {
+ return false;
+ }
+
+ public CDOTransferType getOldType()
+ {
+ return oldType;
+ }
+
+ public CDOTransferType getNewType()
+ {
+ return newType;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferElement.java b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferElement.java
new file mode 100644
index 0000000000..477f4c81c0
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferElement.java
@@ -0,0 +1,170 @@
+/*
+ * 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.transfer;
+
+import org.eclipse.emf.common.util.URI;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author Eike Stepper
+ * @since 4.2
+ */
+public abstract class CDOTransferElement
+{
+ public static final CDOTransferElement[] NO_CHILDREN = {};
+
+ private final CDOTransferSystem system;
+
+ protected CDOTransferElement(CDOTransferSystem system)
+ {
+ this.system = system;
+ }
+
+ public final CDOTransferSystem getSystem()
+ {
+ return system;
+ }
+
+ public abstract Object getNativeObject();
+
+ public abstract boolean isDirectory();
+
+ public abstract IPath getPath();
+
+ public final String getName()
+ {
+ return getPath().lastSegment();
+ }
+
+ public final URI getURI()
+ {
+ IPath path = getPath();
+ return system.getURI(path);
+ }
+
+ public final boolean isRoot()
+ {
+ return getParent() == null;
+ }
+
+ public final CDOTransferElement getParent()
+ {
+ IPath path = getPath();
+ if (path.isRoot())
+ {
+ return null;
+ }
+
+ return system.getElement(path.removeLastSegments(1));
+ }
+
+ public final CDOTransferElement[] getChildren() throws IOException
+ {
+ if (isDirectory())
+ {
+ return doGetChildren();
+ }
+
+ return NO_CHILDREN;
+ }
+
+ public final CDOTransferElement getChild(IPath path) throws IOException
+ {
+ IPath childPath = getPath().append(path.makeRelative());
+ return system.getElement(childPath);
+ }
+
+ public final CDOTransferElement getChild(String path) throws IOException
+ {
+ return getChild(new Path(path));
+ }
+
+ public final InputStream openInputStream() throws IOException
+ {
+ checkNotDirectory();
+ return doOpenInputStream();
+ }
+
+ @Override
+ public int hashCode()
+ {
+ String path = getPath().toString();
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (system == null ? 0 : system.hashCode());
+ result = prime * result + (path == null ? 0 : path.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+
+ if (obj == null)
+ {
+ return false;
+ }
+
+ if (!(obj instanceof CDOTransferElement))
+ {
+ return false;
+ }
+
+ CDOTransferElement other = (CDOTransferElement)obj;
+ if (system != other.system)
+ {
+ return false;
+ }
+
+ String path = getPath().toString();
+ String otherPath = other.getPath().toString();
+ if (path == null)
+ {
+ if (otherPath != null)
+ {
+ return false;
+ }
+ }
+ else if (!path.equals(otherPath))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getPath().toString();
+ }
+
+ protected abstract CDOTransferElement[] doGetChildren() throws IOException;
+
+ protected abstract InputStream doOpenInputStream() throws IOException;
+
+ private void checkNotDirectory() throws IOException
+ {
+ if (isDirectory())
+ {
+ throw new IOException("Not supported for directories");
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferMapping.java b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferMapping.java
new file mode 100644
index 0000000000..1a697bab33
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferMapping.java
@@ -0,0 +1,78 @@
+/*
+ * 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.transfer;
+
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * @author Eike Stepper
+ * @since 4.2
+ */
+public interface CDOTransferMapping extends Comparable<CDOTransferMapping>
+{
+ public static final CDOTransferMapping[] NO_CHILDREN = {};
+
+ public CDOTransfer getTransfer();
+
+ public CDOTransferElement getSource();
+
+ public CDOTransferMapping getParent();
+
+ public boolean isRoot();
+
+ public boolean isDirectory();
+
+ public String getName();
+
+ public void setName(String name);
+
+ public IPath getRelativePath();
+
+ public void setRelativePath(IPath relativePath);
+
+ public void setRelativePath(String path);
+
+ public void accept(Visitor visitor);
+
+ public CDOTransferMapping[] getChildren();
+
+ public CDOTransferMapping getChild(IPath path);
+
+ public CDOTransferMapping getChild(String path);
+
+ public void unmap();
+
+ public CDOTransferType getTransferType();
+
+ public void setTransferType(CDOTransferType transferType);
+
+ public IPath getFullPath();
+
+ public Status getStatus();
+
+ public CDOTransferElement getTarget();
+
+ /**
+ * @author Eike Stepper
+ */
+ public enum Status
+ {
+ NEW, MERGE, CONFLICT
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public interface Visitor
+ {
+ public boolean visit(CDOTransferMapping mapping);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferMappingImpl.java b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferMappingImpl.java
new file mode 100644
index 0000000000..8510054ca3
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferMappingImpl.java
@@ -0,0 +1,321 @@
+/*
+ * 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.transfer;
+
+import org.eclipse.emf.cdo.transfer.CDOTransfer.ChildrenChangedEvent.Kind;
+
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.event.IListener;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ * @since 4.2
+ */
+class CDOTransferMappingImpl implements CDOTransferMapping
+{
+ private final CDOTransfer transfer;
+
+ private final CDOTransferElement source;
+
+ private final CDOTransferMappingImpl parent;
+
+ private List<CDOTransferMapping> children;
+
+ private CDOTransferType transferType;
+
+ private IPath relativePath;
+
+ public CDOTransferMappingImpl(CDOTransfer transfer, CDOTransferElement source, CDOTransferMapping parent)
+ throws IOException
+ {
+ this.transfer = transfer;
+ this.source = source;
+ this.parent = (CDOTransferMappingImpl)parent;
+ relativePath = new Path(source.getName());
+
+ CDOTransferType transferType = transfer.getTransferType(source);
+ setTransferType(transferType);
+
+ if (parent != null)
+ {
+ this.parent.addChild(this);
+ }
+
+ if (isDirectory())
+ {
+ for (CDOTransferElement child : source.getChildren())
+ {
+ transfer.map(child, this);
+ }
+ }
+ }
+
+ public CDOTransferMappingImpl(CDOTransfer transfer)
+ {
+ this.transfer = transfer;
+ source = null;
+ parent = null;
+ relativePath = Path.EMPTY;
+ setTransferType(CDOTransferType.FOLDER);
+ }
+
+ public CDOTransfer getTransfer()
+ {
+ return transfer;
+ }
+
+ public CDOTransferElement getSource()
+ {
+ return source;
+ }
+
+ public CDOTransferMapping getParent()
+ {
+ return parent;
+ }
+
+ public boolean isRoot()
+ {
+ return parent == null;
+ }
+
+ public boolean isDirectory()
+ {
+ if (source == null)
+ {
+ return true;
+ }
+
+ return source.isDirectory();
+ }
+
+ public String getName()
+ {
+ return relativePath.lastSegment();
+ }
+
+ public void setName(String name)
+ {
+ setRelativePath(relativePath.removeLastSegments(1).append(name));
+ }
+
+ public IPath getRelativePath()
+ {
+ return relativePath;
+ }
+
+ public void setRelativePath(IPath relativePath)
+ {
+ if (!ObjectUtil.equals(this.relativePath, relativePath))
+ {
+ IPath oldPath = this.relativePath;
+ this.relativePath = relativePath;
+
+ IListener[] listeners = transfer.notifier.getListeners();
+ if (listeners != null)
+ {
+ transfer.notifier.fireEvent(new CDOTransfer.RelativePathChangedEvent(this, oldPath, relativePath), listeners);
+ }
+ }
+ }
+
+ public void setRelativePath(String path)
+ {
+ setRelativePath(new Path(path));
+ }
+
+ public void accept(Visitor visitor)
+ {
+ if (visitor.visit(this) && children != null)
+ {
+ for (CDOTransferMapping child : children)
+ {
+ child.accept(visitor);
+ }
+ }
+ }
+
+ public CDOTransferMapping[] getChildren()
+ {
+ if (children == null || children.isEmpty())
+ {
+ return NO_CHILDREN;
+ }
+
+ CDOTransferMapping[] result = children.toArray(new CDOTransferMapping[children.size()]);
+ Arrays.sort(result);
+ return result;
+ }
+
+ public CDOTransferMapping getChild(IPath path)
+ {
+ if (path.isEmpty())
+ {
+ return this;
+ }
+
+ String name = path.segment(0);
+ for (CDOTransferMapping child : getChildren())
+ {
+ if (name.equals(child.getName()))
+ {
+ return child.getChild(path.removeFirstSegments(1));
+ }
+ }
+
+ return null;
+ }
+
+ public CDOTransferMapping getChild(String path)
+ {
+ return getChild(new Path(path));
+ }
+
+ private void addChild(CDOTransferMapping child)
+ {
+ ensureChildrenList();
+ if (!children.contains(child))
+ {
+ children.add(child);
+ fireChildrenChangedEvent(child, CDOTransfer.ChildrenChangedEvent.Kind.MAPPED);
+ }
+ }
+
+ private void removeChild(CDOTransferMapping child)
+ {
+ if (children != null && children.remove(child))
+ {
+ fireChildrenChangedEvent(child, CDOTransfer.ChildrenChangedEvent.Kind.UNMAPPED);
+ }
+ }
+
+ private void ensureChildrenList()
+ {
+ if (children == null)
+ {
+ children = new ArrayList<CDOTransferMapping>();
+ }
+ }
+
+ private void fireChildrenChangedEvent(CDOTransferMapping child, Kind kind)
+ {
+ IListener[] listeners = transfer.notifier.getListeners();
+ if (listeners != null)
+ {
+ transfer.notifier.fireEvent(new CDOTransfer.ChildrenChangedEvent(this, child, kind), listeners);
+ }
+ }
+
+ public void unmap()
+ {
+ transfer.unmap(this);
+ if (parent != null)
+ {
+ parent.removeChild(this);
+ }
+ }
+
+ public CDOTransferType getTransferType()
+ {
+ return transferType;
+ }
+
+ public void setTransferType(CDOTransferType transferType)
+ {
+ if (!ObjectUtil.equals(this.transferType, transferType))
+ {
+ if (transferType == CDOTransferType.MODEL && !transfer.hasResourceFactory(source))
+ {
+ throw new IllegalStateException("No resource factory registered for " + this);
+ }
+
+ CDOTransferType oldType = this.transferType;
+ this.transferType = transferType;
+
+ IListener[] listeners = transfer.notifier.getListeners();
+ if (listeners != null)
+ {
+ transfer.notifier.fireEvent(new CDOTransfer.TransferTypeChangedEvent(this, oldType, transferType), listeners);
+ }
+ }
+ }
+
+ public IPath getFullPath()
+ {
+ IPath relativePath = getRelativePath();
+ if (isRoot())
+ {
+ return relativePath;
+ }
+
+ IPath path = parent.getFullPath();
+ return path.append(relativePath);
+ }
+
+ public Status getStatus()
+ {
+ CDOTransferSystem targetSystem = transfer.getTargetSystem();
+
+ IPath fullPath = getFullPath();
+ int lastSegment = fullPath.segmentCount();
+ for (int i = 1; i <= lastSegment; i++)
+ {
+ IPath path = fullPath.uptoSegment(i);
+ CDOTransferElement target = targetSystem.getElement(path);
+ if (target == null)
+ {
+ return Status.NEW;
+ }
+
+ boolean sourceDirectory = i == lastSegment ? isDirectory() : true;
+ boolean targetDirectory = target.isDirectory();
+ if (!(sourceDirectory && targetDirectory))
+ {
+ return Status.CONFLICT;
+ }
+ }
+
+ return Status.MERGE;
+ }
+
+ public CDOTransferElement getTarget()
+ {
+ CDOTransferSystem targetSystem = transfer.getTargetSystem();
+ IPath fullPath = getFullPath();
+ return targetSystem.getElement(fullPath);
+ }
+
+ public int compareTo(CDOTransferMapping o)
+ {
+ boolean directory = isDirectory();
+ boolean oDirectory = o.isDirectory();
+ if (directory != oDirectory)
+ {
+ return directory ? -1 : 1;
+ }
+
+ return getName().compareTo(o.getName());
+ }
+
+ @Override
+ public String toString()
+ {
+ return getFullPath().toString();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferSystem.java b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferSystem.java
new file mode 100644
index 0000000000..b7aba10e8d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferSystem.java
@@ -0,0 +1,78 @@
+/*
+ * 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.transfer;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author Eike Stepper
+ * @since 4.2
+ */
+public abstract class CDOTransferSystem
+{
+ private boolean readOnly;
+
+ protected CDOTransferSystem(boolean readOnly)
+ {
+ this.readOnly = readOnly;
+ }
+
+ public abstract String getType();
+
+ protected ResourceSet provideResourceSet()
+ {
+ return null;
+ }
+
+ public boolean isReadOnly()
+ {
+ return readOnly;
+ }
+
+ public CDOTransferType getDefaultTransferType(CDOTransferElement element)
+ {
+ if (element.isDirectory())
+ {
+ return CDOTransferType.FOLDER;
+ }
+
+ return CDOTransferType.UNKNOWN;
+ }
+
+ public abstract URI getURI(IPath path);
+
+ public CDOTransferElement getElement(String path)
+ {
+ return getElement(new Path(path));
+ }
+
+ public abstract CDOTransferElement getElement(IPath path);
+
+ public abstract void createFolder(IPath path) throws IOException;
+
+ public Resource createModel(ResourceSet resourceSet, IPath path) throws IOException
+ {
+ URI uri = getURI(path);
+ return resourceSet.createResource(uri);
+ }
+
+ public abstract void createBinary(IPath path, InputStream source) throws IOException;
+
+ public abstract void createText(IPath path, InputStream source, String encoding) throws IOException;
+}
diff --git a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferType.java b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferType.java
new file mode 100644
index 0000000000..86a19be097
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/CDOTransferType.java
@@ -0,0 +1,148 @@
+/*
+ * 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.transfer;
+
+import org.eclipse.net4j.util.ObjectUtil;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ * @since 4.2
+ */
+public class CDOTransferType implements Comparable<CDOTransferType>
+{
+ /**
+ * Must be declared/initialized <b>before</b> any transfer types!
+ */
+ private static final Map<String, CDOTransferType> MAP = new HashMap<String, CDOTransferType>();
+
+ public static final CDOTransferType UNKNOWN = new CDOTransferType()
+ {
+ @Override
+ public String toString()
+ {
+ return "<Unknown>";
+ }
+ };
+
+ public static final CDOTransferType FOLDER = new CDOTransferType()
+ {
+ @Override
+ public String toString()
+ {
+ return "<Folder>";
+ }
+ };
+
+ public static final CDOTransferType MODEL = new CDOTransferType()
+ {
+ @Override
+ public String toString()
+ {
+ return "<Model>";
+ }
+ };
+
+ public static final CDOTransferType BINARY = new CDOTransferType()
+ {
+ @Override
+ public String toString()
+ {
+ return "<Binary>";
+ }
+ };
+
+ public static final Text UTF8 = text("UTF-8");
+
+ public static final Set<CDOTransferType> STANDARD_TYPES = new HashSet<CDOTransferType>(Arrays.asList(UNKNOWN, FOLDER,
+ MODEL, BINARY, UTF8));
+
+ public static final Map<String, CDOTransferType> REGISTRY = Collections.unmodifiableMap(MAP);
+
+ private CDOTransferType()
+ {
+ this(true);
+ }
+
+ private CDOTransferType(boolean register)
+ {
+ if (register)
+ {
+ MAP.put(toString(), this);
+ }
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return toString().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ return ObjectUtil.equals(toString(), obj.toString());
+ }
+
+ public int compareTo(CDOTransferType o)
+ {
+ return toString().compareTo(o.toString());
+ }
+
+ public static Text text(String encoding)
+ {
+ CDOTransferType type = MAP.get(encoding);
+ if (type instanceof Text)
+ {
+ return (Text)type;
+ }
+
+ if (type == null)
+ {
+ Text text = new Text(encoding);
+ MAP.put(encoding, text);
+ return text;
+ }
+
+ throw new IllegalArgumentException("Illegal encoding: " + encoding);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class Text extends CDOTransferType
+ {
+ private String encoding;
+
+ private Text(String encoding)
+ {
+ super(false);
+ this.encoding = encoding;
+ }
+
+ public String getEncoding()
+ {
+ return encoding;
+ }
+
+ @Override
+ public String toString()
+ {
+ return encoding;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/TransferTest.java b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/TransferTest.java
new file mode 100644
index 0000000000..c7a7fbe74a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/TransferTest.java
@@ -0,0 +1,73 @@
+/*
+ * 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.transfer;
+
+import org.eclipse.emf.cdo.spi.transfer.FileSystemTransferSystem;
+
+import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ * @since 4.2
+ */
+public class TransferTest
+{
+ public static final CDOTransferSystem FILE_SYSTEM = new FileSystemTransferSystem();
+
+ public static void main(String[] args) throws IOException
+ {
+ CDOTransfer transfer = createTransfer();
+ dump(transfer.getRootMapping());
+
+ Map<String, Object> map = transfer.getTargetResourceSet().getResourceFactoryRegistry().getExtensionToFactoryMap();
+ map.put("ecore", new EcoreResourceFactoryImpl());
+ map.put("genmodel", new EcoreResourceFactoryImpl());
+
+ transfer.perform();
+ }
+
+ public static CDOTransfer createTransfer() throws IOException
+ {
+ CDOTransfer transfer = new CDOTransfer(FILE_SYSTEM, FILE_SYSTEM);
+ transfer.getRootMapping().setRelativePath("C:/develop/transfer");
+ transfer.setDefaultTransferType(CDOTransferType.UTF8);
+
+ Map<String, Object> map = transfer.getSourceResourceSet().getResourceFactoryRegistry().getExtensionToFactoryMap();
+ map.put("ecore", new EcoreResourceFactoryImpl());
+ map.put("genmodel", new EcoreResourceFactoryImpl());
+
+ CDOTransferMapping mapping = transfer.map("C:/develop/git/cdo/plugins/org.eclipse.emf.cdo.tests.model2");
+ mapping.setRelativePath("");
+ mapping.getChild(".classpath").setName("my.classpath");
+ mapping.getChild(".settings").unmap();
+ mapping.getChild("META-INF").setRelativePath("osgi/inf");
+ mapping.getChild("bin").unmap();
+ mapping.getChild("src").unmap();
+
+ CDOTransferMapping model = mapping.getChild("model");
+ model.getChild("model2.genmodel").setTransferType(CDOTransferType.UTF8);
+ model.getChild("model2.legacy-genmodel").setTransferType(CDOTransferType.BINARY);
+
+ return transfer;
+ }
+
+ protected static void dump(CDOTransferMapping mapping)
+ {
+ System.out.println(mapping + " --> " + mapping.getTransferType() + " --> " + mapping.getStatus());
+ for (CDOTransferMapping child : mapping.getChildren())
+ {
+ dump(child);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/package-info.java b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/package-info.java
new file mode 100644
index 0000000000..0dc51b31da
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.transfer/src/org/eclipse/emf/cdo/transfer/package-info.java
@@ -0,0 +1,17 @@
+/*
+ * 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
+ */
+
+/**
+ * Client concepts for dealing with transfers of {@link org.eclipse.emf.cdo.eresource.CDOResourceLeaf resources}
+ * between {@link org.eclipse.emf.cdo.transfer.CDOTransferSystem systems}.
+ */
+package org.eclipse.emf.cdo.transfer;
+

Back to the top