Author: chris.laprun(a)jboss.com
Date: 2011-02-02 17:01:52 -0500 (Wed, 02 Feb 2011)
New Revision: 5850
Added:
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/registration/policies/
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/registration/policies/DefaultRegistrationPolicyTestCase.java
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/registration/policies/RegistrationPolicyWrapperTestCase.java
Removed:
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/registration/DefaultRegistrationPolicyTestCase.java
Modified:
components/wsrp/branches/2.0.x/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/RegistrationPolicy.java
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/policies/DefaultRegistrationPolicy.java
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/policies/DefaultRegistrationPropertyValidator.java
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/policies/RegistrationPolicyWrapper.java
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirements.java
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/config/impl/xml/ProducerConfigurationProvider.java
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerConfigurationTestCase.java
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirementsTestCase.java
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/wsrp/producer/config/TestRegistrationPolicy.java
Log:
- GTNWSRP-198: Fixed improper persistence of custom RegistrationPolicy implementations.
Made clearer the fact that RegistrationPolicy instances are wrapped using a
RegistrationPolicyWrapper.
- Will need to update JCR persistence in GateIn.
Modified:
components/wsrp/branches/2.0.x/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java
===================================================================
---
components/wsrp/branches/2.0.x/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java 2011-02-02
21:59:34 UTC (rev 5849)
+++
components/wsrp/branches/2.0.x/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java 2011-02-02
22:01:52 UTC (rev 5850)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -25,6 +25,7 @@
import org.gatein.registration.RegistrationPolicy;
import org.gatein.registration.policies.DefaultRegistrationPolicy;
+import org.gatein.registration.policies.RegistrationPolicyWrapper;
import org.gatein.wsrp.producer.config.ProducerConfiguration;
import org.gatein.wsrp.producer.config.ProducerConfigurationService;
import org.gatein.wsrp.producer.config.ProducerRegistrationRequirements;
@@ -95,7 +96,7 @@
RegistrationPolicy policy = getRegRequirements().getPolicy();
if (policy != null)
{
- return policy.getClass().getName();
+ return policy.getClassName();
}
else
{
@@ -117,7 +118,8 @@
{
if (isDefaultRegistrationPolicy())
{
- return
((DefaultRegistrationPolicy)getRegRequirements().getPolicy()).getValidator().getClass().getName();
+ DefaultRegistrationPolicy policy =
(DefaultRegistrationPolicy)RegistrationPolicyWrapper.unwrap(getRegRequirements().getPolicy());
+ return policy.getValidator().getClass().getName();
}
throw new IllegalStateException("getValidatorClassName shouldn't be called
if we're not using the default registration");
}
@@ -163,14 +165,15 @@
registrationRequirements.setRegistrationRequiredForFullDescription(configuration.isRegistrationRequiredForFullDescription());
registrationRequirements.setRegistrationRequired(configuration.isRegistrationRequired());
- if
(!ProducerRegistrationRequirements.DEFAULT_POLICY_CLASS_NAME.equals(policyClassName))
- {
- registrationRequirements.reloadPolicyFrom(policyClassName,
validatorClassName);
- }
+ registrationRequirements.reloadPolicyFrom(policyClassName, validatorClassName);
registrationRequirements.setRegistrationProperties(configuration.getRegistrationRequirements().getRegistrationProperties());
getConfigurationService().saveConfiguration();
+
+ // force a reload local state
+ registrationConfiguration = null;
+
beanContext.createInfoMessage("bean_producer_save_success");
}
catch (Exception e)
Modified:
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/RegistrationPolicy.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/RegistrationPolicy.java 2011-02-02
21:59:34 UTC (rev 5849)
+++
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/RegistrationPolicy.java 2011-02-02
22:01:52 UTC (rev 5850)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -23,6 +23,7 @@
package org.gatein.registration;
+import org.gatein.pc.api.PortletContext;
import org.gatein.wsrp.registration.PropertyDescription;
import javax.xml.namespace.QName;
@@ -32,6 +33,13 @@
* An interface allowing users of the Registration service to customize different aspects
of how Consumers are handled.
* Methods of this interface are used by RegistrationManager to make appropriate
decisions. Implementations of this
* interface <strong>MUST</strong> provide a no-argument constructor for
instantiation from the class name.
+ * <p/>
+ * <strong>IMPORTANT</strong>: RegistrationPolicy instances are wrapped using
a {@link
+ * org.gatein.registration.policies.RegistrationPolicyWrapper}. As a result, using
<code>instanceof</code> on a
+ * RegistrationPolicy will probably result in unexpected result. To retrieve the actual
class of the RegistrationPolicy
+ * instance in use, use {@link #getRealClass()} (or {@link #getClassName()} to retrieve
the class name). If, for some
+ * reason, the actual RegistrationPolicy instance is needed, use {@link
org.gatein.registration.policies.RegistrationPolicyWrapper#unwrap(RegistrationPolicy)},
+ * though it is not recommended to manipulate actual RegistrationPolicy instances
directly.
*
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision: 11406 $
@@ -122,51 +130,33 @@
void validateConsumerGroupName(String groupName, RegistrationManager manager) throws
IllegalArgumentException, RegistrationException;
/**
- * Checks if a portlet handle belongs to a specific registration.
- * GTNWSRP-72
+ * TODO
*
- * @param registration The registration to check
- * @param portletHandle The portlet handle to use
- * @return True if the registration contains this portlet handle
+ * @param portletContext
+ * @param registration
+ * @param operation
+ * @return
*/
-// boolean checkPortletHandle(Registration registration, String portletHandle);
+ boolean allowAccessTo(PortletContext portletContext, Registration registration, String
operation);
/**
- * Adds a Portlet Handle to a Registration
- * GTNWSRP-72
+ * TODO
*
- * @param registration The registration to use
- * @param portletHandle The portletHandle to add
+ * @return
*/
-// void addPortletHandle(Registration registration, String portletHandle);
+ boolean isWrapped();
/**
- * Removes a portlet handle from a specific registration
- * GTNWSRP-72
+ * TODO
*
- * @param registration The registration to use
- * @param portletHandle The portlet handle to remove
+ * @return
*/
-// void removePortletHandle(Registration registration, String portletHandle);
+ String getClassName();
/**
- * Updates the list of currently available portlet handles.
- * GTNWSRP-72
+ * TODO
*
- * Note: this is not registration specific. This method deals with the situation
where
- * the producer has a change in the available portlets. The RegistrationPolicy needs
to either handle
- * the globally available portlets separately or update each registration when this
type of change occurs.
- *
- * @param portlets
+ * @return
*/
-// void updatePortletHandles(List<String> portlets);
-
- /**
- * Adds a PortletContextChangeListener to the RegistrationPolicy. The
PortletContextChangeListener
- * will be called whenever the portlet contexts within a registration changes.
- * GTNWSRP-72
- *
- * @param listener The listener to add
- */
-// void addPortletContextChangeListener(RegistrationPortletContextChangeListener
listener);
+ Class<? extends RegistrationPolicy> getRealClass();
}
Modified:
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/policies/DefaultRegistrationPolicy.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/policies/DefaultRegistrationPolicy.java 2011-02-02
21:59:34 UTC (rev 5849)
+++
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/policies/DefaultRegistrationPolicy.java 2011-02-02
22:01:52 UTC (rev 5850)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -24,6 +24,7 @@
package org.gatein.registration.policies;
import org.gatein.common.util.ParameterValidation;
+import org.gatein.pc.api.PortletContext;
import org.gatein.registration.Consumer;
import org.gatein.registration.DuplicateRegistrationException;
import org.gatein.registration.InvalidConsumerDataException;
@@ -31,17 +32,14 @@
import org.gatein.registration.RegistrationException;
import org.gatein.registration.RegistrationManager;
import org.gatein.registration.RegistrationPolicy;
-import org.gatein.registration.RegistrationPortletContextChangeListener;
import org.gatein.registration.RegistrationStatus;
import org.gatein.wsrp.registration.PropertyDescription;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.namespace.QName;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -57,12 +55,12 @@
{
private RegistrationPropertyValidator validator;
private static final Logger log =
LoggerFactory.getLogger(DefaultRegistrationPolicy.class);
-
- //Stores a list of the default portlet handles which should be available to all
registrations (ie not cloned handles)
- List<String> defaultPortletHandleList = new ArrayList<String>();
-
- List<RegistrationPortletContextChangeListener> listeners;
+ public DefaultRegistrationPolicy()
+ {
+ validator = DefaultRegistrationPropertyValidator.DEFAULT;
+ }
+
@Override
public boolean equals(Object o)
{
@@ -170,28 +168,24 @@
/** Simply returns the given registration id. */
public String createRegistrationHandleFor(String registrationId)
{
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(registrationId,
"Registration id", null);
return registrationId;
}
/** Doesn't support automatic ConsumerGroups so always return
<code>null</code>. */
public String getAutomaticGroupNameFor(String consumerName)
{
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName,
"Consumer name", null);
return null;
}
/** Compute a simple, safe id based on the provided consumer name trusted (!) to be
unique. */
public String getConsumerIdFrom(String consumerName, Map<QName, Object>
registrationProperties) throws IllegalArgumentException, InvalidConsumerDataException
{
- return RegistrationPolicyWrapper.sanitizeConsumerName(consumerName);
+ return consumerName;
}
/** Rejects registration if a Consumer with the specified name already exists. */
public void validateConsumerName(String consumerName, final RegistrationManager
manager) throws IllegalArgumentException, RegistrationException
{
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName,
"Consumer name", null);
-
Consumer consumer = manager.getConsumerByIdentity(getConsumerIdFrom(consumerName,
Collections.<QName, Object>emptyMap()));
if (consumer != null)
{
@@ -205,6 +199,26 @@
// this is already the behavior in the RegistrationPersistenceManager so no need to
do anything
}
+ public boolean allowAccessTo(PortletContext portletContext, Registration registration,
String operation)
+ {
+ return true;
+ }
+
+ public boolean isWrapped()
+ {
+ return false;
+ }
+
+ public String getClassName()
+ {
+ return getClass().getName();
+ }
+
+ public Class<? extends RegistrationPolicy> getRealClass()
+ {
+ return getClass();
+ }
+
/**
* Instructs this policy to use the specified RegistrationPropertyValidator. There
shouldn't be any need to call this
* method manually, as the validator is configured via the WSRP Producer xml
configuration file.
@@ -225,66 +239,4 @@
{
return validator;
}
-
- public void addPortletHandle(Registration registration, String portletHandle)
- {
- if (registration != null &&
!registration.getPortletHandles().contains(portletHandle))
- {
- registration.getPortletHandles().add(portletHandle);
- updatePortletContextListeners(registration);
- }
- }
-
- public boolean checkPortletHandle(Registration registration, String portletHandle)
- {
- if (defaultPortletHandleList.contains(portletHandle))
- {
- return true;
- }
-
- if (registration != null &&
registration.getPortletHandles().contains(portletHandle))
- {
- return true;
- }
-
- return false;
- }
-
- public void removePortletHandle(Registration registration, String portletHandle)
- {
- if (registration != null)
- {
- registration.getPortletHandles().remove(portletHandle);
- updatePortletContextListeners(registration);
- }
- }
-
- public void updatePortletHandles(List<String> portletHandles)
- {
- this.defaultPortletHandleList = portletHandles;
- }
-
- public void addPortletContextChangeListener(RegistrationPortletContextChangeListener
listener)
- {
- if (listeners == null)
- {
- listeners = new ArrayList<RegistrationPortletContextChangeListener>();
- }
-
- if (!listeners.contains(listener))
- {
- listeners.add(listener);
- }
- }
-
- protected void updatePortletContextListeners(Registration registration)
- {
- if (listeners != null)
- {
- for (RegistrationPortletContextChangeListener listener : listeners)
- {
- listener.portletContextsHaveChanged(registration);
- }
- }
- }
}
Modified:
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/policies/DefaultRegistrationPropertyValidator.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/policies/DefaultRegistrationPropertyValidator.java 2011-02-02
21:59:34 UTC (rev 5849)
+++
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/policies/DefaultRegistrationPropertyValidator.java 2011-02-02
22:01:52 UTC (rev 5850)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -41,4 +41,6 @@
"'. DefaultRegistrationPropertyValidator only accepts non-null,
non-empty Strings.");
}
}
+
+ public static final RegistrationPropertyValidator DEFAULT = new
DefaultRegistrationPropertyValidator();
}
Modified:
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/policies/RegistrationPolicyWrapper.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/policies/RegistrationPolicyWrapper.java 2011-02-02
21:59:34 UTC (rev 5849)
+++
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/registration/policies/RegistrationPolicyWrapper.java 2011-02-02
22:01:52 UTC (rev 5850)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -24,7 +24,9 @@
package org.gatein.registration.policies;
import org.gatein.common.util.ParameterValidation;
+import org.gatein.pc.api.PortletContext;
import org.gatein.registration.InvalidConsumerDataException;
+import org.gatein.registration.Registration;
import org.gatein.registration.RegistrationException;
import org.gatein.registration.RegistrationManager;
import org.gatein.registration.RegistrationPolicy;
@@ -41,13 +43,40 @@
{
private final RegistrationPolicy delegate;
- public RegistrationPolicyWrapper(RegistrationPolicy delegate)
+ public static RegistrationPolicy wrap(RegistrationPolicy policy)
{
- ParameterValidation.throwIllegalArgExceptionIfNull(delegate,
"Delegate");
+ ParameterValidation.throwIllegalArgExceptionIfNull(policy, "RegistrationPolicy
to wrap");
+
+ if (!policy.isWrapped())
+ {
+ return new RegistrationPolicyWrapper(policy);
+ }
+ else
+ {
+ return policy;
+ }
+ }
+
+ public static RegistrationPolicy unwrap(RegistrationPolicy policy)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(policy, "RegistrationPolicy
to unwrap");
+
+ if (policy.isWrapped())
+ {
+ return ((RegistrationPolicyWrapper)policy).getDelegate();
+ }
+ else
+ {
+ return policy;
+ }
+ }
+
+ private RegistrationPolicyWrapper(RegistrationPolicy delegate)
+ {
this.delegate = delegate;
}
- public RegistrationPolicy getDelegate()
+ private RegistrationPolicy getDelegate()
{
return delegate;
}
@@ -61,13 +90,14 @@
public String createRegistrationHandleFor(String registrationId)
throws IllegalArgumentException
{
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(registrationId,
"Registration id", null);
return delegate.createRegistrationHandleFor(registrationId);
}
public String getAutomaticGroupNameFor(String consumerName)
throws IllegalArgumentException
{
- return delegate.getAutomaticGroupNameFor(consumerName);
+ return delegate.getAutomaticGroupNameFor(sanitizeConsumerName(consumerName));
}
public String getConsumerIdFrom(String consumerName, Map<QName, Object>
registrationProperties)
@@ -79,7 +109,7 @@
public void validateConsumerName(String consumerName, final RegistrationManager
manager)
throws IllegalArgumentException, RegistrationException
{
- delegate.validateConsumerName(consumerName, manager);
+ delegate.validateConsumerName(sanitizeConsumerName(consumerName), manager);
}
public void validateConsumerGroupName(String groupName, RegistrationManager manager)
@@ -88,40 +118,34 @@
delegate.validateConsumerGroupName(groupName, manager);
}
- static String sanitizeConsumerName(String consumerName)
+ public boolean allowAccessTo(PortletContext portletContext, Registration registration,
String operation)
{
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName,
"Consumer name", null);
- consumerName = consumerName.trim();
- consumerName = consumerName.replaceAll(",", "_");
- consumerName = consumerName.replaceAll(" ", "_");
- consumerName = consumerName.replaceAll("/", "_");
-
- return consumerName;
+ return delegate.allowAccessTo(portletContext, registration, operation);
}
- /* GTNWSRP-72
- public void addPortletHandle(Registration registration, String portletHandle)
+ public boolean isWrapped()
{
- delegate.addPortletHandle(registration, portletHandle);
+ return true;
}
- public boolean checkPortletHandle(Registration registration, String portletHandle)
+ public String getClassName()
{
- return delegate.checkPortletHandle(registration, portletHandle);
+ return delegate.getClassName();
}
- public void removePortletHandle(Registration registration, String portletHandle)
+ public Class<? extends RegistrationPolicy> getRealClass()
{
- delegate.removePortletHandle(registration, portletHandle);
+ return delegate.getClass();
}
- public void updatePortletHandles(List<String> portletHandles)
+ static String sanitizeConsumerName(String consumerName)
{
- delegate.updatePortletHandles(portletHandles);
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName,
"Consumer name", null);
+ consumerName = consumerName.trim();
+ consumerName = consumerName.replaceAll(",", "_");
+ consumerName = consumerName.replaceAll(" ", "_");
+ consumerName = consumerName.replaceAll("/", "_");
+
+ return consumerName;
}
-
- public void addPortletContextChangeListener(RegistrationPortletContextChangeListener
listener)
- {
- delegate.addPortletContextChangeListener(listener);
- }*/
}
Modified:
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirements.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirements.java 2011-02-02
21:59:34 UTC (rev 5849)
+++
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirements.java 2011-02-02
22:01:52 UTC (rev 5850)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -118,4 +118,6 @@
long getLastModified();
void setRegistrationProperties(Map<QName, RegistrationPropertyDescription>
registrationProperties);
+
+ String getPolicyClassName();
}
Modified:
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java 2011-02-02
21:59:34 UTC (rev 5849)
+++
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java 2011-02-02
22:01:52 UTC (rev 5850)
@@ -326,18 +326,25 @@
{
if (ParameterValidation.isOldAndNewDifferent(this.policy, policy))
{
- this.policy = policy;
-
if (policy != null)
{
- policyClassName = policy.getClass().getName();
+ this.policy = RegistrationPolicyWrapper.wrap(policy);
+ policyClassName = policy.getClassName();
- if (policy instanceof DefaultRegistrationPolicy)
+ if (DEFAULT_POLICY_CLASS_NAME.equals(policyClassName))
{
DefaultRegistrationPolicy registrationPolicy =
(DefaultRegistrationPolicy)policy;
validatorClassName =
registrationPolicy.getValidator().getClass().getName();
}
+ else
+ {
+ validatorClassName = null;
+ }
}
+ else
+ {
+ this.policy = null;
+ }
modifyNow();
notifyRegistrationPolicyChangeListeners();
@@ -375,10 +382,7 @@
}
RegistrationPolicy policy =
(RegistrationPolicy)policyClass.newInstance();
- // wrap policy so that we can perform minimal sanitization of values
- RegistrationPolicyWrapper wrapper = new
RegistrationPolicyWrapper(policy);
-
- setPolicy(wrapper);
+ setPolicy(policy);
}
catch (ClassNotFoundException e)
{
@@ -422,9 +426,9 @@
}
- DefaultRegistrationPolicy policy = new DefaultRegistrationPolicy();
- policy.setValidator(validator);
- setPolicy(policy);
+ DefaultRegistrationPolicy delegate = new DefaultRegistrationPolicy();
+ delegate.setValidator(validator);
+ setPolicy(delegate);
}
}
}
Modified:
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/config/impl/xml/ProducerConfigurationProvider.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/config/impl/xml/ProducerConfigurationProvider.java 2011-02-02
21:59:34 UTC (rev 5849)
+++
components/wsrp/branches/2.0.x/producer/src/main/java/org/gatein/wsrp/producer/config/impl/xml/ProducerConfigurationProvider.java 2011-02-02
22:01:52 UTC (rev 5850)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -25,6 +25,7 @@
import org.gatein.registration.RegistrationPolicy;
import org.gatein.registration.policies.DefaultRegistrationPolicy;
+import org.gatein.registration.policies.RegistrationPolicyWrapper;
import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.producer.config.ProducerRegistrationRequirements;
import org.gatein.wsrp.producer.config.impl.ProducerConfigurationImpl;
@@ -104,12 +105,12 @@
RegistrationPolicy policy = regReq.getPolicy();
if (policy != null)
{
- value = policy.getClass().getName();
+ value = policy.getClassName();
}
}
else if ("registration-property-validator".equals(localName))
{
- RegistrationPolicy policy = regReq.getPolicy();
+ RegistrationPolicy policy =
RegistrationPolicyWrapper.unwrap(regReq.getPolicy());
if (policy instanceof DefaultRegistrationPolicy)
{
DefaultRegistrationPolicy defaultRegistrationPolicy =
(DefaultRegistrationPolicy)policy;
Deleted:
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/registration/DefaultRegistrationPolicyTestCase.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/registration/DefaultRegistrationPolicyTestCase.java 2011-02-02
21:59:34 UTC (rev 5849)
+++
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/registration/DefaultRegistrationPolicyTestCase.java 2011-02-02
22:01:52 UTC (rev 5850)
@@ -1,183 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
- * contributors as indicated by the @authors tag. See the
- * copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * 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.gatein.registration;
-
-import junit.framework.TestCase;
-import org.gatein.registration.impl.RegistrationManagerImpl;
-import org.gatein.registration.impl.RegistrationPersistenceManagerImpl;
-import org.gatein.registration.policies.DefaultRegistrationPolicy;
-import org.gatein.registration.policies.DefaultRegistrationPropertyValidator;
-import org.gatein.wsrp.registration.PropertyDescription;
-
-import javax.xml.namespace.QName;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision: 9180 $
- * @since 2.6.3
- */
-public class DefaultRegistrationPolicyTestCase extends TestCase
-{
- DefaultRegistrationPolicy policy;
- Map<QName, Object> registrationProperties;
- Map<QName, PropertyDescription> expectations;
- private static final String CONSUMER = "consumer";
- private static final QName PROP1 = new QName("prop1");
- private static final QName PROP2 = new QName("prop2");
- private static final QName PROP3 = new QName("prop3");
- private RegistrationManager manager;
-
- @Override
- protected void setUp() throws Exception
- {
- policy = new DefaultRegistrationPolicy();
-
- policy.setValidator(new DefaultRegistrationPropertyValidator());
-
- manager = new RegistrationManagerImpl();
- manager.setPolicy(policy);
- manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
- manager.createConsumer(CONSUMER);
-
- registrationProperties = new HashMap<QName, Object>();
- registrationProperties.put(PROP1, "value1");
- registrationProperties.put(PROP2, "value2");
-
- expectations = new HashMap<QName, PropertyDescription>();
- }
-
- public void testValidateRegistrationDataForNull() throws RegistrationException
- {
- try
- {
- policy.validateRegistrationDataFor(null, "foo", expectations,
manager);
- fail("null data cannot be validated");
- }
- catch (IllegalArgumentException e)
- {
- // expected
- }
-
- try
- {
- policy.validateRegistrationDataFor(Collections.<QName, Object>emptyMap(),
null, expectations, manager);
- fail("null data cannot be validated");
- }
- catch (IllegalArgumentException e)
- {
- // expected
- }
- }
-
- public void testValidateRegistrationDataForInexistentConsumer()
- {
- try
- {
- policy.validateRegistrationDataFor(Collections.<QName, Object>emptyMap(),
"foo", expectations, manager);
- }
- catch (RegistrationException e)
- {
- fail("Should be possible to validate information for inexistent consumer
(otherwise, how would we register!)");
- }
- }
-
- public void testValidateRegistrationDataMissingProps()
- {
- expectations.put(PROP1, new TestPropertyDescription(PROP1));
- expectations.put(PROP2, new TestPropertyDescription(PROP2));
- expectations.put(PROP3, new TestPropertyDescription(PROP3));
-
- try
- {
- policy.validateRegistrationDataFor(registrationProperties, CONSUMER,
expectations, manager);
- fail("Missing prop3 should have been detected");
- }
- catch (RegistrationException e)
- {
- assertTrue(e.getLocalizedMessage().contains("prop3"));
- }
- }
-
- public void testValidateRegistrationDataExtraProps()
- {
- expectations.put(PROP1, new TestPropertyDescription(PROP1));
-
- try
- {
- policy.validateRegistrationDataFor(registrationProperties, CONSUMER,
expectations, manager);
- fail("Extra prop2 should have been detected");
- }
- catch (RegistrationException e)
- {
- assertTrue(e.getLocalizedMessage().contains("prop2"));
- }
- }
-
- public void testValidateRegistrationDataInvalidValue()
- {
- expectations.put(PROP1, new TestPropertyDescription(PROP1));
-
- registrationProperties.remove(PROP2);
- registrationProperties.put(PROP1, null);
-
- try
- {
- policy.validateRegistrationDataFor(registrationProperties, CONSUMER,
expectations, manager);
- fail("Should have detected null value for prop1");
- }
- catch (RegistrationException e)
- {
- assertTrue(e.getLocalizedMessage().contains("prop1"));
- }
- }
-
- static class TestPropertyDescription implements PropertyDescription
- {
- private QName name;
- private static final QName TYPE = new QName("type");
-
- TestPropertyDescription(QName name)
- {
- this.name = name;
- }
-
- public QName getName()
- {
- return name;
- }
-
- public QName getType()
- {
- return TYPE;
- }
-
- public int compareTo(PropertyDescription o)
- {
- return name.toString().compareTo(o.getName().toString());
- }
- }
-}
Copied:
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/registration/policies/DefaultRegistrationPolicyTestCase.java
(from rev 5803,
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/registration/DefaultRegistrationPolicyTestCase.java)
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/registration/policies/DefaultRegistrationPolicyTestCase.java
(rev 0)
+++
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/registration/policies/DefaultRegistrationPolicyTestCase.java 2011-02-02
22:01:52 UTC (rev 5850)
@@ -0,0 +1,189 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * 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.gatein.registration.policies;
+
+import junit.framework.TestCase;
+import org.gatein.registration.RegistrationException;
+import org.gatein.registration.RegistrationManager;
+import org.gatein.registration.impl.RegistrationManagerImpl;
+import org.gatein.registration.impl.RegistrationPersistenceManagerImpl;
+import org.gatein.wsrp.registration.PropertyDescription;
+
+import javax.xml.namespace.QName;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision: 9180 $
+ * @since 2.6.3
+ */
+public class DefaultRegistrationPolicyTestCase extends TestCase
+{
+ DefaultRegistrationPolicy policy;
+ Map<QName, Object> registrationProperties;
+ Map<QName, PropertyDescription> expectations;
+ private static final String CONSUMER = "consumer";
+ private static final QName PROP1 = new QName("prop1");
+ private static final QName PROP2 = new QName("prop2");
+ private static final QName PROP3 = new QName("prop3");
+ private RegistrationManager manager;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ policy = new DefaultRegistrationPolicy();
+
+ policy.setValidator(new DefaultRegistrationPropertyValidator());
+
+ manager = new RegistrationManagerImpl();
+ manager.setPolicy(policy);
+ manager.setPersistenceManager(new RegistrationPersistenceManagerImpl());
+ manager.createConsumer(CONSUMER);
+
+ registrationProperties = new HashMap<QName, Object>();
+ registrationProperties.put(PROP1, "value1");
+ registrationProperties.put(PROP2, "value2");
+
+ expectations = new HashMap<QName, PropertyDescription>();
+ }
+
+ public void testInitialState()
+ {
+ DefaultRegistrationPolicy registrationPolicy = new DefaultRegistrationPolicy();
+ assertEquals(DefaultRegistrationPropertyValidator.DEFAULT,
registrationPolicy.getValidator());
+ }
+
+ public void testValidateRegistrationDataForNull() throws RegistrationException
+ {
+ try
+ {
+ policy.validateRegistrationDataFor(null, "foo", expectations,
manager);
+ fail("null data cannot be validated");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+
+ try
+ {
+ policy.validateRegistrationDataFor(Collections.<QName, Object>emptyMap(),
null, expectations, manager);
+ fail("null data cannot be validated");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+ }
+
+ public void testValidateRegistrationDataForInexistentConsumer()
+ {
+ try
+ {
+ policy.validateRegistrationDataFor(Collections.<QName, Object>emptyMap(),
"foo", expectations, manager);
+ }
+ catch (RegistrationException e)
+ {
+ fail("Should be possible to validate information for inexistent consumer
(otherwise, how would we register!)");
+ }
+ }
+
+ public void testValidateRegistrationDataMissingProps()
+ {
+ expectations.put(PROP1, new TestPropertyDescription(PROP1));
+ expectations.put(PROP2, new TestPropertyDescription(PROP2));
+ expectations.put(PROP3, new TestPropertyDescription(PROP3));
+
+ try
+ {
+ policy.validateRegistrationDataFor(registrationProperties, CONSUMER,
expectations, manager);
+ fail("Missing prop3 should have been detected");
+ }
+ catch (RegistrationException e)
+ {
+ assertTrue(e.getLocalizedMessage().contains("prop3"));
+ }
+ }
+
+ public void testValidateRegistrationDataExtraProps()
+ {
+ expectations.put(PROP1, new TestPropertyDescription(PROP1));
+
+ try
+ {
+ policy.validateRegistrationDataFor(registrationProperties, CONSUMER,
expectations, manager);
+ fail("Extra prop2 should have been detected");
+ }
+ catch (RegistrationException e)
+ {
+ assertTrue(e.getLocalizedMessage().contains("prop2"));
+ }
+ }
+
+ public void testValidateRegistrationDataInvalidValue()
+ {
+ expectations.put(PROP1, new TestPropertyDescription(PROP1));
+
+ registrationProperties.remove(PROP2);
+ registrationProperties.put(PROP1, null);
+
+ try
+ {
+ policy.validateRegistrationDataFor(registrationProperties, CONSUMER,
expectations, manager);
+ fail("Should have detected null value for prop1");
+ }
+ catch (RegistrationException e)
+ {
+ assertTrue(e.getLocalizedMessage().contains("prop1"));
+ }
+ }
+
+ static class TestPropertyDescription implements PropertyDescription
+ {
+ private QName name;
+ private static final QName TYPE = new QName("type");
+
+ TestPropertyDescription(QName name)
+ {
+ this.name = name;
+ }
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public QName getType()
+ {
+ return TYPE;
+ }
+
+ public int compareTo(PropertyDescription o)
+ {
+ return name.toString().compareTo(o.getName().toString());
+ }
+ }
+}
Property changes on:
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/registration/policies/DefaultRegistrationPolicyTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/registration/policies/RegistrationPolicyWrapperTestCase.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/registration/policies/RegistrationPolicyWrapperTestCase.java
(rev 0)
+++
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/registration/policies/RegistrationPolicyWrapperTestCase.java 2011-02-02
22:01:52 UTC (rev 5850)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * 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.gatein.registration.policies;
+
+import junit.framework.TestCase;
+import org.gatein.registration.RegistrationPolicy;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ */
+public class RegistrationPolicyWrapperTestCase extends TestCase
+{
+ public void testWrap()
+ {
+ RegistrationPolicy policy = new DefaultRegistrationPolicy();
+
+ RegistrationPolicy wrapper = RegistrationPolicyWrapper.wrap(policy);
+ assertEquals(policy.getClass(), wrapper.getRealClass());
+ assertEquals(policy.getClassName(), wrapper.getClassName());
+ assertEquals(policy.getClass().getName(), wrapper.getClassName());
+
+ assertEquals(wrapper, RegistrationPolicyWrapper.wrap(wrapper));
+ assertTrue(wrapper instanceof RegistrationPolicyWrapper);
+
+ assertEquals(policy, RegistrationPolicyWrapper.unwrap(wrapper));
+ assertEquals(policy, RegistrationPolicyWrapper.unwrap(policy));
+ }
+}
Modified:
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerConfigurationTestCase.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerConfigurationTestCase.java 2011-02-02
21:59:34 UTC (rev 5849)
+++
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerConfigurationTestCase.java 2011-02-02
22:01:52 UTC (rev 5850)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -96,11 +96,13 @@
RegistrationPolicy policy = requirements.getPolicy();
// check that the policy is properly wrapped
- assertTrue(policy instanceof RegistrationPolicyWrapper);
+ assertTrue(policy.isWrapped());
+ // policy is wrapped so instanceof won't work!
+ assertFalse(policy instanceof TestRegistrationPolicy);
+
// and that the delegate is indeed the expected policy
- RegistrationPolicyWrapper wrapper = (RegistrationPolicyWrapper)policy;
- assertTrue(wrapper.getDelegate() instanceof TestRegistrationPolicy);
+ assertEquals(TestRegistrationPolicy.class,
RegistrationPolicyWrapper.unwrap(policy).getClass());
}
public void testExtendedUnmarshalling() throws Exception
@@ -110,7 +112,7 @@
ProducerRegistrationRequirements requirements =
producerConfiguration.getRegistrationRequirements();
assertNotNull(requirements);
- RegistrationPolicy policy = requirements.getPolicy();
+ RegistrationPolicy policy =
RegistrationPolicyWrapper.unwrap(requirements.getPolicy());
assertTrue(policy instanceof DefaultRegistrationPolicy);
RegistrationPropertyValidator propertyValidator =
((DefaultRegistrationPolicy)policy).getValidator();
assertNotNull(propertyValidator);
Modified:
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirementsTestCase.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirementsTestCase.java 2011-02-02
21:59:34 UTC (rev 5849)
+++
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/wsrp/producer/config/ProducerRegistrationRequirementsTestCase.java 2011-02-02
22:01:52 UTC (rev 5850)
@@ -28,7 +28,6 @@
import org.gatein.registration.RegistrationPolicyChangeListener;
import org.gatein.registration.RegistrationPropertyChangeListener;
import org.gatein.registration.policies.DefaultRegistrationPolicy;
-import org.gatein.registration.policies.RegistrationPolicyWrapper;
import org.gatein.wsrp.WSRPConstants;
import org.gatein.wsrp.producer.config.impl.ProducerRegistrationRequirementsImpl;
import org.gatein.wsrp.registration.PropertyDescription;
@@ -72,16 +71,22 @@
public void testChangeRegistrationPolicy()
{
- ProducerRegistrationRequirements requirements = new
ProducerRegistrationRequirementsImpl();
+ ProducerRegistrationRequirementsImpl requirements = new
ProducerRegistrationRequirementsImpl();
requirements.setRegistrationRequired(true); // so that we load the policy
- assertTrue(requirements.getPolicy() instanceof DefaultRegistrationPolicy);
+ RegistrationPolicy policy = requirements.getPolicy();
+ assertTrue(policy.isWrapped());
+ assertFalse(policy instanceof DefaultRegistrationPolicy); // cannot use instanceof
since policy is wrapped
+ assertEquals(ProducerRegistrationRequirements.DEFAULT_POLICY_CLASS_NAME,
policy.getClassName());
+
requirements.reloadPolicyFrom("org.gatein.wsrp.producer.config.TestRegistrationPolicy",
ProducerRegistrationRequirements.DEFAULT_VALIDATOR_CLASS_NAME);
- RegistrationPolicy policy = requirements.getPolicy();
- assertTrue(policy instanceof RegistrationPolicyWrapper);
- RegistrationPolicyWrapper wrapper = (RegistrationPolicyWrapper)policy;
- assertTrue(wrapper.getDelegate() instanceof TestRegistrationPolicy);
+ policy = requirements.getPolicy();
+ assertTrue(policy.isWrapped());
+ assertFalse(policy instanceof TestRegistrationPolicy); // cannot use instanceof
since policy is wrapped
+ assertEquals("org.gatein.wsrp.producer.config.TestRegistrationPolicy",
requirements.getPolicyClassName());
+ assertEquals("org.gatein.wsrp.producer.config.TestRegistrationPolicy",
policy.getClassName());
+ assertNull(requirements.getValidatorClassName());
}
public void testSetUnchangedRegistrationProperties()
Modified:
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/wsrp/producer/config/TestRegistrationPolicy.java
===================================================================
---
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/wsrp/producer/config/TestRegistrationPolicy.java 2011-02-02
21:59:34 UTC (rev 5849)
+++
components/wsrp/branches/2.0.x/producer/src/test/java/org/gatein/wsrp/producer/config/TestRegistrationPolicy.java 2011-02-02
22:01:52 UTC (rev 5850)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -23,17 +23,15 @@
package org.gatein.wsrp.producer.config;
+import org.gatein.pc.api.PortletContext;
import org.gatein.registration.InvalidConsumerDataException;
import org.gatein.registration.Registration;
import org.gatein.registration.RegistrationException;
import org.gatein.registration.RegistrationManager;
import org.gatein.registration.RegistrationPolicy;
-import org.gatein.registration.RegistrationPortletContextChangeListener;
import org.gatein.wsrp.registration.PropertyDescription;
import javax.xml.namespace.QName;
-
-import java.util.List;
import java.util.Map;
/**
@@ -70,25 +68,23 @@
{
}
- public void addPortletHandle(Registration registration, String portletHandle)
+ public boolean allowAccessTo(PortletContext portletContext, Registration registration,
String operation)
{
- }
-
- public boolean checkPortletHandle(Registration registration, String portletHandle)
- {
return true;
}
- public void removePortletHandle(Registration registration, String portletHandle)
+ public boolean isWrapped()
{
+ return false;
}
- public void updatePortletHandles(List<String> portletHandles)
+ public String getClassName()
{
+ return getClass().getName();
}
- public void addPortletContextChangeListener(RegistrationPortletContextChangeListener
listener)
+ public Class<? extends RegistrationPolicy> getRealClass()
{
+ return getClass();
}
-
}