Package org.exolab.castor.xml

Examples of org.exolab.castor.xml.Unmarshaller.unmarshal()


      BufferedReader reader = new BufferedReader(new InputStreamReader(stream));

      Unmarshaller unmarshaller = context.createUnmarshaller();
      unmarshaller.setClass(DatabaseUpgradeQueries.class);
     
      databaseUpgradeQueries = (DatabaseUpgradeQueries) unmarshaller.unmarshal(reader);
  }
 
  public DatabaseUpgradeRecord[] getDatabaseUpgradeRecords() {
    return databaseUpgradeQueries.getDatabaseUpgradeRecord();
  }
View Full Code Here


        Unmarshaller unmarshaller = new Unmarshaller(portletXMLMapping);
        unmarshaller.setIgnoreExtraElements(true);
        unmarshaller.setEntityResolver(this.resolver);
        unmarshaller.setValidation(false);
        PortletApplicationDefinitionImpl portletApp =
            (PortletApplicationDefinitionImpl) unmarshaller.unmarshal(portletXml);

        WebApplicationDefinitionImpl webApp = null;

        if (webXml.getByteStream() != null) {
            unmarshaller = new Unmarshaller(webXMLMapping);
View Full Code Here

        if (webXml.getByteStream() != null) {
            unmarshaller = new Unmarshaller(webXMLMapping);
            unmarshaller.setIgnoreExtraElements(true);
            unmarshaller.setEntityResolver(this.resolver);
            unmarshaller.setValidation(false);
            webApp = (WebApplicationDefinitionImpl) unmarshaller.unmarshal(webXml);

            Vector structure = new Vector();
            structure.add(portletApp);
            structure.add("/" + webModule);
View Full Code Here

   
    public Object getObject(InputStream stream, Map parameters) throws ConverterException {
        try {
            ReferenceFieldHandler.setObjectMap((Map)parameters.get(ProfileLS.PARAMETER_OBJECTMAP));
            Unmarshaller unmarshaller = new Unmarshaller((Mapping)this.mappings.get(parameters.get(ProfileLS.PARAMETER_PROFILETYPE)));
            Object result = unmarshaller.unmarshal(new InputSource(stream));
            stream.close();
            return result;
        } catch (MappingException e) {
            throw new ConverterException("Can't create Unmarshaller", e);
        } catch (Exception e) {
View Full Code Here

    _dbUrl = confUrl.toString();
 
      _jdo.setTransactionManager("java:/TransactionManager");
      _jdo.setConfiguration( _dbUrl );
      unm = new Unmarshaller(org.exolab.castor.jdo.conf.Database.class);
      database = (org.exolab.castor.jdo.conf.Database) unm.unmarshal(new InputSource( _dbUrl ));
      _jdo.setDatabaseName(database.getName());
      if (database.getJndi() != null) {
         _dataSourceName = database.getJndi().getName();
      }
      // Older Castor versions older don't have these methods,
View Full Code Here

        Unmarshaller unm = new Unmarshaller(Database.class);

        unm.setEntityResolver(new DTDResolver());

        try {
            _database = (Database) unm.unmarshal(
                    new InputSource(new URL(databaseURL).openStream()));
        } catch (Exception except) {
            throw new DTXException(except);
        }
View Full Code Here

        Mapping[] mappings = _database.getMapping();

        for (int i = 0; i < mappings.length; ++i) {
            try {
            URL mappingURL = new URL(new URL(databaseURL), mappings[i].getHref());
            MappingRoot mr = (MappingRoot) munm.unmarshal(new InputSource(mappingURL.openStream()));
            ClassMapping[] classMaps = mr.getClassMapping();

            for (int j = 0; j < classMaps.length; j++) {
                _classMappings.put(classMaps[j].getName(), classMaps[j]);
            }
View Full Code Here

                ClassLoader cl = ClassLoader.getSystemClassLoader();
                _mapping.loadMapping(cl.getResource("org/exolab/castor/gui/Queryanlyser.xml"));
                unmarshaller.setMapping(_mapping);

                FileReader reader = new FileReader("queryhistory.xml");
                _qhistory = (QueryHistory) unmarshaller.unmarshal(reader);
            } catch (Exception e) {
                e.printStackTrace();
                // if there is no file, it's ok also
                // then we have an empty History
            }
View Full Code Here

            = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
            + "<bean attribute=\"999\">"
            + "<element>element of 999</element>"
            + "</bean>";
   
        Bean bean = (Bean) unmarshaller.unmarshal(new StringReader(input));
        assertNotNull(bean);
        assertEquals(999, bean.getAttribute().intValue());
        assertEquals("element of 999", bean.getElement());
        assertNull(bean.getReference());
    }
View Full Code Here

            + "<reference attribute=\"999\">"
            + "<element>element of 999</element>"
            + "</reference>"
            + "</bean>";
   
        Bean referer = (Bean) unmarshaller.unmarshal(new StringReader(input));
        assertNotNull(referer);
        assertEquals(100, referer.getAttribute().intValue());
        assertEquals("element of 100", referer.getElement());
        assertNotNull(referer.getReference());
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.