Teneo Developers

File Resources

Introduction

The File manager allows to add files to the solution, these files can be programmatically accessed and used by the solution.

It is possible to upload a variety of file formats; only files added to /script_lib can be programmatically accessed by the solution while files stored in the root path / are accessible publicly for anyone who knows the engine URL, so be careful when placing files here, especially if they contain sensitive data! Learn more about the file types and publish locations further below.

Files in a solution are not shared by other solutions; they only exist in the solution they were added to. When the solution is published, the published solution includes all the uploaded files.

View of File Resources

The File Resource manager is available in the backstage of Teneo Studio: Solution tab > Resources > File

View of File Resources

In this view the user will find:

  • Left side:

    • Text filter and Add button
    • List of existing File Resources
  • Right side:

    • Ribbon options allowing to Edit, Delete, view History, set/unset Stable version
    • Details of the selected File Resource providing a read-only summary

Basics

Open - view or download

To either view or download an already existing file resource, first:

  • Select the file in the list
  • In the right-side panel, click View or Download
    • View allows to open the file in an editor associated with the file's extension
    • Download allows to browse to a wanted folder and download the file to it.

Create

In the backstage of Teneo Studio (Solution tab > Resources > File) follow the below steps to add a resource file:

  • Click Add to browse to the file
  • Select the file and click Open
  • In the right-side panel, optionally write a description of the file
  • Under Publish Location write the folder location; see File type and Publish locations for details
  • When done, click Save in the top of the panel to upload the file to the solution.

Edit properties

To edit the properties of an existing resource file, follow the below steps:

  • Select the file resource in the list
  • Click Edit in the right-side panel
  • Now, edit the wanted property: Name, Description or Publish Location
  • Lastly, remember to click Save to preserve the changes.

The below table provide an overview of further options available in the ribbon when working with file resources, also refer to the below section for details on how to edit a file resource.

ButtonCommentMore information
EditAllows to open the file in edit modeEdit file resource
DeleteProvides the option to delete a file
HistoryOpens the History of the selected file; previous versions and revisions of the file are listed, comments added at save are also displayed here. Select any of the revisions to view its content. Set a previous version as stable by selecting it in the list and clicking Set Stable, restore a previous version by selecting it and clicking Restore.Version History
Set/Unset StableSet the current version of the selected file as stable or unset itVersion Flag

Edit file resource

To edit the content of a file resource, follow the below steps:

  • In the backstage of Teneo Studio (Solution tab > Resources > File), select the file resource in the list
  • Click Edit in the right-side panel
  • Below the property fields of the resource, the File area displays the following options:
    • Edit
      • Opens the editor associated with the file's extension
      • Perform the wanted modifications, save the changes and close the editor
      • Back in Teneo Studio, click Save to apply the modification to Teneo.
    • Upload
      • Opens the file explorer
      • Browse to the new version of the file to upload it
      • Back in Teneo Studio, remember to click Save to upload the new version of the file to Teneo.
    • Download
      • Opens the file explorer
      • Select the folder where to download the file resource locally and click Save.

Save

To save a Resource File in edit mode with a comment, follow the below steps:

  • Click Save in the top ribbon
  • In the dialogue box (optionally) write a comment
  • Click Continue

To save directly and bypass the comment, press the Alt key while clicking the Save button.

Close

To close a Resource File in edit mode, the user needs to either click Cancel and discard any possible changes or click Save to preserve any performed changes.

Delete

To delete a file resource from the solution, follow the below steps:

  • Select the file in the list in the backstage of Teneo Studio (Solution tab > Resources > File)
  • Click Delete in the right-side ribbon
  • The Apply button becomes available, click it to perform the actual deletion; alternatively click Cancel to abort the deletion.

If a file is deleted by mistake, it can be restored from the Recycle Bin.

Filter

A text filter is available at the top of the list of Files; to filter on the available file resources, simply write the wanted letter combination to start filtering on the list.

Details

File types and publish locations

Teneo Studio allows to upload a variety of different file formats, such as Groovy scripts, compiled .jar files, as well as text-based formats such as .txt or .csv, .html, and even images files. Below please find a few examples of file types which can be added as a Resource File.

  • .jar files: .jar files can contain classes available through scripts in a solution, .jar files' Published Location should be set to /script_lib.
  • .groovy files: Groovy classes can be added by storing the class as a .groovy file with the name of the class; the file's Published Location must be /script_lib. When added and saved, the class can be called from anywhere in the solution. It is not needed to compile the class as it compiles when the solution is loaded in memory.
  • .jsp files: Java Server Pages can be used to format the Teneo Engine response and can be used by using the URL parameter viewtype with the name of the JSP without the extension in request to Engine; the JSP can make use of the Teneo Engine scripting API and the Published Location of a JSP is by defaults the /views folder.
  • Images: images files, such as .jpg, .png or .gif are stored in the Published Location /images by default; once the solution is published, the images can be retrieved by appending /images/[image_name].[extension] to the Engine URL.
  • Other file types, such as .csv, .txt, .xls, .zip, .json, .prop, etc., can also be added to a solution and for the mentioned file extensions all share the Published Location /script_lib.