Package nexj.core.meta.xml

Examples of nexj.core.meta.xml.XMLMetadataExporter


         try
         {
            fosStream = new FileOutputStream(new File(m_outputDir, clazz.getName() + ".meta"));
            xmlWriter = new IndentingXMLWriter(new OutputStreamWriter(new BufferedOutputStream(fosStream), XMLUtil.ENCODING));

            new XMLMetadataExporter(xmlWriter).exportMetaclass(clazz);
         }
         finally
         {
            closeOutput(fosStream, xmlWriter);
         }
View Full Code Here


         {
            s_logger.debug("Writing relational database metadata \"" + m_database.getName() +
               "\" to file \"" + file.toString() + "\"");
         }

         new XMLRelationalMetadataExporter(new XMLMetadataExporter(swriter)).exportDatabase(m_database);
         writer.write(XMLUtil.formatXML(swriter.toString()));
      }
      finally
      {
         if (manager != null)
View Full Code Here

            {
               s_logger.debug("Writing class \"" + metaclass.getName() +
                  "\" to file \"" + file.toString() + "\"");
            }

            new XMLMetadataExporter(swriter).exportMetaclass(metaclass);
            writer.write(XMLUtil.formatXML(swriter.toString()));
         }
         finally
         {
            writer.close();
View Full Code Here

            }
            while (newFile.exists());
         }

         StringWriter sw = new StringWriter();
         XMLMetadataExporter exporter = new XMLMetadataExporter(sw);
         Writer writer = null;
        
         try
         {
            exporter.exportMessage(msg);
           
            String sContents = sw.toString();

            sw = null;
            sContents = XMLUtil.formatXML(sContents);
View Full Code Here

      Map messageRegistry = XSDMessageImporterTest.getMessageRegistry(MessageAdapterTest.class.getResource("invalidmessagenames.xsd"));

      Message tableMessage = (Message)messageRegistry.get("Table");     

      StringWriter writer = new StringWriter();
      XMLMetadataExporter exporter = new XMLMetadataExporter(writer);
      exporter.exportMessage(tableMessage);
     
      TransferObject table = new TransferObject();
      TransferObject row = new TransferObject();
      table.setValue("a_b", row);
      row.setValue("isConfirmedBySourceOwner", Boolean.FALSE);
View Full Code Here

   {
      Map msgRegistry = getMessageRegistry(XSDMessageImporterTest.class.getResource("duplicateelements.xsd"));

      Message msg = (Message)msgRegistry.get("validTime");
      StringWriter writer = new StringWriter();
      XMLMetadataExporter exporter = new XMLMetadataExporter(writer);
      exporter.exportMessage(msg);

      // Check result
      assertEquals("validTime", msg.getName());

      CompositeMessagePart comp = msg.getRoot();
View Full Code Here

   public void testComplexType() throws Exception
   {
      Map msgRegistry = getMessageRegistry(XSDMessageImporterTest.class.getResource("complextype.xsd"));
      Message msg = (Message)msgRegistry.get("validTime");
      StringWriter writer = new StringWriter();
      XMLMetadataExporter exporter = new XMLMetadataExporter(writer);
      exporter.exportMessage(msg);

      // Check result
      assertEquals("validTime", msg.getName());

      CompositeMessagePart comp = msg.getRoot();

      assertEquals(1, comp.getPartCount());
      comp = (CompositeMessagePart)comp.getPart(0);
      assertEquals("elemwithtypereferral", comp.getName());
      assertTrue(comp instanceof CompositeMessagePartRef);
      comp = ((CompositeMessagePartRef)comp).getRefPart();

      msg = (Message)msgRegistry.get("IVL_TS");
      assertNotNull(msg);
      assertSame(comp, msg.getRoot());
      assertEquals(1, comp.getPartCount());
      assertEquals("low", comp.getPart(0).getName());
      assertEquals(Primitive.ANY_ORDINAL, ((PrimitiveMessagePart)comp.getPart(0)).getType().getOrdinal());

      // Test export
      writer = new StringWriter();
      exporter = new XMLMetadataExporter(writer);
      exporter.exportMessage(msg);
   }
View Full Code Here

   {
      Map msgRegistry = getMessageRegistry(XSDMessageImporterTest.class.getResource("duplicaterootelements.xsd"));

      Message msg = (Message)msgRegistry.get("PostalAddress");
      StringWriter writer = new StringWriter();
      XMLMetadataExporter exporter = new XMLMetadataExporter(writer);
      exporter.exportMessage(msg);

      Element root = XMLUtil.parse(new StringReader(writer.toString())).getDocumentElement();
      assertEquals("Address", root.getAttribute("ref"));

      // Check result
      CompositeMessagePart comp = msg.getRoot();

      assertTrue(comp instanceof CompositeMessagePartRef);

      msg = (Message)msgRegistry.get("Address");
      assertNotNull(msg);

      comp = msg.getRoot();
      assertTrue(comp instanceof CompositeMessagePartInstance);
      assertEquals(1, comp.getPartCount());
      assertEquals("addr", comp.getPart(0).getName());
      assertTrue(comp.getPart(0) instanceof CompositeMessagePartRef);
      assertSame(comp, ((CompositeMessagePartRef)comp.getPart(0)).getRefPart());


      // Test export
      writer = new StringWriter();
      exporter = new XMLMetadataExporter(writer);
      exporter.exportMessage(msg);

      //System.err.println(XMLUtil.formatXML(writer.toString()));
   }
View Full Code Here

   public void testTable() throws Exception
   {
      Message tableMessage = getMessage("Table");    
      StringWriter writer = new StringWriter();
      XMLMetadataExporter exporter = new XMLMetadataExporter(writer);
      exporter.exportMessage(tableMessage);
     
      assertEquals(tableMessage.getRoot().getPartCount(), 2);
      CompositeMessagePart rowPart = (CompositeMessagePart)tableMessage.getRoot().getPart("Row");
      PrimitiveMessagePart namePart = (PrimitiveMessagePart)rowPart.getPart("name");
      assertEquals(namePart.getType(), Primitive.STRING);
      PrimitiveMessagePart timePart = (PrimitiveMessagePart)rowPart.getPart("time");
      assertEquals(timePart.getType(), Primitive.LONG);
      PrimitiveMessagePart booleanPart = (PrimitiveMessagePart)rowPart.getPart("required");
      assertEquals(booleanPart.getType(), Primitive.BOOLEAN);
      PrimitiveMessagePart enumPart = (PrimitiveMessagePart)rowPart.getPart("type");
      assertEquals(enumPart.getType(), Primitive.STRING);
      assertEquals( enumPart.getEnumerationCount(), 10);

      //System.err.println(XMLUtil.formatXML(writer.toString()));
     
      Message recursiveElement = getMessage("recursiveElement");
     
      MessagePart elem2 = recursiveElement.getRoot().getPart("recursiveElement2");
     
      assertTrue(elem2 instanceof CompositeMessagePartRef);
     
      CompositeMessagePartRef msgRef = (CompositeMessagePartRef)elem2;
     
      assertEquals("recursiveElement2", msgRef.getName());
      assertEquals(msgRef.getRefPart(), getMessage("recursiveElement2").getRoot());
     
      writer = new StringWriter();
      exporter = new XMLMetadataExporter(writer);
      exporter.exportMessage(recursiveElement);
   }
View Full Code Here

TOP

Related Classes of nexj.core.meta.xml.XMLMetadataExporter

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.