http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/service/src/main/java/gov/nasa/jpl/mudrod/services/recommendation/HybridRecomDatasetsResource.java ---------------------------------------------------------------------- diff --git a/service/src/main/java/gov/nasa/jpl/mudrod/services/recommendation/HybridRecomDatasetsResource.java b/service/src/main/java/gov/nasa/jpl/mudrod/services/recommendation/HybridRecomDatasetsResource.java new file mode 100644 index 0000000..7ffc040 --- /dev/null +++ b/service/src/main/java/gov/nasa/jpl/mudrod/services/recommendation/HybridRecomDatasetsResource.java @@ -0,0 +1,59 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package gov.nasa.jpl.mudrod.services.recommendation; + +import com.google.gson.JsonObject; +import gov.nasa.jpl.mudrod.main.MudrodEngine; +import gov.nasa.jpl.mudrod.recommendation.structure.HybridRecommendation; + +import javax.servlet.ServletContext; +import javax.ws.rs.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +/** + * A hybrid recommendation resource for datasets. + */ +@Path("/hrecommendation") +public class HybridRecomDatasetsResource { + + private MudrodEngine mEngine; + + public HybridRecomDatasetsResource(@Context ServletContext sc) { + this.mEngine = (MudrodEngine) sc.getAttribute("MudrodInstance"); + } + + @GET + @Path("/status") + @Produces("text/html") + public Response status() { + return Response.ok("<h1>This is MUDROD Hybrid Recommendation Datasets Resource: running correctly...</h1>").build(); + } + + @GET + @Path("/search") + @Produces(MediaType.APPLICATION_JSON) + @Consumes("text/plain") + public Response hybridRecommendation(@QueryParam("shortname") String shortName) { + JsonObject json = new JsonObject(); + if (shortName != null) { + HybridRecommendation recom = new HybridRecommendation(mEngine.getConfig(), mEngine.getESDriver(), null); + json = new JsonObject(); + json.add("HybridRecommendationData", recom.getRecomDataInJson(shortName, 10)); + } + return Response.ok(json.toString(), MediaType.APPLICATION_JSON).build(); + } + +}
http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/service/src/main/java/gov/nasa/jpl/mudrod/services/recommendation/RecomDatasetsResource.java ---------------------------------------------------------------------- diff --git a/service/src/main/java/gov/nasa/jpl/mudrod/services/recommendation/RecomDatasetsResource.java b/service/src/main/java/gov/nasa/jpl/mudrod/services/recommendation/RecomDatasetsResource.java new file mode 100644 index 0000000..75e043c --- /dev/null +++ b/service/src/main/java/gov/nasa/jpl/mudrod/services/recommendation/RecomDatasetsResource.java @@ -0,0 +1,60 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package gov.nasa.jpl.mudrod.services.recommendation; + +import com.google.gson.JsonObject; +import gov.nasa.jpl.mudrod.main.MudrodEngine; +import gov.nasa.jpl.mudrod.recommendation.structure.RecomData; + +import javax.servlet.ServletContext; +import javax.ws.rs.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +; + +/** + * A Dataset recommendation resource. + */ +@Path("/recommendation") +public class RecomDatasetsResource { + + private MudrodEngine mEngine; + + public RecomDatasetsResource(@Context ServletContext sc) { + this.mEngine = (MudrodEngine) sc.getAttribute("MudrodInstance"); + } + + @GET + @Path("/status") + @Produces("text/html") + public Response status() { + return Response.ok("<h1>This is MUDROD Recommendation Datasets Resource: running correctly...</h1>").build(); + } + + @PUT + @Path("{shortname}") + @Produces(MediaType.APPLICATION_JSON) + @Consumes("text/plain") + public Response hybridRecommendation(@PathParam("shortname") String shortName) { + JsonObject json = new JsonObject(); + if (shortName != null) { + RecomData recom = new RecomData(mEngine.getConfig(), mEngine.getESDriver(), null); + json = new JsonObject(); + json.add("RecommendationData", recom.getRecomDataInJson(shortName, 10)); + } + return Response.ok(json.toString(), MediaType.APPLICATION_JSON).build(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/service/src/main/java/gov/nasa/jpl/mudrod/services/recommendation/package-info.java ---------------------------------------------------------------------- diff --git a/service/src/main/java/gov/nasa/jpl/mudrod/services/recommendation/package-info.java b/service/src/main/java/gov/nasa/jpl/mudrod/services/recommendation/package-info.java new file mode 100644 index 0000000..2ac9330 --- /dev/null +++ b/service/src/main/java/gov/nasa/jpl/mudrod/services/recommendation/package-info.java @@ -0,0 +1,17 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Mudrod recommendation resources. + */ +package gov.nasa.jpl.mudrod.services.recommendation; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/service/src/main/java/gov/nasa/jpl/mudrod/services/search/SearchDatasetDetailResource.java ---------------------------------------------------------------------- diff --git a/service/src/main/java/gov/nasa/jpl/mudrod/services/search/SearchDatasetDetailResource.java b/service/src/main/java/gov/nasa/jpl/mudrod/services/search/SearchDatasetDetailResource.java new file mode 100644 index 0000000..ce20569 --- /dev/null +++ b/service/src/main/java/gov/nasa/jpl/mudrod/services/search/SearchDatasetDetailResource.java @@ -0,0 +1,71 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package gov.nasa.jpl.mudrod.services.search; + +import gov.nasa.jpl.mudrod.main.MudrodConstants; +import gov.nasa.jpl.mudrod.main.MudrodEngine; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.ServletContext; +import javax.ws.rs.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.Properties; +import java.util.concurrent.ExecutionException; + +/** + * A Dataset Detail Search Resource + */ +@Path("/datasetdetail") +public class SearchDatasetDetailResource { + + private static final Logger LOG = LoggerFactory.getLogger(SearchDatasetDetailResource.class); + private MudrodEngine mEngine; + + public SearchDatasetDetailResource(@Context ServletContext sc) { + this.mEngine = (MudrodEngine) sc.getAttribute("MudrodInstance"); + } + + /** + * A simple health status checker for this resource. + * + * @return a static html response if the service is running correctly. + */ + @GET + @Path("/status") + @Produces("text/html") + public Response status() { + return Response.ok("<h1>This is MUDROD Dataset Detail Search Resource: running correctly...</h1>").build(); + } + + @GET + @Path("/search") + @Produces(MediaType.APPLICATION_JSON) + @Consumes("text/plain") + public Response searchDatasetDetail(@QueryParam("shortname") String shortName) { + Properties config = mEngine.getConfig(); + String dataDetailJson = null; + try { + String query = "Dataset-ShortName:\"" + shortName + "\""; + dataDetailJson = mEngine.getESDriver().searchByQuery(config.getProperty(MudrodConstants.ES_INDEX_NAME), config.getProperty(MudrodConstants.RAW_METADATA_TYPE), query, true); + } catch (InterruptedException | ExecutionException | IOException e) { + LOG.error("Error whilst searching for a Dataset-ShortName: ", e); + } + LOG.info("Response received: {}", dataDetailJson); + return Response.ok(dataDetailJson, MediaType.APPLICATION_JSON).build(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/service/src/main/java/gov/nasa/jpl/mudrod/services/search/SearchMetadataResource.java ---------------------------------------------------------------------- diff --git a/service/src/main/java/gov/nasa/jpl/mudrod/services/search/SearchMetadataResource.java b/service/src/main/java/gov/nasa/jpl/mudrod/services/search/SearchMetadataResource.java new file mode 100644 index 0000000..b9dc501 --- /dev/null +++ b/service/src/main/java/gov/nasa/jpl/mudrod/services/search/SearchMetadataResource.java @@ -0,0 +1,73 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package gov.nasa.jpl.mudrod.services.search; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; +import gov.nasa.jpl.mudrod.main.MudrodConstants; +import gov.nasa.jpl.mudrod.main.MudrodEngine; +import gov.nasa.jpl.mudrod.ssearch.Ranker; +import gov.nasa.jpl.mudrod.ssearch.Searcher; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.ServletContext; +import javax.ws.rs.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.util.Properties; + +/** + * A Mudrod Metadata Search Resource + */ +@Path("/metadata") +public class SearchMetadataResource { + + private static final Logger LOG = LoggerFactory.getLogger(SearchMetadataResource.class); + + private MudrodEngine mEngine; + private Searcher searcher; + private Ranker ranker; + + public SearchMetadataResource(@Context ServletContext sc) { + this.mEngine = (MudrodEngine) sc.getAttribute("MudrodInstance"); + this.searcher = (Searcher) sc.getAttribute("MudrodSearcher"); + this.ranker = (Ranker) sc.getAttribute("MudrodRanker"); + } + + @GET + @Path("/status") + @Produces("text/html") + public Response status() { + return Response.ok("<h1>This is MUDROD Metadata Search Resource: running correctly...</h1>").build(); + } + + @GET + @Path("/search") + @Produces(MediaType.APPLICATION_JSON) + @Consumes("text/plain") + public Response searchMetadata(@QueryParam("query") String query, @QueryParam("operator") String operator, @QueryParam("rankoption") String rankoption) { + Properties config = mEngine.getConfig(); + String fileList = searcher + .ssearch(config.getProperty(MudrodConstants.ES_INDEX_NAME), config.getProperty(MudrodConstants.RAW_METADATA_TYPE), query, operator, //please replace it with and, or, phrase + rankoption, ranker); + Gson gson = new GsonBuilder().create(); + String json = gson.toJson(gson.fromJson(fileList, JsonObject.class)); + LOG.debug("Response received: {}", json); + return Response.ok(json, MediaType.APPLICATION_JSON).build(); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/service/src/main/java/gov/nasa/jpl/mudrod/services/search/SearchVocabResource.java ---------------------------------------------------------------------- diff --git a/service/src/main/java/gov/nasa/jpl/mudrod/services/search/SearchVocabResource.java b/service/src/main/java/gov/nasa/jpl/mudrod/services/search/SearchVocabResource.java new file mode 100644 index 0000000..ab4c661 --- /dev/null +++ b/service/src/main/java/gov/nasa/jpl/mudrod/services/search/SearchVocabResource.java @@ -0,0 +1,65 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package gov.nasa.jpl.mudrod.services.search; + +import com.google.gson.Gson; +import com.google.gson.JsonObject; +import gov.nasa.jpl.mudrod.integration.LinkageIntegration; +import gov.nasa.jpl.mudrod.main.MudrodEngine; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.ServletContext; +import javax.ws.rs.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +/** + * A Mudrod Search Vocabulary Resource + */ +@Path("/vocabulary") +public class SearchVocabResource { + + private static final Logger LOG = LoggerFactory.getLogger(SearchMetadataResource.class); + + private MudrodEngine mEngine; + + public SearchVocabResource(@Context ServletContext sc) { + this.mEngine = (MudrodEngine) sc.getAttribute("MudrodInstance"); + } + + @GET + @Path("/status") + @Produces("text/html") + public Response status() { + return Response.ok("<h1>This is MUDROD Vocabulary Search Resource: running correctly...</h1>").build(); + } + + @GET + @Path("/search") + @Produces(MediaType.APPLICATION_JSON) + @Consumes("text/plain") + public Response searchVocabulary(@QueryParam("query") String concept) { + JsonObject json = new JsonObject(); + if (concept != null) { + LinkageIntegration li = new LinkageIntegration(mEngine.getConfig(), mEngine.getESDriver(), null); + json = new JsonObject(); + json.add("graph", li.getIngeratedListInJson(concept)); + } + LOG.info("Response received: {}", json); + return Response.ok(new Gson().toJson(json), MediaType.APPLICATION_JSON).build(); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/service/src/main/java/gov/nasa/jpl/mudrod/services/search/SessionDetailResource.java ---------------------------------------------------------------------- diff --git a/service/src/main/java/gov/nasa/jpl/mudrod/services/search/SessionDetailResource.java b/service/src/main/java/gov/nasa/jpl/mudrod/services/search/SessionDetailResource.java new file mode 100644 index 0000000..fcbe3c6 --- /dev/null +++ b/service/src/main/java/gov/nasa/jpl/mudrod/services/search/SessionDetailResource.java @@ -0,0 +1,69 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package gov.nasa.jpl.mudrod.services.search; + +import com.google.gson.Gson; +import com.google.gson.JsonObject; +import gov.nasa.jpl.mudrod.main.MudrodConstants; +import gov.nasa.jpl.mudrod.main.MudrodEngine; +import gov.nasa.jpl.mudrod.weblog.structure.Session; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.ServletContext; +import javax.ws.rs.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +/** + * Servlet implementation class SessionDetail + */ +@Path("/sessiondetail") +public class SessionDetailResource { + + private static final Logger LOG = LoggerFactory.getLogger(SessionDetailResource.class); + private MudrodEngine mEngine; + + /** + * Constructor + * + * @param sc an instantiated {@link javax.servlet.ServletContext} + */ + public SessionDetailResource(@Context ServletContext sc) { + this.mEngine = (MudrodEngine) sc.getAttribute("MudrodInstance"); + } + + @GET + @Path("/status") + @Produces("text/html") + public Response status() { + return Response.ok("<h1>This is MUDROD Session Detail Search Resource: running correctly...</h1>").build(); + } + + @POST + @Path("{CleanupType}-{SessionID}") + @Produces(MediaType.APPLICATION_JSON) + @Consumes("text/plain") + protected Response searchSessionDetail(@PathParam("CleanupType") String cleanupType, @PathParam("SessionID") String sessionID) { + + JsonObject json = new JsonObject(); + if (sessionID != null) { + Session session = new Session(mEngine.getConfig(), mEngine.getESDriver()); + json = session.getSessionDetail(mEngine.getConfig().getProperty(MudrodConstants.ES_INDEX_NAME, "mudrod"), cleanupType, sessionID); + } + LOG.info("Response received: {}", json); + return Response.ok(new Gson().toJson(json), MediaType.APPLICATION_JSON).build(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/service/src/main/java/gov/nasa/jpl/mudrod/services/search/package-info.java ---------------------------------------------------------------------- diff --git a/service/src/main/java/gov/nasa/jpl/mudrod/services/search/package-info.java b/service/src/main/java/gov/nasa/jpl/mudrod/services/search/package-info.java new file mode 100644 index 0000000..abcfb07 --- /dev/null +++ b/service/src/main/java/gov/nasa/jpl/mudrod/services/search/package-info.java @@ -0,0 +1,17 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you + * may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Mudrod search-related resources. + */ +package gov.nasa.jpl.mudrod.services.search; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/service/src/main/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/service/src/main/resources/log4j.properties b/service/src/main/resources/log4j.properties new file mode 100644 index 0000000..482a580 --- /dev/null +++ b/service/src/main/resources/log4j.properties @@ -0,0 +1,63 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 Unless +# +# required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" +# BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +# express or implied. See the License for the specific language +# governing permissions and limitations under the License. +# Define some default values that can be overridden by system properties +# Logging Threshold +mudrod.root.logger=INFO,DRFA, stdout +mudrod.log.dir=. +mudrod.log.file=mudrod_service.log +log4j.threshhold=ALL +# RootLogger - DailyRollingFileAppender +log4j.rootLogger=${mudrod.root.logger} +#special logging requirements for some commandline tools +log4j.logger.MudrodEngine=INFO,cmdstdout +# +# Daily Rolling File Appender +# +log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender +log4j.appender.DRFA.File=${mudrod.log.dir}/${mudrod.log.file} +# Rollver at midnight +log4j.appender.DRFA.DatePattern=.yyyy-MM-dd +# 30-day backup +#log4j.appender.DRFA.MaxBackupIndex=30 +log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout +# Pattern format: Date LogLevel LoggerName LogMessage +log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} - %m%n +# Debugging Pattern format: Date LogLevel LoggerName (FileName:MethodName:LineNo) LogMessage +#log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n +# +# stdout +# Add *stdout* to rootlogger above if you want to use this +# +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n +# +# plain layout used for commandline tools to output to console +# +log4j.appender.cmdstdout=org.apache.log4j.ConsoleAppender +log4j.appender.cmdstdout.layout=org.apache.log4j.PatternLayout +log4j.appender.cmdstdout.layout.ConversionPattern=%m%n +# +# Rolling File Appender +# +#log4j.appender.RFA=org.apache.log4j.RollingFileAppender +#log4j.appender.RFA.File=${hadoop.log.dir}/${hadoop.log.file} +# Logfile size and and 30-day backups +#log4j.appender.RFA.MaxFileSize=1MB +#log4j.appender.RFA.MaxBackupIndex=30 +#log4j.appender.RFA.layout=org.apache.log4j.PatternLayout +#log4j.appender.RFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} - %m%n +#log4j.appender.RFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n +# Custom Logging levels +log4j.logger.akka=WARN +log4j.logger.org.apache=WARN +log4j.logger.gov.nasa.jpl.mudrod=INFO http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/service/src/main/webapp/META-INF/context.xml ---------------------------------------------------------------------- diff --git a/service/src/main/webapp/META-INF/context.xml b/service/src/main/webapp/META-INF/context.xml new file mode 100644 index 0000000..1fc4b99 --- /dev/null +++ b/service/src/main/webapp/META-INF/context.xml @@ -0,0 +1,18 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one or more contributor +license agreements. See the NOTICE.txt file distributed with this work for +additional information regarding copyright ownership. The ASF licenses this +file to you under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +--> +<Context path="/mudrod-service"> + +</Context> http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/service/src/main/webapp/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/service/src/main/webapp/WEB-INF/web.xml b/service/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..38bb88e --- /dev/null +++ b/service/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 Unless + + required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + express or implied. See the License for the specific language + governing permissions and limitations under the License. +--> +<web-app xmlns="http://java.sun.com/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + version="3.0"> + + <display-name>MUDROD</display-name> + <servlet> + <servlet-name>CXFServlet</servlet-name> + <servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet + </servlet-class> + <init-param> + <param-name>jaxrs.serviceClasses</param-name> + <param-value> + gov.nasa.jpl.mudrod.services.autocomplete.AutoCompleteResource, + gov.nasa.jpl.mudrod.services.search.SearchDatasetDetailResource, + gov.nasa.jpl.mudrod.services.recommendation.HybridRecomDatasetsResource, + gov.nasa.jpl.mudrod.services.recommendation.RecomDatasetsResource, + gov.nasa.jpl.mudrod.services.search.SearchMetadataResource, + gov.nasa.jpl.mudrod.services.search.SearchVocabResource, + gov.nasa.jpl.mudrod.services.search.SessionDetailResource, + gov.nasa.jpl.mudrod.services.ontology.OntologyResource, + </param-value> + </init-param> + <init-param> + <param-name>jaxrs.providers</param-name> + <param-value>gov.nasa.jpl.mudrod.services.DefaultExceptionMapper</param-value> + </init-param> + <load-on-startup>1</load-on-startup> + </servlet> + + <listener> + <listener-class>gov.nasa.jpl.mudrod.services.MudrodContextListener + </listener-class> + </listener> + + <servlet-mapping> + <servlet-name>CXFServlet</servlet-name> + <url-pattern>/services/*</url-pattern> + </servlet-mapping> + +</web-app> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/sonar-project.properties ---------------------------------------------------------------------- diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..8b8e884 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,25 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# must be unique in a given SonarQube instance +sonar.projectKey=gov.nasa.jpl.mudrod:mudrod-parent +# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1. +#sonar.projectName=Mudrod :: Parent +#sonar.projectVersion=0.0.1-SNAPSHOT + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +# This property is optional if sonar.modules is set. +sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/web/.classpath ---------------------------------------------------------------------- diff --git a/web/.classpath b/web/.classpath new file mode 100644 index 0000000..93e3cde --- /dev/null +++ b/web/.classpath @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="META-INF" output="target/classes/META-INF" excluding="**/*.java"/> + <classpathentry kind="output" path="target/classes"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> +</classpath> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/web/.project ---------------------------------------------------------------------- diff --git a/web/.project b/web/.project new file mode 100644 index 0000000..c7705cb --- /dev/null +++ b/web/.project @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>mudrod-web</name> + <comment>MUDROD: Mining and Utilizing Dataset Relevancy from + Oceanographic Datasets + to Improve Data Discovery and Access. MUDROD is a semantic discovery and + search project + funded by NASA AIST (NNX15AM85G). NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment> + <projects/> + <buildSpec> + <buildCommand> + <name>org.eclipse.wst.common.project.facet.core.builder</name> + </buildCommand> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + </buildCommand> + <buildCommand> + <name>org.eclipse.wst.validation.validationbuilder</name> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jem.workbench.JavaEMFNature</nature> + <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.wst.common.project.facet.core.nature</nature> + </natures> +</projectDescription> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/web/.settings/org.eclipse.jdt.core.prefs ---------------------------------------------------------------------- diff --git a/web/.settings/org.eclipse.jdt.core.prefs b/web/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..45a6e0e --- /dev/null +++ b/web/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.5 http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/web/.settings/org.eclipse.m2e.core.prefs ---------------------------------------------------------------------- diff --git a/web/.settings/org.eclipse.m2e.core.prefs b/web/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/web/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/web/.settings/org.eclipse.wst.common.component ---------------------------------------------------------------------- diff --git a/web/.settings/org.eclipse.wst.common.component b/web/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..0da6e11 --- /dev/null +++ b/web/.settings/org.eclipse.wst.common.component @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> + <wb-module deploy-name="mudrod-web"> + <wb-resource deploy-path="/" source-path="/META-INF"/> + <wb-resource deploy-path="/" source-path="/src/main/java"/> + </wb-module> +</project-modules> http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/web/.settings/org.eclipse.wst.common.project.facet.core.xml ---------------------------------------------------------------------- diff --git a/web/.settings/org.eclipse.wst.common.project.facet.core.xml b/web/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..a1f6907 --- /dev/null +++ b/web/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<faceted-project> + <installed facet="java" version="1.5"/> + <installed facet="jst.utility" version="1.0"/> +</faceted-project> http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/web/META-INF/resources/css/footer.css ---------------------------------------------------------------------- diff --git a/web/META-INF/resources/css/footer.css b/web/META-INF/resources/css/footer.css new file mode 100644 index 0000000..7e0732e --- /dev/null +++ b/web/META-INF/resources/css/footer.css @@ -0,0 +1,19 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 Unless + + required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" +BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ + +/* + +This file can be used to provide customized css for the customized footer provided in partials/footer.html for the MUDROD website. It is currently left empty. + +*/ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/web/META-INF/resources/css/index.css ---------------------------------------------------------------------- diff --git a/web/META-INF/resources/css/index.css b/web/META-INF/resources/css/index.css new file mode 100644 index 0000000..8512cc0 --- /dev/null +++ b/web/META-INF/resources/css/index.css @@ -0,0 +1,445 @@ +html, body { + padding: 0; + margin: 0; + height: 100%; +} + +body { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + background-color: black; +} + +h1, h2, h3, p { + margin: 0 0 .2em 0; +} + +.toolbar { + background-color: #2276ac; + height: 60px; +} + +article, aside, details, figcaption, figure, header, hgroup, main, menu, nav, section, summary { + display: block; +} + +header h1 { + margin: 0; +} + +.toolbar a:link, .toolbar a:visited { + color: #fff; +} + +header h1 > a { + margin-top: 10px; +} + +a { + color: #428bca; + text-decoration: none; + background-color: transparent; +} + +a:focus, a:hover { + text-decoration: none; +} + +b, strong { + font-weight: bold; +} + +a:link, a:visited { + color: #2980b9; +} + +.view-area-fixed { + width: 100%; + padding-top: 1em; + background-size: cover; + background-repeat: no-repeat; + background-position: 0 0; + background-image: url('../images/OceanWave.jpg'); + background-color: transparent; + background-attachment: fixed; +} + +.view-area-scroll { + width: 100%; + height: 800px; + background-size: cover; + background-repeat: no-repeat; + background-position: 0 0; + background-image: url('../images/OceanWave.jpg'); + background-color: transparent; + background-attachment: scroll; +} + +.landing-dialog { + flex: 1; + padding: 6em; + width: 80%; + margin: 15em auto 15em; + color: #fff; + border-radius: 6px; + box-shadow: 0 0 20px 0 rgba(17, 17, 17, 0.7); +} + +.landing-dialog-header, .noscript, .old-ie { + padding: 1em 1.5em; +} + +.landing-dialog-header h2, .noscript h2, .old-ie h2 { + font-weight: normal; + margin: 0 0 .2em 0; + font-size: 2.2em; + text-shadow: 1px 1px 1px #111; +} + +.searchBox { + height: 100px; + padding: .5em 0; + background: transparent; + margin-left: .5em; +} + +.panel-title { + font-size: 1.5em; +} + +.rankoption { + background-color: white; + color: black; + float: right; +} + +.autocomplete { + overflow-y: auto; + height: 15em; + color: black; +} + +.toolbar .form { + display: inline-block; +} + +.toolbar p { + margin: 0; +} + +.tt-input { + vertical-align: baseline !important; +} + +input[type="text"], input[type="search"], input[type="password"], textarea { + padding: 5px; + outline: none; + min-width: 150px; + color: #424242; +} + +.toolbar .tt-query, .toolbar .tt-hint, .toolbar .tt-input { + padding: 11px; + margin: 2px 0 0 20px; + width: 540px; + border: 1px solid #236d9e; + border-radius: 3px; + box-shadow: inset 0 1px 5px 1px rgba(0, 0, 0, 0.2); +} + +.dropdown { + display: inline-block; + position: relative; +} + +.button, input[type="button"], input[type="reset"], input[type="submit"], button { + text-decoration: none; + display: inline-block; + padding: 8px 12px; + border-radius: 3px; + outline: none; + color: #fff; +} + +.toolbar .button, .toolbar input[type="button"], .toolbar input[type="reset"], .toolbar input[type="submit"] { + border: 1px solid #2c3e50; + background: #1a5981; + color: #fff; + text-shadow: none; +} + +.btn-search, .btn-search:hover, .btn-search:focus, .btn-search:active, .btn-search.active, .open .dropdown-toggle.btn-search, .btn-search:active:focus, .btn-search:active:hover, .btn-search.active:hover, .btn-search.active:focus { + background-color: #1a5981; + border-color: #1a5981; + color: #FFFFFF; + padding: 9px 12px 9px 12px; + font-size: 1.3em; +} + +.checkbox-inline, .radio-inline { + position: relative; + display: inline-block; + padding-left: 20px; + margin-bottom: 0; + font-weight: 400; + vertical-align: middle; + cursor: pointer; +} + +.radio { + padding-left: 20px; +} + +.radio.radio-inline { + margin-top: 0; +} + +.radio input[type="radio"] { + opacity: 0; + z-index: 1; +} + +.radio label { + display: inline-block; + vertical-align: middle; + position: relative; + padding-left: 5px; +} + +.radio label::before { + content: ""; + display: inline-block; + position: absolute; + width: 17px; + height: 17px; + left: 0; + margin-left: -20px; + border: 1px solid #cccccc; + border-radius: 50%; + background-color: #fff; + -webkit-transition: border 0.15s ease-in-out; + -o-transition: border 0.15s ease-in-out; + transition: border 0.15s ease-in-out; +} + +.radio label::after { + display: inline-block; + position: absolute; + content: " "; + width: 11px; + height: 11px; + left: 3px; + top: 3px; + margin-left: -20px; + border-radius: 50%; + background-color: #5bc0de; + -webkit-transform: scale(0, 0); + -ms-transform: scale(0, 0); + -o-transform: scale(0, 0); + transform: scale(0, 0); + -webkit-transition: -webkit-transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33); + -moz-transition: -moz-transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33); + -o-transition: -o-transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33); + transition: transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33); +} + +.radio-info input[type="radio"]:checked + label::before { + border-color: #5bc0de; +} + +.radio-info input[type="radio"] + label::after { + background-color: #5bc0de; +} + +.radio input[type="radio"]:checked + label::after { + -webkit-transform: scale(1, 1); + -ms-transform: scale(1, 1); + -o-transform: scale(1, 1); + transform: scale(1, 1); +} + +.radio-info input[type="radio"]:checked + label::after { + background-color: #5bc0de; +} + +a { + cursor: pointer; +} + +.sidenav { + height: 100%; + transition: 0.5s; +} + +.sidenav a { + padding: 8px 8px 8px 5px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + text-decoration: none; + color: #2980b9; + display: block; + transition: 0.3s; +} + +.sidenav a:hover, .offcanvas a:focus { + color: #8ab9e7; +} + +.sidenav h4 a { + padding: 2px 8px 0 10px; + color: white; +} + +.sidenav .learn-more a { + font-size: 0.9em; + font-style: italic; + text-align: center; +} + +.no-gutter > [class*='col-'] { + padding-right: 5px; + padding-left: 5px; +} + +.content-holder .post-holder { + padding-top: 0; +} + +.post-holder .panel-body { + overflow-x: auto; +} + +.post-holder .post { + background-color: #FFFFFF; + border-bottom: 1px solid #c3c3c3; + padding: 14px 16px; +} + +.content-holder .heading-t3 { + height: 42px; + margin-bottom: 16px; +} + +.content-holder .heading-t3, .heading-t3 { + background: #738dca; + padding: 0 18px 0 16px; + overflow: hidden; +} + +.content-holder .heading-t3 .title { + display: inline-block; + vertical-align: top; + padding: 6px 8px; +} + +.list-related-searches { + text-align: left; + border-bottom: 2px solid #069; + padding-bottom: 10px; + margin-bottom: 6px; + list-style: none; +} + +.heading-t4 { + background: #fff; + border-top: 6px solid #738dca; + border-bottom: 6px solid #738dca; + overflow: hidden; + font-size: 1.2em; +} + +.search-form { + position: relative; + margin-right: 20px; + margin-left: 20px; +} + +.form-group { + margin-bottom: 15px; +} + +.search-form button { + position: absolute; + right: 10px; + top: 3px; + border: 0; + padding: 0; + background: none; +} + +.ico-search { + display: inline-block; + background: url(../images/sprite.png) no-repeat 0 0; + width: 17px; + height: 23px; +} + +.search-form #query { + height: 28px; + border: 2px solid #39c; + border-radius: 14px; + line-height: 20px; + padding: 1px 35px 1px 15px; + width: 100%; + background: #f3f3f3; + box-shadow: none !important; +} + +.searchOption { + color: white; +} + +li { + cursor: default; +} + +.search-ul { + position: absolute; + z-index: 1000; + min-width: 195px; + width: 20%; + list-style: none; + text-align: left; +} + +#spinner { + text-align: center; +} + +#spinner img{ + height: 10em; +} + +/* button recolor */ +.nav-pills > li.active > a, .btn-primary { + background-color: #069; + border-color: #069; + border-radius: 4px; +} + +.mudrod-navbar { + margin-bottom: 0; + padding-left: 1em; + padding-right: 1em; +} + +.mudrod-navbar #searchForm { + width: 50%; +} + +.mudrod-navbar #searchForm .form-group { + width: 100%; +} + +.mudrod-navbar #searchForm .form-group input { + width: 45%; +} + +.mudrod-navbar .nav-item { + margin: 1em 0 0 1em; +} + +.mudrod-footer { + color: white; + padding-left: 2em; +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/web/META-INF/resources/css/main-header.css ---------------------------------------------------------------------- diff --git a/web/META-INF/resources/css/main-header.css b/web/META-INF/resources/css/main-header.css new file mode 100644 index 0000000..8494e09 --- /dev/null +++ b/web/META-INF/resources/css/main-header.css @@ -0,0 +1,19 @@ +/* +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 Unless + + required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" +BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ + +/* + +This file can be used to provide customized css for the customized header provided in partials/main-header.html for the MUDROD website. It is currently left empty. + +*/ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-sdap-mudrod/blob/7b76fa16/web/META-INF/resources/fonts/glyphicons-halflings-regular.eot ---------------------------------------------------------------------- diff --git a/web/META-INF/resources/fonts/glyphicons-halflings-regular.eot b/web/META-INF/resources/fonts/glyphicons-halflings-regular.eot new file mode 100644 index 0000000..b93a495 Binary files /dev/null and b/web/META-INF/resources/fonts/glyphicons-halflings-regular.eot differ
