How to validate if the DCR file exists before trying to read using LiveSiteDAL

I am reading the DCR using the LiveSiteDal with following code sample. But its getting Error in the log and creates struck threads some times.
Is there a way in LiveSiteDal to validate if that dcr is present before Reading the dcr file?
Document currDcrDoc = context.getLiveSiteDal().readXmlFile(
dcrPath);

Comments

  • Aren't you asking a basic Java question ?

    File dcr = new File(dcrPath);
    boolean exists = dcr.exists();

  • I too felt when i was asking this, but still "dcrPath" which we will get will be relative path(based on current working dir starting from templatedata) and the physical path will vary based on the environment, so we need to find the current server location (jboss / weblogic or teamsite preview) and then append this path to find it, which i felt may be handled in LiveSite DAL, since we are reading a file form LiveSite DAN felt there will be an option to validate if exists.

    That's why posted this question, to get the most appropriate solution to validate if the file exists before reading using LiveSiteDAL.

TeamSite Developer Resources

  • Docker Automation

  • LiveSite Content Services (LSCS) REST API

  • Single Page Application (SPA) Modules

  • TeamSite Add-ons

If you are interested in gaining full access to the content, you can register for a My Support account here.
image
OpenText CE Products
TeamSite
APIs