From 9101e28a7e87aa7e3b9352cda0141d843e4a427a Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Mon, 12 Apr 2021 12:25:07 -0400 Subject: [PATCH 1/4] no more google-http-client-protobuf --- google-http-client-assembly/pom.xml | 4 - google-http-client-protobuf/pom.xml | 87 ------------------- .../http/protobuf/ProtoHttpContent.java | 75 ---------------- .../client/http/protobuf/package-info.java | 24 ----- .../client/protobuf/ProtoObjectParser.java | 62 ------------- .../api/client/protobuf/ProtocolBuffers.java | 70 --------------- .../api/client/protobuf/package-info.java | 24 ----- .../client/protobuf/ProtocolBuffersTest.java | 45 ---------- .../src/test/proto/simple_proto.proto | 28 ------ pom.xml | 20 ----- 10 files changed, 439 deletions(-) delete mode 100644 google-http-client-protobuf/pom.xml delete mode 100644 google-http-client-protobuf/src/main/java/com/google/api/client/http/protobuf/ProtoHttpContent.java delete mode 100644 google-http-client-protobuf/src/main/java/com/google/api/client/http/protobuf/package-info.java delete mode 100644 google-http-client-protobuf/src/main/java/com/google/api/client/protobuf/ProtoObjectParser.java delete mode 100644 google-http-client-protobuf/src/main/java/com/google/api/client/protobuf/ProtocolBuffers.java delete mode 100644 google-http-client-protobuf/src/main/java/com/google/api/client/protobuf/package-info.java delete mode 100644 google-http-client-protobuf/src/test/java/com/google/api/client/protobuf/ProtocolBuffersTest.java delete mode 100644 google-http-client-protobuf/src/test/proto/simple_proto.proto diff --git a/google-http-client-assembly/pom.xml b/google-http-client-assembly/pom.xml index 389510f5f..c367b3958 100644 --- a/google-http-client-assembly/pom.xml +++ b/google-http-client-assembly/pom.xml @@ -38,10 +38,6 @@ com.google.http-client google-http-client-jackson2 - - com.google.http-client - google-http-client-protobuf - com.google.http-client google-http-client-xml diff --git a/google-http-client-protobuf/pom.xml b/google-http-client-protobuf/pom.xml deleted file mode 100644 index eda9b0f07..000000000 --- a/google-http-client-protobuf/pom.xml +++ /dev/null @@ -1,87 +0,0 @@ - - 4.0.0 - - com.google.http-client - google-http-client-parent - 1.39.1-SNAPSHOT - ../pom.xml - - google-http-client-protobuf - 1.39.1-SNAPSHOT - Protocol Buffer extensions to the Google HTTP Client Library for Java. - - - - - kr.motd.maven - os-maven-plugin - 1.6.2 - - - - - maven-javadoc-plugin - - - http://download.oracle.com/javase/7/docs/api/ - - ${project.name} ${project.version} - ${project.artifactId} ${project.version} - - - - maven-source-plugin - - - source-jar - compile - - jar - - - - - - com.google.protobuf.tools - maven-protoc-plugin - 0.4.2 - - com.google.protobuf:protoc:${project.protobuf-java.version}:exe:${os.detected.classifier} - - - - - test-compile - - - - - - maven-jar-plugin - - - - com.google.api.client.http.protobuf - - - - - - - - - com.google.http-client - google-http-client - - - junit - junit - test - - - com.google.protobuf - protobuf-java - - - diff --git a/google-http-client-protobuf/src/main/java/com/google/api/client/http/protobuf/ProtoHttpContent.java b/google-http-client-protobuf/src/main/java/com/google/api/client/http/protobuf/ProtoHttpContent.java deleted file mode 100644 index c25f2793e..000000000 --- a/google-http-client-protobuf/src/main/java/com/google/api/client/http/protobuf/ProtoHttpContent.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2011 Google Inc. - * - * 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 - * - * 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. - */ - -package com.google.api.client.http.protobuf; - -import com.google.api.client.http.AbstractHttpContent; -import com.google.api.client.http.HttpMediaType; -import com.google.api.client.protobuf.ProtocolBuffers; -import com.google.api.client.util.Beta; -import com.google.api.client.util.Preconditions; -import com.google.protobuf.MessageLite; -import java.io.IOException; -import java.io.OutputStream; - -/** - * {@link Beta}
- * Serializes of a protocol buffer message to HTTP content. - * - *

Sample usage: - * - *

- * static HttpRequest buildPostRequest(
- * HttpRequestFactory requestFactory, GenericUrl url, MessageLite message) throws IOException {
- * return requestFactory.buildPostRequest(url, new ProtoHttpContent(message));
- * }
- * 
- * - *

