Author: ssmiweve
Date: 2008-04-14 22:21:33 +0200 (Mon, 14 Apr 2008)
New Revision: 6417

Modified:
   
branches/2.16/data-model-api/src/main/java/no/sesat/search/datamodel/DataModelFactory.java
   branches/2.16/generic.sesam/pom.xml
   branches/2.16/pom.xml
   branches/2.16/site-spi/src/main/java/no/sesat/search/site/Site.java
   
branches/2.16/war/src/main/java/no/sesat/search/http/filters/SiteLocatorFilter.java
Log:
SEARCH-4613 - generic.sesam.no configuration files are loaded through apache


Modified: 
branches/2.16/data-model-api/src/main/java/no/sesat/search/datamodel/DataModelFactory.java
===================================================================
--- 
branches/2.16/data-model-api/src/main/java/no/sesat/search/datamodel/DataModelFactory.java
  2008-04-14 20:16:19 UTC (rev 6416)
+++ 
branches/2.16/data-model-api/src/main/java/no/sesat/search/datamodel/DataModelFactory.java
  2008-04-14 20:21:33 UTC (rev 6417)
@@ -186,7 +186,13 @@
 
             final String clsName = 
siteConf.getProperty(DATA_MODEL_FACTORY_IMPL);
             LOG.info("constructing for " + cxt.getSite() + " instance of " + 
clsName);
-            
+
+            if(null == clsName){
+                throw new SiteKeyedFactoryInstantiationException(
+                        "Couldn't find " + DATA_MODEL_FACTORY_IMPL + " in " + 
siteConf.getProperties().toString(), 
+                        new NullPointerException());
+            }
+                
             @SuppressWarnings("unchecked")
             final Class<DataModelFactory> cls = (Class<DataModelFactory>) 
Class.forName(clsName);
 

Modified: branches/2.16/generic.sesam/pom.xml
===================================================================
--- branches/2.16/generic.sesam/pom.xml 2008-04-14 20:16:19 UTC (rev 6416)
+++ branches/2.16/generic.sesam/pom.xml 2008-04-14 20:21:33 UTC (rev 6417)
@@ -376,7 +376,7 @@
             <build><pluginManagement /></build>
             <properties>
 
-                <sesam.site>generic.sesam.no</sesam.site>   
+                <sesam.site>generic.sesam</sesam.site>   
 
                 <!-- QR Servers -->
                 
<newsQueryServerURL>http://10.16.195.250:15100</newsQueryServerURL>

Modified: branches/2.16/pom.xml
===================================================================
--- branches/2.16/pom.xml       2008-04-14 20:16:19 UTC (rev 6416)
+++ branches/2.16/pom.xml       2008-04-14 20:21:33 UTC (rev 6417)
@@ -283,7 +283,6 @@
             <id>gamma</id>
             <activation />
             <properties>
-                <sesam.site.generic>generic.sesam.no</sesam.site.generic>
                 <sesam.site.default>${sesam.site.generic}</sesam.site.default>
                 <!-- IMPORTANT: production cannot handle writing to sesam.log 
at a lower threshold -->
                 <log.level>WARN</log.level>

Modified: branches/2.16/site-spi/src/main/java/no/sesat/search/site/Site.java
===================================================================
--- branches/2.16/site-spi/src/main/java/no/sesat/search/site/Site.java 
2008-04-14 20:16:19 UTC (rev 6416)
+++ branches/2.16/site-spi/src/main/java/no/sesat/search/site/Site.java 
2008-04-14 20:21:33 UTC (rev 6417)
@@ -138,7 +138,7 @@
 
 
             final String parentSiteName = null != cxt ? 
cxt.getParentSiteName(siteContext) : siteName;
-
+            
             parent = null == parentSiteName || 
ensureTrailingSlash(parentSiteName).equals(siteName)
                 ? constructingDefault ? null : DEFAULT
                 : Site.valueOf(cxt, parentSiteName, theLocale);
