hdt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rsha...@apache.org
Subject [12/27] git commit: HDT-56 : server.xmi is shared - Making server.xmi in workspace location rather bundle loc - Useing HDFS manager delete when HDFS server is deleted
Date Thu, 26 Jun 2014 08:36:35 GMT
HDT-56 : server.xmi is shared - Making server.xmi in workspace location rather bundle loc -
Useing HDFS manager delete when HDFS server is deleted


Project: http://git-wip-us.apache.org/repos/asf/incubator-hdt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hdt/commit/a7a89f49
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hdt/tree/a7a89f49
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hdt/diff/a7a89f49

Branch: refs/heads/hadoop-eclipse-merge
Commit: a7a89f4961f477b1c4a519e1e9741954368b6f15
Parents: 0835540
Author: Rahul Sharma <rsharma@apache.org>
Authored: Fri May 16 09:56:07 2014 +0530
Committer: Rahul Sharma <rsharma@apache.org>
Committed: Fri May 23 08:48:28 2014 +0530

----------------------------------------------------------------------
 .../src/org/apache/hdt/core/internal/HadoopManager.java        | 6 ++++--
 .../org/apache/hdt/core/internal/hdfs/HDFSMoveDeleteHook.java  | 3 +++
 2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/a7a89f49/org.apache.hdt.core/src/org/apache/hdt/core/internal/HadoopManager.java
----------------------------------------------------------------------
diff --git a/org.apache.hdt.core/src/org/apache/hdt/core/internal/HadoopManager.java b/org.apache.hdt.core/src/org/apache/hdt/core/internal/HadoopManager.java
index 937b171..125c9a2 100644
--- a/org.apache.hdt.core/src/org/apache/hdt/core/internal/HadoopManager.java
+++ b/org.apache.hdt.core/src/org/apache/hdt/core/internal/HadoopManager.java
@@ -53,7 +53,8 @@ public class HadoopManager {
 			loadServers();
 			if (servers == null) {
 				Bundle bundle = Platform.getBundle(Activator.BUNDLE_ID);
-				File serversFile = bundle.getBundleContext().getDataFile(MODEL_FILE_NAME);
+				File stateLocation = Platform.getStateLocation(bundle).toFile();
+				File serversFile = new File(stateLocation,MODEL_FILE_NAME);
 				Resource resource = new ResourceSetImpl().createResource(URI.createFileURI(serversFile.getPath()));
 				servers = HadoopFactory.eINSTANCE.createServers();
 				resource.getContents().add(servers);
@@ -64,7 +65,8 @@ public class HadoopManager {
 
 	private void loadServers() {
 		Bundle bundle = Platform.getBundle(Activator.BUNDLE_ID);
-		File serversFile = bundle.getBundleContext().getDataFile(MODEL_FILE_NAME);
+		File stateLocation = Platform.getStateLocation(bundle).toFile();
+		File serversFile = new File(stateLocation,MODEL_FILE_NAME);
 		if (serversFile.exists()) {
 			Resource resource = new ResourceSetImpl().getResource(URI.createFileURI(serversFile.getPath()),
true);
 			servers = (Servers) resource.getContents().get(0);

http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/a7a89f49/org.apache.hdt.core/src/org/apache/hdt/core/internal/hdfs/HDFSMoveDeleteHook.java
----------------------------------------------------------------------
diff --git a/org.apache.hdt.core/src/org/apache/hdt/core/internal/hdfs/HDFSMoveDeleteHook.java
b/org.apache.hdt.core/src/org/apache/hdt/core/internal/hdfs/HDFSMoveDeleteHook.java
index 0ca0df4..f4fb099 100644
--- a/org.apache.hdt.core/src/org/apache/hdt/core/internal/hdfs/HDFSMoveDeleteHook.java
+++ b/org.apache.hdt.core/src/org/apache/hdt/core/internal/hdfs/HDFSMoveDeleteHook.java
@@ -18,6 +18,7 @@
 
 package org.apache.hdt.core.internal.hdfs;
 
+import org.apache.hdt.core.internal.model.HDFSServer;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
@@ -77,6 +78,8 @@ public class HDFSMoveDeleteHook implements IMoveDeleteHook {
 				throw new RuntimeException(
 						"Deletion of HDFS project root folder is not supported. To remove project uncheck the
\'Delete project contents on disk\' checkbox");
 			}
+			HDFSServer server = HDFSManager.INSTANCE.getServer(project.getLocationURI().toString());
+			HDFSManager.INSTANCE.deleteServer(server);
 		}
 		return false;
 	}


Mime
View raw message