Examples of GeonetContext


Examples of org.fao.geonet.GeonetContext

        return relatedRecords;
    }


    private Element search(String uuid, String type, ServiceContext context, String from, String to, String fast) throws Exception {
        GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
        SearchManager searchMan = gc.getBean(SearchManager.class);

        // perform the search
        if (Log.isDebugEnabled(Geonet.SEARCH_ENGINE))
            Log.debug(Geonet.SEARCH_ENGINE, "Searching for: " + type);
        MetaSearcher searcher = searchMan.newSearcher(SearchManager.LUCENE, Geonet.File.SEARCH_LUCENE);
View Full Code Here

Examples of org.fao.geonet.GeonetContext

  //---
  //--------------------------------------------------------------------------

  public Element exec(Element params, ServiceContext context) throws Exception
  {
    GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);

    SchemaManager schemaMan = gc.getBean(SchemaManager.class);

    Element schemas = new Element("schemalist");

    for (String schema : schemaMan.getSchemas()) {
      Element elem = new Element("name").setText(schema);
View Full Code Here

Examples of org.fao.geonet.GeonetContext

  public Element exec(Element params, ServiceContext context) throws Exception
  {
    if (System.currentTimeMillis() > _lastUpdateTime + _timeBetweenUpdates)
    {
      GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
      SearchManager searchMan = gc.getBean(SearchManager.class);
      MetaSearcher  searcher  = searchMan.newSearcher(SearchManager.LUCENE, Geonet.File.SEARCH_LUCENE);

      try {
        // FIXME: featured should be at metadata level, not at group level
        Element searchRequest = new Element("request");
        searchRequest.addContent(new Element(Geonet.SearchResult.BUILD_SUMMARY).setText("false"));
        searchRequest.addContent(new Element("featured").setText("true"));
        searchRequest.addContent(new Element("relation").setText(_relation));
        searchRequest.addContent(new Element("northBL").setText(_northBL));
        searchRequest.addContent(new Element("southBL").setText(_southBL));
        searchRequest.addContent(new Element("eastBL").setText(_eastBL));
        searchRequest.addContent(new Element("westBL").setText(_westBL));
 
                if(Log.isDebugEnabled(Geonet.SEARCH_ENGINE))
            Log.debug(Geonet.SEARCH_ENGINE, "RANDOM SEARCH CRITERIA:\n"+ Xml.getString(searchRequest));
       
        searcher.search(context, searchRequest, _config);
 
        Element presentRequest = new Element("request");
        presentRequest.addContent(new Element("fast").setText("true"));
        presentRequest.addContent(new Element("from").setText("1"));
        presentRequest.addContent(new Element("to").setText(searcher.getSize()+""));
             
        @SuppressWarnings("unchecked")
                List<Element> results = searcher.present(context, presentRequest, _config).getChildren();
 
        _response = new Element("response");
        for (int i = 0; i < _maxItems && results.size() > 1; i++) {
          Random rnd = new Random();
          int r = rnd.nextInt(results.size() - 1) + 1// skip summary
 
          Element mdInfo = (Element)results.remove(r);
          mdInfo.detach();
 
          Element info = mdInfo.getChild("info", Edit.NAMESPACE);
          String id = info.getChildText("id");
                    boolean forEditing = false, withValidationErrors = false, keepXlinkAttributes = false;
                    Element md = gc.getBean(DataManager.class).getMetadata(context, id, forEditing, withValidationErrors, keepXlinkAttributes);
          _response.addContent(md);
        }
        _lastUpdateTime = System.currentTimeMillis();
      }
            finally {
View Full Code Here

Examples of org.fao.geonet.GeonetContext

  //---
  //--------------------------------------------------------------------------

  public Element exec(Element params, ServiceContext context) throws Exception
  {
    GeonetContext  gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
    SettingManager sm =gc.getBean(SettingManager.class);

    //--- create local node

    String name   = sm.getSiteName();
    String siteId = sm.getSiteId();
View Full Code Here

Examples of org.fao.geonet.GeonetContext

    // --- Service
    // ---
    // --------------------------------------------------------------------------

    public Element exec(Element params, ServiceContext context) throws Exception {
        GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
        boolean svnManagerFound = false;
        Element root = new Element("a");
       
        try {
            SvnManager svnMan = gc.getBean(SvnManager.class);
            if (svnMan != null) {
                svnManagerFound = true;
            }
        } catch (NoSuchBeanDefinitionException e) {
            // No SVN manager found - SVN is not activated
View Full Code Here

Examples of org.fao.geonet.GeonetContext

     *
     * @see jeeves.interfaces.Service#exec(org.jdom.Element, jeeves.server.context.ServiceContext)
     */
    public Element serviceSpecificExec(Element params, ServiceContext context) throws Exception {
        // Get the header keys to lookup from the settings
        GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
        SettingManager sm = gc.getBean(SettingManager.class);
        String prefix = "system/shib";
        String usernameKey = sm.getValue(prefix + "/attrib/username");
        String surnameKey = sm.getValue(prefix + "/attrib/surname");
        String firstnameKey = sm.getValue(prefix + "/attrib/firstname");
        String profileKey = sm.getValue(prefix + "/attrib/profile");
View Full Code Here

Examples of org.fao.geonet.GeonetContext

    _request.addContent(new Element("from").setText("1"));
    _request.addContent(new Element("to".setText(""));

    if (System.currentTimeMillis() > _lastUpdateTime + _timeBetweenUpdates)
    {
      GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
      SearchManager searchMan = gc.getBean(SearchManager.class);
      DataManager   dataMan   = gc.getBean(DataManager.class);

      _request.getChild("to").setText(""+_maxItems);

      _response = new Element(Jeeves.Elem.RESPONSE);
View Full Code Here

Examples of org.fao.geonet.GeonetContext

    //--------------------------------------------------------------------------

    public Element exec(Element params, ServiceContext context) throws Exception {
        int userId = Util.getParamAsInt(params, "id");

        GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
        UserSession us = context.getUserSession();
        AccessManager am = gc.getBean(AccessManager.class);

        Set<Integer> userGroups = am.getVisibleGroups(userId);
        Set<Integer> myGroups = am.getUserGroups(us, null, false);

        //--- remove 'Intranet' and 'All' groups
View Full Code Here

Examples of org.fao.geonet.GeonetContext

  public Element exec(Element params, ServiceContext context) throws Exception
  {
    // reset the thread local
    XmlSerializer.clearThreadLocal();

    GeonetContext  gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);

    Element response  = gc.getBean(SettingManager.class).getAllAsXML(true);

        Element readOnly = new Element(READ_ONLY);
        readOnly.setText(Boolean.toString(gc.isReadOnly()));
       
        // Get the system node (which is for the time being the only child node
        // of settings
        Element system = response.getChild("system");
        system.addContent(readOnly);
View Full Code Here

Examples of org.fao.geonet.GeonetContext

    this.context= context;
    this.params = params;

    result = new HarvestResult ();
   
    GeonetContext gc = (GeonetContext) context.getHandlerContext (Geonet.CONTEXT_NAME);
    dataMan = gc.getBean(DataManager.class);
    schemaMan = gc.getBean(SchemaManager.class);

    SettingInfo si = context.getBean(SettingInfo.class);
    String siteUrl = si.getSiteUrl() + context.getBaseUrl();
    metadataGetService = siteUrl + "/srv/en/xml.metadata.get";
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.