[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2014-01-02 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13860108#comment-13860108
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

imo we should re-visit the name. there isn't one perfect name, however, imo 
it's more an 'InjectableResource' than an 'ExternalResource'.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
> Attachments: DELTASPIKE-399_merged_interface.patch
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-28 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13858041#comment-13858041
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

@john: we can change it once owb 1.2.2 is released, since it doesn't need to 
implement this cdi 1.1 rule.

@christian:
if we just test the stream in the producer and return a custom InputStream as 
proxy instead (which knows the path and opens a real stream lazily), we could 
reduce the impact.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
> Attachments: DELTASPIKE-399_merged_interface.patch
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-28 Thread John D. Ament (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13858040#comment-13858040
 ] 

John D. Ament commented on DELTASPIKE-399:
--

We need to fix the CdiImplementation enum, since the OWB limitation is fixed in 
OWB 1.2.2.  The test will get incorrectly skipped in OWB 1.2.2.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
> Attachments: DELTASPIKE-399_merged_interface.patch
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-28 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13858039#comment-13858039
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

+1 and the same is true for the 2nd #close if the first one fails

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
> Attachments: DELTASPIKE-399_merged_interface.patch
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-28 Thread John D. Ament (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13858036#comment-13858036
 ] 

John D. Ament commented on DELTASPIKE-399:
--

I fixed an issue where the patch was not closing streams that were opened, 
leading to memory leaks.

Since we didn't reach a usable solution in this, I'm going to add support for 
multi InputStreams (via list) in case they expect multiple. (I was really 
hoping to not have to add this)

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
> Attachments: DELTASPIKE-399_merged_interface.patch
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-28 Thread Christian Kaltepoth (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857996#comment-13857996
 ] 

Christian Kaltepoth commented on DELTASPIKE-399:


@ [~struberg]: I agree with John that injecting a Properties object is _not_ 
the main usecase of this feature. The idea is to be able to inject all kind of 
stuff like XML documents, images, other binary data, etc. But I agree that 
injecting an InputStream may be problematic. Either we tell users to inject 
Instance instead or we create some class that allows to open the 
InputStream several times.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
> Attachments: DELTASPIKE-399_ambiguous_file_check.patch, 
> DELTASPIKE-399_merged_interface.patch
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-27 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857838#comment-13857838
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

@john:
next issue: 2 tests (ClasspathResourceTest and FileResourceTest) should never 
use the same archive name (that causes issues, if 'deploymentExportPath' is 
used in arquillian.xml)

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
> Attachments: DELTASPIKE-399_merged_interface.patch
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-27 Thread Mark Struberg (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857636#comment-13857636
 ] 

Mark Struberg commented on DELTASPIKE-399:
--

Forget the compile argument, had an old checkout. Resolved now.

Regarding the InjectionPoint for dynamic look ups: this only got defined in 
CDI-1.1.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
> Attachments: DELTASPIKE-399_merged_interface.patch
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-27 Thread John D. Ament (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857574#comment-13857574
 ] 

John D. Ament commented on DELTASPIKE-399:
--

[~struberg] This is the key feature, not configuration:

{quote}
The @Resource/ResourceProvider support in Solder was more generic and I think 
would still be useful. It easily allows for the loading of .xml files, images, 
etc.
{quote}

To me, configuration is an aside, and is not meant to replace the existing 
ConfigSource mechanisms.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-27 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857558#comment-13857558
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

@mark: +1

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-27 Thread Mark Struberg (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857552#comment-13857552
 ] 

Mark Struberg commented on DELTASPIKE-399:
--

I also think we can ditch the whole StorageType annotation. I see no real use. 
This can be easily merged with the ExternalResourceProvider.

Also this is currently not user friendly from a customer perspective. E.g. you 
would need to have core-impl as _compile_ time scoped because you need the 
FileSystemStorage class on the compile classpath. 
The goal is to have all *impl modules just as _runtime_ dependencies.

I still miss the clear benefit over the ConfigSource mechanism.
The main usecase is to Inject Properties, right?
Injecting an URL or an InputStream does not make much sense, or do you have a 
specific use case for it?
This is 3 lines of trivial code each and I would never do this via injection if 
there is no additional benefit. Or does it provide any XML parsing feature 
beyond just providing the input stream?

The only remaining benefit I can see so far is that it allows to inject 
Properties from a file URL out of the box.
Why not just provide this via a simple feature as auto-registered ConfigSource 
similar to PropertyFileConfig.
Or just extend PropertyFileConfig to detect external resources. Simply parsing 
for "://" and handling it as URL in that case should be enough. 

I think it's good to have this discussion and you brought up the topic. We 
should really improve this part of DeltaSpike.

I also think we might expand the ConfigSource idea by having a 'category' which 
allows own sets of ConfigSources for a specific category.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-27 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857521#comment-13857521
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

@john & jdk7:
we will see jdk6 users for some time and logging an exception should be the 
minimum (in any case - instead of just ignoring it).

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-27 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857503#comment-13857503
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

@romain: i thought about it as well (-> we wouldn't need @StorageType)

@john:
if it can be done, users will do it -> the worst we can do is to keep a known 
issue which can lead to a random behavior.
we can limit it (actively) or implement the more complex cases as well. 
everything else isn't acceptable.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-27 Thread John D. Ament (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857500#comment-13857500
 ] 

John D. Ament commented on DELTASPIKE-399:
--

[~gpetracek] that's ok about closing the input stream, since in JDK 7 it's 
AutoCloseable anyways.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-27 Thread John D. Ament (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857493#comment-13857493
 ] 

John D. Ament commented on DELTASPIKE-399:
--

[~gpetracek] Already sent a separate email to the list about the OWB failure.  
Looks like a OWB bug.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-27 Thread John D. Ament (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857488#comment-13857488
 ] 

John D. Ament commented on DELTASPIKE-399:
--

[~struberg] [~gpetracek] [~romain.manni-bucau] The whole point to this feature 
is a slimmed down version of what is provided by ConfigSource's, for simpler 
use cases.  If someone is running into these issues, they should upgrade to use 
ConfigSource.

Most of what you're describing doesn't apply to the use cases raised by the 
ticket.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-27 Thread Romain Manni-Bucau (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857468#comment-13857468
 ] 

Romain Manni-Bucau commented on DELTASPIKE-399:
---

Guys, why not making the storage an impl of a loader? classpath would use 
classloader, file new File() but users can want to extend it. wdyt?

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-27 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857455#comment-13857455
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

@mark: you would get different results (depending on what you use - injection 
of InputStream vs Properties) since PropertyLoader merges the the data of 
multiple sources. we would need to do the same for inputstream...

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-27 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857445#comment-13857445
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

@mark: +1

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-27 Thread Mark Struberg (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857443#comment-13857443
 ] 

Mark Struberg commented on DELTASPIKE-399:
--

Why not use the already existing PropertyLoader mechanism to handle multiple 
resource files with the same name?

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-27 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857439#comment-13857439
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

@latest commit:
the 'c' in package org.apache.deltaspike.core.api.resour>c Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-26 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857244#comment-13857244
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

with your latest push #1 and #3 are ok, but #8 (possible random result) and #9 
(missing 'c' in the package name) are still open.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-26 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857242#comment-13857242
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

@john: i've to check what you pushed some min. ago (btw. please follow our 
git-workflow and use a rebase instead of a merge - thx)

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-26 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857240#comment-13857240
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

@john - please read/check it again:
@ #1 and #3 are clearly inconsistent
@ #8 if multiple results get returned by #getResources, we have to throw an 
exception in ClasspathResourceProvider#readClassPath (instead of just using the 
first result which leads to a random result)
@ #9 the original issue is fixed, however, as mentioned earlier there is a typo 
(a missing 'c' in the package name - instead of resourceloader there is just 
resoureloader)

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-26 Thread John D. Ament (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857232#comment-13857232
 ] 

John D. Ament commented on DELTASPIKE-399:
--

[~gpetracek] those are already changed/obsolete at this point.  #8 probably 
won't be changed, if someone wants different behavior they can subclass.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-26 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857159#comment-13857159
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

thx john, but please don't forget to fix at least #1, #3, #8 and #9 as well

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-26 Thread John D. Ament (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857155#comment-13857155
 ] 

John D. Ament commented on DELTASPIKE-399:
--

I'm good with the class approach, I'll push that in this evening.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-26 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13857063#comment-13857063
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

@christian:
the enum-suggestion was before the suggestion with the new attribute.
+ agreed - with such an attribute users don't have to replace the producer for 
std. use-cases.

it's more like:

{code}
public interface ResourceStorage {}
public interface Classpath extends ResourceStorage {} //interface or class

public @interface ExternalResource
{
@Nonbinding
String value();

@Nonbinding
Class storage();
}
{code}

