Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2018-11-22 07:47:24 -0500
committerEike Stepper2018-11-22 07:47:24 -0500
commit7cfee3a21ba4eabeb116229dc6454e173c128b38 (patch)
treecd4ce54be243e36aeb3976f97aba6aac297aec02
parente4227f94a4ccad14d8276f3fd3c6bc3aa5d7362c (diff)
downloadcdo-7cfee3a21ba4eabeb116229dc6454e173c128b38.tar.gz
cdo-7cfee3a21ba4eabeb116229dc6454e173c128b38.tar.xz
cdo-7cfee3a21ba4eabeb116229dc6454e173c128b38.zip
[541449] Provide more CDOServerExporter options, e.g., branchPath and timestamp
https://bugs.eclipse.org/bugs/show_bug.cgi?id=541449
-rw-r--r--plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF18
-rw-r--r--plugins/org.eclipse.emf.cdo.server/pom.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/bundle/CDOCommandProvider.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerExporter.java77
4 files changed, 94 insertions, 24 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF
index 15c06e2d2a..15198747cc 100644
--- a/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.server;singleton:=true
-Bundle-Version: 4.7.100.qualifier
+Bundle-Version: 4.8.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -10,18 +10,18 @@ Bundle-Activator: org.eclipse.emf.cdo.internal.server.bundle.OM$Activator
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .
Require-Bundle: org.eclipse.emf.cdo;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
-Export-Package: org.eclipse.emf.cdo.internal.server;version="4.7.100";
+Export-Package: org.eclipse.emf.cdo.internal.server;version="4.8.0";
x-friends:="org.eclipse.emf.cdo.server.db,
org.eclipse.emf.cdo.server.net4j,
org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.workspace,
org.eclipse.emf.cdo.server.hibernate,
org.eclipse.emf.cdo.server.embedded",
- org.eclipse.emf.cdo.internal.server.bundle;version="4.7.100";x-internal:=true,
- org.eclipse.emf.cdo.internal.server.mem;version="4.7.100";x-friends:="org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.server.messages;version="4.7.100";x-internal:=true,
- org.eclipse.emf.cdo.internal.server.syncing;version="4.7.100";x-friends:="org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.server;version="4.7.100",
- org.eclipse.emf.cdo.server.mem;version="4.7.100",
- org.eclipse.emf.cdo.spi.server;version="4.7.100"
+ org.eclipse.emf.cdo.internal.server.bundle;version="4.8.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.server.mem;version="4.8.0";x-friends:="org.eclipse.emf.cdo.tests",
+ org.eclipse.emf.cdo.internal.server.messages;version="4.8.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.server.syncing;version="4.8.0";x-friends:="org.eclipse.emf.cdo.tests",
+ org.eclipse.emf.cdo.server;version="4.8.0",
+ org.eclipse.emf.cdo.server.mem;version="4.8.0",
+ org.eclipse.emf.cdo.spi.server;version="4.8.0"
Automatic-Module-Name: org.eclipse.emf.cdo.server
diff --git a/plugins/org.eclipse.emf.cdo.server/pom.xml b/plugins/org.eclipse.emf.cdo.server/pom.xml
index e2d5147c11..4973778191 100644
--- a/plugins/org.eclipse.emf.cdo.server/pom.xml
+++ b/plugins/org.eclipse.emf.cdo.server/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo</groupId>
<artifactId>org.eclipse.emf.cdo.server</artifactId>
- <version>4.7.100-SNAPSHOT</version>
+ <version>4.8.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/bundle/CDOCommandProvider.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/bundle/CDOCommandProvider.java
index 84bbe345c9..85b244a115 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/bundle/CDOCommandProvider.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/bundle/CDOCommandProvider.java
@@ -110,7 +110,7 @@ public class CDOCommandProvider implements CommandProvider
};
private static final CDOCommand exportXML = new CDOCommand.WithRepository("export", "export the contents of a repository to an XML file",
- CDOCommand.parameter("export-file"))
+ CDOCommand.parameter("export-file"), CDOCommand.optional("branch-path"), CDOCommand.optional("time-stamp"))
{
@Override
public void execute(InternalRepository repository, String[] args) throws Exception
@@ -123,6 +123,8 @@ public class CDOCommandProvider implements CommandProvider
out = new FileOutputStream(exportFile);
CDOServerExporter.XML exporter = new CDOServerExporter.XML(repository);
+ processArgument(exporter, args[1]);
+ processArgument(exporter, args[2]);
exporter.exportRepository(out);
if (args.length > 1)
@@ -140,6 +142,23 @@ public class CDOCommandProvider implements CommandProvider
IOUtil.close(out);
}
}
+
+ private void processArgument(CDOServerExporter.XML exporter, String arg)
+ {
+ if (arg == null)
+ {
+ return;
+ }
+
+ if (arg.startsWith("/"))
+ {
+ exporter.setBranchPath(arg);
+ }
+ else
+ {
+ exporter.setTimeStamp(Long.valueOf(arg));
+ }
+ }
};
private static final CDOCommand importXML = new CDOCommand.WithRepository("import", "import the contents of a repository from an XML file",
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerExporter.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerExporter.java
index 19dd391774..d304eaf425 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerExporter.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerExporter.java
@@ -27,6 +27,7 @@ import org.eclipse.emf.cdo.common.model.EMFUtil;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionData;
import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
+import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageInfo;
@@ -71,6 +72,10 @@ public abstract class CDOServerExporter<OUT>
private boolean exportSystemPackages;
+ private String branchPath;
+
+ private long timeStamp = CDOBranchPoint.INVALID_DATE;
+
public CDOServerExporter(IRepository repository)
{
this.repository = (InternalRepository)repository;
@@ -97,6 +102,38 @@ public abstract class CDOServerExporter<OUT>
this.exportSystemPackages = exportSystemPackages;
}
+ /**
+ * @since 4.8
+ */
+ public String getBranchPath()
+ {
+ return branchPath;
+ }
+
+ /**
+ * @since 4.8
+ */
+ public void setBranchPath(String branchPath)
+ {
+ this.branchPath = branchPath;
+ }
+
+ /**
+ * @since 4.8
+ */
+ public long getTimeStamp()
+ {
+ return timeStamp;
+ }
+
+ /**
+ * @since 4.8
+ */
+ public void setTimeStamp(long timeStamp)
+ {
+ this.timeStamp = timeStamp;
+ }
+
public final void exportRepository(OutputStream out) throws Exception
{
boolean wasActive = LifecycleUtil.isActive(repository);
@@ -180,24 +217,38 @@ public abstract class CDOServerExporter<OUT>
protected void exportBranches(final OUT out) throws Exception
{
InternalCDOBranchManager branchManager = repository.getBranchManager();
- exportBranch(out, branchManager.getMainBranch());
- if (repository.isSupportingBranches())
+ if (branchPath != null)
+ {
+ InternalCDOBranch branch = branchManager.getBranch(branchPath);
+ if (branch == null)
+ {
+ throw new IllegalStateException("Branch '" + branchPath + "' does not exist");
+ }
+
+ exportBranch(out, branch);
+ }
+ else
{
- branchManager.getBranches(0, 0, new CDOBranchHandler()
+ exportBranch(out, branchManager.getMainBranch());
+
+ if (repository.isSupportingBranches())
{
- public void handleBranch(CDOBranch branch)
+ branchManager.getBranches(0, 0, new CDOBranchHandler()
{
- try
- {
- exportBranch(out, branch);
- }
- catch (Exception ex)
+ public void handleBranch(CDOBranch branch)
{
- throw WrappedException.wrap(ex);
+ try
+ {
+ exportBranch(out, branch);
+ }
+ catch (Exception ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
}
- }
- });
+ });
+ }
}
}
@@ -208,7 +259,7 @@ public abstract class CDOServerExporter<OUT>
protected void exportRevisions(final OUT out, CDOBranch branch) throws Exception
{
- repository.handleRevisions(null, branch, true, CDOBranchPoint.INVALID_DATE, false, new CDORevisionHandler()
+ repository.handleRevisions(null, branch, true, timeStamp, false, new CDORevisionHandler()
{
public boolean handleRevision(CDORevision revision)
{

Back to the top