Author: taylor
Date: Mon Feb 19 10:25:30 2007
New Revision: 509287
URL: http://svn.apache.org/viewvc?view=rev&rev=509287
Log:
https://issues.apache.org/jira/browse/JS2-654
Added:
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheDistributedElementImpl.java
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheDistributedImpl.java
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheEventListener.java
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheEventListenerFactory.java
portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java
portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/DistributedCacheElement.java
portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/DistributedCacheObject.java
portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/DistributedJetspeedCache.java
Modified:
portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java
portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/preference/impl/PrefsPreferenceSetImpl.java
portals/jetspeed-2/trunk/etc/db-ojb/ehcache.xml
portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/cache.xml
Added:
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheDistributedElementImpl.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheDistributedElementImpl.java?view=auto&rev=509287
==============================================================================
---
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheDistributedElementImpl.java
(added)
+++
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheDistributedElementImpl.java
Mon Feb 19 10:25:30 2007
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.cache.impl;
+
+import java.io.Serializable;
+
+import net.sf.ehcache.Element;
+
+import org.apache.jetspeed.cache.DistributedCacheElement;
+import org.apache.jetspeed.cache.DistributedCacheObject;
+
+
+public class EhCacheDistributedElementImpl implements DistributedCacheElement
+{
+ Element element;
+
+ public EhCacheDistributedElementImpl(Element element)
+ {
+ this.element = element;
+ }
+
+ public EhCacheDistributedElementImpl(Serializable key,
DistributedCacheObject value)
+ {
+ this.element = new Element(key,value);
+
+ }
+
+
+ public Object getKey()
+ {
+ return element.getObjectKey();
+ }
+
+
+ public DistributedCacheObject getContent()
+ {
+ return (DistributedCacheObject)element.getObjectValue();
+ }
+
+ public int getTimeToIdleSeconds()
+ {
+ return element.getTimeToIdle();
+ }
+
+ public int getTimeToLiveSeconds()
+ {
+ return element.getTimeToLive();
+ }
+
+ public boolean isEternal()
+ {
+ return element.isEternal();
+ }
+
+ public Element getImplElement()
+ {
+ return element;
+ }
+
+ public void setEternal(boolean eternal)
+ {
+ element.setEternal(eternal);
+ }
+
+ public void setTimeToIdleSeconds(int timeToIdle)
+ {
+ element.setTimeToIdle(timeToIdle);
+ }
+
+ public void setTimeToLiveSeconds(int timeToLive)
+ {
+ element.setTimeToLive(timeToLive);
+ }
+
+ public void notifyChange(int action)
+ {
+ getContent().notifyChange(action);
+ }
+
+
+}
Added:
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheDistributedImpl.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheDistributedImpl.java?view=auto&rev=509287
==============================================================================
---
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheDistributedImpl.java
(added)
+++
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheDistributedImpl.java
Mon Feb 19 10:25:30 2007
@@ -0,0 +1,242 @@
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.cache.impl;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.CacheException;
+import net.sf.ehcache.Ehcache;
+import net.sf.ehcache.Element;
+import net.sf.ehcache.event.CacheEventListener;
+import net.sf.ehcache.event.RegisteredEventListeners;
+
+import org.apache.jetspeed.cache.DistributedCacheElement;
+import org.apache.jetspeed.cache.DistributedCacheObject;
+import org.apache.jetspeed.cache.DistributedJetspeedCache;
+import org.apache.jetspeed.cache.JetspeedCacheEventListener;
+
+public class EhCacheDistributedImpl implements DistributedJetspeedCache,
CacheEventListener
+{
+ private Cache ehcache;
+ private Map refList = Collections.synchronizedMap(new HashMap());
+ protected List listeners = new ArrayList();
+
+ public EhCacheDistributedImpl(Cache ehcache)
+ {
+ this.ehcache = ehcache;
+ RegisteredEventListeners listeners = ehcache
+ .getCacheEventNotificationService();
+ listeners.registerListener(this);
+
+ }
+
+ public DistributedCacheElement get(Serializable key)
+ {
+ Element element = ehcache.get(key);
+ if (element == null)
+ return null;
+ return new EhCacheDistributedElementImpl(element);
+ }
+
+ public void clear()
+ {
+ ehcache.removeAll();
+ }
+ public int getTimeToIdleSeconds()
+ {
+ return (int) ehcache.getTimeToIdleSeconds();
+ }
+
+ public int getTimeToLiveSeconds()
+ {
+ return (int) ehcache.getTimeToLiveSeconds();
+ }
+
+ public boolean isKeyInCache(Serializable key)
+ {
+ return ehcache.isKeyInCache(key);
+ }
+
+ public void put(DistributedCacheElement element)
+ {
+ EhCacheDistributedElementImpl impl =
(EhCacheDistributedElementImpl) element;
+ ehcache.put(impl.getImplElement());
+ refList.put(impl.getKey(), impl);
+ }
+
+ public DistributedCacheElement createElement(Serializable key,
DistributedCacheObject content)
+ {
+ return new EhCacheDistributedElementImpl(key, content);
+ }
+
+ public boolean remove(Serializable key)
+ {
+ Element element = ehcache.get(key);
+ refList.remove(key);
+ if (element == null)
+ return false;
+ return ehcache.remove(key);
+ }
+
+ public boolean removeQuiet(Object key)
+ {
+ Element element = ehcache.get(key);
+ refList.remove(key);
+ if (element == null)
+ return false;
+ return ehcache.removeQuiet(key);
+
+ }
+
+ public void evictContentForUser(String user)
+ {
+ return;
+ }
+
+ public String createCacheKey(String primary, String secondary)
+ {
+ return primary;
+ }
+
+ public Object clone() throws CloneNotSupportedException
+ {
+ return null;
+ }
+
+ public void dispose()
+ {
+ if (refList != null)
+ {
+ Map temp = refList;
+ refList = null;
+ temp.clear();
+ }
+ else
+ return;
+ if (this.ehcache != null)
+ {
+ ehcache = null;
+ }
+ }
+
+ public void addEventListener(JetspeedCacheEventListener listener)
+ {
+ listeners.add(listener);
+ }
+
+ public void removeEventListener(JetspeedCacheEventListener listener)
+ {
+ listeners.remove(listener);
+ }
+
+
+ public void notifyElement(Element arg1, int action)
+ {
+ try
+ {
+ EhCacheDistributedElementImpl e =
(EhCacheDistributedElementImpl) refList
+ .get(arg1.getKey());
+ if (e != null)
+ {
+ if (action < 0)
+ refList.remove(arg1.getKey());
+ e.notifyChange(action);
+ }
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void notifyElementEvicted(Ehcache cache, Element arg1)
+ {
+ try
+ {
+ notifyElement(arg1,
DistributedCacheElement.ActionEvicted);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void notifyElementExpired(Ehcache cache, Element arg1)
+ {
+ try
+ {
+ notifyElement(arg1,
DistributedCacheElement.ActionExpired);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void notifyElementPut(Ehcache cache, Element arg1)
+ throws CacheException
+ {
+ try
+ {
+ notifyElement(arg1,
DistributedCacheElement.ActionAdded);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void notifyElementRemoved(Ehcache cache, Element arg1)
+ throws CacheException
+ {
+ try
+ {
+ EhCacheDistributedElementImpl e =
(EhCacheDistributedElementImpl) refList
+ .get(arg1.getKey());
+ if (e != null)
+ {
+ refList.remove(arg1.getKey());
+
e.notifyChange(DistributedCacheElement.ActionRemoved);
+ }
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void notifyElementUpdated(Ehcache cache, Element arg1)
+ throws CacheException
+ {
+ try
+ {
+ notifyElement(arg1,
DistributedCacheElement.ActionChanged);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ public void notifyRemoveAll(Ehcache cache)
+ {
+// if (ehcache == cache)
+// System.out.println("notifyRemoveAll cache=" +
cache.getName());
+// else
+// System.out.println("NOT MINE notifyRemoveAll cache="
+// + cache.getName());
+ }
+
+}
Added:
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheEventListener.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheEventListener.java?view=auto&rev=509287
==============================================================================
---
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheEventListener.java
(added)
+++
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheEventListener.java
Mon Feb 19 10:25:30 2007
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.cache.impl;
+
+import net.sf.ehcache.CacheException;
+import net.sf.ehcache.Ehcache;
+import net.sf.ehcache.Element;
+import net.sf.ehcache.event.CacheEventListener;
+
+public class EhCacheEventListener implements CacheEventListener
+{
+
+ public Object clone() throws CloneNotSupportedException
+ {
+ return null;
+ }
+
+
+ public void dispose()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void notifyElementEvicted(Ehcache cache, Element arg1)
+ {
+// System.out.println("notifyElementEvicted cache=" +
cache.getName() + " - element = " + arg1.getObjectKey().toString());
+
+ }
+
+ public void notifyElementExpired(Ehcache cache, Element arg1)
+ {
+// System.out.println("notifyElementExpired cache=" +
cache.getName() + " - element = " + arg1.getObjectKey().toString());
+
+ }
+
+ public void notifyElementPut(Ehcache cache, Element arg1)
+ throws CacheException
+ {
+// System.out.println("notifyElementPut cache=" + cache.getName()
+ " - element = " + arg1.getObjectKey().toString());
+
+ }
+
+ public void notifyElementRemoved(Ehcache cache, Element arg1)
+ throws CacheException
+ {
+// System.out.println("notifyElementRemoved cache=" +
cache.getName() + " - element = " + arg1.getObjectKey().toString());
+
+ }
+
+ public void notifyElementUpdated(Ehcache cache, Element arg1)
+ throws CacheException
+ {
+// System.out.println("notifyElementUpdated cache=" +
cache.getName() + " - element = " + arg1.getObjectKey().toString());
+ }
+
+ public void notifyRemoveAll(Ehcache cache)
+ {
+// System.out.println("notifyRemoveAll cache=" + cache.getName() );
+ }
+
+}
Added:
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheEventListenerFactory.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheEventListenerFactory.java?view=auto&rev=509287
==============================================================================
---
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheEventListenerFactory.java
(added)
+++
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhCacheEventListenerFactory.java
Mon Feb 19 10:25:30 2007
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.cache.impl;
+
+import java.util.Properties;
+
+import net.sf.ehcache.event.CacheEventListener;
+import net.sf.ehcache.event.CacheEventListenerFactory;
+
+public class EhCacheEventListenerFactory extends CacheEventListenerFactory
+{
+
+ public EhCacheEventListenerFactory()
+ {
+ // TODO Auto-generated constructor stub
+ }
+
+ public CacheEventListener createCacheEventListener(Properties arg0)
+ {
+ return new EhCacheEventListener();
+ }
+
+}
Added:
portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java?view=auto&rev=509287
==============================================================================
---
portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java
(added)
+++
portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/NodeImplProxy.java
Mon Feb 19 10:25:30 2007
@@ -0,0 +1,170 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS"
+ * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jetspeed.prefs.impl;
+
+
+import java.sql.Timestamp;
+import java.util.Collection;
+
+import org.apache.jetspeed.prefs.om.Node;
+
+public class NodeImplProxy implements Node
+{
+ private Node node = null;
+ private boolean dirty = false;
+ private static PersistenceBrokerPreferencesProvider provider;
+
+
+ protected Object clone() throws CloneNotSupportedException
+ {
+ return super.clone();
+ }
+
+ public Timestamp getCreationDate()
+ {
+ return getNode().getCreationDate();
+ }
+
+ public String getFullPath()
+ {
+ return getNode().getFullPath();
+ }
+
+ public Timestamp getModifiedDate()
+ {
+ return getNode().getModifiedDate();
+ }
+
+ public long getNodeId()
+ {
+ return getNode().getNodeId();
+ }
+
+ public Collection getNodeKeys()
+ {
+ return getNode().getNodeKeys();
+ }
+
+ public String getNodeName()
+ {
+ return getNode().getNodeName();
+ }
+
+ public Collection getNodeProperties()
+ {
+ return getNode().getNodeProperties();
+ }
+
+ public int getNodeType()
+ {
+ return getNode().getNodeType();
+ }
+
+ public Long getParentNodeId()
+ {
+ return getNode().getParentNodeId();
+ }
+
+ public void setCreationDate(Timestamp creationDate)
+ {
+ getNode().setCreationDate(creationDate);
+ }
+
+ public void setFullPath(String fullPath)
+ {
+ getNode().setFullPath(fullPath);
+ }
+
+ public void setModifiedDate(Timestamp modifiedDate)
+ {
+ getNode().setModifiedDate(modifiedDate);
+ }
+
+ public void setNodeId(long nodeId)
+ {
+ getNode().setNodeId(nodeId);
+ }
+
+ public void setNodeKeys(Collection nodeKeys)
+ {
+ getNode().setNodeKeys(nodeKeys);
+ }
+
+ public void setNodeName(String nodeName)
+ {
+ getNode().setNodeName(nodeName);
+
+ }
+
+ public void setNodeProperties(Collection nodeProperties)
+ {
+ getNode().setNodeProperties(nodeProperties);
+ }
+
+ public void setNodeType(int nodeType)
+ {
+ getNode().setNodeType(nodeType);
+ }
+
+ public void setParentNodeId(Long parentNodeId)
+ {
+ getNode().setParentNodeId(parentNodeId);
+ }
+
+ public NodeImplProxy(Node node)
+ {
+ this.node = node;
+ }
+
+ public static void setProvider(PersistenceBrokerPreferencesProvider p)
+ {
+ provider = p;
+ }
+
+ public Node getNode()
+ {
+ if (dirty)
+ reset();
+ return node;
+ }
+
+
+ protected void invalidate()
+ {
+ this.dirty = true;
+ }
+
+ public void setNode(Node node)
+ {
+ this.node = node;
+ }
+ protected void reset()
+ {
+ try
+ {
+ provider.redoNode(this,node.getFullPath(), node.getNodeType());
+ dirty = false;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ node = null;
+ }
+ }
+
+
+}
Modified:
portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java?view=diff&rev=509287&r1=509286&r2=509287
==============================================================================
---
portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java
(original)
+++
portals/jetspeed-2/trunk/components/prefs/src/java/org/apache/jetspeed/prefs/impl/PersistenceBrokerPreferencesProvider.java
Mon Feb 19 10:25:30 2007
@@ -15,11 +15,14 @@
*/
package org.apache.jetspeed.prefs.impl;
-import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.Iterator;
+import java.util.Vector;
-import org.apache.jetspeed.cache.CacheElement;
-import org.apache.jetspeed.cache.JetspeedCache;
+import org.apache.jetspeed.cache.DistributedCacheElement;
+import org.apache.jetspeed.cache.DistributedCacheObject;
+import org.apache.jetspeed.cache.DistributedJetspeedCache;
import org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport;
import org.apache.jetspeed.prefs.FailedToCreateNodeException;
import org.apache.jetspeed.prefs.NodeAlreadyExistsException;
@@ -43,72 +46,47 @@
PreferencesProvider
{
- private static class NodeCache implements Serializable
+ private static class NodeCache implements DistributedCacheObject
{
/** The serial uid. */
private static final long serialVersionUID = 1853381807991868844L;
+ NodeImplProxy node = null;
+ String key = null;;
+ Collection children = null;;
- Node node;
-
- String fullpath;
-
- int type;
-
- boolean childrenLoaded;
-
- Collection children;
-
- public NodeCache(Node node)
+ public NodeCache(NodeImplProxy node)
{
- // System.out.println(this.getClass().getName() + "-" + "NodeCache (node)" +
node.getFullPath());
+ // System.out.println(this.getClass().getName() + "-" + "NodeCache
(node)" + node.getFullPath());
this.node = node;
- this.fullpath = node.getFullPath();
- this.type = node.getNodeType();
+ this.key = node.getFullPath() + "-" + node.getNodeType();
}
public NodeCache(String fullpath, int type)
{
// System.out.println(this.getClass().getName() + "-" + "NodeCache
- fullpath=" + fullpath);
- this.fullpath = fullpath;
- this.type = type;
+ this.key = fullpath + "-" + type;
}
public boolean isChildrenLoaded()
{
// System.out.println(this.getClass().getName() + "-" +
"isChildrenLoaded");
- return childrenLoaded;
+ return children != null;
}
- public void setChildrenLoaded(boolean childrenLoaded)
- {
- // System.out.println(this.getClass().getName() + "-" +
"setChildrenLoaded");
- this.childrenLoaded = childrenLoaded;
- }
- public String getFullpath()
- {
- // System.out.println(this.getClass().getName() + "-" +
"getFullpath=" + fullpath);
- return fullpath;
- }
- public Node getNode()
+ public NodeImplProxy getNode()
{
// System.out.println(this.getClass().getName() + "-" + "getNode="
+ node.getFullPath());
return node;
}
- public void setNode(Node node)
+ public void setNode(NodeImplProxy node)
{
// System.out.println(this.getClass().getName() + "-" +
"setFullpath=" + node.getFullPath());
this.node = node;
}
- public int getType()
- {
- // System.out.println(this.getClass().getName() + "-" + "getType="
);
- return type;
- }
-
public Collection getChildren()
{
// System.out.println(this.getClass().getName() + "-" +
"getCHildren=" );
@@ -118,7 +96,7 @@
public void setChildren(Collection children)
{
// System.out.println(this.getClass().getName() + "-" +
"setChildren=" );
- this.children = children;
+ this.children = children;
}
public boolean equals(Object obj)
@@ -126,23 +104,64 @@
if (obj != null && obj instanceof NodeCache)
{
NodeCache other = (NodeCache) obj;
- return fullpath.equals(other.fullpath) && type == other.type;
+ return getKey().equals(other.getKey());
}
return false;
}
public int hashCode()
{
- return fullpath.hashCode() + type;
+ return getKey().hashCode();
}
public String getCacheKey()
{
- return fullpath + "-" + type;
+ return getKey();
}
+
+ public String getKey()
+ {
+ return key;
+ }
+
+
+ public void notifyChange(int action)
+ {
+
+ switch (action)
+ {
+ case DistributedCacheElement.ActionAdded:
+ //System.out.println("CacheObject Added
=" + this.getKey());
+ break;
+ case DistributedCacheElement.ActionChanged:
+ //System.out.println("CacheObject
Changed =" + this.getKey());
+ if (this.node != null)
+ this.node.invalidate();
+ break;
+ case DistributedCacheElement.ActionRemoved:
+ //System.out.println("CacheObject
Removed =" + this.getKey());
+ if (this.node != null)
+ this.node.invalidate();
+ break;
+ case DistributedCacheElement.ActionEvicted:
+ //System.out.println("CacheObject
Evicted =" + this.getKey());
+ if (this.node != null)
+ this.node.invalidate();
+ break;
+ case DistributedCacheElement.ActionExpired:
+ //System.out.println("CacheObject
Expired =" + this.getKey());
+ if (this.node != null)
+ this.node.invalidate();
+ break;
+ default:
+ //System.out.println("CacheObject -
UNKOWN OPRERATION =" + this.getKey());
+ return;
+ }
+ return;
+ }
}
- private JetspeedCache preferenceCache;
+ private DistributedJetspeedCache preferenceCache;
/**
@@ -160,6 +179,7 @@
throws ClassNotFoundException
{
super(repositoryPath);
+ NodeImplProxy.setProvider(this);
}
/**
@@ -173,16 +193,16 @@
* if the <code>prefsFactoryImpl</code> argument does not
reperesent a Class that exists in the
* current classPath.
*/
- public PersistenceBrokerPreferencesProvider(String repositoryPath,
JetspeedCache preferenceCache)
+ public PersistenceBrokerPreferencesProvider(String repositoryPath,
DistributedJetspeedCache preferenceCache)
throws ClassNotFoundException
{
- super(repositoryPath);
+ this(repositoryPath);
this.preferenceCache = preferenceCache;
}
protected void addToCache(NodeCache content)
{
- CacheElement cachedElement =
preferenceCache.createElement(content.getCacheKey(), content);
+ DistributedCacheElement cachedElement =
preferenceCache.createElement(content.getCacheKey(), content);
cachedElement.setTimeToIdleSeconds(preferenceCache.getTimeToIdleSeconds());
cachedElement.setTimeToLiveSeconds(preferenceCache.getTimeToLiveSeconds());
preferenceCache.put(cachedElement);
@@ -190,18 +210,15 @@
private NodeCache getNode(String cacheKey)
{
- CacheElement cachedElement = preferenceCache.get(cacheKey);
+ DistributedCacheElement cachedElement = preferenceCache.get(cacheKey);
if (cachedElement != null)
return (NodeCache)cachedElement.getContent();
return null;
}
+
- /**
- * @see
org.apache.jetspeed.prefs.PreferencesProvider#getNode(java.lang.String, int)
- */
public Node getNode(String fullPath, int nodeType) throws
NodeDoesNotExistException
{
-
NodeCache key = new NodeCache(fullPath, nodeType);
NodeCache hit = getNode(key.getCacheKey());
if (hit != null)
@@ -217,8 +234,34 @@
Node nodeObj = (Node)
getPersistenceBrokerTemplate().getObjectByQuery(query);
if (null != nodeObj)
{
- addToCache(new NodeCache(nodeObj));
- return nodeObj;
+ NodeImplProxy proxy = new NodeImplProxy(nodeObj);
+ addToCache(new NodeCache(proxy));
+ return proxy;
+
+ }
+ else
+ {
+ throw new NodeDoesNotExistException("No node of type " + nodeType
+ "found at path: " + fullPath);
+ }
+ }
+ /**
+ * @see
org.apache.jetspeed.prefs.PreferencesProvider#getNode(java.lang.String, int)
+ */
+ public void redoNode(NodeImplProxy proxy, String fullPath, int nodeType)
throws NodeDoesNotExistException
+ {
+
+ Criteria c = new Criteria();
+ c.addEqualTo("fullPath", fullPath);
+ c.addEqualTo("nodeType", new Integer(nodeType));
+ Query query = QueryFactory.newQuery(NodeImpl.class, c);
+
+ Node nodeObj = (Node)
getPersistenceBrokerTemplate().getObjectByQuery(query);
+ if (null != nodeObj)
+ {
+ proxy.setNode(nodeObj);
+ NodeCache cn = new NodeCache(nodeObj.getFullPath(),
nodeObj.getNodeType());
+ cn.setNode(proxy);
+ addToCache(cn);
}
else
{
@@ -231,12 +274,22 @@
*/
public boolean nodeExists(String fullPath, int nodeType)
{
- try
+ NodeCache key = new NodeCache(fullPath, nodeType);
+ if (preferenceCache.isKeyInCache(key))
+ return true;
+ Criteria c = new Criteria();
+ c.addEqualTo("fullPath", fullPath);
+ c.addEqualTo("nodeType", new Integer(nodeType));
+ Query query = QueryFactory.newQuery(NodeImpl.class, c);
+
+ Node nodeObj = (Node)
getPersistenceBrokerTemplate().getObjectByQuery(query);
+ if (null != nodeObj)
{
- getNode(fullPath, nodeType);
+ NodeImplProxy proxy = new NodeImplProxy(nodeObj);
+ addToCache(new NodeCache(proxy));
return true;
}
- catch (NodeDoesNotExistException e)
+ else
{
return false;
}
@@ -265,8 +318,9 @@
try
{
getPersistenceBrokerTemplate().store(nodeObj);
- addToCache(new NodeCache(nodeObj));
- return nodeObj;
+ NodeImplProxy proxy = new NodeImplProxy(nodeObj);
+ addToCache(new NodeCache(proxy));
+ return proxy;
}
catch (Exception e)
{
@@ -282,38 +336,97 @@
*/
public Collection getChildren(Node parentNode)
{
- NodeCache key = new NodeCache(parentNode);
+ NodeCache key = new NodeCache(parentNode.getFullPath(),
parentNode.getNodeType());
+
NodeCache hit = getNode(key.getCacheKey());
if (hit == null)
{
-
- key.setNode(parentNode);
- addToCache(key);
- hit = key;
+ NodeImplProxy proxy = new NodeImplProxy(parentNode);
+ hit = new NodeCache(proxy);
+ addToCache(hit);
}
if (hit.isChildrenLoaded())
{
- return hit.getChildren();
+ return resolveChildren(hit.getChildren());
}
Criteria c = new Criteria();
c.addEqualTo("parentNodeId", new Long(parentNode.getNodeId()));
Query query = QueryFactory.newQuery(NodeImpl.class, c);
Collection children =
getPersistenceBrokerTemplate().getCollectionByQuery(query);
- hit.setChildren(children);
+ hit.setChildren(cacheChildren(children));
// null or not
- hit.setChildrenLoaded(true);
return children;
}
+
+ private Collection resolveChildren(Collection children)
+ {
+ if (children == null)
+ return null;
+ try
+ {
+ Iterator it = children.iterator();
+ Vector v = new Vector();
+ while (it.hasNext())
+ {
+ String s = (String) it.next();
+ NodeCache hit =getNode(s);
+ if (hit != null)
+ v.add(hit.getNode());
+ }
+ return v;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+
+ private Collection cacheChildren(Collection children)
+ {
+ Iterator it = children.iterator();
+ Vector v = new Vector();
+ while (it.hasNext())
+ {
+ Node key = (Node)it.next();
+ NodeCache nodeKey = new
NodeCache(key.getFullPath(),key.getNodeType());
+ NodeCache hit = getNode(nodeKey.getCacheKey());
+ if (hit == null)
+ {
+ NodeImplProxy proxy = new NodeImplProxy(key);
+ nodeKey.setNode(proxy);
+ addToCache(nodeKey);
+ hit= nodeKey;
+ }
+ v.add(hit.getCacheKey());
+ }
+ return v;
+ }
+
/**
* @see
org.apache.jetspeed.prefs.PreferencesProvider#storeNode(org.apache.jetspeed.prefs.om.Node)
*/
public void storeNode(Node node)
{
- NodeCache key = new NodeCache(node);
+ NodeImplProxy hit = null;
+ if (node instanceof NodeImplProxy)
+ {
+ hit = (NodeImplProxy)node;
+ }
+ else
+ {
+ //System.out.println("WARNING!!!!STORE NODE!!!!!!!!!!!! -
Illegal Node element passed");
+ hit = new NodeImplProxy(node);
+ }
+
+ NodeCache key = new NodeCache(hit);
+ getPersistenceBrokerTemplate().store(hit.getNode()); // avoid racing
condition with the db and with cluster notification
+
// do the db first
preferenceCache.remove(key.getCacheKey()); // not sure we should
actually do that, could also just update the node
- getPersistenceBrokerTemplate().store(node);
+ addToCache(key);
}
/**
@@ -321,18 +434,45 @@
*/
public void removeNode(Node parentNode, Node node)
{
- NodeCache key = new NodeCache(node);
+ NodeImplProxy hit = null;
+ NodeImplProxy parentHit = null;
+
+ if (node instanceof NodeImplProxy)
+ {
+
getPersistenceBrokerTemplate().delete(((NodeImplProxy)node).getNode());
//avoid race conditions - do this first
+ }
+ else
+ getPersistenceBrokerTemplate().delete(node); //avoid race
conditions - do this first
+
+ if (node instanceof NodeImplProxy)
+ {
+ hit = (NodeImplProxy)node;
+ }
+ else
+ {
+ //System.out.println("WARNING!!!!REMOVE NODE!!!!!!!!!!!! -
Illegal Node element passed");
+ hit = new NodeImplProxy(node);
+ }
+ NodeCache key = new NodeCache(hit);
preferenceCache.remove(key.getCacheKey());
if ( parentNode != null )
{
- key = new NodeCache(parentNode);
- NodeCache hit = getNode(key.getCacheKey());
- if ( hit != null && hit.isChildrenLoaded() )
+ if (parentNode instanceof NodeImplProxy)
+ {
+ parentHit = (NodeImplProxy)parentNode;
+ }
+ else
+ {
+ //System.out.println("WARNING!!!!REMOVE
NODE!!!!!!!!!!!! - Illegal Node element passed");
+ parentHit = new NodeImplProxy(parentNode);
+ }
+ NodeCache parentKey = new NodeCache(parentHit);
+ parentKey = getNode(parentKey.getCacheKey());
+ if ( parentKey != null && parentKey.isChildrenLoaded() )
{
- hit.getChildren().remove(node);
+ parentKey.getChildren().remove(key.getCacheKey());
}
}
- getPersistenceBrokerTemplate().delete(node);
}
/**
@@ -355,6 +495,24 @@
}
Query query = QueryFactory.newQuery(NodeImpl.class, c);
Collection children =
getPersistenceBrokerTemplate().getCollectionByQuery(query);
- return children;
+ Collection proxied = new ArrayList();
+ Iterator iter = children.iterator();
+ while (iter.hasNext())
+ {
+ NodeImpl node = (NodeImpl)iter.next();
+ NodeCache key = new NodeCache(node.getFullPath(),
node.getNodeType());
+ NodeCache hit = getNode(key.getCacheKey());
+ if (hit == null)
+ {
+ NodeImplProxy proxy = new NodeImplProxy(node);
+ addToCache(new NodeCache(proxy));
+ proxied.add(proxy);
+ }
+ else
+ {
+ proxied.add(hit.getNode());
+ }
+ }
+ return proxied;
}
}
Modified:
portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/preference/impl/PrefsPreferenceSetImpl.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/preference/impl/PrefsPreferenceSetImpl.java?view=diff&rev=509287&r1=509286&r2=509287
==============================================================================
---
portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/preference/impl/PrefsPreferenceSetImpl.java
(original)
+++
portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/preference/impl/PrefsPreferenceSetImpl.java
Mon Feb 19 10:25:30 2007
@@ -21,6 +21,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import java.util.Vector;
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;
@@ -214,17 +215,13 @@
{
try
{
- if (prefsRootNode.nodeExists(key))
- {
- Preferences nodeToRemove = prefsRootNode.node(key);
- PrefsPreference pref = new PrefsPreference(nodeToRemove, key);
- nodeToRemove.removeNode();
- return pref;
- }
- else
- {
- return null;
- }
+ Preferences nodeToRemove = prefsRootNode.node(key);
+
+ if (nodeToRemove == null)
+ return null;
+ PrefsPreference pref = new PrefsPreference(nodeToRemove, key);
+ nodeToRemove.removeNode();
+ return pref;
}
catch (BackingStoreException e)
{
@@ -305,7 +302,7 @@
protected class PortletPrefsIterator implements Iterator
{
- int beginSize;
+ int beginSize = 0;
int pointer;
String[] childrenNames;
protected PrefsPreference currentPref;
@@ -315,25 +312,35 @@
super();
try
{
- beginSize = size();
childrenNames = prefsRootNode.childrenNames();
+ if (childrenNames != null)
+ beginSize = childrenNames.length;
+
if(defaults != null)
{
+ Vector v = new Vector();
+
Iterator itr = defaults.getNames().iterator();
while( itr.hasNext())
{
String name = (String) itr.next();
if(!arrayContains(childrenNames, name))
{
- String[] tempArray = new
String[childrenNames.length+1];
- System.arraycopy(childrenNames, 0, tempArray, 0,
childrenNames.length);
- tempArray[(tempArray.length-1)] = name;
- childrenNames = tempArray;
- }
+ v.add(name);
+ }
+ }
+ int j = v.size();
+ if (j>0)
+ {
+ int i = childrenNames.length;
+ String[] tempArray = new String[j+i];
+ System.arraycopy(childrenNames, 0, tempArray, 0, i);
+ for (int x = 0; x < j; x++)
+ tempArray[i+x] = (String)v.get(x);
+ childrenNames = tempArray;
+ beginSize = i+j;
}
}
-
-
pointer = 0;
}
catch (IllegalStateException ise)
@@ -361,11 +368,14 @@
*/
public boolean hasNext()
{
- if (beginSize != size())
- {
- throw new ConcurrentModificationException("Underlying
PreferenceSet has changed.");
- }
- return pointer < beginSize;
+ try
+ {
+ return pointer < beginSize;
+ }
+ catch (Exception e)
+ {
+ throw new ConcurrentModificationException("Underlying
PreferenceSet has changed.");
+ }
}
/**
@@ -378,14 +388,16 @@
*/
public Object next()
{
- if (beginSize != size())
- {
- throw new ConcurrentModificationException("Underlying
PreferenceSet has changed.");
- }
-
- currentPref = (PrefsPreference) get(childrenNames[pointer]);
- pointer++;
- return currentPref;
+ try
+ {
+ currentPref = (PrefsPreference) get(childrenNames[pointer]);
+ pointer++;
+ return currentPref;
+ }
+ catch (Exception e)
+ {
+ throw new ConcurrentModificationException("Underlying
PreferenceSet has changed.");
+ }
}
/**
@@ -404,7 +416,7 @@
}
PrefsPreferenceSetImpl.this.remove(currentPref);
- beginSize = size();
+ beginSize--;
}
}
Modified: portals/jetspeed-2/trunk/etc/db-ojb/ehcache.xml
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/etc/db-ojb/ehcache.xml?view=diff&rev=509287&r1=509286&r2=509287
==============================================================================
--- portals/jetspeed-2/trunk/etc/db-ojb/ehcache.xml (original)
+++ portals/jetspeed-2/trunk/etc/db-ojb/ehcache.xml Mon Feb 19 10:25:30 2007
@@ -329,15 +329,21 @@
memoryStoreEvictionPolicy="LFU"
/>
- <cache name="preferencesCache"
+ <cache name="preferencesCache"
maxElementsInMemory="10000"
maxElementsOnDisk="1000"
eternal="false"
overflowToDisk="false"
timeToIdleSeconds="28800"
timeToLiveSeconds="28800"
- memoryStoreEvictionPolicy="LFU"
- />
+ memoryStoreEvictionPolicy="LFU">
+ <cacheEventListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
+ properties="replicateAsynchronously=false, replicatePuts=false,
+ replicateUpdates=true,
replicateUpdatesViaCopy=false,
+ replicateRemovals=true"/>
+ </cache>
+
<cache name="portletApplicationOidCache"
maxElementsInMemory="500"
Added:
portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/DistributedCacheElement.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/DistributedCacheElement.java?view=auto&rev=509287
==============================================================================
---
portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/DistributedCacheElement.java
(added)
+++
portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/DistributedCacheElement.java
Mon Feb 19 10:25:30 2007
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.cache;
+
+
+
+/**
+ * <p>
+ * Provides interface to cached elements
+ * Abstraction around atual cache implementation
+ * </p>
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public interface DistributedCacheElement
+{
+ public static int ActionAdded = 1;
+ public static int ActionChanged = 2;
+ public static int ActionRemoved = -1;
+ public static int ActionEvicted = -2;
+ public static int ActionExpired = -3;
+
+ /**
+ *
+ * @return the idle time in seconds for this cache element
+ */
+ int getTimeToIdleSeconds();
+
+ /**
+ *
+ * @return the idle time in seconds for this cache element
+ */
+ int getTimeToLiveSeconds();
+
+ void setTimeToLiveSeconds(int timeToLive);
+
+ void setTimeToIdleSeconds(int timeToIdle);
+
+ DistributedCacheObject getContent();
+
+ Object getKey();
+
+ boolean isEternal();
+
+ void setEternal(boolean eternal);
+
+ void notifyChange(int action);
+
+}
\ No newline at end of file
Added:
portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/DistributedCacheObject.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/DistributedCacheObject.java?view=auto&rev=509287
==============================================================================
---
portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/DistributedCacheObject.java
(added)
+++
portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/DistributedCacheObject.java
Mon Feb 19 10:25:30 2007
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.cache;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * Provides interface to the object referenced in the cached Element
+ * Abstraction around atual cache implementation
+ * </p>
+ *
+ * @author
+ * @version $Id: $
+ */
+public interface DistributedCacheObject extends Serializable
+{
+ public void notifyChange(int action);
+
+}
Added:
portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/DistributedJetspeedCache.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/DistributedJetspeedCache.java?view=auto&rev=509287
==============================================================================
---
portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/DistributedJetspeedCache.java
(added)
+++
portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/cache/DistributedJetspeedCache.java
Mon Feb 19 10:25:30 2007
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.cache;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * Provides interface to Jetspeed for cache related activities
+ * Abstraction around actual cache implementation
+ * </p>
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public interface DistributedJetspeedCache
+{
+ /**
+ * Retrieve an object from the cache
+ *
+ * @param key The key used to find the object
+ * @return the found object or null
+ */
+ DistributedCacheElement get(Serializable key);
+
+ /**
+ * clear all content in the cache
+ *
+ */
+ void clear();
+
+ /**
+ * Put an object into the cache, adding it, or replacing if exists
+ * @param object
+ */
+ void put(DistributedCacheElement object);
+
+ /**
+ * Create a cached element
+ *
+ * @param key
+ * @param content
+ * @return
+ */
+ DistributedCacheElement createElement(Serializable key,
DistributedCacheObject content);
+
+ boolean isKeyInCache(Serializable key);
+
+ /**
+ * Remove an object from the cache
+ * @param key
+ * @return true if the object was removed, false otherwise
+ */
+ boolean remove(Serializable key);
+
+ /**
+ *
+ * @return the default idle time in seconds for this cache
+ */
+ int getTimeToIdleSeconds();
+
+ /**
+ *
+ * @return the default idle time in seconds for this cache
+ */
+ int getTimeToLiveSeconds();
+
+ /**
+ * Evict all cached content for the given user
+ *
+ * @param user
+ */
+ void evictContentForUser(String user);
+
+ /**
+ * Create a cache key from a primary segment and secondary segment
+ *
+ * @param primary
+ * @param secondary
+ * @return
+ */
+ String createCacheKey(String primary, String secondary);
+
+ /**
+ * Add a cache listener for supported cache events
+ *
+ * @param listener
+ */
+ void addEventListener(JetspeedCacheEventListener listener);
+
+ void removeEventListener(JetspeedCacheEventListener listener);
+}
\ No newline at end of file
Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/cache.xml
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/cache.xml?view=diff&rev=509287&r1=509286&r2=509287
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/cache.xml (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/cache.xml Mon Feb 19
10:25:30 2007
@@ -45,7 +45,7 @@
<property name="cacheName" value="preferencesCache"/>
</bean>
-<bean id="preferencesCache" class="org.apache.jetspeed.cache.impl.EhCacheImpl">
+<bean id="preferencesCache"
class="org.apache.jetspeed.cache.impl.EhCacheDistributedImpl">
<constructor-arg>
<ref bean="ehPreferencesCache"/>
</constructor-arg>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]