Examples of XMBeanMetaData


Examples of org.jboss.test.xml.multispaced.XMBeanMetaData

      log.debug("--- " + getName());

      InputStream xmlIs = getResource("xml/multispaced/xmbean.xml");
      InputStreamReader xmlReader = new InputStreamReader(xmlIs);

      XMBeanMetaData xmbean = unmarshalXMBean(xmlReader);

      xmlReader.close();

      checkUnmarshalledXMBean(xmbean);
   }
View Full Code Here

Examples of org.jboss.test.xml.multispaced.XMBeanMetaData

      log.debug("--- " + getName());

      InputStream xmlIs = getResource("xml/multispaced/xmbean-localns.xml");
      InputStreamReader xmlReader = new InputStreamReader(xmlIs);

      XMBeanMetaData xmbean = unmarshalXMBean(xmlReader);

      xmlReader.close();

      checkUnmarshalledXMBean(xmbean);
   }
View Full Code Here

Examples of org.jboss.test.xml.multispaced.XMBeanMetaData

      AbstractMarshaller marshaller = (AbstractMarshaller)Marshaller.FACTORY.getInstance();
      marshaller.addRootElement("http://jboss.org/xmbean", "xmbean", "mbean");
      marshaller.declareNamespace("xmbean", "http://jboss.org/xmbean");
      marshaller.declareNamespace("jdbcpm", "http://jboss.org/xmbean/persistence/jdbc");

      XMBeanMetaData xmbean = createXMBeanMetaData();
      ObjectModelProvider provider = XMBeanMetaDataProvider.INSTANCE;

      ObjectModelProvider jdbcPmProvider = new JDBCPmMetaDataProvider((JDBCPm)xmbean.getPersistenceManager());
      marshaller.mapClassToGlobalElement(JDBCPm.class,
         "persistence-manager",
         "http://jboss.org/xmbean/persistence/jdbc",
         getResourceUrl("xml/multispaced/jdbcpm.xsd").toString(),
         jdbcPmProvider
      );

      marshaller.marshal(getResourceUrl("xml/multispaced/xmbean.xsd").toString(), provider, xmbean, strWriter);

      final String xml = strWriter.getBuffer().toString();
      log.debug("marshalled with " + marshaller.getClass().getName() + ": " + xml);

      StringReader xmlReader = new StringReader(xml);
      XMBeanMetaData unmarshalled = unmarshalXMBean(xmlReader);

      assertEquals(xmbean, unmarshalled);
   }
View Full Code Here

Examples of org.jboss.test.xml.multispaced.XMBeanMetaData

   }

   private XMBeanMetaData unmarshalXMBean(Reader xmlReader)
      throws Exception
   {
      XMBeanMetaData xmbean = new XMBeanMetaData();

      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      unmarshaller.mapFactoryToNamespace(JDBCPmMetaDataFactory.INSTANCE, "http://jboss.org/xmbean/persistence/jdbc");
      unmarshaller.unmarshal(xmlReader, XMBeanMetaDataFactory.INSTANCE, xmbean);
View Full Code Here

Examples of org.jboss.test.xml.multispaced.XMBeanMetaData

      assertEquals("xmbeans", pm.getTable());
   }

   private XMBeanMetaData createXMBeanMetaData()
   {
      XMBeanMetaData xmbean = new XMBeanMetaData();
      xmbean.setDescription("The JBoss XMBean version of the monitor server");
      xmbean.setMbeanClass("monitor.MonitorPOJO");

      XMBeanConstructorMetaData constructor = new XMBeanConstructorMetaData();
      constructor.setDescription("The no-arg constructor");
      constructor.setName("monitor.MonitorPOJO");
      xmbean.addConstructor(constructor);

      XMBeanAttributeMetaData attribute = new XMBeanAttributeMetaData();
      attribute.setAccess("read-write");
      attribute.setGetMethod("getInterval");
      attribute.setSetMethod("setInterval");
      attribute.setDescription("The interval in milliseconds between checks of VM memory and threads");
      attribute.setName("Interval");
      attribute.setType("int");
      xmbean.addAttribute(attribute);

      XMBeanOperationMetaData operation = new XMBeanOperationMetaData();
      operation.setDescription("Access the last HistoryLength monitor reports");
      operation.setName("history");
      operation.setReturnType("java.lang.String");
      xmbean.addOperation(operation);

      XMBeanNotificationMetaData notification = new XMBeanNotificationMetaData();
      notification.setDescription("A notification sent when the monitor interval expires");
      notification.setName("javax.management.Notification");
      notification.setNotificationType("monitor.IntervalElapsed");
      xmbean.addNotification(notification);

      JDBCPm pm = new JDBCPm();
      pm.setDatasource("java:/DefaultDS");
      pm.setTable("xmbeans");
      xmbean.setPersistenceManager(pm);

      return xmbean;
   }
