-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[NUTCH-2856] Implement a protocol-smb plugin based on hierynomus/smbj #826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
HiranChaudhuri
wants to merge
10
commits into
apache:master
Choose a base branch
from
HiranChaudhuri:protocol-smb
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b568cc9
[NUTCH-2856] Implement a protocol-smb plugin based on hierynomus/smbj
a5ad1da
Reduce logging
2d9d4c2
fix connection problems
3dbb911
better handling of 'invalid network name' (invalid share names)
17a9103
project cleanup
c354088
remove non-required dependencies
a7dc278
can use different authentication per URL pattern
d2726ad
added ALv2 header
379ccf7
Cache robots.txt to cut network requests in half
4596f71
bugfix: Instread of trunkating at zero bytes by default grab a maximu…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,3 +26,4 @@ lib/spotbugs-* | |
| ivy/dependency-check-ant/* | ||
| .gradle* | ||
| ivy/apache-rat-* | ||
| .vscode | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
|
lewismc marked this conversation as resolved.
|
||
| <!-- 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. | ||
| --> | ||
|
|
||
| <!-- todo: This file should be some encrypted vault --> | ||
| <url-authentication> | ||
| <authentication pattern="^smb://host/share.*" user="user" domain="domain" password="password"/> | ||
| <authentication pattern="^smb://hiran@nas/Documents.*" user="hiran" domain="domain" password="password"/> | ||
| </url-authentication> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <?xml version="1.0"?> | ||
| <!-- | ||
| 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. | ||
| --> | ||
| <project name="protocol-smb" default="jar-core"> | ||
|
|
||
| <import file="../build-plugin.xml"/> | ||
|
|
||
| </project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| <?xml version="1.0" ?> | ||
| <!-- | ||
| 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. | ||
| --> | ||
|
|
||
| <ivy-module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd" | ||
| xmlns:ns0="http://ant.apache.org/ivy/maven" version="2.0"> | ||
| <info organisation="org.apache.nutch" module="${ant.project.name}"> | ||
| <license name="Apache 2.0"/> | ||
| <ivyauthor name="Apache Nutch Team" url="http://nutch.apache.org"/> | ||
| <description> | ||
| Apache Nutch | ||
| </description> | ||
| </info> | ||
|
|
||
| <configurations> | ||
| <include file="../../..//ivy/ivy-configurations.xml"/> | ||
| </configurations> | ||
|
|
||
| <publications> | ||
| <!--get the artifact from our module name--> | ||
| <artifact conf="master"/> | ||
| </publications> | ||
|
|
||
| <dependencies> | ||
| <dependency org="com.hierynomus" name="smbj" rev="0.13.0"/> | ||
| <!-- | ||
| These dependencies are either contained in smbj (transitive) or | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can just remove these comments. |
||
| already provided by Nutch itself. Hence they can remain commented out. | ||
|
|
||
| <dependency org="net.engio" name="mbassador" rev="1.3.0"/> | ||
|
lewismc marked this conversation as resolved.
|
||
| <dependency org="org.bouncycastle" name="bcprov-jdk18on" rev="1.75"/> | ||
| <dependency org="com.hierynomus" name="asn-one" rev="0.6.0"/> | ||
| <dependency org="commons-io" name="commons-io" rev="2.17.0"/> | ||
|
HiranChaudhuri marked this conversation as resolved.
|
||
| --> | ||
| <dependency org="com.google.guava" name="guava" rev="33.3.1-jre"/> | ||
|
|
||
| </dependencies> | ||
|
|
||
| </ivy-module> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| 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 | ||
| id="protocol-smb" | ||
| name="SMB Protocol based on https://github.com/hierynomus/smbj" | ||
| version="1.0.0" | ||
| provider-name="Hiran Chaudhuri"> | ||
|
|
||
| <runtime> | ||
| <library name="asn-one-0.6.0.jar"/> | ||
|
lewismc marked this conversation as resolved.
|
||
| <library name="bcprov-jdk18on-1.75.jar"/> | ||
| <library name="mbassador-1.3.0.jar"/> | ||
| <library name="protocol-smb.jar"> | ||
| <export name="*"/> | ||
| </library> | ||
| <library name="smbj-0.13.0.jar"/> | ||
|
|
||
| <library name="commons-io-2.17.0.jar"/> | ||
| </runtime> | ||
|
|
||
| <requires> | ||
| <import plugin="nutch-extensionpoints"/> | ||
| </requires> | ||
|
|
||
| <extension id="org.apache.nutch.protocol.smb" | ||
| name="SmbProtocol" | ||
| point="org.apache.nutch.protocol.Protocol"> | ||
|
|
||
| <implementation id="org.apache.nutch.protocol.smb.Smb" | ||
| class="org.apache.nutch.protocol.smb.SmbProtocol"> | ||
| <parameter name="protocolName" value="smb"/> | ||
| <parameter name="urlStreamHandler" value="org.apache.nutch.protocol.smb.SmbHandler"/> | ||
| </implementation> | ||
|
|
||
| </extension> | ||
|
|
||
| </plugin> | ||
29 changes: 29 additions & 0 deletions
29
src/plugin/protocol-smb/src/java/org/apache/nutch/protocol/smb/SmbHandler.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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.nutch.protocol.smb; | ||
|
|
||
| import java.net.URL; | ||
| import java.net.URLConnection; | ||
| import java.net.URLStreamHandler; | ||
|
|
||
| public class SmbHandler extends URLStreamHandler { | ||
|
|
||
| @Override | ||
| protected URLConnection openConnection(URL u) { | ||
| return new SmbURLConnection(u); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for this change? Does this print the logger name in full?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does print in full as I am otherwise not entirely clear where a message is coming from.
We can revert the change before merge - for the time being on my side I need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HiranChaudhuri please revert. Thank you