[maven-release-plugin] copy for tag org.apache.sling.hapi.client-1.0.0
git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.hapi.client-1.0.0@1755762 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index fc2f3a6..881bff8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>26</version>
+ <version>28</version>
<relativePath />
</parent>
@@ -74,21 +74,25 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.1</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.5</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
@@ -98,7 +102,6 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.7.21</version>
</dependency>
<!-- test scope -->
<dependency>
@@ -111,13 +114,10 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
- <version>1.7.21</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <scope>test</scope>
</dependency>
</dependencies>
</project>
diff --git a/src/main/java/org/apache/sling/hapi/client/Document.java b/src/main/java/org/apache/sling/hapi/client/Document.java
index 9344e5d..3da16ba 100644
--- a/src/main/java/org/apache/sling/hapi/client/Document.java
+++ b/src/main/java/org/apache/sling/hapi/client/Document.java
@@ -19,11 +19,39 @@
package org.apache.sling.hapi.client;
/**
- * An HTML document representation
+ * A hapi representation of an HTML document, backed by HTML markup.
+ * The Document provides a structure, accessible through the {@link #item(String)} and {@link #items()} methods
+ * and a way to use the hypermedia controls through the {@link #link(String)} and {@link #form(String)} methods
*/
public interface Document {
+ /**
+ * Get all the {@link Document}'s link items. These Items should normally be backed by HTML <i>anchors</i> and <i>links</i>.
+ * @param rel An identifier that groups all the <i>link</i> Items for this Document
+ * @return all the link Items for this Document, that have the given relation
+ * @throws ClientException
+ */
Items link(String rel) throws ClientException;
+
+ /**
+ * Get all the {@link Document}'s form items. These Items should normally be backed by the HTML <i>form</i> element
+ * @param rel An identifier that groups all the <i>form</i> Items for this Document
+ * @return all the form Items for this Document, that have the given relation
+ * @throws ClientException
+ */
Items form(String rel) throws ClientException;
+
+ /**
+ * Get all the {@link Document}'s items. These Items are backed by any HTML element
+ * @param rel An identifier that groups all the Items for this Document
+ * @return all the Items for this Document, that have the given relation
+ * @throws ClientException
+ */
Items item(String rel) throws ClientException;
+
+ /**
+ * Get all the {@link Document}'s items. These Items are backed by any HTML element
+ * @return all the Items for this Document
+ * @throws ClientException
+ */
Items items() throws ClientException;
}
diff --git a/src/main/java/org/apache/sling/hapi/client/HtmlClientService.java b/src/main/java/org/apache/sling/hapi/client/HtmlClientService.java
index bedf01d..fa39f28 100644
--- a/src/main/java/org/apache/sling/hapi/client/HtmlClientService.java
+++ b/src/main/java/org/apache/sling/hapi/client/HtmlClientService.java
@@ -18,6 +18,32 @@
******************************************************************************/
package org.apache.sling.hapi.client;
+import org.apache.http.impl.client.CloseableHttpClient;
+
public interface HtmlClientService {
+ /**
+ * Get an HtmlClient that internally uses a CloseableHttpClient
+ * @param client the inner {@link CloseableHttpClient}. The client should take care of any timeouts, authentication, pre/post
+ * processing, etc.
+ * @param baseUrl The address prefix to all the http requests (e.g. http://localhost:8080/myapp/)
+ * @return
+ */
+ HtmlClient getClient(CloseableHttpClient client, String baseUrl);
+
+ /**
+ * Get an HtmlClient.
+ * @param baseUrl The address prefix to all the http requests (e.g. http://localhost:8080/myapp/)
+ * @return
+ */
+ HtmlClient getClient(String baseUrl);
+
+ /**
+ * Get an HtmlClient that uses BasicAuth for all requests
+ * @param baseUrl The address prefix to all the http requests (e.g. http://localhost:8080/myapp/)
+ * @param user The username for BasicAuth
+ * @param password The password for BasicAuth
+ * @return
+ */
+ HtmlClient getClient(String baseUrl, String user, String password);
}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/hapi/client/Item.java b/src/main/java/org/apache/sling/hapi/client/Item.java
index fa74107..8eba400 100644
--- a/src/main/java/org/apache/sling/hapi/client/Item.java
+++ b/src/main/java/org/apache/sling/hapi/client/Item.java
@@ -20,21 +20,22 @@
******************************************************************************/
import org.apache.http.NameValuePair;
-
-import java.util.List;
import java.util.Set;
/**
- *
+ * An HTML item representation. This maps to an html element and contains all the child elements.
+ * The child <i>semantic</i> elements (properties, links, forms) and the Item's metadata (src, href, value)
+ * are accessible through the dedicated methods
*/
public interface Item {
/**
- * Returns the property of the item having the given name.
+ * Returns the property of the item having the given name. The property is a child Item.
*/
Items prop(String name) throws ClientException;
/**
- * Return a List of all the properties of this item
+ * Return a List of all the properties of this item.
+ * The returned Strings are names that can be used for {@link #prop(String)}
*/
Set<String> props() throws ClientException;
@@ -81,12 +82,12 @@
String src();
/**
- * Follow a hyperlink and get a new {@see Document} representation
+ * Follow a hyperlink and get a new {@link Document} representation
*/
Document follow() throws ClientException;
/**
- * Submits this form item and returns a new {@see Document} representation
+ * Submits this form item and returns a new {@link Document} representation
*/
Document submit(Iterable<NameValuePair> data) throws ClientException;
}
diff --git a/src/main/java/org/apache/sling/hapi/client/forms/FormValues.java b/src/main/java/org/apache/sling/hapi/client/forms/internal/FormValues.java
similarity index 98%
rename from src/main/java/org/apache/sling/hapi/client/forms/FormValues.java
rename to src/main/java/org/apache/sling/hapi/client/forms/internal/FormValues.java
index 9a12cb1..4d894c5 100644
--- a/src/main/java/org/apache/sling/hapi/client/forms/FormValues.java
+++ b/src/main/java/org/apache/sling/hapi/client/forms/internal/FormValues.java
@@ -17,7 +17,7 @@
* under the License.
******************************************************************************/
-package org.apache.sling.hapi.client.forms;
+package org.apache.sling.hapi.client.forms.internal;
import java.io.UnsupportedEncodingException;
diff --git a/src/main/java/org/apache/sling/hapi/client/forms/Vals.java b/src/main/java/org/apache/sling/hapi/client/forms/internal/Vals.java
similarity index 97%
rename from src/main/java/org/apache/sling/hapi/client/forms/Vals.java
rename to src/main/java/org/apache/sling/hapi/client/forms/internal/Vals.java
index 9e728a6..adff0a8 100644
--- a/src/main/java/org/apache/sling/hapi/client/forms/Vals.java
+++ b/src/main/java/org/apache/sling/hapi/client/forms/internal/Vals.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
******************************************************************************/
-package org.apache.sling.hapi.client.forms;
+package org.apache.sling.hapi.client.forms.internal;
import org.apache.http.NameValuePair;
diff --git a/src/main/java/org/apache/sling/hapi/client/forms/package-info.java b/src/main/java/org/apache/sling/hapi/client/forms/package-info.java
deleted file mode 100644
index 8003994..0000000
--- a/src/main/java/org/apache/sling/hapi/client/forms/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * http://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.
- ******************************************************************************/
-
-@Version("1.0.0")
-package org.apache.sling.hapi.client.forms;
-
-import aQute.bnd.annotation.Version;
diff --git a/src/main/java/org/apache/sling/hapi/client/impl/HtmlClientServiceImpl.java b/src/main/java/org/apache/sling/hapi/client/impl/HtmlClientServiceImpl.java
index a684d1d..623c47d 100644
--- a/src/main/java/org/apache/sling/hapi/client/impl/HtmlClientServiceImpl.java
+++ b/src/main/java/org/apache/sling/hapi/client/impl/HtmlClientServiceImpl.java
@@ -32,7 +32,6 @@
@Component(metatype = false)
@Service(value = HtmlClientService.class)
public class HtmlClientServiceImpl implements HtmlClientService {
-
private final Logger LOG = LoggerFactory.getLogger(HtmlClientService.class);
/**
@@ -41,6 +40,7 @@
* @param baseUrl the base URL as String
* @return the HtmlClient or null if there was an error
*/
+ @Override
public HtmlClient getClient(CloseableHttpClient client, String baseUrl) {
try {
return new MicrodataHtmlClient(client, baseUrl);
@@ -55,6 +55,7 @@
* @param baseUrl the base URL as String
* @return the HtmlClient or null if there was an error
*/
+ @Override
public HtmlClient getClient(String baseUrl) {
try {
return new MicrodataHtmlClient(baseUrl);
@@ -71,6 +72,7 @@
* @param password the password to be used for basic auth
* @return the HtmlClient or null if there was an error
*/
+ @Override
public HtmlClient getClient(String baseUrl, String user, String password) {
try {
return new MicrodataHtmlClient(baseUrl, user, password);
diff --git a/src/main/java/org/apache/sling/hapi/client/impl/microdata/MicrodataDocument.java b/src/main/java/org/apache/sling/hapi/client/impl/microdata/MicrodataDocument.java
index 248887d..c60ca97 100644
--- a/src/main/java/org/apache/sling/hapi/client/impl/microdata/MicrodataDocument.java
+++ b/src/main/java/org/apache/sling/hapi/client/impl/microdata/MicrodataDocument.java
@@ -21,7 +21,7 @@
import org.apache.http.NameValuePair;
import org.apache.sling.hapi.client.*;
-import org.apache.sling.hapi.client.forms.FormValues;
+import org.apache.sling.hapi.client.forms.internal.FormValues;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
diff --git a/src/main/java/org/apache/sling/hapi/client/package-info.java b/src/main/java/org/apache/sling/hapi/client/package-info.java
index c15121e..c22d105 100644
--- a/src/main/java/org/apache/sling/hapi/client/package-info.java
+++ b/src/main/java/org/apache/sling/hapi/client/package-info.java
@@ -17,7 +17,5 @@
* under the License.
******************************************************************************/
-@Version("1.0.0")
+@org.osgi.annotation.versioning.Version("1.0.0")
package org.apache.sling.hapi.client;
-
-import aQute.bnd.annotation.Version;