5.3. IHM Recette serveur

5.3.1. IhmRecette

L’application web IHM Recette est utilisée pour lancer le serveur.

    VitamStarter.createVitamStarterForIHM(WebApplicationConfig.class, configurationFile,
BusinessApplication.class, AdminApplication.class, Lists.newArrayList());

5.3.2. Classe BusinessApplication

La classe BusinessApplication possède les singletons qui contiennent les ressources de l’application web IHM recette(WebApplicationResource) pour:

  • Supprimer des collections vitam (WebApplicationResourceDelete)
  • Gérer les tests système(ApplicativeTestResource)
  • Définir les performances(PerformanceResource)
commonBusinessApplication = new CommonBusinessApplication();
    singletons = new HashSet<>();
    singletons.addAll(commonBusinessApplication.getResources());

    final WebApplicationResourceDelete deleteResource = new WebApplicationResourceDelete(configuration);
    final WebApplicationResource resource = new WebApplicationResource(configuration.getTenants(), configuration.getSecureMode());
    singletons.add(deleteResource);
    singletons.add(resource);

    Path sipDirectory = Paths.get(configuration.getSipDirectory());
    Path reportDirectory = Paths.get(configuration.getPerformanceReportDirectory());

    if (!Files.exists(sipDirectory)) {
        Exception sipNotFound =
            new FileNotFoundException(String.format("directory %s does not exist", sipDirectory));
        throw Throwables.propagate(sipNotFound);
    }

    if (!Files.exists(reportDirectory)) {
        Exception reportNotFound =
            new FileNotFoundException(format("directory %s does not exist", reportDirectory));
        throw Throwables.propagate(reportNotFound);
    }

    PerformanceService performanceService = new PerformanceService(sipDirectory, reportDirectory);
    singletons.add(new PerformanceResource(performanceService));

    String testSystemSipDirectory = configuration.getTestSystemSipDirectory();
    String testSystemReportDirectory = configuration.getTestSystemReportDirectory();
    ApplicativeTestService applicativeTestService =
        new ApplicativeTestService(Paths.get(testSystemReportDirectory));

    singletons.add(new ApplicativeTestResource(applicativeTestService,
        testSystemSipDirectory));

5.3.3. Configuration

Le fichier de configuration se nomme ihm-recette.conf:

5.3.3.1. Fichier ihm-recette.conf

serverHost: {{ ip_service }}
port: {{ vitam_struct.port_service }}

baseUrl: "/{{ vitam_struct.baseuri }}"
baseUri: "/{{ vitam_struct.baseuri }}"
staticContent: "{{ vitam_struct.static_content }}"

jettyConfig: jetty-config.xml
authentication: true
enableXsrFilter: true
enableSession: true

secureMode:
{% for securemode in vitam_struct.secure_mode %}
- {{ securemode }}
{% endfor %}
sipDirectory: {{ vitam_folder_data }}/test-data
performanceReportDirectory: {{ vitam_folder_data }}/report/performance

testSystemSipDirectory: {{ vitam_folder_data }}/test-data/system
testSystemReportDirectory: {{ vitam_folder_data }}/report/system
ingestMaxThread: {{ ansible_processor_cores * ansible_processor_threads_per_core + 1 }}

#
workspaceUrl: {{vitam.workspace | client_url}}

# Configuration MongoDB
mongoDbNodes:
{% for server in groups['hosts_mongos_data'] %}
- dbHost: {{ hostvars[server]['ip_service'] }}
  dbPort: {{ mongodb.mongos_port }}
{% endfor %}
# Actually need this field for compatibility
dbName: admin
# @integ: parametrize it !
masterdataDbName: masterdata
logbookDbName: logbook
metadataDbName: metadata
dbAuthentication: {{ mongodb.mongo_authentication }}
dbUserName: {{ mongodb['mongo-data']['admin']['user'] }}
dbPassword: {{ mongodb['mongo-data']['admin']['password'] }}

