Commit 25e11ae520f4a5be3ee39ba7c765a2214530eb05
1 parent
58108eb8
Story Id:1166880 Daily Commit
Committed by: Jarrett Jordaan Reviewed by: Paul Barrett
Showing
5 changed files
with
60 additions
and
24 deletions
bin/luceneserver/KnowledgeTreeIndexer.properties
| @@ -2,6 +2,6 @@ server.port=8875 | @@ -2,6 +2,6 @@ server.port=8875 | ||
| 2 | server.paranoid=false | 2 | server.paranoid=false |
| 3 | server.accept=127.0.0.1 | 3 | server.accept=127.0.0.1 |
| 4 | server.deny= | 4 | server.deny= |
| 5 | -indexer.directory=../../../var/indexes | 5 | +indexer.directory=../../var/indexes |
| 6 | indexer.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer | 6 | indexer.analyzer=org.apache.lucene.analysis.standard.StandardAnalyzer |
| 7 | 7 |
setup/wizard/lib/helpers/demo.sh
100755 โ 100644
setup/wizard/lib/helpers/javaVersion.class
0 โ 100644
No preview for this file type
setup/wizard/lib/helpers/javaVersion.java
0 โ 100644
| 1 | +import java.io.*; | ||
| 2 | +import java.lang.System; | ||
| 3 | +import java.util.Properties; | ||
| 4 | + | ||
| 5 | +public class javaVersion { | ||
| 6 | + | ||
| 7 | + public static void main(String args[]) throws Exception { | ||
| 8 | + String outJV = args[0]; | ||
| 9 | + String outJVHome = args[1]; | ||
| 10 | + Properties sysProps = new Properties(); | ||
| 11 | + sysProps = System.getProperties(); | ||
| 12 | + String sysVersion = sysProps.getProperty("java.version"); | ||
| 13 | + String javaHome = sysProps.getProperty("java.home"); | ||
| 14 | + try{ | ||
| 15 | + // Create file | ||
| 16 | + FileWriter fstream = new FileWriter(outJV); | ||
| 17 | + BufferedWriter out = new BufferedWriter(fstream); | ||
| 18 | + out.write(sysVersion); | ||
| 19 | + //Close the output stream | ||
| 20 | + out.close(); | ||
| 21 | + fstream = new FileWriter(outJVHome); | ||
| 22 | + out = new BufferedWriter(fstream); | ||
| 23 | + out.write(javaHome); | ||
| 24 | + //Close the output stream | ||
| 25 | + out.close(); | ||
| 26 | + } catch (Exception e){//Catch exception if any | ||
| 27 | + System.err.println("Error: " + e.getMessage()); | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | +} | ||
| 0 | \ No newline at end of file | 31 | \ No newline at end of file |
setup/wizard/lib/services/windowsLucene.php
| @@ -140,7 +140,6 @@ class windowsLucene extends windowsService { | @@ -140,7 +140,6 @@ class windowsLucene extends windowsService { | ||
| 140 | * @return void | 140 | * @return void |
| 141 | */ | 141 | */ |
| 142 | public function load() { | 142 | public function load() { |
| 143 | -// $this->name = "KTLuceneTest"; | ||
| 144 | $this->setJavaBin(); | 143 | $this->setJavaBin(); |
| 145 | $this->setLuceneDIR(SYSTEM_DIR."bin".DS."luceneserver"); | 144 | $this->setLuceneDIR(SYSTEM_DIR."bin".DS."luceneserver"); |
| 146 | $this->setLuceneExe("KTLuceneService.exe"); | 145 | $this->setLuceneExe("KTLuceneService.exe"); |
| @@ -152,6 +151,25 @@ class windowsLucene extends windowsService { | @@ -152,6 +151,25 @@ class windowsLucene extends windowsService { | ||
| 152 | } | 151 | } |
| 153 | 152 | ||
| 154 | /** | 153 | /** |
| 154 | + * Retrieve Status Service | ||
| 155 | + * | ||
| 156 | + * @author KnowledgeTree Team | ||
| 157 | + * @access public | ||
| 158 | + * @param none | ||
| 159 | + * @return string | ||
| 160 | + */ | ||
| 161 | + public function status() { | ||
| 162 | + $cmd = "sc query {$this->name}"; | ||
| 163 | + $response = $this->util->pexec($cmd); | ||
| 164 | + if($response['out']) { | ||
| 165 | + $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key | ||
| 166 | + return $state; | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + return ''; | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + /** | ||
| 155 | * Set Java Directory path | 173 | * Set Java Directory path |
| 156 | * | 174 | * |
| 157 | * @author KnowledgeTree Team | 175 | * @author KnowledgeTree Team |
| @@ -169,29 +187,12 @@ class windowsLucene extends windowsService { | @@ -169,29 +187,12 @@ class windowsLucene extends windowsService { | ||
| 169 | } | 187 | } |
| 170 | } | 188 | } |
| 171 | // TODO: Will not detect, but a java pre-check is done in services, before this | 189 | // TODO: Will not detect, but a java pre-check is done in services, before this |
| 172 | - if ($this->util->getJava()) { | ||
| 173 | - } else { | ||
| 174 | - } | ||
| 175 | - $this->javaBin = 'java'; | ||
| 176 | - } | ||
| 177 | - | ||
| 178 | - /** | ||
| 179 | - * Retrieve Status Service | ||
| 180 | - * | ||
| 181 | - * @author KnowledgeTree Team | ||
| 182 | - * @access public | ||
| 183 | - * @param none | ||
| 184 | - * @return string | ||
| 185 | - */ | ||
| 186 | - public function status() { | ||
| 187 | - $cmd = "sc query {$this->name}"; | ||
| 188 | - $response = $this->util->pexec($cmd); | ||
| 189 | - if($response['out']) { | ||
| 190 | - $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key | ||
| 191 | - return $state; | 190 | + if(file_exists(SYS_OUT_DIR.'outJVHome')) { |
| 191 | + $this->javaBin = file_get_contents(SYS_OUT_DIR.'outJVHome'); | ||
| 192 | + if($this->javaBin != '') return true; | ||
| 192 | } | 193 | } |
| 193 | 194 | ||
| 194 | - return ''; | 195 | + return false; |
| 195 | } | 196 | } |
| 196 | 197 | ||
| 197 | /** | 198 | /** |
| @@ -369,6 +370,10 @@ class windowsLucene extends windowsService { | @@ -369,6 +370,10 @@ class windowsLucene extends windowsService { | ||
| 369 | $this->javaJVM = $this->getJavaBin().DS."client".DS."jvm.dll"; | 370 | $this->javaJVM = $this->getJavaBin().DS."client".DS."jvm.dll"; |
| 370 | } elseif (file_exists($this->getJavaBin().DS."server".DS."jvm.dll")) { | 371 | } elseif (file_exists($this->getJavaBin().DS."server".DS."jvm.dll")) { |
| 371 | $this->javaJVM = $this->getJavaBin().DS."server".DS."jvm.dll"; | 372 | $this->javaJVM = $this->getJavaBin().DS."server".DS."jvm.dll"; |
| 373 | + } elseif (file_exists($this->getJavaBin().DS."bin".DS."client".DS."jvm.dll")) { | ||
| 374 | + $this->javaJVM = $this->getJavaBin().DS."bin".DS."client".DS."jvm.dll"; | ||
| 375 | + } elseif (file_exists($this->getJavaBin().DS."bin".DS."server".DS."jvm.dll")) { | ||
| 376 | + $this->javaJVM = $this->getJavaBin().DS."bin".DS."server".DS."jvm.dll"; | ||
| 372 | } else { | 377 | } else { |
| 373 | return false; | 378 | return false; |
| 374 | } | 379 | } |
| @@ -397,10 +402,11 @@ class windowsLucene extends windowsService { | @@ -397,10 +402,11 @@ class windowsLucene extends windowsService { | ||
| 397 | public function install() { | 402 | public function install() { |
| 398 | $state = $this->status(); | 403 | $state = $this->status(); |
| 399 | if($state == '') { | 404 | if($state == '') { |
| 400 | - $this->writeLuceneProperties(); | 405 | + //$this->writeLuceneProperties(); |
| 401 | $luceneExe = $this->getLuceneExe(); | 406 | $luceneExe = $this->getLuceneExe(); |
| 402 | $luceneSource = $this->getLuceneSource(); | 407 | $luceneSource = $this->getLuceneSource(); |
| 403 | $luceneDir = $this->getluceneDir(); | 408 | $luceneDir = $this->getluceneDir(); |
| 409 | + $javaJVM = $this->getJavaJVM(); | ||
| 404 | if($luceneExe && $luceneSource && $luceneDir) { | 410 | if($luceneExe && $luceneSource && $luceneDir) { |
| 405 | $cmd = "\"{$luceneExe}\""." -install \"".$this->getName()."\" \"".$this->getJavaJVM(). "\" -Djava.class.path=\"".$luceneSource."\"". " -start ".$this->getLuceneServer(). " -out \"".$this->getLuceneOut()."\" -err \"".$this->getLuceneError()."\" -current \"".$luceneDir."\" -auto"; | 411 | $cmd = "\"{$luceneExe}\""." -install \"".$this->getName()."\" \"".$this->getJavaJVM(). "\" -Djava.class.path=\"".$luceneSource."\"". " -start ".$this->getLuceneServer(). " -out \"".$this->getLuceneOut()."\" -err \"".$this->getLuceneError()."\" -current \"".$luceneDir."\" -auto"; |
| 406 | if(DEBUG) { | 412 | if(DEBUG) { |