You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Emmanuel DEMEY (Created) (JIRA)" <ji...@apache.org> on 2012/02/17 10:03:59 UTC

[jira] [Created] (TAP5-1850) Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service

Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service
------------------------------------------------------------------------------------------------

                 Key: TAP5-1850
                 URL: https://issues.apache.org/jira/browse/TAP5-1850
             Project: Tapestry 5
          Issue Type: Bug
          Components: tapestry-core
    Affects Versions: 5.3
            Reporter: Emmanuel DEMEY
            Priority: Blocker


I am working in the migration of one of our Components library : Tapestry 5.2.6 to 5.3, and I have a problem with the ServiceOverride service. 

I would like to override the default implementation of the ComponentMessagesSource service.  So first, I added this new implementation  by using the ServiceBinder : 

{code}
public static void bind(ServiceBinder binder) {
  binder.bind(ComponentMessagesSource.class, TestMessageSource.class).withId("test");
}
{code}

And after, I contributed to the ServiceOverride service, in order to specify the default implementation of the ComponentMessagesSource interface : 

{code}
public static void contributeServiceOverride(MappedConfiguration<Class, Object> configuration,
@Local ComponentMessagesSource override) {
		
    configuration.add(ComponentMessagesSource.class, override);
		
}
{code}

But when I jetty:run my application, I have got this message error : 

{code}
Render queue error in BeginRender[core/PropertyEditBlocks:numberfield]: Failure reading parameter 'translate' of component core/PropertyEditBlocks:numberfield: Exception constructing service 'FieldTranslatorSource': Service interface org.apache.tapestry5.services.messages.ComponentMessagesSource is matched by 2 services: ComponentMessagesSource, Test. Automatic dependency resolution requires that exactly one service implement the interface.
{code}

So, I also checked the implementation of the MasterObjectProviderImpl, and I think Tapestry do not find the right ObjectProvider for my interface. 

Here is the email sent to me by Howard : 
There is a definite bug here, and it is related to
ComponentMessagesSource ... or, more specifically,
ApplicationMessageCatalogObjectProvider (which is what allows services
to inject a Messages instance and get a localized version of the
application messages). ObjectProviders, contributed to the
MasterObjectProvider service, are part of the general injection
infrastructure, and thus have the be very tricky to prevent unintended
dependency loops. Even so, it should be possible to fix this with a
little recoding

Thanks 

Manu


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TAP5-1850) Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service

Posted by "Emmanuel DEMEY (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13228396#comment-13228396 ] 

Emmanuel DEMEY commented on TAP5-1850:
--------------------------------------

Thanks a lot Christian. 

It works like a charm !! :d

Manu

                
> Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service
> ------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1850
>                 URL: https://issues.apache.org/jira/browse/TAP5-1850
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3
>            Reporter: Emmanuel DEMEY
>            Priority: Blocker
>         Attachments: tapestry.zip
>
>
> I am working in the migration of one of our Components library : Tapestry 5.2.6 to 5.3, and I have a problem with the ServiceOverride service. 
> I would like to override the default implementation of the ComponentMessagesSource service.  So first, I added this new implementation  by using the ServiceBinder : 
> public static void bind(ServiceBinder binder) {
>   binder.bind(ComponentMessagesSource.class, TestMessageSource.class).withId("test");
> }
> And after, I contributed to the ServiceOverride service, in order to specify the default implementation of the ComponentMessagesSource interface : 
> public static void contributeServiceOverride(MappedConfiguration<Class, Object> configuration,
> @Local ComponentMessagesSource override) {
> 		
>     configuration.add(ComponentMessagesSource.class, override);
> 		
> }
> But when I jetty:run my application, I have got this message error : 
> Render queue error in BeginRender[core/PropertyEditBlocks:numberfield]: Failure reading parameter 'translate' of component core/PropertyEditBlocks:numberfield: Exception constructing service 'FieldTranslatorSource': Service interface org.apache.tapestry5.services.messages.ComponentMessagesSource is matched by 2 services: ComponentMessagesSource, Test. Automatic dependency resolution requires that exactly one service implement the interface.
> So, I also checked the implementation of the MasterObjectProviderImpl, and I think Tapestry do not find the right ObjectProvider for my interface. 
> Here is the email sent to me by Howard : 
> There is a definite bug here, and it is related to
> ComponentMessagesSource ... or, more specifically,
> ApplicationMessageCatalogObjectProvider (which is what allows services
> to inject a Messages instance and get a localized version of the
> application messages). ObjectProviders, contributed to the
> MasterObjectProvider service, are part of the general injection
> infrastructure, and thus have the be very tricky to prevent unintended
> dependency loops. Even so, it should be possible to fix this with a
> little recoding
> Thanks 
> Manu

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TAP5-1850) Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service

