-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate SMB extension project to respective module
* Removed deprecated replaceFile and useTempFile session configs * Refactored to use AssertJ instead of JUnit asserts as per PR feedback * Code clean up for SMB module
- Loading branch information
1 parent
392455e
commit 7ad71d3
Showing
46 changed files
with
3,785 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
65 changes: 65 additions & 0 deletions
65
.../main/java/org/springframework/integration/smb/config/SmbInboundChannelAdapterParser.java
This file contains 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,65 @@ | ||
/* | ||
* Copyright 2012-2022 the original author or authors. | ||
* | ||
* Licensed 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 | ||
* | ||
* https://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.springframework.integration.smb.config; | ||
|
||
import org.springframework.integration.file.config.AbstractRemoteFileInboundChannelAdapterParser; | ||
import org.springframework.integration.file.filters.AbstractPersistentAcceptOnceFileListFilter; | ||
import org.springframework.integration.file.filters.FileListFilter; | ||
import org.springframework.integration.file.remote.synchronizer.InboundFileSynchronizer; | ||
import org.springframework.integration.smb.filters.SmbPersistentAcceptOnceFileListFilter; | ||
import org.springframework.integration.smb.filters.SmbRegexPatternFileListFilter; | ||
import org.springframework.integration.smb.filters.SmbSimplePatternFileListFilter; | ||
import org.springframework.integration.smb.inbound.SmbInboundFileSynchronizer; | ||
import org.springframework.integration.smb.inbound.SmbInboundFileSynchronizingMessageSource; | ||
|
||
/** | ||
* Parser for the SMB 'inbound-channel-adapter' element. | ||
* | ||
* @author Markus Spann | ||
* @author Artem Bilan | ||
* @author Prafull Kumar Soni | ||
* | ||
* @since 6.0 | ||
*/ | ||
public class SmbInboundChannelAdapterParser extends AbstractRemoteFileInboundChannelAdapterParser { | ||
|
||
@Override | ||
protected String getMessageSourceClassname() { | ||
return SmbInboundFileSynchronizingMessageSource.class.getName(); | ||
} | ||
|
||
@Override | ||
protected Class<? extends InboundFileSynchronizer> getInboundFileSynchronizerClass() { | ||
return SmbInboundFileSynchronizer.class; | ||
} | ||
|
||
@Override | ||
protected Class<? extends FileListFilter<?>> getSimplePatternFileListFilterClass() { | ||
return SmbSimplePatternFileListFilter.class; | ||
} | ||
|
||
@Override | ||
protected Class<? extends FileListFilter<?>> getRegexPatternFileListFilterClass() { | ||
return SmbRegexPatternFileListFilter.class; | ||
} | ||
|
||
@Override | ||
protected Class<? extends AbstractPersistentAcceptOnceFileListFilter<?>> getPersistentAcceptOnceFileListFilterClass() { | ||
return SmbPersistentAcceptOnceFileListFilter.class; | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
...ion-smb/src/main/java/org/springframework/integration/smb/config/SmbNamespaceHandler.java
This file contains 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,36 @@ | ||
/* | ||
* Copyright 2012-2022 the original author or authors. | ||
* | ||
* Licensed 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 | ||
* | ||
* https://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.springframework.integration.smb.config; | ||
|
||
import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler; | ||
|
||
/** | ||
* Provides namespace support for using SMB. | ||
* | ||
* @author Markus Spann | ||
* @author Artem Bilan | ||
* | ||
* @since 6.0 | ||
*/ | ||
public class SmbNamespaceHandler extends AbstractIntegrationNamespaceHandler { | ||
|
||
public void init() { | ||
registerBeanDefinitionParser("inbound-channel-adapter", new SmbInboundChannelAdapterParser()); | ||
registerBeanDefinitionParser("outbound-channel-adapter", new SmbOutboundChannelAdapterParser()); | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
...main/java/org/springframework/integration/smb/config/SmbOutboundChannelAdapterParser.java
This file contains 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,37 @@ | ||
/* | ||
* Copyright 2017-2022 the original author or authors. | ||
* | ||
* Licensed 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 | ||
* | ||
* https://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.springframework.integration.smb.config; | ||
|
||
import org.springframework.integration.file.config.RemoteFileOutboundChannelAdapterParser; | ||
import org.springframework.integration.file.remote.RemoteFileOperations; | ||
import org.springframework.integration.smb.session.SmbRemoteFileTemplate; | ||
|
||
/** | ||
* The parser for {@code <Int-smb:outbound-channel-adapter>}. | ||
* | ||
* @author Artem Bilan | ||
* | ||
* @since 6.0 | ||
*/ | ||
public class SmbOutboundChannelAdapterParser extends RemoteFileOutboundChannelAdapterParser { | ||
|
||
@Override | ||
protected Class<? extends RemoteFileOperations<?>> getTemplateClass() { | ||
return SmbRemoteFileTemplate.class; | ||
} | ||
|
||
} |
4 changes: 4 additions & 0 deletions
4
...ntegration-smb/src/main/java/org/springframework/integration/smb/config/package-info.java
This file contains 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,4 @@ | ||
/** | ||
* SMB-specific file list filter classes. | ||
*/ | ||
package org.springframework.integration.smb.config; |
48 changes: 48 additions & 0 deletions
48
...va/org/springframework/integration/smb/filters/SmbPersistentAcceptOnceFileListFilter.java
This file contains 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,48 @@ | ||
/* | ||
* Copyright 2018-2022 the original author or authors. | ||
* | ||
* Licensed 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 | ||
* | ||
* https://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.springframework.integration.smb.filters; | ||
|
||
import org.springframework.integration.file.filters.AbstractPersistentAcceptOnceFileListFilter; | ||
import org.springframework.integration.metadata.ConcurrentMetadataStore; | ||
|
||
import jcifs.smb.SmbFile; | ||
|
||
/** | ||
* Implementation of {@link AbstractPersistentAcceptOnceFileListFilter} for SMB. | ||
* | ||
* @author Prafull Kumar Soni | ||
* | ||
* @since 6.0 | ||
*/ | ||
public class SmbPersistentAcceptOnceFileListFilter extends AbstractPersistentAcceptOnceFileListFilter<SmbFile> { | ||
|
||
|
||
public SmbPersistentAcceptOnceFileListFilter(ConcurrentMetadataStore store, String prefix) { | ||
super(store, prefix); | ||
} | ||
|
||
@Override | ||
protected long modified(SmbFile file) { | ||
return file.getLastModified(); | ||
} | ||
|
||
@Override | ||
protected String fileName(SmbFile file) { | ||
return file.getName(); | ||
} | ||
|
||
} |
66 changes: 66 additions & 0 deletions
66
.../main/java/org/springframework/integration/smb/filters/SmbRegexPatternFileListFilter.java
This file contains 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,66 @@ | ||
/* | ||
* Copyright 2012-2022 the original author or authors. | ||
* | ||
* Licensed 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 | ||
* | ||
* https://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.springframework.integration.smb.filters; | ||
|
||
import java.io.UncheckedIOException; | ||
import java.util.regex.Pattern; | ||
|
||
import org.springframework.integration.file.filters.AbstractRegexPatternFileListFilter; | ||
|
||
import jcifs.smb.SmbException; | ||
import jcifs.smb.SmbFile; | ||
|
||
/** | ||
* Implementation of {@link AbstractRegexPatternFileListFilter} for SMB. | ||
* | ||
* @author Markus Spann | ||
* @author Prafull Kumar Soni | ||
* | ||
* @since 6.0 | ||
*/ | ||
public class SmbRegexPatternFileListFilter extends AbstractRegexPatternFileListFilter<SmbFile> { | ||
|
||
public SmbRegexPatternFileListFilter(String pattern) { | ||
this(Pattern.compile(pattern)); | ||
} | ||
|
||
public SmbRegexPatternFileListFilter(Pattern pattern) { | ||
super(pattern); | ||
} | ||
|
||
/** | ||
* Gets the specified SMB file's name. | ||
* @param file SMB file object | ||
* @return file name | ||
* @see AbstractRegexPatternFileListFilter#getFilename(java.lang.Object) | ||
*/ | ||
@Override | ||
protected String getFilename(SmbFile file) { | ||
return (file != null ? file.getName() : null); | ||
} | ||
|
||
@Override | ||
protected boolean isDirectory(SmbFile file) { | ||
try { | ||
return file.isDirectory(); | ||
} | ||
catch (SmbException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
|
||
} |
62 changes: 62 additions & 0 deletions
62
...main/java/org/springframework/integration/smb/filters/SmbSimplePatternFileListFilter.java
This file contains 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,62 @@ | ||
/* | ||
* Copyright 2018-2022 the original author or authors. | ||
* | ||
* Licensed 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 | ||
* | ||
* https://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.springframework.integration.smb.filters; | ||
|
||
import java.io.UncheckedIOException; | ||
|
||
import org.springframework.integration.file.filters.AbstractSimplePatternFileListFilter; | ||
|
||
import jcifs.smb.SmbException; | ||
import jcifs.smb.SmbFile; | ||
|
||
/** | ||
* Implementation of {@link AbstractSimplePatternFileListFilter} for SMB. | ||
* | ||
* @author Markus Spann | ||
* @author Prafull Kumar Soni | ||
* | ||
* @since 6.0 | ||
*/ | ||
public class SmbSimplePatternFileListFilter extends AbstractSimplePatternFileListFilter<SmbFile> { | ||
|
||
public SmbSimplePatternFileListFilter(String pathPattern) { | ||
super(pathPattern); | ||
} | ||
|
||
/** | ||
* Gets the specified SMB file's name. | ||
* @param file SMB file object | ||
* @return file name | ||
* @see AbstractSimplePatternFileListFilter#getFilename(java.lang.Object) | ||
*/ | ||
@Override | ||
protected String getFilename(SmbFile file) { | ||
return (file != null) ? file.getName() : null; | ||
} | ||
|
||
|
||
@Override | ||
protected boolean isDirectory(SmbFile file) { | ||
try { | ||
return file.isDirectory(); | ||
} | ||
catch (SmbException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.