with that you can't use other classes accidentally + your ide will suggest what 
you can use.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-26 Thread Christian Kaltepoth (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13856877#comment-13856877
 ] 

Christian Kaltepoth commented on DELTASPIKE-399:


@ [~gpetracek]:

I'm fine with using a marker interface instead of a string to make it more 
type-safe. So you are talking about something like this, right?

{code}
@ExternalResource(storage=Classpath.class, name="myapp.properties") 
{code} 

With {{Classpath}} being a simple marker interface:

{code}
public interface Classpath {}
{code}

That's fine. But you were talking about enums before which I don't think is a 
good idea because users cannot extend them.

Perhaps it would make even more sense to use an annotation instead of an 
attribute for the storage. Something like:

{code}
@Classpath
@ExternalResource("myapp.properties") 
{code} 
 
Regarding #1 + #2: I think we need something like the {{storage}} attribute 
now, because the current implementation simply tries all 
{{ExternalResourceProvider}} and returns the first resource found, which is 
(like discussed before) not what we want. 

BTW: I don't get what you mean with "replacing a producer". Basically the 
storage attribute is used to select a {{ExternalResourceProvider}} that should 
be used to load the resource. So there is no need to replace anything. Users 
could provider alternative providers that retrieve resources from other places. 
And I think allowing users to add other provider implementations is a very 
important feature.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-25 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13856562#comment-13856562
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

@christian:
"storage" as a string is the style of other containers and not cdi (and ds).
if we really need it, we can provide a marker interface and keep the 
information type-safe (like with bv-groups, type-safe view-config,...).
users will only have 1-2 implementations - so it isn't a big issue (+ it should 
be an edge case anyway).
replacing an internal producer should be only the last resort and is (/should 
be) a clear edge case (for users).

the point is:
#1 for our current implementation (we provide out-of-the-box) we don't need an 
additional marker/information at all
#2 if we really need it in the future, we can add it at any time
#3 if users really hit edge cases and they replace the producer (most won't do 
that at all btw.), they can use a custom marker annotation
 (but as mentioned before: we don't need it out-of-the-box)

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-24 Thread Christian Kaltepoth (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13856231#comment-13856231
 ] 

Christian Kaltepoth commented on DELTASPIKE-399:


@ [~johnament]: 

A) Regarding the Servlet module: I think it would make sense to provide an 
{{ExternalResourceProvider}} that uses {{ServletContext.getResource()}}. This 
is very useful if you want to load resources that are packed in a WAR. Say you 
want to load {{web.xml}} for whatever reason. You could just use:

{code}
@ExternalResource(storage="web", name="WEB-INF/web.xml") 
{code}

B) I like Gerhard's idea of simply inferring the format of a Properties 
resource from the file name. IMHO {{.properties}} should be the default as most 
people are using this format. So we could simply use 
{{Properties.loadFromXML()}} only if the name of the resource ends with 
{{.xml}}. I think this is a nice example for using convention over 
configuration.

C) I agree with John that using a simple string as an location identifier is 
fine:

{code}
@ExternalResource(storage="classpath", name="myapp.properties") 
{code}

This way uses can provide custom {{ExternalResourceProvider}} implementations 
very easily. But we could provider some constants for the storage types we 
provide out of the box:

{code}
@ExternalResource(storage=StorageType.CLASSPATH, name="myapp.properties") 
{code}


> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-23 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13855876#comment-13855876
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

btw. i don't see the reason for keeping the info at all.

if you have
@ExternalResource("xyz.properties")
and
@ExternalResource("xyz.xml")
it's pretty clear and the producer can be smart enough to handle it correctly 
(without an additional annotation/enum/string-value/...).

@"most is fixed already":
i don't think so (maybe you haven't pushed everything) - esp.:
@ #1 you saw on the mailing list that we should keep the approach we have (i 
never said that i like it, but it's more important to be consistent)
@ #3 also still not aligned with the rest of ds (i would also prefer 
"priority", but it's more important to be consistent)
@ #6 there is still no agreement, but doing it manually (for all parts of ds) 
is just broken over time
@ #8 still not fixed and a clear issue
@ #9 there is still a typo: resoureloader (instead of resourceloader)

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-23 Thread John D. Ament (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13855755#comment-13855755
 ] 

John D. Ament commented on DELTASPIKE-399:
--

My preference at this point is to go the route described:
{noformat}
@ExternalResource(storage="file",name="myapp.properties") 
{noformat}

The storage attribute, we can provide a set of constants, to allow devs to 
extend it as needed.

It seems like what you're saying
bq. you can just provide a custom producer (+ a custom annotation).

Matched exactly what I did for @XMLProperties


Please also recheck as most of 1-9 are now fixed, where it makes sense (and 
some of the things seem like we're trying to limit ourselves).

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-23 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13855741#comment-13855741
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

with what we have right now, you can just provide a custom producer (+ a custom 
annotation).
if you really need to do it (for whatever reason), you can still do it with the 
enum approach. there is no blocker, just because we would use an enum 
out-of-the-box.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-23 Thread John D. Ament (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13855736#comment-13855736
 ] 

John D. Ament commented on DELTASPIKE-399:
--

An app developer should not be overriding a framework provided class.  An app 
developer cannot add new enum values.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-23 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13855712#comment-13855712
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

john: @XMLProperties:
that's not correct since you have the handling in the producer -> if we need 
something in addition you have to add a new annotation + the handling in 
ExternalResourceProducer#getProperties. with an enum you have to do the same 
(just instead the new annotation a new enum-value), but you have only one 
annotation users have to remember (you don't have to remember the enum, because 
it's given...).

in any case: if you need something highly special and you would create a 
special annotation for it (for whatever reason), you can still do it - but we 
don't need it for the functionality we provide out-of-the-box.

btw. it even fails with
 mvn clean install -Ptomee-build-managed
and
 mvn clean install -Pjbossas-build-managed-7
with a NullPointerException

we are close to a new release and this ticket is highly blocking. -> let's fix 
#1-#9 as well as the build or postpone it (= revert it for now).

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-21 Thread John D. Ament (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13855077#comment-13855077
 ] 

John D. Ament commented on DELTASPIKE-399:
--

[~chkal] I'll create a separate ticket to make a priority interface/abstract 
class & comparator.  I agree, it's something we need globally.

When I first prototyping it, I actually used classpath: and file: to 
differentiate.  It definitely works more consistently, and I agree searching 
through is a pain.  At one point I had a `canProivde` method that indicated 
whether or not the value could be read.  I think the CDI-esque way would be to 
use a qualifier on what prefix is handled.

actually, I looked at first at doing this in the servlet module.  From what I'm 
seeing, servlet support isn't actually needed for any use case, you can use 
file to locate it.  I didn't try in every app server mind you.  Is there a 
scenario you can think of that requires servlet context?

[~gpetracek] The reason @XMLProperties is a separate annotation is that it only 
applies to property based loading.  We can't scale well if we need to add new 
attributes/enum values, and we make a lot of inter-dependency by adding them 
unnecessarily.  For example @XMLProperties wouldn't apply if the source was a 
DB table.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-19 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13852960#comment-13852960
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

@christian:
if "classpath:" is needed, it should be available as enum-value...

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-18 Thread Christian Kaltepoth (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13851912#comment-13851912
 ] 

Christian Kaltepoth commented on DELTASPIKE-399:


Hey John,

first of all, thanks for starting to work on this. I really think this will be 
a very useful feature.

I just had a quick look at the code and want to give some feedback.

#1 Regarding ExternalResourceProviderComparator. As we now have some APIs that 
use some kind of priority/ordinal for ordering, we should think about creating 
an interface for this. This way we could build a single comparator that would 
work for all the classes that implement this interface. I'm thinking about 
something like [1]. Thoughts?

#2 To be honest, I'm not quite happy with the fact that the code currently 
tries all ExternalResourceProviders to find a matching resource. As Gerhard 
already pointed out, this may lead to weird effects if more than one provider 
returns a result. I was thinking if we could instead use some kind of prefix in 
the resource name to identifier which provider to use. Something like:

{code}
@Inject
@ExternalResource("classpath:myconfig.properties")
private InputStream inputStream;
{code}

Spring uses a similar concept. I think this would make sense because the users 
typically know from which place the resource should be loaded. So we should 
allow them to specify it. I think this will be easy to implement if the 
provider API supports this concept. 

#3 We could think about adding an ExternalResourceProvider for web resources 
which uses ServletContext.getResource() and add it to the Servlet module.
 

[1] 
https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Weighted.java

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-17 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13851473#comment-13851473
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

@ #2 XMLProperties is just a simple marker which can be part of 
ExternalResource itself (e.g. as format-enum to be extensible in the future). 
we agreed on using as few annotations as possible, because it's easier for 
users.
@ #4: -1 we should be consistent
@ #6: please start a discussion on the list and provide the whole info (e.g. 
why it just helps a bit. imo: if we do it, we should generate it with a 
maven-plugin - everything else is broken over time).
@ #10: everybody is welcome to write as many as needed. i would be happy not to 
write a single one - i just found more and more the more i looked at the code.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-17 Thread John D. Ament (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13851350#comment-13851350
 ] 

John D. Ament commented on DELTASPIKE-399:
--

The use of extension is pretty much needed for my working environment, and 
actually will help us a bit to support EARs.  I'll create a task to implement 
extensions for most of our functionality, as I'm coming across needs to 
implement it.

#2 I don't quite follow.

#4 we shouldn't limit API usage just because it's not what we already are using.

#10 Please try to be concise with your code review comments and edits, I ended 
up receiving 14 emails.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-12-15 Thread John D. Ament (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13848739#comment-13848739
 ] 

John D. Ament commented on DELTASPIKE-399:
--

I ended up calling the annotation `@ExternalResource` to avoid the name clash.  
I also only added support for properties and `InputStream`s.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-08-19 Thread Christian Kaltepoth (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13744727#comment-13744727
 ] 

Christian Kaltepoth commented on DELTASPIKE-399:


Yeah, I think you are right. Seems like it is even simpler then I thought. In 
this case we should just describe this "pattern" in the documentation so that 
people know how to do it the right way.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-08-19 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13743780#comment-13743780
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

i'm not sure about that, because you can do the same with a custom producer.
if you inject the url into the producer, you have to write the same code (with 
the std. cdi-api).

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


Re: [jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-08-19 Thread hantsy
I hope there is more generic way to load the resource.

The javax.annotation.Resource focus on JNDI resources.

I hope there is a way like this.

@Resource("classpath*:/app.properties")
Properties pro;

@Resource("jndi:java:/jboss/datasources/ExampleDS")
DataSource dataSource;

@Resource("http://localhost:8080/myapp/user/1.json";)
  JsonObject json;

@Resource("file:///D:/app.properties")
  File pro;
or

@Resource(value="xyz:myresousepath", resolver=MySolver.class )
  MyObject dataSource;

the value is :...and an optional custom
ResourceResolver(by default, should resgister the some generic resource
resovler by protocol, such as classpath, and jndi, and all url based. )
to discovery the resource, and convert the resource result to required
object.


Hantsy

On 8/19/2013 16:09, Christian Kaltepoth (JIRA) wrote:
> [ 
> https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13743617#comment-13743617
>  ] 
>
> Christian Kaltepoth commented on DELTASPIKE-399:
> 
>
> I agree with Gerhard that we should avoid name clashes. What about 
> @ClasspathResource?
>
> What do you think about extending what Solder provided by supporting 
> injection of other types than URL and InputStream? We could provide an SPI to 
> allow users to extend the types that are supported.
>
> Imagine this example. A user wants to load a FreeMarker template from the 
> classpath. Wouldn't it be nice to be able to do something like this:
>
> @Inject
> @ClasspathResource(name="template.ftl", loader=TemplateLoader.class)
> private Template myTemplate;
>
> Where TemplateLoader is an implementation of an interface like this:
>
> public interface ResourceLoader {
>   T load(URL url);
> }
>
> Actually I don't think the user will have to explicitly name the loader to 
> use. This could be done automatically.
>
> Thoughts?
> 
>> Incorporate Solder's ResourceLoader features into DeltaSpike
>> 
>>
>> Key: DELTASPIKE-399
>> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
>> Project: DeltaSpike
>>  Issue Type: New Feature
>>  Components: Core
>>Affects Versions: 0.4
>>Reporter: Aaron Siri
>>Assignee: John D. Ament
>>Priority: Minor
>> Fix For: 0.6
>>
>>
>> Seam 3's Solder module had some nice resource loading functionality within 
>> the org.jboss.solder.resourceLoader packages.  With it you could do the 
>> following:
>> // Load a properties file
>> @Inject @Resource("app.properties")
>> private Properties appProperties;
>> or:
>> @Inject
>> private ResourceProvider resourceProvider
>> public Properties getHostProperties() {
>>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
>> }
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA administrators
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>



[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-08-19 Thread Christian Kaltepoth (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13743617#comment-13743617
 ] 

Christian Kaltepoth commented on DELTASPIKE-399:


I agree with Gerhard that we should avoid name clashes. What about 
@ClasspathResource?

What do you think about extending what Solder provided by supporting injection 
of other types than URL and InputStream? We could provide an SPI to allow users 
to extend the types that are supported.

Imagine this example. A user wants to load a FreeMarker template from the 
classpath. Wouldn't it be nice to be able to do something like this:

@Inject
@ClasspathResource(name="template.ftl", loader=TemplateLoader.class)
private Template myTemplate;

Where TemplateLoader is an implementation of an interface like this:

public interface ResourceLoader {
  T load(URL url);
}

Actually I don't think the user will have to explicitly name the loader to use. 
This could be done automatically.

Thoughts?

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-08-17 Thread Gerhard Petracek (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13742926#comment-13742926
 ] 

Gerhard Petracek commented on DELTASPIKE-399:
-

+0, but not for the name (there is already javax.annotation.Resource) and we 
should avoid (/reduce the number of) name clashes.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-08-17 Thread Mark Struberg (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13742910#comment-13742910
 ] 

Mark Struberg commented on DELTASPIKE-399:
--

sounds ok for 0.6.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Assignee: John D. Ament
>Priority: Minor
> Fix For: 0.6
>
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-08-17 Thread John D. Ament (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13742906#comment-13742906
 ] 

John D. Ament commented on DELTASPIKE-399:
--

+1

I'll work on porting it.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Priority: Minor
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-08-17 Thread Christian Kaltepoth (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13742864#comment-13742864
 ] 

Christian Kaltepoth commented on DELTASPIKE-399:


Actually I like the idea of having such a feature in DeltaSpike. 

I agree with Aaron that loading configuration is a very special case that 
should be implemented using a ConfigSource instead. But often there is a need 
to load other stuff from the classpath. Typically you have to use the context 
classloader to access such resources and this code can be very difficult to 
test sometimes. The ability to simply inject such resources would be a great 
addition to DeltaSpike IMHO.

Just for completeness, here is the documentation of the original Solder feature:

http://docs.jboss.org/seam/3/3.1.0.Final/reference/en-US/html/solder-resourceloading.html

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Priority: Minor
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-08-10 Thread Aaron Siri (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13735908#comment-13735908
 ] 

Aaron Siri commented on DELTASPIKE-399:
---

The ConfigSource mechanism looks like it'd meet my needs and I'm going to give 
it a try but it has a specific purpose.  The @Resource/ResourceProvider support 
in Solder was more generic and I think would still be useful.  It easily allows 
for the loading of .xml files, images, etc.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Priority: Minor
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-08-10 Thread Mark Struberg (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13735889#comment-13735889
 ] 

Mark Struberg commented on DELTASPIKE-399:
--

great you found it. For completeness: 
http://deltaspike.apache.org/configuration.html

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Priority: Minor
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-08-10 Thread Aaron Siri (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13735888#comment-13735888
 ] 

Aaron Siri commented on DELTASPIKE-399:
---

Never mind - found the docs.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Priority: Minor
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-08-10 Thread Aaron Siri (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13735886#comment-13735886
 ] 

Aaron Siri commented on DELTASPIKE-399:
---

Is there documentation on this anywhere?  I don't see any mention of it.

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Priority: Minor
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (DELTASPIKE-399) Incorporate Solder's ResourceLoader features into DeltaSpike

2013-08-10 Thread Mark Struberg (JIRA)

[ 
https://issues.apache.org/jira/browse/DELTASPIKE-399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13735885#comment-13735885
 ] 

Mark Struberg commented on DELTASPIKE-399:
--

did you look at our ConfigSource mechanism already? This provides very similar 
features, but much more powerful imo. Please report back if you are missing 
something - txs!

> Incorporate Solder's ResourceLoader features into DeltaSpike
> 
>
> Key: DELTASPIKE-399
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-399
> Project: DeltaSpike
>  Issue Type: New Feature
>  Components: Core
>Affects Versions: 0.4
>Reporter: Aaron Siri
>Priority: Minor
>
> Seam 3's Solder module had some nice resource loading functionality within 
> the org.jboss.solder.resourceLoader packages.  With it you could do the 
> following:
> // Load a properties file
> @Inject @Resource("app.properties")
> private Properties appProperties;
> or:
> @Inject
> private ResourceProvider resourceProvider
> public Properties getHostProperties() {
>String hostname = java.net.InetAddress.getLocalHost().getHostName();
>return resourceProvider.loadPropertiesBundle(hostname + ".properties");
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira