List of usage examples for org.springframework.util StringUtils quote
@Nullable public static String quote(@Nullable String str)
From source file:org.springmodules.cache.config.ConfigAssert.java
/** * Asserts the given set of property values contains the expected property * value.//from w w w.ja v a 2s . com * * @param propertyValues * the given set of property values * @param expectedPropertyValue * the expected property value */ public static void assertPropertyIsPresent(MutablePropertyValues propertyValues, PropertyValue expectedPropertyValue) { String propertyName = expectedPropertyValue.getName(); PropertyValue actualPropertyValue = propertyValues.getPropertyValue(propertyName); Assert.assertNotNull("Property " + StringUtils.quote(propertyName) + " not found", actualPropertyValue); Object expectedValue = expectedPropertyValue.getValue(); Object actualValue = actualPropertyValue.getValue(); String message = "<Property " + StringUtils.quote(propertyName) + ">"; assertEquals(message, expectedValue, actualValue); }
From source file:egovframework.rte.itl.integration.metadata.RecordTypeFieldDefinition.java
@Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append(this.getClass().getName()).append(" {typeId = ").append(StringUtils.quote(typeId)).append("}"); return sb.toString(); }
From source file:org.springmodules.cache.interceptor.flush.AbstractFlushingInterceptor.java
/** * @throws FatalCacheException/*w w w . j av a 2 s. c o m*/ * if the cache provider facade is <code>null</code>. * * @see InitializingBean#afterPropertiesSet() * @see #onAfterPropertiesSet() */ public final void afterPropertiesSet() throws FatalCacheException { if (cacheProviderFacade == null) { throw new FatalCacheException("The cache provider facade should not be null"); } if (flushingModels == null || flushingModels.isEmpty()) { return; } CacheModelValidator validator = cacheProviderFacade.modelValidator(); if (flushingModels instanceof Properties) { PropertyEditor editor = cacheProviderFacade.getFlushingModelEditor(); Properties properties = (Properties) flushingModels; Map newFlushingModels = new HashMap(); String id = null; try { for (Iterator i = properties.keySet().iterator(); i.hasNext();) { id = (String) i.next(); String property = properties.getProperty(id); editor.setAsText(property); Object flushingModel = editor.getValue(); validator.validateFlushingModel(flushingModel); newFlushingModels.put(id, flushingModel); } } catch (Exception exception) { throw new FatalCacheException( "Unable to create the flushing model with id " + StringUtils.quote(id), exception); } setFlushingModels(newFlushingModels); } else { String id = null; try { for (Iterator i = flushingModels.keySet().iterator(); i.hasNext();) { id = (String) i.next(); Object flushingModel = flushingModels.get(id); validator.validateFlushingModel(flushingModel); } } catch (Exception exception) { throw new FatalCacheException("Unable to validate flushing model with id " + StringUtils.quote(id), exception); } } onAfterPropertiesSet(); }
From source file:org.springmodules.cache.config.AbstractCacheSetupStrategyParser.java
/** * Parses the given XML element containing the properties and/or sub-elements * necessary to configure a strategy for setting up declarative caching * services./*from ww w . j a v a 2s .co m*/ * * @param element * the XML element to parse * @param parserContext * the parser context * @throws IllegalStateException * if the bean definition registry does not have a definition for * the <code>CacheProviderFacade</code> registered under the name * specified in the XML attribute "providerId" * @throws IllegalStateException * if the cache provider facade is in invalid state * @throws IllegalStateException * if any of the caching listeners is not an instance of * <code>CachingListener</code> * * @see BeanDefinitionParser#parse(Element, ParserContext) */ public final BeanDefinition parse(Element element, ParserContext parserContext) throws NoSuchBeanDefinitionException, IllegalStateException { String cacheProviderFacadeId = element.getAttribute("providerId"); BeanDefinitionRegistry registry = parserContext.getRegistry(); if (!registry.containsBeanDefinition(cacheProviderFacadeId)) { throw new IllegalStateException( "An implementation of CacheProviderFacade should be registered under the name " + StringUtils.quote(cacheProviderFacadeId)); } RuntimeBeanReference cacheProviderFacadeReference = new RuntimeBeanReference(cacheProviderFacadeId); Object cacheKeyGenerator = parseCacheKeyGenerator(element, parserContext); List cachingListeners = parseCachingListeners(element, parserContext); Map cachingModels = parseCachingModels(element); Map flushingModels = parseFlushingModels(element); CacheSetupStrategyPropertySource ps = new CacheSetupStrategyPropertySource(cacheKeyGenerator, cacheProviderFacadeReference, cachingListeners, cachingModels, flushingModels); parseCacheSetupStrategy(element, parserContext, ps); return null; }
From source file:egovframework.rte.itl.webservice.data.MappingInfo.java
@Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append(this.getClass().getName()).append(" {").append("\n\ttype = ").append(StringUtils.quote(type)) .append("\n\tindex = ").append(index).append("\n\targumentNAme = ") .append(StringUtils.quote(argumentName)).append("\n\theader = ").append(header).append("\n}"); return sb.toString(); }
From source file:gda.gui.beans.BeanBase.java
@Override public void run() { // infinite loop while (true) { boolean updateDueToMove = false; try {/*from w w w.j a v a 2 s . c o m*/ // if move in progress or a manual update sent, call updateDisplay in swing thread updateDueToMove = theObservableIsChanging(); while (theObservableIsChanging() || manualUpdate) { updateDisplay(); Thread.sleep(1000);//100ms delay caused the gui to freeze on i02 when displaying the microglide manualUpdate = false; } // if the move just finished, then update one last time to pick up final value if (updateDueToMove) { updateDisplay(); } } catch (Exception e) { final String displayedLabel = (label != null) ? StringUtils.quote(label) : "unlabelled"; logger.error(String.format("Could not update %s bean", displayedLabel), e); } finally { try { Thread.sleep(2500); } catch (InterruptedException e) { e.printStackTrace(); } } } }
From source file:egovframework.rte.itl.integration.metadata.OrganizationDefinition.java
@Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append(this.getClass().getName()).append(" {").append("\n\tid = ").append(StringUtils.quote(id)) .append("\n\tname = ").append(StringUtils.quote(name)); if (systems == null) { sb.append("\n\tsystems = null"); } else {/*from w w w . jav a 2 s .co m*/ sb.append("\n\tsystems = {"); for (Entry<String, SystemDefinition> entry : systems.entrySet()) { sb.append("\n\t\t<key = ").append(StringUtils.quote(entry.getKey())).append(", value = ") .append(entry.getValue() == null ? "" : "\n").append(entry.getValue()).append(">"); } sb.append("\n\t}"); } sb.append("\n}"); return sb.toString(); }
From source file:org.springmodules.cache.provider.ehcache.EhCacheCachingModel.java
/** * @see Object#toString()/*from w ww . j a va 2s . co m*/ */ public String toString() { return Objects.identityToString(this).append("[cacheName=").append(StringUtils.quote(cacheName)) .append(", blocking=").append(blocking).append(", cacheEntryFactory=") .append((cacheEntryFactory != null) ? cacheEntryFactory.getClass().getName() : null).append("]") .toString(); }
From source file:egovframework.rte.itl.integration.metadata.IntegrationDefinition.java
@Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append(this.getClass().getName()).append(" {").append("\n\tid = ").append(StringUtils.quote(id)) .append("\n\tprovider = ").append(provider == null ? "" : "\n").append(provider) .append("\n\tconsumer = ").append(consumer == null ? "" : "\n").append(consumer) .append("\n\tdefaultTimeout = ").append(defaultTimeout).append("\n\tusing = ").append(using) .append("\n\tvalidateFrom = ").append(validateFrom).append("\n\tvalidateTo = ").append(validateTo) .append("\n}"); return sb.toString(); }
From source file:egovframework.rte.itl.webservice.data.WebServiceServerDefinition.java
@Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append(this.getClass().getName()).append(" {").append("\n\tkey = ").append(StringUtils.quote(key)) .append("\n\tserviceDefinition = ").append(serviceDefinition).append("\n\tnamespace = ") .append(StringUtils.quote(namespace)).append("\n\taddress = ").append(StringUtils.quote(address)) .append("\n\tserviceName = ").append(StringUtils.quote(serviceName)).append("\n\tportName = ") .append(StringUtils.quote(portName)).append("\n\toperationName = ") .append(StringUtils.quote(operationName)).append("\n}"); return sb.toString(); }