Package org.apache.slide.projector.i18n

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


          Object entry = i.next();
          if ( entry instanceof AnyValue ) {
            try {
              array[counter] = entryValueDescriptor.valueOf(((AnyValue)entry).load(context), context);
          } catch (Exception e) {
              throw new ValueCastException(new ErrorMessage("uncastableArrayValue", new Object[] { entry }));
          }
          } else {
            array[counter] = entryValueDescriptor.valueOf(entry, context);
          }
          counter++;
        }
        } else if ( value instanceof ArrayValue ) {
          array = new Value[((ArrayValue)value).getArray().length];
        for ( int i = 0; i < array.length; i++ ) {
          Object entry = ((ArrayValue)value).getArray()[i];
          if ( entry instanceof AnyValue ) {
            try {
              array[i] = entryValueDescriptor.valueOf(((AnyValue)entry).load(context), context);
          } catch (Exception e) {
              throw new ValueCastException(new ErrorMessage("uncastableArrayValue", new Object[] { value }));
          }
          } else {
            array[i] = entryValueDescriptor.valueOf(entry, context);
          }
        }
      } else {
        throw new ValueCastException(new ErrorMessage("uncastableArrayValue", new Object[] { value }));
      }
    return new ArrayValue(array);
    }
View Full Code Here


          if ( !(array[i] instanceof NullValue) ) {
            entryValueDescriptor.validate(array[i], context);
          }
        }
      } catch ( ValidationException exception ) {
        throw new ValidationException(new ErrorMessage("invalidNestedValue", new Object[] { value }), exception);
      }
    }
View Full Code Here

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

        return (XMLValue)value;
      } else if ( value instanceof StreamableValue ) {
        try {
          return new DocumentValue(((StreamableValue)value).getInputStream());
        } catch ( Exception e ) {
          throw new ValueCastException(new ErrorMessage("uncastableXMLValue", new Object[] { value }), e);
        }
      } else if ( value instanceof PrintableValue ) {
        try {
          return new DocumentValue(new ByteArrayInputStream(((PrintableValue)value).toString().getBytes("UTF-8")));
        } catch ( Exception e ) {
          throw new ValueCastException(new ErrorMessage("uncastableXMLValue", new Object[] { value }), e);
        }
      }
      throw new ValueCastException(new ErrorMessage("uncastableXMLValue", new Object[] { value }));
    }
View Full Code Here

      throw new ValueCastException(new ErrorMessage("uncastableXMLValue", new Object[] { value }));
    }
     
    public void validate(Value value, Context context) throws ValidationException {
    if ( constrained && !((XMLValue)value).getDocumentType().equals(allowedDocType)) {
      throw new ValidationException(new ErrorMessage("invalidXMLValue", new String[] { ((XMLValue)value).getDocumentType().toString() }));
    }
    }
View Full Code Here

    }

    private void appendNestedDetails(StringBuffer details, Throwable throwable, Locale locale) {
        if ( details.length() > 0 ) details.append(' ');
        if ( throwable instanceof ProcessException ) {
            ErrorMessage message = ((ProcessException)throwable).getErrorMessage();
            details.append(message.getDetails(locale, ""));
        } else {
            details.append(throwable.getMessage());
        }
        if ( throwable.getCause() != null ) appendNestedDetails(details, throwable.getCause(), locale);
    }
View Full Code Here

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

            Number allowedNumber = (Number)i.next();
            if ( allowedNumber.equals(number) ) {
              return;
            }
          }
          throw new ValidationException(new ErrorMessage("invalidNumber", new Object[] { value }));
        } else {
          if ( minimum.longValue() >  number.longValue() || maximum.longValue() < number.longValue()) {
            throw new ValidationException(new ErrorMessage("invalidNumberRange", new Object[] { number, minimum, maximum }));
          }
        }
      }
    }
View Full Code Here

            linkBuffer.append(entry.getKey());
            linkBuffer.append('=');
            linkBuffer.append(entry.getValue());
            }
    } else {
            throw new ProcessException(new ErrorMessage("httpContextRequired"));
        }
        return new Result(StateDescriptor.OK, SimpleProcessor.OUTPUT, new StringValue(linkBuffer.toString()));
  }
View Full Code Here

    public void configure(StreamableValue config) throws ConfigurationException {
        if ( config instanceof XMLValue ) {
            rootElement = ((XMLValue)config).getRootElement();
        } else {
            throw new ConfigurationException(new ErrorMessage("xpathQuery/xmlResourceRequired"));
        }
    }
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.