Posted by "Christian Köberl (Commented JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13228378#comment-13228378 ] 

Christian Köberl commented on TAP5-1850:
----------------------------------------

There is a workaround - you can decorate ComponentMessagesSource:

@Match("ComponentMessagesSource") 
public static ComponentMessagesSource decorateComponentMessagesSource (ComponentMessagesSourcedelegate) 
{ 
    return new MyComponentMessagesSource(delegate); 
} 

See also: http://tapestry.1045711.n5.nabble.com/T5-Expanding-Messages-Catalog-for-localization-from-arbitrary-source-td2420856.html
                
> Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service
> ------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1850
>                 URL: https://issues.apache.org/jira/browse/TAP5-1850
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3
>            Reporter: Emmanuel DEMEY
>            Priority: Blocker
>         Attachments: tapestry.zip
>
>
> I am working in the migration of one of our Components library : Tapestry 5.2.6 to 5.3, and I have a problem with the ServiceOverride service. 
> I would like to override the default implementation of the ComponentMessagesSource service.  So first, I added this new implementation  by using the ServiceBinder : 
> public static void bind(ServiceBinder binder) {
>   binder.bind(ComponentMessagesSource.class, TestMessageSource.class).withId("test");
> }
> And after, I contributed to the ServiceOverride service, in order to specify the default implementation of the ComponentMessagesSource interface : 
> public static void contributeServiceOverride(MappedConfiguration<Class, Object> configuration,
> @Local ComponentMessagesSource override) {
> 		
>     configuration.add(ComponentMessagesSource.class, override);
> 		
> }
> But when I jetty:run my application, I have got this message error : 
> Render queue error in BeginRender[core/PropertyEditBlocks:numberfield]: Failure reading parameter 'translate' of component core/PropertyEditBlocks:numberfield: Exception constructing service 'FieldTranslatorSource': Service interface org.apache.tapestry5.services.messages.ComponentMessagesSource is matched by 2 services: ComponentMessagesSource, Test. Automatic dependency resolution requires that exactly one service implement the interface.
> So, I also checked the implementation of the MasterObjectProviderImpl, and I think Tapestry do not find the right ObjectProvider for my interface. 
> Here is the email sent to me by Howard : 
> There is a definite bug here, and it is related to
> ComponentMessagesSource ... or, more specifically,
> ApplicationMessageCatalogObjectProvider (which is what allows services
> to inject a Messages instance and get a localized version of the
> application messages). ObjectProviders, contributed to the
> MasterObjectProvider service, are part of the general injection
> infrastructure, and thus have the be very tricky to prevent unintended
> dependency loops. Even so, it should be possible to fix this with a
> little recoding
> Thanks 
> Manu

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (TAP5-1850) Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service

Posted by "Emmanuel DEMEY (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13228396#comment-13228396 ] 

Emmanuel DEMEY commented on TAP5-1850:
--------------------------------------

Thanks a lot Christian. 

It works like a charm !! :d

Manu

                
> Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service
> ------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1850
>                 URL: https://issues.apache.org/jira/browse/TAP5-1850
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3
>            Reporter: Emmanuel DEMEY
>            Priority: Blocker
>         Attachments: tapestry.zip
>
>
> I am working in the migration of one of our Components library : Tapestry 5.2.6 to 5.3, and I have a problem with the ServiceOverride service. 
> I would like to override the default implementation of the ComponentMessagesSource service.  So first, I added this new implementation  by using the ServiceBinder : 
> public static void bind(ServiceBinder binder) {
>   binder.bind(ComponentMessagesSource.class, TestMessageSource.class).withId("test");
> }
> And after, I contributed to the ServiceOverride service, in order to specify the default implementation of the ComponentMessagesSource interface : 
> public static void contributeServiceOverride(MappedConfiguration<Class, Object> configuration,
> @Local ComponentMessagesSource override) {
> 		
>     configuration.add(ComponentMessagesSource.class, override);
> 		
> }
> But when I jetty:run my application, I have got this message error : 
> Render queue error in BeginRender[core/PropertyEditBlocks:numberfield]: Failure reading parameter 'translate' of component core/PropertyEditBlocks:numberfield: Exception constructing service 'FieldTranslatorSource': Service interface org.apache.tapestry5.services.messages.ComponentMessagesSource is matched by 2 services: ComponentMessagesSource, Test. Automatic dependency resolution requires that exactly one service implement the interface.
> So, I also checked the implementation of the MasterObjectProviderImpl, and I think Tapestry do not find the right ObjectProvider for my interface. 
> Here is the email sent to me by Howard : 
> There is a definite bug here, and it is related to
> ComponentMessagesSource ... or, more specifically,
> ApplicationMessageCatalogObjectProvider (which is what allows services
> to inject a Messages instance and get a localized version of the
> application messages). ObjectProviders, contributed to the
> MasterObjectProvider service, are part of the general injection
> infrastructure, and thus have the be very tricky to prevent unintended
> dependency loops. Even so, it should be possible to fix this with a
> little recoding
> Thanks 
> Manu

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (TAP5-1850) Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service

Posted by "Emmanuel DEMEY (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TAP5-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel DEMEY updated TAP5-1850:
---------------------------------

    Attachment: tapestry.zip
    
> Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service
> ------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1850
>                 URL: https://issues.apache.org/jira/browse/TAP5-1850
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3
>            Reporter: Emmanuel DEMEY
>            Priority: Blocker
>         Attachments: tapestry.zip
>
>
> I am working in the migration of one of our Components library : Tapestry 5.2.6 to 5.3, and I have a problem with the ServiceOverride service. 
> I would like to override the default implementation of the ComponentMessagesSource service.  So first, I added this new implementation  by using the ServiceBinder : 
> public static void bind(ServiceBinder binder) {
>   binder.bind(ComponentMessagesSource.class, TestMessageSource.class).withId("test");
> }
> And after, I contributed to the ServiceOverride service, in order to specify the default implementation of the ComponentMessagesSource interface : 
> public static void contributeServiceOverride(MappedConfiguration<Class, Object> configuration,
> @Local ComponentMessagesSource override) {
> 		
>     configuration.add(ComponentMessagesSource.class, override);
> 		
> }
> But when I jetty:run my application, I have got this message error : 
> Render queue error in BeginRender[core/PropertyEditBlocks:numberfield]: Failure reading parameter 'translate' of component core/PropertyEditBlocks:numberfield: Exception constructing service 'FieldTranslatorSource': Service interface org.apache.tapestry5.services.messages.ComponentMessagesSource is matched by 2 services: ComponentMessagesSource, Test. Automatic dependency resolution requires that exactly one service implement the interface.
> So, I also checked the implementation of the MasterObjectProviderImpl, and I think Tapestry do not find the right ObjectProvider for my interface. 
> Here is the email sent to me by Howard : 
> There is a definite bug here, and it is related to
> ComponentMessagesSource ... or, more specifically,
> ApplicationMessageCatalogObjectProvider (which is what allows services
> to inject a Messages instance and get a localized version of the
> application messages). ObjectProviders, contributed to the
> MasterObjectProvider service, are part of the general injection
> infrastructure, and thus have the be very tricky to prevent unintended
> dependency loops. Even so, it should be possible to fix this with a
> little recoding
> Thanks 
> Manu

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (TAP5-1850) Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service

Posted by "Emmanuel DEMEY (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TAP5-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel DEMEY updated TAP5-1850:
---------------------------------

    Description: 
I am working in the migration of one of our Components library : Tapestry 5.2.6 to 5.3, and I have a problem with the ServiceOverride service. 

