diff --git a/spring-integration-smb/build.gradle b/spring-integration-smb/build.gradle index e0a705e..4579eb1 100644 --- a/spring-integration-smb/build.gradle +++ b/spring-integration-smb/build.gradle @@ -1,268 +1,238 @@ buildscript { - repositories { - maven { url 'https://repo.spring.io/plugins-release' } - } - dependencies { - classpath 'io.spring.gradle:docbook-reference-plugin:0.3.1' - } + repositories { + maven { url 'https://repo.spring.io/plugins-release' } + } + dependencies { + classpath 'io.spring.gradle:docbook-reference-plugin:0.3.1' + } } plugins { - id 'java' - id 'eclipse' - id 'idea' - id 'jacoco' - id 'checkstyle' - id 'org.sonarqube' version '2.8' + id 'java-library' + id 'eclipse' + id 'idea' + id 'jacoco' + id 'checkstyle' + id 'org.sonarqube' version '2.8' + id 'com.jfrog.artifactory' version '4.15.2' } description = 'Spring Integration SMB Support' -apply from: "${rootProject.projectDir}/publish-maven.gradle" - group = 'org.springframework.integration' repositories { - if (version.endsWith('BUILD-SNAPSHOT')) { - maven { url 'https://repo.spring.io/libs-snapshot' } - } - maven { url 'https://repo.spring.io/libs-milestone' } + if (version.endsWith('BUILD-SNAPSHOT')) { + maven { url 'https://repo.spring.io/libs-snapshot' } + } + maven { url 'https://repo.spring.io/libs-milestone' } } compileJava { - sourceCompatibility = 1.8 - targetCompatibility = 1.8 + sourceCompatibility = 1.8 + targetCompatibility = 1.8 } compileTestJava { - sourceCompatibility = 1.8 - targetCompatibility = 1.8 + sourceCompatibility = 1.8 + targetCompatibility = 1.8 } ext { - idPrefix = 'smb' + idPrefix = 'smb' - jcifsVersion = '2.1.19' - log4jVersion = '2.12.1' - springIntegrationVersion = '5.2.1.RELEASE' + jcifsVersion = '2.1.19' + log4jVersion = '2.13.3' + springIntegrationVersion = '5.3.1.RELEASE' - linkHomepage = 'https://github.com/SpringSource/spring-integration-extensions' - linkCi = 'https://build.springsource.org/browse/INTEXT' - linkIssue = 'https://jira.springsource.org/browse/INTEXT' - linkScmUrl = 'https://github.com/SpringSource/spring-integration-extensions' - linkScmConnection = 'https://github.com/SpringSource/spring-integration-extensions.git' - linkScmDevConnection = 'git@github.com:SpringSource/spring-integration-extensions.git' + linkHomepage = 'https://github.com/SpringSource/spring-integration-extensions' + linkCi = 'https://build.springsource.org/browse/INTEXT' + linkIssue = 'https://github.com/spring-projects/spring-integration-extensions/issues' + linkScmUrl = 'https://github.com/SpringSource/spring-integration-extensions' + linkScmConnection = 'https://github.com/SpringSource/spring-integration-extensions.git' + linkScmDevConnection = 'git@github.com:SpringSource/spring-integration-extensions.git' } eclipse.project.natures += 'org.springframework.ide.eclipse.core.springnature' +java { + withJavadocJar() + withSourcesJar() +} + sourceSets { - test { - resources { - srcDirs = ['src/test/resources', 'src/test/java'] - } - } + test { + resources { + srcDirs = ['src/test/resources', 'src/test/java'] + } + } } jacoco { - toolVersion = '0.8.4' + toolVersion = '0.8.5' } checkstyle { - configFile = file("$rootDir/src/checkstyle/checkstyle.xml") - toolVersion = '8.25' + configDirectory.set(rootProject.file("src/checkstyle")) + toolVersion = '8.33' } dependencies { - compile "org.codelibs:jcifs:$jcifsVersion" - compile "org.springframework.integration:spring-integration-file:$springIntegrationVersion" + api "org.codelibs:jcifs:$jcifsVersion" + api "org.springframework.integration:spring-integration-file:$springIntegrationVersion" - testCompile "org.springframework.integration:spring-integration-test:$springIntegrationVersion" + testImplementation "org.springframework.integration:spring-integration-test:$springIntegrationVersion" -// testRuntime "org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion" - testRuntime "org.apache.logging.log4j:log4j-jcl:$log4jVersion" + testRuntimeOnly "org.apache.logging.log4j:log4j-core:$log4jVersion" + testRuntimeOnly "org.apache.logging.log4j:log4j-jcl:$log4jVersion" } // enable all compiler warnings; individual projects may customize further [compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all,-options,-processing'] jacocoTestReport { - reports { - xml.enabled false - csv.enabled false - html.destination file("${buildDir}/reports/jacoco/html") - } + reports { + xml.enabled false + csv.enabled false + html.destination file("${buildDir}/reports/jacoco/html") + } } test { - // suppress all console output during testing unless running `gradle -i` - logging.captureStandardOutput(LogLevel.INFO) - maxHeapSize = '1024m' - jacoco { - append = false - destinationFile = file("$buildDir/jacoco.exec") - } -} - -task sourcesJar(type: Jar) { - classifier = 'sources' - from sourceSets.main.allJava -} - -task javadocJar(type: Jar) { - classifier = 'javadoc' - from javadoc -} - -artifacts { - archives sourcesJar - archives javadocJar + // suppress all console output during testing unless running `gradle -i` + logging.captureStandardOutput(LogLevel.INFO) + maxHeapSize = '1024m' + jacoco { + destinationFile = file("$buildDir/jacoco.exec") + } } apply plugin: 'docbook-reference' reference { - sourceDir = file('src/reference/docbook') + sourceDir = file('src/reference/docbook') } sonarqube { - properties { - property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec" - property "sonar.links.homepage", linkHomepage - property "sonar.links.ci", linkCi - property "sonar.links.issue", linkIssue - property "sonar.links.scm", linkScmUrl - property "sonar.links.scm_dev", linkScmDevConnection - property "sonar.java.coveragePlugin", "jacoco" - } -} - -task api(type: Javadoc) { - group = 'Documentation' - description = 'Generates the Javadoc API documentation.' - title = "${rootProject.description} ${version} API" - options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED - options.author = true - options.header = rootProject.description - options.overview = 'src/api/overview.html' - - source = sourceSets.main.allJava - classpath = project.sourceSets.main.compileClasspath - destinationDir = file("$buildDir/api") + properties { + property "sonar.jacoco.reportPath", "${buildDir.name}/jacoco.exec" + property "sonar.links.homepage", linkHomepage + property "sonar.links.ci", linkCi + property "sonar.links.issue", linkIssue + property "sonar.links.scm", linkScmUrl + property "sonar.links.scm_dev", linkScmDevConnection + property "sonar.java.coveragePlugin", "jacoco" + } } task schemaZip(type: Zip) { - group = 'Distribution' - classifier = 'schema' - description = "Builds -${classifier} archive containing all " + - "XSDs for deployment at static.springframework.org/schema." + group = 'Distribution' + archiveClassifier = 'schema' + description = "Builds -${archiveClassifier} archive containing all " + + "XSDs for deployment at static.springframework.org/schema." - Properties schemas = new Properties() - def shortName = idPrefix.replaceFirst("${idPrefix}-", '') + Properties schemas = new Properties() + def shortName = idPrefix.replaceFirst("${idPrefix}-", '') - project.sourceSets.main.resources.find { - it.path.endsWith("META-INF${File.separator}spring.schemas") - }?.withInputStream { schemas.load(it) } + project.sourceSets.main.resources.find { + it.path.endsWith("META-INF${File.separator}spring.schemas") + }?.withInputStream { schemas.load(it) } - for (def key : schemas.keySet()) { - File xsdFile = project.sourceSets.main.resources.find { - it.path.replaceAll('\\\\', '/').endsWith(schemas.get(key)) - } - assert xsdFile != null - into("integration/${shortName}") { - from xsdFile.path - } - } + for (def key : schemas.keySet()) { + File xsdFile = project.sourceSets.main.resources.find { + it.path.replaceAll('\\\\', '/').endsWith(schemas.get(key)) + } + assert xsdFile != null + into("integration/${shortName}") { + from xsdFile.path + } + } } task docsZip(type: Zip) { - group = 'Distribution' - classifier = 'docs' - description = "Builds -${classifier} archive containing api and reference " + - "for deployment at static.springframework.org/spring-integration/docs." + group = 'Distribution' + archiveClassifier = 'docs' + description = "Builds -${archiveClassifier} archive containing api and reference " + + "for deployment at static.springframework.org/spring-integration/docs." - from('src/dist') { - include 'changelog.txt' - } + from('src/dist') { + include 'changelog.txt' + } - from (api) { - into 'api' - } + from(javadoc) { + into 'api' + } - from (reference) { - into 'reference' - } + from(reference) { + into 'reference' + } } task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) { - group = 'Distribution' - classifier = 'dist' - description = "Builds -${classifier} archive, containing all jars and docs, " + - "suitable for community download page." + group = 'Distribution' + archiveClassifier = 'dist' + description = "Builds -${archiveClassifier} archive, containing all jars and docs, " + + "suitable for community download page." - ext.baseDir = "${project.name}-${project.version}" + ext.baseDir = "${project.name}-${project.version}" - from('src/dist') { - include 'readme.txt' - include 'license.txt' - include 'notice.txt' - into "${baseDir}" - } + from('src/dist') { + include 'readme.txt' + include 'license.txt' + include 'notice.txt' + into "${baseDir}" + } - from(zipTree(docsZip.archivePath)) { - into "${baseDir}/docs" - } + from(zipTree(docsZip.archiveFile)) { + into "${baseDir}/docs" + } - from(zipTree(schemaZip.archivePath)) { - into "${baseDir}/schema" - } + from(zipTree(schemaZip.archiveFile)) { + into "${baseDir}/schema" + } - into ("${baseDir}/libs") { - from project.jar - from project.sourcesJar - from project.javadocJar - } + into("${baseDir}/libs") { + from project.jar + from project.sourcesJar + from project.javadocJar + } } // Create an optional "with dependencies" distribution. // Not published by default; only for use when building from source. task depsZip(type: Zip, dependsOn: distZip) { zipTask -> - group = 'Distribution' - classifier = 'dist-with-deps' - description = "Builds -${classifier} archive, containing everything " + - "in the -${distZip.classifier} archive plus all dependencies." + group = 'Distribution' + archiveClassifier = 'dist-with-deps' + description = "Builds -${archiveClassifier} archive, containing everything " + + "in the -${distZip.archiveClassifier} archive plus all dependencies." - from zipTree(distZip.archivePath) + from zipTree(distZip.archiveFile) - gradle.taskGraph.whenReady { taskGraph -> - if (taskGraph.hasTask(":${zipTask.name}")) { - def projectName = rootProject.name - def artifacts = new HashSet() + gradle.taskGraph.whenReady { taskGraph -> + if (taskGraph.hasTask(":${zipTask.name}")) { + def projectName = rootProject.name + def artifacts = new HashSet() - rootProject.configurations.runtime.resolvedConfiguration.resolvedArtifacts.each { artifact -> - def dependency = artifact.moduleVersion.id - if (!projectName.equals(dependency.name)) { - artifacts << artifact.file - } - } + rootProject.configurations.runtime.resolvedConfiguration.resolvedArtifacts.each { artifact -> + def dependency = artifact.moduleVersion.id + if (!projectName.equals(dependency.name)) { + artifacts << artifact.file + } + } - zipTask.from(artifacts) { - into "${distZip.baseDir}/deps" - } - } - } -} - -artifacts { - archives distZip - archives docsZip - archives schemaZip + zipTask.from(artifacts) { + into "${distZip.baseDir}/deps" + } + } + } } task dist(dependsOn: assemble) { - group = 'Distribution' - description = 'Builds -dist, -docs and -schema distribution archives.' + group = 'Distribution' + description = 'Builds -dist, -docs and -schema distribution archives.' } + +apply from: "${rootProject.projectDir}/publish-maven.gradle" diff --git a/spring-integration-smb/gradle/wrapper/gradle-wrapper.jar b/spring-integration-smb/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf..62d4c05 100644 Binary files a/spring-integration-smb/gradle/wrapper/gradle-wrapper.jar and b/spring-integration-smb/gradle/wrapper/gradle-wrapper.jar differ diff --git a/spring-integration-smb/gradle/wrapper/gradle-wrapper.properties b/spring-integration-smb/gradle/wrapper/gradle-wrapper.properties index f04d6a2..622ab64 100644 --- a/spring-integration-smb/gradle/wrapper/gradle-wrapper.properties +++ b/spring-integration-smb/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/spring-integration-smb/gradlew b/spring-integration-smb/gradlew index 83f2acf..fbd7c51 100755 --- a/spring-integration-smb/gradlew +++ b/spring-integration-smb/gradlew @@ -82,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath @@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi @@ -175,14 +177,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/spring-integration-smb/gradlew.bat b/spring-integration-smb/gradlew.bat index 24467a1..a9f778a 100644 --- a/spring-integration-smb/gradlew.bat +++ b/spring-integration-smb/gradlew.bat @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @@ -81,6 +84,7 @@ set CMD_LINE_ARGS=%* set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% diff --git a/spring-integration-smb/publish-maven.gradle b/spring-integration-smb/publish-maven.gradle index a0ba5e4..a058a78 100644 --- a/spring-integration-smb/publish-maven.gradle +++ b/spring-integration-smb/publish-maven.gradle @@ -1,79 +1,60 @@ -apply plugin: 'maven' +apply plugin: 'maven-publish' -ext.optionalDeps = [] -ext.providedDeps = [] - -ext.optional = { optionalDeps << it } -ext.provided = { providedDeps << it } - -install { - repositories.mavenInstaller { - customizePom(pom, project) - } -} - -def customizePom(pom, gradleProject) { - pom.whenConfigured { generatedPom -> - // respect 'optional' and 'provided' dependencies - gradleProject.optionalDeps.each { dep -> - generatedPom.dependencies.find { it.artifactId == dep.name }?.optional = true - } - gradleProject.providedDeps.each { dep -> - generatedPom.dependencies.find { it.artifactId == dep.name }?.scope = 'provided' - } - - // eliminate test-scoped dependencies (no need in maven central poms) - generatedPom.dependencies.removeAll { dep -> - dep.scope == 'test' - } - - // add all items necessary for maven central publication - generatedPom.project { - name = gradleProject.description - description = gradleProject.description - url = linkHomepage - organization { - name = 'SpringIO' - url = 'https://spring.io' - } - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'https://www.apache.org/licenses/LICENSE-2.0.txt' - distribution 'repo' +publishing { + publications { + mavenJava(MavenPublication) { + suppressAllPomMetadataWarnings() + from components.java + artifact docsZip + artifact schemaZip + artifact distZip + pom { + afterEvaluate { + name = project.description + description = project.description } - } - - scm { url = linkScmUrl - connection = 'scm:git:' + linkScmConnection - developerConnection = 'scm:git:' + linkScmDevConnection - } - - issueManagement { - system = "Jira" - url = linkIssue - } - - developers { - developer { - id = 'garyrussell' - name = 'Gary Russell' - email = 'grussell@pivotal.io' - roles = ["project lead"] + organization { + name = 'Spring IO' + url = 'https://spring.io/projects/spring-integration' } - developer { - id = 'ghillert' - name = 'Gunnar Hillert' - email = 'ghillert@pivotal.io' + licenses { + license { + name = 'Apache License, Version 2.0' + url = 'https://www.apache.org/licenses/LICENSE-2.0' + distribution = 'repo' + } } - developer { - id = 'abilan' - name = 'Artem Bilan' - email = 'abilan@pivotal.io' + scm { + url = linkScmUrl + connection = linkScmConnection + developerConnection = linkScmDevConnection + } + developers { + developer { + id = 'artembilan' + name = 'Artem Bilan' + email = 'abilan@pivotal.io' + roles = ['project lead'] + } + } + issueManagement { + system = 'GitHub' + url = linkIssue + } + } + versionMapping { + usage('java-api') { + fromResolutionResult() + } + usage('java-runtime') { + fromResolutionResult() } } } } } +artifactoryPublish { + publications(publishing.publications.mavenJava) +} diff --git a/spring-integration-smb/src/checkstyle/checkstyle.xml b/spring-integration-smb/src/checkstyle/checkstyle.xml index 533e068..f672c55 100644 --- a/spring-integration-smb/src/checkstyle/checkstyle.xml +++ b/spring-integration-smb/src/checkstyle/checkstyle.xml @@ -2,36 +2,32 @@ - - + - + - - - - + - - - - - - - - + + + + + + + + @@ -56,7 +52,7 @@ - + @@ -71,6 +67,7 @@ + @@ -79,18 +76,15 @@ + org.mockito.Matchers.*" /> @@ -106,31 +100,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -144,37 +136,36 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - + + + + + diff --git a/spring-integration-smb/src/main/java/org/springframework/integration/smb/config/SmbOutboundChannelAdapterParser.java b/spring-integration-smb/src/main/java/org/springframework/integration/smb/config/SmbOutboundChannelAdapterParser.java index 5fd5652..73f859b 100644 --- a/spring-integration-smb/src/main/java/org/springframework/integration/smb/config/SmbOutboundChannelAdapterParser.java +++ b/spring-integration-smb/src/main/java/org/springframework/integration/smb/config/SmbOutboundChannelAdapterParser.java @@ -21,6 +21,8 @@ import org.springframework.integration.file.remote.RemoteFileOperations; import org.springframework.integration.smb.session.SmbRemoteFileTemplate; /** + * The parser for {@code }. + * * @author Artem Bilan */ public class SmbOutboundChannelAdapterParser extends RemoteFileOutboundChannelAdapterParser { diff --git a/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbConfig.java b/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbConfig.java index 772790b..3e655bc 100644 --- a/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbConfig.java +++ b/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbConfig.java @@ -54,13 +54,13 @@ public class SmbConfig { private boolean useTempFile = false; /** - * Defaults to and follows the jCIFS library default of 'SMB1' + * Defaults to and follows the jCIFS library default of 'SMB1'. * @since 1.2 */ private DialectVersion smbMinVersion = DialectVersion.SMB1; /** - * Defaults to and follows the jCIFS library default of 'SMB210' + * Defaults to and follows the jCIFS library default of 'SMB210'. * @since 1.2 */ private DialectVersion smbMaxVersion = DialectVersion.SMB210; diff --git a/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbRemoteFileTemplate.java b/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbRemoteFileTemplate.java index 139f6a0..1cff5ac 100644 --- a/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbRemoteFileTemplate.java +++ b/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbRemoteFileTemplate.java @@ -22,6 +22,8 @@ import org.springframework.integration.file.remote.session.SessionFactory; import jcifs.smb.SmbFile; /** + * The SMP-specific {@link RemoteFileTemplate} implementation. + * * @author Artem Bilan */ public class SmbRemoteFileTemplate extends RemoteFileTemplate { diff --git a/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbShare.java b/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbShare.java index ce541da..6cbb72d 100644 --- a/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbShare.java +++ b/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbShare.java @@ -37,6 +37,8 @@ import jcifs.smb.SmbException; import jcifs.smb.SmbFile; /** + * The {@link SmbFile} extension to represent an SMB share directory. + * * @author Markus Spann * @author Gregory Bragg * @author Adam Jones @@ -53,16 +55,6 @@ public class SmbShare extends SmbFile { private final AtomicBoolean closeContext = new AtomicBoolean(false); - /** - * @deprecated as of release 1.1.0, use {@link #SmbShare(SmbConfig)} instead. - * @param url do not use - * @throws IOException do not use - */ - @Deprecated - public SmbShare(String url) throws IOException { - super(StringUtils.cleanPath(url)); - } - /** * Initializes the jCIFS library with default properties. * @param _smbConfig the SMB share configuration @@ -155,14 +147,6 @@ public class SmbShare extends SmbFile { return this.open.get(); } - /** - * @deprecated use {@link #close()} instead. - */ - @Deprecated - void doClose() { - close(); - } - @Override public synchronized void close() { this.open.set(false); diff --git a/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbUtils.java b/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbUtils.java deleted file mode 100644 index e23262a..0000000 --- a/spring-integration-smb/src/main/java/org/springframework/integration/smb/session/SmbUtils.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2012-2017 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.session; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.nio.MappedByteBuffer; -import java.nio.channels.FileChannel; - -/** - * @author Markus Spann - * @since 1.0 - */ -public final class SmbUtils { - - private SmbUtils() { - } - - /** - * Read the specified file into a byte array. - * @param _file file - * @return byte array of file contents - * @throws IOException the IO exception - */ - public static byte[] readFile(File _file) throws IOException { - FileInputStream stream = new FileInputStream(_file); - try { - FileChannel fc = stream.getChannel(); - MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()); - return bb.array(); - - /* Instead of using default, pass in a decoder. */ - // return Charset.defaultCharset().decode(bb).toString(); - - } - finally { - stream.close(); - } - } - -} diff --git a/spring-integration-smb/src/main/resources/META-INF/spring.schemas b/spring-integration-smb/src/main/resources/META-INF/spring.schemas index 0ce607f..8ddd71f 100644 --- a/spring-integration-smb/src/main/resources/META-INF/spring.schemas +++ b/spring-integration-smb/src/main/resources/META-INF/spring.schemas @@ -1,4 +1,4 @@ -http\://www.springframework.org/schema/integration/smb/spring-integration-smb-1.0.xsd=org/springframework/integration/smb/config/spring-integration-smb-1.0.xsd -http\://www.springframework.org/schema/integration/smb/spring-integration-smb.xsd=org/springframework/integration/smb/config/spring-integration-smb-1.0.xsd -https\://www.springframework.org/schema/integration/smb/spring-integration-smb-1.0.xsd=org/springframework/integration/smb/config/spring-integration-smb-1.0.xsd -https\://www.springframework.org/schema/integration/smb/spring-integration-smb.xsd=org/springframework/integration/smb/config/spring-integration-smb-1.0.xsd +http\://www.springframework.org/schema/integration/smb/spring-integration-smb-1.0.xsd=org/springframework/integration/smb/config/spring-integration-smb.xsd +http\://www.springframework.org/schema/integration/smb/spring-integration-smb.xsd=org/springframework/integration/smb/config/spring-integration-smb.xsd +https\://www.springframework.org/schema/integration/smb/spring-integration-smb-1.0.xsd=org/springframework/integration/smb/config/spring-integration-smb.xsd +https\://www.springframework.org/schema/integration/smb/spring-integration-smb.xsd=org/springframework/integration/smb/config/spring-integration-smb.xsd diff --git a/spring-integration-smb/src/main/resources/org/springframework/integration/smb/config/spring-integration-smb-1.0.xsd b/spring-integration-smb/src/main/resources/org/springframework/integration/smb/config/spring-integration-smb.xsd similarity index 100% rename from spring-integration-smb/src/main/resources/org/springframework/integration/smb/config/spring-integration-smb-1.0.xsd rename to spring-integration-smb/src/main/resources/org/springframework/integration/smb/config/spring-integration-smb.xsd diff --git a/spring-integration-smb/src/test/java/org/springframework/integration/smb/config/SmbOutboundChannelAdapterParserTests.java b/spring-integration-smb/src/test/java/org/springframework/integration/smb/config/SmbOutboundChannelAdapterParserTests.java index 473118c..8c6e800 100644 --- a/spring-integration-smb/src/test/java/org/springframework/integration/smb/config/SmbOutboundChannelAdapterParserTests.java +++ b/spring-integration-smb/src/test/java/org/springframework/integration/smb/config/SmbOutboundChannelAdapterParserTests.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; +import java.nio.charset.Charset; import java.util.Iterator; import java.util.Set; @@ -60,7 +61,7 @@ public class SmbOutboundChannelAdapterParserTests extends AbstractBaseTests { assertEquals(".working.tmp", TestUtils.getPropertyValue(messageHandler, "remoteFileTemplate.temporaryFileSuffix", String.class)); assertEquals(".", remoteFileSeparator); assertEquals(ac.getBean("fileNameGenerator"), TestUtils.getPropertyValue(messageHandler, "remoteFileTemplate.fileNameGenerator")); - assertEquals("UTF-8", TestUtils.getPropertyValue(messageHandler, "remoteFileTemplate.charset")); + assertEquals("UTF-8", TestUtils.getPropertyValue(messageHandler, "remoteFileTemplate.charset", Charset.class).name()); Object sessionFactoryProp = TestUtils.getPropertyValue(messageHandler, "remoteFileTemplate.sessionFactory"); assertEquals(SmbSessionFactory.class, sessionFactoryProp.getClass());