Package org.apache.slide.projector.i18n

Examples of org.apache.slide.projector.i18n.ErrorMessage


    Value uri = (Value)parameter.get(PROCESSOR);
        if ( uri == null || uri == NullValue.NULL ) {
          uri = (URI)context.getStore(Store.SESSION).get(PROCESSOR);
        }
        if ( uri == null ) {
          throw new ProcessException(new ErrorMessage("test/noProcessorSpecified"));
        }
        context.setProcess((URI)uri);
      context.getStore(Store.SESSION).put(PROCESSOR, uri);
      Value stepResource = (Value)context.getStore(Store.FORM).get(Process.STEP);
      String step;
View Full Code Here


        return name;
    }

    protected void storeValue(Value value, Store stepStore, Result result, ResultEntryDescriptor[] resultEntryDescriptors, Context context) throws ProcessException {
      if ( value == null ) {
        throw new ProcessException(new ErrorMessage("valueToStoreNotFound"));
      }
      if (presentable ) {
            if ( value instanceof StreamableValue ) {
                if ( context instanceof HttpContext ) {
                    ((HttpContext)context).setPresentableResource((StreamableValue)value);
                } else {
                    logger.log(Level.FINE, "Result can only be shown in http-context!");
                }
            } else {
            throw new ProcessException(new ErrorMessage("unpresentableValue"));
            }
        }
        Store resultStore = stepStore;
        if ( store == Store.OUTPUT ) {
          // check if result is defined
          boolean resultDefined = false;
          for ( int i = 0; i < resultEntryDescriptors.length; i++ ) {
            if ( resultEntryDescriptors[i].getName().equals(key) ) {
              // check if result matches description
              if ( ContentType.matches(resultEntryDescriptors[i].getContentType(), value.getContentType()) ) {
                result.addResultEntry(key, value);
                resultDefined = true;
                break;
              } else {
                    throw new ProcessException(new ErrorMessage("contentTypeMismatch", new String[] { key, value.getContentType(), resultEntryDescriptors[i].getContentType()}));
              }
            }
          }
          if ( !resultDefined ) {
            throw new ProcessException(new ErrorMessage("undefinedResultKey", new String[] { key }));
          }
        } else {
            if ( store != Store.NONE ) {
              resultStore = context.getStore(store);
            }
            if ( resultStore == null ) {
            throw new ProcessException(new ErrorMessage("storeNotAvailable", new String[] { key, Store.stores[store] }));
            } else {
                try {
                    String evaluatedKey = Process.evaluateKey(key, context);
                    if ( evaluatedKey != null ) {
                      if ( domain != null ) {
                        Map map;
                        MapValue mapResource = (MapValue)resultStore.get(domain);
                      if ( mapResource == null ) {
                        map = new HashMap();
                        mapResource = new MapValue(map);
                      } else {
                        map = mapResource.getMap();
                      }
                      map.put(evaluatedKey, value);
                      evaluatedKey = domain;
                      value = mapResource;
                      }
                      if ( timeout != -1 ) {
                        resultStore.put(evaluatedKey, value, timeout);
                      } else {
                        resultStore.put(evaluatedKey, value);
                      }
                    }
                } catch ( IOException e ) {
                throw new ProcessException(new ErrorMessage("storingResultFailed"), e);
                }
            }
        }
    }
View Full Code Here

        step.configure(stepElement);
        steps.put(step.getName(), step);
      }
    } catch (Exception exception) {
      logger.log(Level.SEVERE, "Error while parsing process configuration", exception);
      throw new ConfigurationException(new ErrorMessage("process/configurationException"), exception);
    }
  }
View Full Code Here

    context.setInputParameters(parameter);
    do {
      logger.log(Level.FINE, "Processing "+processorUri+", step=" + nextStep);
      context.setStep(nextStep);          // Remember current step in context
      step = (Step)steps.get(nextStep);
      if (step == null) throw new ProcessException(new ErrorMessage("stepNotFound", new String[]{nextStep}));
      Processor processor = ProcessorManager.getInstance().getProcessor(step.getProcessorURI());
      try {
        Map processorParameters = loadParameters(step, processor, context);
        if ( processor instanceof EnvironmentConsumer ) {
          checkRequirements((EnvironmentConsumer)processor, context);
        }
        checkRoutings(step, processor);
        try {
          stepResult = ProcessorManager.process(processor, processorParameters, context);
          try {
            saveResults(step, stepResult, stepStore, result, getResultDescriptor().getResultEntryDescriptors(), context);
          } catch ( ProcessException e ) {
            throw new ProcessException(new ErrorMessage("saveFailed", new Object[] { step.getProcessorURI(), nextStep }), e );
          }
          nextStep = routeState(step, stepResult.getState());
        } catch (Exception e) {
          nextStep = routeException(step, e);
        }
      } catch ( ValidationException exception ) {
        throw new ValidationException(new ErrorMessage("validationFailed", new Object[] { step.getProcessorURI(), nextStep }), exception);
      }
    } while (nextStep != null);
    result.setState(getState(step, stepResult.getState()));
    context.setStepStore(enclosingStepStore);
    context.setInputParameters(enclosingParameters);
View Full Code Here

          routingFound = true;
          break;
        }
      }
      if ( !routingFound ) {
        throw new ValidationException(new ErrorMessage("stateNotRouted", new String[] { step.getName(), state }));
      }
    }
  }
View Full Code Here

    for ( int i = 0; i < requirementDescriptor.length; i++ ) {
      Store store = context.getStore(requirementDescriptor[i].getStore());
      Object value = store.get(requirementDescriptor[i].getName());
      if ( value == null ) {
        if ( requirementDescriptor[i].isRequired() ) {
          throw new ContextException(new ErrorMessage("requiredContextMissing", new Object[] { requirementDescriptor[i].getName(), Store.stores[requirementDescriptor[i].getStore()] }));
        } else {
          value = requirementDescriptor[i].getDefaultValue();
          store.put(requirementDescriptor[i].getName(), value);
        }
      }
View Full Code Here

          if (validStates[j].getState().equals(returnState)) {
            return returnState;
          }
        }
        logger.log(Level.SEVERE, "State '" + returnState + "' not defined!");
        throw new ProcessException(new ErrorMessage("stateNotDefined", new String[]{returnState}));
      }
    }
    return OK;
  }
View Full Code Here

            return (LocaleValue)value;
    }
    try {
      return new LocaleValue(new Locale(StringValueDescriptor.ANY.valueOf(value, null).toString()));
    } catch ( ValueCastException exception ) {
      throw new ValueCastException(new ErrorMessage("uncastableLocaleValue", new Object[] { value }));
    }
  }
View Full Code Here

            for ( Iterator i = allowedContentTypes.iterator(); i.hasNext(); ) {
                if ( ContentType.matches((String)i.next(), ((Value)value).getContentType()) ) {
                    return;
                }
            }
            throw new ValidationException(new ErrorMessage("invalidValue", new String[] { ((Value)value).getContentType(), ContentType.getContentTypesAsString(allowedContentTypes) }));
        }
    }
View Full Code Here

            return (BooleanValue)value;
        }
        try {
            return getBooleanResource(StringValueDescriptor.ANY.valueOf(value, null).toString());
        } catch ( ValueCastException exception ) {
            throw new ValueCastException(new ErrorMessage("uncastableBooleanValue", new Object[] { value }));
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.slide.projector.i18n.ErrorMessage

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.