Cloud Service 配置 cloud-service-configurations

配置旨在提供存储服务配置的逻辑和结构。

您可以扩展现有实例以创建自己的配置。

概念 concepts

开发配置时采用的原则基于以下概念:

  • 服务/适配器用于检索配置。
  • 配置(例如,属性/段落)继承自父项。
  • 按路径从Analytics节点引用。
  • 易于扩展。
  • 能够灵活地满足更复杂的配置需求,例如 Adobe Analytics.
  • 支持依赖项(例如, Adobe Analytics 插件需要 Adobe Analytics 配置)。

结构 structure

配置的基本路径为:

/etc/cloudservices

对于每种类型的配置,都会提供模板和组件。 这使得在自定义后能够满足大多数需求的配置模板成为可能。

要为新服务提供配置,请执行以下操作:

  • 在中创建服务区

    /etc/cloudservices

  • 在此下:

    • 配置模板
    • 配置组件

模板和组件必须继承 sling:resourceSuperType 从基本模板中:

cq/cloudserviceconfigs/templates/configpage

或基本组件分别

cq/cloudserviceconfigs/components/configpage

服务提供商还应提供以下服务页:

/etc/cloudservices/<service-name>

模板 template

您的模板扩展了基本模板:

cq/cloudserviceconfigs/templates/configpage

并定义 resourceType 指向自定义组件。

/libs/cq/analytics/templates/sitecatalyst
sling:resourceSuperType = cq/cloudserviceconfigs/templates/configpage
allowedChildren = /libs/cq/analytics/templates/sitecatalyst
allowedPaths = /etc/cloudservices/analytics/*, /etc/cloudservices/analytics/.*
componentReference = cq/analytics/components/sitecatalyst
jcr:content/
cq:designPath = /etc/designs/cloudservices
sling:resourceType = cq/analytics/components/sitecatalystpage

/libs/cq/analytics/templates/generictracker
sling:resourceSuperType = cq/cloudservices/templates/configpage
allowedChildren = /libs/cq/analytics/templates/generictracker
allowedPaths = /etc/cloudservices/analytics/*, /etc/cloudservices/analytics/.*
jcr:content/
cq:designPath = /etc/designs/cloudservices
sling:resourceType = cq/analytics/components/generictrackerpage

组件 components

您的组件应扩展基本组件:

cq/cloudserviceconfigs/templates/configpage

/libs/cq/analytics/components/sitecatalystpage

/libs/cq/analytics/components/generictrackerpage

设置模板和组件后,您可以通过在下添加子页面来添加配置:

/etc/cloudservices/<service-name>

内容模型 content-model

内容模型存储为 cq:Page 在:

/etc/cloudservices/<service-name>(/*)

/etc/cloudservices
/etc/cloudservices/service-name
/etc/cloudservices/service-name/config
/etc/cloudservices/service-name/config/inherited-config

配置存储在子节点下 jcr:content.

  • 在对话框中定义的固定属性应存储在 jcr:node 直接。
  • 动态元素(使用 parsysiparsys)使用子节点存储组件数据。
/etc/cloudservices/service/config/jcr:content as nt:unstructured
propertyname
*
par/component/ as cq:Component
propertyname
*

API api

有关API的参考文档,请参阅 com.day.cq.wcm.webservicesupport.

AEM集成 aem-integration

可用的服务列在 Cloud Services 的选项卡 页面属性 对话框(继承自的任何页面的) foundation/components/pagewcm/mobile/components/page)。

该选项卡还提供:

  • 可启用服务的位置的链接
  • 从路径字段中选择配置(服务的子节点)

密码加密 password-encryption

存储服务的用户凭据时,所有密码都应加密。

您可以通过添加隐藏表单字段来实现此目的。 此字段应具有注释 @Encrypted 在属性名称中;即 password 字段名称将写成:

password@Encrypted

然后,将自动对属性进行加密(使用 CryptoSupport service),由 EncryptionPostProcessor.

NOTE
这类似于标准 [SlingPostServlet](https://sling.apache.org/site/manipulating-content-the-slingpostservlet-servletspost.html) 注释。
NOTE
默认情况下, EcryptionPostProcessor 仅加密 POST 向发出的请求 /etc/cloudservices.

“服务”页jcr:content节点的其他属性 additional-properties-for-service-page-jcr-content-nodes

属性
描述
componentreference
自动包含在页面中的组件的引用路径。
这用于其他功能和JS包含。
这包括页面上的组件,其中
cq/cloudserviceconfigs/components/servicecomponents
包含(通常早于 body 标记)。
对于Adobe Analytics和Adobe Target,我们使用它来包含其他功能,例如用于跟踪访客行为的JavaScript调用。
说明
服务的简短描述。
descriptionExtended
服务的扩展描述。
排名
在列表中使用的服务排名。
selectableChildren
用于在页面属性对话框中显示配置的筛选器。
serviceUrl
服务网站的URL。
serviceUrlLabel
服务URL标签。
thumbnailPath
服务的缩略图路径。
可见
在页面属性对话框中可见;默认情况下可见(可选)

用例 use-cases

默认提供以下服务:

NOTE
另请参阅 创建自定义Cloud Service.
recommendation-more-help
19ffd973-7af2-44d0-84b5-d547b0dffee2