Ejemplo n.º 1
0
 @Bean(destroyMethod = "close")
 public BasicDataSource dataSource(@Qualifier("appConfig") AppConfiguration appConfig)
     throws IOException {
   AppBasicDataSource myDs =
       new AppBasicDataSource(
           appConfig.getDatabaseConfig().getConnectionConfig().getDriverName(),
           appConfig.getDatabaseConfig().getConnectionConfig().getUrl().trim(),
           appConfig.getDatabaseConfig().getConnectionConfig().getUserName(),
           appConfig.getDatabaseConfig().getConnectionConfig().getPassword());
   return myDs;
 }
  public void init() {

    URL url;
    HttpURLConnection connection = null;
    String targetURL =
        appConfig.getSchedulerConfig().getSchedulerUrl() + "/secure/initiateBatch/"; // here
    // is
    // my
    // local
    // server
    // url

    try {
      // Create connection
      url = new URL(targetURL);
      connection = (HttpURLConnection) url.openConnection();
      connection.setRequestProperty("Content-Type", "application/json");
      connection.setRequestProperty("Job-Execution", "true");
      connection.setUseCaches(false);
      connection.setDoOutput(true);
      connection.setConnectTimeout(120000);
      // //Get Response
      InputStream is = connection.getInputStream();
      BufferedReader rd = new BufferedReader(new InputStreamReader(is));
      String line;
      StringBuffer response = new StringBuffer();
      while ((line = rd.readLine()) != null) {
        response.append(line);
        response.append('\r');
      }
      rd.close();
      System.out.println("message=" + response.toString());

    } catch (Exception e) {

      e.printStackTrace();

    } finally {

      if (connection != null) {
        connection.disconnect();
      }
    }
  }
Ejemplo n.º 3
0
 public String getsearchEngineHomeDir(ServletContext servletContext) {
   AppConfiguration appConfiguration = appSetup(servletContext);
   String searchEngineHomeDir = SEARCHENGINE_HOME;
   if (appConfiguration.getSearchEngineConfig().getBasePath() != null
       && appConfiguration.getSearchEngineConfig().getBasePath().length() > 0) {
     searchEngineHomeDir =
         appConfiguration.getSearchEngineConfig() != null
                 && appConfiguration.getSearchEngineConfig().getBasePath() != null
                 && appConfiguration.getSearchEngineConfig().getBasePath().length() > 0
             ? appConfiguration.getSearchEngineConfig().getBasePath()
             : SEARCHENGINE_HOME;
   }
   return searchEngineHomeDir;
 }