Exemplo n.º 1
0
  public boolean after(String text, String after) {
    try {
      int index = this.string.indexOf(after);

      if (index < 0) {
        System.out.println("No such start: " + after + " in: " + this.string);
        return false;
      }

      index = index + after.length();

      String start = this.string.substring(0, index);

      String end = this.string.substring(index + 1, this.string.length());

      FileOutputStream idFile = new FileOutputStream(this.fileName);
      DataOutputStream idOutData = new DataOutputStream(idFile);
      idOutData.writeBytes(start + text + end);
      // System.out.println("Output: " + start + text + end);

      idOutData.close();
      idFile.close();

      return true;
    } catch (Exception e) {
      if (org.allbinary.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          org.allbinary.logic.communication.log.config.type.LogConfigType.IDLOGGING)) {
        LogUtil.put(
            LogFactory.getInstance(CommonStrings.getInstance().EXCEPTION, this, "after", e));
      }
      return false;
    }
  }
  public static DomNodeInterface getInstance(String storeName) // throws LicensingException
      {
    try {
      StoreFrontsEntity storeFronts =
          StoreFrontsEntityFactory.getInstance().getStoreFrontsEntityInstance();

      return (DomNodeInterface) new StoreFrontView(storeFronts.getStoreFrontInterface(storeName));
    }
    /*
    catch(LicensingException e)
    {
       String error = "Failed to get instance";
       if(abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(abcs.logic.communication.log.config.type.LogConfigType.FACTORYERROR))
       {
          LogUtil.put(error,"StoreFrontFactory","getInstance()",e);
       }
       //throw e;
       return null;
    }
     */
    catch (Exception e) {
      String error = "Failed to get instance";
      if (org.allbinary.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
          org.allbinary.logic.communication.log.config.type.LogConfigType.FACTORYERROR)) {
        LogUtil.put(LogFactory.getInstance(error, "StoreFrontFactory", "getInstance()", e));
      }
      return null;
    }
  }
Exemplo n.º 3
0
 public boolean atEnd(String text) {
   try {
     FileOutputStream idFile = new FileOutputStream(this.fileName);
     DataOutputStream idOutData = new DataOutputStream(idFile);
     idOutData.writeBytes(this.string + text);
     return true;
   } catch (Exception e) {
     if (org.allbinary.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(
         org.allbinary.logic.communication.log.config.type.LogConfigType.IDLOGGING)) {
       LogUtil.put(
           LogFactory.getInstance(CommonStrings.getInstance().EXCEPTION, this, "insertAtEnd", e));
     }
     return false;
   }
 }