コード例 #1
0
ファイル: OauthLoginAct.java プロジェクト: jacking124/Rk_Cms
 public void init() throws Exception {
   SocialAuthConfig config = new SocialAuthConfig();
   File devConfig = Files.findFile("oauth_consumer.properties_dev"); // 开发期所使用的配置文件
   if (devConfig == null) devConfig = Files.findFile("oauth_consumer.properties"); // 真实环境所使用的配置文件
   if (devConfig == null) config.load(new NullInputStream());
   else config.load(new FileInputStream(devConfig));
   this.config = config;
 }
コード例 #2
0
 /**
  * Loads the application configuration from the given file
  *
  * @param fileName the file name which contains the application configuration properties
  * @throws Exception
  */
 public void load(final String fileName) throws Exception {
   if (!isConfigLoaded) {
     LOG.debug("Loading application configuration from file " + fileName);
     ClassLoader loader = SocialAuthConfig.class.getClassLoader();
     try {
       InputStream in = loader.getResourceAsStream(fileName);
       load(in);
     } catch (NullPointerException ne) {
       throw new FileNotFoundException(fileName + " file is not found in your class path");
     }
   }
 }
コード例 #3
0
 /**
  * Loads the application configuration from the given input stream Format of the input stream
  * should be as follows: <br>
  * www.google.com.consumer_key = opensource.brickred.com
  *
  * @param inputStream property file input stream which contains the configuration.
  * @throws Exception
  */
 public void load(final InputStream inputStream) throws Exception {
   if (!isConfigLoaded) {
     LOG.debug("Loading application configuration through input stream.");
     Properties props = new Properties();
     try {
       props.load(inputStream);
       load(props);
     } catch (IOException ie) {
       throw new IOException("Could not load configuration from input stream");
     }
   }
 }
コード例 #4
0
 /**
  * Loads the application properties from oauth_consumer.properties file.
  *
  * @throws Exception
  */
 public void load() throws Exception {
   if (!isConfigLoaded) {
     LOG.debug("Loading application configuration from file " + OAUTH_CONSUMER_PROPS);
     load(OAUTH_CONSUMER_PROPS);
   }
 }
コード例 #5
0
 /**
  * Setter for application configuration properties.
  *
  * @param applicationProperties the application configuration properties
  */
 public void setApplicationProperties(final Properties applicationProperties) throws Exception {
   LOG.info("Loading application properties");
   this.applicationProperties = applicationProperties;
   load(this.applicationProperties);
 }