List of usage examples for org.springframework.beans.factory BeanCreationException BeanCreationException
public BeanCreationException(String msg)
From source file:org.ff4j.aop.FeatureAdvisor.java
/** * Flip with alterBean is realized only if 'alterBean' property is filled and valid. * //from ww w . j av a 2 s . c o m * @param pMInvoc * current method invocation * @param alterBean * target bean to call * @param logger * current logger for the class * @return flag if alterBean should be invoked */ private boolean shouldCallAlterBeanMethod(final MethodInvocation pMInvoc, String alterBean, Logger logger) { boolean callAlterBeanMethod = false; Method method = pMInvoc.getMethod(); String currentBeanName = currentBeanName(pMInvoc); if (alterBean != null && !alterBean.isEmpty()) { if (alterBean.equals(currentBeanName)) { logger.debug("FeatureFlipping on method:{} class:{} already on the alterBean {}", method.getName(), method.getDeclaringClass().getName(), alterBean); } else { if (!appCtx.containsBean(alterBean)) { throw new BeanCreationException("ff4j-aop : bean name '" + alterBean + "' has not been found in applicationContext still declared in 'alterBean' property of bean " + method.getDeclaringClass()); } callAlterBeanMethod = true; } } return callAlterBeanMethod; }
From source file:edu.internet2.middleware.shibboleth.common.config.resource.SVNResourceBeanDefinitionParser.java
/** * Gets the value of the {@value #REPOSITORY_URL_ATTRIB_NAME} attribute. * /* w ww .j a v a 2 s . c o m*/ * @param configElement resource configuration element * * @return value of the attribute * * @throws BeanCreationException thrown if the attribute is missing or contains an invalid directory path */ protected File getWorkingCopyDirectory(Element configElement) throws BeanCreationException { if (!configElement.hasAttributeNS(null, WORKING_COPY_DIR_ATTRIB_NAME)) { log.error("SVN resource definition missing required '" + WORKING_COPY_DIR_ATTRIB_NAME + "' attribute"); throw new BeanCreationException( "SVN resource definition missing required '" + WORKING_COPY_DIR_ATTRIB_NAME + "' attribute"); } File directory = new File(DatatypeHelper .safeTrimOrNullString(configElement.getAttributeNS(null, WORKING_COPY_DIR_ATTRIB_NAME))); if (directory == null) { log.error("SVN working copy directory may not be null"); throw new BeanCreationException("SVN working copy directory may not be null"); } if (!directory.exists()) { boolean created = directory.mkdirs(); if (!created) { log.error("SVN working copy direction " + directory.getAbsolutePath() + " does not exist and could not be created"); throw new BeanCreationException("SVN working copy direction " + directory.getAbsolutePath() + " does not exist and could not be created"); } } if (!directory.isDirectory()) { log.error("SVN working copy location " + directory.getAbsolutePath() + " is not a directory"); throw new BeanCreationException( "SVN working copy location " + directory.getAbsolutePath() + " is not a directory"); } if (!directory.canRead()) { log.error("SVN working copy directory " + directory.getAbsolutePath() + " can not be read by this process"); throw new BeanCreationException("SVN working copy directory " + directory.getAbsolutePath() + " can not be read by this process"); } if (!directory.canWrite()) { log.error("SVN working copy directory " + directory.getAbsolutePath() + " can not be written to by this process"); throw new BeanCreationException("SVN working copy directory " + directory.getAbsolutePath() + " can not be written to by this process"); } return directory; }
From source file:de.extra.client.core.builder.impl.MessageBuilderLocator.java
/** * Prft. ob der gefundene Builder zu dem deklarierten Teil passt * //from w w w .j ava 2 s . c o m * @param complexTypeBuilder * @param builderXmlType */ private void validateComplexTypeBuilder(final IXmlComplexTypeBuilder complexTypeBuilder, final String currentBuilderXmlBype, final String beanName) { Assert.notNull(complexTypeBuilder, "XmlBuilder " + currentBuilderXmlBype + " not found for Bean " + beanName); final String compexTypeBuilderXmlType = complexTypeBuilder.getXmlType(); if (!currentBuilderXmlBype.equals(compexTypeBuilderXmlType)) { throw new BeanCreationException("Configured IXmlComplexTypeBuilder : " + complexTypeBuilder + " does not match the desired XmlType: " + currentBuilderXmlBype); } }
From source file:org.ff4j.aop.FeatureAdvisor.java
private Object callAlterClazzMethodOnFirst(final MethodInvocation pMInvoc, Flip ff, Logger targetLogger) throws Throwable { Map<String, ?> beans = appCtx.getBeansOfType(pMInvoc.getMethod().getDeclaringClass()); for (Object bean : beans.values()) { if (isBeanAProxyOfAlterClass(bean, ff.alterClazz())) { return callAlterClazzMethod(pMInvoc, bean, targetLogger); }/* w ww . ja v a 2 s . c o m*/ } throw new BeanCreationException("ff4j-aop : bean with class '" + ff.alterClazz() + "' has not been found in applicationContext still declared in 'alterClazz' property of bean " + pMInvoc.getMethod().getDeclaringClass()); }
From source file:edu.internet2.middleware.shibboleth.common.config.resource.SVNResourceBeanDefinitionParser.java
/** * Gets the value of the {@value #REVISION_ATTRIB_NAME} attribute. * // www .ja v a 2 s . c om * @param configElement resource configuration element * * @return value of the attribute * * @throws BeanCreationException thrown if the attribute is missing or contains an invalid number */ protected long getRevision(Element configElement) throws BeanCreationException { if (!configElement.hasAttributeNS(null, REVISION_ATTRIB_NAME)) { return -1; } else { try { return Long.parseLong(DatatypeHelper .safeTrimOrNullString(configElement.getAttributeNS(null, WORKING_COPY_DIR_ATTRIB_NAME))); } catch (NumberFormatException e) { log.error("SVN resource definition attribute '" + REVISION_ATTRIB_NAME + "' contains an invalid number"); throw new BeanCreationException("SVN resource definition attribute '" + REVISION_ATTRIB_NAME + "' contains an invalid number"); } } }
From source file:de.codesourcery.eve.skills.calendar.impl.DefaultCalendarManager.java
@Override public void afterPropertiesSet() throws Exception { if (inputFile == null) { throw new BeanCreationException("inputFile cannot be NULL"); }// w w w . j a v a 2 s . c om if (payloadTypeFactory == null) { throw new BeanCreationException("payloadTypeFactory cannot be NULL"); } }
From source file:edu.internet2.middleware.shibboleth.common.config.resource.SVNResourceBeanDefinitionParser.java
/** * Gets the value of the {@value #RESOURCE_FILE_ATTRIB_NAME} attribute. * //from w ww. j a va 2s.c o m * @param configElement resource configuration element * * @return value of the attribute * * @throws BeanCreationException thrown if the attribute is missing or contains an empty string */ protected String getResourceFile(Element configElement) throws BeanCreationException { if (!configElement.hasAttributeNS(null, RESOURCE_FILE_ATTRIB_NAME)) { log.error("SVN resource definition missing required '" + RESOURCE_FILE_ATTRIB_NAME + "' attribute"); throw new BeanCreationException( "SVN resource definition missing required '" + RESOURCE_FILE_ATTRIB_NAME + "' attribute"); } String filename = DatatypeHelper .safeTrimOrNullString(configElement.getAttributeNS(null, RESOURCE_FILE_ATTRIB_NAME)); if (filename == null) { log.error("SVN resource definition attribute '" + RESOURCE_FILE_ATTRIB_NAME + "' may not be an empty string"); throw new BeanCreationException("SVN resource definition attribute '" + RESOURCE_FILE_ATTRIB_NAME + "' may not be an empty string"); } return filename; }
From source file:org.jasig.portlet.announcements.controller.AnnouncementsViewController.java
@Override public void afterPropertiesSet() throws Exception { guestAnnouncementCache = cm.getCacheManager().getCache("guestAnnouncementCache"); if (guestAnnouncementCache == null) { throw new BeanCreationException("Required guestAnnouncementCache could not be loaded."); } else {/* w ww . j a v a 2 s. c om*/ logger.debug("guestAnnouncementCache created."); } }
From source file:edu.internet2.middleware.shibboleth.common.config.resource.SVNResourceBeanDefinitionParser.java
/** * Gets the value of the {@value #USERNAME_ATTRIB_NAME} attribute. * //w w w . j a v a 2 s . com * @param configElement resource configuration element * * @return value of the attribute * * @throws BeanCreationException thrown if the attribute is present but contains an empty string */ protected String getUsername(Element configElement) throws BeanCreationException { if (configElement.hasAttributeNS(null, USERNAME_ATTRIB_NAME)) { String username = DatatypeHelper .safeTrimOrNullString(configElement.getAttributeNS(null, USERNAME_ATTRIB_NAME)); if (username == null) { log.error("SVN resource definition attribute '" + USERNAME_ATTRIB_NAME + "' may not be an empty string"); throw new BeanCreationException("SVN resource definition attribute '" + USERNAME_ATTRIB_NAME + "' may not be an empty string"); } return username; } return null; }
From source file:edu.internet2.middleware.shibboleth.common.config.resource.SVNResourceBeanDefinitionParser.java
/** * Gets the value of the {@value #PASSWORD_ATTRIB_NAME} attribute. * //from www .j ava 2s. co m * @param configElement resource configuration element * * @return value of the attribute * * @throws BeanCreationException thrown if the attribute is present but contains an empty string */ protected String getPassword(Element configElement) throws BeanCreationException { if (configElement.hasAttributeNS(null, PASSWORD_ATTRIB_NAME)) { String password = DatatypeHelper .safeTrimOrNullString(configElement.getAttributeNS(null, PASSWORD_ATTRIB_NAME)); if (password == null) { log.error("SVN resource definition attribute '" + PASSWORD_ATTRIB_NAME + "' may not be an empty string"); throw new BeanCreationException("SVN resource definition attribute '" + PASSWORD_ATTRIB_NAME + "' may not be an empty string"); } return password; } return null; }