Skip to content

Commit

Permalink
refactor: first steps towards more independent packages (DSP-513) (#1678
Browse files Browse the repository at this point in the history
)
  • Loading branch information
subotic committed Jul 27, 2020
1 parent 73a8081 commit 830de4f
Show file tree
Hide file tree
Showing 574 changed files with 4,029 additions and 2,934 deletions.
4 changes: 2 additions & 2 deletions docker/knora-api/BUILD.bazel
Expand Up @@ -6,10 +6,10 @@ load("@io_bazel_rules_docker//container:container.bzl", "container_image", "cont
container_image(
name = "image",
base = "@openjdk11//image",
cmd = ["java", "-jar", "webapi_deploy.jar"],
cmd = ["java", "-jar", "app_cli_deploy.jar"],
# entrypoint = ["java", "-jar", "webapi_deploy.jar"],
files = [
"//webapi:webapi_deploy.jar"
"//webapi/src/main/scala/org/knora/webapi/app:app_cli_deploy.jar",
],
labels = {
"MAINTAINER": "400790+subotic@users.noreply.github.com",
Expand Down
8 changes: 4 additions & 4 deletions docs/05-internals/design/api-v2/gravsearch.md
Expand Up @@ -21,7 +21,7 @@ License along with Knora. If not, see <http://www.gnu.org/licenses/>.

## Gravsearch Package

The classes that process Gravsearch queries and results can be found in `org.knora.webapi.responders.v2.search.gravsearch`.
The classes that process Gravsearch queries and results can be found in `org.knora.webapi.messages.util.search.gravsearch`.

## Type Inspection

Expand All @@ -30,7 +30,7 @@ types of the entities that are used in the input query. As explained in
[Type Inference](../../../03-apis/api-v2/query-language.md#type-inference), these types can be inferred,
or they can be specified in the query using type annotations.

Type inspection is implemented in the package `org.knora.webapi.responders.v2.search.gravsearch.types`.
Type inspection is implemented in the package `org.knora.webapi.messages.util.search.gravsearch.types`.
The entry point to this package is `GravsearchTypeInspectionRunner`, which is instantiated by `SearchResponderV2`.
The result of type inspection is a `GravsearchTypeInspectionResult`, in which each typeable entity in the input query is
associated with a `GravsearchEntityTypeInfo`, which can be either:
Expand Down Expand Up @@ -126,7 +126,7 @@ Sort criteria can be submitted by the user, but the result is always determinist
This is necessary to support paging.
A prequery is a SPARQL SELECT query.

The classes involved in generating prequeries can be found in `org.knora.webapi.responders.v2.search.gravsearch.prequery`.
The classes involved in generating prequeries can be found in `org.knora.webapi.messages.util.search.gravsearch.prequery`.

If the client submits a count query, the prequery returns the overall number of hits, but not the results themselves.

Expand Down Expand Up @@ -226,7 +226,7 @@ the main query can specifically ask for more detailed information on these resou
#### Generating the Main Query

The classes involved in generating the main query can be found in
`org.knora.webapi.responders.v2.search.gravsearch.mainquery`.
`org.knora.webapi.messages.util.search.gravsearch.mainquery`.

The main query is a SPARQL CONSTRUCT query. Its generation is handled by the
method `GravsearchMainQueryGenerator.createMainQuery`.
Expand Down
4 changes: 2 additions & 2 deletions docs/05-internals/design/api-v2/overview.md
Expand Up @@ -123,8 +123,8 @@ schemas. It validates each IRI it parses. To use it, import the
following:

```scala
import org.knora.webapi.util.{SmartIri, StringFormatter}
import org.knora.webapi.util.IriConversions._
import org.knora.webapi.messages.{SmartIri, StringFormatter}
import org.knora.webapi.messages.IriConversions._
```

Ensure that an implicit instance of `StringFormatter` is in scope:
Expand Down
5 changes: 3 additions & 2 deletions docs/05-internals/design/api-v2/smart-iris.md
Expand Up @@ -27,13 +27,14 @@ between internal and external schemas. It validates each IRI it parses. To use i
import the following:

```scala
import org.knora.webapi.util.{SmartIri, StringFormatter}
import org.knora.webapi.util.IriConversions._
import org.knora.webapi.messages.SmartIri
import org.knora.webapi.messages.IriConversions._
```

Ensure that an implicit instance of `StringFormatter` is in scope:

```scala
import org.knora.webapi.messages.StringFormatter
implicit val stringFormatter: StringFormatter = StringFormatter.getGeneralInstance
```

Expand Down
2 changes: 1 addition & 1 deletion docs/05-internals/design/principles/design-overview.md
Expand Up @@ -102,7 +102,7 @@ API v2, but API v2 does not depend on API v1.
- `org.knora.webapi.util`: Utilities needed by different parts of the application,
such as parsing and formatting tools.
- `org.knora.webapi.messages`: The Akka messages used by each responder.
- `org.knora.webapi.twirl`: Text-generation templates for use with
- `org.knora.webapi.messages.twirl`: Text-generation templates for use with
[the Twirl template engine](https://github.com/playframework/twirl). Knora
uses Twirl to generate SPARQL requests and other types of text documents.

Expand Down
1 change: 0 additions & 1 deletion docs/05-internals/development/index.md
Expand Up @@ -20,7 +20,6 @@ License along with Knora. If not, see <http://www.gnu.org/licenses/>.
# Development

- [Overview](overview.md)
- [Starting Fuseki 2](fuseki.md)
- [Starting GraphDB](graphdb.md)
- [Build and Running](building-and-running.md)
- [Build Process](build-process.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/05-internals/development/intellij-config.md
Expand Up @@ -87,7 +87,7 @@ triangle on an orange circle, with the tooltip "Run with VisualVM":

![screenshot 'Run with VisualVM button'](figures/launch-visualvm.png)

You can use this button to run the class `org.knora.webapi.Main` and
You can use this button to run the class `org.knora.webapi.app.Main` and
profile it in VisualVM. The first time you do this, IntelliJ will ask
you for the path to the VisualVM executable. On macOS this is
`/Applications/VisualVM.app/Contents/MacOS/visualvm`.
Expand Down
3 changes: 1 addition & 2 deletions docs/05-internals/development/overview.md
Expand Up @@ -52,8 +52,7 @@ removed in the future.

Built-in support and configuration for other triplestores is planned.

See the chapters on [Starting GraphDB](graphdb.md) and
[Starting Fuseki](fuseki.md) for more details.
See the chapter on [Starting GraphDB](graphdb.md) for more details.

## Sipi

Expand Down
2 changes: 1 addition & 1 deletion salsah1/src/test/scala/org/knora/salsah/BUILD.bazel
@@ -1,6 +1,6 @@
package(default_visibility = ["//visibility:public"])
load("@io_bazel_rules_webtesting//web:scala.bzl", "scala_web_test_suite")
load("//third_party:dependencies.bzl", "BASE_TEST_DEPENDENCIES", "BASE_TEST_DEPENDENCIES_WITH_JSON", "BASE_TEST_DEPENDENCIES_WITH_JSON_LD")
load("//third_party:dependencies.bzl", "ALL_WEBAPI_MAIN_DEPENDENCIES", "BASE_TEST_DEPENDENCIES", "BASE_TEST_DEPENDENCIES_WITH_JSON", "BASE_TEST_DEPENDENCIES_WITH_JSON_LD")

filegroup(
name = "test_srcs",
Expand Down
19 changes: 19 additions & 0 deletions third_party/dependencies.bzl
Expand Up @@ -142,6 +142,25 @@ def dependencies():
],
)

ALL_WEBAPI_MAIN_DEPENDENCIES = [
"//tools/buildstamp:version_info_jar",
"//webapi/src/main/scala/org/knora/webapi",
"//webapi/src/main/scala/org/knora/webapi/app",
"//webapi/src/main/scala/org/knora/webapi/core",
"//webapi/src/main/scala/org/knora/webapi/exceptions",
"//webapi/src/main/scala/org/knora/webapi/http/handler",
"//webapi/src/main/scala/org/knora/webapi/http/version",
"//webapi/src/main/scala/org/knora/webapi/instrumentation",
"//webapi/src/main/scala/org/knora/webapi/messages",
"//webapi/src/main/scala/org/knora/webapi/responders",
"//webapi/src/main/scala/org/knora/webapi/routing",
"//webapi/src/main/scala/org/knora/webapi/settings",
"//webapi/src/main/scala/org/knora/webapi/sharedtestdata",
"//webapi/src/main/scala/org/knora/webapi/store",
"//webapi/src/main/scala/org/knora/webapi/util",
"//webapi/src/main/scala/org/knora/webapi/util/cache",
]

BASE_TEST_DEPENDENCIES = [
"@maven//:com_typesafe_scala_logging_scala_logging_2_12",
"@maven//:org_slf4j_slf4j_api",
Expand Down
12 changes: 6 additions & 6 deletions tools/buildstamp/BUILD.bazel
Expand Up @@ -17,9 +17,9 @@ filegroup(
)

# Generates a scala source file that includes version information
load("//tools/buildstamp:gen_build_info.bzl", "gen_build_info")
gen_build_info(
name = "build_info_src",
load("//tools/buildstamp:gen_version_info.bzl", "gen_version_info")
gen_version_info(
name = "version_info_src",
scala_version = SCALA_VERSION,
akka_version = AKKA_VERSION,
akka_http_version = AKKA_HTTP_VERSION,
Expand All @@ -28,6 +28,6 @@ gen_build_info(
)

scala_library(
name = "build_info_jar",
srcs = [":build_info_src"],
)
name = "version_info_jar",
srcs = [":version_info_src"],
)
Expand Up @@ -17,12 +17,12 @@
* License along with Knora. If not, see <http://www.gnu.org/licenses/>.
*/

package org.knora.webapi
package org.knora.webapi.http.version

import scala.Predef._

/** This object was generated by //tools/buildstamp:version.bzl. */
case object BuildInfo {
case object VersionInfo {

val name: String = "webapi"

Expand Down
Expand Up @@ -4,9 +4,9 @@ content during the analysis phase.
"""

# Label of the template file to use.
_TEMPLATE = "//tools/buildstamp:BuildInfoTemplate.scala"
_TEMPLATE = "//tools/buildstamp:VersionInfoTemplate.scala"

def _gen_build_info_impl(ctx):
def _gen_version_info_impl(ctx):
ctx.actions.expand_template(
template = ctx.file._template,
output = ctx.outputs.source_file,
Expand All @@ -19,8 +19,8 @@ def _gen_build_info_impl(ctx):
},
)

gen_build_info = rule(
implementation = _gen_build_info_impl,
gen_version_info = rule(
implementation = _gen_version_info_impl,
attrs = {
"scala_version": attr.string(mandatory = True),
"akka_version": attr.string(mandatory = True),
Expand Down

0 comments on commit 830de4f

Please sign in to comment.