[ 
https://issues.apache.org/jira/browse/MUSE-254?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vinh Nguyen updated MUSE-254:
-----------------------------

    Description: 
SimpleServiceGroup has a bug. It doesn't allow a ServiceGroup to add references 
to other ServiceGroups.  But I think this should be allowed.

The current limitation/flaw is in resourceAdded() and createEntry().  In the 
current logic, it creates and initializes at the same time.  So even before it 
can be added to the ServiceGroup mappings, the ResourceManager invokes the 
resourceAdded() listener method...which is why it currently can't allow adding 
SGs because it will go into an endless loop.

The fix:
1) Remove filter logic at top of resourceAdded() which filters ServiceGroups. 
Still need to filter Entry resources though.
2) In createEntry(), remove the code chunk at the end which:
   a) calls resource.initialize()
   b) adds the resource to ResourceManager
   c) sets termination time on the resource
3) Move the above code to a new initializeEntry(WsResource,Date) method.
4) In resourceAdded(), remove code block which gets termination time of the 
parent resource.
   It's not needed because the new Entry resource doesn't need a termination 
time.
   It'll automatically be removed in resourceRemoved().  See Muse-253.
5) In resourceAdded(), remove the call to addEntry(resource).  Replace with 
this logic:

        WsResource entry = createEntry(epr, null, null);
        addEntry(epr, entry);
        try
        {
            initializeEntry(entry, null);
        }
        catch (Exception exc)
        {
            removeEntry(entry);
            throw new AddRefusedFault(exc);
        }

Basically, the logic flow is more streamlined.
Create the entry but DON'T initialize it yet.
Add the Entry, then initialize it.
If initialization fails, then remove it.
So now, a ServiceGroup is able to reference other ServiceGroups:)


  was:
SimpleServiceGroup has a bug. It doesn't allow a ServiceGroup to add references 
to other ServiceGroups.  But I think this should be allowed.

The current limitation/flaw is in resourceAdded() and createEntry().  In the 
current logic, it creates and initializes at the same time.  So even before it 
can be added to the ServiceGroup mappings, the ResourceManager invokes the 
resourceAdded() listener method...which is why it currently can't allow adding 
SGs because it will go into an endless loop.

The fix:
1) Remove filter logic in resourceAdded() that checks for ServiceGroup and 
Entry capabilities.
   Filter is no longer needed.
2) In createEntry(), remove the code chunk at the end which:
   a) calls resource.initialize()
   b) adds the resource to ResourceManager
   c) sets termination time on the resource
3) Move the above code to a new initializeEntry(WsResource,Date) method.
4) In resourceAdded(), remove code block which gets termination time of the 
parent resource.
   It's not needed because the new Entry resource doesn't need a termination 
time.
   It'll automatically be removed in resourceRemoved().  See Muse-253.
5) In resourceAdded(), remove the call to addEntry(resource).  Replace with 
this logic:

        WsResource entry = createEntry(epr, null, null);
        addEntry(epr, entry);
        try
        {
            initializeEntry(entry, null);
        }
        catch (Exception exc)
        {
            removeEntry(entry);
            throw new AddRefusedFault(exc);
        }

Basically, the logic flow is more streamlined.
Create the entry but DON'T initialize it yet.
Add the Entry, then initialize it.
If initialization fails, then remove it.
So now, a ServiceGroup is able to reference other ServiceGroups:)



Editted fix step #1.  Still need to filter Entry resources, but just not 
ServiceGroup resources.

> ServiceGroup can't reference other ServiceGroups
> ------------------------------------------------
>
>                 Key: MUSE-254
>                 URL: https://issues.apache.org/jira/browse/MUSE-254
>             Project: Muse
>          Issue Type: Bug
>         Environment: Muse 2.2.0, Eclipse 3.2.1
>            Reporter: Vinh Nguyen
>            Assignee: Dan Jemiolo
>         Attachments: ServiceGroup.java, ServiceGroup.java
>
>
> SimpleServiceGroup has a bug. It doesn't allow a ServiceGroup to add 
> references to other ServiceGroups.  But I think this should be allowed.
> The current limitation/flaw is in resourceAdded() and createEntry().  In the 
> current logic, it creates and initializes at the same time.  So even before 
> it can be added to the ServiceGroup mappings, the ResourceManager invokes the 
> resourceAdded() listener method...which is why it currently can't allow 
> adding SGs because it will go into an endless loop.
> The fix:
> 1) Remove filter logic at top of resourceAdded() which filters ServiceGroups. 
> Still need to filter Entry resources though.
> 2) In createEntry(), remove the code chunk at the end which:
>    a) calls resource.initialize()
>    b) adds the resource to ResourceManager
>    c) sets termination time on the resource
> 3) Move the above code to a new initializeEntry(WsResource,Date) method.
> 4) In resourceAdded(), remove code block which gets termination time of the 
> parent resource.
>    It's not needed because the new Entry resource doesn't need a termination 
> time.
>    It'll automatically be removed in resourceRemoved().  See Muse-253.
> 5) In resourceAdded(), remove the call to addEntry(resource).  Replace with 
> this logic:
>         WsResource entry = createEntry(epr, null, null);
>         addEntry(epr, entry);
>         try
>         {
>             initializeEntry(entry, null);
>         }
>         catch (Exception exc)
>         {
>             removeEntry(entry);
>             throw new AddRefusedFault(exc);
>         }
> Basically, the logic flow is more streamlined.
> Create the entry but DON'T initialize it yet.
> Add the Entry, then initialize it.
> If initialization fails, then remove it.
> So now, a ServiceGroup is able to reference other ServiceGroups:)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to