OK, thanks to the SVN links, I see I need to reference the service by the Java 
class of the interface, not by the id which I assigned to that service).  Very 
curious and I either missed that in the docs or (once again?) it's not 
documented.

I swear, back in Tap2.0 I was an evangelist, but at this point using Tapestry 
feels like coding by braille or utter trial and error.  Is that just me or is 
there some hard to find great docs that everyone else has read?  If so, please, 
please pass along the link. 

Thanks, 

Ezra Epstein 


-----Original Message-----
From: Epstein, Ezra [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 11, 2006 1:19 PM
To: Tapestry users
Subject: RE: General HiveMind questions

Thanks.  I'm not (yet) using autowire (nor Tap4.1) so how does one reference 
something in a page?  I'm trying to use an annotation but it's not working.  
Here are some details:

<html-snippet file="View.html">
<p><span jwcid="@Insert" value="ognl:date">Monday</span></p>

<p><span jwcid="@Insert" value="ognl:jndiServiceString">jndi info</span></p> 
</html-snippet>

<java-snippet file="View.java">
import java.util.Date;

import org.apache.hivemind.lib.NameLookup;
import org.apache.tapestry.annotations.InjectObject;
import org.apache.tapestry.html.BasePage;

public abstract class View extends BasePage {
        
        @InjectObject("service:jndiLookup")
        public abstract NameLookup getJndiLookupService();

        // This blows chunks.
        public String getJndiServiceString() {
                return getJndiLookupService().toString();
        }
        
        // This works
        public String getDate() {
                return (new Date()).toString();
        }
        
}
</java-snippet>

<xml-snippet file="hivemodule.xml">
<?xml version="1.0"?>
<module id="CustomTeamPageAdmin" version="1.0.0">

        <service-point id="jndiLookup"
                interface="org.apache.hivemind.lib.NameLookup"
                parameters-occurs="none">

                <invoke-factory service-id="hivemind.BuilderFactory"
                        model="singleton">

                        <construct 
class="org.apache.hivemind.lib.impl.NameLookupImpl">
                                <set property="initialFactory"
                                        
value="org.jnp.interfaces.NamingContextFactory" />
                                <set property="URLPackages"
                                        
value="org.jboss.naming:org.jnp.interfaces" />
                                <set property="providerURL"
                                        value="jnp://localhost:1099" />
                                <set-service property="coordinator"
                                        service-id="RemoteExceptionCoordinator" 
/>
                                <event-listener 
service-id="RemoteExceptionCoordinator" />
                        </construct>

                </invoke-factory>
        </service-point>
</module>
</xml-snippet>


The hivemodule.xml is in the WEB-INF folder and is being found and parsed (I 
know, because I initially left out the version attribute and saw an exception 
in the JBoss logs).

The above doesn't work.  Am I referencing the hivemind stuff the wrong way? 
using the annotation incorrectly?  HiveMind is completely silent on the subject 
(nothing in the JBoss logs or the page) what I see is:

<output-snippet>
org.apache.tapestry.BindingException
Unable to read OGNL expression '<parsed OGNL expression>' of [EMAIL PROTECTED]: 
jndiServiceString
binding         ExpressionBinding[View jndiServiceString]
location        context:/View.html, line 11
6       
7       <div jwcid="@For" source="ognl:list" value="ognl:item">
8       <span jwcid="@Insert" value="ognl:item" /><br />
9       </div>
10      
11      <p><span jwcid="@Insert" value="ognl:jndiServiceString">jndi 
info</span></p>
12      
13      </body>
14      </html>
org.apache.hivemind.ApplicationRuntimeException
Unable to read OGNL expression '<parsed OGNL expression>' of [EMAIL PROTECTED]: 
jndiServiceString
component       [EMAIL PROTECTED]
location        context:/View.html
ognl.OgnlException
jndiServiceString
java.lang.AbstractMethodError
amazon.pizza.portal.tapestry.pages.View.getJndiLookupService()Lorg/apache/hivemind/lib/NameLookup;

    * amazon.pizza.portal.tapestry.pages.View.getJndiServiceString(View.java:21)
    * sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    * 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    * 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    * java.lang.reflect.Method.invoke(Method.java:585)
    * ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:491)
</output-snippet>

Which, thanks to the vaunted "line-precise error reporting," tells me exactly 
what I already knew and very little about what's causing the issue.  Hence this 
post.... Any help appreciated.

BTW, I can't for the best Google query I can construct, find a simple example 
of accessing a JNDI object via HiveMind and using it in Tapestry page or 
component.  I'd think this would be a canonical example.  I find plenty with 
Spring, of course, ...

Ezra Epstein 


-----Original Message-----
From: James Carman [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 11, 2006 12:17 PM
To: 'Tapestry users'
Subject: RE: General HiveMind questions

Well, HiveMind does support "bean" services, but they're not recommended really 
(at least not by me).  Interface-based services are preferred.
Anyway, if you have to use a bean, all you have to do is use the bean class as 
the interface when defining your service.  You can set your "parameters"
by autowiring (if they're supposed to be references to other HiveMind
services) or using XML inside the hivemodule.xml file.  If you're using 
tapestry-autowire (or Tap4.1), then all you have to do is declare an abstract 
getter of the same type as your bean class and Tapestry will automatically look 
it up for you.

-----Original Message-----
From: Epstein, Ezra [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 11, 2006 3:12 PM
To: Tapestry users
Subject: General HiveMind questions

So I've got an object I want to make available to a Tapestry page and I want to 
use HiveMind to do this.  What are the steps one takes?

More specifically: the object does *not* implement an interface; the object has 
parameters (set via mutator methods).

(Maybe should be posted on the HiveMind lists) 

Thanks, 

Ezra Epstein 

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




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

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

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

Reply via email to