本文整理汇总了Java中org.oscm.converter.PropertiesLoader类的典型用法代码示例。如果您正苦于以下问题:Java PropertiesLoader类的具体用法?Java PropertiesLoader怎么用?Java PropertiesLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PropertiesLoader类属于org.oscm.converter包,在下文中一共展示了PropertiesLoader类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initBuildIdAndDate
import org.oscm.converter.PropertiesLoader; //导入依赖的package包/类
/**
* Read the build id and date from the ear manifest.
*/
private void initBuildIdAndDate() {
if (buildId != null) {
return;
}
buildId = "-1";
buildDate = "";
// read the implementation version property from the war manifest
final InputStream in = FacesContext.getCurrentInstance()
.getExternalContext()
.getResourceAsStream("/META-INF/MANIFEST.MF");
String str = null;
if (in != null) {
final Properties prop = PropertiesLoader.loadProperties(in);
str = prop.getProperty("Implementation-Version");
}
if (str == null) {
return;
}
// parse the implementation version
final int sep = str.lastIndexOf("-");
buildId = str.substring(0, sep);
SimpleDateFormat inFormat = new SimpleDateFormat("yyyyMMddHHmmss");
SimpleDateFormat outFormat = new SimpleDateFormat("yyyy/MM/dd");
try {
buildDate = outFormat
.format(inFormat.parse(str.substring(sep + 1)));
} catch (ParseException e) {
logger.error(e.getMessage());
}
}
示例2: loadConfigurationSettings
import org.oscm.converter.PropertiesLoader; //导入依赖的package包/类
protected static Properties loadConfigurationSettings() {
Properties props = PropertiesLoader.load(
DefaultConfigFileCreator.class, "configsettings.properties");
props.putAll(PropertiesLoader.load(DefaultConfigFileCreator.class,
"local/configsettings.properties"));
return props;
}
示例3: readProperties
import org.oscm.converter.PropertiesLoader; //导入依赖的package包/类
/**
* Reads the properties from the (db.)properties file, required to establish
* a database connection.
*
* @return The properties as given in the file.
* @throws FileNotFoundException
* Thrown in case the file could not be found.
* @throws IOException
* Thrown in case it cannot be read from the file.
*/
public static Properties readProperties(String dbPropertiesFile)
throws FileNotFoundException, IOException {
try {
final InputStream in = new FileInputStream(dbPropertiesFile);
return PropertiesLoader.loadProperties(in);
} catch (FileNotFoundException e) {
System.out
.println("Cannot find the file '"
+ dbPropertiesFile
+ "'! Please ensure it's in the same directory you call this class from.");
throw e;
}
}
示例4: loadLocalizedPropertiesFromFile
import org.oscm.converter.PropertiesLoader; //导入依赖的package包/类
@Override
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public Properties loadLocalizedPropertiesFromFile(String baseName,
String localeString) {
Properties properties = new Properties();
// only standard languages have mail.properties file
if (!LocaleHandler.isStandardLanguage(new Locale(localeString))) {
return properties;
}
final String resource = baseName + "_" + localeString
+ ".properties";
properties = PropertiesLoader
.load(LocalizerServiceBean.class, resource);
return properties;
}
示例5: loadPropertiesFile
import org.oscm.converter.PropertiesLoader; //导入依赖的package包/类
protected LdapProperties loadPropertiesFile(String filename)
throws FileNotFoundException, IOException {
LdapProperties ldapProperties;
Properties properties = new Properties();
FileInputStream fis = new FileInputStream(filename);
properties = PropertiesLoader.loadProperties(fis);
ldapProperties = new LdapProperties(properties);
fis.close();
return ldapProperties;
}
示例6: loadMessagePropertiesFromFile
import org.oscm.converter.PropertiesLoader; //导入依赖的package包/类
ResourceBundle loadMessagePropertiesFromFile(Locale locale, String sheetName)
throws IOException {
if (sheetName.equals(BaseBean.LABEL_USERINTERFACE_TRANSLARIONS)) {
if (LocaleHandler.isStandardLanguage(locale)) {
return PropertiesLoader.loadToBundle(
DbMessages.class,
DbMessages.class.getPackage().getName()
.replaceAll("\\.", "/")
+ "/Messages_"
+ locale.toString()
+ ".properties");
}
}
return null;
}
示例7: addCustomer
import org.oscm.converter.PropertiesLoader; //导入依赖的package包/类
public String addCustomer() throws NonUniqueBusinessKeyException,
OrganizationAuthoritiesException, ValidationException,
MailOperationException, ObjectNotFoundException,
OperationPendingException {
try {
Properties properties = null;
if (ldapManaged && organizationProperties != null) {
properties = PropertiesLoader
.loadProperties(organizationProperties.getInputStream());
}
VOUserDetails user = customerUserToAdd.getVOUserDetails();
user.setLocale(customerToAdd.getLocale());
VOOrganization org = getAccountingService().registerKnownCustomer(
customerToAdd, user, LdapProperties.get(properties),
marketplaceId);
// data must be empty for the next customer to create
customerToAdd = null;
customerUserToAdd = null;
String orgId = "";
if (org != null) {
orgId = org.getOrganizationId();
sessionBean.setSelectedCustomerId(orgId);
}
addInfoOrProgressMessage(org != null, INFO_ORGANIZATION_CREATED,
orgId);
} catch (IOException e) {
logger.logError(Log4jLogger.SYSTEM_LOG, e,
LogMessageIdentifier.ERROR_ADD_CUSTOMER);
addMessage(null, FacesMessage.SEVERITY_ERROR, ERROR_UPLOAD);
return OUTCOME_ERROR;
}
return OUTCOME_SUCCESS;
}
示例8: initBuildIdAndDate
import org.oscm.converter.PropertiesLoader; //导入依赖的package包/类
/**
* Read the build id and date from the ear manifest.
*/
private void initBuildIdAndDate() {
if (buildId != null) {
return;
}
buildId = "-1";
buildDate = "";
// read the implementation version property from the war manifest
final InputStream in = FacesContext.getCurrentInstance()
.getExternalContext()
.getResourceAsStream("/META-INF/MANIFEST.MF");
String str = null;
if (in != null) {
final Properties prop = PropertiesLoader.loadProperties(in);
str = prop.getProperty("Implementation-Version");
}
if (str == null) {
return;
}
// parse the implementation version
final int sep = str.lastIndexOf("-");
buildId = str.substring(0, sep);
SimpleDateFormat inFormat = new SimpleDateFormat("yyyyMMddHHmmss");
SimpleDateFormat outFormat = new SimpleDateFormat("yyyy/MM/dd");
try {
buildDate = outFormat
.format(inFormat.parse(str.substring(sep + 1)));
} catch (ParseException e) {
logger.logError(Log4jLogger.SYSTEM_LOG, e,
LogMessageIdentifier.ERROR_FORMATTING_BUILD_DATE);
}
}
示例9: readPropertyFile
import org.oscm.converter.PropertiesLoader; //导入依赖的package包/类
private static Properties readPropertyFile(final String file)
throws IOException {
return PropertiesLoader.loadProperties(new FileInputStream(file));
}
示例10: importSettings
import org.oscm.converter.PropertiesLoader; //导入依赖的package包/类
public String importSettings() throws SaaSApplicationException {
Properties propsToStore = new Properties();
Part file = model.getFile();
// TODO temporary fix for bug 9815 - for a proper fix, file upload
// should have required="true" and a <mp:message /> added. But message
// positioning is is hard for this case due to used layout and styles
// and additionally currently for masked inputs (file upload, select
// boxed), highlighting does not work.
if (file == null) {
ui.handleError(null, ERROR_NO_IMPORT_FILE);
return OUTCOME_ERROR;
}
try {
propsToStore = PropertiesLoader.loadProperties(file
.getInputStream());
} catch (IOException e) {
logger.logError(Log4jLogger.SYSTEM_LOG, e,
LogMessageIdentifier.ERROR_IMPORT_LDAP_SETTINGS);
addMessage(null, FacesMessage.SEVERITY_ERROR, ERROR_UPLOAD);
return OUTCOME_ERROR;
}
if (handlePlatformSettings()) {
getUserManagementService().setPlatformSettings(propsToStore);
} else {
if (model.getOrganizationIdentifier() == null) {
getUserManagementService()
.setOrganizationSettings(propsToStore);
} else {
getUserManagementService().setOrganizationSettings(
model.getOrganizationIdentifier(), propsToStore);
}
}
reinitModel();
// apply possibly changed attribute mapping for user in session
// (otherwise, 'import' page may contain wrong columns)
updateUserInSession();
addSuccessMessage("info.organization.ldapsettings.imported");
return OUTCOME_SUCCESS;
}
示例11: createOrganization
import org.oscm.converter.PropertiesLoader; //导入依赖的package包/类
/**
* Registers the newly created organization.
*
* @return <code>OUTCOME_SUCCESS</code> if the organization was successfully
* registered.
* @throws ImageException
* Thrown in case the access to the uploaded file failed.
*/
public String createOrganization() throws SaaSApplicationException {
VOOrganization newVoOrganization = null;
OrganizationRoleType[] selectedRoles = newRoles
.toArray(new OrganizationRoleType[newRoles.size()]);
LdapProperties ldapProperties = null;
if (ldapManaged && organizationProperties != null) {
try {
Properties props = PropertiesLoader
.loadProperties(organizationProperties.getInputStream());
ldapProperties = new LdapProperties(props);
} catch (IOException e) {
logger.logError(Log4jLogger.SYSTEM_LOG, e,
LogMessageIdentifier.ERROR_CREATE_ORGANIZATION);
addMessage(null, FacesMessage.SEVERITY_ERROR, ERROR_UPLOAD);
return OUTCOME_ERROR;
}
}
if (!newRoles.contains(OrganizationRoleType.SUPPLIER)
&& null != newOrganization.getOperatorRevenueShare()) {
newOrganization.setOperatorRevenueShare(null);
}
if (StringUtils.isNotBlank(getSelectedTenant())) {
Long tenantKey = Long.valueOf(getSelectedTenant());
newOrganization.setTenantKey(tenantKey);
newAdministrator.setTenantId(getSelectedTenantId());
}
newVoOrganization = getOperatorService().registerOrganization(
newOrganization, getImageUploader().getVOImageResource(),
newAdministrator, ldapProperties, selectedMarketplace,
selectedRoles);
addMessage(null, FacesMessage.SEVERITY_INFO, INFO_ORGANIZATION_CREATED,
newVoOrganization.getOrganizationId());
// Reset the form
newOrganization = null;
newAdministrator = null;
newRoles.clear();
organizationProperties = null;
selectedMarketplace = null;
selectedTenant = null;
return OUTCOME_SUCCESS;
}
示例12: getProperties
import org.oscm.converter.PropertiesLoader; //导入依赖的package包/类
/**
* Read the properties from the property file for the given skin name.
*
* @param skinName
* name of the skin for which the properties are read.
*
* @return read properties.
*/
private Properties getProperties(String skinName) {
final String resource = skinName + ".skin.properties";
return addDefaultProperties(PropertiesLoader.load(SkinBean.class,
resource));
}