迁移现有适配器以在 MobileFirst Server V8.0.0 下工作

improve this page | report issue


概述

从 MobileFirst Server V8.0 开始,适配器是 Maven 项目。 了解如何升级在 MobileFirst Server 的较早版本下开发的适配器。

本页面描述了迁移适配器(开发为与 MobileFirst Server V6.2 或更高版本一起使用)以与 MobileFirst Server V8.0一起使用所需采取的步骤。
首先请了解 V8.0 中不推荐使用的功能以及 API 元素和服务器端 API 更改中描述的适配器 API 更改。

在 MobileFirst Server V8.0 下按原样使用较旧的适配器

除非符合以下任何条件,否则现有适配器可按原样部署在 MobileFirst Server V8.0 下:

适配器类型 条件
Java 使用 PushAPI 或 SecurityAPI 接口
JavaScript
  • 使用 IBM Worklight V6.2 或更低版本构建。
  • 使用不是 HTTP 或 SQL 的连接类型。
  • 包含 securityTest 定制过程
  • 包含使用用户身份来连接到后端的过程
  • 使用以下任何 API:
    • WL.Device.*
    • WL.Geo.\*
    • WL.Server.readSingleJMSMessage
    • WL.Server.readAllJMSMessages
    • WL.Server.writeJMSMessage
    • WL.Server.requestReplyJMSMessage
    • WL.Server.getActiveUser
    • WL.Server.setActiveUser
    • WL.Server.getCurrentUserIdentity
    • WL.Server.getCurrentDeviceIdentity
    • WL.Server.createEventSource
    • WL.Server.createDefaultNotification
    • WL.Server.getUserNotificationSubscription
    • WL.Server.notifyAllDevices
    • WL.Server.notifyDeviceToken
    • WL.Server.notifyDeviceSubscription
    • WL.Server.sendMessage
    • WL.Server.createEventHandler
    • WL.Server.setEventHandlers
    • WL.Server.setApplicationContext
    • WL.Server.fetchNWBusinessObject
    • WL.Server.createNWBusinessObject
    • WL.Server.deleteNWBusinessObject
    • WL.Server.updateNWBusinessObject
    • WL.Server.getBeaconsAndTriggers
    • WL.Server.signSoapMessage
    • WL.Server.createSQLStatement

针对 MobileFirst Server V8.0 将 Java 适配器迁移到 Maven 项目

  1. 创建 archetype 为 adapter-maven-archetype-java 的 Maven 适配器项目。 在设置参数 artifactId 时,请使用适配器名称;对于参数 package,请使用与现有 Java 适配器中的包相同的包。 有关更多信息,请参阅创建 Java 适配器
  2. 覆盖在步骤 1 中创建的新适配器项目的 src/main/adapter-resources 文件夹中的适配器描述符文件 (adapter.xml)。有关描述符的更多详细信息,请参阅 Java 适配器描述符文件
  3. 从新适配器项目的 src/main/java 文件夹中除去所有文件。 然后,复制旧 Java 适配器项目的 src/ 文件夹下的所有 Java 文件,并保持相同的文件夹结构。 将所有非 Java 文件从旧适配器的 src 文件夹复制到新适配器的 src/main/resources 文件夹。 缺省情况下,src/main/resources 不存在,因此如果适配器包含非 Java 文件,请创建此目录。 有关 Java 适配器 API 中的更改,请参阅 V8.0 中的服务器端 API 更改

    下图说明了 V7.1 之前适配器的结构以及 Maven 适配器(从 V8.0 开始)的结构:

     ├── adapters
     │   └── RSSAdapter
     │       ├── RSSAdapter.xml
     │       ├── lib
     │       └── src
     │           └── com
     │               └── sample
     │                   ├── RSSAdapterApplication.java
     │                   └── RSSAdapterResource.java
    

    Java 适配器的新结构:

     ├── pom.xml
     ├── src
     │   └── main
     │       ├── adapter-resources
     │       │   └── adapter.xml
     │       └── java
     │           └── com
     │               └── sample
     │                   ├── RSSAdapterApplication.java
     │                   └── RSSAdapterResource.java
    
  4. 使用以下任一方法,添加 Maven 存储库中未包含的任何 JAR 文件:

针对 MobileFirst Server V8.0 将 JavaScript 适配器迁移到 Maven 项目

  1. 创建 archetype 为 adapter-maven-archetype-http 或 adapter-maven-archetype-sql 的 Maven 适配器项目。 在设置参数 artifactId 时,使用适配器名称。 有关更多信息,请参阅创建 JavaScript 适配器
  2. 覆盖在步骤 1 中创建的新适配器项目的 src/main/adapter-resources 文件夹中的适配器描述符文件 (adapter.xml)。有关描述符的详细信息,请参阅 JavaScript 适配器描述符文件
  3. 覆盖新适配器项目的 src/main/adapter-resources/js 文件夹中的 JavaScript 文件。
Inclusive terminology note: The Mobile First Platform team is making changes to support the IBM® initiative to replace racially biased and other discriminatory language in our code and content with more inclusive language. While IBM values the use of inclusive language, terms that are outside of IBM's direct influence are sometimes required for the sake of maintaining user understanding. As other industry leaders join IBM in embracing the use of inclusive language, IBM will continue to update the documentation to reflect those changes.
Last modified on June 01, 2020