Author: julien_viet
Date: 2009-12-05 17:04:13 -0500 (Sat, 05 Dec 2009)
New Revision: 945
Added:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ContextualTask.java
portal/trunk/component/web/src/main/java/conf/autologin-nodetypes.xml
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/TokenContainer.java
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/TokenEntry.java
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/autologin-configuration.xml
Modified:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ChromatticLifeCycle.java
portal/trunk/component/web/pom.xml
portal/trunk/component/web/src/main/java/org/exoplatform/web/login/PortalLoginController.java
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/Credentials.java
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/AbstractTokenService.java
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/CookieTokenService.java
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/TransientTokenService.java
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/security-configuration.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/configuration.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.tmpl.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/repository-configuration.tmpl.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/repository-configuration.xml
portal/trunk/webui/core/pom.xml
Log:
GTNPORTAL-308 : Cookie token service with Chromattic
Modified:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ChromatticLifeCycle.java
===================================================================
---
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ChromatticLifeCycle.java 2009-12-05
22:01:42 UTC (rev 944)
+++
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ChromatticLifeCycle.java 2009-12-05
22:04:13 UTC (rev 945)
@@ -24,6 +24,7 @@
import org.exoplatform.container.xml.InitParams;
import java.util.List;
+import java.util.concurrent.Callable;
/**
* <p>The chromattic life cycle objets is a plugin that allow to bootstrap a
chromattic builder and make
Added:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ContextualTask.java
===================================================================
---
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ContextualTask.java
(rev 0)
+++
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ContextualTask.java 2009-12-05
22:04:13 UTC (rev 945)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.commons.chromattic;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ * @param <V> the return type value
+ */
+public abstract class ContextualTask<V>
+{
+
+ /**
+ * Executes a task within a context from the specified life cycle. If an existing
context already exists
+ * then this context is used otherwise a context is managed for the duration of the
{@link #execute(SessionContext)}
+ * method.
+ *
+ * @param lifeCycle the life cycle
+ * @return a value
+ */
+ public final V executeWith(ChromatticLifeCycle lifeCycle)
+ {
+ SessionContext context = lifeCycle.getContext(true);
+ if (context == null)
+ {
+ context = lifeCycle.openContext();
+ try
+ {
+ return execute(context);
+ }
+ finally
+ {
+ lifeCycle.closeContext(context, true);
+ }
+ }
+ else
+ {
+ return execute(context);
+ }
+ }
+
+ /**
+ * Implementor must provide the task logic here.
+ *
+ * @param context the context
+ * @return a value
+ */
+ protected abstract V execute(SessionContext context);
+
+}
Modified: portal/trunk/component/web/pom.xml
===================================================================
--- portal/trunk/component/web/pom.xml 2009-12-05 22:01:42 UTC (rev 944)
+++ portal/trunk/component/web/pom.xml 2009-12-05 22:04:13 UTC (rev 945)
@@ -112,6 +112,13 @@
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.chromattic</groupId>
+ <artifactId>chromattic.apt</artifactId>
+ <version>${version.chromattic}</version>
+ <scope>compile</scope>
+ </dependency>
+
<dependency>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-federation</artifactId>
Added: portal/trunk/component/web/src/main/java/conf/autologin-nodetypes.xml
===================================================================
--- portal/trunk/component/web/src/main/java/conf/autologin-nodetypes.xml
(rev 0)
+++ portal/trunk/component/web/src/main/java/conf/autologin-nodetypes.xml 2009-12-05
22:04:13 UTC (rev 945)
@@ -0,0 +1,56 @@
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+
+-->
+<nodeTypes
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0">
+
+ <nodeType name="lgn:tokencontainer" isMixin="false"
hasOrderableChildNodes="false" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <childNodeDefinitions>
+ <childNodeDefinition name="*"
defaultPrimaryType="lgn:tokenentry" autoCreated="false"
mandatory="false"
+ onParentVersion="COPY" protected="false"
sameNameSiblings="false">
+ <requiredPrimaryTypes>
+ <requiredPrimaryType>lgn:tokenentry</requiredPrimaryType>
+ </requiredPrimaryTypes>
+ </childNodeDefinition>
+ </childNodeDefinitions>
+ </nodeType>
+
+ <nodeType name="lgn:tokenentry" isMixin="false"
hasOrderableChildNodes="false" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="username" requiredType="String"
autoCreated="false" mandatory="true" onParentVersion="COPY"
protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="password" requiredType="String"
autoCreated="false" mandatory="true" onParentVersion="COPY"
protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="expiration" requiredType="Date"
autoCreated="true" mandatory="true" onParentVersion="COPY"
protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
+</nodeTypes>
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/login/PortalLoginController.java
===================================================================
---
portal/trunk/component/web/src/main/java/org/exoplatform/web/login/PortalLoginController.java 2009-12-05
22:01:42 UTC (rev 944)
+++
portal/trunk/component/web/src/main/java/org/exoplatform/web/login/PortalLoginController.java 2009-12-05
22:04:13 UTC (rev 945)
@@ -61,8 +61,8 @@
String rememberme = req.getParameter("rememberme");
if ("true".equals(rememberme))
{
- boolean isRememeber =
"true".equals(req.getParameter(InitiateLoginServlet.COOKIE_NAME));
- if (isRememeber)
+ boolean isRemember =
"true".equals(req.getParameter(InitiateLoginServlet.COOKIE_NAME));
+ if (isRemember)
{
//Create token
AbstractTokenService tokenService =
AbstractTokenService.getInstance(CookieTokenService.class);
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/Credentials.java
===================================================================
---
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/Credentials.java 2009-12-05
22:01:42 UTC (rev 944)
+++
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/Credentials.java 2009-12-05
22:04:13 UTC (rev 945)
@@ -28,6 +28,8 @@
public class Credentials
{
+
+
/** . */
private final String username;
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/AbstractTokenService.java
===================================================================
---
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/AbstractTokenService.java 2009-12-05
22:01:42 UTC (rev 944)
+++
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/AbstractTokenService.java 2009-12-05
22:04:13 UTC (rev 945)
@@ -26,6 +26,7 @@
import org.exoplatform.management.annotations.ManagedName;
import org.exoplatform.management.jmx.annotations.NameTemplate;
import org.exoplatform.management.jmx.annotations.Property;
+import org.exoplatform.web.login.InitiateLoginServlet;
import org.exoplatform.web.security.Credentials;
import org.exoplatform.web.security.Token;
import org.exoplatform.web.security.TokenStore;
@@ -37,20 +38,17 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.RepositoryException;
-
/**
* Created by The eXo Platform SAS Author : liem.nguyen ncliam(a)gmail.com Jun 5,
* 2009
*/
@Managed
-@NameTemplate({@Property(key = "service", value = "auth_token"),
@Property(key = "name", value = "{Name}")})
-@ManagedDescription("Token Service")
+@NameTemplate({@Property(key = "service", value = "TokenStore"),
@Property(key = "name", value = "{Name}")})
+@ManagedDescription("Token Store Service")
public abstract class AbstractTokenService implements Startable, TokenStore
{
- protected final String SERVICE_CONFIG = "service.configuration";
+ protected static final String SERVICE_CONFIG = "service.configuration";
protected static final int DELAY_TIME = 600;
@@ -78,14 +76,7 @@
{
public void run()
{
- try
- {
- service.cleanExpiredTokens();
- }
- catch (RepositoryException re)
- {
- System.out.println("Error occur when delete expired cookie
token");
- }
+ service.cleanExpiredTokens();
}
}, 0, DELAY_TIME, TimeUnit.SECONDS);
@@ -96,11 +87,10 @@
// do nothing
}
- @SuppressWarnings("unchecked")
public static <T extends AbstractTokenService> T getInstance(Class<T>
classType)
{
PortalContainer container = PortalContainer.getInstance();
- return (T)container.getComponentInstanceOfType(classType);
+ return classType.cast(container.getComponentInstanceOfType(classType));
}
public Credentials validateToken(String tokenKey, boolean remove)
@@ -144,7 +134,7 @@
@Managed
@ManagedDescription("Clean all tokens are expired")
- public void cleanExpiredTokens() throws PathNotFoundException, RepositoryException
+ public void cleanExpiredTokens()
{
String[] ids = getAllTokens();
for (String s : ids)
@@ -174,11 +164,11 @@
@Managed
@ManagedDescription("get a token by id")
- public abstract Token getToken(String id) throws PathNotFoundException,
RepositoryException;
+ public abstract Token getToken(String id);
@Managed
@ManagedDescription("Delete a token by id")
- public abstract Token deleteToken(String id) throws PathNotFoundException,
RepositoryException;
+ public abstract Token deleteToken(String id);
@Managed
@ManagedDescription("The list of all tokens")
@@ -203,4 +193,9 @@
return configValue * multiply;
}
}
+
+ protected String nextTokenId()
+ {
+ return InitiateLoginServlet.COOKIE_NAME + random.nextInt();
+ }
}
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/CookieTokenService.java
===================================================================
---
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/CookieTokenService.java 2009-12-05
22:01:42 UTC (rev 944)
+++
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/CookieTokenService.java 2009-12-05
22:04:13 UTC (rev 945)
@@ -19,22 +19,18 @@
package org.exoplatform.web.security.security;
+import org.chromattic.api.ChromatticSession;
+import org.exoplatform.commons.chromattic.ChromatticLifeCycle;
+import org.exoplatform.commons.chromattic.ChromatticManager;
+import org.exoplatform.commons.chromattic.ContextualTask;
+import org.exoplatform.commons.chromattic.SessionContext;
import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.services.jcr.ext.common.SessionProvider;
-import org.exoplatform.services.jcr.ext.registry.RegistryEntry;
-import org.exoplatform.services.jcr.ext.registry.RegistryService;
-import org.exoplatform.web.login.InitiateLoginServlet;
import org.exoplatform.web.security.Credentials;
import org.exoplatform.web.security.Token;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
-import javax.jcr.NodeIterator;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.RepositoryException;
-
/**
* Created by The eXo Platform SAS Author : liem.nguyen ncliam(a)gmail.com Jun 5,
* 2009
@@ -42,15 +38,22 @@
public class CookieTokenService extends AbstractTokenService
{
- private RegistryService regService_;
+ /** . */
+ private ChromatticManager chromatticManager;
- public CookieTokenService(InitParams initParams, RegistryService rService)
+ /** . */
+ private ChromatticLifeCycle chromatticLifeCycle;
+
+ public CookieTokenService(InitParams initParams, ChromatticManager chromatticManager)
{
super(initParams);
- regService_ = rService;
+
+ //
+ this.chromatticManager = chromatticManager;
+ this.chromatticLifeCycle = chromatticManager.getLifeCycle("autologin");
}
- public String createToken(Credentials credentials)
+ public String createToken(final Credentials credentials)
{
if (validityMillis < 0)
{
@@ -60,163 +63,117 @@
{
throw new NullPointerException();
}
- String tokenId = InitiateLoginServlet.COOKIE_NAME + random.nextInt();
- long expirationTimeMillis = System.currentTimeMillis() + validityMillis;
- this.saveToken(tokenId, new Token(expirationTimeMillis, credentials));
- return tokenId;
+ return new TokenTask<String>() {
+ @Override
+ protected String execute()
+ {
+ String tokenId = nextTokenId();
+ long expirationTimeMillis = System.currentTimeMillis() + validityMillis;
+ Token token = new Token(expirationTimeMillis, credentials);
+ TokenContainer container = getTokenContainer();
+ container.saveToken(tokenId, token.getPayload(), new
Date(token.getExpirationTimeMillis()));
+ return tokenId;
+ }
+ }.executeWith(chromatticLifeCycle);
}
@Override
- public Token getToken(String id) throws PathNotFoundException, RepositoryException
+ public Token getToken(final String id)
{
- String entryPath = getServiceRegistryPath() + "/" + id;
- SessionProvider sessionProvider = SessionProvider.createSystemProvider();
- try
- {
- RegistryEntry entry = regService_.getEntry(sessionProvider, entryPath);
- return toToken(entry.getDocument());
- }
- finally
- {
- sessionProvider.close();
- }
+ return new TokenTask<Token>() {
+ @Override
+ protected Token execute()
+ {
+ return getTokenContainer().getToken(id);
+ }
+ }.executeWith(chromatticLifeCycle);
}
@Override
- public Token deleteToken(String id) throws PathNotFoundException, RepositoryException
+ public Token deleteToken(final String id)
{
- Token data = getToken(id);
- if (data == null)
- return null;
- String entryPath = getServiceRegistryPath() + "/" + id;
- SessionProvider sessionProvider = SessionProvider.createSystemProvider();
- try
- {
- regService_.removeEntry(sessionProvider, entryPath);
- return data;
- }
- finally
- {
- sessionProvider.close();
- }
+ return new TokenTask<Token>() {
+ @Override
+ protected Token execute()
+ {
+ return getTokenContainer().removeToken(id);
+ }
+ }.executeWith(chromatticLifeCycle);
}
- private void saveToken(String tokenId, Token token)
+ @Override
+ public String[] getAllTokens()
{
- if (tokenId == null || tokenId.length() == 0 || token == null)
- {
- return;
- }
- SessionProvider sessionProvider = SessionProvider.createSystemProvider();
- String servicePath = getServiceRegistryPath();
- String entryPath = servicePath + "/" + tokenId;
- RegistryEntry entry;
- try
- {
- try
+ return new TokenTask<String[]>() {
+ @Override
+ protected String[] execute()
{
- entry = regService_.getEntry(sessionProvider, entryPath);
+ TokenContainer container = getTokenContainer();
+ Collection<TokenEntry> tokens = container.getAllTokens();
+ String[] ids = new String[tokens.size()];
+ int count = 0;
+ for (TokenEntry token : tokens)
+ {
+ ids[count++] = token.getId();
+ }
+ return ids;
}
- catch (PathNotFoundException e)
- {
- entry = new RegistryEntry(tokenId);
- regService_.createEntry(sessionProvider, servicePath, entry);
- }
- Document doc = entry.getDocument();
- map(doc, token);
- regService_.recreateEntry(sessionProvider, servicePath, entry);
- }
- catch (Exception e)
- {
- }
- finally
- {
- sessionProvider.close();
- }
+ }.executeWith(chromatticLifeCycle);
}
- private Token toToken(Document document)
+ @Override
+ public long getNumberTokens() throws Exception
{
- Element root = document.getDocumentElement();
- String userName = root.getAttribute(Token.USERNAME);
- String password = root.getAttribute(Token.PASSWORD);
- long time = Long.parseLong(root.getAttribute(Token.EXPIRE_MILI));
- Credentials payload = new Credentials(userName, password);
- return new Token(time, payload);
+ return new TokenTask<Long>() {
+ @Override
+ protected Long execute()
+ {
+ TokenContainer container = getTokenContainer();
+ Collection<TokenEntry> tokens = container.getAllTokens();
+ return (long)tokens.size();
+ }
+ }.executeWith(chromatticLifeCycle);
}
- private void map(Document document, Token token)
+ /**
+ * Wraps token store logic conveniently.
+ *
+ * @param <V> the return type
+ */
+ private abstract class TokenTask<V> extends ContextualTask<V>
{
- Element root = document.getDocumentElement();
- prepareXmlNamespace(root);
- root.setAttribute(Token.EXPIRE_MILI, "" +
token.getExpirationTimeMillis());
- root.setAttribute(Token.USERNAME, token.getPayload().getUsername());
- root.setAttribute(Token.PASSWORD, token.getPayload().getPassword());
- }
- private void prepareXmlNamespace(Element element)
- {
- setXmlNameSpace(element, "xmlns:exo",
"http://www.exoplatform.com/jcr/exo/1.0");
- setXmlNameSpace(element, "xmlns:jcr",
"http://www.jcp.org/jcr/1.0");
- }
+ /** . */
+ private SessionContext context;
- private void setXmlNameSpace(Element element, String key, String value)
- {
- String xmlns = element.getAttribute(key);
- if (xmlns == null || xmlns.trim().length() < 1)
- {
- element.setAttribute(key, value);
+ protected final TokenContainer getTokenContainer() {
+ SessionContext ctx = chromatticLifeCycle.getContext();
+ ChromatticSession session = ctx.getSession();
+ TokenContainer container = session.findByPath(TokenContainer.class,
"autologin");
+ if (container == null)
+ {
+ container = session.insert(TokenContainer.class, "autologin");
+ }
+ return container;
}
- }
- private String getServiceRegistryPath()
- {
- return RegistryService.EXO_SERVICES + "/" + name;
- }
-
- @Override
- public String[] getAllTokens()
- {
- SessionProvider sessionProvider = SessionProvider.createSystemProvider();
- try
+ @Override
+ protected V execute(SessionContext context)
{
- javax.jcr.Node regNode = regService_.getRegistry(sessionProvider).getNode();
- NodeIterator itr = regNode.getNode(getServiceRegistryPath()).getNodes();
- ArrayList<String> list = new ArrayList<String>();
- while (itr.hasNext())
+ this.context = context;
+
+ //
+ try
{
- javax.jcr.Node node = itr.nextNode();
- list.add(node.getName());
+ return execute();
}
- return list.toArray(new String[]{});
+ finally
+ {
+ this.context = null;
+ }
}
- catch (RepositoryException e)
- {
- return null;
- }
- finally
- {
- sessionProvider.close();
- }
- }
- @Override
- public long getNumberTokens() throws Exception
- {
- SessionProvider sessionProvider = SessionProvider.createSystemProvider();
- try
- {
- javax.jcr.Node regNode = regService_.getRegistry(sessionProvider).getNode();
- NodeIterator itr = regNode.getNode(getServiceRegistryPath()).getNodes();
- return itr.getSize();
- }
- catch (Exception ex)
- {
- return 0;
- }
- finally
- {
- sessionProvider.close();
- }
+ protected abstract V execute();
+
}
}
Added:
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/TokenContainer.java
===================================================================
---
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/TokenContainer.java
(rev 0)
+++
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/TokenContainer.java 2009-12-05
22:04:13 UTC (rev 945)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.web.security.security;
+
+import org.chromattic.api.annotations.Create;
+import org.chromattic.api.annotations.NodeMapping;
+import org.chromattic.api.annotations.OneToMany;
+import org.exoplatform.web.security.Credentials;
+import org.exoplatform.web.security.Token;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+@NodeMapping(name = "lgn:tokencontainer")
+public abstract class TokenContainer
+{
+
+ @Create
+ protected abstract TokenEntry createToken();
+
+ @OneToMany
+ protected abstract Map<String, TokenEntry> getTokens();
+
+ public Collection<TokenEntry> getAllTokens()
+ {
+ return getTokens().values();
+ }
+
+ public Token getToken(String tokenId)
+ {
+ Map<String, TokenEntry> tokens = getTokens();
+ TokenEntry entry = tokens.get(tokenId);
+ return entry != null ? entry.getToken() : null;
+ }
+
+ public Token removeToken(String tokenId)
+ {
+ Map<String, TokenEntry> tokens = getTokens();
+ TokenEntry entry = tokens.get(tokenId);
+ if (entry != null)
+ {
+ Token token = entry.getToken();
+ entry.remove();
+ return token;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Token saveToken(String tokenId, Credentials credentials, Date expirationTime)
+ {
+ Map<String, TokenEntry> tokens = getTokens();
+ TokenEntry entry = tokens.get(tokenId);
+ if (entry == null)
+ {
+ entry = createToken();
+ tokens.put(tokenId, entry);
+ entry.setUserName(credentials.getUsername());
+ entry.setPassword(credentials.getPassword());
+ }
+ entry.setExpirationTime(expirationTime);
+ return entry.getToken();
+ }
+
+}
Added:
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/TokenEntry.java
===================================================================
---
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/TokenEntry.java
(rev 0)
+++
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/TokenEntry.java 2009-12-05
22:04:13 UTC (rev 945)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.web.security.security;
+
+import org.chromattic.api.annotations.Destroy;
+import org.chromattic.api.annotations.Name;
+import org.chromattic.api.annotations.NodeMapping;
+import org.chromattic.api.annotations.Property;
+import org.exoplatform.web.security.Credentials;
+import org.exoplatform.web.security.Token;
+
+import java.util.Date;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+@NodeMapping(name = "lgn:tokenentry")
+public abstract class TokenEntry
+{
+
+ @Name
+ public abstract String getId();
+
+ @Property(name = "username")
+ public abstract String getUserName();
+
+ public abstract void setUserName(String userName);
+
+ @Property(name = "password")
+ public abstract String getPassword();
+
+ public abstract void setPassword(String password);
+
+ @Property(name = "expiration")
+ public abstract Date getExpirationTime();
+
+ public abstract void setExpirationTime(Date expirationTime);
+
+ @Destroy
+ public abstract void remove();
+
+ public Token getToken()
+ {
+ return new Token(
+ getExpirationTime().getTime(),
+ new Credentials(getUserName(), getPassword()));
+ }
+
+}
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/TransientTokenService.java
===================================================================
---
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/TransientTokenService.java 2009-12-05
22:01:42 UTC (rev 944)
+++
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/security/TransientTokenService.java 2009-12-05
22:04:13 UTC (rev 945)
@@ -20,15 +20,11 @@
package org.exoplatform.web.security.security;
import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.web.login.InitiateLoginServlet;
import org.exoplatform.web.security.Credentials;
import org.exoplatform.web.security.Token;
import java.util.concurrent.ConcurrentHashMap;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.RepositoryException;
-
/**
* Created by The eXo Platform SAS Author : liem.nguyen ncliam(a)gmail.com Jun 5,
* 2009
@@ -53,20 +49,20 @@
{
throw new NullPointerException();
}
- String tokenId = InitiateLoginServlet.COOKIE_NAME + random.nextInt();
+ String tokenId = nextTokenId();
long expirationTimeMillis = System.currentTimeMillis() + validityMillis;
tokens.put(tokenId, new Token(expirationTimeMillis, credentials));
return tokenId;
}
@Override
- public Token getToken(String id) throws PathNotFoundException, RepositoryException
+ public Token getToken(String id)
{
return tokens.get(id);
}
@Override
- public Token deleteToken(String id) throws PathNotFoundException, RepositoryException
+ public Token deleteToken(String id)
{
Token token = tokens.get(id);
tokens.remove(id);
Added:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/autologin-configuration.xml
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/autologin-configuration.xml
(rev 0)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/autologin-configuration.xml 2009-12-05
22:04:13 UTC (rev 945)
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+
+-->
+
+<configuration
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd
http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
+ <component>
+ <key>org.exoplatform.web.security.security.CookieTokenService</key>
+ <type>org.exoplatform.web.security.security.CookieTokenService</type>
+ <init-params>
+ <values-param>
+ <name>service.configuration</name>
+ <value>jcr-token</value>
+ <value>7</value>
+ <value>DAY</value>
+ </values-param>
+ </init-params>
+ </component>
+
+ <component>
+ <key>org.exoplatform.web.security.security.TransientTokenService</key>
+ <type>org.exoplatform.web.security.security.TransientTokenService</type>
+ <init-params>
+ <values-param>
+ <name>service.configuration</name>
+ <value>memory-token</value>
+ <value>1</value>
+ <value>MINUTE</value>
+ </values-param>
+ </init-params>
+ </component>
+
+ <external-component-plugins>
+
<target-component>org.exoplatform.commons.chromattic.ChromatticManager</target-component>
+ <component-plugin>
+ <name>chromattic</name>
+ <set-method>addLifeCycle</set-method>
+ <type>org.exoplatform.commons.chromattic.ChromatticLifeCycle</type>
+ <init-params>
+ <value-param>
+ <name>name</name>
+ <value>autologin</value>
+ </value-param>
+ <value-param>
+ <name>workspace-name</name>
+ <value>portal-work</value>
+ </value-param>
+ <values-param>
+ <name>entities</name>
+
<value>org.exoplatform.web.security.security.TokenContainer</value>
+ <value>org.exoplatform.web.security.security.TokenEntry</value>
+ </values-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+
+</configuration>
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml 2009-12-05
22:01:42 UTC (rev 944)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml 2009-12-05
22:04:13 UTC (rev 945)
@@ -37,34 +37,6 @@
</properties-param>
</init-params>
</component>
-
- <!-- ********************* CONFIGURE TOKEN SERVICE ************************* -->
- <component>
- <key>org.exoplatform.web.security.security.CookieTokenService</key>
- <type>org.exoplatform.web.security.security.CookieTokenService</type>
- <init-params>
- <values-param>
- <name>service.configuration</name>
- <value>jcr-token</value>
- <value>7</value>
- <value>DAY</value>
- </values-param>
- </init-params>
- </component>
-
- <component>
- <key>org.exoplatform.web.security.security.TransientTokenService</key>
- <type>org.exoplatform.web.security.security.TransientTokenService</type>
- <init-params>
- <values-param>
- <name>service.configuration</name>
- <value>memory-token</value>
- <value>1</value>
- <value>MINUTE</value>
- </values-param>
- </init-params>
- </component>
- <!-- ********************* END CONFIGURE TOKEN SERVICE *************************
-->
<component>
<key>org.exoplatform.services.resources.LocaleConfigService</key>
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/security-configuration.xml
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/security-configuration.xml 2009-12-05
22:01:42 UTC (rev 944)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/security-configuration.xml 2009-12-05
22:04:13 UTC (rev 945)
@@ -38,4 +38,55 @@
</value-param>
</init-params>
</component>
+
+ <component>
+ <key>org.exoplatform.web.security.security.CookieTokenService</key>
+ <type>org.exoplatform.web.security.security.CookieTokenService</type>
+ <init-params>
+ <values-param>
+ <name>service.configuration</name>
+ <value>jcr-token</value>
+ <value>7</value>
+ <value>DAY</value>
+ </values-param>
+ </init-params>
+ </component>
+
+ <component>
+ <key>org.exoplatform.web.security.security.TransientTokenService</key>
+ <type>org.exoplatform.web.security.security.TransientTokenService</type>
+ <init-params>
+ <values-param>
+ <name>service.configuration</name>
+ <value>memory-token</value>
+ <value>1</value>
+ <value>MINUTE</value>
+ </values-param>
+ </init-params>
+ </component>
+
+ <external-component-plugins>
+
<target-component>org.exoplatform.commons.chromattic.ChromatticManager</target-component>
+ <component-plugin>
+ <name>chromattic</name>
+ <set-method>addLifeCycle</set-method>
+ <type>org.exoplatform.portal.pom.config.MOPChromatticLifeCycle</type>
+ <init-params>
+ <value-param>
+ <name>name</name>
+ <value>token</value>
+ </value-param>
+ <value-param>
+ <name>workspace-name</name>
+ <value>portal-work</value>
+ </value-param>
+ <values-param>
+ <name>entities</name>
+
<value>org.exoplatform.web.security.security.TokenContainer</value>
+ <value>org.exoplatform.web.security.security.TokenEntry</value>
+ </values-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+
</configuration>
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/configuration.xml 2009-12-05
22:01:42 UTC (rev 944)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/configuration.xml 2009-12-05
22:04:13 UTC (rev 945)
@@ -28,6 +28,7 @@
<import>war:/conf/common/portlet-container-configuration.xml</import>
<import>war:/conf/common/wsrp-configuration.xml</import>
<import>war:/conf/common/logs-configuration.xml</import>
+ <import>war:/conf/common/autologin-configuration.xml</import>
<import>war:/conf/database/database-configuration.xml</import>
<import>war:/conf/jcr/jcr-configuration.xml</import>
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.tmpl.xml
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.tmpl.xml 2009-12-05
22:01:42 UTC (rev 944)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.tmpl.xml 2009-12-05
22:04:13 UTC (rev 945)
@@ -106,6 +106,8 @@
<name>namespaces</name>
<property name="dc"
value="http://purl.org/dc/elements/1.1/"/>
<property name="mop"
value="http://www.gatein.org/jcr/mop/1.0/"/>
+ <property name="app"
value="http://www.gatein.org/jcr/application-registry/1.0/"/>
+ <property name="lgn"
value="http://www.gatein.org/jcr/autologin/1.0/"/>
</properties-param>
</init-params>
</component-plugin>
@@ -119,11 +121,13 @@
<description>Node types configuration file</description>
<value>jar:/conf/ext-nodetypes-config.xml</value>
<value>jar:/conf/organization-nodetypes.xml</value>
- <value>jar:/conf/mop-nodetypes.xml</value>
- <value>jar:/conf/portal/portal-nodetypes.xml</value>
+ <value>jar:/conf/mop-nodetypes.xml</value>
+ <value>jar:/conf/application-nodetypes.xml</value>
+ <value>jar:/conf/content-nodetypes.xml</value>
+ <value>jar:/conf/autologin-nodetypes.xml</value>
</values-param>
</init-params>
</component-plugin>
</external-component-plugins>
-
+
</configuration>
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.xml
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.xml 2009-12-05
22:01:42 UTC (rev 944)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.xml 2009-12-05
22:04:13 UTC (rev 945)
@@ -57,7 +57,7 @@
</properties-param>
</init-params>
</component>
-
+
<component>
<key>org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator</key>
<type>org.exoplatform.services.jcr.ext.hierarchy.impl.NodeHierarchyCreatorImpl</type>
@@ -106,7 +106,8 @@
<name>namespaces</name>
<property name="dc"
value="http://purl.org/dc/elements/1.1/"/>
<property name="mop"
value="http://www.gatein.org/jcr/mop/1.0/"/>
- <property name="app"
value="http://www.gatein.org/jcr/app/1.0/"/>
+ <property name="app"
value="http://www.gatein.org/jcr/application-registry/1.0/"/>
+ <property name="lgn"
value="http://www.gatein.org/jcr/autologin/1.0/"/>
</properties-param>
</init-params>
</component-plugin>
@@ -123,8 +124,10 @@
<value>jar:/conf/mop-nodetypes.xml</value>
<value>jar:/conf/application-nodetypes.xml</value>
<value>jar:/conf/content-nodetypes.xml</value>
+ <value>jar:/conf/autologin-nodetypes.xml</value>
</values-param>
</init-params>
</component-plugin>
</external-component-plugins>
+
</configuration>
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/repository-configuration.tmpl.xml
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/repository-configuration.tmpl.xml 2009-12-05
22:01:42 UTC (rev 944)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/repository-configuration.tmpl.xml 2009-12-05
22:04:13 UTC (rev 945)
@@ -1,17 +1,17 @@
<!--
Copyright (C) 2009 eXo Platform SAS.
-
+
This is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this software; if not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
@@ -20,17 +20,19 @@
-->
<repository-service default-repository="repository">
- <repositories>
+ <repositories>
<repository name="repository" system-workspace="system"
default-workspace="portal-system">
- <security-domain>gatein-domain</security-domain>
- <access-control>optional</access-control>
- <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
- <workspaces>
- <workspace name="system">
- <container
class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name"
value="jdbcexo${container.name.suffix}"/>
- <property name="dialect" value="${dialect}"/>
+ <security-domain>gatein-domain</security-domain>
+ <access-control>optional</access-control>
+
<authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+
+ <!-- System -->
+ <workspaces>
+ <workspace name="system">
+ <container
class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name"
value="jdbcexo${container.name.suffix}"/>
+ <property name="dialect" value="hsqldb"/>
<property name="multi-db" value="false"/>
<property name="update-storage" value="true"/>
<property name="max-buffer-size"
value="204800"/>
@@ -47,37 +49,39 @@
</value-storage>
</value-storages>
</container>
- <initializer
class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype"
value="nt:unstructured"/>
- <property name="root-permissions"
value="*:/platform/administrators read;*:/platform/administrators
add_node;*:/platform/administrators set_property;*:/platform/administrators
remove"/>
- </properties>
- </initializer>
- <cache enabled="true">
- <properties>
- <property name="max-size" value="20000"/>
- <property name="live-time" value="30000"/>
- </properties>
- </cache>
- <query-handler
class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir"
value="../temp/jcrlucenedb/system${container.name.suffix}"/>
- </properties>
- </query-handler>
- <lock-manager>
- <time-out>15m</time-out><!-- 15min -->
- <persister
class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
- <properties>
- <property name="path"
value="../temp/lock/system${container.name.suffix}"/>
- </properties>
- </persister>
- </lock-manager>
- </workspace>
- <workspace name="portal-system">
+ <initializer
class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype"
value="nt:unstructured"/>
+ <property name="root-permissions"
value="*:/platform/administrators read;*:/platform/administrators
add_node;*:/platform/administrators set_property;*:/platform/administrators
remove"/>
+ </properties>
+ </initializer>
+ <cache enabled="true">
+ <properties>
+ <property name="max-size" value="20000"/>
+ <property name="live-time" value="30000"/>
+ </properties>
+ </cache>
+ <query-handler
class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir"
value="../temp/jcrlucenedb/system${container.name.suffix}"/>
+ </properties>
+ </query-handler>
+ <lock-manager>
+ <time-out>15m</time-out><!-- 15min -->
+ <persister
class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path"
value="../temp/lock/system${container.name.suffix}"/>
+ </properties>
+ </persister>
+ </lock-manager>
+ </workspace>
+
+ <!-- Portal system data -->
+ <workspace name="portal-system">
<container
class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
<properties>
<property name="source-name"
value="jdbcexo${container.name.suffix}"/>
- <property name="dialect" value="${dialect}"/>
+ <property name="dialect" value="hsqldb"/>
<property name="multi-db" value="false"/>
<property name="update-storage" value="true"/>
<property name="max-buffer-size"
value="204800"/>
@@ -94,12 +98,61 @@
</value-storage>
</value-storages>
</container>
- <initializer
class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype"
value="nt:unstructured"/>
- <property name="root-permissions" value="any
read;*:/platform/administrators read;*:/platform/administrators
add_node;*:/platform/administrators set_property;*:/platform/administrators
remove"/>
- </properties>
- </initializer>
+ <initializer
class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype"
value="nt:unstructured"/>
+ <property name="root-permissions" value="any
read;*:/platform/administrators read;*:/platform/administrators
add_node;*:/platform/administrators set_property;*:/platform/administrators
remove"/>
+ </properties>
+ </initializer>
+ <cache enabled="true">
+ <properties>
+ <property name="max-size" value="20000"/>
+ <property name="live-time" value="30000"/>
+ </properties>
+ </cache>
+ <query-handler
class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir"
value="../temp/jcrlucenedb/portal-system${container.name.suffix}"/>
+ </properties>
+ </query-handler>
+ <lock-manager>
+ <time-out>15m</time-out><!-- 15min -->
+ <persister
class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path"
value="../temp/lock/portal-system${container.name.suffix}"/>
+ </properties>
+ </persister>
+ </lock-manager>
+ </workspace>
+
+ <!-- Portal work data -->
+ <workspace name="portal-work">
+ <container
class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name"
value="jdbcexo${container.name.suffix}"/>
+ <property name="dialect" value="hsqldb"/>
+ <property name="multi-db" value="false"/>
+ <property name="update-storage" value="true"/>
+ <property name="max-buffer-size"
value="204800"/>
+ <property name="swap-directory"
value="../temp/swap/portal-work${container.name.suffix}"/>
+ </properties>
+ <value-storages>
+ <value-storage id="portal-work"
class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path"
value="../temp/values/portal-work${container.name.suffix}"/>
+ </properties>
+ <filters>
+ <filter property-type="Binary"/>
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer
class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype"
value="nt:unstructured"/>
+ <property name="root-permissions" value="any
read;*:/platform/administrators read;*:/platform/administrators
add_node;*:/platform/administrators set_property;*:/platform/administrators
remove"/>
+ </properties>
+ </initializer>
<cache enabled="true">
<properties>
<property name="max-size" value="20000"/>
@@ -108,19 +161,20 @@
</cache>
<query-handler
class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
<properties>
- <property name="index-dir"
value="../temp/jcrlucenedb/portal-system${container.name.suffix}"/>
+ <property name="index-dir"
value="../temp/jcrlucenedb/portal-work${container.name.suffix}"/>
</properties>
</query-handler>
<lock-manager>
- <time-out>15m</time-out><!-- 15min -->
- <persister
class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
- <properties>
- <property name="path"
value="../temp/lock/portal-system${container.name.suffix}"/>
- </properties>
- </persister>
- </lock-manager>
+ <time-out>15m</time-out><!-- 15min -->
+ <persister
class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path"
value="../temp/lock/portal-work${container.name.suffix}"/>
+ </properties>
+ </persister>
+ </lock-manager>
</workspace>
- </workspaces>
+
+ </workspaces>
</repository>
</repositories>
</repository-service>
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/repository-configuration.xml
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/repository-configuration.xml 2009-12-05
22:01:42 UTC (rev 944)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/repository-configuration.xml 2009-12-05
22:04:13 UTC (rev 945)
@@ -20,60 +20,15 @@
-->
<repository-service default-repository="repository">
- <repositories>
+ <repositories>
<repository name="repository" system-workspace="system"
default-workspace="portal-system">
- <security-domain>gatein-domain</security-domain>
- <access-control>optional</access-control>
- <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
- <workspaces>
- <workspace name="system">
- <container
class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name"
value="jdbcexo${container.name.suffix}"/>
- <property name="dialect" value="hsqldb"/>
- <property name="multi-db" value="false"/>
- <property name="update-storage" value="true"/>
- <property name="max-buffer-size" value="204800"/>
- <property name="swap-directory"
value="../temp/swap/system${container.name.suffix}"/>
- </properties>
- <value-storages>
- <value-storage id="system"
class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path"
value="../temp/values/system${container.name.suffix}"/>
- </properties>
- <filters>
- <filter property-type="Binary"/>
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer
class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype"
value="nt:unstructured"/>
- <property name="root-permissions"
value="*:/platform/administrators read;*:/platform/administrators
add_node;*:/platform/administrators set_property;*:/platform/administrators
remove"/>
- </properties>
- </initializer>
- <cache enabled="true">
- <properties>
- <property name="max-size" value="20000"/>
- <property name="live-time" value="30000"/>
- </properties>
- </cache>
- <query-handler
class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir"
value="../temp/jcrlucenedb/system${container.name.suffix}"/>
- </properties>
- </query-handler>
- <lock-manager>
- <time-out>15m</time-out><!-- 15min -->
- <persister
class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
- <properties>
- <property name="path"
value="../temp/lock/system${container.name.suffix}"/>
- </properties>
- </persister>
- </lock-manager>
- </workspace>
- <workspace name="portal-system">
+ <security-domain>gatein-domain</security-domain>
+ <access-control>optional</access-control>
+
<authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+
+ <!-- System -->
+ <workspaces>
+ <workspace name="system">
<container
class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
<properties>
<property name="source-name"
value="jdbcexo${container.name.suffix}"/>
@@ -81,6 +36,55 @@
<property name="multi-db" value="false"/>
<property name="update-storage" value="true"/>
<property name="max-buffer-size"
value="204800"/>
+ <property name="swap-directory"
value="../temp/swap/system${container.name.suffix}"/>
+ </properties>
+ <value-storages>
+ <value-storage id="system"
class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path"
value="../temp/values/system${container.name.suffix}"/>
+ </properties>
+ <filters>
+ <filter property-type="Binary"/>
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer
class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype"
value="nt:unstructured"/>
+ <property name="root-permissions"
value="*:/platform/administrators read;*:/platform/administrators
add_node;*:/platform/administrators set_property;*:/platform/administrators
remove"/>
+ </properties>
+ </initializer>
+ <cache enabled="true">
+ <properties>
+ <property name="max-size" value="20000"/>
+ <property name="live-time" value="30000"/>
+ </properties>
+ </cache>
+ <query-handler
class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir"
value="../temp/jcrlucenedb/system${container.name.suffix}"/>
+ </properties>
+ </query-handler>
+ <lock-manager>
+ <time-out>15m</time-out><!-- 15min -->
+ <persister
class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path"
value="../temp/lock/system${container.name.suffix}"/>
+ </properties>
+ </persister>
+ </lock-manager>
+ </workspace>
+
+ <!-- Portal system data -->
+ <workspace name="portal-system">
+ <container
class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name"
value="jdbcexo${container.name.suffix}"/>
+ <property name="dialect" value="hsqldb"/>
+ <property name="multi-db" value="false"/>
+ <property name="update-storage" value="true"/>
+ <property name="max-buffer-size"
value="204800"/>
<property name="swap-directory"
value="../temp/swap/portal-system${container.name.suffix}"/>
</properties>
<value-storages>
@@ -94,12 +98,61 @@
</value-storage>
</value-storages>
</container>
- <initializer
class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype"
value="nt:unstructured"/>
- <property name="root-permissions" value="any
read;*:/platform/administrators read;*:/platform/administrators
add_node;*:/platform/administrators set_property;*:/platform/administrators
remove"/>
- </properties>
- </initializer>
+ <initializer
class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype"
value="nt:unstructured"/>
+ <property name="root-permissions" value="any
read;*:/platform/administrators read;*:/platform/administrators
add_node;*:/platform/administrators set_property;*:/platform/administrators
remove"/>
+ </properties>
+ </initializer>
+ <cache enabled="true">
+ <properties>
+ <property name="max-size" value="20000"/>
+ <property name="live-time" value="30000"/>
+ </properties>
+ </cache>
+ <query-handler
class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir"
value="../temp/jcrlucenedb/portal-system${container.name.suffix}"/>
+ </properties>
+ </query-handler>
+ <lock-manager>
+ <time-out>15m</time-out><!-- 15min -->
+ <persister
class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path"
value="../temp/lock/portal-system${container.name.suffix}"/>
+ </properties>
+ </persister>
+ </lock-manager>
+ </workspace>
+
+ <!-- Portal work data -->
+ <workspace name="portal-work">
+ <container
class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name"
value="jdbcexo${container.name.suffix}"/>
+ <property name="dialect" value="hsqldb"/>
+ <property name="multi-db" value="false"/>
+ <property name="update-storage" value="true"/>
+ <property name="max-buffer-size"
value="204800"/>
+ <property name="swap-directory"
value="../temp/swap/portal-work${container.name.suffix}"/>
+ </properties>
+ <value-storages>
+ <value-storage id="portal-work"
class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path"
value="../temp/values/portal-work${container.name.suffix}"/>
+ </properties>
+ <filters>
+ <filter property-type="Binary"/>
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer
class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype"
value="nt:unstructured"/>
+ <property name="root-permissions" value="any
read;*:/platform/administrators read;*:/platform/administrators
add_node;*:/platform/administrators set_property;*:/platform/administrators
remove"/>
+ </properties>
+ </initializer>
<cache enabled="true">
<properties>
<property name="max-size" value="20000"/>
@@ -108,19 +161,20 @@
</cache>
<query-handler
class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
<properties>
- <property name="index-dir"
value="../temp/jcrlucenedb/portal-system${container.name.suffix}"/>
+ <property name="index-dir"
value="../temp/jcrlucenedb/portal-work${container.name.suffix}"/>
</properties>
</query-handler>
<lock-manager>
- <time-out>15m</time-out><!-- 15min -->
- <persister
class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
- <properties>
- <property name="path"
value="../temp/lock/portal-system${container.name.suffix}"/>
- </properties>
- </persister>
- </lock-manager>
+ <time-out>15m</time-out><!-- 15min -->
+ <persister
class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path"
value="../temp/lock/portal-work${container.name.suffix}"/>
+ </properties>
+ </persister>
+ </lock-manager>
</workspace>
- </workspaces>
+
+ </workspaces>
</repository>
</repositories>
</repository-service>
Modified: portal/trunk/webui/core/pom.xml
===================================================================
--- portal/trunk/webui/core/pom.xml 2009-12-05 22:01:42 UTC (rev 944)
+++ portal/trunk/webui/core/pom.xml 2009-12-05 22:04:13 UTC (rev 945)
@@ -68,6 +68,15 @@
</execution>
</executions>
</plugin>
+
+ <!-- -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <compilerArgument>-proc:none</compilerArgument>
+ </configuration>
+ </plugin>
</plugins>
</build>
</project>