You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hdt.apache.org by rs...@apache.org on 2013/07/25 06:29:18 UTC
[2/8] HDT-32: Merge the code base of Hadoop-Eclipse project into HDT.
Contributed by Srimanth Gunturi
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/.settings/org.eclipse.jdt.ui.prefs
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/.settings/org.eclipse.jdt.ui.prefs b/org.apache.hdt.ui/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..be0e13d
--- /dev/null
+++ b/org.apache.hdt.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,6 @@
+#Thu Mar 21 02:01:00 PDT 2013
+eclipse.preferences.version=1
+formatter_profile=_Apache Hadoop Eclipse Format
+formatter_settings_version=11
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context
" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * "License"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http\://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */</template><templ
ate autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author Srimanth Gunturi\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc
)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.code
templates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbod
y" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/META-INF/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/META-INF/MANIFEST.MF b/org.apache.hdt.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..aa7ecdb
--- /dev/null
+++ b/org.apache.hdt.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache Hadoop UI Eclipse Plugin
+Bundle-SymbolicName: org.apache.hdt.ui;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.apache.hdt.ui.Activator
+Bundle-Vendor: Apache Hadoop
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.ui,
+ org.eclipse.ui.ide;bundle-version="3.6.0",
+ org.eclipse.team.ui;bundle-version="3.5.100",
+ org.apache.hdt.core;bundle-version="1.0.0",
+ org.eclipse.ui.navigator;bundle-version="3.5.0",
+ org.eclipse.ui.navigator.resources;bundle-version="3.4.200",
+ org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.100";resolution:=optional
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/NOTICE.txt
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/NOTICE.txt b/org.apache.hdt.ui/NOTICE.txt
new file mode 100644
index 0000000..f4ba503
--- /dev/null
+++ b/org.apache.hdt.ui/NOTICE.txt
@@ -0,0 +1,2 @@
+Eclipse Icons (http://tech.joelbecker.net/articles/resources/5-eclipseicons - Eclipse Public License v 1.0)
+http://eclipse.org/ - http://www.eclipse.org/legal/epl-v10.html
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/build.properties
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/build.properties b/org.apache.hdt.ui/build.properties
new file mode 100644
index 0000000..e9472eb
--- /dev/null
+++ b/org.apache.hdt.ui/build.properties
@@ -0,0 +1,9 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ NOTICE.txt,\
+ icons/
+src.includes = NOTICE.txt,\
+ src/
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/plugin.xml
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/plugin.xml b/org.apache.hdt.ui/plugin.xml
new file mode 100644
index 0000000..2051a9f
--- /dev/null
+++ b/org.apache.hdt.ui/plugin.xml
@@ -0,0 +1,424 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ 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.
+-->
+<plugin>
+ <extension
+ point="org.eclipse.ui.perspectives">
+ <perspective
+ class="org.apache.hdt.ui.internal.HadoopPerspectiveFactory"
+ icon="icons/hadoop-logo-16x16.png"
+ id="org.apache.hdt.ui.perspective"
+ name="Hadoop">
+ </perspective>
+ </extension>
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension
+ targetID="org.apache.hdt.ui.perspective">
+ <view
+ id="org.apache.hdt.ui.view.servers"
+ minimized="false"
+ ratio="0.25"
+ relationship="left"
+ relative="org.eclipse.ui.editorss">
+ </view>
+ <view
+ id="org.eclipse.ui.navigator.ProjectExplorer"
+ minimized="false"
+ ratio="0.5"
+ relationship="bottom"
+ relative="org.apache.hdt.ui.view.servers">
+ </view>
+ <view
+ id="org.eclipse.ui.views.PropertySheet"
+ minimized="false"
+ ratio="0.66"
+ relationship="bottom"
+ relative="org.eclipse.ui.editorss">
+ </view>
+ <newWizardShortcut
+ id="org.apache.hdt.ui.wizard.newHdfsServer">
+ </newWizardShortcut>
+ <newWizardShortcut
+ id="org.apache.hdt.ui.wizard.newZooKeeperServer">
+ </newWizardShortcut>
+ <viewShortcut
+ id="org.eclipse.ui.views.ResourceNavigator">
+ </viewShortcut>
+ <actionSet
+ id="org.apache.hdt.ui.actionSet.newServers">
+ </actionSet>
+ </perspectiveExtension>
+ </extension>
+ <extension
+ point="org.eclipse.ui.decorators">
+ <decorator
+ adaptable="true"
+ class="org.apache.hdt.ui.internal.hdfs.HDFSLightweightLabelDecorator"
+ id="org.apache.hdt.ui.decorator.hdfs"
+ label="HDFS Resource Decorator"
+ lightweight="true"
+ location="BOTTOM_RIGHT"
+ state="true">
+ <enablement>
+ <objectClass
+ name="org.eclipse.core.resources.IResource">
+ </objectClass>
+ </enablement>
+ </decorator>
+ <decorator
+ adaptable="true"
+ class="org.apache.hdt.ui.internal.zookeeper.ZooKeeperLightweightLabelDecorator"
+ id="org.apache.hdt.ui.decorator.zookeeper"
+ label="ZooKeeper Resource Decorator"
+ lightweight="true"
+ location="BOTTOM_RIGHT"
+ state="true">
+ <enablement>
+ <objectClass
+ name="org.apache.hdt.core.internal.model.ZNode">
+ </objectClass>
+ </enablement>
+ </decorator>
+ </extension>
+ <extension
+ point="org.eclipse.ui.navigator.viewer">
+ <viewerContentBinding
+ viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <contentExtension
+ isRoot="false"
+ pattern="org.apache.hdt.ui.navigatorContent.hdfs">
+ </contentExtension>
+ </includes>
+ </viewerContentBinding>
+ <viewerContentBinding
+ viewerId="org.apache.hdt.ui.view.servers">
+ <includes>
+ <contentExtension
+ isRoot="true"
+ pattern="org.apache.hdt.ui.navigatorContent.hadoop">
+ </contentExtension>
+ </includes>
+ </viewerContentBinding>
+ </extension>
+ <extension
+ point="org.eclipse.ui.navigator.navigatorContent">
+ <navigatorContent
+ contentProvider="org.apache.hdt.ui.internal.hdfs.HDFSCommonContentProvider"
+ icon="icons/hadoop-logo-16x16.png"
+ id="org.apache.hdt.ui.navigatorContent.hdfs"
+ labelProvider="org.apache.hdt.ui.internal.hdfs.HDFSLabelProvider"
+ name="Navigator HDFS Content Provider"
+ priority="higher">
+ <triggerPoints>
+ <instanceof
+ value="org.eclipse.core.resources.IProject">
+ </instanceof>
+ </triggerPoints>
+ </navigatorContent>
+ <navigatorContent
+ contentProvider="org.apache.hdt.ui.internal.HadoopCommonContentProvider"
+ icon="icons/hadoop-logo-16x16.png"
+ id="org.apache.hdt.ui.navigatorContent.hadoop"
+ labelProvider="org.apache.hdt.ui.internal.HadoopLabelProvider"
+ name="Hadoop Content Provider">
+ <triggerPoints>
+ <instanceof
+ value="org.apache.hdt.core.internal.model.ZooKeeperServer">
+ </instanceof></triggerPoints>
+ </navigatorContent>
+ </extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ category="org.apache.hdt.ui.newWizards.category"
+ class="org.apache.hdt.ui.internal.hdfs.NewHDFSWizard"
+ finalPerspective="org.apache.hdt.ui.perspective"
+ icon="icons/hadoop-hdfs-new.png"
+ id="org.apache.hdt.ui.wizard.newHdfsServer"
+ name="New HDFS Server">
+ </wizard>
+ <category
+ id="org.apache.hdt.ui.newWizards.category"
+ name="Hadoop">
+ </category>
+ <wizard
+ category="org.apache.hdt.ui.newWizards.category"
+ class="org.apache.hdt.ui.internal.zookeeper.NewZooKeeperWizard"
+ finalPerspective="org.apache.hdt.ui.perspective"
+ icon="icons/hadoop-zookeeper-new.png"
+ id="org.apache.hdt.ui.wizard.newZooKeeperServer"
+ name="New ZooKeeper Server">
+ </wizard>
+ </extension>
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ id="org.apache.hdt.ui.team.fileContribution"
+ objectClass="org.eclipse.core.resources.IFile">
+ <action
+ class="org.apache.hdt.ui.internal.hdfs.DownloadResourceAction"
+ icon="icons/download.gif"
+ id="org.apache.hdt.ui.team.FileDownloadAction"
+ label="Download"
+ menubarPath="additions">
+ </action>
+ <action
+ class="org.apache.hdt.ui.internal.hdfs.UploadResourceAction"
+ icon="icons/upload.gif"
+ id="org.apache.hdt.ui.team.FileUploadAction"
+ label="Upload"
+ menubarPath="additions">
+ </action>
+ <action
+ class="org.apache.hdt.ui.internal.hdfs.DiscardDownloadResourceAction"
+ icon="icons/discardDownload.png"
+ id="org.apache.hdt.ui.team.fileDiscardDownloadAction"
+ label="Discard Download"
+ menubarPath="additions">
+ </action>
+ </objectContribution>
+ <objectContribution
+ adaptable="true"
+ id="org.apache.hdt.ui.team.folderContribution"
+ objectClass="org.eclipse.core.resources.IFolder">
+ <action
+ class="org.apache.hdt.ui.internal.hdfs.DownloadResourceAction"
+ icon="icons/download.gif"
+ id="org.apache.hdt.ui.team.folderDownloadContribution"
+ label="Download"
+ menubarPath="additions">
+ </action>
+ <action
+ class="org.apache.hdt.ui.internal.hdfs.UploadResourceAction"
+ icon="icons/upload.gif"
+ id="org.apache.hdt.ui.team.folderUploadContribution"
+ label="Upload"
+ menubarPath="additions">
+ </action>
+ <action
+ class="org.apache.hdt.ui.internal.hdfs.DiscardDownloadResourceAction"
+ icon="icons/discardDownload.png"
+ id="org.apache.hdt.ui.team.folderDiscardDownloadAction"
+ label="Discard Download"
+ menubarPath="additions">
+ </action>
+ </objectContribution>
+ <objectContribution
+ adaptable="false"
+ id="org.apache.hdt.ui.team.projectContribution"
+ objectClass="org.eclipse.core.resources.IProject">
+ <action
+ class="org.apache.hdt.ui.internal.hdfs.ReconnectAction"
+ icon="icons/ovr/online.png"
+ id="org.apache.hdt.ui.team.projectReconnectContribution"
+ label="Reconnect"
+ menubarPath="additions">
+ <class
+ class="org.eclipse.core.resources.IProject">
+ </class>
+ </action>
+ <action
+ class="org.apache.hdt.ui.internal.hdfs.DisconnectAction"
+ icon="icons/ovr/offline.png"
+ id="org.apache.hdt.ui.team.projectDisconnectContribution"
+ label="Disconnect"
+ menubarPath="additions">
+ <class
+ class="org.eclipse.core.resources.IProject">
+ </class>
+ </action>
+ </objectContribution>
+ <objectContribution
+ adaptable="false"
+ id="org.apache.hdt.ui.team.zkServerContribution"
+ objectClass="org.apache.hdt.core.internal.model.ZooKeeperServer">
+ <action
+ class="org.apache.hdt.ui.internal.zookeeper.DisconnectAction"
+ icon="icons/ovr/offline.png"
+ id="org.apache.hdt.ui.team.zookeeper.DisconnectContribution"
+ label="Disconnect"
+ menubarPath="additions">
+ </action>
+ <action
+ class="org.apache.hdt.ui.internal.zookeeper.ReconnectAction"
+ icon="icons/ovr/online.png"
+ id="org.apache.hdt.ui.team.zookeeper.ReconnectContribution"
+ label="Reconnect"
+ menubarPath="additions">
+ </action>
+ <action
+ class="org.apache.hdt.ui.internal.zookeeper.RefreshAction"
+ icon="icons/zookeeper-refresh.gif"
+ id="org.apache.hdt.ui.team.zookeeper.server.RefreshContribution"
+ label="Refresh"
+ menubarPath="additions">
+ </action>
+ <action
+ class="org.apache.hdt.ui.internal.zookeeper.DeleteAction"
+ icon="icons/delete.gif"
+ id="org.apache.hdt.ui.team.zookeeper.node.DeleteContribution"
+ label="Delete"
+ menubarPath="additions">
+ </action>
+ <visibility>
+ <objectClass
+ name="org.apache.hdt.core.internal.model.ZooKeeperServer">
+ </objectClass>
+ </visibility>
+ </objectContribution>
+ <objectContribution
+ adaptable="false"
+ id="org.apache.hdt.ui.team.zkNodeContribution"
+ objectClass="org.apache.hdt.core.internal.model.ZNode">
+ <action
+ class="org.apache.hdt.ui.internal.zookeeper.RefreshAction"
+ icon="icons/zookeeper-refresh.gif"
+ id="org.apache.hdt.ui.team.zookeeper.node.RefreshContribution"
+ label="Refresh"
+ menubarPath="additions">
+ </action>
+ <action
+ class="org.apache.hdt.ui.internal.zookeeper.DeleteAction"
+ icon="icons/delete.gif"
+ id="org.apache.hdt.ui.team.zookeeper.node.DeleteContribution"
+ label="Delete"
+ menubarPath="additions">
+ </action>
+ <action
+ class="org.apache.hdt.ui.internal.zookeeper.OpenAction"
+ enablesFor="1+"
+ id="org.apache.hdt.ui.team.zookeeper.node.OpenContribution"
+ label="Open"
+ menubarPath="additions">
+ </action>
+ <visibility>
+ <and>
+ <objectClass
+ name="org.apache.hdt.core.internal.model.ZNode">
+ </objectClass>
+ <not>
+ <objectClass
+ name="org.apache.hdt.core.internal.model.ZooKeeperServer">
+ </objectClass>
+ </not>
+ </and>
+ </visibility>
+ </objectContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
+ <propertyContributor
+ contributorId="org.eclipse.ui.navigator.ProjectExplorer"
+ typeMapper="org.apache.hdt.ui.internal.hdfs.PropertyTypeMapper">
+ <propertyCategory
+ category="general"></propertyCategory>
+ <propertyCategory
+ category="resource">
+ </propertyCategory>
+ </propertyContributor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
+ <propertyTabs
+ contributorId="org.eclipse.ui.navigator.ProjectExplorer">
+ <propertyTab
+ category="resource"
+ id="org.apache.hdt.ui.propertyTab.hdfs"
+ image="icons/hadoop-hdfs-16x16.gif"
+ label="HDFS">
+ </propertyTab>
+ </propertyTabs>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertySections">
+ <propertySections
+ contributorId="org.eclipse.ui.navigator.ProjectExplorer">
+ <propertySection
+ class="org.apache.hdt.ui.internal.hdfs.HDFSPropertySection"
+ enablesFor="1"
+ id="org.apache.hdt.ui.propertySection.hdfs"
+ tab="org.apache.hdt.ui.propertyTab.hdfs">
+ <input
+ type="org.apache.hdt.core.internal.hdfs.HDFSFileStore">
+ </input>
+ </propertySection>
+ </propertySections>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.apache.hdt.core.internal.hdfs.HDFSFileStore"
+ class="org.apache.hdt.ui.internal.HadoopAdapterFactory">
+ <adapter
+ type="org.eclipse.ui.views.properties.IPropertySource">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.apache.hdt.core.internal.model.ZNode"
+ class="org.apache.hdt.ui.internal.HadoopAdapterFactory">
+ <adapter
+ type="org.eclipse.ui.views.properties.IPropertySource">
+ </adapter>
+ </factory>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ allowMultiple="false"
+ category="org.apache.hdt.ui.category"
+ class="org.eclipse.ui.navigator.CommonNavigator"
+ icon="icons/hadoop-logo-16x16.png"
+ id="org.apache.hdt.ui.view.servers"
+ name="Hadoop Servers"
+ restorable="true">
+ </view>
+ <category
+ id="org.apache.hdt.ui.category"
+ name="Hadoop">
+ </category>
+ </extension>
+ <extension
+ point="org.eclipse.ui.actionSets">
+ <actionSet
+ id="org.apache.hdt.ui.actionSet.newServers"
+ label="Hadoop New Servers Action Set">
+ <action
+ class="org.apache.hdt.ui.internal.zookeeper.NewZooKeeperServerAction"
+ icon="icons/hadoop-zookeeper-new.png"
+ id="org.apache.hdt.ui.action.new.hdfs"
+ label="New ZooKeeper Server"
+ style="push"
+ toolbarPath="new.group"
+ tooltip="New ZooKeeper Server">
+ </action>
+ <action
+ class="org.apache.hdt.ui.internal.hdfs.NewHDFSServerAction"
+ icon="icons/hadoop-hdfs-new.png"
+ id="org.apache.hdt.ui.action.new.hdfs"
+ label="New HDFS Server"
+ style="push"
+ toolbarPath="new.group"
+ tooltip="New HDFS Server">
+ </action>
+ </actionSet>
+ </extension>
+
+</plugin>
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/src/org/apache/hdt/ui/Activator.java
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/src/org/apache/hdt/ui/Activator.java b/org.apache.hdt.ui/src/org/apache/hdt/ui/Activator.java
new file mode 100644
index 0000000..99d7105
--- /dev/null
+++ b/org.apache.hdt.ui/src/org/apache/hdt/ui/Activator.java
@@ -0,0 +1,135 @@
+/**
+ * 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.hdt.ui;
+
+import java.net.URL;
+
+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.plugin.AbstractUIPlugin;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ * @author Srimanth Gunturi
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // private static final Logger logger = Logger.getLogger(Activator.class);
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.apache.hdt.core"; //$NON-NLS-1$
+ public static final String PREFERENCE_HDFS_URLS = "HDFS_SERVER_URLS";
+ public static final String PREFERENCE_ZOOKEEPER_URLS = "ZOOKEEPER_SERVER_URLS";
+ // ImageDescriptors
+ public static ImageDescriptor IMAGE_REMOTE_OVR;
+ public static ImageDescriptor IMAGE_LOCAL_OVR;
+ public static ImageDescriptor IMAGE_INCOMING_OVR;
+ public static ImageDescriptor IMAGE_OUTGOING_OVR;
+ public static ImageDescriptor IMAGE_SYNC_OVR;
+ public static ImageDescriptor IMAGE_READONLY_OVR;
+ public static ImageDescriptor IMAGE_HADOOP;
+ public static ImageDescriptor IMAGE_OFFLINE_OVR;
+ public static ImageDescriptor IMAGE_ONLINE_OVR;
+ public static ImageDescriptor IMAGE_ZOOKEEPER_EPHERMERAL;
+ // Images
+ public static Image IMAGE_HDFS;
+ public static Image IMAGE_ZOOKEEPER;
+ public static Image IMAGE_ZOOKEEPER_NODE;
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+ * )
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ loadImages();
+ }
+
+ /**
+ *
+ */
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+ * )
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ private void loadImages() {
+ Bundle bundle = getDefault().getBundle();
+ URL remoteFileUrl = FileLocator.find(bundle, new Path("/icons/ovr/remote_resource.gif"), null);
+ URL localFileUrl = FileLocator.find(bundle, new Path("/icons/ovr/local_resource.gif"), null);
+ URL incomingUrl = FileLocator.find(bundle, new Path("/icons/ovr/overlay-incoming.gif"), null);
+ URL outgoingUrl = FileLocator.find(bundle, new Path("/icons/ovr/overlay-outgoing.gif"), null);
+ URL waitingUrl = FileLocator.find(bundle, new Path("/icons/ovr/waiting_ovr.gif"), null);
+ URL hdfsUrl = FileLocator.find(bundle, new Path("/icons/hadoop-hdfs-16x16.gif"), null);
+ URL zookeeperUrl = FileLocator.find(bundle, new Path("/icons/hadoop-zookeeper-16x16.png"), null);
+ URL zookeeperNodeUrl = FileLocator.find(bundle, new Path("/icons/zookeeper_node.png"), null);
+ URL hadoopUrl = FileLocator.find(bundle, new Path("/icons/hadoop-logo-16x16.png"), null);
+ URL readonlyUrl = FileLocator.find(bundle, new Path("/icons/ovr/read_only.gif"), null);
+ URL offlineUrl = FileLocator.find(bundle, new Path("/icons/ovr/offline.png"), null);
+ URL onlineUrl = FileLocator.find(bundle, new Path("/icons/ovr/online.png"), null);
+ URL zookeeperEphermeralUrl = FileLocator.find(bundle, new Path("/icons/ovr/zookeeper_ephermeral.gif"), null);
+
+ IMAGE_REMOTE_OVR = ImageDescriptor.createFromURL(remoteFileUrl);
+ IMAGE_LOCAL_OVR = ImageDescriptor.createFromURL(localFileUrl);
+ IMAGE_INCOMING_OVR = ImageDescriptor.createFromURL(incomingUrl);
+ IMAGE_OUTGOING_OVR = ImageDescriptor.createFromURL(outgoingUrl);
+ IMAGE_SYNC_OVR = ImageDescriptor.createFromURL(waitingUrl);
+ IMAGE_HDFS = ImageDescriptor.createFromURL(hdfsUrl).createImage();
+ IMAGE_HADOOP = ImageDescriptor.createFromURL(hadoopUrl);
+ IMAGE_READONLY_OVR = ImageDescriptor.createFromURL(readonlyUrl);
+ IMAGE_OFFLINE_OVR = ImageDescriptor.createFromURL(offlineUrl);
+ IMAGE_ONLINE_OVR = ImageDescriptor.createFromURL(onlineUrl);
+ IMAGE_ZOOKEEPER = ImageDescriptor.createFromURL(zookeeperUrl).createImage();
+ IMAGE_ZOOKEEPER_NODE = ImageDescriptor.createFromURL(zookeeperNodeUrl).createImage();
+ IMAGE_ZOOKEEPER_EPHERMERAL = ImageDescriptor.createFromURL(zookeeperEphermeralUrl);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopAdapterFactory.java
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopAdapterFactory.java b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopAdapterFactory.java
new file mode 100644
index 0000000..e8af745
--- /dev/null
+++ b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopAdapterFactory.java
@@ -0,0 +1,30 @@
+package org.apache.hdt.ui.internal;
+
+import org.apache.hdt.core.internal.hdfs.HDFSFileStore;
+import org.apache.hdt.core.internal.model.ZNode;
+import org.apache.hdt.ui.internal.hdfs.HDFSFileStorePropertySource;
+import org.apache.hdt.ui.internal.zookeeper.ZNodePropertySource;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+public class HadoopAdapterFactory implements IAdapterFactory {
+
+ @Override
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof HDFSFileStore) {
+ HDFSFileStore fs = (HDFSFileStore) adaptableObject;
+ if (adapterType == IPropertySource.class)
+ return new HDFSFileStorePropertySource(fs);
+ } else if (adaptableObject instanceof ZNode) {
+ ZNode z = (ZNode) adaptableObject;
+ return new ZNodePropertySource(z);
+ }
+ return null;
+ }
+
+ @Override
+ public Class[] getAdapterList() {
+ return new Class[] { IPropertySource.class };
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopCommonContentProvider.java
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopCommonContentProvider.java b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopCommonContentProvider.java
new file mode 100644
index 0000000..c671c49
--- /dev/null
+++ b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopCommonContentProvider.java
@@ -0,0 +1,182 @@
+/**
+ * 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.hdt.ui.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hdt.ui.internal.zookeeper.ZooKeeperCommonContentProvider;
+import org.apache.log4j.Logger;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonContentProvider;
+
+/**
+ * @author Srimanth Gunturi
+ *
+ */
+public class HadoopCommonContentProvider implements ICommonContentProvider {
+
+ private static final Logger logger = Logger.getLogger(HadoopCommonContentProvider.class);
+ private List<ICommonContentProvider> childProviders = new ArrayList<ICommonContentProvider>();
+
+ /**
+ *
+ */
+ public HadoopCommonContentProvider() {
+ childProviders.add(new ZooKeeperCommonContentProvider());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.
+ * Object)
+ */
+ @Override
+ public Object[] getElements(Object inputElement) {
+ List<Object> elements = new ArrayList<Object>();
+ for (ICommonContentProvider cp : childProviders) {
+ Object[] ces = cp.getElements(inputElement);
+ if (ces != null)
+ for (Object s : ces)
+ elements.add(s);
+ }
+ if (logger.isDebugEnabled())
+ logger.debug("getElements(" + inputElement + "): " + elements);
+ return elements.toArray();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.
+ * Object)
+ */
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ List<Object> elements = new ArrayList<Object>();
+ for (ICommonContentProvider cp : childProviders) {
+ Object[] ces = cp.getChildren(parentElement);
+ if (ces != null)
+ for (Object s : ces)
+ elements.add(s);
+ }
+ if (logger.isDebugEnabled())
+ logger.debug("getChildren(" + parentElement + "): " + elements);
+ return elements.toArray();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object
+ * )
+ */
+ @Override
+ public Object getParent(Object element) {
+ for (ICommonContentProvider cp : childProviders) {
+ Object parent = cp.getParent(element);
+ if (parent != null)
+ return parent;
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.
+ * Object)
+ */
+ @Override
+ public boolean hasChildren(Object element) {
+ for (ICommonContentProvider cp : childProviders) {
+ boolean hasChildren = cp.hasChildren(element);
+ if (hasChildren)
+ return hasChildren;
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ for (ICommonContentProvider cp : childProviders)
+ cp.dispose();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface
+ * .viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ for (ICommonContentProvider cp : childProviders)
+ cp.inputChanged(viewer, oldInput, newInput);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.navigator.IMementoAware#restoreState(org.eclipse.ui.IMemento
+ * )
+ */
+ @Override
+ public void restoreState(IMemento aMemento) {
+ // TODO Auto-generated method stub
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.navigator.IMementoAware#saveState(org.eclipse.ui.IMemento)
+ */
+ @Override
+ public void saveState(IMemento aMemento) {
+ // TODO Auto-generated method stub
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.navigator.ICommonContentProvider#init(org.eclipse.ui.navigator
+ * .ICommonContentExtensionSite)
+ */
+ @Override
+ public void init(ICommonContentExtensionSite aConfig) {
+ for (ICommonContentProvider cp : childProviders)
+ cp.init(aConfig);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopLabelProvider.java
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopLabelProvider.java b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopLabelProvider.java
new file mode 100644
index 0000000..c0f6529
--- /dev/null
+++ b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopLabelProvider.java
@@ -0,0 +1,177 @@
+/**
+ * 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.hdt.ui.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hdt.ui.internal.hdfs.HDFSLabelProvider;
+import org.apache.hdt.ui.internal.zookeeper.ZooKeeperLabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonLabelProvider;
+
+/**
+ * @author Srimanth Gunturi
+ *
+ */
+public class HadoopLabelProvider implements ICommonLabelProvider {
+ private List<ICommonLabelProvider> childProviders = new ArrayList<ICommonLabelProvider>();
+
+ /**
+ *
+ */
+ public HadoopLabelProvider() {
+ childProviders.add(new HDFSLabelProvider());
+ childProviders.add(new ZooKeeperLabelProvider());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ */
+ @Override
+ public Image getImage(Object element) {
+ for (ICommonLabelProvider lp : childProviders) {
+ Image image = lp.getImage(element);
+ if (image != null)
+ return image;
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object element) {
+ for (ICommonLabelProvider lp : childProviders) {
+ String text = lp.getText(element);
+ if (text != null)
+ return text;
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.
+ * jface.viewers.ILabelProviderListener)
+ */
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang
+ * .Object, java.lang.String)
+ */
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse
+ * .jface.viewers.ILabelProviderListener)
+ */
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.navigator.IMementoAware#restoreState(org.eclipse.ui.IMemento
+ * )
+ */
+ @Override
+ public void restoreState(IMemento aMemento) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.navigator.IMementoAware#saveState(org.eclipse.ui.IMemento)
+ */
+ @Override
+ public void saveState(IMemento aMemento) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.navigator.IDescriptionProvider#getDescription(java.lang
+ * .Object)
+ */
+ @Override
+ public String getDescription(Object anElement) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.navigator.ICommonLabelProvider#init(org.eclipse.ui.navigator
+ * .ICommonContentExtensionSite)
+ */
+ @Override
+ public void init(ICommonContentExtensionSite aConfig) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopPerspectiveFactory.java
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopPerspectiveFactory.java b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopPerspectiveFactory.java
new file mode 100644
index 0000000..e312632
--- /dev/null
+++ b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopPerspectiveFactory.java
@@ -0,0 +1,40 @@
+/**
+ * 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.hdt.ui.internal;
+
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+
+/**
+ *
+ * @author Srimanth Gunturi
+ */
+public class HadoopPerspectiveFactory implements IPerspectiveFactory {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui
+ * .IPageLayout)
+ */
+ @Override
+ public void createInitialLayout(IPageLayout layout) {
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopServersView.java
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopServersView.java b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopServersView.java
new file mode 100644
index 0000000..e12c80d
--- /dev/null
+++ b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/HadoopServersView.java
@@ -0,0 +1,29 @@
+/**
+ * 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.hdt.ui.internal;
+
+import org.eclipse.ui.navigator.CommonNavigator;
+
+/**
+ * @author Srimanth Gunturi
+ *
+ */
+public class HadoopServersView extends CommonNavigator {
+
+ public static final String VIEW_ID = "org.apache.hdt.ui.view.servers";
+}
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/DiscardDownloadResourceAction.java
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/DiscardDownloadResourceAction.java b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/DiscardDownloadResourceAction.java
new file mode 100644
index 0000000..ce1c4d2
--- /dev/null
+++ b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/DiscardDownloadResourceAction.java
@@ -0,0 +1,132 @@
+package org.apache.hdt.ui.internal.hdfs;
+
+import java.io.File;
+import java.util.Iterator;
+
+import org.apache.hdt.core.internal.hdfs.HDFSFileStore;
+import org.apache.hdt.core.internal.hdfs.HDFSManager;
+import org.apache.hdt.core.internal.hdfs.UploadFileJob;
+import org.apache.log4j.Logger;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+public class DiscardDownloadResourceAction implements IObjectActionDelegate {
+
+ private final static Logger logger = Logger.getLogger(DiscardDownloadResourceAction.class);
+ private ISelection selection;
+ private IWorkbenchPart targetPart;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ @Override
+ public void run(IAction action) {
+ if (this.selection != null && !this.selection.isEmpty()) {
+ IStructuredSelection sSelection = (IStructuredSelection) this.selection;
+ @SuppressWarnings("rawtypes")
+ Iterator itr = sSelection.iterator();
+ while (itr.hasNext()) {
+ Object object = itr.next();
+ if (object instanceof IResource) {
+ IResource r = (IResource) object;
+ discardDownloadResource(r);
+ }
+ }
+ }
+ }
+
+ /**
+ * @param r
+ */
+ private void discardDownloadResource(IResource r) {
+ try {
+ HDFSFileStore store = (HDFSFileStore) EFS.getStore(r.getLocationURI());
+ switch (r.getType()) {
+ case IResource.FOLDER:
+ IFolder folder = (IFolder) r;
+ IResource[] members = folder.members();
+ if (members != null) {
+ for (int mc = 0; mc < members.length; mc++) {
+ discardDownloadResource(members[mc]);
+ }
+ }
+ case IResource.FILE:
+ if (store.isLocalFile()) {
+ File file = store.getLocalFile();
+ HDFSManager.INSTANCE.startServerOperation(store.toURI().toString());
+ try{
+ if (file.exists()) {
+ file.delete();
+ UploadFileJob.deleteFoldersIfEmpty(file.getParentFile());
+ }
+ r.getParent().refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
+ }finally{
+ HDFSManager.INSTANCE.stopServerOperation(store.toURI().toString());
+ }
+ }
+ }
+ } catch (CoreException e) {
+ MessageDialog.openError(targetPart.getSite().getShell(), "Upload HDFS Resources", "Error uploading resource to " + r.getLocationURI() + ": "
+ + e.getMessage());
+ logger.warn(e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action
+ * .IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ this.selection = selection;
+ boolean enabled = true;
+ if (this.selection != null && !this.selection.isEmpty()) {
+ IStructuredSelection sSelection = (IStructuredSelection) this.selection;
+ @SuppressWarnings("rawtypes")
+ Iterator itr = sSelection.iterator();
+ while (itr.hasNext()) {
+ Object object = itr.next();
+ if (object instanceof IResource) {
+ IResource r = (IResource) object;
+ try {
+ HDFSFileStore store = (HDFSFileStore) EFS.getStore(r.getLocationURI());
+ enabled = store.isLocalFile();
+ } catch (Throwable t) {
+ enabled = false;
+ }
+ } else
+ enabled = false;
+ }
+ } else
+ enabled = false;
+ action.setEnabled(enabled);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.
+ * action.IAction, org.eclipse.ui.IWorkbenchPart)
+ */
+ @Override
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ this.targetPart = targetPart;
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/DisconnectAction.java
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/DisconnectAction.java b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/DisconnectAction.java
new file mode 100644
index 0000000..aa346cc
--- /dev/null
+++ b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/DisconnectAction.java
@@ -0,0 +1,88 @@
+package org.apache.hdt.ui.internal.hdfs;
+
+import java.util.Iterator;
+
+import org.apache.hdt.core.internal.hdfs.HDFSManager;
+import org.apache.hdt.core.internal.model.HDFSServer;
+import org.apache.hdt.core.internal.model.ServerStatus;
+import org.apache.log4j.Logger;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+public class DisconnectAction implements IObjectActionDelegate {
+
+ private final static Logger logger = Logger.getLogger(DownloadResourceAction.class);
+ private ISelection selection;
+ private IWorkbenchPart targetPart;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ @Override
+ public void run(IAction action) {
+ if (this.selection != null && !this.selection.isEmpty()) {
+ IStructuredSelection sSelection = (IStructuredSelection) this.selection;
+ @SuppressWarnings("rawtypes")
+ Iterator itr = sSelection.iterator();
+ while (itr.hasNext()) {
+ Object object = itr.next();
+ if (object instanceof IProject) {
+ IProject r = (IProject) object;
+ HDFSManager.disconnectProject(r);
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action
+ * .IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ this.selection = selection;
+ boolean enabled = true;
+ if (this.selection != null && !this.selection.isEmpty()) {
+ IStructuredSelection sSelection = (IStructuredSelection) this.selection;
+ @SuppressWarnings("rawtypes")
+ Iterator itr = sSelection.iterator();
+ while (itr.hasNext()) {
+ Object object = itr.next();
+ if (object instanceof IProject) {
+ IProject r = (IProject) object;
+ try {
+ HDFSServer server = HDFSManager.INSTANCE.getServer(r.getLocationURI().toString());
+ enabled = server == null ? false : server.getStatusCode() != ServerStatus.DISCONNECTED_VALUE;
+ } catch (Throwable t) {
+ enabled = false;
+ }
+ } else
+ enabled = false;
+ }
+ } else
+ enabled = false;
+ action.setEnabled(enabled);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.
+ * action.IAction, org.eclipse.ui.IWorkbenchPart)
+ */
+ @Override
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ this.targetPart = targetPart;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/DownloadResourceAction.java
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/DownloadResourceAction.java b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/DownloadResourceAction.java
new file mode 100644
index 0000000..aecc122
--- /dev/null
+++ b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/DownloadResourceAction.java
@@ -0,0 +1,124 @@
+package org.apache.hdt.ui.internal.hdfs;
+
+import java.util.Iterator;
+
+import org.apache.hdt.core.hdfs.ResourceInformation.Permissions;
+import org.apache.hdt.core.internal.hdfs.DownloadFileJob;
+import org.apache.hdt.core.internal.hdfs.HDFSFileStore;
+import org.apache.log4j.Logger;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+public class DownloadResourceAction implements IObjectActionDelegate {
+
+ private final static Logger logger = Logger.getLogger(DownloadResourceAction.class);
+ private ISelection selection;
+ private IWorkbenchPart targetPart;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ @Override
+ public void run(IAction action) {
+ if (this.selection != null && !this.selection.isEmpty()) {
+ IStructuredSelection sSelection = (IStructuredSelection) this.selection;
+ @SuppressWarnings("rawtypes")
+ Iterator itr = sSelection.iterator();
+ while (itr.hasNext()) {
+ Object object = itr.next();
+ if (object instanceof IResource) {
+ IResource r = (IResource) object;
+ downloadResource(r);
+ }
+ }
+ }
+ }
+
+ /**
+ * @param r
+ */
+ private void downloadResource(IResource r) {
+ try {
+ switch (r.getType()) {
+ case IFile.FILE:
+ DownloadFileJob dfj = new DownloadFileJob(r);
+ dfj.schedule();
+ break;
+ case IFolder.FOLDER:
+ IFolder folder = (IFolder) r;
+ IResource[] children = folder.members();
+ if (children != null) {
+ for (int cc = 0; cc < children.length; cc++) {
+ downloadResource(children[cc]);
+ }
+ }
+ break;
+ }
+ } catch (CoreException e) {
+ MessageDialog.openError(targetPart.getSite().getShell(), "Download HDFS Resources", "Error downloading resource from " + r.getLocationURI() + ": "
+ + e.getMessage());
+ logger.warn(e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action
+ * .IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ this.selection = selection;
+ boolean enabled = true;
+ if (this.selection != null && !this.selection.isEmpty()) {
+ IStructuredSelection sSelection = (IStructuredSelection) this.selection;
+ @SuppressWarnings("rawtypes")
+ Iterator itr = sSelection.iterator();
+ while (itr.hasNext()) {
+ Object object = itr.next();
+ if (object instanceof IResource) {
+ IResource r = (IResource) object;
+ try {
+ HDFSFileStore store = (HDFSFileStore) EFS.getStore(r.getLocationURI());
+ Permissions effectivePermissions = store.getEffectivePermissions();
+ if (enabled && effectivePermissions != null && !effectivePermissions.read)
+ enabled = false;
+ if (enabled)
+ enabled = !store.isLocalFile();
+ } catch (Throwable t) {
+ enabled = false;
+ }
+ } else
+ enabled = false;
+ }
+ } else
+ enabled = false;
+ action.setEnabled(enabled);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.
+ * action.IAction, org.eclipse.ui.IWorkbenchPart)
+ */
+ @Override
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ this.targetPart = targetPart;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/HDFSCommonContentProvider.java
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/HDFSCommonContentProvider.java b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/HDFSCommonContentProvider.java
new file mode 100644
index 0000000..fa53a6a
--- /dev/null
+++ b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/HDFSCommonContentProvider.java
@@ -0,0 +1,188 @@
+/**
+ * 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.hdt.ui.internal.hdfs;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hdt.core.internal.HadoopManager;
+import org.apache.hdt.core.internal.hdfs.HDFSManager;
+import org.apache.hdt.core.internal.model.HDFSServer;
+import org.apache.hdt.core.internal.model.HadoopPackage;
+import org.apache.log4j.Logger;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.navigator.CommonNavigator;
+import org.eclipse.ui.navigator.CommonViewer;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonContentProvider;
+import org.eclipse.ui.navigator.INavigatorContentService;
+
+public class HDFSCommonContentProvider implements ICommonContentProvider {
+
+ private static final Logger logger = Logger.getLogger(HDFSCommonContentProvider.class);
+
+ private String viewerId;
+ private Display display = null;
+
+ private EContentAdapter serversListener;
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return null;
+ }
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+
+ @Override
+ public void dispose() {
+ if (serversListener != null) {
+ HadoopManager.INSTANCE.getServers().eAdapters().remove(serversListener);
+ serversListener = null;
+ }
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void restoreState(IMemento aMemento) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void saveState(IMemento aMemento) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void init(ICommonContentExtensionSite aConfig) {
+ INavigatorContentService cs = aConfig.getService();
+ viewerId = cs.getViewerId();
+ this.display = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getDisplay();
+ hookRefreshResources();
+ }
+
+ protected void hookRefreshResources() {
+ serversListener = new EContentAdapter() {
+ private List<String> addedUris = new ArrayList<String>();
+
+ public boolean isAdapterForType(Object type) {
+ return HadoopPackage.eINSTANCE.getHDFSServer().isInstance(type);
+ }
+
+ public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) {
+ super.notifyChanged(notification);
+ if (notification.getNotifier() instanceof HDFSServer) {
+ int featureID = notification.getFeatureID(HDFSServer.class);
+ if (featureID == HadoopPackage.HDFS_SERVER__OPERATION_UR_IS) {
+ if (notification.getEventType() == Notification.ADD) {
+ Object[] array = ((HDFSServer) notification.getNotifier()).getOperationURIs().toArray();
+ for (int ac = 0; ac < array.length; ac++) {
+ String uri = (String) array[ac];
+ addedUris.add(uri);
+ }
+ } else if (addedUris.size() > 0 && display != null) {
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ CommonViewer viewer = null;
+ try {
+ IViewPart view = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(viewerId);
+ if (view instanceof CommonNavigator) {
+ CommonNavigator navigator = (CommonNavigator) view;
+ viewer = navigator.getCommonViewer();
+ }
+ } catch (PartInitException e) {
+ }
+ if (viewer != null) {
+ Object[] addedArray = addedUris.toArray();
+ for (int ac = 0; ac < addedArray.length; ac++) {
+ String uri = (String) addedArray[ac];
+ HDFSServer server = HDFSManager.INSTANCE.getServer(uri);
+ if (server != null) {
+ try {
+ URI relativeURI = org.eclipse.core.runtime.URIUtil.makeRelative(new URI(uri), new URI(server.getUri()));
+ if (relativeURI != null) {
+ String projectName = HDFSManager.INSTANCE.getProjectName(server);
+ if (projectName != null) {
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(
+ new Path(projectName + "/" + relativeURI.toString()));
+ if (file != null) {
+ viewer.refresh(file, true);
+ if (logger.isDebugEnabled())
+ logger.debug("EMF listener: Refreshed [" + file.getFullPath() + "]");
+ IContainer parent = file.getParent();
+ while (parent != null) {
+ viewer.refresh(parent, true);
+ parent = parent.getParent();
+ }
+ }
+ }
+ }
+ } catch (Throwable t) {
+ if (logger.isDebugEnabled())
+ logger.debug(t);
+ }
+ }
+ }
+ }
+ addedUris.clear();
+ }
+ });
+ }
+
+ }
+ }
+ }
+ };
+ HadoopManager.INSTANCE.getServers().eAdapters().add(serversListener);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/HDFSFileStorePropertySource.java
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/HDFSFileStorePropertySource.java b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/HDFSFileStorePropertySource.java
new file mode 100644
index 0000000..b921cf2
--- /dev/null
+++ b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/HDFSFileStorePropertySource.java
@@ -0,0 +1,177 @@
+/**
+ * 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.hdt.ui.internal.hdfs;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hdt.core.hdfs.ResourceInformation.Permissions;
+import org.apache.hdt.core.internal.hdfs.HDFSFileStore;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+/**
+ * @author Srimanth Gunturi
+ *
+ */
+public class HDFSFileStorePropertySource implements IPropertySource {
+
+ private enum Property {
+ USER, GROUP, ISLOCAL,
+ PERMISSIONS, USER_PERMISSIONS,
+ GROUP_PERMISSIONS, OTHER_PERMISSIONS,
+ }
+
+ private final HDFSFileStore fileStore;
+
+ /**
+ * @param fs
+ */
+ public HDFSFileStorePropertySource(HDFSFileStore fileStore) {
+ this.fileStore = fileStore;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
+ */
+ @Override
+ public Object getEditableValue() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
+ */
+ @Override
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ List<IPropertyDescriptor> descriptors = new ArrayList<IPropertyDescriptor>();
+ final PropertyDescriptor user = new PropertyDescriptor(Property.USER, "User");
+ final PropertyDescriptor group = new PropertyDescriptor(Property.GROUP, "Group");
+ final PropertyDescriptor isDownloaded = new PropertyDescriptor(Property.ISLOCAL, "Is downloaded");
+ final PropertyDescriptor perms = new PropertyDescriptor(Property.PERMISSIONS, "Effective Permissions");
+ final PropertyDescriptor userPerms = new PropertyDescriptor(Property.USER_PERMISSIONS, "User Permissions");
+ final PropertyDescriptor groupPerms = new PropertyDescriptor(Property.GROUP_PERMISSIONS, "Group Permissions");
+ final PropertyDescriptor otherPerms = new PropertyDescriptor(Property.OTHER_PERMISSIONS, "Other Permissions");
+ descriptors.add(user);
+ descriptors.add(group);
+ descriptors.add(isDownloaded);
+ descriptors.add(perms);
+ descriptors.add(userPerms);
+ descriptors.add(groupPerms);
+ descriptors.add(otherPerms);
+ return descriptors.toArray(new IPropertyDescriptor[descriptors.size()]);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java
+ * .lang.Object)
+ */
+ @Override
+ public Object getPropertyValue(Object id) {
+ if (Property.USER.equals(id))
+ return this.fileStore.getServerResourceInfo() == null ? null : fileStore.getServerResourceInfo().getOwner();
+ else if (Property.GROUP.equals(id))
+ return this.fileStore.getServerResourceInfo() == null ? null : fileStore.getServerResourceInfo().getGroup();
+ else if (Property.ISLOCAL.equals(id))
+ return this.fileStore.isLocalFile();
+ else if (Property.PERMISSIONS.equals(id)){
+ String perms = "";
+ final Permissions effectivePermissions = this.fileStore.getEffectivePermissions();
+ if(effectivePermissions!=null){
+ perms += effectivePermissions.read ? "r" : "-";
+ perms += effectivePermissions.write ? "w" : "-";
+ perms += effectivePermissions.execute ? "x" : "-";
+ }else{
+ perms += "?";
+ perms += "?";
+ perms += "?";
+ }
+ return perms;
+ } else if (Property.USER_PERMISSIONS.equals(id)){
+ String perms = "";
+ perms += this.fileStore.fetchInfo().getAttribute(EFS.ATTRIBUTE_OWNER_READ) ? "r" : "-";
+ perms += this.fileStore.fetchInfo().getAttribute(EFS.ATTRIBUTE_OWNER_WRITE) ? "w" : "-";
+ perms += this.fileStore.fetchInfo().getAttribute(EFS.ATTRIBUTE_OWNER_EXECUTE) ? "x" : "-";
+ return perms;
+ } else if (Property.GROUP_PERMISSIONS.equals(id)){
+ String perms = "";
+ perms += this.fileStore.fetchInfo().getAttribute(EFS.ATTRIBUTE_GROUP_READ) ? "r" : "-";
+ perms += this.fileStore.fetchInfo().getAttribute(EFS.ATTRIBUTE_GROUP_WRITE) ? "w" : "-";
+ perms += this.fileStore.fetchInfo().getAttribute(EFS.ATTRIBUTE_GROUP_EXECUTE) ? "x" : "-";
+ return perms;
+ } else if (Property.OTHER_PERMISSIONS.equals(id)){
+ String perms = "";
+ perms += this.fileStore.fetchInfo().getAttribute(EFS.ATTRIBUTE_OTHER_READ) ? "r" : "-";
+ perms += this.fileStore.fetchInfo().getAttribute(EFS.ATTRIBUTE_OTHER_WRITE) ? "w" : "-";
+ perms += this.fileStore.fetchInfo().getAttribute(EFS.ATTRIBUTE_OTHER_EXECUTE) ? "x" : "-";
+ return perms;
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang
+ * .Object)
+ */
+ @Override
+ public boolean isPropertySet(Object id) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java
+ * .lang.Object)
+ */
+ @Override
+ public void resetPropertyValue(Object id) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java
+ * .lang.Object, java.lang.Object)
+ */
+ @Override
+ public void setPropertyValue(Object id, Object value) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/HDFSLabelProvider.java
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/HDFSLabelProvider.java b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/HDFSLabelProvider.java
new file mode 100644
index 0000000..a5543a7
--- /dev/null
+++ b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/HDFSLabelProvider.java
@@ -0,0 +1,153 @@
+/**
+ * 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.hdt.ui.internal.hdfs;
+
+import org.apache.hdt.core.internal.hdfs.HDFSFileSystem;
+import org.apache.hdt.ui.Activator;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonLabelProvider;
+
+/**
+ * @author Srimanth Gunturi
+ *
+ */
+public class HDFSLabelProvider implements ICommonLabelProvider {
+
+ /**
+ *
+ */
+ public HDFSLabelProvider() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ */
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof IProject) {
+ IProject project = (IProject) element;
+ if (HDFSFileSystem.SCHEME.equals(project.getLocationURI().getScheme())) {
+ return Activator.IMAGE_HDFS;
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object element) {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.
+ * jface.viewers.ILabelProviderListener)
+ */
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang
+ * .Object, java.lang.String)
+ */
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse
+ * .jface.viewers.ILabelProviderListener)
+ */
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.navigator.IMementoAware#restoreState(org.eclipse.ui.IMemento
+ * )
+ */
+ @Override
+ public void restoreState(IMemento aMemento) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.navigator.IMementoAware#saveState(org.eclipse.ui.IMemento)
+ */
+ @Override
+ public void saveState(IMemento aMemento) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.navigator.IDescriptionProvider#getDescription(java.lang
+ * .Object)
+ */
+ @Override
+ public String getDescription(Object anElement) {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.navigator.ICommonLabelProvider#init(org.eclipse.ui.navigator
+ * .ICommonContentExtensionSite)
+ */
+ @Override
+ public void init(ICommonContentExtensionSite aConfig) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-hdt/blob/63bec260/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/HDFSLightweightLabelDecorator.java
----------------------------------------------------------------------
diff --git a/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/HDFSLightweightLabelDecorator.java b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/HDFSLightweightLabelDecorator.java
new file mode 100644
index 0000000..9424a45
--- /dev/null
+++ b/org.apache.hdt.ui/src/org/apache/hdt/ui/internal/hdfs/HDFSLightweightLabelDecorator.java
@@ -0,0 +1,163 @@
+/**
+ * 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.hdt.ui.internal.hdfs;
+
+import java.net.URI;
+
+import org.apache.hdt.core.hdfs.ResourceInformation.Permissions;
+import org.apache.hdt.core.internal.hdfs.HDFSFileStore;
+import org.apache.hdt.core.internal.hdfs.HDFSManager;
+import org.apache.hdt.core.internal.hdfs.HDFSURI;
+import org.apache.hdt.core.internal.model.HDFSServer;
+import org.apache.hdt.core.internal.model.ServerStatus;
+import org.apache.log4j.Logger;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.IDecoration;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ILightweightLabelDecorator;
+
+public class HDFSLightweightLabelDecorator implements ILightweightLabelDecorator {
+ private static final Logger logger = Logger.getLogger(HDFSLightweightLabelDecorator.class);
+
+ /**
+ *
+ */
+ public HDFSLightweightLabelDecorator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.
+ * jface.viewers.ILabelProviderListener)
+ */
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang
+ * .Object, java.lang.String)
+ */
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse
+ * .jface.viewers.ILabelProviderListener)
+ */
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang
+ * .Object, org.eclipse.jface.viewers.IDecoration)
+ */
+ @Override
+ public void decorate(Object element, IDecoration decoration) {
+ if (element instanceof IResource) {
+ IResource r = (IResource) element;
+ URI locationURI = r.getLocationURI();
+ if (locationURI != null && HDFSURI.SCHEME.equals(locationURI.getScheme())) {
+ try {
+ if (r instanceof IProject) {
+ final HDFSManager hdfsManager = HDFSManager.INSTANCE;
+ HDFSServer server = hdfsManager.getServer(locationURI.toString());
+ if (server != null) {
+ String serverUrl = server.getUri();
+ String userId = server.getUserId();
+ if (userId == null) {
+ try {
+ userId = hdfsManager.getClient(serverUrl).getDefaultUserAndGroupIds().get(0);
+ } catch (Throwable e) {
+ userId = null;
+ }
+ }
+ if (userId == null)
+ userId = "";
+ else
+ userId = userId + "@";
+ if (serverUrl != null) {
+ try {
+ URI uri = new URI(serverUrl);
+ serverUrl = serverUrl.substring(uri.getScheme().length() + 3);
+ } catch (Throwable e) {
+ }
+ }
+ if (serverUrl.endsWith("/"))
+ serverUrl = serverUrl.substring(0, serverUrl.length() - 1);
+ decoration.addSuffix(" " + userId + serverUrl);
+ if (server.getStatusCode() == ServerStatus.DISCONNECTED_VALUE)
+ decoration.addOverlay(org.apache.hdt.ui.Activator.IMAGE_OFFLINE_OVR);
+ else
+ decoration.addOverlay(org.apache.hdt.ui.Activator.IMAGE_ONLINE_OVR);
+ } else
+ decoration.addSuffix(" [Unknown server]");
+ } else
+ decorate((HDFSFileStore) EFS.getStore(locationURI), decoration);
+ } catch (CoreException e) {
+ logger.debug(e.getMessage(), e);
+ }
+ }
+ }
+ }
+
+ protected void decorate(HDFSFileStore store, IDecoration decoration) {
+ if (store != null) {
+ if (store.isLocalFile())
+ decoration.addOverlay(org.apache.hdt.ui.Activator.IMAGE_LOCAL_OVR, IDecoration.BOTTOM_LEFT);
+ else if (store.isRemoteFile())
+ decoration.addOverlay(org.apache.hdt.ui.Activator.IMAGE_REMOTE_OVR, IDecoration.BOTTOM_LEFT);
+ if (store.isLocalOnly())
+ decoration.addOverlay(org.apache.hdt.ui.Activator.IMAGE_OUTGOING_OVR, IDecoration.BOTTOM_RIGHT);
+
+ Permissions effectivePermissions = store.getEffectivePermissions();
+ if (effectivePermissions != null && !effectivePermissions.read && !effectivePermissions.write)
+ decoration.addOverlay(org.apache.hdt.ui.Activator.IMAGE_READONLY_OVR);
+ }
+ }
+
+}