Author: mwringe
Date: 2011-09-14 13:35:05 -0400 (Wed, 14 Sep 2011)
New Revision: 7425
Added:
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/WSSEndpointEnabled.java
Modified:
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/registry/JCRConsumerRegistry.java
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/registry/mapping/EndpointInfoMapping.java
components/wsrp/trunk/jcr-impl/src/main/resources/conf/nodetypes/consumers-configuration-nodetypes.xml
Log:
JBEPP-1143: make the wssendpoint enablement part of a mixin so that it doesn't cause
problems when updating with an older version's jcr.
Modified:
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/registry/JCRConsumerRegistry.java
===================================================================
---
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/registry/JCRConsumerRegistry.java 2011-09-14
16:26:48 UTC (rev 7424)
+++
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/registry/JCRConsumerRegistry.java 2011-09-14
17:35:05 UTC (rev 7425)
@@ -38,6 +38,7 @@
import org.gatein.wsrp.jcr.mapping.mixins.BaseMixin;
import org.gatein.wsrp.jcr.mapping.mixins.LastModified;
import org.gatein.wsrp.jcr.mapping.mixins.ModifyRegistrationRequired;
+import org.gatein.wsrp.jcr.mapping.mixins.WSSEndpointEnabled;
import org.gatein.wsrp.registration.mapping.RegistrationPropertyDescriptionMapping;
import javax.jcr.RepositoryException;
@@ -75,7 +76,8 @@
{
Collections.addAll(mappingClasses, ProducerInfosMapping.class,
ProducerInfoMapping.class,
EndpointInfoMapping.class, RegistrationInfoMapping.class,
RegistrationPropertyMapping.class,
- RegistrationPropertyDescriptionMapping.class, LastModified.class,
ModifyRegistrationRequired.class);
+ RegistrationPropertyDescriptionMapping.class, LastModified.class,
ModifyRegistrationRequired.class,
+ WSSEndpointEnabled.class);
}
public JCRConsumerRegistry(ChromatticPersister persister) throws Exception
@@ -137,7 +139,9 @@
getMixin(pim, session, LastModified.class).setLastModified(now);
getMixin(pim, session,
ModifyRegistrationRequired.class).setModifyRegistrationRequired(info.isModifyRegistrationRequired());
info.setLastModified(now);
+ getMixin(pim.getEndpointInfo(), session,
WSSEndpointEnabled.class).setWSSEnabled(info.getEndpointConfigurationInfo().getWSSEnabled());
+
persister.closeSession(true);
}
catch (Exception e)
@@ -203,6 +207,7 @@
getMixin(pim, session,
ModifyRegistrationRequired.class).setModifyRegistrationRequired(producerInfo.isModifyRegistrationRequired());
getMixin(pim, session, LastModified.class).setLastModified(now);
producerInfo.setLastModified(now);
+ getMixin(pim.getEndpointInfo(), session,
WSSEndpointEnabled.class).setWSSEnabled(producerInfo.getEndpointConfigurationInfo().getWSSEnabled());
persister.closeSession(true);
}
@@ -214,7 +219,30 @@
public Iterator<ProducerInfo> getProducerInfosFromStorage()
{
ChromatticSession session = persister.getSession();
- final Iterator<ProducerInfo> iterator = new
ProducerInfoIterator(getRefreshedInfoCache(session).getConsumers().iterator());
+
+ Collection<WSRPConsumer> consumers =
getRefreshedInfoCache(session).getConsumers();
+
+ // GTNWSRP-239
+ // Kindof crappy place to put this, but we need to be able to retrieve the mixin
from the jcr so that it can be used to
+ // configure the ProducerInfo
+ Iterator<WSRPConsumer> consumersIterator = consumers.iterator();
+ while (consumersIterator.hasNext())
+ {
+ ProducerInfo pi = consumersIterator.next().getProducerInfo();
+ String key = pi.getKey();
+ ProducerInfoMapping pim = session.findById(ProducerInfoMapping.class, key);
+ if (pim == null)
+ {
+ throw new IllegalArgumentException("Couldn't find
ProducerInfoMapping associated with key " + key);
+ }
+ WSSEndpointEnabled wssee = getMixin(pim.getEndpointInfo(), session,
WSSEndpointEnabled.class);
+ if (wssee != null)
+ {
+ pi.getEndpointConfigurationInfo().setWSSEnabled(wssee.getWSSEnabled());
+ }
+ }
+
+ final Iterator<ProducerInfo> iterator = new
ProducerInfoIterator(consumers.iterator());
persister.closeSession(false);
return iterator;
}
Modified:
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/registry/mapping/EndpointInfoMapping.java
===================================================================
---
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/registry/mapping/EndpointInfoMapping.java 2011-09-14
16:26:48 UTC (rev 7424)
+++
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/registry/mapping/EndpointInfoMapping.java 2011-09-14
17:35:05 UTC (rev 7425)
@@ -47,24 +47,16 @@
public abstract void setWSTimeoutMilliseconds(Integer expiration);
- @Property(name = "enablewss")
- @DefaultValue("false")
- public abstract boolean getWSSEnabled();
-
- public abstract void setWSSEnabled(boolean enable);
-
public void initFrom(EndpointConfigurationInfo info)
{
setWSDLURL(info.getWsdlDefinitionURL());
setWSTimeoutMilliseconds(info.getWSOperationTimeOut());
- setWSSEnabled(info.getWSSEnabled());
}
EndpointConfigurationInfo toEndpointConfigurationInfo(EndpointConfigurationInfo
initial)
{
initial.setWsdlDefinitionURL(getWSDLURL());
initial.setWSOperationTimeOut(getWSTimeoutMilliseconds());
- initial.setWSSEnabled(getWSSEnabled());
return initial;
}
}
Added:
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/WSSEndpointEnabled.java
===================================================================
---
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/WSSEndpointEnabled.java
(rev 0)
+++
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/WSSEndpointEnabled.java 2011-09-14
17:35:05 UTC (rev 7425)
@@ -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.wsrp.jcr.mapping.mixins;
+
+import org.chromattic.api.annotations.DefaultValue;
+import org.chromattic.api.annotations.MixinType;
+import org.chromattic.api.annotations.Property;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+@MixinType(name = "wsrp:wssendpointinfo")
+public abstract class WSSEndpointEnabled implements BaseMixin
+{
+ @Property(name = "enablewss")
+ @DefaultValue("false")
+ public abstract boolean getWSSEnabled();
+
+ public abstract void setWSSEnabled(boolean enable);
+
+ @Override
+ public void initializeValue()
+ {
+ //set to false by default
+ setWSSEnabled(false);
+ }
+
+}
+
Property changes on:
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/WSSEndpointEnabled.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
components/wsrp/trunk/jcr-impl/src/main/resources/conf/nodetypes/consumers-configuration-nodetypes.xml
===================================================================
---
components/wsrp/trunk/jcr-impl/src/main/resources/conf/nodetypes/consumers-configuration-nodetypes.xml 2011-09-14
16:26:48 UTC (rev 7424)
+++
components/wsrp/trunk/jcr-impl/src/main/resources/conf/nodetypes/consumers-configuration-nodetypes.xml 2011-09-14
17:35:05 UTC (rev 7425)
@@ -96,6 +96,19 @@
</childNodeDefinitions>
</nodeType>
+ <nodeType name="wsrp:wssendpointinfo" isMixin="true"
hasOrderableChildNodes="false" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ <supertype>mix:referenceable</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="enablewss"
requiredType="boolean" autoCreated="false"
mandatory="false"
+ onParentVersion="COPY" protected="false"
multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
<nodeType name="wsrp:endpointinfo" isMixin="false"
hasOrderableChildNodes="false" primaryItemName="">
<supertypes>
<supertype>nt:base</supertype>
@@ -110,10 +123,6 @@
onParentVersion="COPY" protected="false"
multiple="false">
<valueConstraints/>
</propertyDefinition>
- <propertyDefinition name="enablewss"
requiredType="boolean" autoCreated="false"
mandatory="false"
- onParentVersion="COPY" protected="false"
multiple="false">
- <valueConstraints/>
- </propertyDefinition>
</propertyDefinitions>
</nodeType>