Package org.jibx.runtime

Examples of org.jibx.runtime.IBindingFactory


            System.err.println("Root directory '" + args[1] + "' not found");
            System.exit(2);
        }
       
        // get the binding factory
        IBindingFactory factory = null;
        try {
            factory = BindingDirectory.getFactory("binding", args[0]);
        } catch (JiBXException e) {
            System.err.println("Binding factory not found - did you remember to compile the binding?");
            e.printStackTrace();
View Full Code Here


        String match = (version == null) ? m_versionTexts[0] : version;
        for (int i = 0; i < m_versionTexts.length; i++) {
            if (match.equals(m_versionTexts[i])) {
               
                // version found, create marshaller for the associated binding
                IBindingFactory fact = BindingDirectory.
                    getFactory(m_versionBindings[i], obj.getClass());
                MarshallingContext context =
                    (MarshallingContext)fact.createMarshallingContext();
               
                // configure marshaller for writing document
                context.setIndent(m_outputIndent);
                if (m_outputWriter == null) {
                    if (m_outputStream == null) {
View Full Code Here

        // look up version in defined list
        for (int i = 0; i < m_versionTexts.length; i++) {
            if (version.equals(m_versionTexts[i])) {
               
                // version found, create unmarshaller for the associated binding
                IBindingFactory fact = BindingDirectory.
                    getFactory(m_versionBindings[i], clas);
                UnmarshallingContext context =
                    (UnmarshallingContext)fact.createUnmarshallingContext();
               
                // return object unmarshalled using binding for document version
                context.setFromContext(m_context);
                return context.unmarshalElement();
               
View Full Code Here

    try {
     
            // note that you can use multiple bindings with the same class, in
            //  which case you need to use the getFactory() call that takes the
            //  binding name as the first parameter
            IBindingFactory bfact = BindingDirectory.getFactory(Customer.class);
           
            // unmarshal customer information from file
            IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
            FileInputStream in = new FileInputStream(args[0]);
            Customer customer = (Customer)uctx.unmarshalDocument(in, null);
           
            // you can add code here to alter the unmarshalled customer
           
      // marshal object back out to file (with nice indentation, as UTF-8)
      IMarshallingContext mctx = bfact.createMarshallingContext();
      mctx.setIndent(2);
      FileOutputStream out = new FileOutputStream(args[1]);
      mctx.marshalDocument(customer, "UTF-8", null, out);
     
    } catch (FileNotFoundException e) {
View Full Code Here

          sColName = oMDat.getColumnName(c).toLowerCase();
          if (sColName.equalsIgnoreCase(DB.tx_journal)) {
        try {
        Reader oRdr = oRSet.getCharacterStream(c);
              if (!oRSet.wasNull()) {
            IBindingFactory bfact = BindingDirectory.getFactory(NewsGroupJournal.class);
            IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
                oJournal = (NewsGroupJournal) uctx.unmarshalDocument (oRdr);
            oRdr.close();
                put(DB.tx_journal, oRSet.getString(c));
          } else {
              oJournal = null;
View Full Code Here

      DebugFile.incIdent();
    }

    if (sEnc==null) sEnc="UTF-8";

    IBindingFactory bfact = BindingDirectory.getFactory(Menu.class);
    IUnmarshallingContext uctx = bfact.createUnmarshallingContext();

    final int BUFFER_SIZE = 28000;
    FileInputStream oFileStream = new FileInputStream(sXMLDocPath);
    BufferedInputStream oXMLStream = new BufferedInputStream(oFileStream, BUFFER_SIZE);
View Full Code Here

    String sResponse = readfilestr(sUrl,"UTF-8");

  StringBufferInputStream oResponse = new StringBufferInputStream(sResponse);

    IBindingFactory bfact = BindingDirectory.getFactory(CalendarResponse.class);
    IUnmarshallingContext uctx = bfact.createUnmarshallingContext();

    oCalRsp = (CalendarResponse) uctx.unmarshalDocument (oResponse, "UTF-8");

  return oCalRsp;
  } // get
View Full Code Here

    YSearchResponse oYsr = null;
  URL oUrl = new URL("http://boss.yahooapis.com/ysearch/web/v1/"+Gadgets.URLEncode(sQuery)+
                   "?appid="+sKey+"&format=xml&type=html&style=raw"+
                  (sSites==null ? "" : "&sites="+sSites));
  try {
    IBindingFactory oIbf = BindingDirectory.getFactory(YSearchResponse.class);
    IUnmarshallingContext oUmc = oIbf.createUnmarshallingContext();

    ByteArrayOutputStream oOst = new ByteArrayOutputStream();
    DataHandler oHnd = new DataHandler(oUrl);
    oHnd.writeTo(oOst);
    ByteArrayInputStream oIst = new ByteArrayInputStream(oOst.toByteArray());
View Full Code Here

  @Qualifier("beansFeatureInfo")
  private FeatureInfo featureInfo;

  @Test
  public void testSingleStyle() throws JiBXException, LayerException {
    IBindingFactory bfact = BindingDirectory.getFactory(StyledLayerDescriptorInfo.class);
    IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
    Object object = uctx.unmarshalDocument(getClass().getResourceAsStream("/org/geomajas/testdata/sld/single_layer_no_stylename.sld"), null);
    StyledLayerDescriptorInfo sld = (StyledLayerDescriptorInfo) object;
    NamedStyleInfo info = styleConverterService.convert(sld, featureInfo, "layer", "style");
    Assert.assertNotNull(info);
    Assert.assertEquals("Some title", info.getName());
View Full Code Here

    Assert.assertEquals("Some title", info.getName());
  }
 
  @Test
  public void testPickStyle() throws JiBXException, LayerException {
    IBindingFactory bfact = BindingDirectory.getFactory(StyledLayerDescriptorInfo.class);
    IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
    Object object = uctx.unmarshalDocument(getClass().getResourceAsStream("/org/geomajas/testdata/sld/multiple_layer_stylename.sld"), null);
    StyledLayerDescriptorInfo sld = (StyledLayerDescriptorInfo) object;
    NamedStyleInfo info1 = styleConverterService.convert(sld, featureInfo, "Layer1", "Style1");
    Assert.assertNotNull(info1);
    Assert.assertEquals("Style1", info1.getName());
View Full Code Here

TOP

Related Classes of org.jibx.runtime.IBindingFactory

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.