You can create an EAR file, and copy MobileFirst resources into that EAR to keep up to
date with the newest MobileFirst release.
About this task
The existing MobileFirst®
extension EAR is installed under the \PortalServer\theme location. You cannot
modify this location directly since any changes can be overridden by a fix pack. You must create
your own custom MobileFirst® extension
EAR and install it in \wp_profile. When you create your own EAR, start with a
copy of the existing EAR and modify it. During this process, you replace occurrences of wp
and wps
with custom
and occurrences of the current MobileFirst® version number with your MobileFirst® version number.
Procedure
- Export the worklight_extension.ear from
the WebSphere® Integrated Solutions Console.
- Click .
- Click Next until you find the worklight_extension application.
- Select worklight_extension and
click Export on the toolbar.
- Click the worklight_extension.ear link
to download and save the EAR file to your file system.
- Import the worklight_extension.ear into
Eclipse or Rational Application Developer with Java EE Developer tools
plug-in.
- Click .
- Select . Then, click Next.
- Click Browse. Find and select worklight_extension.ear you
exported to your file system.
-
Rename the EAR project from worklight_extension
to custom_mobilefirst_extension and then click
Next twice.
-
In the Project Name field, change the name from
wp.theme.worklight.ext to
custom.theme.mobilefirst.ext and then click
Finish.
- Customize the ear in Eclipse or Rational Application Developer
for the new version of MobileFirst®.
-
In the custom_mobilefirst_extension EAR project, delete the
EarContent\META-INF\ibmconfig folder and its
contents.
-
Right-click on the custom_mobilefirst_extension EAR project and select
Properties. Select Deployment
Assembly.
-
Select the wp.theme.worklight.ext.war Deploy
Path and rename it to
custom.theme.mobilefirst.ext.war.
- Click Apply and OK.
-
In the custom_mobilefirst_extension EAR project, delete the
EarContent\wp.theme.worklight.ext.war
file.
-
In the
custom_mobilefirst_extension
EAR
project, modify the EarContent\META-INF\application.xml
file. Change the display-name from MobileFirst®
Extension to Custom Mobilefirst Extension.
-
Change the module ID from wp.theme.worklight.ext
to custom.theme.mobilefirst.ext.
-
Change the
web-uri
from
wp.theme.worklight.ext.war to
custom.theme.mobilefirst.ext.war.
-
Change the
context-root
from
/wps/worklightExt to
/custom/mobilefirstExt.
-
In the custom.theme.mobilefirst.ext war project, modify
the WebContent\WEB-INF\web.xml file.
-
Change the web-app ID from wp_theme_worklight_ext_webapp_1 to
custom_theme_mobilefirst_ext_webapp_1.
-
Change the display-name from
Worklight_Extensions
to Custom MobileFirst
Extensions.
-
In the custom.theme.mobilefirst.ext war project, in
WebContent, create your new version folder and its contents. First, examine the
existing version folder and its contents because that shows the folder structure
that you create.
-
Right-click on WebContent and select .
-
Enter the MobileFirst® version number that you are working with as the
folder name.
For example, use
vyour_new_mobilefirst_version,
where your_new_mobilefirst_version is your current
version number.
-
Right-click on the folder you created and create child folders that are
called android and
ios.
-
Locate
the
Android-specific folders in your MobileFirst® project. In previous versions, they were in
\YourMFProject\apps\YourApp\android\native\assets\www\default\js
and
\YourMFProject\apps\YourApp\android\native\assets\www\default\worklight
folders in your Eclipse MobileFirst® project. Copy and paste them into the
vyour_new_mobilefirst_version\android
folder.
-
Locate
the
iOS specific folders in your MobileFirst® project. In previous versions, they were in
\YourMFProject\apps\YourApp\iphone\native\assets\www\default\js
and
\YourMFProject\apps\YourApp\iphone\native\assets\www\default\worklight
folders in your Eclipse MobileFirst® project. Copy and paste them into the
vyour_new_mobilefirst_version\ios
folder.
-
Locate the Windows Phone specific folders in your Worklight project. In
previous versions, they were in
\YourMFProject\apps\YourApp\windowsphone8\native\assets\www\default\js
and
\YourMFProject\apps\YourApp\windowsphone8\native\assets\www\default\worklight
folders in your Eclipse MobileFirst® project. Copy and paste them into the
vyour_new_mobilefirst_version\winphone
folder.
-
Locate the init.js file in
WebContent\vpreviousversion\android\js
folder and copy it to the
WebContent\vnew_version\android\js
folder.
-
Locate the init.js file in
WebContent\vpreviousversion\ios\js
folder and copy it to the
WebContent\vnew_version\ios\js
folder.
-
Locate the init.js file in
WebContent\vpreviousversion\winphone\js
folder and copy it to the
WebContent\vnew_version\winphone\js
folder.
-
Locate the
mobilefirstprevious_version.json
file in the current version folder, where
previous_version is the current MobileFirst® version number. Copy it and paste it in your new
version folder. Rename the file
mobilefirstnew_version.json,
where new_version is your new MobileFirst® version number.
-
Edit the newly copied file, find, and replace all occurrences of the
current MobileFirst® version number with your MobileFirst® version number and save the file.
This file defines the version-independent meta modules that
prereq
the version-dependent modules that are
defined in the plugin.xml file in the next
step.
- Determine whether overrides for Cordova and MobileFirst® APIs
are required.
HCL Portal defines
overrides for Cordova and MobileFirst® APIs
to improve performance and integrate with HCL Portal.
-
To prevent an error when MobileFirst® resources load, the
WL.Utils.loadWLClientMessages
and
WL.Utils.setLocalization
functions are overridden. If these are
still needed, locate and copy the portal directory from each of the Android and iOS directories in
WebContent\vprevious_version\ and copy them to their
respective directories in WebContent\vnew_version\. Verify
that the content of these functions accurately reflects the content from your new version of MobileFirst®.
-
If the Cordova APIs did not change, either copy the changes in the
WebContent\vpreviousversion\android\worklight\cordova.js
file and
WebContent\vpreviousversion\ios\worklight\cordova.js
to the new version of the MobileFirst® folder. This method reduces the number of requests to
HCL Portal. Or, Leave the
Cordova API, and add a
<script>
element to all the pages that require MobileFirst® resources. The <script>
element must reference the
cordova.js file directory.
To improve performance for MobileFirst® applications in HCL Portal, two Cordova APIs were
changed. Originally, the Cordova APIs attempt to load all of the Cordova
plug-ins individually by dynamically determining their location.
However, it is not possible with HCL Portal resource aggregation.
The injectScript
and findCordovaPath
functions are rewritten to
use the ibmCfg.portalConfig.worklightResourcesPath[version_number]
JavaScript variable to determine the location of the Cordova resources.
This value of this variable comes from the Resource Environment Provider
property that you create in a following step. The version_number
used in the variable must be updated to
reflect the new version number, which is reflected in the following
changes to the resource environment provider property.
-
Copy the changes that are in
WebContent\vprevious_version\android\worklight\cordova.js
and
WebContent\vprevious_version\ios\worklight\cordova.js
and copy them into the new version of MobileFirst® that you are upgrading to. This offers a performance
improvement, because it reduces the number of requests that are made to
the HCL Portal server for the MobileFirst® resources.
-
Leave the Cordova API as it is and add a
<script>
element to
all pages that require MobileFirst®
resources. The <script>
element must reference the
cordova.js file directly.
-
In the custom.theme.mobilefirst.ext war project, edit the
WebContent\WEB-INF\plugin.xml file.
-
Change the plug-in ID from wp.theme.worklight.ext
to custom.theme.mobilefirst.ext.
-
Change the plug-in name from MobileFirst® plug-ins to Custom MobileFirst
plugins.
-
Change the plug-in provider-name from IBM to your company's name.
-
Find and replace all occurrences of the current MobileFirst® version number with your MobileFirst® version number. Find and replace version numbers in
both the formats 000 and 0.0.0.
These changes must correspond with the changes made previously to
mobilefirstprevious_version.json.
This plugin.xml file defines the version-dependent
modules that are prereqed
by the
version-independent meta modules that are defined in
mobilefirstprevious_version.json
in the previous step.
-
Locate the
mf_android_new_version and
mf_ios_new_version
modules, where new_version is the new MobileFirst® version number, and verify all of their
subcontributions. Review the resources for the new version of MobileFirst®, and if there are any differences, modify the
subcontributions so that each resource file has a subcontribution.
In these modules, each resource is explicitly listed when debug mode
is enabled. When it is not enabled, HCL Portal provides a single
JavaScript layer for the MobileFirst® resources. Create a similar layer for the resources
of the new version of MobileFirst®. This layer must be defined as a subcontribution
here. If you choose not to create a JavaScript layer for the MobileFirst® resources, add and verify that required resources are
listed as subcontributions.
-
Locate the
mf_plugins_android_new_version
and mf_plugins_ios_new_version
modules, where new_version is the new MobileFirst® version number, and verify all of their
subcontributions. Review the resources for the new version of MobileFirst®, and if there are any differences, modify the
subcontributions so that each resource file has a subcontribution.
In these modules, each resource is explicitly listed when debug mode
is enabled. When it is not enabled, HCL Portal provides a single
JavaScript layer for the MobileFirst® resources. Create a similar layer for the resources
of the new version of MobileFirst®. This layer must be defined as a subcontribution
here. If you choose not to create a JavaScript layer for the MobileFirst® resources, add and verify that required resources are
listed as subcontributions.
-
In the
custom.theme.mobilefirst.ext
war
project, delete the
WebContent\previous_version
folder, where previous_version is the current MobileFirst® version number, and all of its contents.
-
Export your customized ear as
custom_mobilefirst_extension.ear from Eclipse or
Rational Application Developer.
-
Right-click custom_mobilefirst_extension ear
project and select file.
-
Click Browse and choose a destination folder and
name of custom_mobilefirst_extension.ear.
-
Click Finish to save the EAR file to your file
system.
-
Add a
resources.mobilefirst.extensions.new_version
resource environment provider property in the WebSphere® Integrated Solutions Console.
-
Click .
-
Click Next until you find the WP
ConfigService resource environment provider and then
select it.
-
Click the Custom properties link.
-
Click New from the toolbar.
-
Enter
resources.mobilefirst.extensions.new_version
for the name, where new_version is replaced by your
new MobileFirst® version number.
-
Enter
/custom/mobilefirstExt/new_version
for the value where new_version is replaced by your
new MobileFirst® version number.
-
Enter the path to the MobileFirst® vnew_version_number extensions for
the description where new_version_number is replaced
by your new MobileFirst® version number in the v0.0.0
format.
-
Click OK.
-
Click Save to save directly to the master
configuration.
-
Deploy the custom_mobilefirst_extension.ear in the WebSphere® Integrated Solutions Console.
-
Click .
-
Click Install in the toolbar.
-
Click Browse in the local file system, find, and
select your custom_mobilefirst_extension.ear file
and click Next.
-
Take the defaults and click Next.
-
Take the defaults and click Next.
-
Verify that the Directory to install application
field is blank so that it installs to the default location. Delete
anything in the field if it is not.
-
Take the defaults and click Next.
-
Click Finish.
-
When the EAR is done installing without error, click
Save to save to the master
configuration.
-
Find and check your new Custom MobileFirst Extension enterprise
application and click Start from the toolbar.
Your EAR is now installed at
\wp_profile\installedApps\cell\Custom
Mobilefirst Extension.ear.
- Modify your theme contributions to load your new version
of the MobileFirst® extensions.
You continue to use the same
meta module names in your theme profiles, such as wp_worklight_android
and wp_worklight_ios. You must change the JSON file in the theme contributions
folder to change which version-specific modules the meta modules load.
- Use WebDAV to connect to fs-type1:themes\yourtheme\contributions.
-
Delete the
mobilefirstprevious_version.json
file, where previous_version is the previous MobileFirst® version number.
If you back up the file, move it to a different location. Do not
rename the file .jsonbak, for example, because
every file in the contributions folder is loaded by the system. You must
remove the file completely.
-
Copy your
mobilefirstnew_version.json
file into the contributions folder. The file can be copied from
\wp_profile\installedApps\cell\Custom
Mobilefirst
Extension.ear\custom.theme.mobilefirst.ext.war\vnew_version\mobilefirstnew_version.json,
where new_version is replaced by your MobileFirst® version number.
If you must revert to the previous version of MobileFirst®, you can get the
mobilefirstprevious_version.json
file back from
\PortalServer\theme\wp.theme.worklight.ext\installedApps\wp.theme.worklight.ext.ear\wp.theme.worklight.ext.war\vprevious_version\mobilefirstprevious_version.json,
where previous_version is the original MobileFirst® version number.
- Restart the HCL Portal server.
Results
The MobileFirst® meta modules,
such as wp_worklight_ext
, now load and use the resources for your
new version of MobileFirst®.