/**
* 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.servers;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.Map.Entry;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.eclipse.server.ConfProp;
import org.apache.hadoop.eclipse.server.HadoopServer;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text;
/**
* Wizard for editing the settings of a Hadoop location
*
* The wizard contains 3 tabs: General, Tunneling and Advanced. It edits
* parameters of the location member which either a new location or a copy of
* an existing registered location.
*/
public class HadoopLocationWizard extends WizardPage {
Image circle;
/**
* The location effectively edited by the wizard. This location is a copy
* or a new one.
*/
private HadoopServer location;
/**
* The original location being edited by the wizard (null if we create a
* new instance).
*/
private HadoopServer original;
/**
* New Hadoop location wizard
*/
public HadoopLocationWizard() {
super("Hadoop Server", "New Hadoop Location", null);
this.original = null;
this.location = new HadoopServer();
this.location.setLocationName("");
}
/**
* Constructor to edit the parameters of an existing Hadoop server
*
* @param server
*/
public HadoopLocationWizard(HadoopServer server) {
super("Create a new Hadoop location", "Edit Hadoop Location", null);
this.original = server;
this.location = new HadoopServer(server);
}
/**
* Performs any actions appropriate in response to the user having pressed
* the Finish button, or refuse if finishing now is not permitted.
*
* @return the created or updated Hadoop location
*/
public HadoopServer performFinish() {
try {
if (this.original == null) {
// New location
Display.getDefault().syncExec(new Runnable() {
public void run() {
ServerRegistry.getInstance().addServer(
HadoopLocationWizard.this.location);
}
});
return this.location;
} else {
// Update location
final String originalName = this.original.getLocationName();
this.original.load(this.location);
Display.getDefault().syncExec(new Runnable() {
public void run() {
ServerRegistry.getInstance().updateServer(originalName,
HadoopLocationWizard.this.location);
}
});
return this.original;
}
} catch (Exception e) {
e.printStackTrace();
setMessage("Invalid server location values", IMessageProvider.ERROR);
return null;
}
}
/**
* Validates the current Hadoop location settings (look for Hadoop
* installation directory).
*
*/
private void testLocation() {
setMessage("Not implemented yet", IMessageProvider.WARNING);
}
/**
* Location is not complete (and finish button not available) until a host
* name is specified.
*
* @inheritDoc
*/
@Override
public boolean isPageComplete() {
{
String locName = location.getConfProp(ConfProp.PI_LOCATION_NAME);
if ((locName == null) || (locName.length() == 0)
|| locName.contains("/")) {
setMessage("Bad location name: "
+ "the location name should not contain "
+ "any character prohibited in a file name.", WARNING);
return false;
}
}
{
String master = location.getConfProp(ConfProp.PI_JOB_TRACKER_HOST);
if ((master == null) || (master.length() == 0)) {
setMessage("Bad master host name: "
+ "the master host name refers to the machine "
+ "that runs the Job tracker.", WARNING);
return false;
}
}
{
String jobTracker = location.getConfProp(ConfProp.JOB_TRACKER_URI);
String[] strs = jobTracker.split(":");
boolean ok = (strs.length == 2);
if (ok) {
try {
int port = Integer.parseInt(strs[1]);
ok = (port >= 0) && (port < 65536);
} catch (NumberFormatException nfe) {
ok = false;
}
}
if (!ok) {
setMessage("The job tracker information ("
+ ConfProp.JOB_TRACKER_URI.name + ") is invalid. "
+ "This usually looks like \"host:port\"", WARNING);
return false;
}
}
{
String fsDefaultURI = location.getConfProp(ConfProp.FS_DEFAULT_URI);
try {
URI uri = new URI(fsDefaultURI);
} catch (URISyntaxException e) {
setMessage("The default file system URI is invalid. "
+ "This usually looks like \"hdfs://host:port/\" "
+ "or \"file:///dir/\"", WARNING);
}
}
setMessage("Define the location of a Hadoop infrastructure "
+ "for running MapReduce applications.");
return true;
}
/**
* Create the wizard
*/
/* @inheritDoc */
public void createControl(Composite parent) {
setTitle("Define Hadoop location");
setDescription("Define the location of a Hadoop infrastructure "
+ "for running MapReduce applications.");
Composite panel = new Composite(parent, SWT.FILL);
GridLayout glayout = new GridLayout(2, false);
panel.setLayout(glayout);
TabMediator mediator = new TabMediator(panel);
{
GridData gdata = new GridData(GridData.FILL_BOTH);
gdata.horizontalSpan = 2;
mediator.folder.setLayoutData(gdata);
}
this.setControl(panel /* mediator.folder */);
{
final Button btn = new Button(panel, SWT.NONE);
btn.setText("&Load from file");
btn.setEnabled(false);
btn.setToolTipText("Not yet implemented");
btn.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
// TODO
}
});
}
{
final Button validate = new Button(panel, SWT.NONE);
validate.setText("&Validate location");
validate.setEnabled(false);
validate.setToolTipText("Not yet implemented");
validate.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
testLocation();
}
});
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
hadoop2x-eclipse-plugin-master (127个子文件)
build.xml.bak 3KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
Elephant100x100.gif 7KB
reduce100x100.gif 7KB
MAP100x100.gif 7KB
drive100x100.gif 6KB
hadoop.gif 1KB
Elephant16x16.gif 1KB
reduce16x16.gif 1KB
hadoop_small.gif 1KB
drive16x16.gif 1KB
MAP16x15.gif 1KB
elephantblue16x16.gif 1KB
map16x16.gif 1KB
reducer-16x16.gif 988B
files.gif 339B
spitesmall.gif 162B
job.gif 59B
HadoopLocationWizard.java 30KB
NewMapReduceProjectWizard.java 14KB
DFSActionImpl.java 14KB
HadoopServer.java 14KB
ServerView.java 13KB
RunOnHadoopWizard.java 11KB
NewDriverWizardPage.java 9KB
DFSFile.java 9KB
HadoopJob.java 8KB
ImageLibrary.java 7KB
LocalMapReduceLaunchTabGroup.java 7KB
DFSContentProvider.java 6KB
DFSFolder.java 6KB
ActionProvider.java 6KB
ServerRegistry.java 6KB
NewReducerWizard.java 5KB
NewMapperWizard.java 5KB
MapReduceNature.java 5KB
HadoopApplicationLaunchShortcut.java 4KB
JarModule.java 4KB
ConfProp.java 4KB
DFSPath.java 4KB
HadoopPerspectiveFactory.java 4KB
DFSLocationsRoot.java 4KB
HadoopPathPage.java 3KB
DFSLocation.java 3KB
NewDriverWizard.java 3KB
OpenNewMRClassWizardAction.java 3KB
MapReducePreferencePage.java 2KB
HadoopServerSelectionListContentProvider.java 2KB
EditLocationAction.java 2KB
Activator.java 2KB
NewLocationAction.java 2KB
StartHadoopLaunchTabGroup.java 2KB
OpenNewMRProjectAction.java 2KB
DFSActions.java 2KB
ErrorMessageDialog.java 1KB
PropertyTester.java 1KB
DFSMessage.java 1KB
MutexRule.java 1KB
PreferenceConstants.java 1KB
PreferenceInitializer.java 1KB
IJobListener.java 1KB
IHadoopServerListener.java 1KB
DFSContent.java 1KB
hadoop-logo.jpg 9KB
Elephant.jpg 4KB
Elephant2.jpg 3KB
MANIFEST.MF 752B
Elephant-64x64.png 31KB
Elephant2-136x136.png 23KB
Elephant3-122x122.png 16KB
hadoop-logo-85x85.png 10KB
projwiz.png 7KB
Elephant2-64x64.png 7KB
reducewiz.png 4KB
driverwiz.png 4KB
mapwiz.png 4KB
Elephant-32x32.png 2KB
Export.png 2KB
Import.png 2KB
Elephant2-32x32.png 2KB
Elephant-24x24.png 2KB
Reload.png 1KB
hadoop-logo-24x24.png 1KB
Elephant2-24x24.png 1KB
Elephant3-24x24.png 1KB
Tools.png 1KB
Conf.png 1006B
refresh.png 986B
location-edit-16x16.png 930B
location-new-16x16.png 888B
Elephant-16x16.png 866B
reducer16.png 853B
共 127 条
- 1
- 2
资源评论
- xiaokebiubiubiu2018-06-04假的,下载出错。
- 孩子加油孩子2019-01-19不清楚,完了
高寒竹林
- 粉丝: 18
- 资源: 47
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功