]> git.argeo.org Git - gpl/argeo-suite.git/blob - org.argeo.app.core/src/org/argeo/app/core/SuiteMaintenance.java
Disable development mode in FOP servlet
[gpl/argeo-suite.git] / org.argeo.app.core / src / org / argeo / app / core / SuiteMaintenance.java
1 package org.argeo.app.core;
2
3 import java.net.MalformedURLException;
4 import java.net.URL;
5
6 import javax.measure.Quantity;
7 import javax.measure.quantity.Area;
8
9 import org.argeo.api.acr.spi.ContentNamespace;
10 import org.argeo.api.acr.spi.ProvidedRepository;
11 import org.geotools.gml3.v3_2.GML;
12
13 import si.uom.SI;
14 import tech.units.indriya.quantity.Quantities;
15
16 /**
17 * Background service starting and stopping with the whole system, and making
18 * sure it is in a proper state.
19 */
20 public class SuiteMaintenance {
21 private ProvidedRepository contentRepository;
22
23 public void start() {
24 // make sure that the unit system is initialised
25 Quantity<Area> dummy = Quantities.getQuantity(0, SI.SQUARE_METRE);
26
27 getContentRepository().registerTypes(SuiteContentNamespace.values());
28 // for (SuiteContentTypes types : SuiteContentTypes.values()) {
29 // getContentRepository().registerTypes(types.getDefaultPrefix(), types.getNamespace(),
30 // types.getResource() != null ? types.getResource().toExternalForm() : null);
31 // }
32
33 // GML schema import fails because of xlinks issues
34 getContentRepository().registerTypes(new ContentNamespace() {
35
36 @Override
37 public URL getSchemaResource() {
38 try {
39 return new URL(GML.getInstance().getSchemaLocation());
40 } catch (MalformedURLException e) {
41 throw new IllegalArgumentException(e);
42 }
43 }
44
45 @Override
46 public String getNamespaceURI() {
47 return GML.getInstance().getNamespaceURI();
48 }
49
50 @Override
51 public String getDefaultPrefix() {
52 return "gml";
53 }
54 });
55
56 }
57
58 public void stop() {
59
60 }
61
62 protected ProvidedRepository getContentRepository() {
63 return contentRepository;
64 }
65
66 public void setContentRepository(ProvidedRepository contentRepository) {
67 this.contentRepository = contentRepository;
68 }
69
70 }