1 package org
.argeo
.app
.core
;
3 import java
.io
.IOException
;
4 import java
.net
.MalformedURLException
;
8 import javax
.jcr
.RepositoryException
;
9 import javax
.jcr
.Session
;
10 import javax
.jcr
.nodetype
.NodeType
;
11 import javax
.jcr
.security
.Privilege
;
12 import javax
.measure
.Quantity
;
13 import javax
.measure
.quantity
.Area
;
15 import org
.argeo
.api
.acr
.spi
.ContentNamespace
;
16 import org
.argeo
.api
.cms
.CmsConstants
;
17 import org
.argeo
.app
.api
.EntityType
;
18 import org
.argeo
.jcr
.JcrUtils
;
19 import org
.argeo
.maintenance
.AbstractMaintenanceService
;
20 import org
.geotools
.gml3
.v3_2
.GML
;
23 import tech
.units
.indriya
.quantity
.Quantities
;
25 /** Initialises an Argeo Suite backend. */
26 public class SuiteMaintenanceService
extends AbstractMaintenanceService
{
29 // make sure that the unit system is initialised
30 Quantity
<Area
> dummy
= Quantities
.getQuantity(0, SI
.SQUARE_METRE
);
34 getContentRepository().registerTypes(SuiteContentNamespace
.values());
35 // for (SuiteContentTypes types : SuiteContentTypes.values()) {
36 // getContentRepository().registerTypes(types.getDefaultPrefix(), types.getNamespace(),
37 // types.getResource() != null ? types.getResource().toExternalForm() : null);
40 // GML schema import fails because of xlinks issues
41 getContentRepository().registerTypes(new ContentNamespace() {
44 public URL
getSchemaResource() {
46 return new URL(GML
.getInstance().getSchemaLocation());
47 } catch (MalformedURLException e
) {
48 throw new IllegalArgumentException(e
);
53 public String
getNamespaceURI() {
54 return GML
.getInstance().getNamespaceURI();
58 public String
getDefaultPrefix() {
65 public boolean prepareJcrTree(Session adminSession
) throws RepositoryException
, IOException
{
66 boolean modified
= false;
67 Node rootNode
= adminSession
.getRootNode();
68 if (!rootNode
.hasNode(EntityType
.user
.name())) {
69 rootNode
.addNode(EntityType
.user
.name(), NodeType
.NT_UNSTRUCTURED
);
78 public void configurePrivileges(Session adminSession
) throws RepositoryException
{
79 JcrUtils
.addPrivilege(adminSession
, EntityType
.user
.basePath(), CmsConstants
.ROLE_USER_ADMIN
,
81 // JcrUtils.addPrivilege(adminSession, "/", SuiteRole.coworker.dn(),
82 // Privilege.JCR_READ);