de.fraunhofer.iese.ind2uce.autoconfiguration.InduceWebServiceAutoConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core.webservice Show documentation
Show all versions of core.webservice Show documentation
IND2UCE :: Webproject related contents like JSON, Autoconfiguration of Spring, etc.
/*-
* =================================LICENSE_START=================================
* IND2UCE
* %%
* Copyright (C) 2016 Fraunhofer IESE (www.iese.fraunhofer.de)
* %%
* The Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Hansastrasse 27c, 80686 Munich, Germany (further: Fraunhofer) is holder of all proprietary rights on this computer program.
* You can only use this computer program if you have closed a license agreement with Fraunhofer or you get the right to use the computer program from someone who is authorized to grant you that right.
* Any use of the computer program without a valid license is prohibited and liable to prosecution.
*
* Copyright (C) 2018 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V. acting on behalf of its Fraunhofer Institute for Experimental Software Engineering (IESE)
*
* All rights reserved.
*
* Contact: [email protected]
* =================================LICENSE_END=================================
*/
package de.fraunhofer.iese.ind2uce.autoconfiguration;
import de.fraunhofer.iese.ind2uce.api.component.identifier.EnforcementScopeId;
import de.fraunhofer.iese.ind2uce.api.component.identifier.EnforcementScopeTypeId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.net.URI;
/**
* Thsis Configuration class congfigures the most common.
*/
@Configuration
@EnableConfigurationProperties(Ind2uceConfigurationProperties.class)
@AutoConfigureAfter(PropertyPlaceholderAutoConfiguration.class)
public class InduceWebServiceAutoConfiguration {
/**
* The properties.
*/
@Autowired
private Ind2uceConfigurationProperties properties;
/**
* Pmp uri.
*
* @return the uri
*/
@Bean(name = "pmpUri")
public URI pmpUri() {
return URI.create(this.properties.getPmpUri());
}
/**
* Pmp id.
*
* @return the string
*/
@Bean(name = "pmpId")
public String pmpId() {
return this.properties.getPmpId();
}
/**
* Pdp uri.
*
* @return the uri
*/
@Bean(name = "pdpUri")
@ConditionalOnClass(name = "de.fraunhofer.iese.ind2uce.pdp.java.PolicyDecisionPoint")
public URI pdpUri() {
return URI.create(this.properties.getPdpUri());
}
/**
* Es is.
*
* @return the enforcement scope id
*/
@Bean(name = "enforcementScopeId")
public EnforcementScopeId esIs() {
return new EnforcementScopeId(this.properties.getEsId());
}
/**
* Es type.
*
* @return the enforcement scope type id
*/
@Bean(name = "enforcementScopeType")
public EnforcementScopeTypeId esType() {
return new EnforcementScopeTypeId(this.properties.getEsType());
}
/**
* Num threads.
*
* @return the int
*/
@Bean(name = "numThreads")
public int numThreads() {
return this.properties.getNumThreads() == 0 ? 1 : this.properties.getNumThreads();
}
/**
* Validate schema.
*
* @return true, if successful
*/
@Bean(name = "schemaValidation")
public boolean validateSchema() {
return this.properties.isValidateSchema();
}
}