View Full Code Here

Examples of org.jboss.test.xml.multispaced.XMBeanMetaData

   }

   private XMBeanMetaData unmarshalXMBean(Reader xmlReader)
      throws Exception
   {
      XMBeanMetaData xmbean = new XMBeanMetaData();

      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
      unmarshaller.mapFactoryToNamespace(JDBCPmMetaDataFactory.INSTANCE, "http://jboss.org/xmbean/persistence/jdbc");
      unmarshaller.unmarshal(xmlReader, XMBeanMetaDataFactory.INSTANCE, xmbean);
View Full Code Here

Examples of org.jboss.test.xml.multispaced.XMBeanMetaData

      assertEquals("xmbeans", pm.getTable());
   }

   private XMBeanMetaData createXMBeanMetaData()
   {
      XMBeanMetaData xmbean = new XMBeanMetaData();
      xmbean.setDescription("The JBoss XMBean version of the monitor server");
      xmbean.setMbeanClass("monitor.MonitorPOJO");

      XMBeanConstructorMetaData constructor = new XMBeanConstructorMetaData();
      constructor.setDescription("The no-arg constructor");
      constructor.setName("monitor.MonitorPOJO");
      xmbean.addConstructor(constructor);

      XMBeanAttributeMetaData attribute = new XMBeanAttributeMetaData();
      attribute.setAccess("read-write");
      attribute.setGetMethod("getInterval");
      attribute.setSetMethod("setInterval");
      attribute.setDescription("The interval in milliseconds between checks of VM memory and threads");
      attribute.setName("Interval");
      attribute.setType("int");
      xmbean.addAttribute(attribute);

      XMBeanOperationMetaData operation = new XMBeanOperationMetaData();
      operation.setDescription("Access the last HistoryLength monitor reports");
      operation.setName("history");
      operation.setReturnType("java.lang.String");
      xmbean.addOperation(operation);

      XMBeanNotificationMetaData notification = new XMBeanNotificationMetaData();
      notification.setDescription("A notification sent when the monitor interval expires");
      notification.setName("javax.management.Notification");
      notification.setNotificationType("monitor.IntervalElapsed");
      xmbean.addNotification(notification);

      JDBCPm pm = new JDBCPm();
      pm.setDatasource("java:/DefaultDS");
      pm.setTable("xmbeans");
      xmbean.setPersistenceManager(pm);

      return xmbean;
   }
View Full Code Here

Examples of org.jboss.test.xml.multispaced.XMBeanMetaData

      log.debug("--- " + getName());

      InputStream xmlIs = getResource("xml/multispaced/xmbean.xml");
      InputStreamReader xmlReader = new InputStreamReader(xmlIs);

      XMBeanMetaData xmbean = unmarshalXMBean(xmlReader);

      xmlReader.close();

      checkUnmarshalledXMBean(xmbean);
   }
View Full Code Here

Examples of org.jboss.test.xml.multispaced.XMBeanMetaData

      log.debug("--- " + getName());

      InputStream xmlIs = getResource("xml/multispaced/xmbean-localns.xml");
      InputStreamReader xmlReader = new InputStreamReader(xmlIs);

      XMBeanMetaData xmbean = unmarshalXMBean(xmlReader);

      xmlReader.close();

      checkUnmarshalledXMBean(xmbean);
   }
View Full Code Here

Examples of org.jboss.test.xml.multispaced.XMBeanMetaData

      AbstractMarshaller marshaller = (AbstractMarshaller)Marshaller.FACTORY.getInstance();
      marshaller.addRootElement("http://jboss.org/xmbean", "xmbean", "mbean");
      marshaller.declareNamespace("xmbean", "http://jboss.org/xmbean");
      marshaller.declareNamespace("jdbcpm", "http://jboss.org/xmbean/persistence/jdbc");

      XMBeanMetaData xmbean = createXMBeanMetaData();
      ObjectModelProvider provider = XMBeanMetaDataProvider.INSTANCE;

      ObjectModelProvider jdbcPmProvider = new JDBCPmMetaDataProvider((JDBCPm)xmbean.getPersistenceManager());
      marshaller.mapClassToGlobalElement(JDBCPm.class,
         "persistence-manager",
         "http://jboss.org/xmbean/persistence/jdbc",
         getResourceUrl("xml/multispaced/jdbcpm.xsd").toString(),
         jdbcPmProvider
      );

      marshaller.marshal(getResourceUrl("xml/multispaced/xmbean.xsd").toString(), provider, xmbean, strWriter);

      final String xml = strWriter.getBuffer().toString();
      log.debug("marshalled with " + marshaller.getClass().getName() + ": " + xml);

      StringReader xmlReader = new StringReader(xml);
      XMBeanMetaData unmarshalled = unmarshalXMBean(xmlReader);

      assertEquals(xmbean, unmarshalled);
   }
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.