Package javax.xml.bind

Examples of javax.xml.bind.Unmarshaller


    setSuffix("-vdb.xml"); //$NON-NLS-1$
  }

  @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


   }
  
   @Override
   protected TranslatorMetaDataGroup parse(VFSDeploymentUnit unit, VirtualFile file, TranslatorMetaDataGroup root) throws Exception {
    JAXBContext context = JAXBContext.newInstance(new Class[] {TranslatorMetaDataGroup.class});
      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<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

  static Unmarshaller getUnMarsheller() throws JAXBException, SAXException {
    JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {VDBMetaData.class});
    SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
    Schema schema = schemaFactory.newSchema(VDBMetaData.class.getResource("/vdb-deployer.xsd")); //$NON-NLS-1$
    Unmarshaller un = jc.createUnmarshaller();
    un.setSchema(schema);
    return un;
  }
View Full Code Here

        this.rangeName = rangeName;
    }

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

    StringWriter sw = new StringWriter();
    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

    marshell.marshal(vdb, sw);
       
    //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

  @WebMethod (operationName="listAlbums")
  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

          Crediential crediential,
          @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

  @XmlElement(namespace="http://www.metamatrix.com/metamodels/MetaMatrixFunction", name="ScalarFunction")
  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

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.