Juan Hernandez has uploaded a new change for review. Change subject: codgen: Remove explicit dependency on httpclient ......................................................................
codgen: Remove explicit dependency on httpclient Currently the code generator depends explictly on the httpclient because many methods declare org.apache.http.client.ClientProtocolException as one of the exceptions that they may throw. But all these methods already declare that they may throw the more generic java.io.IOException, so the former is redundant. This patch removes the dependency from the POM and the exception from the throws declarations. Change-Id: I8f5fdbb0d82d9606763ef16786438e30ac53a8fc Signed-off-by: Juan Hernandez <juan.hernan...@redhat.com> --- M ovirt-engine-sdk-java-codegen/pom.xml M ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/Main.java M ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/common/AbstractCodegen.java M ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/common/ICodegen.java M ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/rsdl/ApiCodegen.java M ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/rsdl/RsdlCodegen.java M ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/xsd/XsdCodegen.java 7 files changed, 9 insertions(+), 34 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-sdk-java refs/changes/93/22893/1 diff --git a/ovirt-engine-sdk-java-codegen/pom.xml b/ovirt-engine-sdk-java-codegen/pom.xml index 3746350..73d274a 100644 --- a/ovirt-engine-sdk-java-codegen/pom.xml +++ b/ovirt-engine-sdk-java-codegen/pom.xml @@ -31,12 +31,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>4.1.3</version> - <scope>compile</scope> - </dependency> - <dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> <version>1.8.3</version> diff --git a/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/Main.java b/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/Main.java index 1e913aa..a741083 100644 --- a/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/Main.java +++ b/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/Main.java @@ -20,7 +20,6 @@ import javax.xml.bind.JAXBException; -import org.apache.http.client.ClientProtocolException; import org.ovirt.engine.sdk.codegen.rsdl.RsdlCodegen; import org.ovirt.engine.sdk.codegen.xsd.XsdCodegen; import org.ovirt.engine.sdk.exceptions.ServerException; @@ -37,8 +36,7 @@ private static final String USER = "admin@internal"; private static final String PASSWORD = "letmein!"; - public static void main(String[] args) throws ClientProtocolException, - ServerException, IOException, JAXBException { + public static void main(String[] args) throws ServerException, IOException, JAXBException { HttpProxyBroker httpProxyBroker = new HttpProxyBroker( new HttpProxyBuilder( diff --git a/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/common/AbstractCodegen.java b/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/common/AbstractCodegen.java index ed433fd..b3037e8 100644 --- a/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/common/AbstractCodegen.java +++ b/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/common/AbstractCodegen.java @@ -21,7 +21,6 @@ import javax.xml.bind.JAXBException; -import org.apache.http.client.ClientProtocolException; import org.ovirt.engine.sdk.codegen.compile.CodeCompiler; import org.ovirt.engine.sdk.codegen.utils.FileUtils; import org.ovirt.engine.sdk.exceptions.ServerException; @@ -62,14 +61,12 @@ /** * Cleans the package, generates new code and compiles it * - * @throws ClientProtocolException * @throws ServerException * @throws IOException * @throws JAXBException */ @Override - public void generate() throws ClientProtocolException, - ServerException, IOException, JAXBException { + public void generate() throws ServerException, IOException, JAXBException { doCleanPackage(this.distPath); doGenerate(this.distPath); doCompile(); @@ -98,13 +95,11 @@ * @param distPath * directory to generates the code at * - * @throws ClientProtocolException * @throws ServerException * @throws IOException * @throws JAXBException */ - protected abstract void doGenerate(String distPath) throws ClientProtocolException, - ServerException, IOException, JAXBException; + protected abstract void doGenerate(String distPath) throws ServerException, IOException, JAXBException; /** * Delete all files in given directory diff --git a/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/common/ICodegen.java b/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/common/ICodegen.java index 8582ed8..be1634e 100644 --- a/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/common/ICodegen.java +++ b/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/common/ICodegen.java @@ -20,18 +20,15 @@ import javax.xml.bind.JAXBException; -import org.apache.http.client.ClientProtocolException; import org.ovirt.engine.sdk.exceptions.ServerException; public interface ICodegen { /** * Cleans the package and generates the code * - * @throws ClientProtocolException * @throws ServerException * @throws IOException * @throws JAXBException */ - abstract void generate() throws ClientProtocolException, - ServerException, IOException, JAXBException; + abstract void generate() throws ServerException, IOException, JAXBException; } diff --git a/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/rsdl/ApiCodegen.java b/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/rsdl/ApiCodegen.java index 8008e52..71bdee4 100644 --- a/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/rsdl/ApiCodegen.java +++ b/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/rsdl/ApiCodegen.java @@ -22,7 +22,6 @@ import javax.xml.bind.JAXBException; -import org.apache.http.client.ClientProtocolException; import org.ovirt.engine.sdk.codegen.common.AbstractCodegen; import org.ovirt.engine.sdk.codegen.holders.CollectionHolder; import org.ovirt.engine.sdk.codegen.templates.ApiTemplate; @@ -91,7 +90,7 @@ * Generates SDK entry point class */ @Override - protected void doGenerate(String distPath) throws ClientProtocolException, ServerException, IOException, + protected void doGenerate(String distPath) throws ServerException, IOException, JAXBException { String collectionsVariables = produceCollectionVariables(); String collectionsGetters = produceCollectionGetters(); @@ -110,9 +109,8 @@ * * @throws IOException * @throws ServerException - * @throws ClientProtocolException */ - private String produceRootMethods() throws ClientProtocolException, ServerException, IOException { + private String produceRootMethods() throws ServerException, IOException { String rootMethods = ""; String[] exceptions = diff --git a/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/rsdl/RsdlCodegen.java b/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/rsdl/RsdlCodegen.java index 145c76e..c296bbc 100644 --- a/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/rsdl/RsdlCodegen.java +++ b/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/rsdl/RsdlCodegen.java @@ -24,7 +24,6 @@ import javax.xml.bind.JAXBException; -import org.apache.http.client.ClientProtocolException; import org.ovirt.engine.sdk.codegen.common.AbstractCodegen; import org.ovirt.engine.sdk.codegen.documentation.DocsGen; import org.ovirt.engine.sdk.codegen.holders.CollectionHolder; @@ -187,15 +186,13 @@ * @param distPath * directory to generates the code at * - * @throws ClientProtocolException * @throws ServerException * @throws IOException * @throws JAXBException */ @SuppressWarnings("unused") @Override - protected void doGenerate(String distPath) throws ClientProtocolException, - ServerException, IOException, JAXBException { + protected void doGenerate(String distPath) throws ServerException, IOException, JAXBException { String url, rel, requestBodyType, responseBodyType, parent, collectionName, actualReturnType; HttpMethod requestMethod; @@ -959,12 +956,11 @@ * * @return RSDL * - * @throws ClientProtocolException * @throws ServerException * @throws IOException * @throws JAXBException */ - private RSDL fetchRsdl() throws ClientProtocolException, ServerException, IOException, JAXBException { + private RSDL fetchRsdl() throws ServerException, IOException, JAXBException { return httpProxy.get(RSDL_URL, RSDL.class); } } diff --git a/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/xsd/XsdCodegen.java b/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/xsd/XsdCodegen.java index 5b93794..7d38603 100644 --- a/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/xsd/XsdCodegen.java +++ b/ovirt-engine-sdk-java-codegen/src/main/java/org/ovirt/engine/sdk/codegen/xsd/XsdCodegen.java @@ -28,7 +28,6 @@ import javax.xml.bind.JAXBException; -import org.apache.http.client.ClientProtocolException; import org.ovirt.engine.sdk.codegen.common.AbstractCodegen; import org.ovirt.engine.sdk.codegen.templates.CopyrightTemplate; import org.ovirt.engine.sdk.codegen.utils.FileUtils; @@ -72,14 +71,12 @@ * @param distPath * directory to generates the code at * - * @throws ClientProtocolException * @throws ServerException * @throws IOException * @throws JAXBException */ @Override - public void doGenerate(String distPath) throws ClientProtocolException, - ServerException, IOException, JAXBException { + public void doGenerate(String distPath) throws ServerException, IOException, JAXBException { String xjcOutput = null; -- To view, visit http://gerrit.ovirt.org/22893 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8f5fdbb0d82d9606763ef16786438e30ac53a8fc Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine-sdk-java Gerrit-Branch: master Gerrit-Owner: Juan Hernandez <juan.hernan...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches