本文整理了Java中org.apache.camel.language.XPath.<init>()
方法的一些代码示例,展示了XPath.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XPath.<init>()
方法的具体详情如下:
包路径:org.apache.camel.language.XPath
类名称:XPath
方法名:<init>
暂无
代码示例来源:origin: Talend/tesb-rt-se
public String transform(@XPath("/stock/symbol/text()") String symbol, @XPath("/stock/value/text()") String value) {
Integer hits = stat.get(symbol);
if (hits == null) {
hits = 1;
} else {
hits++;
}
stat.put(symbol, hits);
return symbol + '@' + hits;
}
代码示例来源:origin: camelinaction/camelinaction2
public Map toMap(@XPath("partner/@id") int partnerId,
@XPath("partner/date/text()") String date,
@XPath("partner/code/text()") int statusCode,
@XPath("partner/time/text()") long responseTime) {
Map map = new HashMap();
map.put("id", partnerId);
map.put("date", date);
map.put("code", statusCode);
map.put("time", responseTime);
return map;
}
}
代码示例来源:origin: org.apache.camel/camel-example-management
public String transform(@XPath("/stock/symbol/text()") String symbol, @XPath("/stock/value/text()") String value) {
Integer hits = stat.get(symbol);
if (hits == null) {
hits = 1;
} else {
hits++;
}
stat.put(symbol, hits);
return symbol + "@" + hits;
}
代码示例来源:origin: camelinaction/camelinaction2
public Map toMap(@XPath("partner/@id") int partnerId,
@XPath("partner/date/text()") String date,
@XPath("partner/code/text()") int statusCode,
@XPath("partner/time/text()") long responseTime) {
Map map = new HashMap();
map.put("id", partnerId);
map.put("date", date);
map.put("code", statusCode);
map.put("time", responseTime);
return map;
}
}
代码示例来源:origin: cschneider/Karaf-Tutorial
public String getMail(@XPath("/item/@vendor") String vendor) {
return mailMap.get(vendor);
}
}
代码示例来源:origin: camelinaction/camelinaction2
public Map toMap(@XPath("partner/@id") int partnerId,
@XPath("partner/date/text()") String date,
@XPath("partner/code/text()") int statusCode,
@XPath("partner/time/text()") long responseTime) {
Map map = new HashMap();
map.put("id", partnerId);
map.put("date", date);
map.put("code", statusCode);
map.put("time", responseTime);
return map;
}
}
代码示例来源:origin: camelinaction/camelinaction2
public String toSql(@XPath("order/@name") String name,
@XPath("order/@amount") int amount,
@XPath("order/@customer") String customer,
@Headers Map<String, Object> outHeaders) {
outHeaders.put("partName", name);
outHeaders.put("quantity", amount);
outHeaders.put("customer", customer);
return "insert into incoming_orders (part_name, quantity, customer) values (:?partName, :?quantity, :?customer)";
}
}
代码示例来源:origin: camelinaction/camelinaction2
public Map toMap(@XPath("partner/@id") int partnerId,
@XPath("partner/date/text()") String date,
@XPath("partner/code/text()") int statusCode,
@XPath("partner/time/text()") long responseTime) {
if (partnerId <= 0) {
throw new IllegalArgumentException("PartnerId is invalid, was " + partnerId);
}
Map map = new HashMap();
map.put("id", partnerId);
map.put("date", date);
map.put("code", statusCode);
map.put("time", responseTime);
return map;
}
代码示例来源:origin: camelinaction/camelinaction
public String toSql(@XPath("partner/@id") int partnerId,
@XPath("partner/date/text()") String date,
@XPath("partner/code/text()") int statusCode,
@XPath("partner/time/text()") long responsTime) {
StringBuilder sb = new StringBuilder();
sb.append("INSERT INTO PARTNER_METRIC (partner_id, time_occurred, status_code, perf_time) VALUES (");
sb.append("'").append(partnerId).append("', ");
sb.append("'").append(date).append("', ");
sb.append("'").append(statusCode).append("', ");
sb.append("'").append(responsTime).append("') ");
return sb.toString();
}
}
代码示例来源:origin: camelinaction/camelinaction
public String toSql(@XPath("order/@name") String name,
@XPath("order/@amount") int amount,
@XPath("order/@customer") String customer) {
StringBuilder sb = new StringBuilder();
sb.append("insert into incoming_orders (part_name, quantity, customer) values (");
sb.append("'").append(name).append("', ");
sb.append("'").append(amount).append("', ");
sb.append("'").append(customer).append("') ");
System.out.println(sb.toString());
return sb.toString();
}
}
代码示例来源:origin: camelinaction/camelinaction
public String toSql(@XPath("partner/@id") int partnerId,
@XPath("partner/date/text()") String date,
@XPath("partner/code/text()") int statusCode,
@XPath("partner/time/text()") long responseTime) {
if (partnerId <= 0) {
throw new IllegalArgumentException("PartnerId is invalid, was " + partnerId);
}
StringBuilder sb = new StringBuilder();
sb.append("INSERT INTO PARTNER_METRIC (partner_id, time_occurred, status_code, perf_time) VALUES (");
sb.append("'").append(partnerId).append("', ");
sb.append("'").append(date).append("', ");
sb.append("'").append(statusCode).append("', ");
sb.append("'").append(responseTime).append("') ");
return sb.toString();
}
}
代码示例来源:origin: camelinaction/camelinaction2
public String[] recipients(@XPath("/order/@customer") String customer) {
if (isGoldCustomer(customer)) {
return new String[] {"jms:accounting", "jms:production"};
} else {
return new String[] {"jms:accounting"};
}
}
代码示例来源:origin: jboss-fuse/quickstarts
/**
* Get the region code that corresponds to the given country code.
*
* This method can be used as a plain Java method. However, when it is used inside a Camel route, the @XPath annotation will
* evaluate the XPath expression and use the result as the method parameter. In this case, it will fetch the country code
* from the order XML message. So, the method will determine the region code for the country that is in the XML message.
*
* @param country the country code
* @return the region code
*/
public String getRegion(@XPath(value = "/order:order/order:customer/order:country",
namespaces = @NamespacePrefix(prefix = "order", uri = "http://fabric8.com/examples/order/v7")) String country) {
if (country.equals("AU")) {
return APAC;
} else if (country.equals("US")) {
return AMER;
} else {
return EMEA;
}
}
}
代码示例来源:origin: camelinaction/camelinaction
public Document handleIncomingOrder(@Body Document xml,
@XPath("/order/@customerId") int customerId,
@Bean(ref = "guid", method = "generate") int orderId) {
Attr attr = xml.createAttribute("orderId");
attr.setValue("" + orderId);
Node node = xml.getElementsByTagName("order").item(0);
node.getAttributes().setNamedItem(attr);
return xml;
}
代码示例来源:origin: camelinaction/camelinaction
public Document handleIncomingOrder(@Body Document xml,
@XPath(value = "/c:order/@customerId",
namespaces = @NamespacePrefix(
prefix = "c",
uri = "http://camelinaction.com/order")) int customerId,
@Bean(ref = "guid", method = "generate") int orderId) {
Attr attr = xml.createAttribute("orderId");
attr.setValue("" + orderId);
Node node = xml.getElementsByTagName("order").item(0);
node.getAttributes().setNamedItem(attr);
return xml;
}
代码示例来源:origin: camelinaction/camelinaction2
@RecipientList
public String[] route(@XPath("/order/@customer") String customer) {
if (isGoldCustomer(customer)) {
return new String[] {"jms:accounting", "jms:production"};
} else {
return new String[] {"jms:accounting"};
}
}
代码示例来源:origin: camelinaction/camelinaction
@RecipientList
public String[] route(@XPath("/order/@customer") String customer) {
if (isGoldCustomer(customer)) {
return new String[] {"jms:accounting", "jms:production"};
} else {
return new String[] {"jms:accounting"};
}
}
代码示例来源:origin: jboss-fuse/quickstarts
/**
* Validate the order date - orders should only be place from Monday to Saturday.
* <p/>
* This method can be used as a plain Java method, but when it is used inside a Camel route, the @XPath annotation will kick
* in, evaluating the XPath expression and using the result as the method parameter. In this case, it will fetch the order
* date from the order XML message.
*
* @param date the order date
* @throws OrderValidationException when the order date is a Sunday
*/
public void validateOrderDate(
@XPath(value = "/order:order/order:date",
namespaces = @NamespacePrefix(prefix = "order", uri = "http://fabric8.com/examples/order/v7")) String date) throws OrderValidationException {
final Calendar calendar = new GregorianCalendar();
try {
calendar.setTime(DATE_FORMAT.parse(date));
if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
LOGGER.warn("Order validation failure: order date " + date + " should not be a Sunday");
throw new OrderValidationException("Order date should not be a Sunday: " + date);
}
} catch (ParseException e) {
throw new OrderValidationException("Invalid order date: " + date);
}
}
内容来源于网络,如有侵权,请联系作者删除!