Author: ssmiweve
Date: 2008-04-03 20:25:40 +0200 (Thu, 03 Apr 2008)
New Revision: 6338

Modified:
   trunk/
   trunk/generic.sesam/war/src/main/conf/modes.xml
   trunk/mojo/src/main/java/no/sesat/mojo/SearchModesSchemaGenerator.java
   trunk/mojo/src/main/java/no/sesat/mojo/modes/Builder.java
   trunk/pom.xml
   trunk/query-api/src/main/java/no/sesat/search/query/parser/QueryParser.java
   trunk/query-api/src/main/javacc/QueryParserImpl.jj
   trunk/war/src/main/java/no/sesat/search/http/servlet/SearchServlet.java
Log:
Merged revisions 6331-6337 via svnmerge from 
http://sesat.no/svn/sesat-kernel/branches/2.16

........
  r6332 | ssmiweve | 2008-04-02 16:28:45 +0200 (Wed, 02 Apr 2008) | 2 lines
  
  SEARCH-4410 - Move out SearchServlet.checkFinn
........
  r6333 | ssmiweve | 2008-04-02 20:16:28 +0200 (Wed, 02 Apr 2008) | 2 lines
  
  SEARCH-4427 - Weird things going on when searching with only numerical input
........
  r6334 | ssmiweve | 2008-04-03 12:31:13 +0200 (Thu, 03 Apr 2008) | 1 line
  
  there are snapshots in our repository
........
  r6335 | ssmiweve | 2008-04-03 13:11:57 +0200 (Thu, 03 Apr 2008) | 1 line
  
  SEARCH-4288 -  Bildes?\195?\184k: Tjenestemenyen viser feil tall
........
  r6336 | sshafroi | 2008-04-03 13:56:10 +0200 (Thu, 03 Apr 2008) | 1 line
  
  build sources jar packages for all modules
........
  r6337 | sshafroi | 2008-04-03 14:09:41 +0200 (Thu, 03 Apr 2008) | 3 lines
  
  Make it possible to use specify 'sourceArtifact' for the 
SearchModeSchemaGenerator. This will now fetch the artifact from some 
repository and unpack it into the target/source directory. Then append this to 
the classpath.
........



Property changes on: trunk
___________________________________________________________________
Name: svnmerge-integrated
   - /branches/2.10:1-4690,4692-4745 /branches/2.11:1-4933 
/branches/2.12:1-5051,5053-5106 /branches/2.13:1-5378 /branches/2.14:1-5508 
/branches/2.15:1-5995 /branches/2.16:1-6330 /branches/2.6:1-3877 
/branches/2.7:1-4160 /branches/2.8:1-4446 /branches/2.9:1-4626 
/branches/MAP_SEARCHv2:1-4544
   + /branches/2.10:1-4690,4692-4745 /branches/2.11:1-4933 
/branches/2.12:1-5051,5053-5106 /branches/2.13:1-5378 /branches/2.14:1-5508 
/branches/2.15:1-5995 /branches/2.16:1-6337 /branches/2.6:1-3877 
/branches/2.7:1-4160 /branches/2.8:1-4446 /branches/2.9:1-4626 
/branches/MAP_SEARCHv2:1-4544

Modified: trunk/generic.sesam/war/src/main/conf/modes.xml
===================================================================
--- trunk/generic.sesam/war/src/main/conf/modes.xml     2008-04-03 12:09:41 UTC 
(rev 6337)
+++ trunk/generic.sesam/war/src/main/conf/modes.xml     2008-04-03 18:25:40 UTC 
(rev 6338)
@@ -141,6 +141,7 @@
         <picture-command id="default-picture-command"
                          query-server-host="picsearch.host"
                          query-server-port="picsearch.port"
+                         
result-fields="thumb_url,page_url,thumb_width,thumb_height,height,width,filesize"
                          inherit="default-command"/>
 
         <picture-command id="default-picture-count-command" 
results-to-return="1" inherit="default-picture-command"/>
@@ -245,7 +246,6 @@
         <picture-command id="default-picSearchEnrichment"
                          always-run="false"
                          field-filters="PICTURE_TRIGGER AS +"
