Skip to content

Commit 7174e88

Browse files
GregBraggartembilan
authored andcommitted
Add XSD for new SMB components
* Add namespace handler support for new XSD configs * Add JUnit tests for outbound gateway XML config * Add JUnit tests for streaming inbound adapter XML config * Add Javadoc to new parser classes as per PR feedback * Some code clean up
1 parent 0cf1dfe commit 7174e88

File tree

9 files changed

+1182
-104
lines changed

9 files changed

+1182
-104
lines changed

spring-integration-smb/src/main/java/org/springframework/integration/smb/config/SmbNamespaceHandler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,17 @@
2323
*
2424
* @author Markus Spann
2525
* @author Artem Bilan
26+
* @author Gregory Bragg
2627
*
2728
* @since 6.0
2829
*/
2930
public class SmbNamespaceHandler extends AbstractIntegrationNamespaceHandler {
3031

3132
public void init() {
3233
registerBeanDefinitionParser("inbound-channel-adapter", new SmbInboundChannelAdapterParser());
34+
registerBeanDefinitionParser("inbound-streaming-channel-adapter", new SmbStreamingInboundChannelAdapterParser());
3335
registerBeanDefinitionParser("outbound-channel-adapter", new SmbOutboundChannelAdapterParser());
36+
registerBeanDefinitionParser("outbound-gateway", new SmbOutboundGatewayParser());
3437
}
3538

3639
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright 2022 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.integration.smb.config;
18+
19+
import org.springframework.integration.file.config.AbstractRemoteFileOutboundGatewayParser;
20+
import org.springframework.integration.file.remote.RemoteFileOperations;
21+
import org.springframework.integration.smb.filters.SmbRegexPatternFileListFilter;
22+
import org.springframework.integration.smb.filters.SmbSimplePatternFileListFilter;
23+
import org.springframework.integration.smb.outbound.SmbOutboundGateway;
24+
import org.springframework.integration.smb.session.SmbRemoteFileTemplate;
25+
26+
/**
27+
* Parser for the SMB 'outbound-gateway' element.
28+
*
29+
* @author Gregory Bragg
30+
*
31+
* @since 6.0
32+
*/
33+
public class SmbOutboundGatewayParser extends AbstractRemoteFileOutboundGatewayParser {
34+
35+
@Override
36+
public String getGatewayClassName() {
37+
return SmbOutboundGateway.class.getName();
38+
}
39+
40+
@Override
41+
protected String getSimplePatternFileListFilterClassName() {
42+
return SmbSimplePatternFileListFilter.class.getName();
43+
}
44+
45+
@Override
46+
protected String getRegexPatternFileListFilterClassName() {
47+
return SmbRegexPatternFileListFilter.class.getName();
48+
}
49+
50+
@Override
51+
protected Class<? extends RemoteFileOperations<?>> getTemplateClass() {
52+
return SmbRemoteFileTemplate.class;
53+
}
54+
55+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright 2022 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.integration.smb.config;
18+
19+
import org.springframework.integration.core.MessageSource;
20+
import org.springframework.integration.file.config.AbstractRemoteFileStreamingInboundChannelAdapterParser;
21+
import org.springframework.integration.file.filters.AbstractPersistentAcceptOnceFileListFilter;
22+
import org.springframework.integration.file.filters.FileListFilter;
23+
import org.springframework.integration.file.remote.RemoteFileOperations;
24+
import org.springframework.integration.smb.filters.SmbPersistentAcceptOnceFileListFilter;
25+
import org.springframework.integration.smb.filters.SmbRegexPatternFileListFilter;
26+
import org.springframework.integration.smb.filters.SmbSimplePatternFileListFilter;
27+
import org.springframework.integration.smb.inbound.SmbStreamingMessageSource;
28+
import org.springframework.integration.smb.session.SmbRemoteFileTemplate;
29+
30+
/**
31+
* Parser for the SMB 'inbound-streaming-channel-adapter' element.
32+
*
33+
* @author Gregory Bragg
34+
*
35+
* @since 6.0
36+
*/
37+
public class SmbStreamingInboundChannelAdapterParser extends AbstractRemoteFileStreamingInboundChannelAdapterParser {
38+
39+
@Override
40+
protected Class<? extends RemoteFileOperations<?>> getTemplateClass() {
41+
return SmbRemoteFileTemplate.class;
42+
}
43+
44+
@Override
45+
protected Class<? extends MessageSource<?>> getMessageSourceClass() {
46+
return SmbStreamingMessageSource.class;
47+
}
48+
49+
@Override
50+
protected Class<? extends FileListFilter<?>> getSimplePatternFileListFilterClass() {
51+
return SmbSimplePatternFileListFilter.class;
52+
}
53+
54+
@Override
55+
protected Class<? extends FileListFilter<?>> getRegexPatternFileListFilterClass() {
56+
return SmbRegexPatternFileListFilter.class;
57+
}
58+
59+
@Override
60+
protected Class<? extends AbstractPersistentAcceptOnceFileListFilter<?>> getPersistentAcceptOnceFileListFilterClass() {
61+
return SmbPersistentAcceptOnceFileListFilter.class;
62+
}
63+
64+
}

0 commit comments

Comments
 (0)