Changeset 2694
- Timestamp:
- 03/13/13 16:25:07 (11 years ago)
- Location:
- SRUAggregator/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
SRUAggregator/trunk/pom.xml
r2528 r2694 60 60 <version>1.2.2</version> 61 61 </dependency> 62 <dependency> 63 <groupId>com.sun.jersey</groupId> 64 <artifactId>jersey-client</artifactId> 65 <version>1.17.1</version> 66 </dependency> 62 67 </dependencies> 63 68 <build> -
SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/app/Aggregator.java
r2599 r2694 3 3 import com.google.gson.Gson; 4 4 import com.google.gson.reflect.TypeToken; 5 import com.sun.jersey.api.client.Client; 5 6 import eu.clarin.sru.client.SRUVersion; 6 7 import eu.clarin.sru.fcs.aggregator.data.CenterRegistry; … … 15 16 import java.util.Set; 16 17 import java.util.logging.*; 18 import org.zkoss.util.media.AMedia; 19 import org.zkoss.util.media.Media; 17 20 import org.zkoss.zk.ui.Component; 18 21 import org.zkoss.zk.ui.Executions; … … 35 38 import org.zkoss.zul.Window; 36 39 import org.zkoss.zul.event.ZulEvents; 40 import com.sun.jersey.api.client.WebResource; 41 import com.sun.jersey.api.client.config.ClientConfig; 42 import com.sun.jersey.api.client.config.DefaultClientConfig; 43 import eu.clarin.weblicht.wlfxb.tc.api.GeoLongLatFormat; 44 import eu.clarin.weblicht.wlfxb.tc.api.Token; 45 import eu.clarin.weblicht.wlfxb.tc.xb.TextCorpusStored; 46 import eu.clarin.weblicht.wlfxb.xb.WLData; 47 import javax.ws.rs.core.MediaType; 37 48 38 49 /** … … 77 88 @Wire 78 89 private Label searchResultsProgress; 90 91 private WebResource mapGenerator; 92 public static final String MAPS_SERVICE_URL = "http://weblicht.sfs.uni-tuebingen.de/rws/service-geolocationconsumer/resources/geoloc/"; 79 93 80 94 private Map<String, List<String>> xAggregationContext; … … 105 119 tree.setItemRenderer(new CorpusTreeNodeRenderer()); 106 120 tree.setMultiple(true); 121 122 123 //tempMap(); 107 124 108 125 } … … 139 156 int maxRecords = Integer.parseInt(maximumRecordsSelect.getValue()); 140 157 searchResultsController.executeSearch(tree.getSelectedItems(), maxRecords, searchString.getText(), version); 158 } 159 160 @Listen("onOK = #searchString") 161 public void onEnterSearchString(Event ev) { 162 onExecuteSearch(ev); 141 163 } 142 164 … … 231 253 232 254 } 255 256 private void tempMap() { 257 ClientConfig config = new DefaultClientConfig(); 258 Client client = Client.create(config); 259 mapGenerator = client.resource(MAPS_SERVICE_URL); 260 TextCorpusStored tc = new TextCorpusStored("en"); 261 Token t1 = tc.createTokensLayer().addToken("Virginia"); 262 List<Token> s1 = new ArrayList<Token>(); s1.add(t1); 263 tc.createSentencesLayer().addSentence(s1); 264 tc.createGeoLayer("unknown", GeoLongLatFormat.DegDec); 265 //tc.getGeoLayer().addPoint("138.56027", "-34.6663", 15.0, null, null, null, t1); 266 WLData data = new WLData(tc); 267 268 Iframe resultsPic = (Iframe) resultsBox.getFellow("resultsPic"); 269 270 try { 271 String output = mapGenerator.path("3").accept(MediaType.TEXT_HTML).type("text/tcf+xml").post(String.class, data); 272 Media media = new AMedia("map-" + 4 + ".html", null, "text/html", output); 273 resultsPic.setContent(media); 274 } catch (Exception e) { 275 Logger.getLogger(Aggregator.class.getName()).log(Level.SEVERE, "ERROR accessing the maps generator service", e); 276 Messagebox.show("ERROR accessing the maps generator service \n" + e.getMessage(), "FCS", 0, Messagebox.INFORMATION); 277 } 278 } 233 279 } -
SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/data/Endpoint.java
r2599 r2694 87 87 corpora = new ArrayList<Corpus>(); 88 88 SRUScanResponse corporaResponse = null; 89 StringBuilder scanClause = new StringBuilder("fcs.resource");89 90 90 try { 91 // old specification 92 StringBuilder scanClause = new StringBuilder("fcs.resource"); 91 93 SRUClient sruClient = new SRUClient(SRUVersion.VERSION_1_2); 92 94 SRUScanRequest corporaRequest = new SRUScanRequest(url); … … 95 97 //corporaRequest.setExtraRequestData("x-cmd-resource-info", "true"); 96 98 corporaResponse = sruClient.scan(corporaRequest); 99 if (corporaResponse == null || !corporaResponse.hasTerms() ) { 100 corporaRequest = new SRUScanRequest(url); 101 // new specification 102 corporaRequest.setScanClause(scanClause.toString() + "=root"); 103 corporaResponse = sruClient.scan(corporaRequest); 104 } 105 97 106 } catch (SRUClientException ex) { 98 107 logger.log(Level.SEVERE, "Error accessing corpora at {0} {1} {2}", new String[]{url, ex.getClass().getName(), ex.getMessage()}); -
SRUAggregator/trunk/src/main/webapp/index.zul
r2527 r2694 102 102 </groupbox> 103 103 104 105 <!-- 104 106 <separator/> 105 107 <separator/> … … 128 130 </div> 129 131 </groupbox> 132 --> 130 133 <separator/> 131 134 </panelchildren> … … 160 163 </north> 161 164 <center margins="0,5,0,0" autoscroll="true" border="0"> 162 <panel >165 <panel width="100%" height="100%"> 163 166 <panelchildren id="resultsPanel" style="overflow: auto"> 164 <window id="resultsBox" style="overflow:auto;" >165 <iframe src="help.html" width="800px" height="400px"/>167 <window id="resultsBox" style="overflow:auto;" width="100%" height="100%"> 168 <iframe id="resultsPic" src="help.html" width="100%" height="100%"/> 166 169 </window> 167 170 <label value=" " id="searchResultsProgress" style="border-width:0px;margin-left:5px;"/>
Note: See TracChangeset
for help on using the changeset viewer.