Example usage for javax.xml.bind JAXBException printStackTrace

List of usage examples for javax.xml.bind JAXBException printStackTrace

Introduction

In this page you can find the example usage for javax.xml.bind JAXBException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this JAXBException and its stack trace (including the stack trace of the linkedException if it is non-null) to System.err .

Usage

From source file:org.megam.deccanplato.provider.zoho.invoice.handler.ItemImpl.java

/**
 * this method update a particular item in zoho invoice and returns updated item details.
 * This method takes input as a MAP(contains json dada) and returns a MAP.
 * @param outMap /*from  w  w w . ja v  a 2 s .co m*/
 */
private Map<String, String> update(Map<String, String> outMap) {

    final String ZOHO_INVOICE_ITEM_UPDATE_URL = ZOHO_INVOICE_ITEM + "update";

    Item itm = new Item();
    itm.setItemID(args.get(ID));
    itm.setName(args.get(ITEM_NAME));
    itm.setDescription(args.get(DESCRIPTION));
    itm.setRate(args.get(RATE));
    itm.setTax1Name(args.get(TAX_NAME_1));
    String xmlout = null;
    try {
        xmlout = itm.toXMLString();
    } catch (JAXBException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    List<NameValuePair> updateAttrList = new ArrayList<NameValuePair>();
    updateAttrList.add(new BasicNameValuePair(OAUTH_TOKEN, args.get(AUTHTOKEN)));
    updateAttrList.add(new BasicNameValuePair(ZOHO_SCOPE, SCOPE));
    updateAttrList.add(new BasicNameValuePair(ZOHO_XMLSTRING, xmlout));
    updateAttrList.add(new BasicNameValuePair(APIKEY, args.get(APIKEY)));

    TransportTools tst = new TransportTools(ZOHO_INVOICE_ITEM_UPDATE_URL, updateAttrList);
    String responseBody = null;

    TransportResponse response = null;

    try {
        response = TransportMachinery.post(tst);
    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    responseBody = response.entityToString();

    outMap.put(OUTPUT, responseBody);
    return outMap;

}

From source file:org.megam.deccanplato.provider.zoho.invoice.handler.PaymentImpl.java

/**
 * this method creates a payment in zoho invoice and returns that payment details.
 * and it uses the business support class Payment to populate ZOHO INVOICE XML input
 * This method takes input as a MAP(contains json dada) and returns a MAP.
 * @param outMap /*from  w w  w .j  ava2 s  . com*/
 */
private Map<String, String> create(Map<String, String> outMap) {

    final String ZOHO_INVOICE_PAYMENT_CREATE_URL = ZOHO_INVOICE_PAYMENT + "create";
    Payment payment = new Payment();
    payment.setInvoiceID(args.get(INVOICE_ID));
    payment.setMode(args.get(MODE));
    payment.setDescription(args.get(DESCRIPTION));
    payment.setDate(args.get(DATE));
    payment.setExchangeRate(args.get(EXCHANGE_RATE));
    payment.setAmount(args.get(AMOUNT));
    String xmlout = null;
    try {
        xmlout = payment.toXMLString();
    } catch (JAXBException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    List<NameValuePair> createAttrList = new ArrayList<NameValuePair>();
    createAttrList.add(new BasicNameValuePair(OAUTH_TOKEN, args.get(AUTHTOKEN)));
    createAttrList.add(new BasicNameValuePair(ZOHO_SCOPE, SCOPE));
    createAttrList.add(new BasicNameValuePair(ZOHO_XMLSTRING, xmlout));
    createAttrList.add(new BasicNameValuePair(APIKEY, args.get(APIKEY)));

    TransportTools tst = new TransportTools(ZOHO_INVOICE_PAYMENT_CREATE_URL, createAttrList);
    String responseBody = null;

    TransportResponse response = null;

    try {
        response = TransportMachinery.post(tst);
    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    responseBody = response.entityToString();

    outMap.put(OUTPUT, responseBody);
    return outMap;
}

From source file:com.ibm.opensirf.jaxrs.ObjectApi.java

@DELETE
@Path("container/{containername}/{po}/data")
public Response deletePOAndMetadata(@PathParam("containername") String containerName,
        @PathParam("po") String poName) throws IOException, URISyntaxException {

    JCloudsApi jcloudsSwift = new JCloudsApi();
    InputStream is = jcloudsSwift.getFileInputStream(containerName, SIRFContainer.SIRF_DEFAULT_CATALOG_ID);
    SIRFCatalog catalog = null;/*from  www . ja  v a  2 s .  com*/

    try {
        catalog = new SIRFCatalogUnmarshaller("application/json").unmarshalCatalog(is);
        jcloudsSwift.close();
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (JAXBException jbe) {
        jbe.printStackTrace();
    }

    try {
        catalog.getSirfObjects().remove(poName);
        jcloudsSwift.uploadObjectFromString(containerName, SIRFContainer.SIRF_DEFAULT_CATALOG_ID,
                new SIRFCatalogMarshaller("application/json").marshalCatalog(catalog));
        jcloudsSwift.deleteObject(containerName, poName);
        jcloudsSwift.close();
        jcloudsSwift.close();
    } catch (IOException ioe) {
        ioe.printStackTrace();
    } catch (JAXBException jbe) {
        jbe.printStackTrace();
    }

    return Response.ok().build();
}

From source file:org.megam.deccanplato.provider.zoho.invoice.handler.ExpenseCategoryImpl.java

/**
 * this method creates an Expensecategory in zoho invoice and returns that expensecategory details.
 * and it uses the business support class expensecategory to populate ZOHO XML
 * input This method takes input as a MAP(contains json dada) and returns a
 * MAP.//  w  w  w.j a va 2  s.  c  o m
 * 
 * @param outMap
 */
private Map<String, String> create(Map<String, String> outMap) {

    final String ZOHO_INVOICE_EXPENSECATEGORY_CREATE_URL = ZOHO_INVOICE_EXPENSECATEGORY + "create";

    ExpenseCategory expcat = new ExpenseCategory();
    expcat.setCategoryName(args.get(CATEGORY_NAME));
    expcat.setDescription(args.get(DESCRIPTION));
    String xmlout = null;
    try {
        xmlout = expcat.toXMLString();
    } catch (JAXBException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    List<NameValuePair> createAttrList = new ArrayList<NameValuePair>();
    createAttrList.add(new BasicNameValuePair(OAUTH_TOKEN, args.get(AUTHTOKEN)));
    createAttrList.add(new BasicNameValuePair(ZOHO_SCOPE, SCOPE));
    createAttrList.add(new BasicNameValuePair(ZOHO_XMLSTRING, xmlout));
    createAttrList.add(new BasicNameValuePair(APIKEY, args.get(APIKEY)));

    TransportTools tst = new TransportTools(ZOHO_INVOICE_EXPENSECATEGORY_CREATE_URL, createAttrList);
    String responseBody = null;

    TransportResponse response = null;

    try {
        response = TransportMachinery.post(tst);
    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    responseBody = response.entityToString();

    outMap.put(OUTPUT, responseBody);
    return outMap;
}

From source file:eu.optimis.mi.aggregator.util.XmlUtil.java

public void storeXmlResource(String xmlRes) {
    XmlUtil ut = new XmlUtil();
    String objRecordXml = ut.getObjXml(xmlRes);
    JAXBContext context;/*  ww  w. j  a  va  2s. c  o m*/
    try {
        context = JAXBContext.newInstance(MonitoringResourceDatasets.class);
        StringReader reader = new StringReader(objRecordXml);
        @SuppressWarnings("unused")
        MonitoringResourceDatasets mds = (MonitoringResourceDatasets) context.createUnmarshaller()
                .unmarshal(reader);
    } catch (JAXBException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:org.megam.deccanplato.provider.zoho.invoice.handler.ExpenseCategoryImpl.java

/**
 * this method update a particular expensecategory in zoho invoice 
 * and returns expensecategory details. This method takes input as a
 * MAP(contains json dada) and returns a MAP.
 * /*from   w w  w . j  a va 2s .  c o  m*/
 * @param outMap
 */
private Map<String, String> update(Map<String, String> outMap) {

    final String ZOHO_INVOICE_EXPENSECATEGORY_UPDATE_URL = ZOHO_INVOICE_EXPENSECATEGORY + "update";

    ExpenseCategory expcat = new ExpenseCategory();
    expcat.setCategoryID(args.get(ID));
    expcat.setCategoryName(args.get(CATEGORY_NAME));
    expcat.setDescription(args.get(DESCRIPTION));
    String xmlout = null;
    try {
        xmlout = expcat.toXMLString();
    } catch (JAXBException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    List<NameValuePair> updateAttrList = new ArrayList<NameValuePair>();
    updateAttrList.add(new BasicNameValuePair(OAUTH_TOKEN, args.get(AUTHTOKEN)));
    updateAttrList.add(new BasicNameValuePair(ZOHO_SCOPE, SCOPE));
    updateAttrList.add(new BasicNameValuePair(ZOHO_XMLSTRING, xmlout));
    updateAttrList.add(new BasicNameValuePair(APIKEY, args.get(APIKEY)));

    TransportTools tst = new TransportTools(ZOHO_INVOICE_EXPENSECATEGORY_UPDATE_URL, updateAttrList);
    String responseBody = null;

    TransportResponse response = null;

    try {
        response = TransportMachinery.post(tst);
    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    responseBody = response.entityToString();

    outMap.put(OUTPUT, responseBody);
    return outMap;

}

From source file:org.megam.deccanplato.provider.zoho.invoice.handler.PaymentImpl.java

/**
 * this method update a particular payment in zoho invoice and returns that updated payment details.
 * This method takes input as a MAP(contains json dada) and returns a MAP.
 * @param outMap //from   ww  w .  ja  v a2s. c om
 */
private Map<String, String> update(Map<String, String> outMap) {

    final String ZOHO_INVOICE_PAYMENT_UPDATE_URL = ZOHO_INVOICE_PAYMENT + "update";

    Payment payment = new Payment();
    payment.setPaymentID(args.get(ID));
    payment.setInvoiceID(args.get(INVOICE_ID));
    payment.setMode(args.get(MODE));
    payment.setDescription(args.get(DESCRIPTION));
    payment.setDate(args.get(DATE));
    payment.setExchangeRate(args.get(EXCHANGE_RATE));
    payment.setAmount(args.get(AMOUNT));
    String xmlout = null;
    try {
        xmlout = payment.toXMLString();
    } catch (JAXBException e) {
        //    TODO Auto-generated catch block
        e.printStackTrace();
    }
    List<NameValuePair> updateAttrList = new ArrayList<NameValuePair>();
    updateAttrList.add(new BasicNameValuePair(OAUTH_TOKEN, args.get(AUTHTOKEN)));
    updateAttrList.add(new BasicNameValuePair(ZOHO_SCOPE, SCOPE));
    updateAttrList.add(new BasicNameValuePair(ZOHO_XMLSTRING, xmlout));
    updateAttrList.add(new BasicNameValuePair(APIKEY, args.get(APIKEY)));

    TransportTools tst = new TransportTools(ZOHO_INVOICE_PAYMENT_UPDATE_URL, updateAttrList);
    String responseBody = null;

    TransportResponse response = null;

    try {
        response = TransportMachinery.post(tst);
    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    responseBody = response.entityToString();

    outMap.put(OUTPUT, responseBody);
    return outMap;

}

From source file:org.megam.deccanplato.provider.zoho.invoice.handler.ExpenseImpl.java

/**
 * this method creates an espense in zoho invoice and returns that expense details.
 * and it uses the business support class Expense to populate ZOHO XML input
 * This method takes input as a MAP(contains json dada) and returns a MAP.
 * @param outMap //from   w  w  w. j  a  va  2 s .co  m
 */
private Map<String, String> create(Map<String, String> outMap) {

    final String ZOHO_INVOICE_EXPENSE_CREATE_URL = ZOHO_INVOICE_EXPENSE + "create";
    Expense expense = new Expense();
    expense.setCategoryName(args.get(CATEGORY_NAME));
    expense.setExpenseDate(args.get(EXPENSE_DATE));
    expense.setExpenseAmount(args.get(AMOUNT));
    expense.setExpenseDescription(args.get(DESCRIPTION));
    expense.setTax1Name(args.get(TAX_NAME_1));
    expense.setIsInclusiveTax(args.get(INCLUSIVE_TAX));
    expense.setIsBillable(args.get(BILLABLE));
    expense.setReference(args.get(REFERENCE));
    expense.setCustomerID(args.get(CUSTOMERID));
    expense.setCurrencyCode(args.get(CURRENCY_CODE));
    expense.setExchangeRate(args.get(EXCHANGE_RATE));
    String xmlout = null;
    try {
        xmlout = expense.toXMLString();
    } catch (JAXBException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    List<NameValuePair> createAttrList = new ArrayList<NameValuePair>();
    createAttrList.add(new BasicNameValuePair(OAUTH_TOKEN, args.get(AUTHTOKEN)));
    createAttrList.add(new BasicNameValuePair(ZOHO_SCOPE, SCOPE));
    createAttrList.add(new BasicNameValuePair(ZOHO_XMLSTRING, xmlout));
    createAttrList.add(new BasicNameValuePair(APIKEY, args.get(APIKEY)));

    TransportTools tst = new TransportTools(ZOHO_INVOICE_EXPENSE_CREATE_URL, createAttrList);
    String responseBody = null;

    TransportResponse response = null;

    try {
        response = TransportMachinery.post(tst);
    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    responseBody = response.entityToString();

    outMap.put(OUTPUT, responseBody);
    return outMap;
}

From source file:org.megam.deccanplato.provider.zoho.invoice.handler.ExpenseImpl.java

/**
 * this method update a particular expense in zoho invoice and returns updated expense details.
 * This method takes input as a MAP(contains json dada) and returns a MAP.
 * @param outMap /*from w ww.j a  va  2 s .co  m*/
 */
private Map<String, String> update(Map<String, String> outMap) {

    final String ZOHO_INVOICE_EXPENSE_UPDATE_URL = ZOHO_INVOICE_EXPENSE + "update";

    Expense expense = new Expense();
    expense.setExpenseID(args.get(ID));
    expense.setCategoryName(args.get(CATEGORY_NAME));
    expense.setExpenseDate(args.get(EXPENSE_DATE));
    expense.setExpenseAmount(args.get(AMOUNT));
    expense.setExpenseDescription(args.get(DESCRIPTION));
    expense.setTax1Name(args.get(TAX_NAME_1));
    expense.setIsInclusiveTax(args.get(INCLUSIVE_TAX));
    expense.setIsBillable(args.get(BILLABLE));
    expense.setReference(args.get(REFERENCE));
    expense.setCustomerID(args.get(CUSTOMERID));
    expense.setCurrencyCode(args.get(CURRENCY_CODE));
    expense.setExchangeRate(args.get(EXCHANGE_RATE));
    String xmlout = null;
    try {
        xmlout = expense.toXMLString();
    } catch (JAXBException e) {
        //    TODO Auto-generated catch block
        e.printStackTrace();
    }
    List<NameValuePair> updateAttrList = new ArrayList<NameValuePair>();
    updateAttrList.add(new BasicNameValuePair(OAUTH_TOKEN, args.get(AUTHTOKEN)));
    updateAttrList.add(new BasicNameValuePair(ZOHO_SCOPE, SCOPE));
    updateAttrList.add(new BasicNameValuePair(ZOHO_XMLSTRING, xmlout));
    updateAttrList.add(new BasicNameValuePair(APIKEY, args.get(APIKEY)));

    TransportTools tst = new TransportTools(ZOHO_INVOICE_EXPENSE_UPDATE_URL, updateAttrList);
    String responseBody = null;

    TransportResponse response = null;

    try {
        response = TransportMachinery.post(tst);
    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    responseBody = response.entityToString();

    outMap.put(OUTPUT, responseBody);
    return outMap;

}

From source file:edu.cornell.med.icb.goby.modes.StatsMode.java

private void loadInfo() {
    try {//from  w  ww  .ja  va  2s .  co  m
        final JAXBContext jc = JAXBContext.newInstance(InfoOutput.class);

        final Unmarshaller m = jc.createUnmarshaller();
        InfoOutput info = (InfoOutput) m.unmarshal(new File(infoFilename));
        for (AnnotationLength ae : info.lengths) {
            int index = deCalculator.getElementIndex(ae.id);
            if (index != -1) {

                deCalculator.defineElementLength(index, ae.length);
            } else {

                // OK since some elements will yield zero counts and not be in the input.
            }
        }
        for (SampleTotalCount tc : info.totalCounts) {
            deCalculator.setNumAlignedInSample(tc.sampleId, tc.totalCount);
        }
    } catch (JAXBException e) {
        System.err.printf("An error occurred loading the content of info file %s %n", infoFilename);
        e.printStackTrace();
        System.exit(1);
    }
}