Massive package refactoring
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / acr / SingleUserContentRepository.java
index 09efa72740c2118f0d6251301badcf316e577407..8c87c5a938cd2613cc2b690edfd0a7c2ab695db1 100644 (file)
@@ -4,14 +4,17 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Locale;
 import java.util.Objects;
+import java.util.UUID;
 
 import javax.security.auth.Subject;
 import javax.security.auth.x500.X500Principal;
 
 import org.argeo.api.acr.ContentSession;
+import org.argeo.api.acr.ldap.LdapAttrs;
 import org.argeo.api.acr.spi.ProvidedRepository;
+import org.argeo.api.uuid.MacAddressUuidFactory;
+import org.argeo.api.uuid.UuidFactory;
 import org.argeo.cms.acr.fs.FsContentProvider;
-import org.argeo.util.naming.LdapAttrs;
 
 /**
  * A standalone {@link ProvidedRepository} with a single {@link Subject} (which
@@ -21,6 +24,10 @@ public class SingleUserContentRepository extends AbstractContentRepository {
        private final Subject subject;
        private final Locale locale;
 
+       private UUID uuid;
+
+       private UuidFactory uuidFactory = new MacAddressUuidFactory();
+
        // the single session
        private CmsContentSession contentSession;
 
@@ -34,6 +41,9 @@ public class SingleUserContentRepository extends AbstractContentRepository {
 
                this.subject = subject;
                this.locale = locale;
+
+               // TODO use an UUID factory
+               this.uuid = UUID.randomUUID();
        }
 
        @Override
@@ -45,7 +55,7 @@ public class SingleUserContentRepository extends AbstractContentRepository {
                initRootContentProvider(null);
                if (contentSession != null)
                        throw new IllegalStateException("Repository is already started, stop it first.");
-               contentSession = new CmsContentSession(this, subject, locale);
+               contentSession = new CmsContentSession(this, uuid, subject, locale, uuidFactory);
        }
 
        @Override
@@ -70,7 +80,7 @@ public class SingleUserContentRepository extends AbstractContentRepository {
 
        @Override
        protected CmsContentSession newSystemSession() {
-               return new CmsContentSession(this, subject, Locale.getDefault());
+               return new CmsContentSession(this, uuid, subject, Locale.getDefault(), uuidFactory);
        }
 
        public static void main(String... args) {