方磊
3 years ago
4 changed files with 63 additions and 25 deletions
@ -0,0 +1,52 @@ |
|||||||
|
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; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue