[Java-link-svn] SF.net SVN: java-link: [25] branches/private_welterde0/server/src/main/java /org/jl
Status: Pre-Alpha
Brought to you by:
welterde0
From: <wel...@us...> - 2006-11-25 17:12:13
|
Revision: 25 http://svn.sourceforge.net/java-link/?rev=25&view=rev Author: welterde0 Date: 2006-11-25 09:12:10 -0800 (Sat, 25 Nov 2006) Log Message: ----------- removed legacy code Removed Paths: ------------- branches/private_welterde0/server/src/main/java/org/jlink/CoreController.java branches/private_welterde0/server/src/main/java/org/jlink/DatabaseController.java branches/private_welterde0/server/src/main/java/org/jlink/LoginController.java branches/private_welterde0/server/src/main/java/org/jlink/Options.java branches/private_welterde0/server/src/main/java/org/jlink/ServerCore.java branches/private_welterde0/server/src/main/java/org/jlink/ServerDatabase.java branches/private_welterde0/server/src/main/java/org/jlink/ServerMain.java branches/private_welterde0/server/src/main/java/org/jlink/ServerNetwork.java branches/private_welterde0/server/src/main/java/org/jlink/server/db/ Deleted: branches/private_welterde0/server/src/main/java/org/jlink/CoreController.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/CoreController.java 2006-11-25 16:50:09 UTC (rev 24) +++ branches/private_welterde0/server/src/main/java/org/jlink/CoreController.java 2006-11-25 17:12:10 UTC (rev 25) @@ -1,37 +0,0 @@ -/* - * CoreController.java - * - * Created on 10. Januar 2006, 18:54 - * - * JLink: An Introversion Uplink Clone with multiplayer support. - * Copyright (C) 2006 Tassilo Schweyer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package org.jlink; - -/** - * - * @author tassilo - */ -public interface CoreController { - - public void createConnection(int id, String rhost); - public void destroyConnection(int id); - - public boolean login(int id, String user, String pass); - public void logout(int id); -} Deleted: branches/private_welterde0/server/src/main/java/org/jlink/DatabaseController.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/DatabaseController.java 2006-11-25 16:50:09 UTC (rev 24) +++ branches/private_welterde0/server/src/main/java/org/jlink/DatabaseController.java 2006-11-25 17:12:10 UTC (rev 25) @@ -1,32 +0,0 @@ -/* - * DatabaseController.java - * - * Created on 9. Januar 2006, 20:04 - * - * JLink: An Introversion Uplink Clone with multiplayer support. - * Copyright (C) 2006 Tassilo Schweyer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package org.jlink; - -/** - * - * @author tassilo - */ -public interface DatabaseController { - -} Deleted: branches/private_welterde0/server/src/main/java/org/jlink/LoginController.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/LoginController.java 2006-11-25 16:50:09 UTC (rev 24) +++ branches/private_welterde0/server/src/main/java/org/jlink/LoginController.java 2006-11-25 17:12:10 UTC (rev 25) @@ -1,36 +0,0 @@ -/* - * LoginController.java - * - * Created on 10. Januar 2006, 19:37 - * - * JLink: An Introversion Uplink Clone with multiplayer support. - * Copyright (C) 2006 Tassilo Schweyer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package org.jlink; - -/** - * - * @author tassilo - */ -public class LoginController { - - /** Creates a new instance of LoginController */ - public LoginController() { - } - -} Deleted: branches/private_welterde0/server/src/main/java/org/jlink/Options.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/Options.java 2006-11-25 16:50:09 UTC (rev 24) +++ branches/private_welterde0/server/src/main/java/org/jlink/Options.java 2006-11-25 17:12:10 UTC (rev 25) @@ -1,54 +0,0 @@ -/* - * Options.java - * - * Created on 23. Februar 2006, 17:02 - * - * JLink: An Introversion Uplink Clone with multiplayer support. - * Copyright (C) 2006 Tassilo Schweyer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package org.jlink; - -//import::sys -//import::sys::log4j -import org.apache.log4j.Level; - -/** - * - * @author tassilo - */ -public class Options { - private Options() { - } - - public static final boolean GLOBAL_LOGGING_USED = true; - //logging levels(more higher, more logging output) - //public static final Level GLOBAL_LOGGING_LEVEL_CONSOLE = Level.ALL; - public static final Level GLOBAL_LOGGING_LEVEL_CONSOLE = Level.TRACE; - //public static final Level GLOBAL_LOGGING_LEVEL_CONSOLE = Level.DEBUG; - //public static final Level GLOBAL_LOGGING_LEVEL_CONSOLE = Level.INFO; - //public static final Level GLOBAL_LOGGING_LEVEL_CONSOLE = Level.ERROR; - //public static final Level GLOBAL_LOGGING_LEVEL_CONSOLE = Level.FATAL; - public static final String GLOBAL_VERSION = "0.0.1pre-alpha"; - - public static final boolean FRONTEND_LOCAL = true; - - - public static final int NETWORK_LISTEN_PORT = 3470; - public static final int NETWORKBACK_C_ERR = 1000; //if your Connection is bad set this var higher - -} Deleted: branches/private_welterde0/server/src/main/java/org/jlink/ServerCore.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/ServerCore.java 2006-11-25 16:50:09 UTC (rev 24) +++ branches/private_welterde0/server/src/main/java/org/jlink/ServerCore.java 2006-11-25 17:12:10 UTC (rev 25) @@ -1,134 +0,0 @@ -/* - * ServerCore.java - * - * Created on 27. Februar 2006, 11:49 - * - * JLink: An Introversion Uplink Clone with multiplayer support. - * Copyright (C) 2006 Tassilo Schweyer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package org.jlink; - -//import -//import::own -//import::sys -import org.apache.log4j.Logger; -//import::sys::util -import java.util.Vector; -import java.util.concurrent.Executors; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Callable; - -/** - * - * @author tassilo - */ -public class ServerCore extends Core implements CoreController { - - protected void runCoreSuf() { - } - - public void createConnection(int id, String rhost) { - synchronized(this.conLock) { - } - } - - public void destroyConnection(int id) { - } - - public boolean login(int id, String user, String pass) { - return false; - } - - public void logout(int id) { - } - - - - - ServerCore() { - this.conIDs = new Vector<String>(); - this.mod_run = Executors.newCachedThreadPool(); - } - - protected Core createCore() { - ServerCore ret = null; - ret = new ServerCore(); - ret.log = Logger.getLogger("jlink.core"); - - //Creating Core - ret.log.info("Core::create()"); - - - //createing other modules - ret.log.debug("Core::creteModules()"); - ret.mod_network = ServerNetwork.create(this); - - return ret; - } - - protected void runCore() throws Exception { - this.c_gc++; - if(this.c_gc > 14000) { - this.c_gc = 0; - log.debug("System::gc()"); - System.gc(); - } - this.c_final++; - if(this.c_final > 28000) { - this.c_final = 0; - log.debug("System::finalize()"); - System.runFinalization(); - } - Thread.sleep(1); - } - - protected void runCorePre() { - log.debug("calling other modules"); - this.mod_run.submit(new Callable<Void>() { - public Void call() throws Exception { - log.info("Network::run()"); - mod_network.run(); - - return null; - } - }); - } - - ///////////////////////// - ///////////////////////// - ////private Variables//// - ///////////////////////// - ///////////////////////// - //Composite// - ///////////// - private ServerNetwork mod_network = null; - private ServerDatabase mod_database = null; - private ExecutorService mod_run = null; - ////////////// - //Connection// - ////////////// - private Vector<String> conIDs = null; - private Byte conLock = null; - - ////////////////// - //internal Usage// - ////////////////// - private Logger log = null; - private int c_gc = 0; - private int c_final = 0; -} Deleted: branches/private_welterde0/server/src/main/java/org/jlink/ServerDatabase.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/ServerDatabase.java 2006-11-25 16:50:09 UTC (rev 24) +++ branches/private_welterde0/server/src/main/java/org/jlink/ServerDatabase.java 2006-11-25 17:12:10 UTC (rev 25) @@ -1,88 +0,0 @@ -/* - * ServerDatabase.java - * - * Created on 27. Februar 2006, 11:53 - * - * JLink: An Introversion Uplink Clone with multiplayer support. - * Copyright (C) 2006 Tassilo Schweyer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package org.jlink; - -//import -//import::sys -//import::sys::log4j -import org.apache.log4j.Logger; - -/** - * - * @author tassilo - */ -public class ServerDatabase implements Module { - - public static ServerDatabase create(Core c) { - ServerDatabase ret = null; - ret = new ServerDatabase(); - ret.log = Logger.getLogger("jlink.database.core"); - ret.log.info("Database::create()"); - - - return ret; - } - - public synchronized void run() throws IllegalStateException { - log.info("Database::run()"); - if(!this.keep) - throw new IllegalStateException(); - log.debug("in started state now"); - while(this.keep) { - try { - log.trace("sleeping, 100ms"); - Thread.sleep(100); - } - catch(Exception e) { - - } - } - log.debug("in stopped state now"); - } - - public void destroy() { - log.info("Database::destroy()"); - this.keep = false; - } - - public boolean isDestroyed() { - return this.keep; - } - - public void join() { - } - - - - - - - - - private ServerDatabase() { - } - - private Logger log = null; - private boolean keep = true; -} Deleted: branches/private_welterde0/server/src/main/java/org/jlink/ServerMain.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/ServerMain.java 2006-11-25 16:50:09 UTC (rev 24) +++ branches/private_welterde0/server/src/main/java/org/jlink/ServerMain.java 2006-11-25 17:12:10 UTC (rev 25) @@ -1,116 +0,0 @@ -/* - * ServerMain.java - * - * Created on 14. Februar 2006, 19:36 - * - * JLink: An Introversion Uplink Clone with multiplayer support. - * Copyright (C) 2006 Tassilo Schweyer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package org.jlink; - -//import::own -//import::own::jmx -import org.jlink.server.jmx.JMXAgent; -//import::own::net -//import::sys -//import::sys::io -import java.io.File; -//import::sys::log4j -import org.apache.log4j.Logger; -import org.apache.log4j.BasicConfigurator; -import org.apache.log4j.FileAppender; -import org.apache.log4j.PatternLayout; -import org.apache.log4j.Level; -import org.apache.log4j.ConsoleAppender; - -/** - * - * @author tassilo - */ -public class ServerMain { - private static File dir_home = null; - private ServerMain() { - } - - /** - * @param args the command line arguments - */ - public static void main(String[] args) throws Exception { - Logger log = null; - Core mod_core = null; - - dir_home = new File(new File(System.getProperty("user.home")), ".jlink"); - - //start logging - setupLog4j(); - log = Logger.getLogger("jlink"); - log.info("logging started"); - outputSystemInformation(); - compile(); - setup(); - Core.setImpl(new ServerCore()); - mod_core = Core.create(); - setupJMX(); - mod_core.run(); - log.info("logging stopped"); - System.exit(0); - } - - private static void setupLog4j() throws Exception { - if(Options.GLOBAL_LOGGING_USED) { - File dir_logs = new File(dir_home, "logs"); - dir_logs.mkdirs(); - FileAppender log4j_file = new FileAppender(new PatternLayout(), new File(dir_logs, "server.log").getAbsolutePath()); - log4j_file.setLayout(new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN)); - log4j_file.clearFilters(); - log4j_file.setThreshold(Level.ALL); - Logger.getRootLogger().setLevel(Level.ALL); - BasicConfigurator.configure(log4j_file); - ConsoleAppender log4j_con = new ConsoleAppender(new PatternLayout("%-5p [%-15t | %10x]: %m%n"), "System.err"); - log4j_con.setThreshold(Options.GLOBAL_LOGGING_LEVEL_CONSOLE); - BasicConfigurator.configure(log4j_con); - } - } - private static void compile() { - Logger log = Logger.getLogger("jlink"); - log.info("pre-compiling some classes"); - boolean b = false; - b = b || Compiler.compileClass(ServerNetwork.class); - log.debug("check for enabled compiling result 1: " + b); - //TODO: do some more checks - if(b) { - //compile more classes - } else { - log.error("Cannot pre-compile classes"); - } - } - private static void setup() { - } - private static void setupJMX() { - JMXAgent agent = JMXAgent.getDefault(); - } - private static void outputSystemInformation() { - Logger log = Logger.getLogger("jlink"); - log.debug("#############JLink############"); - log.debug("##############################"); - log.debug("############System############"); - log.debug("##########Information#########"); - log.debug("##############################"); - log.debug("System.compiler: " + System.getProperty("java.compiler")); - } -} Deleted: branches/private_welterde0/server/src/main/java/org/jlink/ServerNetwork.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/ServerNetwork.java 2006-11-25 16:50:09 UTC (rev 24) +++ branches/private_welterde0/server/src/main/java/org/jlink/ServerNetwork.java 2006-11-25 17:12:10 UTC (rev 25) @@ -1,163 +0,0 @@ -/* - * ServerNetwork.java - * - * Created on 27. Februar 2006, 11:53 - * - * JLink: An Introversion Uplink Clone with multiplayer support. - * Copyright (C) 2006 Tassilo Schweyer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package org.jlink; - -//import -//import::own -import java.io.IOException; -import org.jlink.Options; -//import::own::net -import org.jlink.net.ConnectionHandler; -import org.jlink.net.ConnectionListener; -import org.jlink.net.Message; -//import::own::net::msgs -import org.jlink.net.msgs.ConnectionEnding; -import org.jlink.net.msgs.Login; -//import::sys -import org.apache.log4j.Logger; -import org.apache.log4j.NDC; -//import::sys::util -import java.util.Map; -import java.util.HashMap; - - -/** - * - * @author tassilo - */ -public class ServerNetwork implements Module { - - public static ServerNetwork create(ServerCore c) { - ServerNetwork ret = null; - ret = new ServerNetwork(); - ret.log = Logger.getLogger("jlink.net.core"); - - //Network::create - ret.log.info("Network::create()"); - ret.mod_core = c; - - //creating other Parts - ret.log.debug("Network::createParts()"); - try { - ret.log.debug("trying to listen on Port: " + Options.NETWORK_LISTEN_PORT); - //TODO: something to put here - ret.log.debug("ok we're listening"); - //} catch (IOException ex) { - // ret.log.error("Cannot listen", ex); - //throw new RuntimeException("cannot listen", ex); - } finally { - - } - - - return ret; - } - - public synchronized void run() throws IllegalStateException { - if(!this.status_active) - throw new IllegalStateException("already destroyed"); - log.debug("Network::Core::run() started"); - - - String[] cons = null; - ConnectionHandler curCH = null; - Message cur = null; - int i = 0; - - while(this.status_active) { - try { - Thread.sleep(100); - } catch (InterruptedException ex) { - ex.printStackTrace(); - } - } - log.debug("Network::Core::run() stopped"); - } - - public void destroy() { - this.status_active = false; - } - - public boolean isDestroyed() { - return this.status_active; - } - - //Connection-Services - public void conRegister(int id, final ConnectionHandler h) { - if(h == null) - throw new NullPointerException(); - final String i = "" + id; - log.debug("creating Listener"); - h.setConnectionListener(new ConnectionListener() { - public void recived(Message m) { - try { - NDC.push(i); - conOperate(h, m, i); - NDC.clear(); - } catch(Exception e) { - log.error("Exception catched", e); - NDC.clear(); - } - } - }); - } - - - private ServerNetwork() { - } - - //run-Methods - private void conOperate(ConnectionHandler h, Message c, String id) throws Exception { - //check for connectionEnd - NDC.push("choose"); - if(c instanceof ConnectionEnding) { - log.debug("Message type is ConEnding =>disconnecting"); - h.disconnect(); - } else if(c instanceof Login) { - log.debug("Message type is Login=>login"); - Login t = (Login) c; - String pass = t.getUsername(); - String user = t.getPassword(); - } - } - - public void join() { - } - - ///////////////////////// - ///////////////////////// - ////private Variables//// - ///////////////////////// - ///////////////////////// - //Composite// - ///////////// - private ServerCore mod_core = null; - private Logger log = null; - - //////////////////// - //internal::Status// - //////////////////// - private boolean status_active = true; - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |