Package hirondelle.web4j.model

Examples of hirondelle.web4j.model.AppException


   @param aRequestParser allows parsing of request parameters into higher level java objects.
  */
  protected ActionImpl(ResponsePage aNominalPage, RequestParser aRequestParser) {
    fFinalResponsePage = aNominalPage;
    fRequestParser = aRequestParser;
    fErrors = new AppException();
    fMessages = new MessageListImpl();
    fLocale = BuildImpl.forLocaleSource().get(fRequestParser.getRequest());
    fTimeZone = BuildImpl.forTimeZoneSource().get(fRequestParser.getRequest());
    fOperation = parseOperation();
    addToRequest("Operation", fOperation);
View Full Code Here


  private static void checkSqlFilesVersusSqlIdFields() {
    Map sqlIdFields = ConfigReader.fetchPublicStaticFinalFields(SqlId.class);
    Set<String> sqlIdStrings = convertToSetOfStrings(sqlIdFields);
    fLogger.config("SqlId fields " + Util.logOnePerLine(sqlIdStrings));
    AppException mismatches = getMismatches(sqlIdStrings, fSqlProperties.keySet());
    if (mismatches.isNotEmpty()) {
      fLogger.severe("MISMATCH found between .sql files and SqlId fields. " + Util.logOnePerLine(mismatches.getMessages()));
      throw new IllegalStateException(Util.logOnePerLine(mismatches.getMessages()));
    }
    fLogger.config("No mismatches found between .sql files and SqlId fields.");
  }
View Full Code Here

    return result;
  }

  private static AppException getMismatches(Set<String> aSqlIdStrings,
  Collection<Object> aSqlTextFileKeys) {
    AppException result = new AppException();
    for (String fieldValue : aSqlIdStrings) {
      if (!aSqlTextFileKeys.contains(fieldValue)) {
        result.add("SqlId field " + fieldValue + " is not present in any underlying .sql file.");
      }
    }
    for (Object sqlFileKey : aSqlTextFileKeys) {
      if (!aSqlIdStrings.contains(sqlFileKey)) {
        result.add("The key " + sqlFileKey  + " in a .sql file does not match any corresponding public static final SqlId field in any class.");
      }
    }
    return result;
  }
View Full Code Here

    }
    return result;
  }

  private static void checkStoredProcedures() {
    AppException errors = new AppException();

    Enumeration allSqlIds = fSqlProperties.propertyNames();
    while (allSqlIds.hasMoreElements()) {
      String sqlId = (String)allSqlIds.nextElement();
      String sql = (String)fSqlProperties.get(sqlId);
      if (sql.startsWith(fUNSUPPORTED_STORED_PROC)) {
        errors.add(
          "The stored procedured called " + Util.quote(sqlId) + " has an explict return "
          + "value since it begins with " + fUNSUPPORTED_STORED_PROC + ". "
          + "A *.sql file can contain stored procedures, but only if they do not "
          + "have any OUT or INOUT parameters, including *explicit* return values (which "
          + "would need registration as an OUT parameter). See hirondelle.web4j.database "
          + "package overview for more information."
        );
      }
    }

    if (errors.isNotEmpty()) { throw new IllegalStateException(errors.getMessages().toString()); }
  }
View Full Code Here

      fHandler = new FileHandler(getFileName(), MAX_BYTES, NUM_FILES, APPEND_TO_EXISTING);
      fHandler.setLevel(Level.FINEST);
      fHandler.setFormatter(new TimeSensitiveFormatter());
    }
    catch (IOException ex){
      throw new AppException("Cannot create FileHandler: " + ex.toString() , ex);
    }
  }
View Full Code Here

    Class<?> result = null;
    try {
      result = Class.forName(aClassName);
    }
    catch (ClassNotFoundException ex){
      throw new AppException(
        "Load of configured (or default) implementation class has failed. Class.forName() failed for " + Util.quote(aClassName), ex
      );
    }
    return result;
  }
View Full Code Here

    try {
      result = Class.forName(aStandardName);
    }
    catch (ClassNotFoundException ex){
      if( ! Util.textHasContent(aDefaultName) ){
        throw new AppException(
          "Load of configured implementation class has failed. Class.forName() failed for " + Util.quote(aStandardName), ex
        );
      }
      fLogger.config("Cannot see any class named " + Util.quote(aStandardName) + ". Will use default WEB4J implementation instead, named " + Util.quote(aDefaultName));
      try {
        result = Class.forName(aDefaultName);
      }
      catch (ClassNotFoundException exception){
        throw new AppException(
          "Load of default implementation has failed. Class.forName() failed for " + Util.quote(aDefaultName), exception
        );
      }
    }
    return result;
View Full Code Here

TOP

Related Classes of hirondelle.web4j.model.AppException

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.