Home | Firestreamer | Downloads | Support | About Us My Account | Site Map | Search | Cristalink RSS Feed  
Firestreamer Getting Started Guide Firestreamer Home

Automation

On This Page

Overview

Firestreamer allows you to automate most of the operations that you can do in the Firestreamer Snap-in. For example, you may want to write a custom script to automatically create and load file media before a backup task begins. You can write such a script in any programming language that supports .NET or COM.

.NET Interface

The .NET interface is used by the Firestreamer Snap-in internally, and it supports most of the operations that you can perform in the snap-in. To use the interface, you need to reference the C:\Program Files\Cristalink\FsChanger\FirestreamerInterface.dll assembly in your .NET application. The main .NET class of the interface is Firestreamer.Driver.Controller. For more information, refer to the sample VB Script code below.

COM Interface

The Firestreamer COM interface is exposed through the standard .NET interoperability mechanism. Because of COM limitations, the COM interface is less powerful than the .NET one, however, it is able to perform basic Firestreamer operations. For more information, refer to the VB Script example below.

'-------------------------------------------
'
' com.vbs
'
' Before using the Firestreamer COM interface, you need to register it first with the following command line:
'
'  For a 32-bit operating system:
'     C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe /codebase "C:\Program Files\Cristalink\FsChanger\FirestreamerInterface.dll"
'
'  For a 64-bit operating system:
'     C:\Windows\Microsoft.NET\Framework64\v2.0.50727\RegAsm.exe /codebase "C:\Program Files\Cristalink\FsChanger\FirestreamerInterface.dll"
'
'-------------------------------------------

' Create the controller object.
set ctl = CreateObject( "Firestreamer.Controller" )

' Display the version of FirestreamerInterface.dll.
msgbox "Interface version: " & ctl.InterfaceVersion & _
  
" (" & ctl.InterfaceVersion.VersionMajor & "." & _
   ctl.InterfaceVersion.VersionMinorHigh &
"." _
   & ctl.InterfaceVersion.VersionMinorLow &
")", _
   0,
"InterfaceVersion"

' You have to connect to the Firestreamer Storage Controller driver before sending any commands.
ctl.Connect

' Display the version of the Firestreamer Storage Controller driver.
msgbox "Driver version: " & ctl.GetDriverVersion, 0, "GetDriverVersion"

' Display the changer configuration.
set cfg = ctl.ChangerConfiguration

text =
"Number of tape libraries: " & cfg.LibraryCount & chr(13) & chr(10)

for i = 1 to cfg.LibraryCount
   tapeDriveCnt = cfg.GetTapeDriveCount( i )
   text = text &
"  Library #" & i & " has " & tapeDriveCnt & " tape drives and " & _
      cfg.GetStorageSlotCount( i ) &
" storage slots." & chr(13) & chr(10)
   text = text &
"     Library serial number: " & ctl.GetLibrarySerialNumber( i ) & chr(13) & chr(10)
  
for j = 1 to tapeDriveCnt
      text = text &
"     Tape drive #" & j & " serial number: " & _
         ctl.GetTapeDriveSerialNumber( i, j ) & chr(13) & chr(10)
  
next
next

text = text & "Bar code counter length: " & cfg.BarcodeCounterLength & chr(13) & chr(10)
text = text &
"Base serial number: " & cfg.BaseSerialNumber & chr(13) & chr(10)
msgbox text, 0,
"ChangerConfiguration"

' The following commands will use Library #1.
libraryNumber = 1

' Load media from a media map file.
file = "c:\test\MyMediaMap.fsmap"
ctl.ChangerLoadMediaFromFile libraryNumber, file
msgbox
"Loaded media from file " & file, 0, "ChangerLoadMediaFromFile"

' Save the initial media layout to a file. The destination file must have a zero length.
set fso = CreateObject("Scripting.FileSystemObject")
file =
"c:\test\InitialMediaLayout1.fsmap"
fso.CreateTextFile( file, true ).close
ctl.ChangerGetInitialMediaMapToFile libraryNumber, file

' Save the current media layout to a file. The destination file must have a zero length.
file = "c:\test\CurrentMediaLayout1.fsmap"
fso.CreateTextFile( file, true ).close
ctl.ChangerGetCurrentMediaMapToFile libraryNumber, file

' Load media from a string.
text = "S*||file://c:\test\mytape1.fsrm" & chr(13) & chr(10)
text = text &
"S*||file://c:\test\mytape2.fsrm" & chr(13) & chr(10)
ctl.ChangerLoadMediaFromString libraryNumber, text
msgbox
"Loaded media from string " & chr(13) & chr(10) & text, 0, "ChangerLoadMediaFromString"

' Get the current and initial media layouts as strings.
text = ctl.ChangerGetInitialMediaMapAsString( libraryNumber )
msgbox
"Initial media layout:" & chr(13) & chr(10) & text, 0, "ChangerGetInitialMediaMapAsString"
text = ctl.ChangerGetCurrentMediaMapAsString( libraryNumber )
msgbox
"Current media layout:" & chr(13) & chr(10) & text, 0, "ChangerGetCurrentMediaMapAsString"

' Unload all media.
ctl.ChangerLoadMediaFromFile libraryNumber, ""
msgbox "Unloaded all media from Library #" & libraryNumber, 0, "ChangerLoadMediaFromFile"

' Get the bar code prefix information.
set bp = ctl.BarcodePrefix
msgbox
"Bar code prefix: " & bp.Text & ", maximum length: " & bp.MaximumLength, 0, "BarcodePrefix"

' Create a file medium.
file = ctl.CreateFileMedium( libraryNumber, "c:\test", ctl.BarcodePrefix.Text )
msgbox
"Created file medium " & file, 0, "CreateFileMedium"

' Display the current data compression setting (off=0, on=1, auto=2).
msgbox "Data compression: " & ctl.DataCompression, 0, "DataCompression"

' Disable data compression.
ctl.DataCompression = 0
msgbox
"Data compression disabled, current value: " & ctl.DataCompression, 0, "DataCompression"

' Enable data compression.
ctl.DataCompression = 1
msgbox
"Data compression enabled, current value: " & ctl.DataCompression, 0, "DataCompression"

' Set data compression to "controlled by backup software".
ctl.DataCompression = 2
msgbox
"Data compression is set to Auto, current value: " & ctl.DataCompression, 0, "DataCompression"

' Disconnect and clean up.
ctl.Dispose

 

Terms of Use | Privacy Policy This page is protected by Secure Sockets Layer (SSL) © Cristalink Pty Ltd, 2023. ABN 97615040027