Adilol

Server concurrency?

Dec 4th, 2011
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.26 KB | None | 0 0
  1. package com.coal.core;
  2.  
  3. /**@author Adil */
  4.  
  5. /***
  6.  * Credits and fanfares:
  7.  * Myrax(Dominic) - :D
  8.  * Mike (office.boy/Demilium) & Nillus (Nils) - Blunk (reference)
  9.  */
  10. /**@version 0.1 */
  11.  
  12. import java.io.FileInputStream;
  13. import java.io.FileOutputStream;
  14. import java.io.IOException;
  15. import java.sql.SQLException;
  16. import java.util.Properties;
  17.  
  18. import com.coal.net.*;
  19. import com.coal.storage.*;
  20. ;/** Class where all our methods are called */
  21. public class CoalEnvironment {
  22.     public static Properties conf;
  23. public static void config(){
  24. Properties conf = new  Properties();
  25.     try {
  26.         //set the properties value
  27.         conf.setProperty("url","http://localhost");
  28.         conf.setProperty("database", "bittybay");
  29.         conf.setProperty("dbuser", "root");
  30.         conf.setProperty("dbpassword", "asd");
  31.  
  32.         //save properties to project root folder
  33.         conf.store(new FileOutputStream("coal.properties"), null);
  34.         //let's write now
  35.     } catch (IOException ex) {
  36.         ex.printStackTrace();
  37.     }
  38. }
  39. public static void writeconf(){
  40.    
  41.      
  42. }
  43.     public static void main(String[] args) throws SQLException {
  44.         System.out.println();
  45.         System.out.println("#########################################");
  46.         System.out.println("##  Coal:Simple Emulation Environment  ##");
  47.         System.out.println("##     Copyright (C) 2011              ##");
  48.         System.out.println("##      Adil                           ##");
  49.         System.out.println("##      JokerCode.NET                  ##");
  50.         System.out.println("#########################################");
  51.         System.out.println("Initializing core objects...");
  52.         socket.getIP();
  53.         System.out.println("Connecting on port:" + socket.getsocket());
  54.         socket.serversocket(socket.getsocket());
  55.         System.out.println("Socket connection established!");
  56.         System.out.println("Preparing to set up TCP environment....");
  57.         socket.setTCP();
  58.         Storage.jdbcheck();
  59.         try {
  60.             //load a properties file
  61.         conf.load(new FileInputStream("coal.properties"));
  62.  
  63.             //get the property value and print it out
  64.              System.out.println(conf.getProperty("database"));
  65.         System.out.println(conf.getProperty("dbuser"));
  66.         System.out.println(conf.getProperty("dbpassword"));
  67.  
  68.     } catch (IOException ex) {
  69.         ex.printStackTrace();
  70.      }
  71.         Storage.bonecon();
  72.  
  73.    
  74.  
  75.     }}
  76.  
  77.  
Advertisement
Add Comment
Please, Sign In to add comment