Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * This software is provided "as is" and the authors
- * hold no liability to any damage committed by the
- * software to both physical and virtual objects.
- *
- * This software is "free" as in "freedom" and allows
- * users to do whatever they please with it.
- */
- package us.blaam;
- import us.blaam.options.*;
- /**
- * Used to configure and build a server.
- *
- * @author Thomas G. P. Nappo <canownueasy@hotmail.com>
- * @author Conner G. Davis <connergdavis@gmail.com>
- * @author Ryley M. Kimmel <ryley.kimmel@live.com>
- * @author Jordon Jensen <jwjens@live.com>
- */
- public abstract class ServerFactory {
- /**
- * The created server which <tt>ServerFactory</tt>
- * implementations should configure.
- */
- private final Server server = new Server();
- /////////////////////////////////////////////////////////////////
- // /**
- // * Retrieves the factory's {@link #server}.
- // * @return The created server which is maintained by
- // * this <tt>ServerFactory</tt>. You should prefer to
- // * configure the server through factory methods rather
- // * than directly with the instance.
- // */
- // private final Server getServer() {
- // return server;
- // }
- //////////// REMOVE NOTICE: Not needed //////////////////////////
- /**
- * Configure this server object to your liking
- * with the available options set.
- */
- public abstract void configureServer();
- /**
- *
- * @param option
- */
- protected final void setOption(ServerOption option) {
- server.setOption(option);
- }
- protected final void setPort(int port) {
- server.setPort(port);
- }
- protected final void setHostName(String hostName) {
- server.setHostName(hostName);
- }
- protected final void setName(String name) {
- server.setName(name);
- }
- public Server buildServer() {
- configureServer();
- return server;
- }
- /**
- *
- * @author Thomas G. P. Nappo <canownueasy@hotmail.com>
- * @author Conner G. Davis <connergdavis@gmail.com>
- * @author Ryley M. Kimmel <ryley.kimmel@live.com>
- * @author Jordon Jensen <jwjens@live.com>
- */
- protected enum ServerOption {
- DEBUG(new DebugOption());
- private final ServerOptionTask task;
- ServerOption(ServerOptionTask task) {
- this.task = task;
- }
- void runTask(Server server) {
- task.run(server);
- }
- }
- }
Add Comment
Please, Sign In to add comment