Package javax.xml.bind

Examples of javax.xml.bind.Unmarshaller


            // All the classes we need should be part of this package
            JAXBContext jc = JAXBContext
                    .newInstance("org.apache.axis2.jaxws.description.xml.handler",
                                 EndpointDescriptionImpl.class.getClassLoader());

            Unmarshaller u = jc.createUnmarshaller();

            JAXBElement<?> o = (JAXBElement<?>)u.unmarshal(is);
            return (HandlerChainsType)o.getValue();

        } catch (Exception e) {
            throw ExceptionFactory
                    .makeWebServiceException(
View Full Code Here


     *             if an error occurs while unmarshalling
     */
    public static Object unmarshal(JAXBContext context, OMElement element, boolean cache) throws JAXBException {
        UnmarshallerAdapter adapter = org.apache.axiom.util.jaxb.JAXBUtils.getUnmarshallerAdapter(
                element.getXMLStreamReader(cache));
        Unmarshaller unmarshaller = context.createUnmarshaller();
        unmarshaller.setAttachmentUnmarshaller(adapter.getAttachmentUnmarshaller());
        return unmarshaller.unmarshal(adapter.getReader());
    }
View Full Code Here

    ContextProvidingValidationEventHandler handler = new ContextProvidingValidationEventHandler();
    try {
      staxEventReader = new JpaNamespaceTransformingEventReader( staxEventReader );
      JAXBContext jaxbContext = JAXBContext.newInstance( ObjectFactory.class );
      Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
      unmarshaller.setSchema( schema );
      unmarshaller.setEventHandler( handler );
      return clazz.cast( unmarshaller.unmarshal( staxEventReader ) );
    }
    catch ( JAXBException e ) {
      StringBuilder builder = new StringBuilder();
      builder.append( "Unable to perform unmarshalling at line number " );
      builder.append( handler.getLineNumber() );
View Full Code Here

    public abstract List<SamlExternalEntity> getExternalSamlEntities();

    protected void readEntitiesDescriptor(Reader reader) {
        try {
            Unmarshaller unmarshaller = metaDataJaxbContext.createUnmarshaller();
            JAXBElement<?> o = (JAXBElement<?>) unmarshaller.unmarshal(reader);
            EntitiesDescriptorType entitiesDescriptor = (EntitiesDescriptorType) o.getValue();
            readEntitiesDescriptor(entitiesDescriptor);
        } catch (JAXBException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

        return metaInfo;
    }

    protected EntityDescriptorType readEntityDescriptor(Reader metaInfoReader) {
        try {
            Unmarshaller unmarshaller = metaDataJaxbContext.createUnmarshaller();
            JAXBElement<?> o = (JAXBElement<?>) unmarshaller.unmarshal(metaInfoReader);
            EntityDescriptorType entityDescriptor = (EntityDescriptorType) o.getValue();
            return entityDescriptor;
        } catch (JAXBException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

        dialogueManager.detachDialogue();
    }

    private RequestAbstractType getSamlRequest(Document document) throws InvalidRequestException {
        try {
            Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
            @SuppressWarnings("unchecked")
            JAXBElement<RequestAbstractType> jaxbRequest = (JAXBElement<RequestAbstractType>) unmarshaller.unmarshal(document);
            RequestAbstractType request = jaxbRequest.getValue();
            return request;
        } catch (JAXBException e) {
            throw new InvalidRequestException("SAML message could not be parsed", e);
        }
View Full Code Here

        }
    }

    private StatusResponseType getSamlResponse(Document document) throws InvalidRequestException {
        try {
            Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
            @SuppressWarnings("unchecked")
            JAXBElement<StatusResponseType> jaxbResponseType = (JAXBElement<StatusResponseType>) unmarshaller.unmarshal(document);
            StatusResponseType statusResponse = jaxbResponseType.getValue();
            return statusResponse;
        } catch (JAXBException e) {
            throw new InvalidRequestException("SAML message could not be parsed", e);
        }
View Full Code Here

        if (jaxbContext == null) {
            // must use classloader from CamelContext to have JAXB working
            jaxbContext = JAXBContext.newInstance(Constants.JAXB_CONTEXT_PACKAGES, CamelContext.class.getClassLoader());
        }

        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        Object result = unmarshaller.unmarshal(is);

        if (result == null) {
            throw new IOException("Cannot unmarshal to routes using JAXB from input stream: " + is);
        }
View Full Code Here

    private void initializeRoot() {

        try {
            JAXBContext context = JAXBContext.newInstance(Root.class);
            Unmarshaller unmarshaller = context.createUnmarshaller();
            unmarshaller.setListener(new Listener() {
                @Override
                public void afterUnmarshal(Object target, Object parent) {
                    super.afterUnmarshal(target, parent);

                    if (parent instanceof Entry) {
                        ((Entry) target).setParent((Entry) parent);
                    }
                }
            });

            root = (Root) unmarshaller.unmarshal(TreeModelDataBean.class.getResource("tree-model-data.xml"));
        } catch (JAXBException e) {
            throw new FacesException(e.getMessage(), e);
        }
    }
View Full Code Here

    if (sqlResource == null) {
      final InputStream inputStream = getInputStream(resName);
      JAXBContext context;
      try {
        context = JAXBContext.newInstance(ObjectFactory.class);
        final Unmarshaller unmarshaller = context.createUnmarshaller();
        unmarshaller.setSchema(null);
        final SqlResourceDefinition definition = ((JAXBElement<SqlResourceDefinition>) unmarshaller
            .unmarshal(inputStream)).getValue();
        final SqlBuilder sqlBuilder = Factory.getSqlBuilder();
        sqlResource = new SqlResourceImpl(resName, definition, Factory.getSqlResourceMetaData(
            resName, definition, sqlBuilder), sqlBuilder, new ArrayList<Trigger>());
        sqlResources.put(resName, sqlResource);
View Full Code Here

TOP

Related Classes of javax.xml.bind.Unmarshaller

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.