I would like to override the default implementation of the ComponentMessagesSource service.  So first, I added this new implementation  by using the ServiceBinder : 

public static void bind(ServiceBinder binder) {
  binder.bind(ComponentMessagesSource.class, TestMessageSource.class).withId("test");
}

And after, I contributed to the ServiceOverride service, in order to specify the default implementation of the ComponentMessagesSource interface : 

public static void contributeServiceOverride(MappedConfiguration<Class, Object> configuration,
@Local ComponentMessagesSource override) {
		
    configuration.add(ComponentMessagesSource.class, override);
		
}

But when I jetty:run my application, I have got this message error : 

Render queue error in BeginRender[core/PropertyEditBlocks:numberfield]: Failure reading parameter 'translate' of component core/PropertyEditBlocks:numberfield: Exception constructing service 'FieldTranslatorSource': Service interface org.apache.tapestry5.services.messages.ComponentMessagesSource is matched by 2 services: ComponentMessagesSource, Test. Automatic dependency resolution requires that exactly one service implement the interface.


So, I also checked the implementation of the MasterObjectProviderImpl, and I think Tapestry do not find the right ObjectProvider for my interface. 

Here is the email sent to me by Howard : 
There is a definite bug here, and it is related to
ComponentMessagesSource ... or, more specifically,
ApplicationMessageCatalogObjectProvider (which is what allows services
to inject a Messages instance and get a localized version of the
application messages). ObjectProviders, contributed to the
MasterObjectProvider service, are part of the general injection
infrastructure, and thus have the be very tricky to prevent unintended
dependency loops. Even so, it should be possible to fix this with a
little recoding

Thanks 

Manu


  was:
I am working in the migration of one of our Components library : Tapestry 5.2.6 to 5.3, and I have a problem with the ServiceOverride service. 

I would like to override the default implementation of the ComponentMessagesSource service.  So first, I added this new implementation  by using the ServiceBinder : 

{code}
public static void bind(ServiceBinder binder) {
  binder.bind(ComponentMessagesSource.class, TestMessageSource.class).withId("test");
}
{code}

And after, I contributed to the ServiceOverride service, in order to specify the default implementation of the ComponentMessagesSource interface : 

{code}
public static void contributeServiceOverride(MappedConfiguration<Class, Object> configuration,
@Local ComponentMessagesSource override) {
		
    configuration.add(ComponentMessagesSource.class, override);
		
}
{code}

But when I jetty:run my application, I have got this message error : 

{code}
Render queue error in BeginRender[core/PropertyEditBlocks:numberfield]: Failure reading parameter 'translate' of component core/PropertyEditBlocks:numberfield: Exception constructing service 'FieldTranslatorSource': Service interface org.apache.tapestry5.services.messages.ComponentMessagesSource is matched by 2 services: ComponentMessagesSource, Test. Automatic dependency resolution requires that exactly one service implement the interface.
{code}

So, I also checked the implementation of the MasterObjectProviderImpl, and I think Tapestry do not find the right ObjectProvider for my interface. 

Here is the email sent to me by Howard : 
There is a definite bug here, and it is related to
ComponentMessagesSource ... or, more specifically,
ApplicationMessageCatalogObjectProvider (which is what allows services
to inject a Messages instance and get a localized version of the
application messages). ObjectProviders, contributed to the
MasterObjectProvider service, are part of the general injection
infrastructure, and thus have the be very tricky to prevent unintended
dependency loops. Even so, it should be possible to fix this with a
little recoding

Thanks 

