Tuesday 21 March 2017

Exploring the SDL Mobile Devices Database

It is possible to query the SDL Mobile Devices database by using a tool such as RazorSQL.

  • Download and start RazorSQL
  • Select Connections/Connect from the main menu
  • Click the Add Connection Profile tab
  • Select HSQLDB / HyperSQL as the database type as shown below.






























  • Click Continue
  • Set a Profile Name of your choice
  • Enter value "sa" as the Login
  • Leave the Password empty
  • Click the browse button to select the Database Script File
  • Select the sdl-context-repository script file as shown below.























Your new connection profile details should now appear as follows.


































Click the Connect button to access the database. You can start querying the devices database. Below are a few examples.

Select the device names per vendor showing the default width/height information













































Select the list of OS names













































Select the list of Browser names













































Conclusion

The ability to query the devices database helps to find out which values will be set in the ADF content store. This may assist the creation of conditional logic in your implementation as well as setting up Promotions in SDL Experience Optimization (SmartTarget).

Wednesday 8 March 2017

Connecting to SDL Media Manager

The solution presented here assumes a Secure Token Service (STS) is readily available. The helper class below can be used for connecting to SDL Media Manager with a secure token.

Here is an extract from the App.config file containing the bindings and endpoint information.

Note that TENANTNAME is the name of your company used by Media Manager.

Friday 3 March 2017

Uploading images from SDL Web (Tridion) to SDL Media Manager

Consider the scenario where you need to migrate all the images from your SDL Web CMS to SDL Media Manager. For each image in SDL Web, the solution would involve:
  • Downloading the image
  • Uploading the image to SDL Media Manager
  • Creating a program and distribution in SDL Media Manager
  • Putting the distribution Live
  • Finding the "using components" in SDL Web and updating each one by replacing the relationship to the image in SDL Web with the relationship to the equivalent image in SDL Media Manager.
To complete all the steps above, you will require the following.
  • SDL Web Core Service client
  • SDL Web Stream Download client
  • SDL Media Manager client
  • ECL Service client
Here are the supporting app settings.


As shown above, the first set of properties is related to the SDL Web (Tridion) Core Service. The second set of properties is related to Media Manager, which includes the IssuerName specifying the URL to the Secure Token Service (STS). The third set of properties is required for specifying:
  • A spreadsheet mapping the SDL Web (Tridion) folder structures to the equivalent folder structures in Media Manager.
  • A directory used for storing the images downloaded from SDL Web for uploading to Media Manager.
  • The tcmid of the schema (asset type) to be migrated. In the listing above, the tcm:5-33-8 corresponds to the Image multimedia schema.
  • The name of the asset type (as defined in Media Manager) to be migrated.
  • The named of the outlet (as defined in Media Manager) to be used when creating the distributions in Media Manager.
  • The name of the tag (as defined in Media Manager) to be used when uploading and creating the assets in Media Manager.
The Media Manager Secure Token Service is essential for running the asset migration. It allows the communication to Media Manager to be established through the API. In the application settings above, the STS service is available from the http://localhost:89/IWSTrust13/ URL.

The Media Manager API does not support the creation of folders. Therefore, before migration can take place, the folder structures in SDL Web must be replicated in Media Manager to accommodate the assets. The TridionToMediaManagerFolderMappingsFile configuration property specifies a spreadsheet containing the full mappings between the existing folder structures in SDL Web and the equivalent folders created in SDL Media Manager.

Downloading assets from SDL Web (Tridion)


The code for downloading assets from SDL Web is shown below.


Uploading to SDL Media Manager


The code for uploading to SDL Media Manager is shown below. This code also creates the program, the distribution and puts the distribution live.


Updating the relationships in SDL Web (Tridion)


The download and upload steps complete the process of migrating assets from SDL Web to SDL Media Manager. However, it is also important to update the components using the migrated asset by swapping the reference for the new asset in SDL Media Manager.

This step relies on a SessionAwareEclServiceClient only available through a netTcpBinding which is not exposed. Therefore, a solution invoking this service can only run on the CME server itself.

And through the following endpoint.

You will need to copy the Tridion.ExternalContentLibrary.Service.Client.dll file from the SDL Web CME server and import into your solution in order to build the project.

The code below takes the core service and ECL clients, the migrated SDL Web multimedia component and a Dictionary object containing information gathered during the upload process. This information includes the distribution id, which is used to create or get the stub to the asset originating from Media Manager.