Package com.dotmarketing.viewtools.bean

Examples of com.dotmarketing.viewtools.bean.XmlToolDoc


      return null;
    }

    XmlTool xml = new XmlTool();

    XmlToolDoc doc = XmlToolCache.getXmlToolDoc(String.valueOf(o));
    if (doc == null) {
      String xmlPath = "";
      if (o instanceof URL) {
        xml.read((URL) o);
      } else {
        String file = String.valueOf(o);
        xml.read(file);
      }

      doc = new XmlToolDoc();
      doc.setXmlPath(String.valueOf(o));
      doc.setXmlTool(xml);
      doc.setTtl(new Date().getTime() + (ttl * 60000));
      XmlToolCache.addXmlToolDoc(doc);

    } else {
      xml = doc.getXmlTool();
    }
    return xml;

  }
View Full Code Here


   * @param XMLPath XML path
   * @return XmlToolDoc
   */
  public static XmlToolDoc getXmlToolDoc(String XMLPath) {
    DotCacheAdministrator cache = CacheLocator.getCacheAdministrator();
    XmlToolDoc doc = null;
    try{
      doc = (XmlToolDoc) cache.get(getPrimaryGroup() + hashPath(XMLPath), getPrimaryGroup());
    }catch (DotCacheException e) {
      Logger.debug(XmlToolCache.class,"Cache Entry not found", e);
    }

    if (doc != null) {
      try{

        /*validate time to live*/
        long ttl = doc.getTtl() - new Date().getTime();

        if(ttl <= 0 ){
          removeXmlToolDoc(doc);
          doc =null;
        }
View Full Code Here

TOP

Related Classes of com.dotmarketing.viewtools.bean.XmlToolDoc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.