Package org.apache.slide.projector.i18n

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


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


        descendingHeaderColumnTemplate = getOptionalFragment(DESCENDING_HEADER_COLUMN_FRAGMENT);
        try {
            columnTemplate = getRequiredFragment(COLUMN_FRAGMENT);
            headerColumnTemplate = getRequiredFragment(HEADER_COLUMN_FRAGMENT);
        } catch ( ProcessException exception ) {
            throw new ConfigurationException(new ErrorMessage("tableRenderer/fragmentsMissing"), exception);
        }
    }
View Full Code Here

    public Value process(Value input, Context context) throws Exception {
        Value output;
        if ( context instanceof HttpContext ) {
            output = new StringValue(((HttpContext)context).getContextPath() + "/" + ((StringValue)input).toString());
        } else {
            throw new ProcessException(new ErrorMessage("httpContextRequired"));
        }
        return output;
    }
View Full Code Here

  public Processor getProcessor(URI uri) throws ProcessException {
        if ( processorMap.containsKey(uri) ) {
            return (Processor)processorMap.get(uri);
        }
        logger.log(Level.SEVERE, "Requested processor with URI=" + uri+ " not found!");
        throw new ProcessException(new ErrorMessage("processorNotFound", new Object[] {uri.toString()}));
    }
View Full Code Here

            if ( entry.getValue() == processor ) {
                return ((URI)entry.getKey());
            }
        }
        logger.log(Level.SEVERE, "Requested URI for processor=" + processor + " not found!");
        throw new ProcessException(new ErrorMessage("processorNotFound", new Object[] {processor.toString()}));
    }
View Full Code Here

    public Value process(URI simpleProcessorUri, Object input, String resultKey, Context context) throws Exception {
        Processor  processor = getProcessor(simpleProcessorUri);
        ParameterDescriptor[] parameterDescriptors = processor.getParameterDescriptors();
        if ( parameterDescriptors.length > 1 && countRequiredParameters(parameterDescriptors) > 1 ) {
            throw new ProcessException(new ErrorMessage("valueProcessorNeedsTooManyParametersException"));
        }
        if ( resultKey  == null ) {
            ResultDescriptor resultDescriptor = processor.getResultDescriptor();
            if ( resultDescriptor.getResultEntryDescriptors().length == 0 ) {
                throw new ProcessException(new ErrorMessage("parameterProcessingException", new String[] { simpleProcessorUri.toString() }));
            } else {
                resultKey = resultDescriptor.getResultEntryDescriptors()[0].getName();
            }
        }
        if ( input == null && parameterDescriptors.length == 1 && parameterDescriptors[0].isRequired()) {
            throw new ProcessException(new ErrorMessage("requiredParameterMissing", new String[]{parameterDescriptors[0].getName()}));
        } else if ( input == null && parameterDescriptors.length > 1 ) {
            ParameterDescriptor requiredParameter = getRequiredParameter(parameterDescriptors);
            if ( requiredParameter != null ) throw new ProcessException(new ErrorMessage("requiredParameterMissing", new String[]{ requiredParameter.getName()}));
        } else {
            try {
                // check for SimpleProcessor to avoid HashMap creation
                if ( processor instanceof EnvironmentConsumer ) {
                    Process.checkRequirements((EnvironmentConsumer)processor, context);
                }
                if ( processor instanceof SimpleProcessor ) {
                    Value preparedValue = prepareValue(parameterDescriptors[0], input, context);
                    input = ((SimpleProcessor)processor).process(preparedValue, context);
                } else {
                    Map parameters = new HashMap();
                    if ( parameterDescriptors.length == 1 ) {
                        parameters.put(parameterDescriptors[0].getName(), prepareValue(parameterDescriptors[0], input, context));
                    } else {
                      for ( int i = 0; i < parameterDescriptors.length; i++ ) {
                            if ( parameterDescriptors[i].isRequired() ) {
                                parameters.put(parameterDescriptors[i].getName(), prepareValue(parameterDescriptors[i], input, context));
                            } else {
                                parameters.put(parameterDescriptors[i].getName(), parameterDescriptors[i].getDefaultValue());
                            }
                        }
                     
                    }
                    Result processorResult = processor.process(parameters, context);
                    input = processorResult.getResultEntries().get(resultKey);
                }
            } catch ( Exception exception ) {
                throw new ProcessException(new ErrorMessage("parameterProcessingException", new String[] { simpleProcessorUri.toString(), exception.getMessage() }), exception);
            }
        }
        return (Value)input;
    }
View Full Code Here

      if ( value instanceof AnyValue ) {
         value = ((AnyValue)value).load(context);
      }
      if ( value == null || value instanceof NullValue ) {
            if ( parameterDescriptor.isRequired() ) {
                throw new ValidationException(new ErrorMessage("requiredParameterMissing", new String[] { parameterDescriptor.getName() }));
            } else {
                preparedValue = parameterDescriptor.getDefaultValue();
            }
      } else {
          preparedValue = parameterDescriptor.getValueDescriptor().valueOf(value, context);
View Full Code Here

        evenTemplate = getOptionalFragment(EVEN_FRAGMENT);
        emptyTemplate = getOptionalFragment(EMPTY_FRAGMENT);
        try {
            defaultTemplate = getRequiredFragment(DEFAULT_FRAGMENT);
        } catch ( ProcessException exception ) {
            throw new ConfigurationException(new ErrorMessage("tableRenderer/fragmentsMissing"), exception);
        }
    }
View Full Code Here

    }
   
    public URI createUser(String username, String password, Credentials credentials) throws UserExistsException, IOException {
      Value userExists = getResource(new URIValue(users+username), credentials);
      if ( userExists == NullValue.NULL || userExists != null ) {
            throw new UserExistsException(new ErrorMessage("userExists", new String[] { username }));
        } else {
          URI userUri = new URIValue(users+username);
          MkcolMethod mkcolMethod = new MkcolMethod(domain+userUri.toString());
          mkcolMethod.setDoAuthentication(true);
            HttpState httpState = new HttpState();
View Full Code Here

    }
   
    public URI createRole(String rolename, Credentials credentials) throws RoleExistsException, IOException {
      Value userExists = getResource(new URIValue(domain+roles+rolename), credentials);
      if ( userExists == NullValue.NULL || userExists != null ) {
            throw new RoleExistsException(new ErrorMessage("roleExists", new String[] { rolename }));
        } else {
          URI roleUri = new URIValue(roles+rolename);
          MkcolMethod mkcolMethod = new MkcolMethod(domain+roleUri.toString());
          mkcolMethod.setDoAuthentication(true);
            HttpState httpState = new HttpState();
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.