Manu


    
> Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service
> ------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1850
>                 URL: https://issues.apache.org/jira/browse/TAP5-1850
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3
>            Reporter: Emmanuel DEMEY
>            Priority: Blocker
>
> I am working in the migration of one of our Components library : Tapestry 5.2.6 to 5.3, and I have a problem with the ServiceOverride service. 
> I would like to override the default implementation of the ComponentMessagesSource service.  So first, I added this new implementation  by using the ServiceBinder : 
> public static void bind(ServiceBinder binder) {
>   binder.bind(ComponentMessagesSource.class, TestMessageSource.class).withId("test");
> }
> And after, I contributed to the ServiceOverride service, in order to specify the default implementation of the ComponentMessagesSource interface : 
> public static void contributeServiceOverride(MappedConfiguration<Class, Object> configuration,
> @Local ComponentMessagesSource override) {
> 		
>     configuration.add(ComponentMessagesSource.class, override);
> 		
> }
> But when I jetty:run my application, I have got this message error : 
> Render queue error in BeginRender[core/PropertyEditBlocks:numberfield]: Failure reading parameter 'translate' of component core/PropertyEditBlocks:numberfield: Exception constructing service 'FieldTranslatorSource': Service interface org.apache.tapestry5.services.messages.ComponentMessagesSource is matched by 2 services: ComponentMessagesSource, Test. Automatic dependency resolution requires that exactly one service implement the interface.
> So, I also checked the implementation of the MasterObjectProviderImpl, and I think Tapestry do not find the right ObjectProvider for my interface. 
> Here is the email sent to me by Howard : 
> There is a definite bug here, and it is related to
> ComponentMessagesSource ... or, more specifically,
> ApplicationMessageCatalogObjectProvider (which is what allows services
> to inject a Messages instance and get a localized version of the
> application messages). ObjectProviders, contributed to the
> MasterObjectProvider service, are part of the general injection
> infrastructure, and thus have the be very tricky to prevent unintended
> dependency loops. Even so, it should be possible to fix this with a
> little recoding
> Thanks 
> Manu

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (TAP5-1850) Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service

Posted by "Emmanuel DEMEY (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TAP5-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel DEMEY updated TAP5-1850:
---------------------------------

    Attachment: tapestry.zip
    
> Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service
> ------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1850
>                 URL: https://issues.apache.org/jira/browse/TAP5-1850
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3
>            Reporter: Emmanuel DEMEY
>            Priority: Blocker
>         Attachments: tapestry.zip
>
>
> I am working in the migration of one of our Components library : Tapestry 5.2.6 to 5.3, and I have a problem with the ServiceOverride service. 
> I would like to override the default implementation of the ComponentMessagesSource service.  So first, I added this new implementation  by using the ServiceBinder : 
> public static void bind(ServiceBinder binder) {
>   binder.bind(ComponentMessagesSource.class, TestMessageSource.class).withId("test");
> }
> And after, I contributed to the ServiceOverride service, in order to specify the default implementation of the ComponentMessagesSource interface : 
> public static void contributeServiceOverride(MappedConfiguration<Class, Object> configuration,
> @Local ComponentMessagesSource override) {
> 		
>     configuration.add(ComponentMessagesSource.class, override);
> 		
> }
> But when I jetty:run my application, I have got this message error : 
> Render queue error in BeginRender[core/PropertyEditBlocks:numberfield]: Failure reading parameter 'translate' of component core/PropertyEditBlocks:numberfield: Exception constructing service 'FieldTranslatorSource': Service interface org.apache.tapestry5.services.messages.ComponentMessagesSource is matched by 2 services: ComponentMessagesSource, Test. Automatic dependency resolution requires that exactly one service implement the interface.
> So, I also checked the implementation of the MasterObjectProviderImpl, and I think Tapestry do not find the right ObjectProvider for my interface. 
> Here is the email sent to me by Howard : 
> There is a definite bug here, and it is related to
> ComponentMessagesSource ... or, more specifically,
> ApplicationMessageCatalogObjectProvider (which is what allows services
> to inject a Messages instance and get a localized version of the
> application messages). ObjectProviders, contributed to the
> MasterObjectProvider service, are part of the general injection
> infrastructure, and thus have the be very tricky to prevent unintended
> dependency loops. Even so, it should be possible to fix this with a
> little recoding
> Thanks 
> Manu

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TAP5-1850) Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service

Posted by "Christian Köberl (Commented JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13228378#comment-13228378 ] 

Christian Köberl commented on TAP5-1850:
----------------------------------------

There is a workaround - you can decorate ComponentMessagesSource:

@Match("ComponentMessagesSource") 
public static ComponentMessagesSource decorateComponentMessagesSource (ComponentMessagesSourcedelegate) 
{ 
    return new MyComponentMessagesSource(delegate); 
} 

