// Path: src/com/seller/trade/core/ConfigurationKeys.java
// public class ConfigurationKeys {
//     public static final String ST_VERSION = "st.version";
//     public static final String ST_SERVER_PORT = "st.server_port";
//     public static final String ST_SITE_NAME = "st.site_name";
//     public static final String ST_TEMPLATES_FOLDER = "st.templates.folder";
//     public static final String ST_SITE_SLOGAN = "st.site_slogan";
//     public static final String ST_SITE_DESCRIPTION = "st.site_description";
//     public static final String ST_SITE_KEYWORDS = "st.site_keywords";
//     public static final String ST_SHIPPING_FROM = "st.shipping_from";
//     public static final String ST_HOSTNAME = "st.hostname";
//     public static final String ST_SERVER_IP = "st.server_ip";
//     public static final String ST_IS_LOBBY_SERVER = "st.is_lobby_server";
//     public static final String ST_USE_LAN_MAPPINGS= "st.use_lan_mappings";
//     public static final String ST_SEND_ACCESS_CONTROL_ALLOW_ORIGIN = "st.send_access_control_allow_origin";
//     public static final String ST_SEARCH_HOPS = "st.search.hops";
//     public static final String ST_PRODUCTS_SET = "st.products_set";
//     public static final String ST_QUERY_NODE_TIMEOUT_MS = "st.query_node_timeout_ms";
// 
//     protected ConfigurationKeys() {
//     }
// }
// 
// Path: src/com/seller/trade/services/ServiceBroker.java
// public final class ServiceBroker {
// 
//     protected final Logger LOG;
//     private final Configuration configuration;
//     private final DHTService dhtService;
//     private final StoreService storeService;
//     private final TemplateService templateService;
// 
//     private final String serverIp;
// 
//     public ServiceBroker(Configuration configuration) {
//         System.out.println("Starting ServiceBroker...");
//         this.configuration = configuration;
//         LOG = Lumberjack.getLogger(this);
//         serverIp = configuration.getString(ConfigurationKeys.ST_SERVER_IP);
//         int tcpPort = configuration.getInt(ConfigurationKeys.ST_SERVER_PORT);
// 
//         dhtService = new DHTServiceImpl(configuration.getBoolean(ConfigurationKeys.ST_USE_LAN_MAPPINGS));
//         if (!configuration.getBoolean(ConfigurationKeys.ST_IS_LOBBY_SERVER)) {
//             System.out.println("Announcing myself, not lobby.");
//             dhtService.announceNode(tcpPort);
//         } else {
//             System.out.println("Not announcing myself, I'm a lobby server....");
//         }
// 
//         storeService = new StoreService(configuration, dhtService);
//         storeService.announceProducts();
// 
//         templateService = new TemplateService(configuration);
//         System.out.println("ServiceBroker started.");
//     }
// 
//     public Configuration getConfiguration() {
//         return configuration;
//     }
// 
//     public DHTService getDhtService() { return dhtService; }
// 
//     public StoreService getStoreService() { return storeService; }
// 
//     public TemplateService getTemplateService() { return templateService; }
// }


import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import com.seller.trade.core.ConfigurationKeys;
import com.seller.trade.services.ServiceBroker;
import org.apache.velocity.VelocityContext;
/**
 * The MIT License
 ===============

 Copyright (C) 2015 SellerTrade Developers

 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
 "Software"), to deal in the Software without restriction, including
 without limitation the rights to use, copy, modify, merge, publish,
 distribute, sublicense, and/or sell copies of the Software, and to
 permit persons to whom the Software is furnished to do so, subject
 to the following conditions:

 The above copyright notice and this permission notice shall be
 included in all copies or substantial portions of the Software.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package com.seller.trade.servlets;



public final class HelloWorldServlet extends STAbstractServlet {

    public HelloWorldServlet(String command, ServiceBroker broker) {
        super(command, broker);
    }

    @Override
    protected void handleUncached(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        response.setContentType("text/html");
        response.setStatus(HttpServletResponse.SC_OK);

        VelocityContext context = new VelocityContext();
// Path: src/com/seller/trade/core/ConfigurationKeys.java
// public class ConfigurationKeys {
//     public static final String ST_VERSION = "st.version";
//     public static final String ST_SERVER_PORT = "st.server_port";
//     public static final String ST_SITE_NAME = "st.site_name";
//     public static final String ST_TEMPLATES_FOLDER = "st.templates.folder";
//     public static final String ST_SITE_SLOGAN = "st.site_slogan";
//     public static final String ST_SITE_DESCRIPTION = "st.site_description";
//     public static final String ST_SITE_KEYWORDS = "st.site_keywords";
//     public static final String ST_SHIPPING_FROM = "st.shipping_from";
//     public static final String ST_HOSTNAME = "st.hostname";
//     public static final String ST_SERVER_IP = "st.server_ip";
//     public static final String ST_IS_LOBBY_SERVER = "st.is_lobby_server";
//     public static final String ST_USE_LAN_MAPPINGS= "st.use_lan_mappings";
//     public static final String ST_SEND_ACCESS_CONTROL_ALLOW_ORIGIN = "st.send_access_control_allow_origin";
//     public static final String ST_SEARCH_HOPS = "st.search.hops";
//     public static final String ST_PRODUCTS_SET = "st.products_set";
//     public static final String ST_QUERY_NODE_TIMEOUT_MS = "st.query_node_timeout_ms";
// 
//     protected ConfigurationKeys() {
//     }
// }
// 
// Path: src/com/seller/trade/services/ServiceBroker.java
// public final class ServiceBroker {
// 
//     protected final Logger LOG;
//     private final Configuration configuration;
//     private final DHTService dhtService;
//     private final StoreService storeService;
//     private final TemplateService templateService;
// 
//     private final String serverIp;
// 
//     public ServiceBroker(Configuration configuration) {
//         System.out.println("Starting ServiceBroker...");
//         this.configuration = configuration;
//         LOG = Lumberjack.getLogger(this);
//         serverIp = configuration.getString(ConfigurationKeys.ST_SERVER_IP);
//         int tcpPort = configuration.getInt(ConfigurationKeys.ST_SERVER_PORT);
// 
//         dhtService = new DHTServiceImpl(configuration.getBoolean(ConfigurationKeys.ST_USE_LAN_MAPPINGS));
//         if (!configuration.getBoolean(ConfigurationKeys.ST_IS_LOBBY_SERVER)) {
//             System.out.println("Announcing myself, not lobby.");
//             dhtService.announceNode(tcpPort);
//         } else {
//             System.out.println("Not announcing myself, I'm a lobby server....");
//         }
// 
//         storeService = new StoreService(configuration, dhtService);
//         storeService.announceProducts();
// 
//         templateService = new TemplateService(configuration);
//         System.out.println("ServiceBroker started.");
//     }
// 
//     public Configuration getConfiguration() {
//         return configuration;
//     }
// 
//     public DHTService getDhtService() { return dhtService; }
// 
//     public StoreService getStoreService() { return storeService; }
// 
//     public TemplateService getTemplateService() { return templateService; }
// }


// Path: src/com/seller/trade/servlets/HelloWorldServlet.java
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import com.seller.trade.core.ConfigurationKeys;
import com.seller.trade.services.ServiceBroker;
import org.apache.velocity.VelocityContext;

/**
 * The MIT License
 ===============

 Copyright (C) 2015 SellerTrade Developers

 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
 "Software"), to deal in the Software without restriction, including
 without limitation the rights to use, copy, modify, merge, publish,
 distribute, sublicense, and/or sell copies of the Software, and to
 permit persons to whom the Software is furnished to do so, subject
 to the following conditions:

 The above copyright notice and this permission notice shall be
 included in all copies or substantial portions of the Software.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package com.seller.trade.servlets;



public final class HelloWorldServlet extends STAbstractServlet {

    public HelloWorldServlet(String command, ServiceBroker broker) {
        super(command, broker);
    }

    @Override
    protected void handleUncached(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        response.setContentType("text/html");
        response.setStatus(HttpServletResponse.SC_OK);

        VelocityContext context = new VelocityContext();
        context.put("siteName", broker.getConfiguration().getString(ConfigurationKeys.ST_SITE_NAME));