org.apache.cxf.common.i18n.BundleUtils Java Examples
The following examples show how to use
org.apache.cxf.common.i18n.BundleUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnnotationHandlerChainBuilder.java From cxf with Apache License 2.0 | 5 votes |
private boolean patternMatches(Element el, QName comp) { if (comp == null) { return true; } String namePattern = el.getTextContent().trim(); if ("*".equals(namePattern)) { return true; } final int idx = namePattern.indexOf(':'); if (idx < 0) { String xml = StaxUtils.toString(el); throw new WebServiceException( BundleUtils.getFormattedString(BUNDLE, "NOT_A_QNAME_PATTER", namePattern, xml)); } String pfx = namePattern.substring(0, idx); String ns = el.lookupNamespaceURI(pfx); if (ns == null) { ns = pfx; } if (!ns.equals(comp.getNamespaceURI())) { return false; } String localPart = namePattern.substring(idx + 1, namePattern.length()); if (localPart.contains("*")) { //wildcard pattern matching return Pattern.matches(mapPattern(localPart), comp.getLocalPart()); } else if (!localPart.equals(comp.getLocalPart())) { return false; } return true; }
Example #2
Source File: LogUtilsTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testGetL7dLog() throws Exception { Logger log = LogUtils.getL7dLogger(LogUtilsTest.class, null, "testGetL7dLog"); assertNotNull("expected non-null logger", log); assertEquals("unexpected resource bundle name", BundleUtils.getBundleName(LogUtilsTest.class), log.getResourceBundleName()); Logger otherLogger = LogUtils.getL7dLogger(LogUtilsTest.class, "Messages", "testGetL7dLog"); assertEquals("unexpected resource bundle name", BundleUtils.getBundleName(LogUtilsTest.class, "Messages"), otherLogger.getResourceBundleName()); }