Package org.fao.geonet

Examples of org.fao.geonet.GeonetContext


  public void init(String appPath, ServiceConfig params) throws Exception {
  }

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

    loadSystemInfo();
    loadCatalogueInfo(gc);
    loadIndexInfo(context);
    loadDatabaseInfo(context);

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

    Element main = new Element("main");
    addToElement(main, systemProperties);

    Element index = new Element("index");
View Full Code Here


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

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

    String fname = Util.getParam(params, "fname");
    String tname = Util.getParam(params, "tname");
    String tnamespace = Util.getParam(params, "tns");
    String dname = Util.getParam(params, "dname");
    String type = Util.getParam(params, "type");
    String activated = Util.getParam(params, "activated", "y");

    fname = fname.trim().replaceAll("\\s+", "");
   
    if (!fname.endsWith(".rdf")){
      fname = fname + ".rdf";
    }
   
    ThesaurusManager tm = gc.getBean(ThesaurusManager.class);

    String filePath = tm.buildThesaurusFilePath(fname, type, dname);
   
    File rdfFile = new File(filePath);
        final String siteURL = context.getBean(SettingManager.class).getSiteURL(context);
View Full Code Here

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

    public Element serviceSpecificExec(Element params, ServiceContext context) throws Exception {
        GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
        DataManager dm = gc.getBean(DataManager.class);
        AccessManager accessMan = gc.getBean(AccessManager.class);
        UserSession session = context.getUserSession();


        String targetUsr = Util.getParam(params, Params.USER);
        String targetGrp = Util.getParam(params, Params.GROUP);
View Full Code Here

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

        Map<String, String> values = new HashMap<String, String>();
        for (Object obj : params.getChildren()) {
            if (obj instanceof Element) {
                Element param = (Element) obj;
View Full Code Here

                    "\tmaxNumberOfTerms: '" + maxNumberOfTerms + "'" +
                    "\tsortBy: '" + sortBy + "'" +
                    "\tfrom: '" + origin + "'");
        }
       
        GeonetContext gc = (GeonetContext) context
                .getHandlerContext(Geonet.CONTEXT_NAME);
        SearchManager sm = gc.getBean(SearchManager.class);
        // The response element
        Element suggestionsResponse = new Element(ELEM_ITEMS);

        TreeSet<SearchManager.TermFrequency> listOfSuggestions;
View Full Code Here

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

    // function builds a OAI records from a metadata record, according to the arguments select and selectVal
    public static Record buildRecordStat(ServiceContext context, Specification<Metadata> spec/*String select, Object selectVal*/,
                                         String prefix) throws Exception {
        GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
        SchemaManager sm = gc.getBean(SchemaManager.class);

        Metadata metadata = context.getBean(MetadataRepository.class).findOne(spec);
        if (metadata == null)
            throw new IdDoesNotExistException(spec.toString());

        String uuid = metadata.getUuid();
        final MetadataDataInfo dataInfo = metadata.getDataInfo();
        String schema = dataInfo.getSchemaId();
        String changeDate = dataInfo.getChangeDate().getDateAndTime();
        String data = metadata.getData();

        Element md = Xml.loadString(data, false);

        //--- try to disseminate format

        if (prefix.equals(schema)) {
            Attribute schemaLocAtt = sm.getSchemaLocation(schema, context);
            if (schemaLocAtt != null) {
                if (md.getAttribute(schemaLocAtt.getName(), schemaLocAtt.getNamespace()) == null) {
                    md.setAttribute(schemaLocAtt);
                    // make sure namespace declaration for schemalocation is present -
                    // remove it first (does nothing if not there) then add it
                    md.removeNamespaceDeclaration(schemaLocAtt.getNamespace());
                    md.addNamespaceDeclaration(schemaLocAtt.getNamespace());
                }
            }
        } else {
            String schemaDir = sm.getSchemaDir(schema);
            if (Lib.existsConverter(schemaDir, prefix)) {
                final String siteURL = context.getBean(SettingManager.class).getSiteURL(context);
                Element env = Lib.prepareTransformEnv(uuid, changeDate, context.getBaseUrl(), siteURL, gc.getBean(SettingManager.class)
                        .getSiteName());
                md = Lib.transform(schemaDir, env, md, prefix + ".xsl");
            } else {
                throw new CannotDisseminateFormatException("Unknown prefix : " + prefix);
            }
View Full Code Here

        // Handle children IDs.
        String[] children = childrenIds.split(",");

        // Update children
        GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
        DataManager   dm = gc.getBean(DataManager.class);

        Set<String> untreatedChildren = dm.updateChildren(context, parentUuid, children, parameters);

        Element response = new Element(Jeeves.Elem.RESPONSE);
        int treatedChildren = children.length;
View Full Code Here

public class Clear implements Service {
    public void init(String appPath, ServiceConfig params) throws Exception {
    }

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

        String fname = Util.getParam(params, Params.REF);
       

        ThesaurusManager tm = gc.getBean(ThesaurusManager.class);
        Thesaurus t = tm.getThesaurusByName(fname);

        if (t != null) {
            t.clear();
        } else {
View Full Code Here

     * @param context
     * @return
     * @throws Exception
     */
    public Element serviceSpecificExec(Element params, ServiceContext context) throws Exception {
        GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
        DataManager dataMan = gc.getBean(DataManager.class);
        AccessManager accessMan = gc.getBean(AccessManager.class);

        String id = Utils.getIdentifierFromParameters(params, context);
        String groupOwner = Util.getParam(params, "groupid");

        int iLocalId = Integer.parseInt(id);
View Full Code Here

  }

  public Element exec(Element params, ServiceContext context)
      throws Exception {
    String status = "true";
    GeonetContext gc = (GeonetContext) context
        .getHandlerContext(Geonet.CONTEXT_NAME);
    ServiceConfig handlerConfig = gc.getBean(ServiceConfig.class);
    String luceneConfigXmlFile = handlerConfig
        .getMandatoryValue(Geonet.Config.LUCENE_CONFIG);

    LuceneConfig lc = context.getBean(LuceneConfig.class);
        lc.configure(luceneConfigXmlFile);
View Full Code Here

TOP

Related Classes of org.fao.geonet.GeonetContext

Copyright © 2018 www.massapicom. 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.