mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.0 to HEAD
12795: ALFCOM-2419: ResourceBundleWrapper is no longer (de)serializable after changes merged from 2.1-A rev 8323 12826: Fix for ETHREEOH-37 and ETHREEOH-176. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12828 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -36,13 +36,9 @@ import java.util.Set;
|
||||
* required.
|
||||
*
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public class DynamicNamespacePrefixResolver implements NamespaceService
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = -7721089444629137409L;
|
||||
|
||||
/**
|
||||
* The delegate
|
||||
*/
|
||||
@@ -53,6 +49,7 @@ public class DynamicNamespacePrefixResolver implements NamespaceService
|
||||
*/
|
||||
private HashMap<String, String> map = new HashMap<String, String>();
|
||||
|
||||
|
||||
public DynamicNamespacePrefixResolver(NamespacePrefixResolver delegate)
|
||||
{
|
||||
super();
|
||||
@@ -64,6 +61,7 @@ public class DynamicNamespacePrefixResolver implements NamespaceService
|
||||
this(null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add prefix to name space mapping override
|
||||
*
|
||||
@@ -143,5 +141,4 @@ public class DynamicNamespacePrefixResolver implements NamespaceService
|
||||
uris.addAll(map.keySet());
|
||||
return uris;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@ import org.alfresco.service.PublicService;
|
||||
* @author David Caruana
|
||||
*/
|
||||
@PublicService
|
||||
public interface NamespacePrefixResolver extends Serializable
|
||||
public interface NamespacePrefixResolver
|
||||
{
|
||||
/**
|
||||
* Gets the namespace URI registered for the given prefix
|
||||
@@ -76,5 +76,4 @@ public interface NamespacePrefixResolver extends Serializable
|
||||
*/
|
||||
@Auditable
|
||||
Collection<String> getURIs();
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program 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 General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing
|
||||
*/
|
||||
package org.alfresco.service.namespace;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Provides support for serializable objects such as the QNameMap that require a
|
||||
* NamespacePrefixResolver to be available. Ensures that the objects can remain
|
||||
* serializable themselves and still maintain a valid NamespacePrefixResolver.
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public interface NamespacePrefixResolverProvider extends Serializable
|
||||
{
|
||||
/**
|
||||
* Get an object that implements the NamespacePrefixResolver interface
|
||||
*
|
||||
* @return NamespacePrefixResolver
|
||||
*/
|
||||
NamespacePrefixResolver getNamespacePrefixResolver();
|
||||
}
|
@@ -30,8 +30,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -43,39 +41,47 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
public class QNameMap<K,V> implements Map, Cloneable, Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -6578946123712939601L;
|
||||
private static final long serialVersionUID = -6578946123712939602L;
|
||||
|
||||
protected static Log logger = LogFactory.getLog(QNameMap.class);
|
||||
protected Map<String, Object> contents = new HashMap<String, Object>(16, 1.0f);
|
||||
protected NamespacePrefixResolver resolver = null;
|
||||
protected NamespacePrefixResolverProvider provider = null;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param resolver Mandatory NamespacePrefixResolver helper
|
||||
* @param provider Mandatory NamespacePrefixResolverProvider helper
|
||||
*/
|
||||
public QNameMap(NamespacePrefixResolver resolver)
|
||||
public QNameMap(NamespacePrefixResolverProvider provider)
|
||||
{
|
||||
if (resolver == null)
|
||||
if (provider == null)
|
||||
{
|
||||
throw new IllegalArgumentException("NamespacePrefixResolver is mandatory.");
|
||||
throw new IllegalArgumentException("NamespacePrefixResolverProvider is mandatory.");
|
||||
}
|
||||
this.resolver = resolver;
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for Serialization mechanism
|
||||
*
|
||||
*/
|
||||
protected QNameMap()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Helper to return a NamespacePrefixResolver instance - should -always- be used
|
||||
* rather than holding onto a reference on the heap.
|
||||
*
|
||||
* @return NamespacePrefixResolver
|
||||
*/
|
||||
protected final NamespacePrefixResolver getResolver()
|
||||
{
|
||||
return this.provider.getNamespacePrefixResolver();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.util.Map#size()
|
||||
*/
|
||||
@@ -97,7 +103,7 @@ public class QNameMap<K,V> implements Map, Cloneable, Serializable
|
||||
*/
|
||||
public boolean containsKey(Object key)
|
||||
{
|
||||
return (this.contents.containsKey(QName.resolveToQNameString(resolver, key.toString())));
|
||||
return (this.contents.containsKey(QName.resolveToQNameString(getResolver(), key.toString())));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,7 +119,7 @@ public class QNameMap<K,V> implements Map, Cloneable, Serializable
|
||||
*/
|
||||
public Object get(Object key)
|
||||
{
|
||||
String qnameKey = QName.resolveToQNameString(resolver, key.toString());
|
||||
String qnameKey = QName.resolveToQNameString(getResolver(), key.toString());
|
||||
Object obj = this.contents.get(qnameKey);
|
||||
|
||||
return obj;
|
||||
@@ -124,7 +130,7 @@ public class QNameMap<K,V> implements Map, Cloneable, Serializable
|
||||
*/
|
||||
public Object put(Object key, Object value)
|
||||
{
|
||||
return this.contents.put(QName.resolveToQNameString(resolver, key.toString()), value);
|
||||
return this.contents.put(QName.resolveToQNameString(getResolver(), key.toString()), value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,7 +138,7 @@ public class QNameMap<K,V> implements Map, Cloneable, Serializable
|
||||
*/
|
||||
public Object remove(Object key)
|
||||
{
|
||||
return this.contents.remove(QName.resolveToQNameString(resolver, key.toString()));
|
||||
return this.contents.remove(QName.resolveToQNameString(getResolver(), key.toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,7 +197,7 @@ public class QNameMap<K,V> implements Map, Cloneable, Serializable
|
||||
*/
|
||||
public Object clone()
|
||||
{
|
||||
QNameMap map = new QNameMap(resolver);
|
||||
QNameMap map = new QNameMap(provider);
|
||||
map.putAll(this);
|
||||
|
||||
return map;
|
||||
|
Reference in New Issue
Block a user