Package javax.xml.bind

Examples of javax.xml.bind.JAXBContext


      setBuildManagedObject(true);
   }
  
   @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());
View Full Code Here


      throw new IllegalArgumentException("Cannot match arguments: expectedClass=" + expectedType ); //$NON-NLS-1$
    }   
  }

  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

   
    group.addTranslator(translator);
       
    // Now use JAXB and write the file.
    Class[] classes = { TranslatorMetaDataGroup.class };
    JAXBContext context = JAXBContext.newInstance(classes);
    Marshaller marshaller = context.createMarshaller();
    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,new Boolean(true));

    FileWriter fw = null;
    try {
      fw = new FileWriter(dsXml);
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

     * document form.
     * @return an XML document of this PlanNode
     */
    public String toXml() {
      try {
        JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {PlanNode.class});
      Marshaller marshaller = jc.createMarshaller();
      marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE); //$NON-NLS-1$
      StringWriter writer = new StringWriter();
      marshaller.marshal(this, writer);
      return writer.toString();
      } catch (JAXBException e) {
View Full Code Here

    tm.setExecutionFactoryClass(ExecutionFactory.class);
    tm.setName("Oracle");
    tm.setDescription("desc");
    tm.addProperty("ExtensionTranslationClassName", "org.teiid.translator.jdbc.oracle.OracleSQLTranslator");
   
    JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {TranslatorMetaDataGroup.class});
    Marshaller marshell = jc.createMarshaller();
    marshell.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,new Boolean(true));
   
    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());
View Full Code Here

   
    vdb.addDataPolicy(roleOne);
   
    SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        Schema schema = schemaFactory.newSchema(VDBMetaData.class.getResource("/vdb-deployer.xsd"));      //$NON-NLS-1$
    JAXBContext jc = JAXBContext.newInstance(new Class<?>[] {VDBMetaData.class});
    Marshaller marshell = jc.createMarshaller();
    marshell.setSchema(schema);
    marshell.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,new Boolean(true));
   
    StringWriter sw = new StringWriter();
    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$
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

        AddressingPropertiesImpl maps = getMAPs(exposeAs, outbound);
        SOAPMessage message = control.createMock(SOAPMessage.class);
        context.getMessage();
        EasyMock.expectLastCall().andReturn(message);
        SOAPHeader header = setUpSOAPHeader(context, message, outbound);
        JAXBContext jaxbContext = control.createMock(JAXBContext.class);
        ContextUtils.setJAXBContext(jaxbContext);
        VersionTransformer.Names200408.setJAXBContext(jaxbContext);
        if (outbound) {
            setUpEncode(context,
                        message,
View Full Code Here

               && ContextUtils.isRequestor(context)
               && !body.getChildElements().hasNext();
    }
   
    private Marshaller getMarshaller() throws JAXBException {
        JAXBContext jaxbContext =
            VersionTransformer.getExposedJAXBContext(currentNamespaceURI);
        Marshaller marshaller = jaxbContext.createMarshaller();
        marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
        return marshaller;
    }
View Full Code Here

TOP

Related Classes of javax.xml.bind.JAXBContext

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.