From 1c8db5cf36417874da138f237e13ad69cb10fe5e Mon Sep 17 00:00:00 2001 From: Rogiel Date: Fri, 7 Oct 2011 01:41:53 -0300 Subject: [PATCH] Modularize in maven projects the httpchannel library This commit creates several maven modules for each segment of the library. Now it is possible to include only individual services to the classpath instead of the full library. --- .classpath | 10 ------- .gitignore | 15 +++++++++- .project | 24 --------------- .settings/org.eclipse.jdt.core.prefs | 13 -------- .settings/org.eclipse.m2e.core.prefs | 5 ---- .settings/org.maven.ide.eclipse.prefs | 8 ----- httpchannel-api/pom.xml | 10 +++++++ .../httpchannel/service/AbstractService.java | 0 .../service/AuthenticationService.java | 0 .../httpchannel/service/Authenticator.java | 0 .../service/AuthenticatorCapability.java | 0 .../httpchannel/service/CapabilityMatrix.java | 1 + .../httpchannel/service/Credential.java | 0 .../httpchannel/service/DownloadChannel.java | 0 .../httpchannel/service/DownloadListener.java | 0 .../httpchannel/service/DownloadService.java | 0 .../httpchannel/service/Downloader.java | 7 +++-- .../service/DownloaderCapability.java | 0 .../rogiel/httpchannel/service/Service.java | 0 .../httpchannel/service/ServiceHelper.java | 0 .../httpchannel/service/UploadChannel.java | 0 .../httpchannel/service/UploadService.java | 0 .../rogiel/httpchannel/service/Uploader.java | 0 .../service/UploaderCapability.java | 0 .../httpchannel/service/captcha/Captcha.java | 0 .../service/captcha/CaptchaResolver.java | 0 .../service/captcha/ImageCaptcha.java | 0 .../channel/InputStreamDownloadChannel.java | 0 .../service/channel/LinkedUploadChannel.java | 0 .../LinkedUploadChannelContentBody.java | 7 +++-- .../service/config/ServiceConfiguration.java | 0 .../config/ServiceConfigurationHelper.java | 0 .../config/ServiceConfigurationProperty.java | 0 ...henticationInvalidCredentialException.java | 0 .../AuthenticationServiceException.java | 0 .../exception/ChannelServiceException.java | 0 .../DownloadInvalidCaptchaException.java | 0 .../DownloadLimitExceededException.java | 0 .../DownloadLinkNotFoundException.java | 0 .../exception/DownloadServiceException.java | 0 .../UploadLinkNotFoundException.java | 0 .../exception/UploadServiceException.java | 0 .../transformer/TransformationException.java | 0 .../util/transformer/Transformer.java | 0 .../util/transformer/TransformerFactory.java | 0 .../transformer/impl/BooleanTransformer.java | 0 .../transformer/impl/IntegerTransformer.java | 0 .../transformer/impl/LongTransformer.java | 0 .../transformer/impl/StringTransformer.java | 0 .../util/transformer/impl/URLTransformer.java | 0 .../httpchannel-service-hotfile/pom.xml | 10 +++++++ .../service/impl/HotFileService.java | 4 +-- .../service/impl/HotFileServiceTest.java | 6 ++-- .../src/test/resources/.gitignore | 1 + .../src}/test/resources/upload-test-file.txt | 0 .../httpchannel-service-megaupload/pom.xml | 10 +++++++ .../service/impl/MegaUploadService.java | 4 +-- .../service/impl/MegaUploadServiceTest.java | 8 ++--- .../src/test/resources/.gitignore | 1 + .../src/test/resources/upload-test-file.txt | 3 ++ httpchannel-service/pom.xml | 30 +++++++++++++++++++ httpchannel-util/pom.xml | 17 +++++++++++ .../service/AbstractDownloader.java | 0 .../service/AbstractHttpService.java | 8 +++++ .../util/AlwaysRedirectStrategy.java | 0 .../rogiel/httpchannel/util/ChannelUtils.java | 0 .../httpchannel/util/HttpClientUtils.java | 0 .../rogiel/httpchannel/util/PatternUtils.java | 0 .../rogiel/httpchannel/util/ThreadUtils.java | 1 + .../httpchannel/util/htmlparser/HTMLPage.java | 3 ++ log4.properties | 10 ------- pom.xml | 8 +++-- src/test/resources/.gitignore | 1 - src/test/resources/log4j.properties | 9 ------ 74 files changed, 135 insertions(+), 99 deletions(-) delete mode 100644 .classpath delete mode 100644 .project delete mode 100644 .settings/org.eclipse.jdt.core.prefs delete mode 100644 .settings/org.eclipse.m2e.core.prefs delete mode 100644 .settings/org.maven.ide.eclipse.prefs create mode 100644 httpchannel-api/pom.xml rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/AbstractService.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/AuthenticationService.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/Authenticator.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/AuthenticatorCapability.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/CapabilityMatrix.java (99%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/Credential.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/DownloadChannel.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/DownloadListener.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/DownloadService.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/Downloader.java (86%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/DownloaderCapability.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/Service.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/ServiceHelper.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/UploadChannel.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/UploadService.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/Uploader.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/UploaderCapability.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/captcha/Captcha.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/captcha/CaptchaResolver.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/captcha/ImageCaptcha.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/channel/InputStreamDownloadChannel.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/channel/LinkedUploadChannel.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/channel/LinkedUploadChannelContentBody.java (96%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/config/ServiceConfiguration.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/config/ServiceConfigurationHelper.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/config/ServiceConfigurationProperty.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/exception/AuthenticationInvalidCredentialException.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/exception/AuthenticationServiceException.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/exception/ChannelServiceException.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/exception/DownloadInvalidCaptchaException.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/exception/DownloadLimitExceededException.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/exception/DownloadLinkNotFoundException.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/exception/DownloadServiceException.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/exception/UploadLinkNotFoundException.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/service/exception/UploadServiceException.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/util/transformer/TransformationException.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/util/transformer/Transformer.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/util/transformer/TransformerFactory.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/util/transformer/impl/BooleanTransformer.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/util/transformer/impl/IntegerTransformer.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/util/transformer/impl/LongTransformer.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/util/transformer/impl/StringTransformer.java (100%) rename {src => httpchannel-api/src}/main/java/com/rogiel/httpchannel/util/transformer/impl/URLTransformer.java (100%) create mode 100644 httpchannel-service/httpchannel-service-hotfile/pom.xml rename {src => httpchannel-service/httpchannel-service-hotfile/src}/main/java/com/rogiel/httpchannel/service/impl/HotFileService.java (99%) rename {src => httpchannel-service/httpchannel-service-hotfile/src}/test/java/com/rogiel/httpchannel/service/impl/HotFileServiceTest.java (98%) create mode 100644 httpchannel-service/httpchannel-service-hotfile/src/test/resources/.gitignore rename {src => httpchannel-service/httpchannel-service-hotfile/src}/test/resources/upload-test-file.txt (100%) create mode 100644 httpchannel-service/httpchannel-service-megaupload/pom.xml rename {src => httpchannel-service/httpchannel-service-megaupload/src}/main/java/com/rogiel/httpchannel/service/impl/MegaUploadService.java (98%) rename {src => httpchannel-service/httpchannel-service-megaupload/src}/test/java/com/rogiel/httpchannel/service/impl/MegaUploadServiceTest.java (98%) create mode 100644 httpchannel-service/httpchannel-service-megaupload/src/test/resources/.gitignore create mode 100644 httpchannel-service/httpchannel-service-megaupload/src/test/resources/upload-test-file.txt create mode 100644 httpchannel-service/pom.xml create mode 100644 httpchannel-util/pom.xml rename {src => httpchannel-util/src}/main/java/com/rogiel/httpchannel/service/AbstractDownloader.java (100%) rename {src => httpchannel-util/src}/main/java/com/rogiel/httpchannel/service/AbstractHttpService.java (94%) rename {src => httpchannel-util/src}/main/java/com/rogiel/httpchannel/util/AlwaysRedirectStrategy.java (100%) rename {src => httpchannel-util/src}/main/java/com/rogiel/httpchannel/util/ChannelUtils.java (100%) rename {src => httpchannel-util/src}/main/java/com/rogiel/httpchannel/util/HttpClientUtils.java (100%) rename {src => httpchannel-util/src}/main/java/com/rogiel/httpchannel/util/PatternUtils.java (100%) rename {src => httpchannel-util/src}/main/java/com/rogiel/httpchannel/util/ThreadUtils.java (99%) rename {src => httpchannel-util/src}/main/java/com/rogiel/httpchannel/util/htmlparser/HTMLPage.java (98%) delete mode 100644 log4.properties delete mode 100644 src/test/resources/.gitignore delete mode 100644 src/test/resources/log4j.properties diff --git a/.classpath b/.classpath deleted file mode 100644 index 6e26406..0000000 --- a/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/.gitignore b/.gitignore index ea8c4bf..a68c78e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,14 @@ -/target +# Eclipse project files and folders +.project +.metadata +.classpath +.settings/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# Maven target directory +target/ + +# Find bugs configuration file +/.fbprefs \ No newline at end of file diff --git a/.project b/.project deleted file mode 100644 index 84ceca0..0000000 --- a/.project +++ /dev/null @@ -1,24 +0,0 @@ - - - seedbox-httpchannel - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index f58b826..0000000 --- a/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,13 +0,0 @@ -#Sun Sep 11 18:22:22 BRT 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.7 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index b5b55f3..0000000 --- a/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Tue Sep 13 15:42:20 BRT 2011 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/.settings/org.maven.ide.eclipse.prefs b/.settings/org.maven.ide.eclipse.prefs deleted file mode 100644 index 512edbb..0000000 --- a/.settings/org.maven.ide.eclipse.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sun Aug 14 13:30:10 BRT 2011 -activeProfiles= -eclipse.preferences.version=1 -fullBuildGoals=process-test-resources -resolveWorkspaceProjects=true -resourceFilterGoals=process-resources resources\:testResources -skipCompilerPlugin=true -version=1 diff --git a/httpchannel-api/pom.xml b/httpchannel-api/pom.xml new file mode 100644 index 0000000..2a711c9 --- /dev/null +++ b/httpchannel-api/pom.xml @@ -0,0 +1,10 @@ + + 4.0.0 + + httpchannel + com.rogiel.httpchannel + 1.0.0 + .. + + httpchannel-api + \ No newline at end of file diff --git a/src/main/java/com/rogiel/httpchannel/service/AbstractService.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/AbstractService.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/AbstractService.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/AbstractService.java diff --git a/src/main/java/com/rogiel/httpchannel/service/AuthenticationService.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/AuthenticationService.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/AuthenticationService.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/AuthenticationService.java diff --git a/src/main/java/com/rogiel/httpchannel/service/Authenticator.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/Authenticator.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/Authenticator.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/Authenticator.java diff --git a/src/main/java/com/rogiel/httpchannel/service/AuthenticatorCapability.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/AuthenticatorCapability.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/AuthenticatorCapability.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/AuthenticatorCapability.java diff --git a/src/main/java/com/rogiel/httpchannel/service/CapabilityMatrix.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/CapabilityMatrix.java similarity index 99% rename from src/main/java/com/rogiel/httpchannel/service/CapabilityMatrix.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/CapabilityMatrix.java index 8265720..bbc1aa0 100644 --- a/src/main/java/com/rogiel/httpchannel/service/CapabilityMatrix.java +++ b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/CapabilityMatrix.java @@ -36,6 +36,7 @@ public class CapabilityMatrix { * @param matrix * all the capabilities this service support */ + @SafeVarargs public CapabilityMatrix(T... matrix) { this.matrix = matrix; } diff --git a/src/main/java/com/rogiel/httpchannel/service/Credential.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/Credential.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/Credential.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/Credential.java diff --git a/src/main/java/com/rogiel/httpchannel/service/DownloadChannel.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/DownloadChannel.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/DownloadChannel.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/DownloadChannel.java diff --git a/src/main/java/com/rogiel/httpchannel/service/DownloadListener.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/DownloadListener.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/DownloadListener.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/DownloadListener.java diff --git a/src/main/java/com/rogiel/httpchannel/service/DownloadService.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/DownloadService.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/DownloadService.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/DownloadService.java diff --git a/src/main/java/com/rogiel/httpchannel/service/Downloader.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/Downloader.java similarity index 86% rename from src/main/java/com/rogiel/httpchannel/service/Downloader.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/Downloader.java index e165634..01e19f9 100644 --- a/src/main/java/com/rogiel/httpchannel/service/Downloader.java +++ b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/Downloader.java @@ -33,6 +33,8 @@ public interface Downloader { * * @param listener * the listener to keep a track on the download progress + * @param position + * the download start position. If seek is supported by service. * * @return the {@link DownloadChannel} instance * @throws IOException @@ -44,6 +46,7 @@ public interface Downloader { * if the download limit has been exceed, most times thrown when * downloading as a non-premium user */ - DownloadChannel download(DownloadListener listener) throws IOException, - DownloadLinkNotFoundException, DownloadLimitExceededException; + DownloadChannel download(DownloadListener listener, long position) + throws IOException, DownloadLinkNotFoundException, + DownloadLimitExceededException; } diff --git a/src/main/java/com/rogiel/httpchannel/service/DownloaderCapability.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/DownloaderCapability.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/DownloaderCapability.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/DownloaderCapability.java diff --git a/src/main/java/com/rogiel/httpchannel/service/Service.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/Service.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/Service.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/Service.java diff --git a/src/main/java/com/rogiel/httpchannel/service/ServiceHelper.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/ServiceHelper.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/ServiceHelper.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/ServiceHelper.java diff --git a/src/main/java/com/rogiel/httpchannel/service/UploadChannel.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/UploadChannel.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/UploadChannel.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/UploadChannel.java diff --git a/src/main/java/com/rogiel/httpchannel/service/UploadService.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/UploadService.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/UploadService.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/UploadService.java diff --git a/src/main/java/com/rogiel/httpchannel/service/Uploader.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/Uploader.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/Uploader.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/Uploader.java diff --git a/src/main/java/com/rogiel/httpchannel/service/UploaderCapability.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/UploaderCapability.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/UploaderCapability.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/UploaderCapability.java diff --git a/src/main/java/com/rogiel/httpchannel/service/captcha/Captcha.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/captcha/Captcha.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/captcha/Captcha.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/captcha/Captcha.java diff --git a/src/main/java/com/rogiel/httpchannel/service/captcha/CaptchaResolver.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/captcha/CaptchaResolver.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/captcha/CaptchaResolver.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/captcha/CaptchaResolver.java diff --git a/src/main/java/com/rogiel/httpchannel/service/captcha/ImageCaptcha.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/captcha/ImageCaptcha.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/captcha/ImageCaptcha.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/captcha/ImageCaptcha.java diff --git a/src/main/java/com/rogiel/httpchannel/service/channel/InputStreamDownloadChannel.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/channel/InputStreamDownloadChannel.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/channel/InputStreamDownloadChannel.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/channel/InputStreamDownloadChannel.java diff --git a/src/main/java/com/rogiel/httpchannel/service/channel/LinkedUploadChannel.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/channel/LinkedUploadChannel.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/channel/LinkedUploadChannel.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/channel/LinkedUploadChannel.java diff --git a/src/main/java/com/rogiel/httpchannel/service/channel/LinkedUploadChannelContentBody.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/channel/LinkedUploadChannelContentBody.java similarity index 96% rename from src/main/java/com/rogiel/httpchannel/service/channel/LinkedUploadChannelContentBody.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/channel/LinkedUploadChannelContentBody.java index a4a797f..433896a 100644 --- a/src/main/java/com/rogiel/httpchannel/service/channel/LinkedUploadChannelContentBody.java +++ b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/channel/LinkedUploadChannelContentBody.java @@ -21,12 +21,10 @@ import java.io.OutputStream; import java.nio.channels.Channels; import java.nio.channels.WritableByteChannel; - import org.apache.http.entity.mime.content.AbstractContentBody; import org.apache.http.entity.mime.content.ContentBody; import com.rogiel.httpchannel.service.Uploader; -import com.rogiel.httpchannel.util.ThreadUtils; /** * {@link ContentBody} used to upload files in {@link Uploader} implementations. @@ -53,7 +51,10 @@ public class LinkedUploadChannelContentBody extends AbstractContentBody { channel.linkChannel(outputChannel); while (channel.isOpen() && outputChannel.isOpen()) { - ThreadUtils.sleep(500); + try { + Thread.sleep(500); + } catch (InterruptedException e) { + } } } diff --git a/src/main/java/com/rogiel/httpchannel/service/config/ServiceConfiguration.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/config/ServiceConfiguration.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/config/ServiceConfiguration.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/config/ServiceConfiguration.java diff --git a/src/main/java/com/rogiel/httpchannel/service/config/ServiceConfigurationHelper.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/config/ServiceConfigurationHelper.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/config/ServiceConfigurationHelper.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/config/ServiceConfigurationHelper.java diff --git a/src/main/java/com/rogiel/httpchannel/service/config/ServiceConfigurationProperty.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/config/ServiceConfigurationProperty.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/config/ServiceConfigurationProperty.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/config/ServiceConfigurationProperty.java diff --git a/src/main/java/com/rogiel/httpchannel/service/exception/AuthenticationInvalidCredentialException.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/AuthenticationInvalidCredentialException.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/exception/AuthenticationInvalidCredentialException.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/AuthenticationInvalidCredentialException.java diff --git a/src/main/java/com/rogiel/httpchannel/service/exception/AuthenticationServiceException.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/AuthenticationServiceException.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/exception/AuthenticationServiceException.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/AuthenticationServiceException.java diff --git a/src/main/java/com/rogiel/httpchannel/service/exception/ChannelServiceException.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/ChannelServiceException.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/exception/ChannelServiceException.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/ChannelServiceException.java diff --git a/src/main/java/com/rogiel/httpchannel/service/exception/DownloadInvalidCaptchaException.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/DownloadInvalidCaptchaException.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/exception/DownloadInvalidCaptchaException.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/DownloadInvalidCaptchaException.java diff --git a/src/main/java/com/rogiel/httpchannel/service/exception/DownloadLimitExceededException.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/DownloadLimitExceededException.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/exception/DownloadLimitExceededException.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/DownloadLimitExceededException.java diff --git a/src/main/java/com/rogiel/httpchannel/service/exception/DownloadLinkNotFoundException.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/DownloadLinkNotFoundException.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/exception/DownloadLinkNotFoundException.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/DownloadLinkNotFoundException.java diff --git a/src/main/java/com/rogiel/httpchannel/service/exception/DownloadServiceException.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/DownloadServiceException.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/exception/DownloadServiceException.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/DownloadServiceException.java diff --git a/src/main/java/com/rogiel/httpchannel/service/exception/UploadLinkNotFoundException.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/UploadLinkNotFoundException.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/exception/UploadLinkNotFoundException.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/UploadLinkNotFoundException.java diff --git a/src/main/java/com/rogiel/httpchannel/service/exception/UploadServiceException.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/UploadServiceException.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/exception/UploadServiceException.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/service/exception/UploadServiceException.java diff --git a/src/main/java/com/rogiel/httpchannel/util/transformer/TransformationException.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/util/transformer/TransformationException.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/util/transformer/TransformationException.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/util/transformer/TransformationException.java diff --git a/src/main/java/com/rogiel/httpchannel/util/transformer/Transformer.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/util/transformer/Transformer.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/util/transformer/Transformer.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/util/transformer/Transformer.java diff --git a/src/main/java/com/rogiel/httpchannel/util/transformer/TransformerFactory.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/util/transformer/TransformerFactory.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/util/transformer/TransformerFactory.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/util/transformer/TransformerFactory.java diff --git a/src/main/java/com/rogiel/httpchannel/util/transformer/impl/BooleanTransformer.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/util/transformer/impl/BooleanTransformer.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/util/transformer/impl/BooleanTransformer.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/util/transformer/impl/BooleanTransformer.java diff --git a/src/main/java/com/rogiel/httpchannel/util/transformer/impl/IntegerTransformer.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/util/transformer/impl/IntegerTransformer.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/util/transformer/impl/IntegerTransformer.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/util/transformer/impl/IntegerTransformer.java diff --git a/src/main/java/com/rogiel/httpchannel/util/transformer/impl/LongTransformer.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/util/transformer/impl/LongTransformer.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/util/transformer/impl/LongTransformer.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/util/transformer/impl/LongTransformer.java diff --git a/src/main/java/com/rogiel/httpchannel/util/transformer/impl/StringTransformer.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/util/transformer/impl/StringTransformer.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/util/transformer/impl/StringTransformer.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/util/transformer/impl/StringTransformer.java diff --git a/src/main/java/com/rogiel/httpchannel/util/transformer/impl/URLTransformer.java b/httpchannel-api/src/main/java/com/rogiel/httpchannel/util/transformer/impl/URLTransformer.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/util/transformer/impl/URLTransformer.java rename to httpchannel-api/src/main/java/com/rogiel/httpchannel/util/transformer/impl/URLTransformer.java diff --git a/httpchannel-service/httpchannel-service-hotfile/pom.xml b/httpchannel-service/httpchannel-service-hotfile/pom.xml new file mode 100644 index 0000000..393ab43 --- /dev/null +++ b/httpchannel-service/httpchannel-service-hotfile/pom.xml @@ -0,0 +1,10 @@ + + 4.0.0 + + httpchannel-service + com.rogiel.httpchannel + 1.0.0 + .. + + httpchannel-service-hotfile + \ No newline at end of file diff --git a/src/main/java/com/rogiel/httpchannel/service/impl/HotFileService.java b/httpchannel-service/httpchannel-service-hotfile/src/main/java/com/rogiel/httpchannel/service/impl/HotFileService.java similarity index 99% rename from src/main/java/com/rogiel/httpchannel/service/impl/HotFileService.java rename to httpchannel-service/httpchannel-service-hotfile/src/main/java/com/rogiel/httpchannel/service/impl/HotFileService.java index 42e656e..cb91f71 100644 --- a/src/main/java/com/rogiel/httpchannel/service/impl/HotFileService.java +++ b/httpchannel-service/httpchannel-service-hotfile/src/main/java/com/rogiel/httpchannel/service/impl/HotFileService.java @@ -48,8 +48,8 @@ import com.rogiel.httpchannel.service.Uploader; import com.rogiel.httpchannel.service.UploaderCapability; import com.rogiel.httpchannel.service.channel.InputStreamDownloadChannel; import com.rogiel.httpchannel.service.channel.LinkedUploadChannel; -import com.rogiel.httpchannel.service.channel.LinkedUploadChannelContentBody; import com.rogiel.httpchannel.service.channel.LinkedUploadChannel.LinkedUploadChannelCloseCallback; +import com.rogiel.httpchannel.service.channel.LinkedUploadChannelContentBody; import com.rogiel.httpchannel.service.config.ServiceConfiguration; import com.rogiel.httpchannel.service.exception.AuthenticationInvalidCredentialException; import com.rogiel.httpchannel.service.impl.HotFileService.HotFileServiceConfiguration; @@ -198,7 +198,7 @@ public class HotFileService extends } @Override - public DownloadChannel download(DownloadListener listener) + public DownloadChannel download(DownloadListener listener, long position) throws IOException { final HTMLPage page = getAsPage(url.toString()); diff --git a/src/test/java/com/rogiel/httpchannel/service/impl/HotFileServiceTest.java b/httpchannel-service/httpchannel-service-hotfile/src/test/java/com/rogiel/httpchannel/service/impl/HotFileServiceTest.java similarity index 98% rename from src/test/java/com/rogiel/httpchannel/service/impl/HotFileServiceTest.java rename to httpchannel-service/httpchannel-service-hotfile/src/test/java/com/rogiel/httpchannel/service/impl/HotFileServiceTest.java index afd4073..c0f18d1 100644 --- a/src/test/java/com/rogiel/httpchannel/service/impl/HotFileServiceTest.java +++ b/httpchannel-service/httpchannel-service-hotfile/src/test/java/com/rogiel/httpchannel/service/impl/HotFileServiceTest.java @@ -82,7 +82,7 @@ public class HotFileServiceTest { final Properties properties = new Properties(); properties.load(new FileInputStream( - "src/test/resources/config/hotfile.properties")); + "src/test/resources/login.properties")); VALID_USERNAME = properties.getProperty("username"); VALID_PASSWORD = properties.getProperty("password"); } @@ -161,7 +161,7 @@ public class HotFileServiceTest { .getDownloader( new URL( "http://hotfile.com/dl/129251605/9b4faf2/simulado_2010_1_res_all.zip.html")) - .download(null); + .download(null, 0); final ByteArrayOutputStream bout = new ByteArrayOutputStream(); IOUtils.copy(Channels.newInputStream(channel), bout); System.out.println(bout.size()); @@ -177,7 +177,7 @@ public class HotFileServiceTest { .getDownloader( new URL( "http://hotfile.com/dl/129251605/9b4faf2/simulado_2010_1_res_all.zip.html")) - .download(null); + .download(null, 0); final ByteArrayOutputStream bout = new ByteArrayOutputStream(); IOUtils.copy(Channels.newInputStream(channel), bout); diff --git a/httpchannel-service/httpchannel-service-hotfile/src/test/resources/.gitignore b/httpchannel-service/httpchannel-service-hotfile/src/test/resources/.gitignore new file mode 100644 index 0000000..93d95f2 --- /dev/null +++ b/httpchannel-service/httpchannel-service-hotfile/src/test/resources/.gitignore @@ -0,0 +1 @@ +/login.properties diff --git a/src/test/resources/upload-test-file.txt b/httpchannel-service/httpchannel-service-hotfile/src/test/resources/upload-test-file.txt similarity index 100% rename from src/test/resources/upload-test-file.txt rename to httpchannel-service/httpchannel-service-hotfile/src/test/resources/upload-test-file.txt diff --git a/httpchannel-service/httpchannel-service-megaupload/pom.xml b/httpchannel-service/httpchannel-service-megaupload/pom.xml new file mode 100644 index 0000000..1b29388 --- /dev/null +++ b/httpchannel-service/httpchannel-service-megaupload/pom.xml @@ -0,0 +1,10 @@ + + 4.0.0 + + httpchannel-service + com.rogiel.httpchannel + 1.0.0 + .. + + httpchannel-service-megaupload + \ No newline at end of file diff --git a/src/main/java/com/rogiel/httpchannel/service/impl/MegaUploadService.java b/httpchannel-service/httpchannel-service-megaupload/src/main/java/com/rogiel/httpchannel/service/impl/MegaUploadService.java similarity index 98% rename from src/main/java/com/rogiel/httpchannel/service/impl/MegaUploadService.java rename to httpchannel-service/httpchannel-service-megaupload/src/main/java/com/rogiel/httpchannel/service/impl/MegaUploadService.java index 7c93494..b02266a 100644 --- a/src/main/java/com/rogiel/httpchannel/service/impl/MegaUploadService.java +++ b/httpchannel-service/httpchannel-service-megaupload/src/main/java/com/rogiel/httpchannel/service/impl/MegaUploadService.java @@ -222,7 +222,7 @@ public class MegaUploadService extends } @Override - public DownloadChannel download(DownloadListener listener) + public DownloadChannel download(DownloadListener listener, long position) throws IOException { HttpResponse response = get(url.toString()); @@ -255,7 +255,7 @@ public class MegaUploadService extends final String downloadUrl = page .getLink(DOWNLOAD_DIRECT_LINK_PATTERN); if (downloadUrl != null && downloadUrl.length() > 0) { - final HttpResponse downloadResponse = get(downloadUrl); + final HttpResponse downloadResponse = get(downloadUrl, position); if (downloadResponse.getStatusLine().getStatusCode() == HttpStatus.SC_FORBIDDEN || downloadResponse.getStatusLine().getStatusCode() == HttpStatus.SC_SERVICE_UNAVAILABLE) { downloadResponse.getEntity().getContent().close(); diff --git a/src/test/java/com/rogiel/httpchannel/service/impl/MegaUploadServiceTest.java b/httpchannel-service/httpchannel-service-megaupload/src/test/java/com/rogiel/httpchannel/service/impl/MegaUploadServiceTest.java similarity index 98% rename from src/test/java/com/rogiel/httpchannel/service/impl/MegaUploadServiceTest.java rename to httpchannel-service/httpchannel-service-megaupload/src/test/java/com/rogiel/httpchannel/service/impl/MegaUploadServiceTest.java index ec03e42..773fef9 100644 --- a/src/test/java/com/rogiel/httpchannel/service/impl/MegaUploadServiceTest.java +++ b/httpchannel-service/httpchannel-service-megaupload/src/test/java/com/rogiel/httpchannel/service/impl/MegaUploadServiceTest.java @@ -83,7 +83,7 @@ public class MegaUploadServiceTest { final Properties properties = new Properties(); properties.load(new FileInputStream( - "src/test/resources/config/megaupload.properties")); + "src/test/resources/login.properties")); VALID_USERNAME = properties.getProperty("username"); VALID_PASSWORD = properties.getProperty("password"); } @@ -166,7 +166,7 @@ public class MegaUploadServiceTest { // return true; return true; } - }); + }, 0); final ByteArrayOutputStream bout = new ByteArrayOutputStream(); IOUtils.copy(Channels.newInputStream(channel), bout); System.out.println(bout.size()); @@ -186,7 +186,7 @@ public class MegaUploadServiceTest { System.out.println("Waiting " + time); return true; } - }); + }, 0); final ByteArrayOutputStream bout = new ByteArrayOutputStream(); IOUtils.copy(Channels.newInputStream(channel), bout); System.out.println(bout.size()); @@ -208,6 +208,6 @@ public class MegaUploadServiceTest { System.out.println("Waiting " + time); return false; } - }); + }, 0); } } diff --git a/httpchannel-service/httpchannel-service-megaupload/src/test/resources/.gitignore b/httpchannel-service/httpchannel-service-megaupload/src/test/resources/.gitignore new file mode 100644 index 0000000..93d95f2 --- /dev/null +++ b/httpchannel-service/httpchannel-service-megaupload/src/test/resources/.gitignore @@ -0,0 +1 @@ +/login.properties diff --git a/httpchannel-service/httpchannel-service-megaupload/src/test/resources/upload-test-file.txt b/httpchannel-service/httpchannel-service-megaupload/src/test/resources/upload-test-file.txt new file mode 100644 index 0000000..3cfccc8 --- /dev/null +++ b/httpchannel-service/httpchannel-service-megaupload/src/test/resources/upload-test-file.txt @@ -0,0 +1,3 @@ +This is a simple upload test file. + +This is for testing purposes only. \ No newline at end of file diff --git a/httpchannel-service/pom.xml b/httpchannel-service/pom.xml new file mode 100644 index 0000000..87757d8 --- /dev/null +++ b/httpchannel-service/pom.xml @@ -0,0 +1,30 @@ + + 4.0.0 + + httpchannel + com.rogiel.httpchannel + 1.0.0 + .. + + httpchannel-service + pom + + + httpchannel-service-megaupload + httpchannel-service-hotfile + + + + + com.rogiel.httpchannel + httpchannel-api + ${project.version} + + + com.rogiel.httpchannel + httpchannel-util + 1.0.0 + + + \ No newline at end of file diff --git a/httpchannel-util/pom.xml b/httpchannel-util/pom.xml new file mode 100644 index 0000000..cddcbd2 --- /dev/null +++ b/httpchannel-util/pom.xml @@ -0,0 +1,17 @@ + + 4.0.0 + + httpchannel + com.rogiel.httpchannel + 1.0.0 + .. + + httpchannel-util + + + com.rogiel.httpchannel + httpchannel-api + 1.0.0 + + + \ No newline at end of file diff --git a/src/main/java/com/rogiel/httpchannel/service/AbstractDownloader.java b/httpchannel-util/src/main/java/com/rogiel/httpchannel/service/AbstractDownloader.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/service/AbstractDownloader.java rename to httpchannel-util/src/main/java/com/rogiel/httpchannel/service/AbstractDownloader.java diff --git a/src/main/java/com/rogiel/httpchannel/service/AbstractHttpService.java b/httpchannel-util/src/main/java/com/rogiel/httpchannel/service/AbstractHttpService.java similarity index 94% rename from src/main/java/com/rogiel/httpchannel/service/AbstractHttpService.java rename to httpchannel-util/src/main/java/com/rogiel/httpchannel/service/AbstractHttpService.java index b0a3248..36a494f 100644 --- a/src/main/java/com/rogiel/httpchannel/service/AbstractHttpService.java +++ b/httpchannel-util/src/main/java/com/rogiel/httpchannel/service/AbstractHttpService.java @@ -72,6 +72,14 @@ public abstract class AbstractHttpService return client.execute(request); } + protected HttpResponse get(String url, long rangeStart) + throws ClientProtocolException, IOException { + final HttpGet request = new HttpGet(url); + if (rangeStart >= 0) + request.addHeader("Range", "bytes=" + rangeStart + "-"); + return client.execute(request); + } + protected String getAsString(String url) throws ClientProtocolException, IOException { return HttpClientUtils.toString(get(url)); diff --git a/src/main/java/com/rogiel/httpchannel/util/AlwaysRedirectStrategy.java b/httpchannel-util/src/main/java/com/rogiel/httpchannel/util/AlwaysRedirectStrategy.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/util/AlwaysRedirectStrategy.java rename to httpchannel-util/src/main/java/com/rogiel/httpchannel/util/AlwaysRedirectStrategy.java diff --git a/src/main/java/com/rogiel/httpchannel/util/ChannelUtils.java b/httpchannel-util/src/main/java/com/rogiel/httpchannel/util/ChannelUtils.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/util/ChannelUtils.java rename to httpchannel-util/src/main/java/com/rogiel/httpchannel/util/ChannelUtils.java diff --git a/src/main/java/com/rogiel/httpchannel/util/HttpClientUtils.java b/httpchannel-util/src/main/java/com/rogiel/httpchannel/util/HttpClientUtils.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/util/HttpClientUtils.java rename to httpchannel-util/src/main/java/com/rogiel/httpchannel/util/HttpClientUtils.java diff --git a/src/main/java/com/rogiel/httpchannel/util/PatternUtils.java b/httpchannel-util/src/main/java/com/rogiel/httpchannel/util/PatternUtils.java similarity index 100% rename from src/main/java/com/rogiel/httpchannel/util/PatternUtils.java rename to httpchannel-util/src/main/java/com/rogiel/httpchannel/util/PatternUtils.java diff --git a/src/main/java/com/rogiel/httpchannel/util/ThreadUtils.java b/httpchannel-util/src/main/java/com/rogiel/httpchannel/util/ThreadUtils.java similarity index 99% rename from src/main/java/com/rogiel/httpchannel/util/ThreadUtils.java rename to httpchannel-util/src/main/java/com/rogiel/httpchannel/util/ThreadUtils.java index ae2db4c..dbb0ba8 100644 --- a/src/main/java/com/rogiel/httpchannel/util/ThreadUtils.java +++ b/httpchannel-util/src/main/java/com/rogiel/httpchannel/util/ThreadUtils.java @@ -1,4 +1,5 @@ /* + * This file is part of seedbox . * * seedbox is free software: you can redistribute it and/or modify diff --git a/src/main/java/com/rogiel/httpchannel/util/htmlparser/HTMLPage.java b/httpchannel-util/src/main/java/com/rogiel/httpchannel/util/htmlparser/HTMLPage.java similarity index 98% rename from src/main/java/com/rogiel/httpchannel/util/htmlparser/HTMLPage.java rename to httpchannel-util/src/main/java/com/rogiel/httpchannel/util/htmlparser/HTMLPage.java index 18b0ad7..a8fe811 100644 --- a/src/main/java/com/rogiel/httpchannel/util/htmlparser/HTMLPage.java +++ b/httpchannel-util/src/main/java/com/rogiel/httpchannel/util/htmlparser/HTMLPage.java @@ -224,6 +224,9 @@ public class HTMLPage { } public int findIntegerInScript(final Pattern pattern, int n) { + String found = findInScript(pattern, n); + if(found == null) + return 0; return Integer.parseInt(findInScript(pattern, n)); } diff --git a/log4.properties b/log4.properties deleted file mode 100644 index 4090469..0000000 --- a/log4.properties +++ /dev/null @@ -1,10 +0,0 @@ -log4j.rootLogger=INFO, stdout - - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%5p [%c] %m%n - - -log4j.logger.httpclient.wire.header=DEBUG -log4j.logger.org.apache.commons.httpclient=DEBUG \ No newline at end of file diff --git a/pom.xml b/pom.xml index 42cc066..e89a125 100644 --- a/pom.xml +++ b/pom.xml @@ -1,8 +1,8 @@ 4.0.0 - com.rogiel.seedbox - seedbox-httpchannel + com.rogiel.httpchannel + httpchannel 1.0.0 Seedbox - HTTP Channel library Library capable of downloading and uploading files from free servers using channels. @@ -78,5 +78,9 @@ + httpchannel-api + httpchannel-service + httpchannel-util + pom \ No newline at end of file diff --git a/src/test/resources/.gitignore b/src/test/resources/.gitignore deleted file mode 100644 index 50cf6de..0000000 --- a/src/test/resources/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/config diff --git a/src/test/resources/log4j.properties b/src/test/resources/log4j.properties deleted file mode 100644 index 29ae93a..0000000 --- a/src/test/resources/log4j.properties +++ /dev/null @@ -1,9 +0,0 @@ -log4j.rootLogger=INFO, stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%5p [%c] %m%n - -log4j.logger.org.apache.http.impl.conn=DEBUG -log4j.logger.org.apache.http.impl.client=DEBUG -log4j.logger.org.apache.http.client=DEBUG \ No newline at end of file