List of usage examples for org.apache.commons.configuration ConfigurationException getMessage
public String getMessage()
From source file:org.apache.juddi.validation.ValidatePublish.java
public void validateSaveBusinessMax(EntityManager em) throws DispositionReportFaultMessage { //Obtain the maxSettings for this publisher or get the defaults Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName()); Integer maxBusinesses = publisher.getMaxBusinesses(); try {/*from ww w. j a va 2s . com*/ if (maxBusinesses == null) { if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_BUSINESSES_PER_PUBLISHER)) { maxBusinesses = AppConfig.getConfiguration() .getInteger(Property.JUDDI_MAX_BUSINESSES_PER_PUBLISHER, -1); } else { maxBusinesses = -1; } } } catch (ConfigurationException e) { log.error(e.getMessage(), e); maxBusinesses = -1; //in case the configuration is not available } //if we have the maxBusinesses set for this publisher then we need to make sure we did not exceed it. if (maxBusinesses > 0) { //get the businesses owned by this publisher List<?> businessKeysFound = FindBusinessByPublisherQuery.select(em, null, publisher, null); if (businessKeysFound != null && businessKeysFound.size() > maxBusinesses) { throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxBusinessesExceeded")); } } }
From source file:org.apache.juddi.validation.ValidatePublish.java
public void validateSaveService(EntityManager em, SaveService body, Configuration config) throws DispositionReportFaultMessage { if (config == null) { try {/*w w w. j a v a 2 s . co m*/ config = AppConfig.getConfiguration(); } catch (ConfigurationException ce) { log.error("Could not optain config. " + ce.getMessage(), ce); } } // No null input if (body == null) { throw new FatalErrorException(new ErrorMessage("errors.NullInput")); } // No null or empty list List<org.uddi.api_v3.BusinessService> entityList = body.getBusinessService(); if (entityList == null || entityList.size() == 0) { throw new ValueNotAllowedException(new ErrorMessage("errors.saveservice.NoInput")); } for (org.uddi.api_v3.BusinessService entity : entityList) { // Entity specific data validation validateBusinessService(em, entity, null, config); } }
From source file:org.apache.juddi.validation.ValidatePublish.java
public void validateSaveServiceMax(EntityManager em, String businessKey) throws DispositionReportFaultMessage { //Obtain the maxSettings for this publisher or get the defaults Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName()); Integer maxServices = publisher.getMaxBusinesses(); try {/*from ww w .jav a2s . co m*/ if (maxServices == null) { if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_SERVICES_PER_BUSINESS)) { maxServices = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_SERVICES_PER_BUSINESS, -1); } else { maxServices = -1; } } } catch (ConfigurationException e) { log.error(e.getMessage(), e); maxServices = -1; //incase the configuration isn't available } //if we have the maxServices set for a business then we need to make sure we did not exceed it. if (maxServices > 0) { //get the businesses owned by this publisher org.apache.juddi.model.BusinessEntity modelBusinessEntity = em .find(org.apache.juddi.model.BusinessEntity.class, businessKey); if (modelBusinessEntity.getBusinessServices() != null && modelBusinessEntity.getBusinessServices().size() > maxServices) { throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxServicesExceeded")); } } }
From source file:org.apache.juddi.validation.ValidatePublish.java
public void validateSaveBinding(EntityManager em, SaveBinding body, Configuration config) throws DispositionReportFaultMessage { if (config == null) { try {//w w w . jav a 2 s . co m config = AppConfig.getConfiguration(); } catch (ConfigurationException ce) { log.error("Could not optain config. " + ce.getMessage(), ce); } } // No null input if (body == null) { throw new FatalErrorException(new ErrorMessage("errors.NullInput")); } // No null or empty list List<org.uddi.api_v3.BindingTemplate> entityList = body.getBindingTemplate(); if (entityList == null || entityList.size() == 0) { throw new ValueNotAllowedException(new ErrorMessage("errors.savebinding.NoInput")); } for (org.uddi.api_v3.BindingTemplate entity : entityList) { validateBindingTemplate(em, entity, null, config); } }
From source file:org.apache.juddi.validation.ValidatePublish.java
public void validateSaveBindingMax(EntityManager em, String serviceKey) throws DispositionReportFaultMessage { //Obtain the maxSettings for this publisher or get the defaults Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName()); Integer maxBindings = publisher.getMaxBindingsPerService(); try {/* w w w .j av a2s. c om*/ if (maxBindings == null) { if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_BINDINGS_PER_SERVICE)) { maxBindings = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_BINDINGS_PER_SERVICE, -1); } else { maxBindings = -1; } } } catch (ConfigurationException e) { log.error(e.getMessage(), e); maxBindings = -1; //incase the config isn't available } //if we have the maxBindings set for a service then we need to make sure we did not exceed it. if (maxBindings > 0) { //get the bindings owned by this service org.apache.juddi.model.BusinessService modelBusinessService = em .find(org.apache.juddi.model.BusinessService.class, serviceKey); if (modelBusinessService.getBindingTemplates() != null && modelBusinessService.getBindingTemplates().size() > maxBindings) { throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxBindingsExceeded")); } } }
From source file:org.apache.juddi.validation.ValidatePublish.java
public void validateSaveTModel(EntityManager em, SaveTModel body, Configuration config) throws DispositionReportFaultMessage { if (config == null) { try {/*from www.j av a2 s.c o m*/ config = AppConfig.getConfiguration(); } catch (ConfigurationException ce) { log.error("Could not optain config. " + ce.getMessage(), ce); } } // No null input if (body == null) { throw new FatalErrorException(new ErrorMessage("errors.NullInput")); } // No null or empty list List<org.uddi.api_v3.TModel> entityList = body.getTModel(); if (entityList == null || entityList.size() == 0) { throw new ValueNotAllowedException(new ErrorMessage("errors.savetmodel.NoInput")); } for (org.uddi.api_v3.TModel entity : entityList) { validateTModel(em, entity, config); } }
From source file:org.apache.juddi.validation.ValidatePublish.java
public void validateSaveTModelMax(EntityManager em) throws DispositionReportFaultMessage { //Obtain the maxSettings for this publisher or get the defaults Publisher publisher = em.find(Publisher.class, getPublisher().getAuthorizedName()); Integer maxTModels = publisher.getMaxTmodels(); try {//from w w w . j av a 2s. c o m if (maxTModels == null) { if (AppConfig.getConfiguration().containsKey(Property.JUDDI_MAX_TMODELS_PER_PUBLISHER)) { maxTModels = AppConfig.getConfiguration().getInteger(Property.JUDDI_MAX_TMODELS_PER_PUBLISHER, -1); } else { maxTModels = -1; } } } catch (ConfigurationException e) { log.error(e.getMessage(), e); maxTModels = -1; //incase the config isn't available } //if we have the TModels set for a publisher then we need to make sure we did not exceed it. if (maxTModels > 0) { //get the tmodels owned by this publisher List<?> tmodelKeysFound = FindTModelByPublisherQuery.select(em, null, publisher, null); if (tmodelKeysFound != null && tmodelKeysFound.size() > maxTModels) { throw new MaxEntitiesExceededException(new ErrorMessage("errors.save.maxTModelsExceeded")); } } }
From source file:org.apache.juddi.validation.ValidatePublish.java
public void validatePublisherAssertion(EntityManager em, org.uddi.api_v3.PublisherAssertion pubAssertion) throws DispositionReportFaultMessage { // A supplied publisher assertion can't be null if (pubAssertion == null) { throw new ValueNotAllowedException(new ErrorMessage("errors.pubassertion.NullInput")); }/*w w w.java 2 s. co m*/ // The keyedRef must not be blank and every field must contain data. org.uddi.api_v3.KeyedReference keyedRef = pubAssertion.getKeyedReference(); if (keyedRef == null || keyedRef.getTModelKey() == null || keyedRef.getTModelKey().length() == 0 || keyedRef.getKeyName() == null || keyedRef.getKeyName().length() == 0 || keyedRef.getKeyValue() == null || keyedRef.getKeyValue().length() == 0) { throw new ValueNotAllowedException(new ErrorMessage("errors.pubassertion.BlankKeyedRef")); } String fromKey = pubAssertion.getFromKey(); if (fromKey == null || fromKey.length() == 0) { throw new ValueNotAllowedException(new ErrorMessage("errors.pubassertion.BlankFromKey")); } String toKey = pubAssertion.getToKey(); if (toKey == null || toKey.length() == 0) { throw new ValueNotAllowedException(new ErrorMessage("errors.pubassertion.BlankToKey")); } if (fromKey.equalsIgnoreCase(toKey)) { throw new ValueNotAllowedException(new ErrorMessage("errors.pubassertion.SameBusinessKey")); } // Per section 4.4: keys must be case-folded fromKey = fromKey.toLowerCase(); pubAssertion.setFromKey(fromKey); toKey = toKey.toLowerCase(); pubAssertion.setToKey(toKey); validateKeyLength(toKey); validateKeyLength(fromKey); Object fromObj = em.find(org.apache.juddi.model.BusinessEntity.class, fromKey); if (fromObj == null) { throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", fromKey)); } Object toObj = em.find(org.apache.juddi.model.BusinessEntity.class, pubAssertion.getToKey()); if (toObj == null) { throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", toKey)); } if (!publisher.isOwner((UddiEntity) fromObj) && !publisher.isOwner((UddiEntity) toObj)) { throw new UserMismatchException( new ErrorMessage("errors.pubassertion.UserMismatch", fromKey + " & " + toKey)); } try { validateKeyedReference(pubAssertion.getKeyedReference(), AppConfig.getConfiguration(), false); } catch (ConfigurationException ce) { log.error("Could not optain config. " + ce.getMessage(), ce); } }
From source file:org.apache.marmotta.platform.core.services.config.ConfigurationServiceImpl.java
protected void save() { if (saveConfiguration instanceof PropertiesConfiguration) { try {//from ww w . ja va 2 s . c o m log.debug("Saving configuration values"); final PropertiesConfiguration conf = (PropertiesConfiguration) saveConfiguration; saveSecure(conf); } catch (ConfigurationException e) { log.error("could not save system configuration: {}", e.getMessage()); } } if (saveMetadata instanceof PropertiesConfiguration) { try { log.debug("Saving configuration description"); final PropertiesConfiguration conf = (PropertiesConfiguration) saveMetadata; saveSecure(conf); } catch (ConfigurationException e) { log.error("could not save system metadata: {}", e.getMessage()); } } }
From source file:org.apache.marmotta.platform.security.services.SecurityServiceImpl.java
private Configuration loadProfile(String profile, LinkedHashSet<String> profiles) { URL securityConfigUrl = this.getClass().getClassLoader() .getResource("security-profile." + profile + ".properties"); if (securityConfigUrl != null) { try {// www . j a va 2 s . c o m Configuration securityConfig = null; securityConfig = new PropertiesConfiguration(securityConfigUrl); if (securityConfig.containsKey("security.profile.base")) { final String baseP = securityConfig.getString("security.profile.base"); if (profiles.contains(baseP)) { log.warn("Cycle in security configuration detected: {} -> {}", profiles, baseP); return securityConfig; } else { profiles.add(baseP); final Configuration baseProfile = loadProfile(baseP, profiles); for (Iterator<String> keys = securityConfig.getKeys(); keys.hasNext();) { String key = keys.next(); baseProfile.setProperty(key, securityConfig.getProperty(key)); } return baseProfile; } } else { return securityConfig; } } catch (ConfigurationException e) { log.error("error parsing security-profile.{}.properties file at {}: {}", new Object[] { profile, securityConfigUrl, e.getMessage() }); } } return null; }