List of usage examples for org.springframework.beans BeansException toString
public String toString()
From source file:org.archive.crawler.restlet.BeanBrowseResource.java
/** * Constructs a nested Map data structure with the information represented * by this Resource. The result is particularly suitable for use with with * {@link XmlMarshaller}./*from www. j av a 2 s. co m*/ * * @return the nested Map data structure */ protected BeansModel makeDataModel() { Object bean = null; String problem = null; boolean editable = false; Object target = null; if (StringUtils.isNotBlank(beanPath)) { try { int firstDot = beanPath.indexOf("."); String beanName = firstDot < 0 ? beanPath : beanPath.substring(0, firstDot); Object namedBean = appCtx.getBean(beanName); if (firstDot < 0) { target = namedBean; bean = makePresentableMapFor(null, target, beanPath); } else { BeanWrapperImpl bwrap = new BeanWrapperImpl(namedBean); String propPath = beanPath.substring(firstDot + 1); target = bwrap.getPropertyValue(propPath); Class<?> type = bwrap.getPropertyType(propPath); if (bwrap.isWritableProperty(propPath) && (bwrap.getDefaultEditor(type) != null || type == String.class) && !Collection.class.isAssignableFrom(type)) { editable = true; bean = makePresentableMapFor(null, target); } else { bean = makePresentableMapFor(null, target, beanPath); } } } catch (BeansException e) { problem = e.toString(); } } Collection<Object> nestedNames = new LinkedList<Object>(); Set<Object> alreadyWritten = new HashSet<Object>(); addPresentableNestedNames(nestedNames, appCtx.getBean("crawlController"), alreadyWritten); for (String name : appCtx.getBeanDefinitionNames()) { addPresentableNestedNames(nestedNames, appCtx.getBean(name), alreadyWritten); } return new BeansModel(cj.getShortName(), new Reference(getRequest().getResourceRef().getBaseRef(), "..").getTargetRef().toString(), beanPath, bean, editable, problem, target, nestedNames); }
From source file:org.metis.cassandra.CqlComponent.java
private void initComponent() throws Exception { if (LOG.isTraceEnabled()) { LOG.trace("initComponent: Component has not yet been initialized"); LOG.trace("initComponent: Using this context file name: " + dfltContextFileName); }/*from w ww . ja v a2 s . c o m*/ ConfigurableApplicationContext cassandraContext = null; // load the spring application context, which should be somewhere // in the application's classpath if (myContextFileName == null) { myContextFileName = dfltContextFileName; } try { cassandraContext = new ClassPathXmlApplicationContext(myContextFileName); setClients(cassandraContext.getBeansOfType(Client.class)); } catch (BeansException exc) { LOG.error("initComponent: caught this exception while " + "attempting to load spring context file: " + exc.toString()); throw exc; } if (getClients() == null || getClients().isEmpty()) { cassandraContext.close(); throw new Exception("there are no beans of type Client in the Spring XML file"); } // now that the context has been successfully loaded, create a new // profile and continue the init process setComponentProfile(new ComponentProfile(cassandraContext, myContextFileName, this)); initClientMapper(cassandraContext); initProfileMonitor(); }