Package com.seclore.fs.helper.library
Class FSHelperLibrary
java.lang.Object
com.seclore.fs.helper.library.FSHelperLibrary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FSHelperGet an instance ofFSHelperfor the given identifier.static Stringstatic StringThis method returns the version of the Helper Library.static voidinitialize(ISecloreSDKLogger pLogger, String pConfigXML) This method initializes the library.static voidinitialize(String pConfigXML) This method initializes the library.static FSHelperinitializeHelper(String pFSHelperId, String pResourcePath, String pServerConfigXml) This method acts as the single point of entry for the connection to the Policy Server.static FSHelperinitializeHelper(String pFSHelperId, String pResourceDir, String pServerConfigXml, com.seclore.fs.ws.client.pscp.CryptoHandler pCryptoHandler) This method acts as the single point of entry for the connection to the Policy Server.static booleanThis method returns whether the library is initialized or not.static booleanstatic booleanThis method returns whether the library is terminated or not.static voidLog message at debug levelstatic voidLog message at error level.static voidLog message at info levelvoidstatus()Logs the status of initialization of Library.static voidThis method should be called as part of the termination process of the calling application.static voidterminateHelper(String pFSHelperId) This method removes theFSHelperassociated with the current identifier.
-
Constructor Details
-
FSHelperLibrary
public FSHelperLibrary()
-
-
Method Details
-
initialize
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 ofISecloreSDKLogger. If the parameter passed asnull, 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
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 ofCryptoHandler- Returns:
- object of
FSHelpermapped 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 ofFSHelperwhich 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
Get an instance ofFSHelperfor the given identifier.- Parameters:
pFSHelperId- Unique Identifier of theFSHelperobject.- Returns:
- Object of
FSHelper. - Throws:
FSHelperException- If noFSHelperobject is mapped to pFSHelperId
-
terminateHelper
This method removes theFSHelperassociated with the current identifier.- Parameters:
pFSHelperId- Unique Identifier of theFSHelper.- 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
Log message at info level- Parameters:
pInfoMessage- Message to be logged
-
logDebug
Log message at debug level- Parameters:
pDebugMessage- Message to be logged
-
logError
Log message at error level.- Parameters:
pErrorMessage- Message to be logged.pThrowable- Throwable instance
-
getVersion
This method returns the version of the Helper Library.- Returns:
- the String containing the library version.
-
getIntegratedAppName
-
isProductMetricsDisabled
public static boolean isProductMetricsDisabled()
-