Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation #52

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
13 changes: 7 additions & 6 deletions 3 Setup instructions/00040-SetupDevelopmentEnvironment.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
## Setup Oskari development environment

This document describes how to setup development environment for Oskari using source code. If you want to develop / maintain oskari yourself this is the correct section.
For setting up an instance using the ready jetty bundle check out [Setup Jetty](00030-SetupJetty.md)
This section describes how to setup development environment for Oskari using source code. If you want to develop or maintain Oskari yourself this is the correct section.
rekjuh marked this conversation as resolved.
Show resolved Hide resolved

For setting up an instance using the ready jetty bundle see [Setup Jetty](00030-SetupJetty.md)

### Requirements

The following items are assumed installed.

* JDK 8
* [Maven 3+](http://maven.apache.org/) (developed using 3.5.0)
* Git client (http://git-scm.com/) - Optionally download zip file from https://github.com/oskariorg/oskari-server
* [Git client](http://git-scm.com/) (git is mandatory for contributing any changes to Oskari) - Optionally download zip file from https://github.com/oskariorg/oskari-server
* `{jetty.base}` refers to the oskari-server folder in an unzipped [Jetty bundle](/download)

### Setup Git configuration
Expand All @@ -26,14 +27,14 @@ With commandline git:

git clone https://github.com/oskariorg/oskari-server.git

Note! You can also download the codes in zip format from Github, but for contributing any changes to Oskari git is mandatory.
Additional Maven modules can be contributed outside git though if they are compatible with the current develop/master branch, but this is not adviced.
Note! You can also download the codes in zip format from Github, but for contributing any changes to Oskari git is mandatory.
Additional Maven modules can be contributed outside git though if they are compatible with the current develop/master branch, but this is not advised.

Note! The frontend source code is already available under `{jetty.base}/oskari-frontend` in the [Jetty bundle](/download). To update it you can replace it with code found in https://github.com/oskariorg/oskari-frontend.

### Build Oskari server

This will build all modules that Oskari server is composed of.
This will build all modules that Oskari server is composed of:

cd oskari-server
mvn clean install
Expand Down
14 changes: 7 additions & 7 deletions 7 Operating instructions/00080-HowToUseABundle.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
### How to use a bundle

A bundle is a component in an Oskari application. A bundle is a selection of [Oskari classes](00100-HowToUseClasses.md) which form a component that offers additional functionality for an application. A bundle can offer multiple implementations for a functionality which can then be divided into smaller packages for different application setups. Packages can be used to offer a multiple views for the same functionality for example search functionality as a small on-map textfield or a window-like UI (see Tile/Flyout) for the same functionality. For a short introduction see [create your own bundle](/guides/quick-start/create-your-own-bundle).
A bundle is a component in an Oskari application. A bundle is a selection of [Oskari classes](00100-HowToUseClasses.md) which form a component that offers additional functionality for an application. A bundle can offer multiple implementations for a functionality which can then be divided into smaller packages for different application setups. Packages can be used to offer a multiple views for the same functionality - for example search functionality as a small on-map textfield or a window-like UI (see Tile/Flyout) for the same functionality. For a short introduction see [create your own bundle](../8%20Developing%20instructions/00120-HowToCreateABundle.md).
rekjuh marked this conversation as resolved.
Show resolved Hide resolved

#### Directory structure

See [here](../2 Application environment/00020-Frontend.md) for info about structure and conventions.
See [here](../2%20Application%20environment/00040-DirectoryStructure.md)) for info about directory structure and conventions.
Copy link
Member

@ZakarFin ZakarFin Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now use folder and directory as terms. Maybe we should pick one and stick to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wikipedia is not a reliable source per se, but I've understood the difference between the terms as mentioned there:
"If one is referring to a container of documents, the term folder is more appropriate. The term directory refers to the way a structured list of document files and folders is stored on the computer. "

Thus I'd say that in this very context directory is a appropriate term, whereas in other contexts folder is more suitable.


#### Implementation

Bundles implementation files should be located under the `/bundles` folder. If the bundle has a BundleInstance (ie. something that is started/instantiated when the bundle is played) it is usually defined in a file called `instance.js`, but this is not enforced and any file referenced in bundle definition (`bundle.js`) can be used. The bundle doesn't need to have an instance and can be just used to import dependency files that can be instantiated elsewhere. Usually you want to implement a BundleInstance since you can think of it as a starting point for your functionality which is triggered by just adding your bundle in an applications startup sequence.
Bundle's implementation files should be located under the `/bundles` folder. If the bundle has a BundleInstance (ie. something that is started/instantiated when the bundle is played) it is usually defined in a file called `instance.js`, but this is not enforced and any file referenced in bundle definition (`bundle.js`) can be used.
rekjuh marked this conversation as resolved.
Show resolved Hide resolved

A Bundle instance is an Oskari class which implements `Oskari.bundle.BundleInstance` protocol. A Bundle instance is created as a result from a Bundle definitions (see above) create method. Bundle instance state and lifecycle is managed by Bundle Manager.
A Bundle instance is an Oskari class which implements `Oskari.bundle.BundleInstance` protocol. Usually you want to implement a BundleInstance since you can think of it as a starting point for your functionality which is triggered by just adding your bundle in an applications startup sequence. A Bundle instance is created as a result from a Bundle definitions (see above) create method. Bundle instance state and lifecycle is managed by Bundle Manager. However, the bundle doesn't need to have an instance and can be just used to import dependency files that can be instantiated elsewhere.

Bundle lifecycle methods
**Bundle lifecycle methods:**

* `start` - called by application to start any functionality that this bundle instance might have
* `update` - called by Bundle Manager when Bundle Manager state is changed (to inform any changes in current 'bundlage')
Expand All @@ -27,9 +27,9 @@ instance.mediator = {

#### Definition

The bundle definition (or package) should be located in `bundle.js` file under the `/packages` folder. The bundle package definition should not implement any actual functionality. It should only declare the JavaScript, CSS and localization resources (== files) and metadata if any. If the bundle package can be instantiated the package's `create` method should create the bundle's instance. The bundle doesn't need to have an instance and can be used to import dependency files that can be instantiated elsewhere. In that case the create method should return the bundle class itself (`return this;`).
The bundle definition (or package) should be located in `bundle.js` file under the `/packages` folder. The bundle package definition should not implement any actual functionality. It should only declare the JavaScript, CSS and localization resources (= files) and metadata (if any). If the bundle package can be instantiated the package's `create` method should create the bundle's instance.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The bundle definition (or package) should be located in bundle.js file under the /packages folder". This is not always true anymore and this might change in a very near future. However, for now I think this might be accurate enough.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, any CSS and most of Javascript can be imported now on for example the instance.js. The bundle.js file is currently mostly used for picking what the files that need to be imported when a bundle with certain id is being used in the app AND the way to include and split localization files when the application is built.

Copy link
Contributor Author

@rekjuh rekjuh Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this part for now combining these two different perspectives. When the very near future arrives and this needs revising, will do further fixes.


[Sample bundle definition](/guides/quick-start/sample-bundle-definition)
If the bundle doesn't have an instance and is used to import dependency files that are instantiated elsewhere, the create method should return the bundle class itself (`return this;`). A sample bundle definition can be found as a file named `bundle.js` under `/packages/<mynamespace>/<bundle-identifier>/`.

Bundle should install itself to Oskari framework by calling `installBundleClass` at the end of `bundle.js`

Expand Down
4 changes: 2 additions & 2 deletions 8 Developing instructions/00120-HowToCreateABundle.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## How to create a bundle

If you haven't done it already, download sources [here](). Then extract the files from the downloaded archive.
If you haven't done it already, download sources [here](https://oskari.org/download/). Then extract the files from the downloaded archive.
rekjuh marked this conversation as resolved.
Show resolved Hide resolved

Now decide a `<bundle-identifier>` which is unique and describes the functionality the bundle offers e.g. 'search' (already implemented so prefix it with something like mysearch).
Now decide a `<bundle-identifier>` which is unique and describes the functionality the bundle offers e.g. `search` (already implemented so prefix it with something like mysearch).

Create a folder with the name of your `<bundle-identifier>` under `/packages/framework/` and `/bundles/framework/`. If you require styling/images, create a folder under `/bundles/framework/<bundle-identifier>/resources/css`, too. The `/framework/` directory isn't enforced and you can replace it with something fitting your bundle compilation. The `framework` directory refers to the namespace of the same name and it includes (almost) all code written by the Oskari core team. It is encouraged to create your own namespace (and directories) for your own bundles.
rekjuh marked this conversation as resolved.
Show resolved Hide resolved

Expand Down