Implementation is not thread-safe. - * - * @since 1.5 - * @author Yaniv Inbar - */ -@Beta -public class ProtoHttpContent extends AbstractHttpContent { - - /** Message to serialize. */ - private final MessageLite message; - - /** @param message message to serialize */ - public ProtoHttpContent(MessageLite message) { - super(ProtocolBuffers.CONTENT_TYPE); - this.message = Preconditions.checkNotNull(message); - } - - @Override - public long getLength() throws IOException { - return message.getSerializedSize(); - } - - public void writeTo(OutputStream out) throws IOException { - message.writeTo(out); - out.flush(); - } - - /** Returns the message to serialize. */ - public final MessageLite getMessage() { - return message; - } - - @Override - public ProtoHttpContent setMediaType(HttpMediaType mediaType) { - return (ProtoHttpContent) super.setMediaType(mediaType); - } -} diff --git a/google-http-client-protobuf/src/main/java/com/google/api/client/http/protobuf/package-info.java b/google-http-client-protobuf/src/main/java/com/google/api/client/http/protobuf/package-info.java deleted file mode 100644 index b786dba70..000000000 --- a/google-http-client-protobuf/src/main/java/com/google/api/client/http/protobuf/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2011 Google Inc. - * - * 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 - * - * 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. - */ - -/** - * {@link com.google.api.client.util.Beta}
- * HTTP utilities for the Protocol Buffer - * format based on the pluggable HTTP library. - * - * @since 1.5 - * @author Yaniv Inbar - */ -@com.google.api.client.util.Beta -package com.google.api.client.http.protobuf; diff --git a/google-http-client-protobuf/src/main/java/com/google/api/client/protobuf/ProtoObjectParser.java b/google-http-client-protobuf/src/main/java/com/google/api/client/protobuf/ProtoObjectParser.java deleted file mode 100644 index 60ed3f46a..000000000 --- a/google-http-client-protobuf/src/main/java/com/google/api/client/protobuf/ProtoObjectParser.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2012 Google Inc. - * - * 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 - * - * 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. - */ - -package com.google.api.client.protobuf; - -import com.google.api.client.util.Beta; -import com.google.api.client.util.ObjectParser; -import com.google.protobuf.MessageLite; -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.lang.reflect.Type; -import java.nio.charset.Charset; - -/** - * {@link Beta}
- * Parses protocol buffer HTTP response content into a protocol buffer message. - * - *

Implementation is immutable and therefore thread-safe. - * - *

Data-classes are expected to extend {@link MessageLite}. - * - *

All Charset parameters are ignored for protocol buffers. - * - * @author Matthias Linder (mlinder) - * @since 1.10 - */ -@Beta -public class ProtoObjectParser implements ObjectParser { - - @SuppressWarnings("unchecked") - public T parseAndClose(InputStream in, Charset charset, Class dataClass) - throws IOException { - return (T) ProtocolBuffers.parseAndClose(in, (Class) dataClass); - } - - public Object parseAndClose(InputStream in, Charset charset, Type dataType) throws IOException { - if (dataType instanceof Class) { - return parseAndClose(in, charset, (Class) dataType); - } - throw new UnsupportedOperationException("dataType must be of Class"); - } - - public T parseAndClose(Reader reader, Class dataClass) throws IOException { - throw new UnsupportedOperationException("protocol buffers must be read from a binary stream"); - } - - public Object parseAndClose(Reader reader, Type dataType) throws IOException { - throw new UnsupportedOperationException("protocol buffers must be read from a binary stream"); - } -} diff --git a/google-http-client-protobuf/src/main/java/com/google/api/client/protobuf/ProtocolBuffers.java b/google-http-client-protobuf/src/main/java/com/google/api/client/protobuf/ProtocolBuffers.java deleted file mode 100644 index b9b383d1d..000000000 --- a/google-http-client-protobuf/src/main/java/com/google/api/client/protobuf/ProtocolBuffers.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2011 Google Inc. - * - * 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 - * - * 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. - */ - -package com.google.api.client.protobuf; - -import com.google.api.client.util.Beta; -import com.google.api.client.util.Throwables; -import com.google.protobuf.MessageLite; -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.Method; - -/** - * {@link Beta}
- * Utilities for protocol buffers. - * - *

There is no official media type for protocol buffers registered with the IANA. {@link - * #CONTENT_TYPE} and {@link #ALT_CONTENT_TYPE} are some of the more popular choices being used - * today, but other media types are also in use. - * - * @since 1.5 - * @author Yaniv Inbar - */ -@Beta -public class ProtocolBuffers { - - /** {@code "application/x-protobuf"} content type. */ - public static final String CONTENT_TYPE = "application/x-protobuf"; - - /** {@code "application/x-protobuffer"} content type. */ - public static final String ALT_CONTENT_TYPE = "application/x-protobuffer"; - - /** - * Parses protocol buffer content from an input stream (closing the input stream) into a protocol - * buffer message. - * - * @param destination message type - * @param messageClass destination message class that has a {@code parseFrom(InputStream)} public - * static method - * @return new instance of the parsed destination message class - */ - public static T parseAndClose( - InputStream inputStream, Class messageClass) throws IOException { - try { - Method newBuilder = messageClass.getDeclaredMethod("parseFrom", InputStream.class); - return messageClass.cast(newBuilder.invoke(null, inputStream)); - } catch (Exception e) { - Throwables.propagateIfPossible(e, IOException.class); - IOException io = new IOException("Error parsing message of type " + messageClass); - io.initCause(e); - throw io; - } finally { - inputStream.close(); - } - } - - private ProtocolBuffers() {} -} diff --git a/google-http-client-protobuf/src/main/java/com/google/api/client/protobuf/package-info.java b/google-http-client-protobuf/src/main/java/com/google/api/client/protobuf/package-info.java deleted file mode 100644 index c6b19b0a2..000000000 --- a/google-http-client-protobuf/src/main/java/com/google/api/client/protobuf/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2011 Google Inc. - * - * 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 - * - * 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. - */ - -/** - * {@link com.google.api.client.util.Beta}
- * Utilities for the Protocol Buffer - * format. - * - * @since 1.5 - * @author Yaniv Inbar - */ -@com.google.api.client.util.Beta -package com.google.api.client.protobuf; diff --git a/google-http-client-protobuf/src/test/java/com/google/api/client/protobuf/ProtocolBuffersTest.java b/google-http-client-protobuf/src/test/java/com/google/api/client/protobuf/ProtocolBuffersTest.java deleted file mode 100644 index 94d7d1391..000000000 --- a/google-http-client-protobuf/src/test/java/com/google/api/client/protobuf/ProtocolBuffersTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2011 Google Inc. - * - * 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 - * - * 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. - */ - -package com.google.api.client.protobuf; - -import java.io.ByteArrayInputStream; -import junit.framework.TestCase; - -/** - * Tests {@link ProtocolBuffers}. - * - * @author Yaniv Inbar - */ -public class ProtocolBuffersTest extends TestCase { - - public void testParseAndClose() throws Exception { - SimpleProto.TestMessage mockResponse = - SimpleProto.TestMessage.newBuilder() - .setStatus(SimpleProto.TestStatus.SUCCESS) - .setName("This is a test!") - .setValue(123454321) - .build(); - // Create the parser and test it with our mock response - SimpleProto.TestMessage parsedResponse = - ProtocolBuffers.parseAndClose( - new ByteArrayInputStream(mockResponse.toByteArray()), SimpleProto.TestMessage.class); - // Validate the parser properly parsed the response - // (i.e. it matches the original mock response) - assertEquals(mockResponse.getSerializedSize(), parsedResponse.getSerializedSize()); - assertEquals(mockResponse.getStatus(), parsedResponse.getStatus()); - assertEquals(mockResponse.getName(), parsedResponse.getName()); - assertEquals(mockResponse.getValue(), parsedResponse.getValue()); - } -} diff --git a/google-http-client-protobuf/src/test/proto/simple_proto.proto b/google-http-client-protobuf/src/test/proto/simple_proto.proto deleted file mode 100644 index f4fe3bbe7..000000000 --- a/google-http-client-protobuf/src/test/proto/simple_proto.proto +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2011 Google Inc. - * - * 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 - * - * 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. - */ - -syntax = "proto2"; -option optimize_for = LITE_RUNTIME; -option java_package = "com.google.api.client.protobuf"; - -message TestMessage { - required TestStatus status = 1; - required string name = 2; - required int64 value = 3; -} - -enum TestStatus { - SUCCESS = 1; - FAILURE = 2; -} \ No newline at end of file diff --git a/pom.xml b/pom.xml index f0de72e82..9239aea44 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,6 @@ google-http-client-appengine google-http-client-android google-http-client-apache-v2 - google-http-client-protobuf google-http-client-gson google-http-client-jackson2 google-http-client-xml @@ -87,10 +86,6 @@ Central Repository https://repo.maven.apache.org/maven2 - - protoc-plugin - https://dl.bintray.com/sergei-ivanov/maven/ - ../google-http-client/target/site/dependencies.html @@ -112,11 +100,6 @@ google-http-client-jackson2-dependencies.html google-http-java-client/dependencies - - ../google-http-client-protobuf/target/site/dependencies.html - google-http-client-protobuf-dependencies.html - google-http-java-client/dependencies - ../google-http-client-xml/target/site/dependencies.html google-http-client-xml-dependencies.html From f4548292e01ca2a9b8c75f38a35fe43fd02dcfd5 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Mon, 12 Apr 2021 12:59:33 -0400 Subject: [PATCH 4/4] bom --- google-http-client-bom/pom.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/google-http-client-bom/pom.xml b/google-http-client-bom/pom.xml index 5876e66dd..afce7f71b 100644 --- a/google-http-client-bom/pom.xml +++ b/google-http-client-bom/pom.xml @@ -95,11 +95,6 @@ google-http-client-jackson2 1.39.3-SNAPSHOT - - com.google.http-client - google-http-client-protobuf - 1.39.3-SNAPSHOT - com.google.http-client google-http-client-test