# ElasticSearch
clusterName: {{ vitam_struct.cluster_name }}
elasticsearchNodes:
{% for server in groups['hosts_elasticsearch_data'] %}
- hostName: {{ hostvars[server]['ip_service'] }}
  httpPort: {{ elasticsearch.data.port_http }}
{% endfor %}

# ElasticSearch External Metadata Mapping
elasticsearchExternalMetadataMappings:
- collection: Unit
  mappingFile: {{ vitam.ihm_recette.elasticsearch_mapping_dir }}/unit-es-mapping.json
- collection: ObjectGroup
  mappingFile: {{ vitam.ihm_recette.elasticsearch_mapping_dir }}/og-es-mapping.json

# Functional Admin Configuration
functionalAdminAdmin:
   functionalAdminServerHost: {{ vitam.functional_administration.host }}
   functionalAdminServerPort: {{ vitam.functional_administration.port_admin }}
   adminBasicAuth:
      userName: {{ admin_basic_auth_user }}
      password: {{ admin_basic_auth_password }}

# ES index configuration
functionalAdminIndexationSettings:
  default_config:
    number_of_shards: {{ vitam_elasticsearch_tenant_indexation.default_config.masterdata.number_of_shards }}
    number_of_replicas: {{ vitam_elasticsearch_tenant_indexation.default_config.masterdata.number_of_replicas }}

{% for collection in ["accesscontract", "accessionregisterdetail", "accessionregistersummary", "accessionregistersymbolic", "agencies", "archiveunitprofile", "context", "fileformat", "filerules", "griffin", "ingestcontract", "managementcontract", "ontology", "preservationscenario", "profile", "securityprofile"] %}
{% if vitam_elasticsearch_tenant_indexation.masterdata[collection] is defined %}
  {{collection}}:
{% if vitam_elasticsearch_tenant_indexation.masterdata[collection].number_of_shards is defined %}
    number_of_shards: {{ vitam_elasticsearch_tenant_indexation.masterdata[collection].number_of_shards }}
{% endif %}
{% if vitam_elasticsearch_tenant_indexation.masterdata[collection].number_of_replicas is defined %}
    number_of_replicas: {{ vitam_elasticsearch_tenant_indexation.masterdata[collection].number_of_replicas }}
{% endif %}
{% endif %}
{% endfor %}

metadataIndexationSettings:

  default_config:
    unit:
      number_of_shards: {{ vitam_elasticsearch_tenant_indexation.default_config.unit.number_of_shards }}
      number_of_replicas: {{ vitam_elasticsearch_tenant_indexation.default_config.unit.number_of_replicas }}
    objectgroup:
      number_of_shards: {{ vitam_elasticsearch_tenant_indexation.default_config.objectgroup.number_of_shards }}
      number_of_replicas: {{ vitam_elasticsearch_tenant_indexation.default_config.objectgroup.number_of_replicas }}

{% if vitam_elasticsearch_tenant_indexation.dedicated_tenants is defined and vitam_elasticsearch_tenant_indexation.dedicated_tenants is not none %}
  dedicated_tenants:
{% for entry in vitam_elasticsearch_tenant_indexation.dedicated_tenants %}
{% if (entry.unit is defined and (entry.unit.number_of_shards is defined or entry.unit.number_of_replicas is defined)) or
      (entry.objectgroup is defined and (entry.objectgroup.number_of_shards is defined or entry.objectgroup.number_of_replicas is defined)) %}
  - tenants: '{{ entry.tenants }}'
{% if entry.unit is defined %}
    unit:
{% if entry.unit.number_of_shards is defined %}
      number_of_shards: {{ entry.unit.number_of_shards }}
{% endif %}
{% if entry.unit.number_of_replicas is defined %}
      number_of_replicas: {{ entry.unit.number_of_replicas }}
{% endif %}
{% endif %}
{% if entry.objectgroup is defined %}
    objectgroup:
{% if entry.objectgroup.number_of_shards is defined %}
      number_of_shards: {{ entry.objectgroup.number_of_shards }}
{% endif %}
{% if entry.objectgroup.number_of_replicas is defined %}
      number_of_replicas: {{ entry.objectgroup.number_of_replicas }}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}