See also: http://tapestry.1045711.n5.nabble.com/T5-Expanding-Messages-Catalog-for-localization-from-arbitrary-source-td2420856.html
                
> Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service
> ------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1850
>                 URL: https://issues.apache.org/jira/browse/TAP5-1850
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3
>            Reporter: Emmanuel DEMEY
>            Priority: Blocker
>         Attachments: tapestry.zip
>
>
> I am working in the migration of one of our Components library : Tapestry 5.2.6 to 5.3, and I have a problem with the ServiceOverride service. 
> I would like to override the default implementation of the ComponentMessagesSource service.  So first, I added this new implementation  by using the ServiceBinder : 
> public static void bind(ServiceBinder binder) {
>   binder.bind(ComponentMessagesSource.class, TestMessageSource.class).withId("test");
> }
> And after, I contributed to the ServiceOverride service, in order to specify the default implementation of the ComponentMessagesSource interface : 
> public static void contributeServiceOverride(MappedConfiguration<Class, Object> configuration,
> @Local ComponentMessagesSource override) {
> 		
>     configuration.add(ComponentMessagesSource.class, override);
> 		
> }
> But when I jetty:run my application, I have got this message error : 
> Render queue error in BeginRender[core/PropertyEditBlocks:numberfield]: Failure reading parameter 'translate' of component core/PropertyEditBlocks:numberfield: Exception constructing service 'FieldTranslatorSource': Service interface org.apache.tapestry5.services.messages.ComponentMessagesSource is matched by 2 services: ComponentMessagesSource, Test. Automatic dependency resolution requires that exactly one service implement the interface.
> So, I also checked the implementation of the MasterObjectProviderImpl, and I think Tapestry do not find the right ObjectProvider for my interface. 
> Here is the email sent to me by Howard : 
> There is a definite bug here, and it is related to
> ComponentMessagesSource ... or, more specifically,
> ApplicationMessageCatalogObjectProvider (which is what allows services
> to inject a Messages instance and get a localized version of the
> application messages). ObjectProviders, contributed to the
> MasterObjectProvider service, are part of the general injection
> infrastructure, and thus have the be very tricky to prevent unintended
> dependency loops. Even so, it should be possible to fix this with a
> little recoding
> Thanks 
> Manu

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (TAP5-1850) Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service

Posted by "Emmanuel DEMEY (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TAP5-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel DEMEY updated TAP5-1850:
---------------------------------

    Description: 
I am working in the migration of one of our Components library : Tapestry 5.2.6 to 5.3, and I have a problem with the ServiceOverride service. 

I would like to override the default implementation of the ComponentMessagesSource service.  So first, I added this new implementation  by using the ServiceBinder : 

public static void bind(ServiceBinder binder) {
  binder.bind(ComponentMessagesSource.class, TestMessageSource.class).withId("test");
}

And after, I contributed to the ServiceOverride service, in order to specify the default implementation of the ComponentMessagesSource interface : 

public static void contributeServiceOverride(MappedConfiguration<Class, Object> configuration,
@Local ComponentMessagesSource override) {
		
    configuration.add(ComponentMessagesSource.class, override);
		
}

But when I jetty:run my application, I have got this message error : 

Render queue error in BeginRender[core/PropertyEditBlocks:numberfield]: Failure reading parameter 'translate' of component core/PropertyEditBlocks:numberfield: Exception constructing service 'FieldTranslatorSource': Service interface org.apache.tapestry5.services.messages.ComponentMessagesSource is matched by 2 services: ComponentMessagesSource, Test. Automatic dependency resolution requires that exactly one service implement the interface.


So, I also checked the implementation of the MasterObjectProviderImpl, and I think Tapestry do not find the right ObjectProvider for my interface. 

Here is the email sent to me by Howard : 
There is a definite bug here, and it is related to
ComponentMessagesSource ... or, more specifically,
ApplicationMessageCatalogObjectProvider (which is what allows services
to inject a Messages instance and get a localized version of the
application messages). ObjectProviders, contributed to the
MasterObjectProvider service, are part of the general injection
infrastructure, and thus have the be very tricky to prevent unintended
dependency loops. Even so, it should be possible to fix this with a
little recoding

