Package ca.uhn.fhir.context

Examples of ca.uhn.fhir.context.ConfigurationException


      }

      eventWriter.writeEndElement();
      eventWriter.close();
    } catch (XMLStreamException e) {
      throw new ConfigurationException("Failed to initialize STaX event factory", e);
    }
  }
View Full Code Here


    try {
      streamReader = myXmlInputFactory.createXMLEventReader(theReader);
    } catch (XMLStreamException e) {
      throw new DataFormatException(e);
    } catch (FactoryConfigurationError e) {
      throw new ConfigurationException("Failed to initialize STaX event factory", e);
    }
    return streamReader;
  }
View Full Code Here

      super.containResourcesForEncoding(theResource);
    }

    RuntimeResourceDefinition resDef = myContext.getResourceDefinition(theResource);
    if (resDef == null) {
      throw new ConfigurationException("Unknown resource type: " + theResource.getClass());
    }

    theEventWriter.writeStartElement(resDef.getName());
    theEventWriter.writeDefaultNamespace(FHIR_NS);
View Full Code Here

      if (next.getValue() != null) {
        IElement nextValue = next.getValue();
        RuntimeChildUndeclaredExtensionDefinition extDef = myContext.getRuntimeChildUndeclaredExtensionDefinition();
        String childName = extDef.getChildNameByDatatype(nextValue.getClass());
        if (childName == null) {
          throw new ConfigurationException("Unable to encode extension, unregognized child element type: " + nextValue.getClass().getCanonicalName());
        }
        BaseRuntimeElementDefinition<?> childDef = extDef.getChildElementDefinitionByDatatype(nextValue.getClass());
        encodeChildElementToStreamWriter(theResDef, theResource, theWriter, nextValue, childName, childDef, null, theIncludedResource);
      }
View Full Code Here

  public BaseOutcomeReturningMethodBinding(Method theMethod, FhirContext theContext, Class<?> theMethodAnnotation, Object theProvider) {
    super(theMethod, theContext, theProvider);

    if (!theMethod.getReturnType().equals(MethodOutcome.class)) {
      if (!allowVoidReturnType()) {
        throw new ConfigurationException("Method " + theMethod.getName() + " in type " + theMethod.getDeclaringClass().getCanonicalName() + " is a @" + theMethodAnnotation.getSimpleName() + " method but it does not return " + MethodOutcome.class);
      } else if (theMethod.getReturnType() == void.class) {
        myReturnVoid = true;
      }
    }
  }
View Full Code Here

      myMethodToLambda.put(theClientType.getMethod("setEncoding", EncodingEnum.class), new SetEncodingLambda());
      myMethodToLambda.put(theClientType.getMethod("setPrettyPrint", boolean.class), new SetPrettyPrintLambda());

    } catch (NoSuchMethodException e) {
      throw new ConfigurationException("Failed to find methods on client. This is a HAPI bug!", e);
    } catch (SecurityException e) {
      throw new ConfigurationException("Failed to find methods on client. This is a HAPI bug!", e);
    }
  }
View Full Code Here

    try {
      b.append(URLEncoder.encode(nextKey, "UTF-8"));
      b.append('=');
      b.append(URLEncoder.encode(nextValue, "UTF-8"));
    } catch (UnsupportedEncodingException e) {
      throw new ConfigurationException("Could not find UTF-8 encoding. This shouldn't happen.", e);
    }
    return retVal;
  }
View Full Code Here

  public UpdateMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) {
    super(theMethod, theContext, Update.class, theProvider);

    myIdParameterIndex = ParameterUtil.findIdParameterIndex(theMethod);
    if (myIdParameterIndex == null) {
      throw new ConfigurationException("Method '" + theMethod.getName() + "' on type '" + theMethod.getDeclaringClass().getCanonicalName() + "' has no parameter annotated with the @" + IdParam.class.getSimpleName() + " annotation");
    }
    myVersionIdParameterIndex = ParameterUtil.findVersionIdParameterIndex(theMethod);
  }
View Full Code Here

    } else {
      myType = theTypeFromMethodAnnotation;
    }

    if (myType.equals(IResource.class)) {
      throw new ConfigurationException("Method '" + theMethod.getName() + "' does not specify a resource type, but has an @" + IdParam.class.getSimpleName() + " parameter. Please specity a resource type in the method annotation on this method");
    }
    myResourceName = theConetxt.getResourceDefinition(myType).getName();

    myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod);
    myVersionIdParamIndex = ParameterUtil.findVersionIdParameterIndex(theMethod);
    myTagListParamIndex = ParameterUtil.findTagListParameterIndex(theMethod);

    if (myIdParamIndex == null) {
      throw new ConfigurationException("Method '" + theMethod.getName() + "' does not have an @" + IdParam.class.getSimpleName() + " parameter.");
    }

    if (myTagListParamIndex == null) {
      throw new ConfigurationException("Method '" + theMethod.getName() + "' does not have a parameter of type " + TagList.class.getSimpleName() + ", or paramater is not annotated with the @" + TagListParam.class.getSimpleName() + " annotation");
    }

  }
View Full Code Here

  }

  @Override
  public void initializeTypes(Method theMethod, Class<? extends Collection<?>> theOuterCollectionType, Class<? extends Collection<?>> theInnerCollectionType, Class<?> theParameterType) {
    if (theOuterCollectionType != null) {
      throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" +theMethod.getDeclaringClass().getCanonicalName()+ "' is annotated with @" + Since.class.getName() + " but can not be of collection type");
    }
    if (!ParameterUtil.getBindableIntegerTypes().contains(theParameterType)) {
      throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" +theMethod.getDeclaringClass().getCanonicalName()+ "' is annotated with @" + Since.class.getName() + " but type '" + theParameterType + "' is an invalid type, must be one of: " + ParameterUtil.getBindableIntegerTypes());
    }
    myType = theParameterType;
  }
View Full Code Here

TOP

Related Classes of ca.uhn.fhir.context.ConfigurationException

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.