divijvaidya commented on code in PR #1838: URL: https://github.com/apache/tinkerpop/pull/1838#discussion_r1030495233
########## gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/util/UserAgent.java: ########## @@ -0,0 +1,55 @@ +/* + * 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. + */ +package org.apache.tinkerpop.gremlin.driver.util; + +import org.apache.tinkerpop.gremlin.util.Gremlin; +import javax.naming.NamingException; + +public class UserAgent { Review Comment: I was thinking in the following direction: 1. UserAgent.java is a model (POJO) that describes the UserAgent. It contains fields such as JavaVersion etc. along with the getter & setters. It contains methods "serializeToString" and "deserializeFromString". This model resides in a place which is common to all drivers, communication protocols and server. I would suggest placing it in https://github.com/apache/tinkerpop/tree/master/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver at same level as Host.java. This POJO/modelling for UserAgent would help us from code extensibility perspective in future if we want to add enums or constraints checks on values of user agent. 2. Both HTTP and WebSocket will create this POJO using a static method in the above file, perhaps, UserAgent#Generate() The goal of this structure is to ensure that code is extensible to HTTP in future and that individual methods could be unit tested easily. I don't have a strong opinion on this except for things such as WS_HANDSHAKE_USER_AGENT which should be made agnostic of WebSocket (the same could be used for HTTP). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
