You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.6 KiB
52 lines
1.6 KiB
package com.fr.design.config; |
|
|
|
import com.fr.general.IOUtils; |
|
import com.fr.log.FineLoggerFactory; |
|
import com.fr.stable.StableUtils; |
|
import com.fr.stable.StringUtils; |
|
|
|
import java.io.BufferedInputStream; |
|
import java.io.FileInputStream; |
|
import java.io.FileNotFoundException; |
|
import java.io.InputStream; |
|
import java.util.Properties; |
|
|
|
public class DesignerProperties { |
|
private static DesignerProperties holder = null; |
|
private boolean supportLoginEntry = true; |
|
|
|
public DesignerProperties() { |
|
String filePath = StableUtils.pathJoin(StableUtils.getInstallHome(), "/config/config.properties"); |
|
InputStream is = null; |
|
try { |
|
is = new BufferedInputStream(new FileInputStream(filePath)); |
|
Properties ps = new Properties(); |
|
ps.load(is); |
|
this.initProperties(ps); |
|
} catch (FileNotFoundException e) { |
|
// ignore |
|
} catch (Exception e) { |
|
FineLoggerFactory.getLogger().error(e, e.getMessage()); |
|
} finally { |
|
IOUtils.close(is); |
|
} |
|
} |
|
|
|
public static DesignerProperties getInstance() { |
|
if (holder == null) { |
|
holder = new DesignerProperties(); |
|
} |
|
return holder; |
|
} |
|
|
|
private void initProperties(Properties ps) { |
|
String supportLoginEntry = ps.getProperty("supportLoginEntry"); |
|
if (StringUtils.isNotEmpty(supportLoginEntry)) { |
|
this.supportLoginEntry = Boolean.valueOf(supportLoginEntry); |
|
} |
|
} |
|
|
|
public boolean isSupportLoginEntry() { |
|
return supportLoginEntry; |
|
} |
|
} |