]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.cms/src/org/argeo/cms/internal/kernel/KernelUtils.java
Introduce workbench login
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / internal / kernel / KernelUtils.java
index 1d7e0868e1e6102bce439f7d7ad31fb3c3aec64a..c1e20892456fd26792956f3ce2532a3ddce9738c 100644 (file)
@@ -15,7 +15,7 @@ import javax.servlet.http.HttpServletRequest;
 
 import org.apache.commons.logging.Log;
 import org.argeo.cms.CmsException;
-import org.argeo.cms.KernelHeader;
+import org.argeo.cms.auth.AuthConstants;
 
 /** Package utilities */
 class KernelUtils implements KernelConstants {
@@ -47,6 +47,19 @@ class KernelUtils implements KernelConstants {
                                .getAbsoluteFile();
        }
 
+       static String getOsgiInstancePath(String relativePath) {
+               try {
+                       if (relativePath == null)
+                               return getOsgiInstanceDir().getCanonicalPath();
+                       else
+                               return new File(getOsgiInstanceDir(), relativePath)
+                                               .getCanonicalPath();
+               } catch (IOException e) {
+                       throw new CmsException("Cannot get instance path for "
+                                       + relativePath, e);
+               }
+       }
+
        static File getOsgiConfigurationFile(String relativePath) {
                try {
                        return new File(new URI(Activator.getBundleContext().getProperty(
@@ -74,7 +87,8 @@ class KernelUtils implements KernelConstants {
                Subject subject = new Subject();
                LoginContext lc;
                try {
-                       lc = new LoginContext(KernelHeader.LOGIN_CONTEXT_ANONYMOUS, subject);
+                       lc = new LoginContext(AuthConstants.LOGIN_CONTEXT_ANONYMOUS,
+                                       subject);
                        lc.login();
                        return subject;
                } catch (LoginException e) {