Package javax.xml.bind

Examples of javax.xml.bind.Unmarshaller.unmarshal()


  }

  @Override
  protected VDBMetaData parse(VFSDeploymentUnit unit, VirtualFile file, VDBMetaData root) throws Exception {
    Unmarshaller un = VDBParserDeployer.getUnMarsheller();
    VDBMetaData vdb = (VDBMetaData)un.unmarshal(file.openStream());
   
    vdb.setUrl(unit.getRoot().toURL());
    vdb.setDynamic(true);
   
    LogManager.logDetail(LogConstants.CTX_RUNTIME,"VDB "+unit.getRoot().getName()+" has been parsed.")//$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here


         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<TranslatorMetaDataGroup> elem = um.unmarshal(source, TranslatorMetaDataGroup.class);
         TranslatorMetaDataGroup deployment = elem.getValue();
         return deployment;
      }     
      finally {
         if (is != null)
View Full Code Here

 
  @Override
  protected <U> U parse(VFSDeploymentUnit unit, Class<U> expectedType, VirtualFile file, Object root) throws Exception {
    if (expectedType.equals(VDBMetaData.class)) {
      Unmarshaller un = getUnMarsheller();
      VDBMetaData def = (VDBMetaData)un.unmarshal(file.openStream());
     
      return expectedType.cast(def);
    }
    else if (expectedType.equals(UDFMetaData.class)) {
      if (root == null) {
View Full Code Here

    }

    public <T> T getData(Class<T> clazz, String str) throws Exception {
        JAXBContext context = JAXBContext.newInstance(clazz);
        Unmarshaller u = context.createUnmarshaller();
        return (T) u.unmarshal(new FileReader(new File(folder, str)));
    }

    private void setFire(boolean b) {
        for (Dao dao : dataPool.getDaos()) {
            dao.setFirePropertyChange(b);
View Full Code Here

    marshell.marshal(group, sw);
       
    System.out.println(sw.toString());   
   
    Unmarshaller un = jc.createUnmarshaller();
    group = (TranslatorMetaDataGroup)un.unmarshal(new StringReader(sw.toString()));
   
    tm = group.getTranslators().get(0);
   
    assertEquals("Oracle", tm.getName());
    assertEquals("desc", tm.getDescription());
View Full Code Here

    //System.out.println(sw.toString());

    // UnMarshell
    Unmarshaller un = jc.createUnmarshaller();
    un.setSchema(schema);
    vdb = (VDBMetaData)un.unmarshal(new StringReader(sw.toString()));
   
    assertEquals("myVDB", vdb.getName()); //$NON-NLS-1$
    assertEquals("vdb description", vdb.getDescription()); //$NON-NLS-1$
    assertEquals(1, vdb.getVersion());
    assertEquals("vdb-value", vdb.getPropertyValue("vdb-property")); //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

  public @WebResult(name="albums") FeedType listAlbums(@WebParam(name = "crediential") Crediential crediential) {
    try {
      //TODO from JNDI property
      URL       albumURL   = new URL("http://picasaweb.google.com/data/feed/api/user/"+crediential.getUsername()+"?kind=album");
      Unmarshaller   um       = context.createUnmarshaller();
      FeedType ob = um.unmarshal(new StreamSource(albumURL.openStream()),FeedType.class).getValue();
      return ob;
    } catch (Exception e) {
      e.printStackTrace();
      throw new Error("Album request failed",e);
    }
View Full Code Here

          @WebParam(name = "albumUrl", partName = "albumUrl")
          String albumUrl) {
    try {
      URL       albumURL   = new URL(albumUrl);
      Unmarshaller   um       = context.createUnmarshaller();
      FeedType ob = um.unmarshal(new StreamSource(albumURL.openStream()),FeedType.class).getValue();
      return ob;
    } catch (Exception e) {
      e.printStackTrace();
      throw new Error("Album request failed",e);
    }
View Full Code Here

  List<FunctionMethod> functionMethods = new ArrayList<FunctionMethod>();
 
  public static List<FunctionMethod> loadFunctionMethods(InputStream source) throws JAXBException {
    JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {FunctionMetadataReader.class});
    Unmarshaller marshaller = jc.createUnmarshaller();
    FunctionMetadataReader md = (FunctionMetadataReader) marshaller.unmarshal(source);
    return md.functionMethods;
  }
 
}
View Full Code Here

            } else if (StreamSource.class.isAssignableFrom(callback.getSupportedFormats()[0])) {    
                obj = new StreamSource(getSOAPBodyStream(doc));
            } else if (Object.class.isAssignableFrom(callback.getSupportedFormats()[0])) {          
                JAXBContext context = callback.getJAXBContext();
                Unmarshaller u = context.createUnmarshaller();
                return u.unmarshal(doc);                   
            }
        } catch (Exception se) {
            se.printStackTrace();
        }
        return obj;
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.