public void instantiateAndRunSpringRemoting() { HttpInvokerProxyFactoryBean httpInvokerProxyFactoryBean = new HttpInvokerProxyFactoryBean(); httpInvokerProxyFactoryBean.setServiceInterface( it.geosolutions.geofence.services.RuleReaderService.class); httpInvokerProxyFactoryBean.setServiceUrl("http://localhost:9191/geofence/remoting/RuleReader"); httpInvokerProxyFactoryBean.afterPropertiesSet(); RuleReaderService rrs = (RuleReaderService) httpInvokerProxyFactoryBean.getObject(); RuleFilter filter1 = new RuleFilter(SpecialFilterType.DEFAULT, true) .setUser("pippo") .setInstance("gs1") .setService("WMS"); AccessInfo accessInfo = rrs.getAccessInfo(filter1); LOGGER.info(accessInfo); RuleFilter filter2 = new RuleFilter(SpecialFilterType.DEFAULT, true) .setUser("pippo") .setInstance("gs1") .setService("WCS"); AccessInfo accessInfo2 = rrs.getAccessInfo(filter2); LOGGER.info(accessInfo2); }
static { String baseName = null; try { String resName = System.getProperty("zoie.perf.env"); if ((resName == null) || ("".equals(resName))) { baseName = _defaultPropertyFileName; System.out.println( "Could not find System property named zoie.perf.env. Using default property file named " + _defaultPropertyFileName + ".properties"); } else { if (resName.endsWith(".properties")) { resName = resName.substring(0, resName.lastIndexOf(".")); } baseName = resName; } } catch (Exception e) { baseName = _defaultPropertyFileName; System.out.println( "Could not find System property named facetsearch.perf.env. Using default property file named " + _defaultPropertyFileName + ".properties"); } try { ResourceBundle resource = ResourceBundle.getBundle(baseName); String svcUrl = null; try { svcUrl = resource.getString("org.deepak.performance.test.zoieperftest.serviceurl"); } catch (Exception ex) { System.out.println( "Could not find value for service url : org.deepak.performance.test.zoieperftest.serviceurl. " + "Using default value of: " + _defaultServiceUrl); svcUrl = _defaultServiceUrl; } String dataFile = null; try { dataFile = resource.getString("org.deepak.performance.test.zoieperftest.querydatafile"); } catch (Exception ex) { System.out.println( "Could not find value for query data file : org.deepak.performance.test.zoieperftest.querydatafile. " + "Using default value of: " + _defaultDataFile); } BufferedReader br = new BufferedReader( new FileReader(new File(StringParseUtility.getFullPathToFile(dataFile)))); String line = null; Map qMap = new HashMap(); int cnt = 0; while ((line = br.readLine()) != null) { cnt++; String qtxt = line; SearchRequest req = new SearchRequest(); if (req != null) { req.setQuery(qtxt); // System.out.println(req.getQuery()); TestQuery tq = new TestQuery(req, qtxt); qMap.put(new Integer(cnt), tq); } } br.close(); qMap = new TreeMap(qMap); TestQuery[] queries = new TestQuery[qMap.size()]; System.out.println("LENGTH: " + queries.length); Iterator itr = qMap.keySet().iterator(); for (int i = 0; i < queries.length; i++) { queries[i] = (TestQuery) qMap.get(itr.next()); // System.out.println(queries[i].getRequest().getQuery()); } _queries = new DataAccess(queries, DataAccess.SEQUENTIAL_ACCESS); factoryBean.setServiceInterface(ZoieSearchService.class); factoryBean.setServiceUrl(svcUrl); factoryBean.afterPropertiesSet(); _service = (ZoieSearchService) (factoryBean.getObject()); } catch (Exception e) { System.out.println("Exception in static method. Exiting..."); e.printStackTrace(); System.exit(1); } }