Visual Basic Sample Code - HCP Explorer demo

File uploaded by Bertrand Le Quellec Employee on Jan 1, 2018Last modified by Bertrand Le Quellec Employee on Jan 11, 2018
Version 4Show Document
  • View in full screen mode

HCP Explorer is just a Visual Basic sample code to illustrate how to put and get data with Hitachi Content Platform and the free edition of Microsoft Visual Studio.

Sure on Hitachi Community web site, there are other few HCP code samples (C, Python, Java, ...), but I only know Visual Studio. To quickly develop a graphical demo, I developed this code to understand the HCP RESTful API and show the easy way to integrate this Object Storage in any Windows application.

 

Take this free code as a demonstrator to address beginners. Advanced developers will use HCP Data Migrator code from Github: Hitachi.GitHub.io by Hitachi

 

How to Put and Get data?

.NET access is really simple to use with VB language. Only few calls and parameters are necessary to declare a request and apply it to send and retrieve HCP data:

  1. Make the request to an URL (Namespace + Tenant + Domain, Tenant + Domain or Domain only) :
  2. Add encrypted user and password to access to URL data or information:
  3. Send the request, wait the response and store the file result if the request is to retrieve a file:

  4. If useful, read headers of the response:

 

Main User Interface : on left, you see the windows files and folders and on right the HCP file system view + metadata of selected file

HCPexplorer_008.bmp

 

This code sample is composed from two Visual Studio projects:

  • HCPexplorer: the graphical user interface (Exe) to transfer data (file and folder) between HCP and local your Windows.
  • LibHCP: the generic library (Dll) developed to facilitate the HCP RESTful API. It's the main part of this code. Library can be used independently from any program.

 

First Launch:

From the main Window, open the "HCP settings dialog" (last right button on the main tool bar) to record the platform login and password and other access to the principal Tenant. Settings are recorded in HCPpreferences.xml file in the same directory of .exe program. The HCP settings dialog is a part of LibHCP.dll. This user interface allows to check HCP access and display various information.

 

HCPexplorer_006.bmp

 

Requirements:

Software source works with Visual Studio Community 2015 and .NET Framework v4-7-1. With Windows 7, I didn't evaluate the code with the last 2017 release, and I used VMware Workstation Player 14-1-0 to run HCP Eval-Edition 7-3-1.

 

Limits - except the bugs:

  • The software does not create Namespace and Tenant. Create one Namespace/Tenant in your HCP to use the code before.
  • To manage certificate exception, I coded a Callback function to return always True from a phantom certificate server.
  • The code does not manage Active Directory user access.
  • HCP custom metadata is not managed in this version.

Attachments

Outcomes