You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ta...@apache.org on 2007/10/25 20:58:39 UTC
svn commit: r588310 [1/4] - in
/lucene/hadoop/trunk/src/contrib/eclipse-plugin: ./ .settings/ META-INF/
resources/ resources/Components/ resources/Old/
src/java/org/apache/hadoop/eclipse/
src/java/org/apache/hadoop/eclipse/actions/ src/java/org/apache/...
Author: taton
Date: Thu Oct 25 11:58:32 2007
New Revision: 588310
URL: http://svn.apache.org/viewvc?rev=588310&view=rev
Log:
HADOOP-1848 Major rewrite of the Eclipse plug-in. The new design lets the plug-in use the RPC interface to the Hadoop DFS and Map/Reduce instead of relying on shell command-line tools. This also include support for SOCKS proxy access to a DFS and to a Map/Reduce tracker. (taton)
Added:
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Conf.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Export.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Import.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/New.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Reload.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Tool.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Tools.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-16x16.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-24x24.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-32x32.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-64x64.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-small-16x16.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant.jpg (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-136x136.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-16x16.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-24x24.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-32x32.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-64x64.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2.jpg (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant3-122x122.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant3-16x16.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant3-24x24.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Old/
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Old/location-edit-16x16.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/download.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/hadoop-logo-16x16.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/hadoop-logo-24x24.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/hadoop-logo-85x85.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/hadoop-logo.jpg (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/location-edit-16x16.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/location-new-16x16.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/new-folder.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/refresh.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/upload.png (with props)
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/ErrorMessageDialog.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/ImageLibrary.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/DFSActionImpl.java
- copied, changed from r566883, lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/DfsAction.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/EditLocationAction.java
- copied, changed from r566883, lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/EditServerAction.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/NewLocationAction.java
- copied, changed from r566883, lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/NewServerAction.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSActions.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSContent.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFile.java
- copied, changed from r566883, lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DfsFile.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSFolder.java
- copied, changed from r566883, lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DfsFolder.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSLocation.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSLocationsRoot.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSMessage.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSPath.java
- copied, changed from r566883, lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DfsPath.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/launch/HadoopApplicationLaunchShortcut.java
- copied, changed from r566883, lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/launch/LaunchShortcut.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/preferences/MapReducePreferencePage.java
- copied, changed from r566883, lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/preferences/HadoopHomeDirPreferencePage.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/ConfProp.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/HadoopLocationWizard.java
Removed:
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/JSchUtilities.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/DfsAction.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/EditServerAction.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/NewServerAction.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/RunOnHadoopActionDelegate.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DfsFile.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DfsFolder.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DfsPath.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/launch/LaunchShortcut.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/launch/SWTUserInfo.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/launch/StartMapReduceServer.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/preferences/HadoopHomeDirPreferencePage.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/DefineHadoopServerLocWizardPage.java
Modified:
lucene/hadoop/trunk/src/contrib/eclipse-plugin/.classpath
lucene/hadoop/trunk/src/contrib/eclipse-plugin/.settings/org.eclipse.jdt.core.prefs
lucene/hadoop/trunk/src/contrib/eclipse-plugin/META-INF/MANIFEST.MF
lucene/hadoop/trunk/src/contrib/eclipse-plugin/build.properties
lucene/hadoop/trunk/src/contrib/eclipse-plugin/build.xml
lucene/hadoop/trunk/src/contrib/eclipse-plugin/plugin.xml
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/Activator.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/MapReduceNature.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewDriverWizardPage.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewMapReduceProjectWizard.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewMapperWizard.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewReducerWizard.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/OpenNewMRProjectAction.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/ActionProvider.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/dfs/DFSContentProvider.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopServer.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/IJobListener.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/JarModule.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/HadoopServerSelectionListContentProvider.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/RunOnHadoopWizard.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/ServerRegistry.java
lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/view/servers/ServerView.java
Modified: lucene/hadoop/trunk/src/contrib/eclipse-plugin/.classpath
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/.classpath?rev=588310&r1=588309&r2=588310&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/.classpath (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/.classpath Thu Oct 25 11:58:32 2007
@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/java"/>
+ <classpathentry excluding="org/apache/hadoop/eclipse/server/CopyOfHadoopServer.java" kind="src" path="src/java"/>
+ <classpathentry exported="true" kind="lib" path="classes" sourcepath="classes"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-cli-2.0-SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="lib/hadoop-core.jar" sourcepath="/hadoop-socks/src/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="output" path="classes"/>
</classpath>
Modified: lucene/hadoop/trunk/src/contrib/eclipse-plugin/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/.settings/org.eclipse.jdt.core.prefs?rev=588310&r1=588309&r2=588310&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/.settings/org.eclipse.jdt.core.prefs (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/.settings/org.eclipse.jdt.core.prefs Thu Oct 25 11:58:32 2007
@@ -1,4 +1,4 @@
-#Wed Aug 15 11:41:44 PDT 2007
+#Sat Oct 13 13:37:43 CEST 2007
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
Modified: lucene/hadoop/trunk/src/contrib/eclipse-plugin/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/META-INF/MANIFEST.MF?rev=588310&r1=588309&r2=588310&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/META-INF/MANIFEST.MF (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/META-INF/MANIFEST.MF Thu Oct 25 11:58:32 2007
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: MapReduce Tools for Eclipse
Bundle-SymbolicName: org.apache.hadoop.eclipse;singleton:=true
-Bundle-Version: 1.0.4
+Bundle-Version: 1.1
Bundle-Activator: org.apache.hadoop.eclipse.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
@@ -21,8 +21,9 @@
org.eclipse.ui.console,
org.eclipse.ui.navigator,
org.eclipse.core.filesystem,
- org.eclipse.team.cvs.ssh2,
- com.jcraft.jsch
+ org.apache.commons.logging
Eclipse-LazyStart: true
-Bundle-ClassPath: classes/
+Bundle-ClassPath: classes/,
+ lib/commons-cli-2.0-SNAPSHOT.jar,
+ lib/hadoop-core.jar
Bundle-Vendor: Apache Hadoop
Modified: lucene/hadoop/trunk/src/contrib/eclipse-plugin/build.properties
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/build.properties?rev=588310&r1=588309&r2=588310&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/build.properties (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/build.properties Thu Oct 25 11:58:32 2007
@@ -2,4 +2,6 @@
bin.includes = META-INF/,\
plugin.xml,\
resources/,\
- bin/
+ classes/,\
+ classes/,\
+ lib/
Modified: lucene/hadoop/trunk/src/contrib/eclipse-plugin/build.xml
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/build.xml?rev=588310&r1=588309&r2=588310&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/build.xml (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/build.xml Thu Oct 25 11:58:32 2007
@@ -23,6 +23,7 @@
<!-- Override classpath to include Eclipse SDK jars -->
<path id="classpath">
<pathelement location="${build.classes}"/>
+ <pathelement location="${hadoop.root}/build/classes"/>
<path refid="eclipse-sdk-jars"/>
</path>
@@ -34,10 +35,13 @@
<!-- Override jar target to specify manifest -->
<target name="jar" depends="compile" unless="skip.contrib">
+ <mkdir dir="${build.dir}/lib"/>
+ <copy file="${deploy.dir}/hadoop-${version}-core.jar" tofile="${build.dir}/lib/hadoop-core.jar" verbose="true"/>
+ <copy file="${hadoop.root}/lib/commons-cli-2.0-SNAPSHOT.jar" todir="${build.dir}/lib" verbose="true"/>
<jar
jarfile="${build.dir}/hadoop-${version}-${name}.jar"
manifest="${root}/META-INF/MANIFEST.MF">
- <fileset dir="${build.dir}" includes="classes/"/>
+ <fileset dir="${build.dir}" includes="classes/ lib/"/>
<fileset dir="${root}" includes="resources/ plugin.xml"/>
</jar>
</target>
Modified: lucene/hadoop/trunk/src/contrib/eclipse-plugin/plugin.xml
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/plugin.xml?rev=588310&r1=588309&r2=588310&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/plugin.xml (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/plugin.xml Thu Oct 25 11:58:32 2007
@@ -1,15 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
+
<plugin>
- <extension
+
+ <!-- extension
point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
- delegate="org.apache.hadoop.eclipse.launch.StartMapReduceServer"
+ delegate="org.apache.hadoop.eclipse.launch.HadoopLaunchDelegate"
id="org.apache.hadoop.eclipse.launch.StartServer"
modes="run,debug"
name="Start Hadoop Server"
public="true"/>
- </extension>
+ </extension -->
+
<extension
name="MapReduce Nature"
id="org.apache.hadoop.eclipse.Nature"
@@ -18,9 +21,12 @@
<run class="org.apache.hadoop.eclipse.MapReduceNature"/>
</runtime>
</extension>
+
<extension
point="org.eclipse.ui.ide.projectNatureImages">
</extension>
+
+ <!-- Wizards: new Mapper, Reducer, Driver -->
<extension
point="org.eclipse.ui.newWizards">
<primaryWizard id="org.apache.hadoop.eclipse.NewProjectWizard"/>
@@ -31,7 +37,7 @@
hasPages="true"
icon="resources/Elephant16x16.gif"
id="org.apache.hadoop.eclipse.NewProjectWizard"
- name="MapReduce Project"
+ name="Map/Reduce Project"
preferredPerspectives="org.apache.hadoop.eclipse.Perspective"
project="true"/>
<wizard
@@ -46,7 +52,8 @@
class="org.apache.hadoop.eclipse.NewReducerWizard"
icon="resources/reducer16.png"
id="org.apache.hadoop.eclipse.NewReducerWizard"
- name="Reducer"/>
+ name="Reducer"
+ project="false"/>
<wizard
category="org.apache.hadoop.eclipse.category"
class="org.apache.hadoop.eclipse.NewDriverWizard"
@@ -56,8 +63,9 @@
project="false"/>
<category
id="org.apache.hadoop.eclipse.category"
- name="MapReduce"/>
+ name="Map/Reduce"/>
</extension>
+
<extension
point="org.eclipse.debug.ui.launchConfigurationTypeImages">
<launchConfigurationTypeImage
@@ -65,6 +73,7 @@
icon="resources/elephantblue16x16.gif"
id="Hadouken.launchConfigurationTypeImage1"/>
</extension>
+
<extension
point="org.eclipse.debug.ui.launchConfigurationTabGroups">
<launchConfigurationTabGroup
@@ -74,14 +83,17 @@
</extension>
+ <!-- Perspective: Map/Reduce -->
<extension
point="org.eclipse.ui.perspectives">
<perspective
class="org.apache.hadoop.eclipse.HadoopPerspectiveFactory"
icon="resources/elephantblue16x16.gif"
id="org.apache.hadoop.eclipse.Perspective"
- name="MapReduce"/>
+ name="Map/Reduce"/>
</extension>
+
+ <!-- Needed: allows DFS Browsing in Navigator! [TODO] -->
<extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
@@ -97,10 +109,12 @@
properties="server"
type="org.eclipse.wst.server.core.IServer"/>
</extension>
+
+ <!-- Run on Hadoop action -->
<extension
point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
- class="org.apache.hadoop.eclipse.launch.LaunchShortcut"
+ class="org.apache.hadoop.eclipse.launch.HadoopApplicationLaunchShortcut"
icon="resources/elephantblue16x16.gif"
id="org.apache.hadoop.eclipse.launch.shortcut"
label="Run on Hadoop"
@@ -126,19 +140,25 @@
<perspective id="org.apache.hadoop.eclipse.Perspective"/>
</shortcut>
</extension>
+
+ <!-- Hadoop locations view -->
<extension
point="org.eclipse.ui.views">
<category
- id="com.ibm.hipods.mapreduce.views.category"
+ id="org.apache.hadoop.eclipse.view.servers"
name="MapReduce Tools"/>
<view
allowMultiple="false"
- category="com.ibm.hipods.mapreduce.views.category"
+ category="org.apache.hadoop.eclipse.view.servers"
class="org.apache.hadoop.eclipse.view.servers.ServerView"
+ icon="resources/hadoop-logo-16x16.png"
id="org.apache.hadoop.eclipse.view.servers"
- name="MapReduce Servers"/>
+ name="Map/Reduce Locations">
+ </view>
</extension>
- <extension
+
+ <!-- ??? -->
+ <!-- extension
point="org.eclipse.ui.cheatsheets.cheatSheetContent">
<category
id="org.apache.hadoop.eclipse.cheatsheet.Examples"
@@ -149,7 +169,9 @@
contentFile="resources/HelloWorld.xml"
id="org.apache.hadoop.eclipse.cheatsheet"
name="Write a MapReduce application"/>
- </extension>
+ </extension -->
+
+ <!-- DFS Browser -->
<extension
point="org.eclipse.ui.navigator.navigatorContent">
<navigatorContent
@@ -158,12 +180,12 @@
icon="resources/elephantblue16x16.gif"
id="org.apache.hadoop.eclipse.views.dfscontent"
labelProvider="org.apache.hadoop.eclipse.dfs.DFSContentProvider"
- name="Distributed File Systems"
- priority="highest"
+ name="Hadoop Distributed File Systems"
+ priority="normal"
providesSaveables="false">
<triggerPoints>
<or>
- <instanceof value="org.apache.hadoop.eclipse.dfs.DfsPath"/>
+ <instanceof value="org.apache.hadoop.eclipse.dfs.DFSPath"/>
<adapt type="org.eclipse.core.resources.IResource">
<test
forcePluginActivation="true"
@@ -175,13 +197,16 @@
</actionProvider>
<possibleChildren>
<or>
- <instanceof value="org.apache.hadoop.eclipse.dfs.DfsPath"/>
<instanceof value="org.eclipse.wst.server.core.IServer"/>
- <instanceof value="org.apache.hadoop.eclipse.dfs.DFSContentProvider$DFS"/>
+ <instanceof value="org.apache.hadoop.eclipse.dfs.DFSLocationsRoot"/>
+ <instanceof value="org.apache.hadoop.eclipse.dfs.DFSLocation"/>
+ <instanceof value="org.apache.hadoop.eclipse.dfs.DFSPath"/>
</or>
</possibleChildren>
</navigatorContent>
</extension>
+
+ <!-- DFS Actions -->
<extension
point="org.eclipse.ui.navigator.viewer">
<viewer
@@ -225,35 +250,35 @@
isRoot="false"
pattern="org.apache.hadoop.eclipse.views.dfscontent"/>
<actionExtension pattern="org.apache.hadoop.eclipse.views.dfscontent.*"/>
-
-
-
-
-
-
-
</includes>
</viewerContentBinding>
</extension>
- <extension
+
+ <!-- HDFS FileSystem registration [TODO] -->
+ <!-- extension
point="org.eclipse.core.filesystem.filesystems">
- <filesystem scheme="dfs">
+ <filesystem scheme="hdfs">
<run class="org.apache.hadoop.eclipse.dfs.FileSystem"/>
</filesystem>
- </extension>
+ </extension -->
+
+ <!--
<extension
point="org.eclipse.ui.popupMenus">
<viewerContribution
id="Hadouken.viewerContribution1"
targetID="org.eclipse.ui.navigator.ProjectExplorer#PopupMenu"/>
- </extension>
+ </extension> -->
+
+ <!-- Preferences -->
<extension
point="org.eclipse.ui.preferencePages">
<page
- class="org.apache.hadoop.eclipse.preferences.HadoopHomeDirPreferencePage"
- id="org.apache.hadoop.eclipse.preferences.HadoopHomeDirPreferencePage"
- name="Hadoop Home Directory"/>
+ class="org.apache.hadoop.eclipse.preferences.MapReducePreferencePage"
+ id="org.apache.hadoop.eclipse.preferences.MapReducePreferencePage"
+ name="Hadoop Map/Reduce"/>
</extension>
+
<extension
point="org.eclipse.core.runtime.preferences">
<initializer class="org.apache.hadoop.eclipse.preferences.PreferenceInitializer"/>
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Conf.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Conf.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Conf.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Export.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Export.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Export.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Import.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Import.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Import.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/New.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/New.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/New.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Reload.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Reload.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Reload.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Tool.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Tool.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Tool.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Tools.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Tools.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Components/Tools.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-16x16.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-16x16.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-16x16.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-24x24.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-24x24.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-24x24.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-32x32.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-32x32.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-32x32.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-64x64.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-64x64.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-64x64.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-small-16x16.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-small-16x16.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant-small-16x16.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant.jpg
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant.jpg?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant.jpg
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-136x136.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-136x136.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-136x136.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-16x16.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-16x16.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-16x16.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-24x24.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-24x24.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-24x24.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-32x32.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-32x32.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-32x32.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-64x64.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-64x64.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2-64x64.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2.jpg
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2.jpg?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant2.jpg
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant3-122x122.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant3-122x122.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant3-122x122.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant3-16x16.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant3-16x16.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant3-16x16.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant3-24x24.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant3-24x24.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Elephant3-24x24.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Old/location-edit-16x16.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Old/location-edit-16x16.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/Old/location-edit-16x16.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/download.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/download.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/download.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/hadoop-logo-16x16.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/hadoop-logo-16x16.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/hadoop-logo-16x16.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/hadoop-logo-24x24.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/hadoop-logo-24x24.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/hadoop-logo-24x24.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/hadoop-logo-85x85.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/hadoop-logo-85x85.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/hadoop-logo-85x85.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/hadoop-logo.jpg
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/hadoop-logo.jpg?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/hadoop-logo.jpg
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/location-edit-16x16.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/location-edit-16x16.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/location-edit-16x16.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/location-new-16x16.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/location-new-16x16.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/location-new-16x16.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/new-folder.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/new-folder.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/new-folder.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/refresh.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/refresh.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/refresh.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/upload.png
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/upload.png?rev=588310&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lucene/hadoop/trunk/src/contrib/eclipse-plugin/resources/upload.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/Activator.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/Activator.java?rev=588310&r1=588309&r2=588310&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/Activator.java (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/Activator.java Thu Oct 25 11:58:32 2007
@@ -27,18 +27,28 @@
*/
public class Activator extends AbstractUIPlugin {
- // The plug-in ID
- public static final String PLUGIN_ID =
- "org.apache.hadoop.eclipse.Hadouken";
+ /**
+ * The plug-in ID
+ */
+ public static final String PLUGIN_ID = "org.apache.hadoop.eclipse";
- // The shared instance
+ /**
+ * The shared unique instance (singleton)
+ */
private static Activator plugin;
/**
- * The constructor
+ * Constructor
*/
public Activator() {
- plugin = this;
+ synchronized (Activator.class) {
+ if (plugin != null) {
+ // Not a singleton!?
+ throw new RuntimeException("Activator for " + PLUGIN_ID
+ + " is not a singleton");
+ }
+ plugin = this;
+ }
}
/* @inheritDoc */
@@ -56,9 +66,9 @@
}
/**
- * Returns the shared instance
+ * Returns the shared unique instance (singleton)
*
- * @return the shared instance
+ * @return the shared unique instance (singleton)
*/
public static Activator getDefault() {
return plugin;
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/ErrorMessageDialog.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/ErrorMessageDialog.java?rev=588310&view=auto
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/ErrorMessageDialog.java (added)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/ErrorMessageDialog.java Thu Oct 25 11:58:32 2007
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.eclipse;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Error dialog helper
+ */
+public class ErrorMessageDialog {
+
+ public static void display(final String title, final String message) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ MessageDialog.openError(Display.getDefault().getActiveShell(),
+ title, message);
+ }
+
+ });
+ }
+
+ public static void display(Exception e) {
+ display("An exception has occured!", "Exception description:\n"
+ + e.getLocalizedMessage());
+ }
+
+}
Added: lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/ImageLibrary.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/ImageLibrary.java?rev=588310&view=auto
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/ImageLibrary.java (added)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/ImageLibrary.java Thu Oct 25 11:58:32 2007
@@ -0,0 +1,252 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.eclipse;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.Bundle;
+
+/**
+ * Icons manager
+ */
+public class ImageLibrary {
+
+ private final Bundle bundle = Activator.getDefault().getBundle();
+
+ /**
+ * Singleton instance
+ */
+ private static volatile ImageLibrary instance = null;
+
+ private ISharedImages sharedImages =
+ PlatformUI.getWorkbench().getSharedImages();
+
+ /**
+ * Where resources (icons, images...) are available in the Bundle
+ */
+ private static final String RESOURCE_DIR = "resources/";
+
+ /**
+ * Public access to image descriptors
+ *
+ * @param name
+ * @return the image descriptor
+ */
+ public static ImageDescriptor get(String name) {
+ return getInstance().getImageDescriptorByName(name);
+ }
+
+ /**
+ * Public access to images
+ *
+ * @param name
+ * @return the image
+ */
+ public static Image getImage(String name) {
+ return getInstance().getImageByName(name);
+ }
+
+ /**
+ * Singleton access
+ *
+ * @return the Image library
+ */
+ public static ImageLibrary getInstance() {
+ if (instance == null) {
+ synchronized (ImageLibrary.class) {
+ if (instance == null)
+ instance = new ImageLibrary();
+ }
+ }
+ return instance;
+ }
+
+ /**
+ * Map of registered resources (ImageDescriptor and Image)
+ */
+ private Map<String, ImageDescriptor> descMap =
+ new HashMap<String, ImageDescriptor>();
+
+ private Map<String, Image> imageMap = new HashMap<String, Image>();
+
+ /**
+ * Image library constructor: put image definitions here.
+ */
+ private ImageLibrary() {
+ /*
+ * Servers view
+ */
+ newImage("server.view.location.entry", "Elephant-24x24.png");
+ newImage("server.view.job.entry", "job.gif");
+ newImage("server.view.action.location.new", "location-new-16x16.png");
+ newImage("server.view.action.location.edit", "location-edit-16x16.png");
+ newSharedImage("server.view.action.delete",
+ ISharedImages.IMG_TOOL_DELETE);
+
+ /*
+ * DFS Browser
+ */
+ newImage("dfs.browser.root.entry", "files.gif");
+ newImage("dfs.browser.location.entry", "Elephant-16x16.png");
+ newSharedImage("dfs.browser.folder.entry", ISharedImages.IMG_OBJ_FOLDER);
+ newSharedImage("dfs.browser.file.entry", ISharedImages.IMG_OBJ_FILE);
+ // DFS files in editor
+ newSharedImage("dfs.file.editor", ISharedImages.IMG_OBJ_FILE);
+ // Actions
+ newImage("dfs.browser.action.mkdir", "new-folder.png");
+ newImage("dfs.browser.action.download", "download.png");
+ newImage("dfs.browser.action.upload_files", "upload.png");
+ newImage("dfs.browser.action.upload_dir", "upload.png");
+ newSharedImage("dfs.browser.action.delete",
+ ISharedImages.IMG_TOOL_DELETE);
+ newImage("dfs.browser.action.refresh", "refresh.png");
+
+ /*
+ * Wizards
+ */
+ newImage("wizard.mapper.new", "mapwiz.png");
+ newImage("wizard.reducer.new", "reducewiz.png");
+ newImage("wizard.driver.new", "driverwiz.png");
+ newImage("wizard.mapreduce.project.new", "projwiz.png");
+ }
+
+ /**
+ * Accessor to images
+ *
+ * @param name
+ * @return
+ */
+ private ImageDescriptor getImageDescriptorByName(String name) {
+ return this.descMap.get(name);
+ }
+
+ /**
+ * Accessor to images
+ *
+ * @param name
+ * @return
+ */
+ private Image getImageByName(String name) {
+ return this.imageMap.get(name);
+ }
+
+ /**
+ * Access to platform shared images
+ *
+ * @param name
+ * @return
+ */
+ private ImageDescriptor getSharedByName(String name) {
+ return sharedImages.getImageDescriptor(name);
+ }
+
+ /**
+ * Load and register a new image. If the image resource does not exist or
+ * fails to load, a default "error" resource is supplied.
+ *
+ * @param name name of the image
+ * @param filename name of the file containing the image
+ * @return whether the image has correctly been loaded
+ */
+ private boolean newImage(String name, String filename) {
+ ImageDescriptor id;
+ boolean success;
+
+ try {
+ URL fileURL =
+ FileLocator.find(bundle, new Path(RESOURCE_DIR + filename), null);
+ id = ImageDescriptor.createFromURL(FileLocator.toFileURL(fileURL));
+ success = true;
+
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ id = ImageDescriptor.getMissingImageDescriptor();
+ // id = getSharedByName(ISharedImages.IMG_OBJS_ERROR_TSK);
+ success = false;
+ }
+
+ descMap.put(name, id);
+ imageMap.put(name, id.createImage(true));
+
+ return success;
+ }
+
+ /**
+ * Register an image from the workspace shared image pool. If the image
+ * resource does not exist or fails to load, a default "error" resource is
+ * supplied.
+ *
+ * @param name name of the image
+ * @param sharedName name of the shared image ({@link ISharedImages})
+ * @return whether the image has correctly been loaded
+ */
+ private boolean newSharedImage(String name, String sharedName) {
+ boolean success = true;
+ ImageDescriptor id = getSharedByName(sharedName);
+
+ if (id == null) {
+ id = ImageDescriptor.getMissingImageDescriptor();
+ // id = getSharedByName(ISharedImages.IMG_OBJS_ERROR_TSK);
+ success = false;
+ }
+
+ descMap.put(name, id);
+ imageMap.put(name, id.createImage(true));
+
+ return success;
+ }
+
+ /**
+ * Register an image from the workspace shared image pool. If the image
+ * resource does not exist or fails to load, a default "error" resource is
+ * supplied.
+ *
+ * @param name name of the image
+ * @param sharedName name of the shared image ({@link ISharedImages})
+ * @return whether the image has correctly been loaded
+ */
+ private boolean newPluginImage(String name, String pluginId,
+ String filename) {
+
+ boolean success = true;
+ ImageDescriptor id =
+ AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, filename);
+
+ if (id == null) {
+ id = ImageDescriptor.getMissingImageDescriptor();
+ // id = getSharedByName(ISharedImages.IMG_OBJS_ERROR_TSK);
+ success = false;
+ }
+
+ descMap.put(name, id);
+ imageMap.put(name, id.createImage(true));
+
+ return success;
+ }
+}
Modified: lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/MapReduceNature.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/MapReduceNature.java?rev=588310&r1=588309&r2=588310&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/MapReduceNature.java (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/MapReduceNature.java Thu Oct 25 11:58:32 2007
@@ -50,7 +50,7 @@
static Logger log = Logger.getLogger(MapReduceNature.class.getName());
/**
- * Configures an Eclipse project as a MapReduce project by adding the
+ * Configures an Eclipse project as a Map/Reduce project by adding the
* Hadoop libraries to a project's classpath.
*/
public void configure() throws CoreException {
@@ -98,7 +98,7 @@
new IClasspathEntry[currentCp.length + coreJars.size()];
System.arraycopy(currentCp, 0, newCp, 0, currentCp.length);
- final Iterator i = coreJars.iterator();
+ final Iterator<File> i = coreJars.iterator();
int count = 0;
while (i.hasNext()) {
// for (int i = 0; i < s_coreJarNames.length; i++) {
@@ -106,7 +106,7 @@
final File f = (File) i.next();
// URL url = FileLocator.toFileURL(FileLocator.find(bundle, new
// Path("lib/" + s_coreJarNames[i]), null));
- URL url = f.toURL();
+ URL url = f.toURI().toURL();
log.finer("hadoop library url.getPath() = " + url.getPath());
newCp[newCp.length - 1 - count] =
@@ -116,8 +116,8 @@
javaProject.setRawClasspath(newCp, new NullProgressMonitor());
} catch (Exception e) {
- log.log(Level.SEVERE, "IOException generated in HadoukenNature.class",
- e);
+ log.log(Level.SEVERE, "IOException generated in "
+ + this.getClass().getCanonicalName(), e);
}
}
@@ -126,7 +126,6 @@
*/
public void deconfigure() throws CoreException {
// TODO Auto-generated method stub
-
}
/**
@@ -143,4 +142,5 @@
public void setProject(IProject project) {
this.project = project;
}
+
}
Modified: lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewDriverWizardPage.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewDriverWizardPage.java?rev=588310&r1=588309&r2=588310&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewDriverWizardPage.java (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewDriverWizardPage.java Thu Oct 25 11:58:32 2007
@@ -70,14 +70,7 @@
this.showContainerSelector = showContainerSelector;
setTitle("MapReduce Driver");
setDescription("Create a new MapReduce driver.");
- try {
- setImageDescriptor(ImageDescriptor.createFromURL((FileLocator
- .toFileURL(FileLocator.find(Activator.getDefault().getBundle(),
- new Path("resources/driverwiz.png"), null)))));
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ setImageDescriptor(ImageLibrary.get("wizard.driver.new"));
}
public void setSelection(IStructuredSelection selection) {
Modified: lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewMapReduceProjectWizard.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewMapReduceProjectWizard.java?rev=588310&r1=588309&r2=588310&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewMapReduceProjectWizard.java (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewMapReduceProjectWizard.java Thu Oct 25 11:58:32 2007
@@ -24,13 +24,12 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import org.apache.hadoop.eclipse.preferences.HadoopHomeDirPreferencePage;
+import org.apache.hadoop.eclipse.preferences.MapReducePreferencePage;
import org.apache.hadoop.eclipse.preferences.PreferenceConstants;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -44,7 +43,6 @@
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.preference.PreferenceManager;
import org.eclipse.jface.preference.PreferenceNode;
-import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
@@ -72,8 +70,8 @@
public class NewMapReduceProjectWizard extends Wizard implements
IWorkbenchWizard, IExecutableExtension {
- static Logger log = Logger.getLogger(NewMapReduceProjectWizard.class
- .getName());
+ static Logger log =
+ Logger.getLogger(NewMapReduceProjectWizard.class.getName());
private HadoopFirstPage firstPage;
@@ -132,19 +130,11 @@
}
}
- static class HadoopFirstPage extends WizardNewProjectCreationPage implements
- SelectionListener {
+ static class HadoopFirstPage extends WizardNewProjectCreationPage
+ implements SelectionListener {
public HadoopFirstPage() {
super("New Hadoop Project");
-
- try {
- setImageDescriptor(ImageDescriptor.createFromURL((FileLocator
- .toFileURL(FileLocator.find(Activator.getDefault().getBundle(),
- new Path("resources/projwiz.png"), null)))));
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ setImageDescriptor(ImageLibrary.get("wizard.mapreduce.project.new"));
}
private Link openPreferences;
@@ -161,7 +151,7 @@
public String currentPath;
- private Button generateDriver;
+ // private Button generateDriver;
@Override
public void createControl(Composite parent) {
@@ -174,15 +164,19 @@
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
group.setText("Hadoop MapReduce Library Installation Path");
GridLayout layout = new GridLayout(3, true);
- layout.marginLeft = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.marginRight = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.marginTop = convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginBottom = convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginLeft =
+ convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.marginRight =
+ convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.marginTop =
+ convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginBottom =
+ convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
group.setLayout(layout);
workspaceHadoop = new Button(group, SWT.RADIO);
- GridData d = new GridData(GridData.BEGINNING, GridData.BEGINNING, false,
- false);
+ GridData d =
+ new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false);
d.horizontalSpan = 2;
workspaceHadoop.setLayoutData(d);
// workspaceHadoop.setText("Use default workbench Hadoop library
@@ -192,9 +186,10 @@
updateHadoopDirLabelFromPreferences();
openPreferences = new Link(group, SWT.NONE);
- openPreferences.setText("<a>Configure Hadoop install directory...</a>");
- openPreferences.setLayoutData(new GridData(GridData.END, GridData.CENTER,
- false, false));
+ openPreferences
+ .setText("<a>Configure Hadoop install directory...</a>");
+ openPreferences.setLayoutData(new GridData(GridData.END,
+ GridData.CENTER, false, false));
openPreferences.addSelectionListener(this);
projectHadoop = new Button(group, SWT.RADIO);
@@ -264,8 +259,9 @@
}
private void updateHadoopDirLabelFromPreferences() {
- path = Activator.getDefault().getPreferenceStore().getString(
- PreferenceConstants.P_PATH);
+ path =
+ Activator.getDefault().getPreferenceStore().getString(
+ PreferenceConstants.P_PATH);
if ((path != null) && (path.length() > 0)) {
workspaceHadoop.setText("Use default Hadoop");
@@ -280,9 +276,10 @@
public void widgetSelected(SelectionEvent e) {
if (e.getSource() == openPreferences) {
PreferenceManager manager = new PreferenceManager();
- manager.addToRoot(new PreferenceNode("Hadoop Installation Directory",
- new HadoopHomeDirPreferencePage()));
- PreferenceDialog dialog = new PreferenceDialog(this.getShell(), manager);
+ manager.addToRoot(new PreferenceNode(
+ "Hadoop Installation Directory", new MapReducePreferencePage()));
+ PreferenceDialog dialog =
+ new PreferenceDialog(this.getShell(), manager);
dialog.create();
dialog.setMessage("Select Hadoop Installation Directory");
dialog.setBlockOnOpen(true);
@@ -325,8 +322,9 @@
*/
firstPage = new HadoopFirstPage();
- javaPage = new NewJavaProjectWizardPage(ResourcesPlugin.getWorkspace()
- .getRoot(), firstPage);
+ javaPage =
+ new NewJavaProjectWizardPage(ResourcesPlugin.getWorkspace()
+ .getRoot(), firstPage);
// newDriverPage = new NewDriverWizardPage(false);
// newDriverPage.setPageComplete(false); // ensure finish button
// initially disabled
@@ -345,8 +343,8 @@
try {
monitor.beginTask("Create Hadoop Project", 300);
- javaPage.getRunnable()
- .run(new SubProgressMonitor(monitor, 100));
+ javaPage.getRunnable().run(
+ new SubProgressMonitor(monitor, 100));
// if( firstPage.generateDriver.getSelection())
// {
@@ -356,8 +354,8 @@
// SubProgressMonitor(monitor,100));
// }
- IProject project = javaPage.getNewJavaProject().getResource()
- .getProject();
+ IProject project =
+ javaPage.getNewJavaProject().getResource().getProject();
IProjectDescription description = project.getDescription();
String[] existingNatures = description.getNatureIds();
String[] natures = new String[existingNatures.length + 1];
@@ -371,7 +369,8 @@
project.setPersistentProperty(new QualifiedName(
Activator.PLUGIN_ID, "hadoop.runtime.path"),
firstPage.currentPath);
- project.setDescription(description, new NullProgressMonitor());
+ project.setDescription(description,
+ new NullProgressMonitor());
String[] natureIds = project.getDescription().getNatureIds();
for (int i = 0; i < natureIds.length; i++) {
Modified: lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewMapperWizard.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewMapperWizard.java?rev=588310&r1=588309&r2=588310&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewMapperWizard.java (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewMapperWizard.java Thu Oct 25 11:58:32 2007
@@ -42,8 +42,8 @@
import org.eclipse.ui.IWorkbench;
/**
- * Wizard for creating a new Mapper class (a class that runs the Map portion of
- * a MapReduce job). The class is pre-filled with a template.
+ * Wizard for creating a new Mapper class (a class that runs the Map portion
+ * of a MapReduce job). The class is pre-filled with a template.
*
*/
@@ -84,15 +84,7 @@
setTitle("Mapper");
setDescription("Create a new Mapper implementation.");
- try {
- setImageDescriptor(ImageDescriptor.createFromURL((FileLocator
- .toFileURL(FileLocator.find(Activator.getDefault().getBundle(),
- new Path("resources/mapwiz.png"), null)))));
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
+ setImageDescriptor(ImageLibrary.get("wizard.mapper.new"));
}
public void setSelection(IStructuredSelection selection) {
Modified: lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewReducerWizard.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewReducerWizard.java?rev=588310&r1=588309&r2=588310&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewReducerWizard.java (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/NewReducerWizard.java Thu Oct 25 11:58:32 2007
@@ -41,13 +41,13 @@
import org.eclipse.ui.IWorkbench;
/**
- * Wizard for creating a new Reducer class (a class that runs the Reduce portion
- * of a MapReduce job). The class is pre-filled with a template.
+ * Wizard for creating a new Reducer class (a class that runs the Reduce
+ * portion of a MapReduce job). The class is pre-filled with a template.
*
*/
-public class NewReducerWizard extends NewElementWizard implements INewWizard,
- IRunnableWithProgress {
+public class NewReducerWizard extends NewElementWizard implements
+ INewWizard, IRunnableWithProgress {
private Page page;
public NewReducerWizard() {
@@ -81,15 +81,7 @@
setTitle("Reducer");
setDescription("Create a new Reducer implementation.");
- try {
- setImageDescriptor(ImageDescriptor.createFromURL((FileLocator
- .toFileURL(FileLocator.find(Activator.getDefault().getBundle(),
- new Path("resources/reducewiz.png"), null)))));
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
+ setImageDescriptor(ImageLibrary.get("wizard.reducer.new"));
}
public void setSelection(IStructuredSelection selection) {
Copied: lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/DFSActionImpl.java (from r566883, lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/DfsAction.java)
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/DFSActionImpl.java?p2=lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/DFSActionImpl.java&p1=lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/DfsAction.java&r1=566883&r2=588310&rev=588310&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/DfsAction.java (original)
+++ lucene/hadoop/trunk/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/actions/DFSActionImpl.java Thu Oct 25 11:58:32 2007
@@ -18,40 +18,47 @@
package org.apache.hadoop.eclipse.actions;
+import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
-import org.apache.hadoop.eclipse.dfs.DfsFile;
-import org.apache.hadoop.eclipse.dfs.DfsFolder;
-import org.apache.hadoop.eclipse.dfs.DfsPath;
-import org.eclipse.core.internal.runtime.AdapterManager;
+import org.apache.hadoop.eclipse.ImageLibrary;
+import org.apache.hadoop.eclipse.dfs.DFSActions;
+import org.apache.hadoop.eclipse.dfs.DFSFile;
+import org.apache.hadoop.eclipse.dfs.DFSFolder;
+import org.apache.hadoop.eclipse.dfs.DFSLocation;
+import org.apache.hadoop.eclipse.dfs.DFSLocationsRoot;
+import org.apache.hadoop.eclipse.dfs.DFSPath;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IPersistableElement;
-import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
-import com.jcraft.jsch.JSchException;
-import com.jcraft.jsch.SftpException;
-
-public class DfsAction implements IObjectActionDelegate {
+/**
+ * Actual implementation of DFS actions
+ */
+public class DFSActionImpl implements IObjectActionDelegate {
private ISelection selection;
@@ -69,28 +76,82 @@
if (!(this.selection instanceof IStructuredSelection))
return;
- IStructuredSelection ss = (IStructuredSelection) selection;
- String actionId = action.getActionDefinitionId();
- try {
- if (actionId.equals("dfs.delete"))
- delete(ss);
- else if (actionId.equals("dfs.open"))
- open(ss);
- else if (actionId.equals("dfs.put"))
- put(ss);
- else if (actionId.equals("dfs.refresh"))
- refresh(ss);
- else if (actionId.equals("dfs.get"))
- get(ss);
-
- } catch (Exception e) {
- Shell shell = new Shell();
- e.printStackTrace();
- MessageDialog.openError(shell, "DFS Error",
- "An error occurred while performing DFS operation: "
- + e.getMessage());
- }
+ // operate on the DFS asynchronously to prevent blocking the main UI
+ final IStructuredSelection ss = (IStructuredSelection) selection;
+ final String actionId = action.getActionDefinitionId();
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ try {
+ switch (DFSActions.getById(actionId)) {
+ case DELETE: {
+ delete(ss);
+ break;
+ }
+ case OPEN: {
+ open(ss);
+ break;
+ }
+ case MKDIR: {
+ mkdir(ss);
+ break;
+ }
+ case UPLOAD_FILES: {
+ uploadFilesToDFS(ss);
+ break;
+ }
+ case UPLOAD_DIR: {
+ uploadDirectoryToDFS(ss);
+ break;
+ }
+ case REFRESH: {
+ refresh(ss);
+ break;
+ }
+ case DOWNLOAD: {
+ downloadFromDFS(ss);
+ break;
+ }
+ case RECONNECT: {
+ reconnect(ss);
+ break;
+ }
+ case DISCONNECT: {
+ disconnect(ss);
+ break;
+ }
+ default: {
+ System.err.printf("Unhandled DFS Action: " + actionId);
+ break;
+ }
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ MessageDialog.openError(Display.getDefault().getActiveShell(),
+ "DFS Action error",
+ "An error occurred while performing DFS operation: "
+ + e.getMessage());
+ }
+ }
+ });
+ }
+ /**
+ * Create a new sub-folder into an existing directory
+ *
+ * @param selection
+ */
+ private void mkdir(IStructuredSelection selection) {
+ List<DFSFolder> folders = filterSelection(DFSFolder.class, selection);
+ if (folders.size() >= 1) {
+ DFSFolder folder = folders.get(0);
+ InputDialog dialog =
+ new InputDialog(Display.getCurrent().getActiveShell(),
+ "Create subfolder", "Enter the name of the subfolder", "",
+ null);
+ if (dialog.open() == InputDialog.OK)
+ folder.mkdir(dialog.getValue());
+ }
}
/**
@@ -103,22 +164,109 @@
* @throws InvocationTargetException
* @throws InterruptedException
*/
- private void put(IStructuredSelection selection) throws SftpException,
- JSchException, InvocationTargetException, InterruptedException {
+ private void uploadFilesToDFS(IStructuredSelection selection)
+ throws InvocationTargetException, InterruptedException {
+
+ // Ask the user which files to upload
+ FileDialog dialog =
+ new FileDialog(Display.getCurrent().getActiveShell(), SWT.OPEN
+ | SWT.MULTI);
+ dialog.setText("Select the local files to upload");
+ dialog.open();
+
+ List<File> files = new ArrayList<File>();
+ for (String fname : dialog.getFileNames())
+ files.add(new File(dialog.getFilterPath() + File.separator + fname));
+
+ // TODO enable upload command only when selection is exactly one folder
+ List<DFSFolder> folders = filterSelection(DFSFolder.class, selection);
+ if (folders.size() >= 1)
+ uploadToDFS(folders.get(0), files);
+ }
+
+ /**
+ * Implement the import action (upload directory from the current machine
+ * to HDFS)
+ *
+ * @param object
+ * @throws SftpException
+ * @throws JSchException
+ * @throws InvocationTargetException
+ * @throws InterruptedException
+ */
+ private void uploadDirectoryToDFS(IStructuredSelection selection)
+ throws InvocationTargetException, InterruptedException {
// Ask the user which local directory to upload
DirectoryDialog dialog =
- new DirectoryDialog(Display.getCurrent().getActiveShell());
- dialog.setText("Copy from local directory");
- dialog.setMessage("Copy the local directory"
- + " to the selected directories on the distributed filesystem");
- String directory = dialog.open();
+ new DirectoryDialog(Display.getCurrent().getActiveShell(), SWT.OPEN
+ | SWT.MULTI);
+ dialog.setText("Select the local file or directory to upload");
+
+ String dirName = dialog.open();
+ final File dir = new File(dirName);
+ List<File> files = new ArrayList<File>();
+ files.add(dir);
+
+ // TODO enable upload command only when selection is exactly one folder
+ final List<DFSFolder> folders =
+ filterSelection(DFSFolder.class, selection);
+ if (folders.size() >= 1)
+ uploadToDFS(folders.get(0), files);
- if (directory == null)
+ }
+
+ private void uploadToDFS(final DFSFolder folder, final List<File> files)
+ throws InvocationTargetException, InterruptedException {
+
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(
+ new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException {
+
+ int work = 0;
+ for (File file : files)
+ work += computeUploadWork(file);
+
+ monitor.beginTask("Uploading files to distributed file system",
+ work);
+
+ for (File file : files) {
+ try {
+ folder.upload(monitor, file);
+
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ MessageDialog.openError(null,
+ "Upload files to distributed file system",
+ "Upload failed.\n" + ioe);
+ }
+ }
+
+ monitor.done();
+
+ // Update the UI
+ folder.doRefresh();
+ }
+ });
+ }
+
+ private void reconnect(IStructuredSelection selection) {
+ for (DFSLocation location : filterSelection(DFSLocation.class, selection))
+ location.reconnect();
+ }
+
+ private void disconnect(IStructuredSelection selection) {
+ if (selection.size() != 1)
return;
- for (DfsFolder folder : filterSelection(DfsFolder.class, selection))
- folder.put(directory);
+ Object first = selection.getFirstElement();
+ if (!(first instanceof DFSLocationsRoot))
+ return;
+
+ DFSLocationsRoot root = (DFSLocationsRoot) first;
+ root.disconnect();
+ root.refresh();
}
/**
@@ -127,9 +275,11 @@
* @param object
* @throws SftpException
* @throws JSchException
+ * @throws InterruptedException
+ * @throws InvocationTargetException
*/
- private void get(IStructuredSelection selection) throws SftpException,
- JSchException {
+ private void downloadFromDFS(IStructuredSelection selection)
+ throws InvocationTargetException, InterruptedException {
// Ask the user where to put the downloaded files
DirectoryDialog dialog =
@@ -142,15 +292,44 @@
if (directory == null)
return;
- for (DfsPath path : filterSelection(DfsPath.class, selection)) {
- try {
- path.downloadToLocalDirectory(directory);
- } catch (Exception e) {
- // nothing we want to do here, ignore
- e.printStackTrace();
- }
+ final File dir = new File(directory);
+ if (!dir.exists())
+ dir.mkdirs();
+
+ if (!dir.isDirectory()) {
+ MessageDialog.openError(null, "Download to local file system",
+ "Invalid directory location: \"" + dir + "\"");
+ return;
}
+ final List<DFSPath> paths = filterSelection(DFSPath.class, selection);
+
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(
+ new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException {
+
+ int work = 0;
+ for (DFSPath path : paths)
+ work += path.computeDownloadWork();
+
+ monitor
+ .beginTask("Downloading files to local file system", work);
+
+ for (DFSPath path : paths) {
+ if (monitor.isCanceled())
+ return;
+ try {
+ path.downloadToLocalDirectory(monitor, dir);
+ } catch (Exception e) {
+ // nothing we want to do here
+ e.printStackTrace();
+ }
+ }
+
+ monitor.done();
+ }
+ });
}
/**
@@ -163,89 +342,50 @@
* @throws InvocationTargetException
* @throws InterruptedException
*/
- private void open(IStructuredSelection selection) throws JSchException,
- IOException, PartInitException, InvocationTargetException,
- InterruptedException {
-
- for (final DfsFile path : filterSelection(DfsFile.class, selection)) {
-
- final InputStream data = path.open();
- if (data == null)
- continue;
-
- final IStorage storage = new IStorage() {
- public Object getAdapter(Class adapter) {
- return AdapterManager.getDefault().getAdapter(this, adapter);
- }
-
- public boolean isReadOnly() {
- return true;
- }
-
- public String getName() {
- return path.toString();
- }
-
- public IPath getFullPath() {
- return new Path(path.toString());
- }
-
- public InputStream getContents() throws CoreException {
- return data;
- }
- };
+ private void open(IStructuredSelection selection) throws IOException,
+ PartInitException, InvocationTargetException, InterruptedException {
- IStorageEditorInput storageEditorInput = new IStorageEditorInput() {
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- public String getToolTipText() {
- return "";
- }
-
- public IPersistableElement getPersistable() {
- return null;
- }
-
- public String getName() {
- return path.toString();
- }
-
- public ImageDescriptor getImageDescriptor() {
- return PlatformUI.getWorkbench().getSharedImages()
- .getImageDescriptor(ISharedImages.IMG_OBJ_FILE);
- }
-
- public boolean exists() {
- return true;
- }
-
- public IStorage getStorage() throws CoreException {
- return storage;
- }
- };
+ for (DFSFile file : filterSelection(DFSFile.class, selection)) {
+ IStorageEditorInput editorInput = new DFSFileEditorInput(file);
targetPart.getSite().getWorkbenchWindow().getActivePage().openEditor(
- storageEditorInput, "org.eclipse.ui.DefaultTextEditor");
+ editorInput, "org.eclipse.ui.DefaultTextEditor");
}
}
- private void refresh(IStructuredSelection selection) throws JSchException {
- for (DfsPath path : filterSelection(DfsPath.class, selection))
+ /**
+ * @param selection
+ * @throws JSchException
+ */
+ private void refresh(IStructuredSelection selection) {
+ for (DFSPath path : filterSelection(DFSPath.class, selection))
path.refresh();
}
- private void delete(IStructuredSelection selection) throws JSchException {
- List<DfsPath> list = filterSelection(DfsPath.class, selection);
+ private void delete(IStructuredSelection selection) {
+ List<DFSPath> list = filterSelection(DFSPath.class, selection);
if (list.isEmpty())
return;
- if (MessageDialog.openConfirm(null, "Confirm Delete from DFS",
- "Are you sure you want to delete " + list + " from the DFS?")) {
- for (DfsPath path : list)
+ StringBuffer msg = new StringBuffer();
+ msg.append("Are you sure you want to delete "
+ + "the following files from the distributed file system?\n");
+ for (DFSPath path : list)
+ msg.append(path.getPath()).append("\n");
+
+ if (MessageDialog.openConfirm(null, "Confirm Delete from DFS", msg
+ .toString())) {
+
+ Set<DFSPath> toRefresh = new HashSet<DFSPath>();
+ for (DFSPath path : list) {
path.delete();
+ toRefresh.add(path.getParent());
+ }
+
+ for (DFSPath path : toRefresh) {
+ path.refresh();
+ }
}
}
@@ -261,7 +401,7 @@
* @param selection the structured selection
* @return the list of <T> it contains
*/
- private <T> List<T> filterSelection(Class<T> clazz,
+ private static <T> List<T> filterSelection(Class<T> clazz,
IStructuredSelection selection) {
List<T> list = new ArrayList<T>();
for (Object obj : selection.toList()) {
@@ -272,4 +412,67 @@
return list;
}
+ private static int computeUploadWork(File file) {
+ if (file.isDirectory()) {
+ int contentWork = 1;
+ for (File child : file.listFiles())
+ contentWork += computeUploadWork(child);
+ return contentWork;
+
+ } else if (file.isFile()) {
+ return 1 + (int) (file.length() / 1024);
+
+ } else {
+ return 0;
+ }
+ }
+
}
+
+/**
+ * Adapter to allow the viewing of a DfsFile in the Editor window
+ */
+class DFSFileEditorInput extends PlatformObject implements
+ IStorageEditorInput {
+
+ private DFSFile file;
+
+ /**
+ * Constructor
+ *
+ * @param file
+ */
+ DFSFileEditorInput(DFSFile file) {
+ this.file = file;
+ }
+
+ /* @inheritDoc */
+ public String getToolTipText() {
+ return file.toDetailedString();
+ }
+
+ /* @inheritDoc */
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+ /* @inheritDoc */
+ public String getName() {
+ return file.toString();
+ }
+
+ /* @inheritDoc */
+ public ImageDescriptor getImageDescriptor() {
+ return ImageLibrary.get("dfs.file.editor");
+ }
+
+ /* @inheritDoc */
+ public boolean exists() {
+ return true;
+ }
+
+ /* @inheritDoc */
+ public IStorage getStorage() throws CoreException {
+ return file.getIStorage();
+ }
+};