Class FSHelperLibrary

java.lang.Object
com.seclore.fs.helper.library.FSHelperLibrary

public class FSHelperLibrary extends Object
  • Constructor Details

    • FSHelperLibrary

      public FSHelperLibrary()
  • Method Details

    • initialize

      public static void initialize(String pConfigXML) throws FSHelperException
      This method initializes the library. It has to be called before using any other method of the library.

      Code Usage:

       
       import com.seclore.fs.helper.library.FSHelperLibrary;
       import com.seclore.fs.helper.exception.FSHelperException;
       
       public class Example {
       
       	public static void main(String[] args) 
       	{		
       		try
       		{
       			// FSHelper Logger Config XML. Please refer FSHelper Logger Configuration XML provided in the package for more info.
       			String xmlLoggerConfigString = "<..>";
       			FSHelperLibrary.initialize( xmlLoggerConfigString );        
       		}
       		catch(FSHelperException exception)
       		{
       			Log("Message : " + exception.getMessage());
       			Log("Error Code : " + exception.getErrorCode());
       		}
       	}
       }
       
       
      Parameters:
      pConfigXML - Information required to initialize the library in the form of XML string. Please refer config.xml for detail explanation.
      Throws:
      FSHelperException
    • initialize

      public static void initialize(ISecloreSDKLogger pLogger, String pConfigXML) throws FSHelperException
      This method initializes the library. It has to be called before using any other method of the library.

      Code Usage:

       
       import com.seclore.fs.helper.library.FSHelperLibrary;
       import com.seclore.fs.helper.exception.FSHelperException;
       import com.seclore.fs.ws.client.logger.interfaces.ISecloreSDKLogger;
       
       public class Example {
       
       	public static void main(String[] args) 
       	{		
       		try
       		{
       			// FSHelper Logger Config XML. Please refer FSHelper Logger Configuration XML provided in the package for more info.
       			String xmlLoggerConfigString = "<..>";
       			ISecoreSDKLogger lLogger = new CustomLogger();
       			FSHelperLibrary.initialize(lLogger, xmlLoggerConfigString );        
       		}
       		catch(FSHelperException exception)
       		{
       			Log("Message : " + exception.getMessage());
       			Log("Error Code : " + exception.getErrorCode());
       		}
       	}
       }
       
       
      Parameters:
      pLogger - External logger to be used by SDK for logging. This logger should be implementation of ISecloreSDKLogger. If the parameter passed as null, SDK will initialize its own logger with Log4j2 implementation.
      pConfigXML - Information required to initialize the library in the form of XML string. Please refer config.xml for detail explanation.
      Throws:
      FSHelperException
    • terminate

      public static void terminate() throws FSHelperException
      This method should be called as part of the termination process of the calling application. This method should be called when the application no longer wants to use the library. Please note that the library methods can not be used once terminate() is called unless initialize() is called again.
      Throws:
      FSHelperException
    • initializeHelper

      public static FSHelper initializeHelper(String pFSHelperId, String pResourceDir, String pServerConfigXml, com.seclore.fs.ws.client.pscp.CryptoHandler pCryptoHandler) throws FSHelperException
      This method acts as the single point of entry for the connection to the Policy Server. It creates a API object which can be further utilized to protect/unprotect a file.

      Code Usage:

       
       import com.seclore.fs.helper.exception.FSHelperException;
       import com.seclore.fs.helper.library.FSHelper;
       import com.seclore.fs.helper.library.FSHelperLibrary;
       import com.seclore.fs.ws.client.pscp.CryptoHandler;
       import com.seclore.fs.helper.crypto.DefaultCryptoHandler;
       
       public class Example {
       
       	public static void main(String[] args)
       	{
       		try
       		{
       			if(FSHelperLibrary.isInitialized() == true)
       			{
       				// Tenant Identifier should be unique
       				String tenantId = "tenant-1";
       				// Tenant buffer files and supported extension lists directory location.
       				String fshelperTenantResourcePath = "/../";
       				// FSHelper Tenant Config XML. Please refer FSHelper Tenant Configuration XML provided in the package for more info.
       				String fshelperTenantConfig = "<..>";
       				
       				// Implementation of CryptoHandler interface
       				CryptoHandler myCryptoHandler = new DefaultCryptoHandler(...);
       				FSHelper fsTenant = FSHelperLibrary.initializeHelper(fshelperTenantId, fshelperTenantResourcePath, fshelperTenantConfig, myCryptoHandler);
       			}
       			else
       			{
       				// Please refer initialize() method of FSHelperLibrary for more details
       			}		
       		}
       		catch(FSHelperException exception)
       		{
       			Log("Message : " + exception.getMessage());
       			Log("Error Code : " + exception.getErrorCode());
       		}
       	}
       
       }
       
       
      Parameters:
      pFSHelperId - Unique Identifier for the FSHelper Object.
      pResourceDir - The directory path where the custom buffer files are present. If it is null or empty, default buffer files will be used.
      pServerConfigXml - Policy Server connection parameters in xml format.
      pCryptoHandler - Implementation of CryptoHandler
      Returns:
      object of FSHelper mapped to pFSHelperId
      Throws:
      FSHelperException
    • initializeHelper

      public static FSHelper initializeHelper(String pFSHelperId, String pResourcePath, String pServerConfigXml) throws FSHelperException
      This method acts as the single point of entry for the connection to the Policy Server. It creates a API object of FSHelper which can be further utilized to protect/unprotect a file.

      Code Usage:

       
       import com.seclore.fs.helper.exception.FSHelperException;
       import com.seclore.fs.helper.library.FSHelper;
       import com.seclore.fs.helper.library.FSHelperLibrary;
       
       public class Example {
       
       	public static void main(String[] args)
       	{
       		try
       		{
       			if(FSHelperLibrary.isInitialized() == true)
       			{
       				// Tenant Identifier should be unique
       				String tenantId = "tenant-1";
       				// Tenant buffer files and supported extension lists directory location.
       				String fshelperTenantResourcePath = "/../";
       				// FSHelper Tenant Config XML. Please refer FSHelper Tenant Configuration XML provided in the package for more info.
       				String fshelperTenantConfig = "<..>";
       				
       				FSHelper fsTenant = FSHelperLibrary.initializeHelper(fshelperTenantId, fshelperTenantResourcePath, fshelperTenantConfig);
       			}
       			else
       			{
       				// Please refer initialize() method of FSHelperLibrary for more details
       			}		
       		}
       		catch(FSHelperException exception)
       		{
       			Log("Message : " + exception.getMessage());
       			Log("Error Code : " + exception.getErrorCode());
       		}
       	}
       
       }
       
       
      Parameters:
      pFSHelperId - Unique Identifier for the FSHelper Object.
      pResourcePath - The directory path where the custom buffer files are present. If it is null or empty, default buffer files will be used.
      pServerConfigXml - Policy Server connection parameters in xml format.
      Returns:
      Throws:
      FSHelperException
    • getHelper

      public static FSHelper getHelper(String pFSHelperId) throws FSHelperException
      Get an instance of FSHelper for the given identifier.
      Parameters:
      pFSHelperId - Unique Identifier of the FSHelper object.
      Returns:
      Object of FSHelper.
      Throws:
      FSHelperException - If no FSHelper object is mapped to pFSHelperId
    • terminateHelper

      public static void terminateHelper(String pFSHelperId) throws FSHelperException
      This method removes the FSHelper associated with the current identifier.
      Parameters:
      pFSHelperId - Unique Identifier of the FSHelper.
      Throws:
      FSHelperException
    • isInitialized

      public static boolean isInitialized()
      This method returns whether the library is initialized or not.
      Returns:
      true if the library is initialized.
    • isTerminated

      public static boolean isTerminated()
      This method returns whether the library is terminated or not.
      Returns:
      true, if the library is terminated.
    • status

      public void status()
      Logs the status of initialization of Library.
    • logInfo

      public static void logInfo(String pInfoMessage)
      Log message at info level
      Parameters:
      pInfoMessage - Message to be logged
    • logDebug

      public static void logDebug(String pDebugMessage)
      Log message at debug level
      Parameters:
      pDebugMessage - Message to be logged
    • logError

      public static void logError(String pErrorMessage, Throwable pThrowable)
      Log message at error level.
      Parameters:
      pErrorMessage - Message to be logged.
      pThrowable - Throwable instance
    • getVersion

      public static String getVersion()
      This method returns the version of the Helper Library.
      Returns:
      the String containing the library version.
    • getIntegratedAppName

      public static String getIntegratedAppName()
    • isProductMetricsDisabled

      public static boolean isProductMetricsDisabled()