{% if vitam_elasticsearch_tenant_indexation.grouped_tenants is defined and vitam_elasticsearch_tenant_indexation.grouped_tenants is not none %}
  grouped_tenants:
{% for entry in vitam_elasticsearch_tenant_indexation.grouped_tenants %}
{% if (entry.unit is defined and (entry.unit.number_of_shards is defined or entry.unit.number_of_replicas is defined)) or
      (entry.objectgroup is defined and (entry.objectgroup.number_of_shards is defined or entry.objectgroup.number_of_replicas is defined)) %}
  - name: '{{ entry.name }}'
    tenants: '{{ entry.tenants }}'
{% if entry.unit is defined %}
    unit:
{% if entry.unit.number_of_shards is defined %}
      number_of_shards: {{ entry.unit.number_of_shards }}
{% endif %}
{% if entry.unit.number_of_replicas is defined %}
      number_of_replicas: {{ entry.unit.number_of_replicas }}
{% endif %}
{% endif %}
{% if entry.objectgroup is defined %}
    objectgroup:
{% if entry.objectgroup.number_of_shards is defined %}
      number_of_shards: {{ entry.objectgroup.number_of_shards }}
{% endif %}
{% if entry.objectgroup.number_of_replicas is defined %}
      number_of_replicas: {{ entry.objectgroup.number_of_replicas }}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}

logbookIndexationSettings:
  default_config:
    logbookoperation:
      number_of_shards: {{ vitam_elasticsearch_tenant_indexation.default_config.logbookoperation.number_of_shards }}
      number_of_replicas: {{ vitam_elasticsearch_tenant_indexation.default_config.logbookoperation.number_of_replicas }}

{% if vitam_elasticsearch_tenant_indexation.dedicated_tenants is defined and vitam_elasticsearch_tenant_indexation.dedicated_tenants is not none %}
  dedicated_tenants:
{% for entry in vitam_elasticsearch_tenant_indexation.dedicated_tenants %}
{% if (entry.logbookoperation is defined and (entry.logbookoperation.number_of_shards is defined or entry.logbookoperation.number_of_replicas is defined)) %}
  - tenants: '{{ entry.tenants }}'
    logbookoperation:
{% if entry.logbookoperation.number_of_shards is defined %}
      number_of_shards: {{ entry.logbookoperation.number_of_shards }}
{% endif %}
{% if entry.logbookoperation.number_of_replicas is defined %}
      number_of_replicas: {{ entry.logbookoperation.number_of_replicas }}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}

{% if vitam_elasticsearch_tenant_indexation.grouped_tenants is defined and vitam_elasticsearch_tenant_indexation.grouped_tenants is not none %}
  grouped_tenants:
{% for entry in vitam_elasticsearch_tenant_indexation.grouped_tenants %}
{% if (entry.logbookoperation is defined and (entry.logbookoperation.number_of_shards is defined or entry.logbookoperation.number_of_replicas is defined)) %}
  - name: '{{ entry.name }}'
    tenants: '{{ entry.tenants }}'
    logbookoperation:
{% if entry.logbookoperation.number_of_shards is defined %}
      number_of_shards: {{ entry.logbookoperation.number_of_shards }}
{% endif %}
{% if entry.logbookoperation.number_of_replicas is defined %}
      number_of_replicas: {{ entry.logbookoperation.number_of_replicas }}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
  • port, serverHost, jettyConfig, tenants, secureMode
  • baseUrl, staticContent, baseUri (qui configure jetty)
  • authentication (ajoute le filtre shiro si le booléen est à « true »)
  • dbName, masterdataDbName, logbookDbName, metadataDbName, mongoDbNodes, clusterName, elasticsearchNodes
  • testSystemSipDirectory, testSystemReportDirectory
  • sipDirectory, performanceReportDirectory
  • elasticsearchExternalMetadataMappings (liste des collections respectivement Unit et ObjectGroup et les fichiers de mappings associés d’elasticsearch)