-                         
result-fields="thumb_url,page_url,thumb_width,thumb_height,height,width,filesize"
                          results-to-return="3"
                          statistical-name="picsearch_picsearch"
                          inherit="default-picture-command">

Modified: trunk/mojo/src/main/java/no/sesat/mojo/SearchModesSchemaGenerator.java
===================================================================
--- trunk/mojo/src/main/java/no/sesat/mojo/SearchModesSchemaGenerator.java      
2008-04-03 12:09:41 UTC (rev 6337)
+++ trunk/mojo/src/main/java/no/sesat/mojo/SearchModesSchemaGenerator.java      
2008-04-03 18:25:40 UTC (rev 6338)
@@ -2,11 +2,22 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
 
 import no.sesat.mojo.modes.Builder;
 
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
@@ -18,7 +29,7 @@
 
     /**
      * The Maven project.
-     *
+     * 
      * @parameter expression="${project}"
      * @required
      * @readonly
@@ -28,50 +39,137 @@
 
     /**
      * Classpath
-     *
+     * 
      * @parameter
      */
     private List<String> classpaths;
 
     /**
+     * sourceArtifacts
+     * 
+     * @parameter
+     */
+    private List<String> sourceArtifacts;
+
+    /**
      * Output directory
-     *
+     * 
      * @parameter
      */
     private String outputDir;
 
     /**
+     * Used to look up Artifacts in the remote serverDeployLocation.
+     * 
+     * @parameter 
expression="${component.org.apache.maven.artifact.factory.ArtifactFactory}"
+     * @required
+     * @readonly
+     */
+    private ArtifactFactory factory;
+
+    /**
+     * Used to look up Artifacts in the remote serverDeployLocation.
+     * 
+     * @parameter 
expression="${component.org.apache.maven.artifact.resolver.ArtifactResolver}"
+     * @required
+     * @readonly
+     */
+    private ArtifactResolver resolver;
+
+    /**
+     * Location of the local serverDeployLocation.
+     * 
+     * @parameter expression="${localRepository}"
+     * @readonly
+     * @required
+     */
+    private org.apache.maven.artifact.repository.ArtifactRepository local;
+
+    /**
+     * List of Remote Repositories used by the resolver
+     * 
+     * @parameter expression="${project.remoteArtifactRepositories}"
+     * @readonly
+     * @required
+     */
+    private java.util.List remoteRepos;
+
+    /**
      * @see org.apache.maven.plugin.Mojo#execute()
      */
     public void execute() throws MojoExecutionException {
         getLog().info(this.getClass().getName());
 
-        if (classpaths == null) {
-            getLog().error("classpaths variable must be specified");
-        }
-
         if (outputDir == null) {
             getLog().error("outputDir variable must be specified");
         }
 
         String classpath = "";
-        for (final Iterator<String> iterator = classpaths.iterator(); 
iterator.hasNext();) {
-            final String name = iterator.next();
-            File file = new File(name);
-            if (!file.isAbsolute()) {
-                file = new File(project.getBasedir(), name);
+        if (classpaths != null) {
+            for (final Iterator<String> iterator = classpaths.iterator(); 
iterator.hasNext();) {
+                final String name = iterator.next();
+                File file = new File(name);
+                if (!file.isAbsolute()) {
+                    file = new File(project.getBasedir(), name);
+                }
+                if (file.exists()) {
+                    try {
+                        classpath += file.getCanonicalPath() + File.separator;
+                    } catch (IOException e) {
+                        getLog().warn(e);
+                    }
+                    if (iterator.hasNext()) {
+                        classpath += File.pathSeparator;
+                    }
+                } else {
+                    getLog().warn("Classpath not found : " + 
file.getAbsolutePath());
+                }
             }
-            if (file.exists()) {
+        }
+
+        if (sourceArtifacts != null) {
+            Map<String, Artifact> artifactMap = project.getArtifactMap();
+            for (String artifactName : sourceArtifacts) {
+                String[] ap = artifactName.split(":");
+
+                Artifact a = factory.createArtifactWithClassifier(ap[0], 
ap[1], ap[2], "jar", "sources");
+
                 try {
-                    classpath += file.getCanonicalPath() + File.separator;
-                } catch (IOException e) {
-                    getLog().warn(e);
+                    resolver.resolve(a, remoteRepos, local);
+                } catch (ArtifactResolutionException e) {
+                    e.printStackTrace();
+                } catch (ArtifactNotFoundException e) {
+                    e.printStackTrace();
                 }
-                if (iterator.hasNext()) {
+
+                File outFolder = new File("target/source/");
+                outFolder.mkdirs();
+                if (!classpath.isEmpty()) {
                     classpath += File.pathSeparator;
                 }
-            } else {
-                getLog().warn("Classpath not found : " + 
file.getAbsolutePath());
+                classpath += outFolder.getAbsolutePath();
+
+                try {
+                    JarFile jarFile = new JarFile(a.getFile());
+
+                    for (Enumeration<JarEntry> e = jarFile.entries(); 
e.hasMoreElements();) {
+                        JarEntry entry = (JarEntry) e.nextElement();
+                        File file = new File(outFolder, entry.getName());
+                        if (entry.isDirectory()) {
+                            file.mkdir();
+                        } else {
+                            InputStream in = jarFile.getInputStream(entry);
+                            PrintStream out = new PrintStream(file);
+                            byte[] buf = new byte[1024];
+                            int len;
+                            while ((len = in.read(buf)) > 0) {
+                                out.write(buf, 0, len);
+                            }
+                        }
+                    }
+                } catch (IOException e1) {
+                    e1.printStackTrace();
+                }
             }
         }
 

Modified: trunk/mojo/src/main/java/no/sesat/mojo/modes/Builder.java
===================================================================
--- trunk/mojo/src/main/java/no/sesat/mojo/modes/Builder.java   2008-04-03 
12:09:41 UTC (rev 6337)
+++ trunk/mojo/src/main/java/no/sesat/mojo/modes/Builder.java   2008-04-03 
18:25:40 UTC (rev 6338)
@@ -44,7 +44,8 @@
     public static void build(final String classpath, final String dir, final 
String idString) {
         outputDir = new File(dir).getAbsolutePath() + File.separator;
         id = idString;
-
+        RootDocImpl root = null;
+        
         // hack to suppress javadoc's warnings.
         final PrintStream out = System.out;
         final PrintStream err = System.err;
@@ -64,7 +65,7 @@
 
             final Options compOpts = Options.instance(context);
             compOpts.put("-classpath", classpath);
-            RootDocImpl root = null;
+            
             try {
                 root = comp.getRootDocImpl("", "", new ModifierFilter(PUBLIC | 
PROTECTED), javaNames.toList(), options
                         .toList(), false, subPackages.toList(), 
xcludePackages.toList(), false, false, false);
@@ -72,9 +73,6 @@
                 e.printStackTrace(err);
                 return;
             }
-            if (root != null) {
-                start(root);
-            }
         } catch (Throwable e) {
             // e.printStackTrace(out);
             out.print("Generating schema files failed due to error: " + 
e.getMessage());
@@ -82,6 +80,9 @@
             System.setOut(out);
             System.setErr(err);
         }
+        if (root != null) {
+            start(root);
+        }
     }
 
     /**

Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml       2008-04-03 12:09:41 UTC (rev 6337)
+++ trunk/pom.xml       2008-04-03 18:25:40 UTC (rev 6338)
@@ -203,6 +203,20 @@
                     <artifactId>jdepend-maven-plugin</artifactId>
                     <version>2.0-beta-1</version>
                 </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-source-plugin</artifactId>
+                    <executions>
+                        <execution>
+                            <id>attach-sources</id>
+                            <phase>verify</phase>
+                            <goals>
+                                <goal>jar</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
+
             </plugins>
         <!--/pluginManagement--> <!-- See 
http://jira.codehaus.org/browse/MNG-3018 .Uncomment when fixed. -->
     </build>
@@ -344,6 +358,7 @@
          <id>Sesat</id>
          <name>Sesat Repository</name>
          <url>http://sesat.no/maven2</url>
+         <snapshots><enabled>true</enabled></snapshots>
         </repository>
         <repository>
             <id>Central</id>

Modified: 
trunk/query-api/src/main/java/no/sesat/search/query/parser/QueryParser.java
===================================================================
--- trunk/query-api/src/main/java/no/sesat/search/query/parser/QueryParser.java 
2008-04-03 12:09:41 UTC (rev 6337)
+++ trunk/query-api/src/main/java/no/sesat/search/query/parser/QueryParser.java 
2008-04-03 18:25:40 UTC (rev 6338)
@@ -56,7 +56,8 @@
     char[][] SKIP_CHARACTER_RANGES = {
         {' ', ' '},
         {'!', '!'},
-        {'\u0023', '\u0040'},
+        {'\u0023', '\u0029'},
+        {'\u003b', '\u0040'},
         {'\u005b', '\u0060'},
         {'\u007b', '\u00bf'},
         {'\u00d7', '\u00d7'},

Modified: trunk/query-api/src/main/javacc/QueryParserImpl.jj
===================================================================
--- trunk/query-api/src/main/javacc/QueryParserImpl.jj  2008-04-03 12:09:41 UTC 
(rev 6337)
+++ trunk/query-api/src/main/javacc/QueryParserImpl.jj  2008-04-03 18:25:40 UTC 
(rev 6338)
@@ -129,7 +129,8 @@
     | <#WORD_SYMBOL_MIDDLE: (".")|<HYPON>|("_")|("+")>
     | <#WORD_SEPARATOR: [ // just a copy of the SKIP declaration. see SKIP 
comment!
             " ", "!",
-            "\u0023"-"\u0040",
+            "\u0023"-"\u0029",
+            "\u003b"-"\u0040",
             "\u005b"-"\u0060",
             "\u007b"-"\u00bf",
             "\u00d7",

Modified: 
trunk/war/src/main/java/no/sesat/search/http/servlet/SearchServlet.java
===================================================================
--- trunk/war/src/main/java/no/sesat/search/http/servlet/SearchServlet.java     
2008-04-03 12:09:41 UTC (rev 6337)
+++ trunk/war/src/main/java/no/sesat/search/http/servlet/SearchServlet.java     
2008-04-03 18:25:40 UTC (rev 6338)
@@ -377,39 +377,6 @@
 
     }
 
-    /* TODO Move into a RunningQueryHandler
-     *
-     *  redirects to yellowinfopage if request is from finn.no -> 
req.param("finn") = "finn"
-     *  finn sends orgnumber as queryparam, if only 1 hit, then redirect.
-     * @return true if a response.sendRedirect(..) was performed.
-     */
-    private static boolean checkFinn(
-            final HttpServletRequest request,
-            final HttpServletResponse response, final DataModel datamodel) 
throws IOException{
-
-        if ("finn".equalsIgnoreCase(request.getParameter("finn"))) {
-
-            if (datamodel.getSearch("catalogue").getResults().getHitCount() > 
0) {
-
-                if 
(datamodel.getSearch("catalogue").getResults().getHitCount() == 1) {
-                    final ResultItem sri = 
datamodel.getSearch("catalogue").getResults().getResults().get(0);
-                    final String recordid = 
sri.getField("contentid").toString();
-                    final String url = "/search/?c=yip&q=" + 
datamodel.getQuery().getQuery().getQueryString()
-                            + "&companyId=" + recordid
-                            + "&companyId_x=" + new MD5Generator("S3SAM 
rockz").generateMD5(recordid)
-                            + (null != 
datamodel.getParameters().getValue("showtab").getUtf8UrlEncoded()
-                            ? "&showtab=" + 
datamodel.getParameters().getValue("showtab").getUtf8UrlEncoded()
-                            : "");
-
-                    LOG.info("Finn.no redirect: " + url);
-                    response.sendRedirect(url);
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
     private static SearchTab updateSearchTab(
             final HttpServletRequest request,
             final DataModelFactory dmFactory,
@@ -537,9 +504,6 @@
                     }
                 }
 
-                // FIXME move out to a RunHandler implementation.
-                checkFinn(request, response, datamodel);
-
             } catch (InterruptedException e) {
                 LOG.error("Task timed out");
             } catch (SiteKeyedFactoryInstantiationException e) {

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

Reply via email to