Package com.esri.gpt.catalog.context

Examples of com.esri.gpt.catalog.context.CatalogConfiguration


/**
* Gets the harvesting table name.
* @return the harvesting table name
*/
protected String getHarvestingHistoryTableName() {
  CatalogConfiguration cfg = getRequestContext().getCatalogConfiguration();
  return cfg.getHarvestingHistoryTableName();
}
View Full Code Here


  XPath xpath = XPathFactory.newInstance().newXPath();

  // catalog configuration
  Node ndCat = (Node) xpath.evaluate("catalog", root, XPathConstants.NODE);
  if (ndCat != null) {
    CatalogConfiguration cfg = appConfig.getCatalogConfiguration();
    cfg.getParameters().clear();
    ImsService publish = cfg.getArcImsCatalog().getPublishService();
    ImsService browse = cfg.getArcImsCatalog().getBrowseService();
    cfg.setTablePrefix(Val.chkStr(xpath.evaluate("@gptTablePrefix", ndCat),"GPT_"));
    cfg.setMvsTablePrefix(Val.chkStr(xpath.evaluate("@mvsTablePrefix", ndCat),"MVS_"));

    publish.setServerUrl(xpath.evaluate("@metadataServerUrl", ndCat));
    publish.setServiceName(Val.chkStr(xpath.evaluate("@metadataServerPublishService",ndCat), "GPT_Publish_Metadata"));
    publish.setTimeoutMillisecs(Val.chkInt(xpath.evaluate("@metadataServerTimeoutMillisecs", ndCat), 0));

    browse.setServerUrl(publish.getServerUrl());
    browse.setServiceName(Val.chkStr(xpath.evaluate("@metadataServerBrowseService", ndCat),"GPT_Browse_Metadata"));
    browse.setTimeoutMillisecs(publish.getTimeoutMillisecs());

    // additional parameters
    populateParameters(cfg.getParameters(), ndCat);
   
    //load dcat fields
    if(cfg.getParameters().containsKey("dcat.mappings")){
      loadDcatMappings(cfg.getDcatSchemas(),cfg.getParameters().get("dcat.mappings").getValue());
    }
   
    // parse http timeouts
    String connectionTimeout = cfg.getParameters().getValue("httpClientRequest.connectionTimeout");
    String responseTimeout   = cfg.getParameters().getValue("httpClientRequest.responseTimeout");
   
    // set http timeouts
    cfg.setConnectionTimeMs((int)parsePeriod(connectionTimeout, HttpClientRequest.DEFAULT_CONNECTION_TIMEOUT).getValue());
    cfg.setResponseTimeOutMs((int)parsePeriod(responseTimeout , HttpClientRequest.DEFAULT_RESPONSE_TIMEOUT).getValue());
  }

  // search configuration
  Node ndSearch = (Node) xpath.evaluate("catalog/search", root,
      XPathConstants.NODE);
  SearchConfig sCfg = appConfig.getCatalogConfiguration().getSearchConfig();
  sCfg.setSearchConfigNode(ndSearch);
  if (ndSearch != null) {
    sCfg.setResultsReviewsShown(
        Val.chkStr(xpath.evaluate("@searchResultsReviewsShown", ndSearch)));
    sCfg.setResultsPerPage(xpath.evaluate("@searchResultsPerPage", ndSearch));
    sCfg.setMaxSavedSearches(xpath.evaluate("@maxSavedSearches", ndSearch));
    sCfg.setCswProfile(
        Val.chkStr(xpath.evaluate("@cswServletUrlProfile", ndSearch),"urn:ogc:CSW:2.0.2:HTTP:OGCCORE:ESRI:GPT"));
    sCfg.setSearchUri(xpath.evaluate("@cswServletUrl", ndSearch));
    sCfg.setTimeOut(xpath.evaluate("@searchTimeoutMillisecs", ndSearch));
    sCfg.setDistributedSearchMaxSelectedSites(
        Val.chkStr(xpath.evaluate("@distributedSearchMaxSelectedSites",
            ndSearch)));
    sCfg.setDistributedSearchTimeoutMillisecs(
        Val.chkStr(xpath.evaluate("@distributedSearchTimeoutMillisecs",
            ndSearch)));
       
    sCfg.setAllowExternalSearch(Val.chkBool(xpath.evaluate(
        "@allowExternalSiteSearch", ndSearch), false));
    sCfg.setAllowTemporalSearch(Val.chkBool(xpath.evaluate("@allowTemporalSearch",ndSearch),false));
    sCfg.setJsfSuffix(Val.chkStr(xpath.evaluate(
        "@jsfSuffix", ndSearch)));
    sCfg.setGptToCswXsltPath(xpath.evaluate("@gpt2cswXslt", ndSearch));
    sCfg.setMapViewerUrl(Val.chkStr(xpath.evaluate("@mapViewerUrl", ndSearch),""));
    sCfg.validate();
  }


  NodeList nodes = (NodeList) xpath.evaluate(
      "catalog/search/repositories/repository",
      root, XPathConstants.NODESET);
  NodeList nodeList = nodes;
  LinkedHashMap<String, Map<String, String>> sFactory =
      new LinkedHashMap<String, Map<String, String>>();
  Map<String, String> attributes =
      new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
  /*attributes.put("key", "local");
  attributes.put("class", "com.esri.gpt.catalog.search.SearchEngineLocal");
  attributes.put("resourceKey", "catalog.search.searchSite.defaultsite");
  attributes.put("labelResourceKey", "catalog.search.searchSite.defaultsite");
  attributes.put("abstractResourceKey", "catalog.search.searchSite.defaultsite.abstract");
  sFactory.put("local", attributes);*/
  for (int i = 0; nodeList != null && i < nodeList.getLength(); i++) {
    ndSearch = nodeList.item(i);
    attributes =
        new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
    NamedNodeMap nnm = ndSearch.getAttributes();
    for (int j = 0; nnm != null && j < nnm.getLength(); j++) {
      Node nd = nnm.item(j);
      String key = Val.chkStr(nd.getNodeName());
      String value = Val.chkStr(nd.getNodeValue());
      attributes.put(key, value);
      if (key.equalsIgnoreCase("RESOURCEKEY")) {
        attributes.put("RESOURCEKEY", value);
      }
      if (key.equalsIgnoreCase("labelResourceKey")) {
        attributes.put("labelResourceKey", value);
      }
      if (key.equalsIgnoreCase("abstractResourceKey")) {
        attributes.put("abstractResourceKey", value);
      }
    }
    NodeList params = (NodeList) xpath.evaluate("parameter",
        ndSearch, XPathConstants.NODESET);
    for (int k = 0; params != null && k < params.getLength(); k++) {
      String key = xpath.evaluate("@key", params.item(k));
      String value = xpath.evaluate("@value", params.item(k));
      attributes.put(Val.chkStr(key), Val.chkStr(value));
    }

    String key = Val.chkStr(xpath.evaluate("@key", ndSearch));
    sFactory.put(key, attributes);

  }
  sCfg.setSearchFactoryRepos(sFactory);

  // Mapviewer
  ArrayList<MapViewerConfigs> mapViewerConfigs =
      new ArrayList<MapViewerConfigs>();
  nodes = (NodeList) xpath.evaluate("catalog/mapViewer/instance", root,
      XPathConstants.NODESET);
  for (int j = 0; nodes != null && j < nodes.getLength(); j++) {
    MapViewerConfigs mvConfigs = new MapViewerConfigs();
    Node nd = nodes.item(j);
    mvConfigs.setClassName(Val.chkStr(xpath.evaluate("@className", nd),"com.esri.gpt.catalog.search.MapViewerFlex"));
    mvConfigs.setUrl(xpath.evaluate("@url", nd));
    NodeList pNodeList = (NodeList) xpath.evaluate("parameter", nd, XPathConstants.NODESET);
    for (int k = 0; pNodeList != null && k < pNodeList.getLength(); k++) {
      String key = xpath.evaluate("@key", pNodeList.item(k));
      String value = xpath.evaluate("@value", pNodeList.item(k));
      if (key != null || value != null) {
        mvConfigs.addParameter(key, value);
      }
    }
    mapViewerConfigs.add(mvConfigs);

  }
  sCfg.setMapViewerInstances(mapViewerConfigs);

  // Lucene configuration
  Node ndLucene = (Node) xpath.evaluate("catalog/lucene", root, XPathConstants.NODE);
  if (ndLucene != null) {
    CatalogConfiguration cfg = appConfig.getCatalogConfiguration();
    cfg.getLuceneConfig().setIndexLocation(
        xpath.evaluate("@indexLocation", ndLucene));
    cfg.getLuceneConfig().setWriteLockTimeout(
        Val.chkInt(xpath.evaluate("@writeLockTimeout", ndLucene), -1));
    cfg.getLuceneConfig().setUseNativeFSLockFactory(
        Val.chkStr(xpath.evaluate("@useNativeFSLockFactory", ndLucene)).equalsIgnoreCase("true"));
    cfg.getLuceneConfig().setAnalyzerClassName(
        xpath.evaluate("@analyzerClassName", ndLucene));
    cfg.getLuceneConfig().setUseConstantScoreQuery(
        Val.chkBool(xpath.evaluate("@useConstantScoreQuery", ndLucene), false));
    cfg.getLuceneConfig().setMaxClauseCount(
        Val.chkInt(xpath.evaluate("@maxClauseCount", ndLucene), BooleanQuery.getMaxClauseCount()));

    ParserAdaptorInfos infos = new ParserAdaptorInfos();
    NodeList ndLstProxies = (NodeList) xpath.evaluate("adaptor", ndLucene,
        XPathConstants.NODESET);
    for (int i = 0; i < ndLstProxies.getLength(); i++) {
      Node ndProxy = ndLstProxies.item(i);
      String proxyName = xpath.evaluate("@name", ndProxy);
      String proxyClassName = xpath.evaluate("@className", ndProxy);

      ParserAdaptorInfo info = new ParserAdaptorInfo();
      info.setName(proxyName);
      info.setClassName(proxyClassName);

      NodeList ndListProps = (NodeList) xpath.evaluate("attribute", ndProxy,
          XPathConstants.NODESET);
      for (int p = 0; p < ndListProps.getLength(); p++) {
        Node ndProp = ndListProps.item(p);
        String key = xpath.evaluate("@key", ndProp);
        String value = xpath.evaluate("@value", ndProp);
        info.getAttributes().set(key, value);
      }

      infos.add(info);
    }

    cfg.getLuceneConfig().setParserProxies(infos.createParserProxies());
   
    NodeList ndObservers = (NodeList) xpath.evaluate("observer", ndLucene, XPathConstants.NODESET);
    for (Node ndObserver: new NodeListAdapter(ndObservers)) {
      LuceneIndexObserverInfo info = new LuceneIndexObserverInfo();
      info.setClassName(Val.chkStr(xpath.evaluate("@className", ndObserver)));
      NodeList ndListProps = (NodeList) xpath.evaluate("attribute", ndObserver, XPathConstants.NODESET);
      for (Node ndAttribute: new NodeListAdapter(ndListProps)) {
        String key = xpath.evaluate("@key", ndAttribute);
        String value = xpath.evaluate("@value", ndAttribute);
        info.getAttributes().set(key, value);
      }
      LuceneIndexObserver observer = info.createObserver();
      if (observer!=null) {
        cfg.getLuceneConfig().getObservers().add(observer);
      }
    }
   
  }

