List of usage examples for javax.xml.bind JAXBException printStackTrace
public void printStackTrace()
From source file:org.megam.deccanplato.provider.zoho.crm.handler.LeadsImpl.java
/** * This method creates a lead in zoho.com and returns that account id. * and it uses the business support class Leads to populate ZOHO XML input. * This method takes input as a MAP(contains json dada) and returns a MAP. * @param outMap //w w w . j a v a 2 s . co m */ private Map<String, String> create(Map<String, String> outMap) { Leads leads = new Leads(); leads.setAnualRevenue(args.get(ANNUALREVENUE)); leads.setCity(args.get(CITY)); leads.setCompany(args.get(COMPANY)); leads.setCountry(args.get(COUNTRY)); leads.setDescription(args.get(DESCRIPTION)); leads.setDesignation(args.get(DESIGNATION)); leads.setEmail(args.get(EMAIL)); leads.setEmailOptOut(args.get(EMAIL_OPT_OUT)); leads.setFax(args.get(FAX)); leads.setFirstname(args.get(FIRSTNAME)); leads.setIndustry(args.get(INDUSTRY)); leads.setLastname(args.get(LASTNAME)); leads.setLeadSource(args.get(LEAD_SOURCE)); leads.setLeadStatus(args.get(LEAD_STATUS)); leads.setMobile(args.get(MOBILE)); leads.setNoOfEmployees(args.get(EMPLOYEES)); leads.setPhone(args.get(PHONE)); leads.setSalutation(args.get(SALUTATION)); leads.setSkypeId(args.get(SKYPE_ID)); leads.setState(args.get(STATE)); leads.setStreet(args.get(STREET)); leads.setWebsite(args.get(WEBSITE)); leads.setZipCode(args.get(ZIP_CODE)); String xmlout = null; try { xmlout = leads.toXMLString(); } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); } List<NameValuePair> accountAttrList = new ArrayList<NameValuePair>(); accountAttrList.add(new BasicNameValuePair(OAUTH_TOKEN, args.get(AUTHTOKEN))); accountAttrList.add(new BasicNameValuePair(ZOHO_SCOPE, SCOPE)); accountAttrList.add(new BasicNameValuePair(ZOHO_XMLDATA, xmlout)); TransportTools tst = new TransportTools(ZOHO_CRM_LEAD_XML_URL + INSERT_RECORDS, accountAttrList); 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.statusLineToString(); outMap.put(OUTPUT, responseBody); return outMap; }
From source file:org.megam.deccanplato.provider.zoho.crm.handler.LeadsImpl.java
/** * This method update a lead in zoho.com and returns a success message with updated lead id. * This method takes input as a MAP(contains json dada) and returns a MAP. * @param outMap //w w w . ja v a 2 s . c o m */ private Map<String, String> update(Map<String, String> outMap) { Leads leads = new Leads(); leads.setAnualRevenue(args.get(ANNUALREVENUE)); leads.setCity(args.get(CITY)); leads.setCompany(args.get(COMPANY)); leads.setCountry(args.get(COUNTRY)); leads.setDescription(args.get(DESCRIPTION)); leads.setDesignation(args.get(DESIGNATION)); leads.setEmail(args.get(EMAIL)); leads.setEmailOptOut(args.get(EMAIL_OPT_OUT)); leads.setFax(args.get(FAX)); leads.setFirstname(args.get(FIRSTNAME)); leads.setIndustry(args.get(INDUSTRY)); leads.setLastname(args.get(LASTNAME)); leads.setLeadSource(args.get(LEAD_SOURCE)); leads.setLeadStatus(args.get(LEAD_STATUS)); leads.setMobile(args.get(MOBILE)); leads.setNoOfEmployees(args.get(EMPLOYEES)); leads.setPhone(args.get(PHONE)); leads.setSalutation(args.get(SALUTATION)); leads.setSkypeId(args.get(SKYPE_ID)); leads.setState(args.get(STATE)); leads.setStreet(args.get(STREET)); leads.setWebsite(args.get(WEBSITE)); leads.setZipCode(args.get(ZIP_CODE)); String xmlout = null; try { xmlout = leads.toXMLString(); } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); } List<NameValuePair> accountAttrList = new ArrayList<NameValuePair>(); accountAttrList.add(new BasicNameValuePair(OAUTH_TOKEN, args.get(AUTHTOKEN))); accountAttrList.add(new BasicNameValuePair(ZOHO_SCOPE, SCOPE)); accountAttrList.add(new BasicNameValuePair(ID, args.get(ID))); accountAttrList.add(new BasicNameValuePair(ZOHO_XMLDATA, xmlout)); TransportTools tst = new TransportTools(ZOHO_CRM_LEAD_XML_URL + UPDATE_RECORDS, accountAttrList); 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.statusLineToString(); outMap.put(OUTPUT, responseBody); return outMap; }
From source file:com.ibm.opensirf.jaxrs.ObjectApi.java
@POST @Consumes(MediaType.MULTIPART_FORM_DATA) @Path("container/{containername}/{po}") public Response submitPO(@PathParam("containername") String container, @PathParam("po") String poName, @FormDataParam("objectName") String objectName, @FormDataParam("inputstream") InputStream inputStream) throws IOException, URISyntaxException { JCloudsApi jcloudsSwift = new JCloudsApi(); InputStream is = jcloudsSwift.getFileInputStream(container, SIRFContainer.SIRF_DEFAULT_CATALOG_ID); SIRFCatalog catalog = null;/* ww w . ja v a 2 s. c o m*/ try { catalog = new SIRFCatalogUnmarshaller("application/json").unmarshalCatalog(is); jcloudsSwift.close(); PreservationObjectInformation poi = new PreservationObjectInformation("none"); PreservationObjectIdentifier poId = new PreservationObjectIdentifier(); String logicalIdentifier = container + "-" + poName; String versionIdentifier = logicalIdentifier + "-1.0"; poId.setObjectLogicalIdentifier( new PreservationObjectLogicalIdentifier("logicalIdentifier", "en", logicalIdentifier)); poId.setObjectParentIdentifier( new PreservationObjectParentIdentifier("parentIdentifier", "en", "null")); poId.setObjectVersionIdentifier( new PreservationObjectVersionIdentifier("versionIdentifier", "en", versionIdentifier)); poId.putObjectName(new PreservationObjectName("name", "en", objectName)); poi.addObjectIdentifier(poId); byte[] b = IOUtils.toByteArray(inputStream); String sha1Hex = getSHA1(b); System.out.println("SHA-1 sum: " + sha1Hex); DigestInformation di = new DigestInformation("ObjectApi", "SHA-1", sha1Hex); poi.setObjectFixity(new FixityInformation(di)); poi.setObjectRetention(new Retention("time_period", "default")); // Begin: added functionality (for FVT purposes) // PreservationObjectIdentifier poId2 = new PreservationObjectIdentifier(); // String logicalIdentifier2 = "2 SWIFT-" + container + "-" + poName; // String versionIdentifier2 = logicalIdentifier2 + "-1.0 2"; // poId2.setObjectLogicalIdentifier(new PreservationObjectLogicalIdentifier("logicalIdentifier2", "en2", logicalIdentifier2)); // poId2.setObjectParentIdentifier(new PreservationObjectParentIdentifier("parentIdentifier2", "en2", "null2")); // poId2.setObjectVersionIdentifier(new PreservationObjectVersionIdentifier("versionIdentifier2", "en2", versionIdentifier2)); // poId2.putObjectName(new PreservationObjectName("name2", "en", objectName)); // poId2.putObjectName(new PreservationObjectName("name3", "en", objectName)); // poi.addObjectIdentifier(poId2); // // RelatedObjects ros1 = new RelatedObjects(); // RelatedObjectReference ror1 = new RelatedObjectReference(); // ror1.setReferenceRole("sample related reference role 1"); // ror1.setReferenceType("sample related reference type 1"); // ror1.setReferenceValue("sample related reference value 1"); // ros1.setObjectRelatedObjectsReference(ror1); // RelatedObjects ros2 = new RelatedObjects(); // RelatedObjectReference ror2 = new RelatedObjectReference(); // ror2.setReferenceRole("sample related reference role 2"); // ror2.setReferenceType("sample related reference type 2"); // ror2.setReferenceValue("sample related reference value 2"); // ros2.setObjectRelatedObjectsReference(ror2); // HashSet<RelatedObjects> roSet = new HashSet<RelatedObjects>(); // roSet.add(ros1); roSet.add(ros2); // poi.setObjectRelatedObjects(roSet); // // HashSet<PreservationObjectAuditLog> alSet = new HashSet<PreservationObjectAuditLog>(); // PreservationObjectAuditLog al1 = new PreservationObjectAuditLog(); // AuditLogReference alr1 = new AuditLogReference(); // alr1.setReferenceRole("sample audit log role 1"); // alr1.setReferenceType("sample audit log type 1"); // alr1.setReferenceValue("sample audit log value 1"); // al1.setObjectAuditLogReference(alr1); // PreservationObjectAuditLog al2 = new PreservationObjectAuditLog(); // AuditLogReference alr2 = new AuditLogReference(); // alr2.setReferenceRole("sample audit log role 2"); // alr2.setReferenceType("sample audit log type 2"); // alr2.setReferenceValue("sample audit log value 2"); // al2.setObjectAuditLogReference(alr2); // alSet.add(al1); alSet.add(al2); // poi.setObjectAuditLogObjectIds(alSet); // // HashSet<Extension> exSet = new HashSet<Extension>(); // Extension e1 = new Extension(); // e1.setObjectExtensionDescription("sample ext descr 1"); // e1.setObjectExtensionOrganization("sample ext org 1"); // HashSet<ExtensionPair> pairSet = new HashSet<ExtensionPair>(); // pairSet.add(new ExtensionPair("ext key example1", "ext value example1")); // pairSet.add(new ExtensionPair("ext key example2", "ext value example2")); // e1.setObjectExtensionPairs(pairSet); // Extension e2 = new Extension(); // e2.setObjectExtensionDescription("sample ext descr 2"); // e2.setObjectExtensionOrganization("sample ext org 3"); // HashSet<ExtensionPair> pairSet2 = new HashSet<ExtensionPair>(); // pairSet2.add(new ExtensionPair("ext key example3", "ext value example3")); // pairSet2.add(new ExtensionPair("ext key example4", "ext value example4")); // e2.setObjectExtensionPairs(pairSet2); // exSet.add(e1); exSet.add(e2); // poi.setObjectExtension(exSet); // End: added functionality catalog.getSirfObjects().put(poi); jcloudsSwift.uploadObjectFromString(container, SIRFContainer.SIRF_DEFAULT_CATALOG_ID, new SIRFCatalogMarshaller("application/json").marshalCatalog(catalog)); jcloudsSwift.uploadObjectFromByteArray(container, versionIdentifier, b); jcloudsSwift.close(); } catch (IOException ioe) { ioe.printStackTrace(); } catch (JAXBException jbe) { jbe.printStackTrace(); } return Response.created(new URI("sirf/container/" + container + "/" + poName)).build(); }
From source file:org.kemri.wellcome.dhisreport.api.impl.DHIS2ReportingServiceImpl.java
@Override public void unMarshallandSaveReportTemplates(InputStream is) { JAXBContext jaxbContext = null; Unmarshaller jaxbUnmarshaller = null; ReportTemplates reportTemplates = null; try {/*from ww w . j a va 2 s. co m*/ jaxbContext = JAXBContext.newInstance(ReportTemplates.class); jaxbUnmarshaller = jaxbContext.createUnmarshaller(); reportTemplates = (ReportTemplates) jaxbUnmarshaller.unmarshal(is); if (reportTemplates == null) log.error("\n reportTemplates : null"); } catch (JAXBException e) { log.error(e.getMessage()); e.printStackTrace(); } for (DataElement de : reportTemplates.getDataElements()) { saveDataElement(de); } for (Disaggregation disagg : reportTemplates.getDisaggregations()) { saveDisaggregation(disagg); } for (ReportDefinition rd : reportTemplates.getReportDefinitions()) { for (DataValueTemplate dvt : rd.getDataValueTemplates()) { dvt.setReportDefinition(rd); } saveReportDefinition(rd); } }
From source file:org.megam.deccanplato.provider.zoho.invoice.handler.CustomerImpl.java
/** * this method creates a customer in zoho invoice and returns that customer details. * and it uses the business support classes Customer, Contact and CustomFields to populate ZOHO XML input * This method takes input as a MAP(contains json dada) and returns a MAP. * @param outMap /*from www .j ava 2 s.com*/ */ private Map<String, String> create(Map<String, String> outMap) { final String ZOHO_INVOICE_CUSTOMER_CREATE_URL = "https://invoice.zoho.com/api/view/customers/create"; Customer customer = new Customer(); Contact contact = new Contact(); CustomFields custom = new CustomFields(); customer.setBillingAddress(args.get(BILLING_ADDESS)); customer.setBillingCity(args.get(BILLING_CITY)); customer.setBillingCountry(args.get(BILLING_COUNTRY)); customer.setBillingFax(args.get(BILLING_FAX)); customer.setBillingZip(args.get(BILLING_ZIP)); customer.setCurrencyCode(args.get(CURRENCY_CODE)); customer.setName(args.get(NAME)); customer.setPaymentsDue(args.get(PAYMENT_DUE)); customer.setShippingAddress(args.get(SHIPPING_ADDRESS)); customer.setShippingCity(args.get(SHIPPING_CITY)); customer.setShippingCountry(args.get(SHIPPING_COUNTRY)); customer.setShippingFax(args.get(SHIPPING_FAX)); customer.setShippingState(args.get(SHIPPING_STATE)); customer.setShippingZip(args.get(SHIPPING_ZIP)); contact.setEmail(args.get(EMAIL)); contact.setFirstName(args.get(FIRST_NAME)); contact.setLastName(args.get(LAST_NAME)); contact.setMobile(args.get(MOBILE)); contact.setPhone(args.get(PHONE)); contact.setSalutation(args.get(SALUTATION)); customer.getContact().add(contact); custom.setField1_name(args.get(LABEL1)); custom.setField1_value(args.get(VALUE1)); custom.setField2_name(args.get(LABEL2)); custom.setField2_value(args.get(VALUE2)); custom.setField3_name(args.get(LABEL3)); custom.setField3_value(args.get(VALUE3)); customer.getCustomFields().add(custom); customer.setNotes(args.get(NOTES)); String xmlout = null; try { xmlout = customer.toXMLString(); } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); } List<NameValuePair> customerAttrList = new ArrayList<NameValuePair>(); customerAttrList.add(new BasicNameValuePair(OAUTH_TOKEN, args.get(AUTHTOKEN))); customerAttrList.add(new BasicNameValuePair(ZOHO_SCOPE, SCOPE)); customerAttrList.add(new BasicNameValuePair(ZOHO_XMLSTRING, xmlout)); customerAttrList.add(new BasicNameValuePair(APIKEY, args.get(APIKEY))); TransportTools tst = new TransportTools(ZOHO_INVOICE_CUSTOMER_CREATE_URL, customerAttrList); 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.CustomerImpl.java
/** * this method update a particular customer in zoho invoice and returns customer details. * This method takes input as a MAP(contains json dada) and returns a MAP. * @param outMap // www . j av a 2 s . c o m */ private Map<String, String> update(Map<String, String> outMap) { final String ZOHO_INVOICE_CUSTOMER_UPDATE_URL = "https://invoice.zoho.com/api/view/customers/update"; Customer customer = new Customer(); Contact contact = new Contact(Boolean.parseBoolean(args.get(DELETE_CONTACT))); CustomFields custom = new CustomFields(); customer.setCustomerId(args.get(CUSTOMERID)); customer.setBillingAddress(args.get(BILLING_ADDESS)); customer.setBillingCity(args.get(BILLING_CITY)); customer.setBillingCountry(args.get(BILLING_COUNTRY)); customer.setBillingFax(args.get(BILLING_FAX)); customer.setBillingZip(args.get(BILLING_ZIP)); customer.setPaymentsDue(args.get(PAYMENT_DUE)); customer.setShippingAddress(args.get(SHIPPING_ADDRESS)); customer.setShippingCity(args.get(SHIPPING_CITY)); customer.setShippingCountry(args.get(SHIPPING_COUNTRY)); customer.setShippingFax(args.get(SHIPPING_FAX)); customer.setShippingState(args.get(SHIPPING_STATE)); customer.setShippingZip(args.get(SHIPPING_ZIP)); contact.setContactId(args.get(CONTACT_ID)); contact.setSalutation(args.get(SALUTATION)); contact.setEmail(args.get(EMAIL)); contact.setFirstName(args.get(FIRST_NAME)); contact.setLastName(args.get(LAST_NAME)); contact.setPhone(args.get(PHONE)); customer.getContact().add(contact); custom.setField1_name(LABEL1); custom.setField1_value(args.get(VALUE1)); custom.setField2_name(args.get(LABEL2)); custom.setField2_value(args.get(VALUE2)); custom.setField3_name(args.get(LABEL3)); custom.setField3_value(args.get(VALUE3)); customer.getCustomFields().add(custom); String xmlout = null; try { xmlout = customer.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_CUSTOMER_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:com.athena.chameleon.engine.utils.JaxbUtilsTest.java
@Test public void jbossAppV50CreateTest() { try {/*from w w w . j av a2s . c om*/ String projectName = "athena-chameleon"; String docType = "<!DOCTYPE jboss-app PUBLIC \"-//JBoss//DTD J2EE Application 5.0//EN\" \"http://www.jboss.org/j2ee/dtd/jboss-app_5_0.dtd\">"; JbossApp jbossApp = new JbossApp(); LoaderRepository loaderRepository = new LoaderRepository(); loaderRepository.setvalue("com.athena.chameleon:loader=" + projectName); jbossApp.setLoaderRepository(loaderRepository); String xmlData = JaxbUtils.marshal(JbossApp.class.getPackage().getName(), jbossApp, docType); System.out.println(xmlData); } catch (JAXBException e) { e.printStackTrace(); fail("Error"); } catch (IOException e) { e.printStackTrace(); fail("Error"); } }
From source file:org.megam.deccanplato.provider.zoho.invoice.handler.EstimateImpl.java
/** * this method creates an Estimate in zoho invoice and returns that users details. * and it uses the business support class Estimate, EstimateItem and Comment to populate ZOHO ESTIMATE XML input * This method takes input as a MAP(contains json dada) and returns a MAP. * @param outMap /* w w w .ja v a2 s .c om*/ */ private Map<String, String> create(Map<String, String> outMap) { final String ZOHO_INVOICE_ESTIMATE_CREATE_URL = "https://invoice.zoho.com/api/view/estimates/create"; Estimate estimate = new Estimate(); EstimateItem estimateitem = new EstimateItem(); Comment comment = new Comment(); estimate.setCustomerID(args.get(CUSTOMERID)); estimate.setEstimateDate(args.get(ESTIMATE_DATE)); estimate.setReferenceNumber(args.get(REFERENCE_NO)); estimate.setExchangeRate(args.get(EXCHANGE_RATE)); estimate.setCustom_Body(args.get(CUSTOM_BODY)); estimate.setCustom_Subject(args.get(CUSTOM_SUBJECT)); estimateitem.setProductID(args.get(PRODUCT_ID)); estimate.getEstimateItem().add(estimateitem); comment.setDescription(args.get(DESCRIPTION)); estimate.getComment().add(comment); estimate.setNotes(args.get(NOTES)); estimate.setTerms(args.get(TERMS)); String xmlout = null; try { xmlout = estimate.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_ESTIMATE_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.EstimateImpl.java
/** * this method update a particular estimate in zoho invoice and returns success message with updated estimate. * This method takes input as a MAP(contains json dada) and returns a MAP. * @param outMap /*from ww w . j a va 2s. c o m*/ */ private Map<String, String> update(Map<String, String> outMap) { final String ZOHO_INVOICE_ESTIMATE_UPDATE_URL = "https://invoice.zoho.com/api/view/estimates/update"; Estimate estimate = new Estimate(); EstimateItem estimateitem = new EstimateItem(Boolean.parseBoolean(args.get(DELETE_ESTIMATE))); Comment comment = new Comment(); estimate.setEstimateId(args.get(ID)); estimate.setCustomerID(args.get(CUSTOMERID)); estimate.setEstimateDate(args.get(ESTIMATE_DATE)); estimate.setReferenceNumber(args.get(REFERENCE_NO)); estimate.setExchangeRate(args.get(EXCHANGE_RATE)); estimate.setCustom_Body(args.get(CUSTOM_BODY)); estimate.setCustom_Subject(args.get(CUSTOM_SUBJECT)); estimateitem.setProductID(args.get(PRODUCT_ID)); estimate.getEstimateItem().add(estimateitem); comment.setDescription(args.get(DESCRIPTION)); estimate.getComment().add(comment); estimate.setNotes(args.get(NOTES)); estimate.setTerms(args.get(TERMS)); String xmlout = null; try { xmlout = estimate.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_ESTIMATE_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:at.ac.tuwien.dsg.cloud.salsa.engine.smartdeployment.QUELLE.QuelleService.java
@POST @Path("/submitCloudDescription") @Consumes(MediaType.APPLICATION_XML)//from w w w. j a va 2s . c o m public boolean submitCloudProviderDescription(CloudProvider provider, @DefaultValue("true") @QueryParam("overwrite") boolean overwrite) { File saveAs = new File(SalsaConfiguration.getCloudProviderDescriptionDir() + File.separator + provider.getName() + cloudDescriptionFileExtension); if (saveAs.exists() && overwrite == false) { EngineLogger.logger.debug("Do not overwrite file : " + saveAs); return false; } try { JAXBContext jaxbContext = JAXBContext.newInstance(CloudProvider.class); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); jaxbMarshaller.marshal(provider, saveAs); } catch (JAXBException e) { EngineLogger.logger.debug("Fail to pass the cloud description !"); e.printStackTrace(); } EngineLogger.logger.debug("Saved/Updated cloud description in : " + saveAs); return true; }