[ 
http://jira.amdatu.org/jira/browse/AMDATU-238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10801#comment-10801
 ] 

Angelo van der Sijpt commented on AMDATU-238:
---------------------------------------------

I did some quick checks, and the OSGi core and compendium to see what other 
services are doing. For instance,
- Configuration.getProperties is not backed with the original implementation.
- Event (from EventAdmin) and ServiceReference do not provide access to the 
full Properties object, so that doesn't have a problem.
- Role (from UserAdmin) is backed by the actual object.

So, we see all three ways, but both Configuration and Role are 'backed' 
objects, that is, any changes to the object is directly reflected in the 
underlying service. Our Tenants are value objects, so they obey different 
rules. In that sense, the are more like an Event, which has a 
getProperty(String), getPropertyNames(), but no setProperty() since the object 
is immutable.

Our Tenant object is neither backed, nor immutable, so I don't mind changing 
the API to something that makes most sense. Any suggestions?

> Updating tenants does not work
> ------------------------------
>
>                 Key: AMDATU-238
>                 URL: http://jira.amdatu.org/jira/browse/AMDATU-238
>             Project: Amdatu
>          Issue Type: Bug
>          Components: Amdatu Core
>    Affects Versions: 0.1.0
>            Reporter: Ivo Ladage - van Doorn
>            Assignee: Angelo van der Sijpt
>             Fix For: 0.1.0
>
>
> When I add this code snippet to my service to create and later on update a 
> tenant, I get a NullPointerException when the tenant already exists:
> TenantEntity tenantA = m_tenantManagementService.getTenantById("tenant_a");
> if (tenantA == null) {
>   tenantA = m_tenantManagementService.createTenant("tenant_a", "Tenant A");
> }
> tenantA.getProperties().put(HOSTNAME, "localhost");
> m_tenantManagementService.updateTenant(tenantA);
> The error I get:
> WARNING: Invocation of 'start' failed. [org.amdatu.core.tenant]
> null
> java.lang.NullPointerException
>         at 
> org.amdatu.core.tenant.service.TenantManagementServiceImpl.updateTenantService(TenantManagementServiceImpl.java:117)
>         at 
> org.amdatu.core.tenant.service.TenantManagementServiceImpl.updateTenant(TenantManagementServiceImpl.java:93)
>         at 
> org.amdatu.core.tenant.service.TenantContextProviderImpl.start(TenantContextProviderImpl.java:74)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to