1
0
mirror of https://github.com/Rogiel/httpchannel synced 2025-12-06 07:32:50 +00:00

Adds -SNAPSHOT to Maven version parameter and few modifications to API

This commit is contained in:
2012-01-17 17:07:48 -02:00
parent 08d22a12fe
commit 673bfc6639
56 changed files with 536 additions and 399 deletions

View File

@@ -4,7 +4,7 @@
<parent>
<artifactId>httpchannel</artifactId>
<groupId>com.rogiel.httpchannel</groupId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>httpchannel-api</artifactId>

View File

@@ -3,7 +3,7 @@
*/
package com.rogiel.httpchannel.captcha;
import java.net.URL;
import java.net.URI;
/**
* @author <a href="http://www.rogiel.com">Rogiel</a>
@@ -15,9 +15,9 @@ public class ImageCaptcha implements Captcha {
*/
private final String ID;
/**
* The CAPTCHA Image {@link URL}
* The CAPTCHA Image {@link URI}
*/
private final URL imageURL;
private final URI imageURI;
/**
* The CAPTCHA answer
*/
@@ -27,9 +27,9 @@ public class ImageCaptcha implements Captcha {
*/
private Object attachment;
public ImageCaptcha(String id, URL imageURL) {
public ImageCaptcha(String id, URI imageURI) {
this.ID = id;
this.imageURL = imageURL;
this.imageURI = imageURI;
}
@Override
@@ -37,8 +37,8 @@ public class ImageCaptcha implements Captcha {
return ID;
}
public URL getImageURL() {
return imageURL;
public URI getImageURI() {
return imageURI;
}
@Override
@@ -68,7 +68,7 @@ public class ImageCaptcha implements Captcha {
@Override
public String toString() {
return "ImageCaptcha [ID=" + ID + ", imageURL=" + imageURL
return "ImageCaptcha [ID=" + ID + ", imageURI=" + imageURI
+ ", answer=" + answer + ", attachment=" + attachment + "]";
}
}

View File

@@ -16,7 +16,7 @@
*/
package com.rogiel.httpchannel.service;
import java.net.URL;
import java.net.URI;
import javax.tools.FileObject;
@@ -33,27 +33,27 @@ public interface DownloadService<C extends DownloaderConfiguration> extends
Service {
/**
* Creates a new instance of the {@link Downloader}. This instance will be
* attached to the {@link URL}, {@link FileObject} provided through the the
* attached to the {@link URI}, {@link FileObject} provided through the the
* arguments and the parent {@link Service} instance.
*
* @param url
* the url to be downloaded
* @param uri
* the uri to be downloaded
* @param configuration
* the downloader configurationf
* the downloader configuration
* @return an new instance of {@link Downloader}
*/
Downloader<C> getDownloader(URL url, C configuration);
Downloader<C> getDownloader(URI uri, C configuration);
/**
* Creates a new instance of the {@link Downloader}. This instance will be
* attached to the {@link URL}, {@link FileObject} provided through the the
* attached to the {@link URI}, {@link FileObject} provided through the the
* arguments and the parent {@link Service} instance.
*
* @param url
* the url to be downloaded
* @param uri
* the uri to be downloaded
* @return an new instance of {@link Downloader}
*/
Downloader<C> getDownloader(URL url);
Downloader<C> getDownloader(URI uri);
/**
* Creates a new configuration object. If a service does not support or
@@ -65,17 +65,17 @@ public interface DownloadService<C extends DownloaderConfiguration> extends
C newDownloaderConfiguration();
/**
* Check if this {@link Service} can download from this URL. Implementations
* Check if this {@link Service} can download from this URI. Implementations
* might or might not perform network activity.
* <p>
* <b>Please note</b> that the value returned by this method may vary based
* on it's state (i.e. premium or not).
*
* @param url
* the {@link URL} to be tested.
* @param uri
* the {@link URI} to be tested.
* @return true if supported, false otherwise.
*/
boolean matchURL(URL url);
boolean matchURI(URI uri);
/**
* Return the matrix of capabilities for this {@link Downloader}.

View File

@@ -37,7 +37,7 @@ public interface Service extends Cloneable {
*
* @return the id of the service
*/
ServiceID getID();
ServiceID getServiceID();
/**
* Get Major version of this service

View File

@@ -17,7 +17,7 @@
package com.rogiel.httpchannel.service;
import java.io.IOException;
import java.net.URL;
import java.net.URI;
import java.nio.channels.Channel;
import java.nio.channels.WritableByteChannel;
@@ -43,7 +43,7 @@ public interface UploadChannel extends HttpChannel, WritableByteChannel {
*
* @return the download link for this upload
*/
URL getDownloadLink();
URI getDownloadLink();
/**
* @throws UploadLinkNotFoundException

View File

@@ -17,7 +17,7 @@
package com.rogiel.httpchannel.service.helper;
import java.io.IOException;
import java.net.URL;
import java.net.URI;
import com.rogiel.httpchannel.service.DownloadService;
@@ -25,8 +25,8 @@ import com.rogiel.httpchannel.service.DownloadService;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class DownloadServices {
public static boolean canDownload(DownloadService<?> service, URL url)
public static boolean canDownload(DownloadService<?> service, URI uri)
throws IOException {
return service.matchURL(url);
return service.matchURI(uri);
}
}

View File

@@ -16,7 +16,7 @@
*/
package com.rogiel.httpchannel.service.helper;
import java.net.URL;
import java.net.URI;
import java.util.Iterator;
import java.util.ServiceLoader;
@@ -41,17 +41,17 @@ public class Services {
}
/**
* Tries to detect which service should be used to download the given URL
* Tries to detect which service should be used to download the given URI
*
* @param url
* the URL
* @param uri
* the URI
* @return the matched service
*/
public static DownloadService<?> matchURL(URL url) {
public static DownloadService<?> matchURI(URI uri) {
for (final Service service : iterate()) {
if (!(service instanceof DownloadService))
continue;
if (((DownloadService<?>) service).matchURL(url))
if (((DownloadService<?>) service).matchURI(uri))
return (DownloadService<?>) service;
}
return null;
@@ -66,7 +66,7 @@ public class Services {
*/
public static Service getService(ServiceID id) {
for (final Service service : iterate()) {
if (service.getID().equals(id))
if (service.getServiceID().equals(id))
return service;
}
return null;
@@ -106,7 +106,7 @@ public class Services {
@Override
public ServiceID next() {
return iterator.next().getID();
return iterator.next().getServiceID();
}
@Override