Examples of UnMarshaller


Examples of com.betfair.cougar.marshalling.api.databinding.UnMarshaller

        if (mediaType != null) {
            DataBindingFactory factory = DataBindingManager.getInstance().getFactory(mediaType);
            if(factory == null) {
                throw new CougarFrameworkException("Invalid content type " + mediaType);
            }
            UnMarshaller unMarshaller = factory.getUnMarshaller();
            return (RescriptBody)unMarshaller.unmarshall(inputStream,
                        bindingDescriptor.getBodyClass(),
                        encoding, false);
        }
        return null;
    }
View Full Code Here

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

Examples of javax.xml.bind.Unmarshaller

   }
  
   @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

Examples of javax.xml.bind.Unmarshaller

  }
 
  @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

Examples of javax.xml.bind.Unmarshaller

  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

Examples of javax.xml.bind.Unmarshaller

        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

Examples of javax.xml.bind.Unmarshaller

    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

Examples of javax.xml.bind.Unmarshaller

    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

Examples of javax.xml.bind.Unmarshaller

  @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

Examples of javax.xml.bind.Unmarshaller

          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
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.