Package javax.xml.bind

Examples of javax.xml.bind.JAXBContext.createUnmarshaller()


    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);
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(
View Full Code Here

         throw new RuntimeException(e);
      }
      JAXBElement<?> result;
      try
      {
         Unmarshaller unmarshaller = jaxb.createUnmarshaller();
         JAXBElement<?> e = unmarshaller.unmarshal(new StreamSource(entityStream), (Class<?>) typeArg);
         result = e;
      }
      catch (JAXBException e)
      {
View Full Code Here

                     InputStream entityStream) throws IOException
   {
      try
      {
         JAXBContext jaxb = findJAXBContext(type, annotations, mediaType, true);
         Unmarshaller unmarshaller = jaxb.createUnmarshaller();
         unmarshaller = decorateUnmarshaller(type, annotations, mediaType, unmarshaller);
         return (T) unmarshaller.unmarshal(new StreamSource(entityStream));
      }
      catch (JAXBException e)
      {
View Full Code Here

   public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException
   {
      try
      {
         JAXBContext jaxb = findJAXBContext(type, annotations, mediaType, true);
         Unmarshaller unmarshaller = jaxb.createUnmarshaller();
         Object obj = unmarshaller.unmarshal(entityStream);
         if (obj instanceof JAXBElement)
         {
            JAXBElement element = (JAXBElement) obj;
            return element.getValue();
View Full Code Here

  private JaxbHibernateConfiguration unmarshal(XMLStreamReader staxReader, final Origin origin) {
    final Object target;
    final ContextProvidingValidationEventHandler handler = new ContextProvidingValidationEventHandler();
    try {
      JAXBContext jaxbContext = JAXBContext.newInstance( JaxbHibernateConfiguration.class );
      Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
      unmarshaller.setSchema( schema() );
      unmarshaller.setEventHandler( handler );
      target = unmarshaller.unmarshal( staxReader );
      return (JaxbHibernateConfiguration) target;
    }
View Full Code Here

            final InputStream in = getConfigurationStream(getConfig());
            if (in == null) {
                return;
            }
            final JAXBContext context = JAXBContext.newInstance(FeatureDescriptors.class);
            final Unmarshaller unmarshaller = context.createUnmarshaller();
            final FeatureDescriptors descriptors = (FeatureDescriptors) unmarshaller
                    .unmarshal(in);

            cache.clear();
            if (descriptors != null && descriptors.getFeatures() != null)
View Full Code Here

            javax.xml.validation.Schema schema = sf.newSchema(
                GenerationTool.class.getResource("/xsd/" + Constants.XSD_CODEGEN)
            );

            JAXBContext ctx = JAXBContext.newInstance(Configuration.class);
            Unmarshaller unmarshaller = ctx.createUnmarshaller();
            unmarshaller.setSchema(schema);
            unmarshaller.setEventHandler(new ValidationEventHandler() {
                @Override
                public boolean handleEvent(ValidationEvent event) {
                    log.warn("Unmarshal warning", event.getMessage());
View Full Code Here

            exception = new ManifoldCFException("FetchTokensThread error - interface returned incorrect return code for: " + url + " - " + response.getStatusLine().toString());
            return;
          }
          JAXBContext context;
          context = JAXBContext.newInstance(Auth.class);
          Unmarshaller m = context.createUnmarshaller();
          auth = (Auth) m.unmarshal(response.getEntity().getContent());
        } catch (JAXBException ex) {
          exception = ex;
        } finally {
          EntityUtils.consume(response.getEntity());
View Full Code Here

            exception = new ManifoldCFException("addSeedDocuments error - interface returned incorrect return code for: " + url + " - " + response.getStatusLine().toString());
            return;
          }
          JAXBContext context;
          context = JAXBContext.newInstance(Items.class);
          Unmarshaller m = context.createUnmarshaller();
          Items items = (Items) m.unmarshal(response.getEntity().getContent());
          if (items.items != null) {
            for (Item item : items.items) {
              documentCache.put(item.id, item);
              for (int i = 0; i < versions.length; i++) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.