-
Notifications
You must be signed in to change notification settings - Fork 5
File based instance configuration
The server includes an API to manage Hawk instances, but sometimes you may prefer to set up those instances using plain old files. The server will be ready to receive user queries upon startup without any interaction from user or clients. Upon startup, the Hawk server reads and parses configuration files, and then it creates instances according to the configuration files.
NOTE: currently these configuration files are not updated on shutdown. If an instance configuration changes, this configuration is persisted through the Eclipse configuration area. The configuration files will not overwrite any of the changed settings either, except for the polling intervals (minimum and maximum).
Configuration files are XML files that define the name of the instance and its configuration. The XML Schema can be found at HawkServerConfigurationSchema.xsd. A sample configuration file can be found at Sample Configuration File.
The XML should include the following elements:
Element Name | Parent Element Name | multiplicity | Value | Description |
---|---|---|---|---|
‘hawk’ | xml | 1 | None | Root element |
‘delay’ | ‘hawk’ | 1 | None | Polling configuration |
‘plugins’ | ‘hawk’ | 0-1 | None | List of plugins (to be/that are) enabled |
‘plugin’ | ‘plugins’ | 0-* | None | Plugin name |
‘metamodels’ | ‘hawk’ | 0-1 | None | List of metamodels (to be/that are) registered |
‘metamodel’ | ‘metamodels’ | 0-* | None | Metamodel parameters |
‘repositories’ | ‘hawk’ | 0-1 | None | List of repositories (to be/that are) added |
‘repository’ | ‘repositories’ | 0-* | None | Repository parameters |
‘derivedAttributes’ | ‘hawk’ | 0-1 | None | List of derived attributes (to be/that are) added |
‘derivedAttribute’ | ‘derivedAttributes’ | 0-* | None | Derived attribute parameters |
‘derivation’ | ‘derivedAttribute’ | 0-1 | None | Derivation parameters |
‘logic’ | ‘derivation’ | 0-1 | CDATA section | An executable expression of the derivation logic in the language specified. |
‘indexedAttributes’ | ‘hawk’ | 0-1 | None | List of indexed attributes (to be/that are) added |
‘indexedAttribute’ | ‘indexedAttributes’ | 0-* | None | Indexed attribute parameters |
Element Name | Attribute name | Optional/Required | Type | Description |
---|---|---|---|---|
‘hawk’ | ‘name’ | Required | String | The unique name of the new Hawk instance |
‘backend’ | Required | String | The name of the backend to be used (e.g.org.hawk.orientdb.OrientDatabase, org.hawk.orientdb.RemoteOrientDatabase) |
Element Name | Attribute name | Optional/Required | Type | Description |
---|---|---|---|---|
‘delay’ | ‘min’ | Required | String | Minimum delay between periodic synchronization in milliseconds |
‘max’ | Required | String | Maximum delay between periodic synchronization in milliseconds (0 to disable periodic synchronization) |
Element Name | Attribute name | Optional/Required | Type | Description |
---|---|---|---|---|
‘plugin’ | ‘name’ | Required | String | e.g. (org.hawk.modelio.exml.listeners.ModelioGraphChangeListener, org.hawk.modelio.exml.metamodel.ModelioMetaModelResourceFactory, org.hawk.modelio.exml.model.ModelioModelResourceFactory) |
Element Name | Attribute name | Optional/Required | Type | Description |
---|---|---|---|---|
‘metamodel’ | ‘location’ | Optional | String | Location of metamodel file to be registered |
Element Name | Attribute name | Optional/Required | Type | Description |
---|---|---|---|---|
‘repository’ | ‘location’ | Required | String | Location of the repository |
‘type’ | Optional | String | The type of repository available repository types () | |
‘user’ | Optional | String | Username for logging into the VCS | |
‘pass’ | Optional | String | Password for logging into the VCS | |
‘frozen’ | Optional | String | If the repository is frozen (true/false) |
Element Name | Attribute name | Optional/Required | Type | Description |
---|---|---|---|---|
‘derivedAttribute’ | ‘attributeName’ | Required | String | The name of the derived attribute |
‘typeName’ | Required | String | The name of the type to which the derived attribute belongs | |
‘metamodelUri’ | Required | String | The URI of the metamodel to which the de- rived attribute belongs | |
‘attributeType’ | Optional | String | The (primitive) type of the derived attribute | |
‘isOrdered’ | Optional | String | A flag specifying whether the order of the values of the derived attribute is significant (only makes sense when isMany=true) | |
‘isUnique’ | Optional | String | A flag specifying whether the the values of the derived attribute are unique (only makes sense when isMany=true) | |
‘isMany’ | Optional | String | The multiplicity of the derived attribute |
Element Name | Attribute name | Optional/Required | Type | Description |
---|---|---|---|---|
‘derivation’ | ‘language’ | Required | String | The language used to express the derivation logic. Available labguages in Hawk: org.hawk.epsilon.emc.EOLQueryEngine, org.hawk.orientdb.query.OrientSQLQueryEngine, org.hawk.epsilon.emc.EPLQueryEngine |
Element Name | Attribute name | Optional/Required | Type | Description |
---|---|---|---|---|
‘indexedAttribute’ | ‘attributeName’ | Required | String | The name of the indexed attribute. |
‘typeName’ | Required | String | The name of the type to which the indexed attribute | |
‘metamodelUri’ | Required | String | The URI of the metamodel to which the indexed attribute belongs. |
Configuration files are expected to be located in the ‘configuration’ folder in the server’s home directory. Each Hawk instance should have its own configuration file. There are no rules on how the file should be named. It is a good practice to include hawk instance name in the file name for easy recognition.
You can follow this video tutorial, or alternatively follow these steps:
- Download the hawk-server-*.zip file for your operating system and architecture of choice from Hawk Server With Configuration)
- Create a configuration file for each instance required to run in the Hawk server.
- Edit configuration files:
- Set instance name, backend, delay
- Add list of plugins to be enabled
- Add metamodel file to location to be registered
- Add repositories that are to be indexed
- Add any required derived attributes
- Add any required indexed attributes
- Save the configuration files to the ‘configuration’ folder in the server’s home directory (see figure 1)
- Perform any other configuration that are required by Hawk Server and start the server (by following instructions at Deploying-and-running-the-server)
- Check if the hawk instances are added and running by typing ‘hawkListInstances’ in the server’s command terminal:
-
Deleting configuration files from the directory will not delete instances from the server. However, the server will not start those instances.
-
To test Hawk server with the MEASURE platform, refer to Using HawkQueryMeasure to query Hawk instance running in Hawk Server