Examples of Unmarshaller


Examples of javax.xml.bind.Unmarshaller

     *   javax.wsdl.extensions.ExtensionRegistry)
     */
    public ExtensibilityElement unmarshall(Class parent, QName qname, Element element, Definition wsdl,
                                           ExtensionRegistry registry) throws WSDLException {
        try {
            Unmarshaller u = context.createUnmarshaller();
       
            Object o = u.unmarshal(element);
            if (o instanceof JAXBElement<?>) {
                JAXBElement<?> el = (JAXBElement<?>)o;
                o = el.getValue();
            }
           
View Full Code Here

Examples of javax.xml.bind.Unmarshaller

        Class cls[] = new Class[] {
            ObjectFactory.class,
            org.objectweb.celtix.ws.addressing.wsdl.ObjectFactory.class
        };
        JAXBContext context = JAXBContext.newInstance(cls);
        Unmarshaller u = context.createUnmarshaller();

        EndpointReferenceType ref = (EndpointReferenceType)
                                    ((JAXBElement<?>)u.unmarshal(
                                        getClass().getResource("resources/reference2.xml"))).getValue();

        Definition def = EndpointReferenceUtils.getWSDLDefinition(manager,
                                                                  ref);
        assertNotNull("Could not load wsdl", def);
View Full Code Here

Examples of javax.xml.bind.Unmarshaller

      return group;
   }
   public static ManagedConnectionFactoryDeploymentGroup unmarshalResource(String resourceName) throws Exception
   {
      JAXBContext ctx = JAXBContext.newInstance(CTX_CLASS);
      Unmarshaller um = ctx.createUnmarshaller();
      Document d = getDocumentForResource(resourceName);
      JAXBElement<ManagedConnectionFactoryDeploymentGroup> elem = um.unmarshal(d, ManagedConnectionFactoryDeploymentGroup.class);
      ManagedConnectionFactoryDeploymentGroup group = elem.getValue();
      //      ManagedConnectionFactoryDeploymentGroup group = elem.getValue();
      return group;     
   }
View Full Code Here

Examples of javax.xml.bind.Unmarshaller

   }
  
   public static ManagedConnectionFactoryDeploymentGroup unmarshalSource(String content) throws Exception
   {
      JAXBContext ctx = JAXBContext.newInstance(CTX_CLASS);
      Unmarshaller um = ctx.createUnmarshaller();
      StringReader r = new StringReader(content);
      InputSource is = new InputSource(r);
      Source s = new SAXSource(is);
      JAXBElement<ManagedConnectionFactoryDeploymentGroup> elem = um.unmarshal(s, ManagedConnectionFactoryDeploymentGroup.class);
      ManagedConnectionFactoryDeploymentGroup group = elem.getValue();
      return group;
   }
View Full Code Here

Examples of javax.xml.bind.Unmarshaller

   protected <T> T loadAttachment(File attachmentsStore, Class<T> expected) throws Exception
   {
      if(log.isTraceEnabled())
         log.trace("loadAttachment, attachmentsStore=" + attachmentsStore);
      JAXBContext ctx = JAXBContext.newInstance(expected);
      Unmarshaller unmarshaller = ctx.createUnmarshaller();
      InputStream is = new FileInputStream(attachmentsStore);
      try
      {
         return (T) unmarshaller.unmarshal(is);
      }
      finally
      {
         is.close();
      }
View Full Code Here

Examples of javax.xml.bind.Unmarshaller

  
   @Override
   protected ManagedConnectionFactoryDeploymentGroup parse(VFSDeploymentUnit unit, VirtualFile file, ManagedConnectionFactoryDeploymentGroup root) throws Exception
   {
      //TODO do we need to this every time?
      Unmarshaller um = context.createUnmarshaller();     
      InputStream is = file.openStream();

      try
      {
         InputSource input = new InputSource(is);
         input.setSystemId(file.toURI().toString());
         XMLReader reader = XMLReaderFactory.createXMLReader();
         reader.setEntityResolver(new JBossEntityResolver());
         SAXSource source = new SAXSource(reader, input);
         JAXBElement<ManagedConnectionFactoryDeploymentGroup> elem = um.unmarshal(source, ManagedConnectionFactoryDeploymentGroup.class);
         ManagedConnectionFactoryDeploymentGroup deployment = elem.getValue();
         repository.addManagedConnectionFactoryDeploymentGroup(deployment);
         return deployment;
      }     
      finally
View Full Code Here

Examples of javax.xml.bind.Unmarshaller

   }

   @Override
   protected Object parse(VFSDeploymentUnit unit, VirtualFile file, Object root) throws Exception
   {
      Unmarshaller unmarshaller = context.createUnmarshaller();
      InputStream is = openStreamAndValidate(file);
      try
      {
         InputSource source = new InputSource(is);
         source.setSystemId(file.toURI().toString());
         Object o = unmarshaller.unmarshal(source);
         return getOutput().cast(o);
      }
      finally
      {
         try
View Full Code Here

Examples of javax.xml.bind.Unmarshaller

      XMLReader reader = XMLReaderFactory.createXMLReader();
      reader.setEntityResolver(new JBossEntityResolver());
      SAXSource source = new SAXSource(reader, input);
      // New JAXB context
      JAXBContext context = JAXBContext.newInstance(ManagedConnectionFactoryDeploymentGroup.class);
      Unmarshaller um = context.createUnmarshaller();
      // Unmarshal
      JAXBElement<ManagedConnectionFactoryDeploymentGroup> elem = um.unmarshal(source,
            ManagedConnectionFactoryDeploymentGroup.class);
      return elem.getValue();
   }
View Full Code Here

Examples of javax.xml.bind.Unmarshaller

   }
  
   protected PersistenceRoot deserialize(File file) throws Exception
   {
      JAXBContext ctx = JAXBContext.newInstance(PersistenceRoot.class);
      Unmarshaller unmarshaller = ctx.createUnmarshaller();
      return (PersistenceRoot) unmarshaller.unmarshal(file);
   }
View Full Code Here

Examples of javax.xml.bind.Unmarshaller

      throws IOException {
    try {
      InputPart rootPart = xopPackage.getRootPart();
      JAXBContext jaxb = findJAXBContext(type, annotations, rootPart
          .getMediaType(), true);
      Unmarshaller unmarshaller = jaxb.createUnmarshaller();
      unmarshaller
          .setAttachmentUnmarshaller(new XopAttachmentUnmarshaller(
              xopPackage));
      return unmarshaller.unmarshal(new StreamSource(rootPart.getBody(
          InputStream.class, null)));
    } catch (JAXBException e) {
      Response response = Response.serverError().build();
      throw new WebApplicationException(e, response);
    }
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.