com.konakartadmin.bl
Class AdminFileMgr

java.lang.Object
  extended by com.konakartadmin.bl.AdminBaseMgr
      extended by com.konakartadmin.bl.AdminFileMgr
All Implemented Interfaces:
AdminFileMgrIf

public class AdminFileMgr
extends AdminBaseMgr
implements AdminFileMgrIf

Manages Files for KonaKartAdmin


Nested Class Summary
 
Nested classes/interfaces inherited from class com.konakartadmin.bl.AdminBaseMgr
AdminBaseMgr.StaticData
 
Field Summary
protected static org.apache.commons.logging.Log log
           
 
Fields inherited from class com.konakartadmin.bl.AdminBaseMgr
adminEng, baseMgrMutex, baseStaticDataHM, cDataEnd, cDataStart, kkConf, kkInstanceId, mgrFactory, STORE_ID, templateBaseDir
 
Constructor Summary
AdminFileMgr(KKAdminIf eng)
          The AdminFileMgr constructor
 
Method Summary
 boolean deleteFile(java.lang.String fileName)
          Delete the file.
 AdminFile[] getConfigFiles()
          Returns an array containing the configuration files.
 java.lang.String getFileContents(java.lang.String fileName)
          Get the file contents.
 byte[] getFileContentsAsByteArray(java.lang.String fileName)
          Get the file contents as a byte array.
 AdminFile[] getFiles(java.lang.String directory, java.lang.String extension)
          Returns an array of files found in the directory.
 void saveFileContents(java.lang.String fileName, java.lang.String fileContents)
          Writes the specified file contents into the specified file.
 
Methods inherited from class com.konakartadmin.bl.AdminBaseMgr
addInsertAttr, addInsertAttr, checkIntIsSet, checkRequired, getAdminAddressMgr, getAdminAuditMgr, getAdminBillingMgr, getAdminBookableProductMgr, getAdminCatMgr, getAdminConfigMgr, getAdminCurrMgr, getAdminCustMgr, getAdminCustTagMgr, getAdminEmailMgr, getAdminEng, getAdminHtmlMgr, getAdminLanguageMgr, getAdminManuMgr, getAdminMessageMgr, getAdminMiscItemMgr, getAdminModulesMgr, getAdminMultiStoreMgr, getAdminOrderMgr, getAdminPdfMgr, getAdminProdAttrMgr, getAdminProdMgr, getAdminPromMgr, getAdminPublishProdMgr, getAdminReviewMgr, getAdminSearchRuleMgr, getAdminSecMgr, getAdminSolrMgr, getAdminStoreMgr, getAdminTagMgr, getAdminTaxMgr, getAdminValidationMgr, getAdminVelocityContextMgr, getAdminWishListMgr, getBooleanFromString, getExportXMLData, getIntFromString, getKkConfig, getKkInstanceId, getMode, getModeString, getMqMgr, getNewCriteria, getNewCriteria, getPostSearchText, getPreSearchText, getPropertyValue, getRecordCount, getRewardPointMgr, getSingleIntResult, getStoreId, getTemplate, getTemplateBase, getXml_io, init, isConfigSet, isEnterprise, isMultiStoreLanguagesShared, isMultiStoreMode, isMultiStoreShareCategories, isMultiStoreShareCustomers, isMultiStoreShareProducts, isMultiStoreSingleDBCSMode, isMultiStoreSingleDBMode, isMultiStoreSingleDBNonCSMode, manageException, refreshConfigs, removeCData, setAdminEng, setupWildCardRules, setWildCardAfter, setWildCardBefore, shutdownGracefully, shutdownGracefully, timestampStr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
Constructor Detail

AdminFileMgr

public AdminFileMgr(KKAdminIf eng)
             throws java.lang.Exception
The AdminFileMgr constructor

Parameters:
eng -
Throws:
java.lang.Exception
Method Detail

getFileContents

public java.lang.String getFileContents(java.lang.String fileName)
                                 throws KKAdminException
Get the file contents. Note that it uses the line terminators appropriate for the platform where the file resides.

Specified by:
getFileContents in interface AdminFileMgrIf
Parameters:
fileName - the filename in the server's context
Returns:
the file contents as a String
Throws:
KKAdminException - if the file's not present or can't be read, or it's not a text file

saveFileContents

public void saveFileContents(java.lang.String fileName,
                             java.lang.String fileContents)
                      throws KKAdminException
Writes the specified file contents into the specified file. It creates the file if it doesn't already exist.

Specified by:
saveFileContents in interface AdminFileMgrIf
Parameters:
fileName - the filename in the server's context
fileContents - the file contents to write
Throws:
KKAdminException - on any Security or IO problems that prevent us from saving the data to the file.

deleteFile

public boolean deleteFile(java.lang.String fileName)
                   throws KKAdminException
Delete the file.

Specified by:
deleteFile in interface AdminFileMgrIf
Parameters:
fileName - the filename in the server's context
Returns:
true if the file was deleted, otherwise false.
Throws:
KKAdminException - if the file's not present or can't be deleted

getConfigFiles

public AdminFile[] getConfigFiles()
                           throws KKAdminException
Description copied from interface: AdminFileMgrIf
Returns an array containing the configuration files.

Specified by:
getConfigFiles in interface AdminFileMgrIf
Returns:
Returns the files defined in konakart-files.xml
Throws:
KKAdminException

getFiles

public AdminFile[] getFiles(java.lang.String directory,
                            java.lang.String extension)
                     throws KKAdminException
Returns an array of files found in the directory. If the extension is not null, then the files are filtered by extension.

Specified by:
getFiles in interface AdminFileMgrIf
Parameters:
directory -
extension -
Returns:
Returns an array of Admin File objects
Throws:
KKAdminException

getFileContentsAsByteArray

public byte[] getFileContentsAsByteArray(java.lang.String fileName)
                                  throws KKAdminException
Get the file contents as a byte array.

Specified by:
getFileContentsAsByteArray in interface AdminFileMgrIf
Parameters:
fileName - the filename in the server's context
Returns:
the file contents as a vte array
Throws:
KKAdminException - if the file's not present or can't be read


Copyright © 2011 DS Data Systems UK Ltd.