You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by da...@apache.org on 2006/08/18 17:59:32 UTC

svn commit: r432624 - in /webservices/muse/trunk/modules/muse-wsdm-muws-adv-impl/src/org/apache/muse/ws/dm/muws/adv/impl: Messages.properties ServiceGroupEntryAdvertisement.java

Author: danj
Date: Fri Aug 18 08:59:29 2006
New Revision: 432624

URL: http://svn.apache.org/viewvc?rev=432624&view=rev
Log:
Modified SG entry advertisement class to check and make sure the resource type that's using the capability 
is actually a service group. This required the creation of a messages file for the package.

Added:
    webservices/muse/trunk/modules/muse-wsdm-muws-adv-impl/src/org/apache/muse/ws/dm/muws/adv/impl/Messages.properties
Modified:
    webservices/muse/trunk/modules/muse-wsdm-muws-adv-impl/src/org/apache/muse/ws/dm/muws/adv/impl/ServiceGroupEntryAdvertisement.java

Added: webservices/muse/trunk/modules/muse-wsdm-muws-adv-impl/src/org/apache/muse/ws/dm/muws/adv/impl/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws-adv-impl/src/org/apache/muse/ws/dm/muws/adv/impl/Messages.properties?rev=432624&view=auto
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws-adv-impl/src/org/apache/muse/ws/dm/muws/adv/impl/Messages.properties (added)
+++ webservices/muse/trunk/modules/muse-wsdm-muws-adv-impl/src/org/apache/muse/ws/dm/muws/adv/impl/Messages.properties Fri Aug 18 08:59:29 2006
@@ -0,0 +1 @@
+NoServiceGroupCapability=The resource type 'XXX' is using the ServiceGroupEntryAdvertisement capability but does not have the required ServiceGroup capability - only service groups can advertise the creation and destruction of service group entries. The current capabilities for the type are: XXX

Modified: webservices/muse/trunk/modules/muse-wsdm-muws-adv-impl/src/org/apache/muse/ws/dm/muws/adv/impl/ServiceGroupEntryAdvertisement.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-wsdm-muws-adv-impl/src/org/apache/muse/ws/dm/muws/adv/impl/ServiceGroupEntryAdvertisement.java?rev=432624&r1=432623&r2=432624&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-wsdm-muws-adv-impl/src/org/apache/muse/ws/dm/muws/adv/impl/ServiceGroupEntryAdvertisement.java (original)
+++ webservices/muse/trunk/modules/muse-wsdm-muws-adv-impl/src/org/apache/muse/ws/dm/muws/adv/impl/ServiceGroupEntryAdvertisement.java Fri Aug 18 08:59:29 2006
@@ -21,6 +21,8 @@
 import org.w3c.dom.Element;
 
 import org.apache.muse.core.Resource;
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
 import org.apache.muse.util.xml.XmlUtils;
 import org.apache.muse.ws.addressing.EndpointReference;
 import org.apache.muse.ws.addressing.soap.SoapFault;
@@ -39,6 +41,25 @@
 
 public class ServiceGroupEntryAdvertisement extends SimpleAdvertisement
 {
+    private static Messages _MESSAGES = MessagesFactory.get(ServiceGroupEntryAdvertisement.class);
+    
+    public void initialize() 
+        throws SoapFault
+    {
+        super.initialize();
+        
+        //
+        // make sure the owner resource type IS a service group
+        //
+        Resource resource = getResource();
+        
+        if (!resource.hasCapability(WssgConstants.SERVICE_GROUP_URI))
+        {
+            Object[] filler = { resource.getContextPath(), resource.getCapabilityURIs() };
+            throw new RuntimeException(_MESSAGES.get("NoServiceGroupCapability", filler));
+        }
+    }
+    
     public void resourceAdded(EndpointReference epr, Resource resource) throws SoapFault
     {
         Entry entry = (Entry)resource.getCapability(WssgConstants.ENTRY_URI);
@@ -63,10 +84,6 @@
     {
         ServiceGroup serviceGroup = (ServiceGroup)getResource().getCapability(WssgConstants.SERVICE_GROUP_URI);
         
-        //
-        // resource may be a SG, but its not necessarily the SG that owns 
-        // the entry resource
-        //
         if (serviceGroup.getEntry(epr) != null)
         {
             Element payload = XmlUtils.createElement(MuwsConstants.DESTROY_NOTIFICATION_QNAME);



---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org