View Full Code Here

*/
protected void execute(HttpServletRequest request,
    HttpServletResponse response, RequestContext context) throws Exception {

  // initialize
  CatalogConfiguration catConfig = context.getCatalogConfiguration();
  String sService = getServiceName(request);
  String axlRequest = readInputCharacters(request);
  String axlResponse = "";
  String sSourceUri = "";
  String sServiceNameParam = sService;
View Full Code Here

*/
public PublishServiceRequest(RequestContext requestContext,
                             Publisher publisher) {
  setRequestContext(requestContext);
  setPublisher(publisher);
  CatalogConfiguration catConfig = requestContext.getCatalogConfiguration();
  setService(catConfig.getArcImsCatalog().getPublishService());
  setCredentials(getPublisher().getCredentials());
}
View Full Code Here

    // initialize
    this.indexReferences = new AsnIndexReferences();
    this.operations = new AsnOperations();
    AsnIndexReferences indexRefs = this.indexReferences;
    ApplicationConfiguration appCfg = ApplicationContext.getInstance().getConfiguration();
    CatalogConfiguration catCfg = appCfg.getCatalogConfiguration();
    StringAttributeMap catParams = catCfg.getParameters();
    LuceneConfig luceneCfg = catCfg.getLuceneConfig();
   
    // API operations
    AsnOperation op = new AsnOperation();
    op.setHandlerClass("com.esri.gpt.server.assertion.handler.AsnApiHandler");
    op.setSubject(new AsnSubject(AsnConstants.APP_URN_PREFIX));
View Full Code Here

/** Default constructor. */
public ApplicationConfiguration() {
  super();
  setDatabaseReferences(new DatabaseReferences());
  setIdentityConfiguration(new IdentityConfiguration());
  setCatalogConfiguration(new CatalogConfiguration());
  setMailConfiguration(new MailConfiguration());
  setThreadSchedulerConfiguration(new ThreadSchedulerConfiguration());
  setDownloadDataConfiguration(new DownloadConfiguration());
  setMetadataAccessPolicy(new MetadataAccessPolicy());
}
View Full Code Here

* @param configuration the catalog configuration
*/
private void setCatalogConfiguration(CatalogConfiguration configuration) {
  _catalogConfiguration = configuration;
  if (_catalogConfiguration == null) {
    _catalogConfiguration = new CatalogConfiguration();
  }
}
View Full Code Here

   * /gptConfig/catalog/parameter@key="csw.provider.local.IProviderFactory"
   * @param requestContext the active request context
   * @return the provider factory
   */
  public static IProviderFactory newFactory(RequestContext requestContext) {
    CatalogConfiguration catCfg = null;
    if (requestContext != null) {
      catCfg = requestContext.getCatalogConfiguration();
    } else {
      catCfg = ApplicationContext.getInstance().getConfiguration().getCatalogConfiguration();
    }
   
    String key = "csw.provider.local.IProviderFactory";
    String className = Val.chkStr(catCfg.getParameters().getValue(key));
    if (className.length() == 0) {
      return new ProviderFactory();
    } else {

      try {
View Full Code Here

 
  if (messageBroker == null) {
    messageBroker = new MessageBroker();
    messageBroker.setBundleBaseName("gpt.resources.gpt");
  }
  CatalogConfiguration catCfg = context.getCatalogConfiguration();

  // look for a configured class name for the resource link builder
  String className = Val.chkStr(catCfg.getParameters().getValue(
      "resourceLinkBuilder"));
  if (className.length() == 0) {
    className = com.esri.gpt.catalog.search.ResourceLinkBuilder.class.getName();
  }
View Full Code Here

   */
  private String readXml(HttpServletRequest request, RequestContext context)
    throws Exception {
   
    // initialize values for substitution
    CatalogConfiguration catCfg = context.getCatalogConfiguration();
    MessageBroker msgBroker = new MessageBroker();
    msgBroker.setBundleBaseName("gpt.resources.gpt");
   
    String basePath = RequestContext.resolveBaseContextPath(request);
    String restPath = basePath+"/rest/find/document";
View Full Code Here

TOP

Related Classes of com.esri.gpt.catalog.context.CatalogConfiguration

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.