[GitHub] zeppelin pull request #1369: [ZEPPELIN-1376] Add proxy credentials for depen...

2016-10-10 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/zeppelin/pull/1369


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] zeppelin pull request #1369: [ZEPPELIN-1376] Add proxy credentials for depen...

2016-09-01 Thread doanduyhai
Github user doanduyhai closed the pull request at:

https://github.com/apache/zeppelin/pull/1369


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] zeppelin pull request #1369: [ZEPPELIN-1376] Add proxy credentials for depen...

2016-09-01 Thread doanduyhai
GitHub user doanduyhai reopened a pull request:

https://github.com/apache/zeppelin/pull/1369

[ZEPPELIN-1376] Add proxy credentials for dependency repo for corporate 
firewall use-cases

### What is this PR for?
When using Zeppelin behind corporate firewall, sometimes the dependencies 
download just fails silently. This PR has 2 objectives:

* add proxy credentials information for dependencies repo
* raise clear error message in case of dependencies download failure

There are 3 commits.

The first one add extra inputs in the form for adding new repository


![add_repo](https://cloud.githubusercontent.com/assets/1532977/18017489/0b486fda-6bd2-11e6-90c7-ceda18c53575.png)

The second commit fixes some issues and display a clear and explicit error 
message when download of dependencies fail.

Before that, when the download fails, we can see the below behaviour


![irrelevant_double_error_message](https://cloud.githubusercontent.com/assets/1532977/18017541/3cf0de1e-6bd2-11e6-8285-af03f222e8d2.gif)

* the error message is displayed twice because the call twice the method 
`checkDownloadingDependencies();`. One in the success callback of:

```javascript
 $scope.updateInterpreterSetting = function(form, settingId) {
  ...
$http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/' 
+ settingId, request)
  .success(function(data, status, headers, config) {
$scope.interpreterSettings[index] = data.body;
removeTMPSettings(index);
thisConfirm.close();
checkDownloadingDependencies();
$route.reload();
  })
  .error(function(data, status, headers, config) {
 ...
};
```

Another call is inside success callback of `getInterpreterSettings()`

```javascript
var getInterpreterSettings = function() {
  $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/setting')
  .success(function(data, status, headers, config) {
$scope.interpreterSettings = data.body;
checkDownloadingDependencies();
  }).error(function(data, status, headers, config) {
  
```

The problem is that `$route.reload();` in the success callback of 
`updateInterpreterSetting()` will trigger `init()` then 
`getInterpreterSettings()` so `checkDownloadingDependencies()` is called twice.

I remove the call to `checkDownloadingDependencies()` from success callback 
of `updateInterpreterSetting()` 

The second modification is on class `DependencyResolver`. In the screen 
capture above, we get a **cryptic** NullPointerException coming from 
`DefaultRepositorySystem`. I now catch this NPE to wrap it into a more sensible 
and clearer exception:

```java

  public List getArtifactsWithDep(String dependency,
Collection excludes) throws RepositoryException {
Artifact artifact = new DefaultArtifact(dependency);
DependencyFilter classpathFilter = 
DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE);
PatternExclusionsDependencyFilter exclusionFilter =
new PatternExclusionsDependencyFilter(excludes);

CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot(new Dependency(artifact, JavaScopes.COMPILE));

synchronized (repos) {
  for (RemoteRepository repo : repos) {
collectRequest.addRepository(repo);
  }
}
DependencyRequest dependencyRequest = new 
DependencyRequest(collectRequest,
DependencyFilterUtils.andFilter(exclusionFilter, 
classpathFilter));

 //Catch NPE thrown by aether and give a proper error message 
try {
  return system.resolveDependencies(session, 
dependencyRequest).getArtifactResults();
} catch (NullPointerException ex) {
  throw new RepositoryException(String.format("Cannot fetch 
dependencies for %s", dependency));
}
  }
```

The result is much more cleaner


![dependencies_download_error_popup](https://cloud.githubusercontent.com/assets/1532977/18033855/1be5fe9a-6d2e-11e6-91f9-2f5ea66cab26.gif)



The last commit is just doc update


![updated_docs](https://cloud.githubusercontent.com/assets/1532977/18017797/97302f14-6bd3-11e6-97cc-77bd52f25cde.png)


### What type of PR is it?
[Improvement]

### Todos
* [ ] - Code Review
* [ ] - Simple test with no Internet connection
* [ ] - Test within a corporate firewall env with a third-party dependency, 
requiring download

### What is the Jira issue?
**[ZEPPELIN-1376]**

### How should this be tested?

# Simple test
* `git fetch origin 

[GitHub] zeppelin pull request #1369: [ZEPPELIN-1376] Add proxy credentials for depen...

2016-08-29 Thread doanduyhai
Github user doanduyhai closed the pull request at:

https://github.com/apache/zeppelin/pull/1369


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] zeppelin pull request #1369: [ZEPPELIN-1376] Add proxy credentials for depen...

2016-08-29 Thread doanduyhai
GitHub user doanduyhai reopened a pull request:

https://github.com/apache/zeppelin/pull/1369

[ZEPPELIN-1376] Add proxy credentials for dependency repo for corporate 
firewall use-cases

### What is this PR for?
When using Zeppelin behind corporate firewall, sometimes the dependencies 
download just fails silently. This PR has 2 objectives:

* add proxy credentials information for dependencies repo
* raise clear error message in case of dependencies download failure

There are 3 commits.

The first one add extra inputs in the form for adding new repository


![add_repo](https://cloud.githubusercontent.com/assets/1532977/18017489/0b486fda-6bd2-11e6-90c7-ceda18c53575.png)

The second commit fixes some issues and display a clear and explicit error 
message when download of dependencies fail.

Before that, when the download fails, we can see the below behaviour


![irrelevant_double_error_message](https://cloud.githubusercontent.com/assets/1532977/18017541/3cf0de1e-6bd2-11e6-8285-af03f222e8d2.gif)

* the error message is displayed twice because the call twice the method 
`checkDownloadingDependencies();`. One in the success callback of:

```javascript
 $scope.updateInterpreterSetting = function(form, settingId) {
  ...
$http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/' 
+ settingId, request)
  .success(function(data, status, headers, config) {
$scope.interpreterSettings[index] = data.body;
removeTMPSettings(index);
thisConfirm.close();
checkDownloadingDependencies();
$route.reload();
  })
  .error(function(data, status, headers, config) {
 ...
};
```

Another call is inside success callback of `getInterpreterSettings()`

```javascript
var getInterpreterSettings = function() {
  $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/setting')
  .success(function(data, status, headers, config) {
$scope.interpreterSettings = data.body;
checkDownloadingDependencies();
  }).error(function(data, status, headers, config) {
  
```

The problem is that `$route.reload();` in the success callback of 
`updateInterpreterSetting()` will trigger `init()` then 
`getInterpreterSettings()` so `checkDownloadingDependencies()` is called twice.

I remove the call to `checkDownloadingDependencies()` from success callback 
of `updateInterpreterSetting()` 

The second modification is on class `DependencyResolver`. In the screen 
capture above, we get a **cryptic** NullPointerException coming from 
`DefaultRepositorySystem`. I now catch this NPE to wrap it into a more sensible 
and clearer exception:

```java

  public List getArtifactsWithDep(String dependency,
Collection excludes) throws RepositoryException {
Artifact artifact = new DefaultArtifact(dependency);
DependencyFilter classpathFilter = 
DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE);
PatternExclusionsDependencyFilter exclusionFilter =
new PatternExclusionsDependencyFilter(excludes);

CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot(new Dependency(artifact, JavaScopes.COMPILE));

synchronized (repos) {
  for (RemoteRepository repo : repos) {
collectRequest.addRepository(repo);
  }
}
DependencyRequest dependencyRequest = new 
DependencyRequest(collectRequest,
DependencyFilterUtils.andFilter(exclusionFilter, 
classpathFilter));

 //Catch NPE thrown by aether and give a proper error message 
try {
  return system.resolveDependencies(session, 
dependencyRequest).getArtifactResults();
} catch (NullPointerException ex) {
  throw new RepositoryException(String.format("Cannot fetch 
dependencies for %s", dependency));
}
  }
```

The result is much more cleaner


![dependencies_download_error_popup](https://cloud.githubusercontent.com/assets/1532977/18033855/1be5fe9a-6d2e-11e6-91f9-2f5ea66cab26.gif)



The last commit is just doc update


![updated_docs](https://cloud.githubusercontent.com/assets/1532977/18017797/97302f14-6bd3-11e6-97cc-77bd52f25cde.png)


### What type of PR is it?
[Improvement]

### Todos
* [ ] - Code Review
* [ ] - Simple test with no Internet connection
* [ ] - Test within a corporate firewall env with a third-party dependency, 
requiring download

### What is the Jira issue?
**[ZEPPELIN-1376]**

### How should this be tested?

# Simple test
* `git fetch origin 

[GitHub] zeppelin pull request #1369: [ZEPPELIN-1376]

2016-08-28 Thread doanduyhai
GitHub user doanduyhai reopened a pull request:

https://github.com/apache/zeppelin/pull/1369

[ZEPPELIN-1376]

### What is this PR for?
When using Zeppelin behind corporate firewall, sometimes the dependencies 
download just fails silently. This PR has 2 objectives:

* add proxy credentials information for dependencies repo
* raise clear error message in case of dependencies download failure

There are 3 commits.

The first one add extra inputs in the form for adding new repository


![add_repo](https://cloud.githubusercontent.com/assets/1532977/18017489/0b486fda-6bd2-11e6-90c7-ceda18c53575.png)

The second commit fixes some issues and display a clear and explicit error 
message when download of dependencies fail.

Before that, when the download fails, we can see the below behaviour


![irrelevant_double_error_message](https://cloud.githubusercontent.com/assets/1532977/18017541/3cf0de1e-6bd2-11e6-8285-af03f222e8d2.gif)

* the error message is displayed twice because the call twice the method 
`checkDownloadingDependencies();`. One in the success callback of:

```javascript
 $scope.updateInterpreterSetting = function(form, settingId) {
  ...
$http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/' 
+ settingId, request)
  .success(function(data, status, headers, config) {
$scope.interpreterSettings[index] = data.body;
removeTMPSettings(index);
thisConfirm.close();
checkDownloadingDependencies();
$route.reload();
  })
  .error(function(data, status, headers, config) {
 ...
};
```

Another call is inside success callback of `getInterpreterSettings()`

```javascript
var getInterpreterSettings = function() {
  $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/setting')
  .success(function(data, status, headers, config) {
$scope.interpreterSettings = data.body;
checkDownloadingDependencies();
  }).error(function(data, status, headers, config) {
  
```

The problem is that `$route.reload();` in the success callback of 
`updateInterpreterSetting()` will trigger `init()` then 
`getInterpreterSettings()` so `checkDownloadingDependencies()` is called twice.

I remove the call to `checkDownloadingDependencies()` from success callback 
of `updateInterpreterSetting()` 

The second modification is on class `DependencyResolver`. In the screen 
capture above, we get a **cryptic** NullPointerException coming from 
`DefaultRepositorySystem`. I now catch this NPE to wrap it into a more sensible 
and clearer exception:

```java

  public List getArtifactsWithDep(String dependency,
Collection excludes) throws RepositoryException {
Artifact artifact = new DefaultArtifact(dependency);
DependencyFilter classpathFilter = 
DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE);
PatternExclusionsDependencyFilter exclusionFilter =
new PatternExclusionsDependencyFilter(excludes);

CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot(new Dependency(artifact, JavaScopes.COMPILE));

synchronized (repos) {
  for (RemoteRepository repo : repos) {
collectRequest.addRepository(repo);
  }
}
DependencyRequest dependencyRequest = new 
DependencyRequest(collectRequest,
DependencyFilterUtils.andFilter(exclusionFilter, 
classpathFilter));

 //Catch NPE thrown by aether and give a proper error message 
try {
  return system.resolveDependencies(session, 
dependencyRequest).getArtifactResults();
} catch (NullPointerException ex) {
  throw new RepositoryException(String.format("Cannot fetch 
dependencies for %s", dependency));
}
  }
```

The result is much more cleaner


![dependencies_download_error_popup](https://cloud.githubusercontent.com/assets/1532977/18033855/1be5fe9a-6d2e-11e6-91f9-2f5ea66cab26.gif)



The last commit is just doc update


![updated_docs](https://cloud.githubusercontent.com/assets/1532977/18017797/97302f14-6bd3-11e6-97cc-77bd52f25cde.png)


### What type of PR is it?
[Improvement]

### Todos
* [ ] - Code Review
* [ ] - Simple test with no Internet connection
* [ ] - Test within a corporate firewall env with a third-party dependency, 
requiring download

### What is the Jira issue?
**[ZEPPELIN-1376]**

### How should this be tested?

# Simple test
* `git fetch origin pull/1369/head:WebProxy`
* `git checkout WebProxy`
* `mvn clean package -DskipTests`
* 

[GitHub] zeppelin pull request #1369: [ZEPPELIN-1376]

2016-08-26 Thread doanduyhai
GitHub user doanduyhai opened a pull request:

https://github.com/apache/zeppelin/pull/1369

[ZEPPELIN-1376]

### What is this PR for?
When using Zeppelin behind corporate firewall, sometimes the dependencies 
download just fails silently. This PR has 2 objectives:

* add proxy credentials information for dependencies repo
* raise clear error message in case of dependencies download failure

There are 3 commits.

The first one add extra inputs in the form for adding new repository


![add_repo](https://cloud.githubusercontent.com/assets/1532977/18017489/0b486fda-6bd2-11e6-90c7-ceda18c53575.png)

The second commit fixes some issues and display a clear and explicit error 
message when download of dependencies fail.

Before that, when the download fails, we can see the below behaviour


![irrelevant_double_error_message](https://cloud.githubusercontent.com/assets/1532977/18017541/3cf0de1e-6bd2-11e6-8285-af03f222e8d2.gif)

* the error message is displayed twice because the call twice the method 
`checkDownloadingDependencies();`. One in the success callback of:

```javascript
 $scope.updateInterpreterSetting = function(form, settingId) {
  ...
$http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/' 
+ settingId, request)
  .success(function(data, status, headers, config) {
$scope.interpreterSettings[index] = data.body;
removeTMPSettings(index);
thisConfirm.close();
checkDownloadingDependencies();
$route.reload();
  })
  .error(function(data, status, headers, config) {
 ...
};
```

Another call is inside success callback of `getInterpreterSettings()`

```javascript
var getInterpreterSettings = function() {
  $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/setting')
  .success(function(data, status, headers, config) {
$scope.interpreterSettings = data.body;
checkDownloadingDependencies();
  }).error(function(data, status, headers, config) {
  
```

The problem is that `$route.reload();` in the success callback of 
`updateInterpreterSetting()` will trigger `init()` then 
`getInterpreterSettings()` so `checkDownloadingDependencies()` is called twice.

I remove the call to `checkDownloadingDependencies()` from success callback 
of `updateInterpreterSetting()` 

The second modification is on class `DependencyResolver`. In the screen 
capture above, we get a **cryptic** NullPointerException coming from 
`DefaultRepositorySystem`. The reason is that we do not set the **root 
dependency** when we create the class `DependencyRequest`. Now it is fixed:

```java

  public List getArtifactsWithDep(String dependency,
  Collection excludes) throws RepositoryException {
Artifact artifact = new DefaultArtifact(dependency);
DependencyFilter classpathFilter = 
DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE);
PatternExclusionsDependencyFilter exclusionFilter =
new PatternExclusionsDependencyFilter(excludes);

CollectRequest collectRequest = new CollectRequest();
/** 
   * Create root dependency here
  **/
final Dependency rootDependency = new Dependency(artifact, 
JavaScopes.COMPILE);
collectRequest.setRoot(rootDependency);

synchronized (repos) {
  for (RemoteRepository repo : repos) {
collectRequest.addRepository(repo);
  }
}
DependencyRequest dependencyRequest = new 
DependencyRequest(collectRequest,
DependencyFilterUtils.andFilter(exclusionFilter, classpathFilter));
/** 
   * Inject root dependency here
  **/
dependencyRequest.setRoot(new DefaultDependencyNode(rootDependency));
return system.resolveDependencies(session, 
dependencyRequest).getArtifactResults();
  }
```

The result is much more cleaner


![dependencies_download_error_popup](https://cloud.githubusercontent.com/assets/1532977/18017780/8b589c1c-6bd3-11e6-831d-33eeb5e08696.gif)

The last commit is just doc update


![updated_docs](https://cloud.githubusercontent.com/assets/1532977/18017797/97302f14-6bd3-11e6-97cc-77bd52f25cde.png)


### What type of PR is it?
[Improvement]

### Todos
* [ ] - Code Review
* [ ] - Simple test with no Internet connection
* [ ] - Test within a corporate firewall env with a third-party dependency, 
requiring download

### What is the Jira issue?
**[ZEPPELIN-1376]**

### How should this be tested?

# Simple test
* `git fetch origin pull/746/head:WebProxy`
* `git checkout