@@ -229,19 +229,15 @@
      * A "www." prefix will be automatically ignored.
      * @param cxt the cxt to use during creation. null will prevent 
constructing a new site.
      * @param siteName the virtual host name.
+     * @param locale the locale desired
      * @return the site bean.
      */
     public static Site valueOf(final Context cxt, final String siteName, final 
Locale locale) {
 
         Site site = null;
-        
-        // Tweak the port is SERVER_PORT has been explicitly set.
-        final String correctedPortSiteName = SERVER_PORT > 0 && 
siteName.indexOf(':') > 0
-                ? siteName.substring(0, siteName.indexOf(':') + 1) + 
SERVER_PORT
-                : siteName;
 
         // Strip www. from siteName
-        final String realSiteName = 
ensureTrailingSlash(correctedPortSiteName.replaceAll("www.", ""));
+        final String realSiteName = 
ensureTrailingSlash(siteName.replaceAll("www.", ""));
 
         // Look for existing instances
         try{

Modified: 
branches/2.16/war/src/main/java/no/sesat/search/http/filters/SiteLocatorFilter.java
===================================================================
--- 
branches/2.16/war/src/main/java/no/sesat/search/http/filters/SiteLocatorFilter.java
 2008-04-14 20:16:19 UTC (rev 6416)
+++ 
branches/2.16/war/src/main/java/no/sesat/search/http/filters/SiteLocatorFilter.java
 2008-04-14 20:21:33 UTC (rev 6417)
@@ -304,12 +304,16 @@
         //      2) "UseCanonicalName Off" to assign ServerName from client's 
request.
         final String vhost = getServerName(servletRequest);
 
+        // Tweak the port if SERVER_PORT has been explicitly set. (We may have 
gone through Apache or Cisco LB).
+        final String correctedVhost = Site.SERVER_PORT > 0 && 
vhost.indexOf(':') > 0
+                ? vhost.substring(0, vhost.indexOf(':') + 1) + Site.SERVER_PORT
+                : vhost;
 
-        LOG.trace(DEBUG_REQUESTED_VHOST + vhost);
+        LOG.trace(DEBUG_REQUESTED_VHOST + correctedVhost);
 
         // Construct the site object off the browser's locale, even if it 
won't finally be used.
         final Locale locale = servletRequest.getLocale();
-        final Site result = Site.valueOf(SITE_CONTEXT, vhost, locale);
+        final Site result = Site.valueOf(SITE_CONTEXT, correctedVhost, locale);
         final SiteConfiguration.Context siteConfCxt = new 
SiteConfiguration.Context(){
             public PropertiesLoader newPropertiesLoader(
                     final SiteContext siteCxt,
@@ -344,16 +348,16 @@
 
             case 3:
                 LOG.trace(result+INFO_USING_DEFAULT_LOCALE + prefLocale[0] + 
'_' + prefLocale[1] + '_' + prefLocale[2]);
-                return Site.valueOf(SITE_CONTEXT, vhost, new 
Locale(prefLocale[0], prefLocale[1], prefLocale[2]));
+                return Site.valueOf(SITE_CONTEXT, correctedVhost, new 
Locale(prefLocale[0], prefLocale[1], prefLocale[2]));
 
             case 2:
                 LOG.trace(result+INFO_USING_DEFAULT_LOCALE + prefLocale[0] + 
'_' + prefLocale[1]);
-                return Site.valueOf(SITE_CONTEXT, vhost, new 
Locale(prefLocale[0], prefLocale[1]));
+                return Site.valueOf(SITE_CONTEXT, correctedVhost, new 
Locale(prefLocale[0], prefLocale[1]));
 
             case 1:
             default:
                 LOG.trace(result+INFO_USING_DEFAULT_LOCALE + prefLocale[0]);
-                return Site.valueOf(SITE_CONTEXT, vhost, new 
Locale(prefLocale[0]));
+                return Site.valueOf(SITE_CONTEXT, correctedVhost, new 
Locale(prefLocale[0]));
 
         }
     }

_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits

Reply via email to