简体   繁体   English

OLP Protobuf模式的命名约定

[英]Naming convention for OLP Protobuf Schemas

I'm trying to migrate some of our existing schema to OLP, using maven archetype. 我正在尝试使用maven原型将一些现有架构迁移到OLP。 Is there any naming convention to what the package name should look like? 软件包名称应该是什么样的命名约定? We are debating wether it should be "com.here.hdlm.protobuf.schema" or "com.here.schema.hdlm.protobuf". 我们正在辩论应该是“ com.here.hdlm.protobuf.schema”还是“ com.here.schema.hdlm.protobuf”。 Or maybe we should even skip protobuf from the name. 也许我们甚至应该从名称中跳过protobuf。

Thanks. 谢谢。

You should definitely use the convention of placing the project name after the reversed internet domain and company name, https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html , ie, "com.here.hdlm" 您绝对应该使用将项目名称放在反向互联网域名和公司名称之后的约定,即https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html ,即“ com.here.hdlm ”

As to whether "protobuf.schema", "schema.protobuf" or skipping protobuf, it's up to you. 至于“ protobuf.schema”,“ schema.protobuf”还是跳过protobuf,这取决于您。

As an additional reference - https://developer.here.com/olp/documentation/data-user-guide/portal/schemas-creating.html 作为其他参考-https://developer.here.com/olp/documentation/data-user-guide/portal/schemas-creating.html

HERE Artifact Service hosts only Protobuf Schemas. 这里的工件服务仅托管Protobuf模式。 I would recommend not to use words 'protobuf' and 'schema' in the name as it is implied and makes the package name longer. 我建议不要在名称中使用单词“ protobuf”和“ schema”,因为这暗示并会使软件包名称更长。

Protobuf Schema publishing documentation has a section connected to the naming: https://developer.here.com/olp/documentation/archetypes/dev_guide/topics/archetypes-best-practices.html Protobuf Schema发布文档的一部分与命名有关: https : //developer.here.com/olp/documentation/archetypes/dev_guide/topics/archetypes-best-practices.html

This is the content of the section: 这是本节的内容:

Package Naming 包命名

You are prompted to define the group ID, artifact ID, and package name for your schema at the stage of generating a schema project. 在生成模式项目的阶段,系统会提示您定义模式的组ID,工件ID和程序包名称。 If you don't specify any package name, the group ID is used instead. 如果您未指定任何软件包名称,则使用组ID。

Group ID and artifact ID are used to generate the schema's HERE Resource Name (HRN) once you upload your schema to OLP. 将架构上载到OLP后,组ID和工件ID将用于生成架构的HERE资源名称(HRN)。 For example, the HRN of the HMC Building Footprints schema is hrn:here:schema:::com.here.schema.rib:building-footprints_v2:2.13.0. 例如,“ HMC建筑足迹”架构的HRN为hrn:here:schema :::: com.here.schema.rib:building-footprints_v2:2.13.0。

The package name is used in the protobuf, Java, and Scala package names. 程序包名称用于protobuf,Java和Scala程序包名称中。

For group ID, use your company's reversed domain name, such as com.here.schema.rib. 对于组ID,请使用公司的反向域名,例如com.here.schema.rib。

For artifact ID, use a name specific to the type of schemas packaged in the project, such as building-footprints. 对于工件ID,请使用特定于项目中打包的模式类型的名称,例如建筑物占地面积。 Try to keep the artifact ID as short as possible. 尝试使工件ID尽可能短。

Also, make sure that the major version of your schema is included in the name of your package. 另外,请确保方案的主要版本包含在软件包名称中。 For example, version 2.3 should have v2 as part of its package name, such as: com.here.platform.schema.foo.v2. 例如,版本2.3应将v2作为其软件包名称的一部分,例如:com.here.platform.schema.foo.v2。 The presence of the major version in the package name is additionally verified by the Major Version in Package Validator. 软件包名称中是否存在主要版本,还可以通过软件包验证程序中的主要版本进行验证。

We recommend following Java package naming conventions. 我们建议遵循Java包命名约定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM