// Path: src/com/seller/trade/core/Configuration.java
// public final class Configuration {
// 
//     private static final Logger LOG = Lumberjack.getLogger(Configuration.class);
// 
//     private static final String ST_CONF_ENV = "ST_CONF";
// 
//     private final Properties properties;
// 
//     public Configuration(String filename) {
//         properties = new Properties();
// 
//         try {
//             properties.load(new FileInputStream(filename));
//         } catch (Throwable e) {
//             throw new RuntimeException("Can't run without configuration", e);
//         }
//     }
// 
//     public Configuration() {
//         this(System.getenv(ST_CONF_ENV));
//     }
// 
//     public String getString(String key) {
//         String r = "";
//         
//         try{
//             r = properties.getProperty(key);
//         } catch (Throwable e) {
//             LOG.log(Level.SEVERE, String.format("Error reading configuration key %s", key), e);
//         }
//         
//         return r;
//     }
// 
//     public int getInt(String key) {
//         int r = 0;
// 
//         try {
//             r = Integer.parseInt(properties.getProperty(key));
//         } catch (Throwable e) {
//             LOG.log(Level.SEVERE, String.format("Error reading configuration key %s", key), e);
//         }
// 
//         return r;
//     }
//     
//     public float getFloat(String key) {
//         float r = 0f;
// 
//         try {
//             r = Float.parseFloat(properties.getProperty(key));
//         } catch (Throwable e) {
//             LOG.log(Level.SEVERE, String.format("Error reading configuration key %s", key), e);
//         }
// 
//         return r;
//     }
// 
//     public boolean getBoolean(String key) {
//         boolean r = false;
// 
//         try {
//             r = Boolean.parseBoolean(properties.getProperty(key));
//         } catch (Throwable e) {
//             LOG.log(Level.SEVERE, String.format("Error reading configuration key %s", key), e);
//         }
// 
//         return r;
//     }
// 
//     public List<String> getList(String key) {
// 
//         List<String> results = new ArrayList<>();
//         String property = null;
//         String[] split = null;
// 
//         try {
//             property = properties.getProperty(key);
//             
//             if (property == null) {
//                 return null;
//             }
//             
//             split = property.split(",");
//             results = Arrays.asList(split);
//         } catch (Exception e) {
//             LOG.log(Level.SEVERE, String.format("Error reading configuration key %s", key), e);
//         }
// 
//         return results;
//     }
// 
//     public long getLong(String key) {
//         long r = 0;
// 
//         try {
//             r = Long.parseLong(properties.getProperty(key));
//         } catch (Throwable e) {
//             LOG.log(Level.SEVERE, String.format("Error reading configuration key %s", key), e);
//         }
// 
//         return r;
//     }
// }
// 
// 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() {
//     }
// }


import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.seller.trade.core.Configuration;
import com.seller.trade.core.ConfigurationKeys;
import com.seller.trade.servlets.*;
import org.eclipse.jetty.server.DispatcherType;

        Collection<STAbstractServlet> servlets = SERVLET_MAP.values();

        for (STAbstractServlet servlet : servlets) {
            if (servlet.getClass().equals(clazz)) {
                return servlet.getURLCommandName();
            }
        }

        return null;
    }

    private void addServletsToContextHandler(ServletContextHandler context) {

        for (Entry<String, STAbstractServlet> entry : SERVLET_MAP.entrySet()) {
            String contextPath = "/" + entry.getKey() + "/";

            if (contextPath.equals("///")) {
                contextPath = "/";
            }

            System.out.println("key: [" + entry.getKey() + "] value: [" + entry.getValue().getClass().getName() + "] contextPath: [" + contextPath + "]");

            context.addServlet(new ServletHolder(entry.getValue()), contextPath);
        }
    }


    public static void main(String[] args) {
        ServiceBroker broker = null;
// Path: src/com/seller/trade/core/Configuration.java
// public final class Configuration {
// 
//     private static final Logger LOG = Lumberjack.getLogger(Configuration.class);
// 
//     private static final String ST_CONF_ENV = "ST_CONF";
// 
//     private final Properties properties;
// 
//     public Configuration(String filename) {
//         properties = new Properties();
// 
//         try {
//             properties.load(new FileInputStream(filename));
//         } catch (Throwable e) {
//             throw new RuntimeException("Can't run without configuration", e);
//         }
//     }
// 
//     public Configuration() {
//         this(System.getenv(ST_CONF_ENV));
//     }
// 
//     public String getString(String key) {
//         String r = "";
//         
//         try{
//             r = properties.getProperty(key);
//         } catch (Throwable e) {
//             LOG.log(Level.SEVERE, String.format("Error reading configuration key %s", key), e);
//         }
//         
//         return r;
//     }
// 
//     public int getInt(String key) {
//         int r = 0;
// 
//         try {
//             r = Integer.parseInt(properties.getProperty(key));
//         } catch (Throwable e) {
//             LOG.log(Level.SEVERE, String.format("Error reading configuration key %s", key), e);
//         }
// 
//         return r;
//     }
//     
//     public float getFloat(String key) {
//         float r = 0f;
// 
//         try {
//             r = Float.parseFloat(properties.getProperty(key));
//         } catch (Throwable e) {
//             LOG.log(Level.SEVERE, String.format("Error reading configuration key %s", key), e);
//         }
// 
//         return r;
//     }
// 
//     public boolean getBoolean(String key) {
//         boolean r = false;
// 
//         try {
//             r = Boolean.parseBoolean(properties.getProperty(key));
//         } catch (Throwable e) {
//             LOG.log(Level.SEVERE, String.format("Error reading configuration key %s", key), e);
//         }
// 
//         return r;
//     }
// 
//     public List<String> getList(String key) {
// 
//         List<String> results = new ArrayList<>();
//         String property = null;
//         String[] split = null;
// 
//         try {
//             property = properties.getProperty(key);
//             
//             if (property == null) {
//                 return null;
//             }
//             
//             split = property.split(",");
//             results = Arrays.asList(split);
//         } catch (Exception e) {
//             LOG.log(Level.SEVERE, String.format("Error reading configuration key %s", key), e);
//         }
// 
//         return results;
//     }
// 
//     public long getLong(String key) {
//         long r = 0;
// 
//         try {
//             r = Long.parseLong(properties.getProperty(key));
//         } catch (Throwable e) {
//             LOG.log(Level.SEVERE, String.format("Error reading configuration key %s", key), e);
//         }
// 
//         return r;
//     }
// }
// 
// 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/APIServer.java
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.seller.trade.core.Configuration;
import com.seller.trade.core.ConfigurationKeys;
import com.seller.trade.servlets.*;
import org.eclipse.jetty.server.DispatcherType;


        Collection<STAbstractServlet> servlets = SERVLET_MAP.values();

        for (STAbstractServlet servlet : servlets) {
            if (servlet.getClass().equals(clazz)) {
                return servlet.getURLCommandName();
            }
        }

        return null;
    }

    private void addServletsToContextHandler(ServletContextHandler context) {

        for (Entry<String, STAbstractServlet> entry : SERVLET_MAP.entrySet()) {
            String contextPath = "/" + entry.getKey() + "/";

            if (contextPath.equals("///")) {
                contextPath = "/";
            }

            System.out.println("key: [" + entry.getKey() + "] value: [" + entry.getValue().getClass().getName() + "] contextPath: [" + contextPath + "]");

            context.addServlet(new ServletHolder(entry.getValue()), contextPath);
        }
    }


    public static void main(String[] args) {
        ServiceBroker broker = null;
        Configuration configuration = null;