Ok I've made some progress.

First of all, my component not loading issue was a problem with eclipse/maven plugin. As I said I created a different project for my test component lib, also using maven, and used mvn install to install the artifact to my local repo. I manually added this artifact as a dependency to my Tapestry app's pom.xml, and then things got a bit odd. The maven 2 plugin creates an eclipse library that dynamically includes all artifact jars of each artifact listed as a dependency in the pom. However, with my test lib it didn't to this. Instead it showed a bland folder icon with the same name as my test lib project. I verified this was caused by my pom entry by removing the dep from the pom and cleaning the project. So to confirm this test I created a "normal" user library (called "Mine") and manually added the test lib artifact to it. Now I am able to use my component in my tap app! If anyone has any suggestions for configuring eclipse/m2 plugin to behave, that'd be much appreciated!

Now how to reference the component. I've noticed some slight inconsistencies in using components (or passing component params) in templates. For my component, if I want to use tap's invisible instrumentation, I have to do this:

<div t:type="testlib/TestComp"/>

Note that this WILL NOT work:

<div t:type="testlib.TestComp"/>

However, the inverse is true using tap-namespaced tags:

<t:testlib.TestComp/>

Works, while this DOES NOT:

<t:testlib/TestComp/>

That makes sense because "<t:testlib/TestComp/>" is invalid XML, but the fact that "<div t:type="testlib.TestComp"/>" causes an error is inconsistent, and I find it a bit annoying.

I hope this helps - let me know how you fare.

sincerely,
chris

Kolesnikov, Alexander GNI wrote:
Hi Chris,

The only idea I have so far is that the problem is in HTML template that
goes into the same package as the page class. I would try creating a
component without template to test this. Do not have time at the moment
though, will try later.
I suspect that T5 with its pro-Maven orientation expects to see HTML
stuff in some other place, like resources.

I wonder if Ted could give us a hint on how he managed to package his
components...

Cheers,

Alexander

-----Original Message-----
From: Chris Lewis [mailto:[EMAIL PROTECTED] Sent: 19 September 2007 14:59
To: Tapestry users
Subject: Re: [T5] Can't make custom library work


Hi Alexander,

I too am curious about this - I'm in the same situation. I've started poking into ComponentClassResolverImpl but haven't caught anything yet. Do tell if you discover anything.

sincerely,
chris

Kolesnikov, Alexander GNI wrote:
Finally, logging shows that contributeComponentClassResolver() method in the library's module actually runs. Does Tapestry expect the components not to be POJOs? Questions, questions... Will go look into the source.

-----Original Message-----
From: Kolesnikov, Alexander GNI
Sent: 19 September 2007 13:45
To: Tapestry users
Subject: RE: [T5] Can't make custom library work


The additional detail is that if I change the reference in the manifest misspelling the module name, the application doesn't start, throwing ClassNotFoundException. Which proves that Tapestry does read the manifest and tries to load the library's module. Why it doesn't see the components then?

-----Original Message-----
From: Kolesnikov, Alexander GNI
Sent: 19 September 2007 11:45
To: Tapestry users
Subject: [T5] Can't make custom library work


I am trying to create and use a trivial custom library.

Here is the component:

TestComp.java:

package com.test.components;

public class TestComp {
        public String getMessage() {
                return "Test message";
        }
}

TestComp.html:

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
        <p>${message}</p>
</html>

Here is its module:

package com.test;

import org.apache.tapestry.ioc.Configuration;
import org.apache.tapestry.services.LibraryMapping;

public class TestModule {
public static void contributeComponentClassResolver(Configuration<LibraryMapping>
configuration){
                configuration.add(new LibraryMapping("test",
"com.test"));
        }
}

Here is the manifest:

Manifest-Version: 1.0
Tapestry-Module-Classes: com.test.TestModule


The testlib.jar is packaged like so:

META-INF/MANIFEST.MF
com/test/TestModule.class
com/test/components/TestComp.class
com/test/components/TestComp.html

This JAR is placed into WEB-INF/lib of a T5 application and I am trying to display the test component like so:

<t:test.TestComp/>

The result is:

Unable to resolve component type 'test/TestComp' to a component class name. Available component types: core/ActionLink, core/BeanEditForm, core/Checkbox, core/ComponentMessages, core/Delegate, core/Errors, core/Form, core/FormSupportImpl, core/Grid, core/GridCell, core/GridColumns, core/GridPager, core/GridRows, core/If, core/Label, core/Loop, core/Output, core/OutputRaw, core/PageLink, core/Palette, core/PasswordField, core/Radio, core/RadioGroup, core/RenderObject, core/Select, core/Submit, core/TextArea, core/TextField, fckeditor/Editor, jscalendar/DatePicker.

Why Tapestry doesn't see my component I wonder?

----------------------------------------------------------------------
--
------
CONFIDENTIALITY NOTICE: If you have received this email in error,
please
immediately notify the sender by e-mail at the address shown.  This
email transmission may contain confidential information.  This
information is intended only for the use of the individual(s) or
entity
to whom it is intended even if addressed incorrectly.  Please delete
it
from your files if you are not the intended recipient.  Thank you for
your compliance.  Copyright 2007 CIGNA

========================================================================
======

----------------------------------------------------------------------
--
------
CONFIDENTIALITY NOTICE: If you have received this email in error,
please
immediately notify the sender by e-mail at the address shown.  This
email transmission may contain confidential information.  This
information is intended only for the use of the individual(s) or
entity
to whom it is intended even if addressed incorrectly.  Please delete
it
from your files if you are not the intended recipient.  Thank you for
your compliance.  Copyright 2007 CIGNA

========================================================================
======


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



----------------------------------------------------------------------
--------
CONFIDENTIALITY NOTICE: If you have received this email in error,
please immediately notify the sender by e-mail at the address shown.
This email transmission may contain confidential information.  This
information is intended only for the use of the individual(s) or entity
to whom it is intended even if addressed incorrectly.  Please delete it
from your files if you are not the intended recipient.  Thank you for
your compliance.  Copyright 2007 CIGNA
========================================================================
======
---------------------------------------------------------------------
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]



------------------------------------------------------------------------------
CONFIDENTIALITY NOTICE: If you have received this email in error, please 
immediately notify the sender by e-mail at the address shown.  This email 
transmission may contain confidential information.  This information is 
intended only for the use of the individual(s) or entity to whom it is intended 
even if addressed incorrectly.  Please delete it from your files if you are not 
the intended recipient.  Thank you for your compliance.  Copyright 2007 CIGNA
==============================================================================


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



Reply via email to