Thanks 

Manu


  was:
I am working in the migration of one of our Components library : Tapestry 5.2.6 to 5.3, and I have a problem with the ServiceOverride service. 

I would like to override the default implementation of the ComponentMessagesSource service.  So first, I added this new implementation  by using the ServiceBinder : 

{code}
public static void bind(ServiceBinder binder) {
  binder.bind(ComponentMessagesSource.class, TestMessageSource.class).withId("test");
}
{code}

And after, I contributed to the ServiceOverride service, in order to specify the default implementation of the ComponentMessagesSource interface : 

{code}
public static void contributeServiceOverride(MappedConfiguration<Class, Object> configuration,
@Local ComponentMessagesSource override) {
		
    configuration.add(ComponentMessagesSource.class, override);
		
}
{code}

But when I jetty:run my application, I have got this message error : 

{code}
Render queue error in BeginRender[core/PropertyEditBlocks:numberfield]: Failure reading parameter 'translate' of component core/PropertyEditBlocks:numberfield: Exception constructing service 'FieldTranslatorSource': Service interface org.apache.tapestry5.services.messages.ComponentMessagesSource is matched by 2 services: ComponentMessagesSource, Test. Automatic dependency resolution requires that exactly one service implement the interface.
{code}

So, I also checked the implementation of the MasterObjectProviderImpl, and I think Tapestry do not find the right ObjectProvider for my interface. 

Here is the email sent to me by Howard : 
There is a definite bug here, and it is related to
ComponentMessagesSource ... or, more specifically,
ApplicationMessageCatalogObjectProvider (which is what allows services
to inject a Messages instance and get a localized version of the
application messages). ObjectProviders, contributed to the
MasterObjectProvider service, are part of the general injection
infrastructure, and thus have the be very tricky to prevent unintended
dependency loops. Even so, it should be possible to fix this with a
little recoding

Thanks 

Manu


    
> Impossible to override the ComponentMessagesSource service, by using the ServiceOverride service
> ------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-1850
>                 URL: https://issues.apache.org/jira/browse/TAP5-1850
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3
>            Reporter: Emmanuel DEMEY
>            Priority: Blocker
>
> I am working in the migration of one of our Components library : Tapestry 5.2.6 to 5.3, and I have a problem with the ServiceOverride service. 
> I would like to override the default implementation of the ComponentMessagesSource service.  So first, I added this new implementation  by using the ServiceBinder : 
> public static void bind(ServiceBinder binder) {
>   binder.bind(ComponentMessagesSource.class, TestMessageSource.class).withId("test");
> }
> And after, I contributed to the ServiceOverride service, in order to specify the default implementation of the ComponentMessagesSource interface : 
> public static void contributeServiceOverride(MappedConfiguration<Class, Object> configuration,
> @Local ComponentMessagesSource override) {
> 		
>     configuration.add(ComponentMessagesSource.class, override);
> 		
> }
> But when I jetty:run my application, I have got this message error : 
> Render queue error in BeginRender[core/PropertyEditBlocks:numberfield]: Failure reading parameter 'translate' of component core/PropertyEditBlocks:numberfield: Exception constructing service 'FieldTranslatorSource': Service interface org.apache.tapestry5.services.messages.ComponentMessagesSource is matched by 2 services: ComponentMessagesSource, Test. Automatic dependency resolution requires that exactly one service implement the interface.
> So, I also checked the implementation of the MasterObjectProviderImpl, and I think Tapestry do not find the right ObjectProvider for my interface. 
> Here is the email sent to me by Howard : 
> There is a definite bug here, and it is related to
> ComponentMessagesSource ... or, more specifically,
> ApplicationMessageCatalogObjectProvider (which is what allows services
> to inject a Messages instance and get a localized version of the
> application messages). ObjectProviders, contributed to the
> MasterObjectProvider service, are part of the general injection
> infrastructure, and thus have the be very tricky to prevent unintended
> dependency loops. Even so, it should be possible to fix this with a
> little recoding
> Thanks 
> Manu

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira