br.com.jhonsapp.web.configuration.WebConfiguration Maven / Gradle / Ivy
The newest version!
package br.com.jhonsapp.web.configuration;
import java.util.Properties;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import br.com.jhonsapp.util.loader.PropertiesLoader;
@ManagedBean
@RequestScoped
public class WebConfiguration {
private static final String propertieFileName = "web_configuration.properties";
private PropertiesLoader loader = new PropertiesLoader();
private Properties properties;
public WebConfiguration() {
properties = loader.getPropertiesFile(propertieFileName);
}
public String getIP() {
String value = "web.application.ip";
loader.verifyIfValueExists(properties, value);
return loader.getProperty(this.properties, value);
}
public String getApplicationName() {
String value = "web.application.name";
loader.verifyIfValueExists(properties, value);
return loader.getProperty(this.properties, value);
}
public String getEjbProjectName() {
return getParentProjectName() + "-ejb";
}
public String getEarProjectName() {
return getParentProjectName() + "-ear";
}
public String getParentProjectName() {
String value = "parent.project.name";
loader.verifyIfValueExists(properties, value);
return loader.getProperty(properties, value);
}
}