Package org.apache.tuscany.sca.databinding

Examples of org.apache.tuscany.sca.databinding.TransformationException


                        .getMetadata());
                Array.set(targetArray, i, targetItem);
            }
            return targetArray;
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here


        if (dataBindingId != null) {
            DataBinding dataBinding = mediator.getDataBindings().getDataBinding(dataBindingId);
            wrapperHandler = dataBinding == null ? null : dataBinding.getWrapperHandler();
        }
        if (wrapperHandler == null && required) {
            throw new TransformationException("No wrapper handler is provided for databinding: " + dataBindingId);
        }
        return wrapperHandler;
    }
View Full Code Here

                || source instanceof org.codehaus.jettison.json.JSONObject
                || source instanceof org.codehaus.jettison.json.JSONArray) {
                try {
                    sink.write(source.toString().getBytes("UTF-8"));
                } catch (Exception e) {
                    throw new TransformationException(e);
                }
            } else {
                ObjectMapper mapper = JacksonHelper.createObjectMapper(source.getClass());
                try {
                    mapper.writeValue(sink, source);
                } catch (Throwable e) {
                    throw new TransformationException(e);
                }
            }
        }
    }
View Full Code Here

        return cache.getJAXBContext(cls);
    }

    public JAXBContext createJAXBContext(TransformationContext tContext, boolean source) throws JAXBException {
        if (tContext == null)
            throw new TransformationException("JAXB context is not set for the transformation.");

        // TODO: [rfeng] Need to figure out what's the best granularity to create the JAXBContext
        // per interface, operation or parameter
        Operation op = source ? tContext.getSourceOperation() : tContext.getTargetOperation();
        if (op != null) {
View Full Code Here

                    // TUSCANY-3530
                    // something went wrong in the transformation that
                    // generated the JAXBElement. Have seen this when trying
                    // to convert a value to a simple type with an incompatible
                    // value.
                    throw new TransformationException("Null returned when trying to convert value to: " + cls.getName());
                }
                return returnValue;
            } else {
                return value;
            }
View Full Code Here

            synchronized(source){
                result = unmarshaller.unmarshal(source, JAXBContextHelper.getJavaType(context.getTargetDataType()));
            }
            return JAXBContextHelper.createReturnValue(jaxbContext, context.getTargetDataType(), result);
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here

        super();
        serializer = new JSONSerializer();
        try {
            serializer.registerDefaultSerializers();
        } catch (Exception e) {
            throw new TransformationException(e);
        }
        serializer.setMarshallClassHints(true);
        serializer.setMarshallNullAttributes(false);
    }
View Full Code Here

        try {
            SerializerState state = new SerializerState();
            return serializer.unmarshall(state, context.getTargetDataType().getPhysical(), source);
        } catch (Exception e) {
            throw new TransformationException(e);
        }

    }
View Full Code Here

                return JacksonHelper.createJsonParser(value);
            } else {
                return JSONHelper.toJSON(value, targetType);
            }
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here

                return mapper.readValue((JsonParser)source, javaType);
            } else {
                return mapper.readValue(source.toString(), javaType);
            }
        } catch (Exception e) {
            throw new TransformationException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.databinding.TransformationException

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.