"> *
* @ see com.gmail.dosofredriver.ajax.serviceserver.service.Service;
* / java.lang.annotation. *;
@ Documented
@ Target (ElementType.METHOD)
@ Retention (RetentionPolicy.RUNTIME) @ interface ServiceMethod {
}com.gmail.dosofredriver.ajax.serviceserver.util.collections;java.util.Comparator;
/ **
* Date: 29.03.13
* Time: 21:51
*
* @ author DoSOfRR
* / class DefaultOrderComparator implements Comparator {
@ Overrideint compare (Object o1, Object o2) {1;
}
}com.gmail.dosofredriver.ajax.serviceserver.util.configure;com.gmail.dosofredriver.ajax.serviceserver.server.TCPServer;com.gmail.dosofredriver.ajax.serviceserver.server.handlers.ConnectionFilter;com.gmail.dosofredriver.ajax.serviceserver.service.worker.Worker;com.gmail.dosofredriver.ajax.serviceserver.util.logger.ServerLogger;java.io.File;java.io.FileInputStream;java.io.IOException;java.util.StringTokenizer;
/ **
* Date: 26.04.13
* Time: 2:14
*
* @ author DoSOfRR
* / Class Configurator {ConnectionFilter configuredFilter; ServerLogger configuredLogger; TCPServer configuredServer; Worker configuredWorker; Configurator (String configPath) throws IOException {(configPath);
} void init (String configPath) throws IOException {data=readFile (configPath); (data == null) {();;
} (data);
} void parseConfig (String data) throws IOException {whiteList_path=ConnectionFilter.DEFAULT_WHITELIST_PATH; blackList_path=ConnectionFilter.DEFAULT_BLACKLIST_PATH; server_ip=TCPServer.DEFAULT_IP_ADDRESS; log_name=ServerLogger.DEFAULT_LOG_NAME; server_pool_size=TCPServer.DEFAULT_POOL_SIZE; worker_pool_size= Worker.DEFAULT_POOL_SIZE; server_port=TCPServer.DEFAULT_PORT; blackListOn=false; whiteListOn=false; tokenizer=new StringTokenizer (data); (tokenizer.hasMoreTokens ()) {line=tokenizer.nextToken (); type=linebstring (0, line.indexOf («=»)); value=linebstring (line.indexOf («=») +1, line.length ()); (type.toLowerCase ()) {«server-pool-size » : Server_pool_size=Integer.parseInt (value); break; «worker-pool-size» : Worker_pool_size=Integer.parseInt (value); break; «server-port» : Server_port=Integer.parseInt (value); break; «server-ip» : Server_ip=value; break; «log-name» : Log_name=value; break; «blacklist» : BlackListOn=Boolean.parseBoolean (value); break; «whitelist» : WhiteListOn=Boolean.parseBoolean (value); break; «whitelist-path» : WhiteList_path=value; break; «blacklist-path» : BlackList_path=value; break;: System.err.println («Unknown config option -» + value);
}. configuredWorker=new Worker (worker_pool_size);. configuredServer=new TCPServer (server_port, server_pool_size, server_ip);. configuredLogger=new ServerLogger (ServerLogger.DEFAULT_NAME, log_name);. configuredFilter=new ConnectionFilter ( );
/ / configure filter (blackListOn) {. configuredFilter.setOption (ConnectionFilter.BLACKLIST_ON, blackList_path);