Spring Security (née acegi) integration str ategy?

2008-08-15 Thread David Nedrow
In general, when planning to implement Spring Security for  
authentication, what is generally considered the best way to do so?


1) Implement the app completely with Wicket Security (wasp/swarm/hive)  
and then add in Spring Security?


2) Start with Spring Security and Wicket Security from the start?

Thoughts?

-David

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



Any wicketstuff.org site admins around?

2008-08-11 Thread David Nedrow
It doesn't look as though there is any way to send a message to the  
site admins listed on the Wicket Stuff site.


The web server is not setting the correct mime-type for .war files.

If any of the admins see this, could you add something like the  
following (assuming Apache httpd)...


AddType application/octet-stream .war

-David

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



Re: Decoding hierarchy errors (resolved)

2008-07-26 Thread David Nedrow

NM, looks like I had a bad tag in the html.

-David


On Jul 25, 2008, at 2:42 PM, David Nedrow wrote:


I have the following setup...

Page
TabbedPanel
Tab
Panel
ModalWindow
Panel
Form
FeedbackPanel

In the form, I've defined...

   final FeedbackPanel feedback = new  
FeedbackPanel(createuserfeedback);

   form.add(feedback);

This feedback panel is to be used to provide corrective guidance to  
users for field entry via a custom Validator.


The HTML for the Panel containing the form is pretty simple...

wicket:panel
form
span wicket:id=createuserfeedback/
...
/form
/wicket:panel

However, when I run the app, I received the following error...

WicketMessage: Unable to find component with id 'createuserfeedback'  
in [MarkupContainer [Component id = content, page =  
com.vzbi.ncs.argfrp.webapp.FilterRequest.web.pages.TabbedPanelPage,  
path = 2:tabs:panel:modalwindow:content.UserCreateModalWindow$1,  
isVisible = true, isVersioned = false]]. This means that you  
declared wicket:id=createuserfeedback in your markup, but that you  
either did not add the component to your page at all, or that the  
hierarchy does not match.
[markup = file:/Users/dnedrow/Developer/NetBeansProjects/ArgfrpEE/ 
dist/gfdeploy/FilterRequest_war/WEB-INF/classes/com/vzbi/ncs/argfrp/ 
webapp/FilterRequest/web/panels/UserCreatePanel.html

wicket:panel
form name=form
span wicket:id=createuserfeedback/span
...
   /form
/wicket:panel
, index = 2, current = 'div wicket:id=createuserfeedback' (line  
3, column 9)]


The target in the HTML matches the component id in the java file, so  
I'm guessing there is a hierarchy problem?


Any ideas?

-David

-
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]



Decoding hierarchy errors

2008-07-25 Thread David Nedrow

I have the following setup...

Page
TabbedPanel
Tab
Panel
ModalWindow
Panel
Form
FeedbackPanel

In the form, I've defined...

final FeedbackPanel feedback = new  
FeedbackPanel(createuserfeedback);

form.add(feedback);

This feedback panel is to be used to provide corrective guidance to  
users for field entry via a custom Validator.


The HTML for the Panel containing the form is pretty simple...

wicket:panel
form
span wicket:id=createuserfeedback/
...
/form
/wicket:panel

However, when I run the app, I received the following error...

WicketMessage: Unable to find component with id 'createuserfeedback'  
in [MarkupContainer [Component id = content, page =  
com.vzbi.ncs.argfrp.webapp.FilterRequest.web.pages.TabbedPanelPage,  
path = 2:tabs:panel:modalwindow:content.UserCreateModalWindow$1,  
isVisible = true, isVersioned = false]]. This means that you declared  
wicket:id=createuserfeedback in your markup, but that you either did  
not add the component to your page at all, or that the hierarchy does  
not match.
[markup = file:/Users/dnedrow/Developer/NetBeansProjects/ArgfrpEE/dist/ 
gfdeploy/FilterRequest_war/WEB-INF/classes/com/vzbi/ncs/argfrp/webapp/ 
FilterRequest/web/panels/UserCreatePanel.html

wicket:panel
form name=form
span wicket:id=createuserfeedback/span
...
/form
/wicket:panel
, index = 2, current = 'div wicket:id=createuserfeedback' (line 3,  
column 9)]


The target in the HTML matches the component id in the java file, so  
I'm guessing there is a hierarchy problem?


Any ideas?

-David

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



Spring injection not working

2008-07-23 Thread David Nedrow
I believe (though I'm clearly wrong in that belief) that I have  
everything properly configured to allow spring injection along the  
lines of:


import com.foo.dao.UserDAO;
@Spring
private UserDAO userDAO;

Meaning that for a bean defined in the applicationContext as . . .

bean id=UserDAO class=com.foo.dao.UserDAO
property name=entityManagerFactory  
ref=entityManagerFactory /

/bean

. . . I don't have to do anything else to utilize the bean. There is  
an added complexity in that I am using interfaces for the DAOs, ie.  
UserDAO implements IUserDAO.


I've tried using different combinations of interface and dao, like the  
following


import com.foo.dao.IUserDAO;
import com.foo.dao.UserDAO;
@Spring(name=userDAO)
private IUserDAO userDAO;

No matter what I've tried, userDAO remains unitialized.

I have to resort to the following to get hold of the DAO...

ApplicationContextapplicationContext =  
((WicketApplication) Application.get()).getContext();
IUserDAOdao=  
UserDAO.getFromApplicationContext(applicationContext);




Anyone have a guess at what I'm not doing correctly?

I should note that in the main application class, the init makes the  
following call . . .


addComponentInstantiationListener(new  
SpringComponentInjector(this));



And the entity manager is defined as follows . . .

bean id=entityManagerFactory
 
class 
=org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
property name=persistenceUnitManager  
ref=persistenceUnitManager/

property name=persistenceUnitName value=NetConfPU/
/bean


-David

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



Re: Spring injection not working

2008-07-23 Thread David Nedrow

On Jul 23, 2008, at 12:10 PM, James Carman wrote:


Have you tried using @SpringBean?

On Wed, Jul 23, 2008 at 12:04 PM, David Nedrow [EMAIL PROTECTED]  
wrote:
I believe (though I'm clearly wrong in that belief) that I have  
everything

properly configured to allow spring injection along the lines of:

import com.foo.dao.UserDAO;
@Spring
private UserDAO userDAO;


D'oh! Yes, I'm using @SpringBean.

I wish it was that simple. ;)

I was typing the examples I included in my original message, rather  
than copy and paste and flubbed it.


Wherever @Spring is in my example, read @SpringBean.

-David



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



Re: Spring injection not working

2008-07-23 Thread David Nedrow


On Jul 23, 2008, at 3:27 PM, landry soules wrote:

Actually, if the class using userDAO doesn't extend Component, you  
have to add InjectorHolder.getInjector().inject(this)  in the  
constructor of the calling class.




Is that in addition to addComponentInstantiationListener(), or in  
place of? Is order important if both are needed?


-David

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



Field level Authorization strategy suggestions?

2008-07-18 Thread David Nedrow

I'm building a database driven application.

I've constructed LoadableDetachableModel for my entities, those LDMs  
then being presented in a Panel via  a SortableDataProvider driven  
DefaultDataTable.


I'd like to automatically expose additional functionality or field  
visibility depending on the authorization level of the user (session).  
For example, editable fields for admin users.


At which point is it most appropriate to handle that? Should I somehow  
construct field(column) level models and encapsulate those in a higher- 
level model?


Has anyone done something similar or is there an example somewhere  
that I'm overlooking?


-David

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



Re: Reading files

2008-07-11 Thread David Nedrow


On Jul 9, 2008, at 6:52 AM, greeklinux wrote:



Hello,

I do not know if it helps:

Can you read the CSV file as Resource, get the IResourceStream, then
getInputStream() on IResourceStream and put this inputStream in a
java.io.InputStreamReader?



Yeah, that's basically where I am. I thought maybe there was a way to  
simplify the process.


Here's what I've have...

IResourceStream resStream = new  
PackageResourceStream(WicketApplication.class, protocols.csv);

InputStream inStream = resStream.getInputStream();
InputStreamReader isr = new InputStreamReader(inStream);
ListString[] protocolList = new CSVReader(isr).readAll();
inStream.close();

I could collapse this a bit, but I need to keep hold of  
IResourceStream so that I can close it after the CSVReader.readAll()  
call.


-David

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



Reading files

2008-07-07 Thread David Nedrow
I have a third party package that requires a java.io.Reader (or  
descendent) as an input.


I need to provide a Reader for a file locate in either WEB-INF (or  
possibly package sourced). This file is a CSV list of items that is  
used to initialize a database table. I just need to iterate over it  
and send it off to my DAO.


I've looked at a couple of options, but it seems like I'm traversing  
an inordinately large number of classes just to get hold of some type  
of Reader.


Any suggestions on a wicket friendly, yet straightforward way to  
handle this type of activity?


-David


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



1.3.4 == 1.3-SNAPSHOT?

2008-06-28 Thread David Nedrow
Is 1.3.4 a lock of one of the 1.3-SNAPSHOTs? IE., if I've been using  
a snapshot, should I simply swap libraries out for 1.3.4?


-David

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



Wicket elements and character encoding

2008-06-26 Thread David Nedrow
Does each wicket object attempt to set the character encoding for that  
objects output?


I've been trying to track down what is causing GlassFish to generate a  
number of the following warnings...


PWC4011: Unable to set request character encoding to UTF-8 from  
context /FilterRequest, because request parameters have already been  
read, or ServletRequest.getReader() has already been called


I noticed that a particular group of warnings number the same as the  
number of Wicket objects (panels, pages, etc.) rendered for a  
particular view.


It seems as though Wicket is attempting to set the encoding multiple  
times during an application run. Is that the case?


-David Nedrow

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



PWC4011

2008-06-24 Thread David Nedrow
Running GlassFish v2ur2 within NetBeans, I get a large number of the  
following messages from my application...


PWC4011: Unable to set request character encoding to UTF-8 from  
context /FilterRequest, because request parameters have already been  
read, or ServletRequest.getReader() has already been called


A new message is generated for each new page generated (via Wicket  
with Spring injection).


Any pointers on what I need to do to make the application server  
happy? I have to admit, this appears to be cosmetic, but as I've noted  
on the list before, I hate not clearing warnings.


-David Nedrow

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



Re: Contributing CSS with Panel components?

2008-06-18 Thread David Nedrow


On Jun 17, 2008, at 7:07 PM, Matej Knopp wrote:


Wicket detects the CSS being rendered and should load the CSS on fly
using ajax. Of course you will not see the css link in the page source
because it has been added later (and you only see the initial source).


Aha. Thanks, that was it. I had expected to see a link similar to  
those generated earlier in the page tree.


-David

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



Contributing CSS with Panel components?

2008-06-17 Thread David Nedrow

Hmm, Google is not being helpful.

Is there a way to contribute CSS when a Panel is added to a page?

I like the idea of keeping the CSS with the related class and html  
file, but have not figured out if it is possible to add CSS at render  
time for components contained in the page.


IE., I have UserDetailsPanel.java, UserDetailsPanel.html, and  
UserDetailsPanel.css.


If I include the panel in an AjaxTabbedPanel(), with  
UserDetailsPanel.java containing a HeaderContributor.forCss() pointing  
to UserDetailsPanel.css, the rendered page does not contain the css  
link. Frankly, this is what I would expect, given that the page header  
has already been rendered.


Is this a circumstance in which I will need to contribute the CSS  
earlier in the process, or is there a mechanism that can be used to do  
this when the panel is rendered?


-David

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



PasswordTextField model?

2008-06-12 Thread David Nedrow
Given the following from the wicket security quickstart (1.3- 
SNAPSHOT)...


add(new PasswordTextField(password).setOutputMarkupId(false));

glassfish generates the following message

Couldn't resolve model type of  
Model:classname=[org.apache.wicket.model.CompoundPropertyModel 
$ 
AttachedCompoundPropertyModel 
]:nestedModel 
= 
[Model:classname 
=[org.apache.wicket.model.CompoundPropertyModel]:nestedModel=[username  
= regular]] for [MarkupContainer [Component id = password, page =  
com.vzbi.ncs.argfrp.webapp.FilterRequest.app.LoginPage, path =  
0:signInPanel:signInForm:password.PasswordTextField, isVisible = true,  
isVersioned = false]], please set the type yourself.


Not setting the model does not seem to create a problem, but it would  
seem that the system would prefer that models be set where applicable.


Is that the case? I have to admit, I'm a little anal about clearing  
all warnings in my apps.


What would an appropriate model be for the above PasswordTextField()?

Models seem to be the most poorly exampled Wicket feature, in that  
examples of Models rarely tell one why they are needed and what role  
they perform. It's generally, here's an example to make your code  
work. Clearly, in most cases the model contains the data for the  
markup. But what would that data be for a PasswordTextField()? One  
isn't normally going to pre-fill a password field, correct?


Thanks,

David

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



ClassCastException with ListView()

2008-05-30 Thread David Nedrow
I'm getting a cast exception when I attempt to pull a list element  
from the model. I may be mishandling how I'm using the model, but this  
is basically based on several tutorials I've looked at.


(Note, as people have pointed out here, I use the old fashioned  
naming style for my interfaces and DAOs.)


Anyone see a problem with the below code?

public class ShowProtocolsPanel extends Panel {
@SpringBean(name=ProtocolDAO)
private IProtocolDAO dao;

public ShowProtocolsPanel(String id) {
super(id);

IModel protocolsModel = new LoadableDetachableModel() {
protected Object load() {
return dao.findAll();
}
};

add(new PropertyListView(eachItem, protocolsModel) {
@Override
protected void populateItem(ListItem item) {
Protocol protocol = (Protocol) item.getModelObject();

item.add(new Label(keyword, protocol.getKeyword()));
item.add(new Label(description,  
protocol.getDescription()));

}
});
}
}


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



Re: ClassCastException with ListView()

2008-05-30 Thread David Nedrow


On May 30, 2008, at 11:20 AM, James Carman wrote:


What is the type of item.getModelObject().  Have you run it through a
debugger (or just simply put in a println)?


Yes, I had done that first, thinking maybe I didn't understand how  
ListView worked via the Model.


The object returned by item.getModelObject().toString() is...

com.vzbi.ncs.argfrp.jpa.netconf.Protocol

That's what baffles me about the cast exception.


On Fri, May 30, 2008 at 11:16 AM, David Nedrow [EMAIL PROTECTED]  
wrote:
I'm getting a cast exception when I attempt to pull a list element  
from the
model. I may be mishandling how I'm using the model, but this is  
basically

based on several tutorials I've looked at.

(Note, as people have pointed out here, I use the old fashioned  
naming

style for my interfaces and DAOs.)

Anyone see a problem with the below code?

public class ShowProtocolsPanel extends Panel {
  @SpringBean(name=ProtocolDAO)
  private IProtocolDAO dao;

  public ShowProtocolsPanel(String id) {
  super(id);

  IModel protocolsModel = new LoadableDetachableModel() {
  protected Object load() {
  return dao.findAll();
  }
  };

  add(new PropertyListView(eachItem, protocolsModel) {
  @Override
  protected void populateItem(ListItem item) {
  Protocol protocol = (Protocol) item.getModelObject();

  item.add(new Label(keyword, protocol.getKeyword()));
  item.add(new Label(description,
protocol.getDescription()));
  }
  });
  }
}


-
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]



Re: ClassCastException with ListView()

2008-05-30 Thread David Nedrow


On May 30, 2008, at 11:46 AM, Ryan Gravener wrote:


How about changing PropertyListView to just ListView.



I hadoriginally been using ListView, but switched to PropertyListView  
while trying to troubleshoot this problem. I had forgotten to roll  
that change back. Switching to ListView makes no difference in the  
behavior.


-David

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



Re: ClassCastException with ListView()

2008-05-30 Thread David Nedrow


On May 30, 2008, at 11:47 AM, Thomas Mäder wrote:

2) You're being done in by the BoundCompoundPropertyModel you have  
in the

item. Fire up the debugger and check the values directly (relying on
toString() is bad; some object might be lying to you. Step into the
item.getModelObject().


After stepping into getModelObject(), I can clearly see that there is  
a list of protocol items containing expected data.


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



Re: ClassCastException with ListView()

2008-05-30 Thread David Nedrow


On May 30, 2008, at 12:20 PM, James Carman wrote:


Protocol.class.equals(item.getModelObject().getClass())


Interesting, this returns false.

-David

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



Re: ClassCastException with ListView()

2008-05-30 Thread David Nedrow


On May 30, 2008, at 12:17 PM, Gwyn Evans wrote:


Just to double-check Thomas's point (1), are there any of the jars
being loaded from the AppServer's class-path rather than the Web-App's
classpath?  (What AppServer anyway?)


No, the only thing endorsed is the mysql connector.

This is running on GlasshFish v2.

-David

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



Re: ClassCastException with ListView()

2008-05-30 Thread David Nedrow
As an aside, this is clearly a configuration item for Spring. From my  
application context


bean id=persistenceUnitManager
 
class 
= 
org 
.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager

property name=persistenceXmlLocations
list
valueclasspath:META-INF/persistence.xml/value
/list
/property
property name=loadTimeWeaver
bean  
class 
=org.springframework.instrument.classloading.SimpleLoadTimeWeaver/

/property
/bean

This was derived from several JPA+Spring+Wicket examples. The weaver  
is non-optional with the way I've gotten this all working as far as it  
is.


-David

On May 30, 2008, at 3:20 PM, David Nedrow wrote:



On May 30, 2008, at 2:26 PM, James Carman wrote:


Take a look at what classloaders loaded each of the classes.  If the
class names are the same, then that means that they were loaded by  
two
different classloaders.  How are you setting up your application?   
Are

all jars in your WEB-INF/lib directory?


I added the following to just before line that causes the cast  
failure...


   java.lang.ClassLoader ctxCl =  
Thread.currentThread().getContextClassLoader();
   java.lang.ClassLoader tcCl  =  
Protocol.class.getClassLoader();
   java.lang.ClassLoader soCl  =  
item.getModelObject().getClass().getClassLoader();


   System.out.println(ctxCl= + ((ctxCl == null)
  ? null
  : ctxCl.toString()));
   System.out.println(tcCl= + ((tcCl == null)
 ? null
 : tcCl.toString()));
   System.out.println(soCl= + ((soCl == null)
 ? null
 : soCl.toString()));

Below is the run output, which would appear to show  
WebAppClassloader for the target, and a Spring loader for the  
source. Isn't the whole point of Spring to do exactly that? Load  
classes dynamically? In any case, any suggestions, or should I hit  
the Spring forum now that it appear to be Spring specific?


-David

[TopLink Info]: 2008.05.30 03:07:21.737--ServerSession(878231)-- 
file:/Users/dnedrow/Developer/NetBeansProjects/FilterRequest/build/ 
web/WEB-INF/classes/-NetConfPU login successful

finding all Protocol instances
ctxCl=WebappClassLoader
 delegate: true
 repositories:
   /WEB-INF/classes/
-- Parent Classloader:
EJBClassLoader :
urlSet = []
doneCalled = false
Parent - [EMAIL PROTECTED]
tcCl=WebappClassLoader
 delegate: true
 repositories:
   /WEB-INF/classes/
-- Parent Classloader:
EJBClassLoader :
urlSet = []
doneCalled = false
Parent - [EMAIL PROTECTED]
soCl 
= 
org 
.springframework 
[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]



Re: ClassCastException with ListView()

2008-05-30 Thread David Nedrow


On May 30, 2008, at 3:26 PM, James Carman wrote:


Perhaps this thread will help you?

http://forum.springframework.org/archive/index.php/t-29565.html


I found a similar thread that basically dealt with the same thing,  
recommending  
org 
.springframework 
.instrument.classloading.glassfish.GlassFishLoadTimeWeaver for the  
weaver, but that causes the app to not be able to locate the class at  
all.


I'll ask on the Spring forum.

Thanks for all the help. Back when I get the Spring bit working with  
annotations.


-David

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



Re: ClassCastException with ListView() SOLVED! Sort of.

2008-05-30 Thread David Nedrow
It looks as though this is some subtlety (or brokenness) to GlassFish  
and Toplink. If I deploy my Wicket app as a module of a Java  
Enterprise package, it all works as expected.


It's a simple workaround for now until I find out if it's a bug, or if  
I'm just not getting my Glassfish config correct.


Basically, using NetBeans, I create a new Enterprise Application,  
add my Wicket app as a Java EE module, then deploy. Et voila!


In any case, I can move on for the moment. ;)

-David

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



Re: Sanity check. Can't inject DAO

2008-05-29 Thread David Nedrow


On May 29, 2008, at 5:18 PM, Michael O'Cleirigh wrote:


Hi David,

Have you tried with naming the dao to be injected explicitly? i.e.

@SpringBean (name=ProtocolDAO)
  private ProtocolDAO dao;


Interesting. That seems to get me closer...

org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean  
named 'ProtocolDAO' must be of type  
[com.vzbi.ncs.argfrp.jpa.netconf.ProtocolDAO], but was actually of  
type [$Proxy30]


Checking google...

-David

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



Re: Sanity check. Can't inject DAO

2008-05-29 Thread David Nedrow


On May 29, 2008, at 8:51 PM, James Carman wrote:


I don't think the proxy stuff is your problem.  Is your DAO class
interface-based (it should be).  Meaning, do you have a DAO interface
that your implementation class implements (this part is key)?



Yes, the classes are interface-based. Eg.,

public class ProtocolDAO extends JpaDaoSupport implements IProtocolDAO

I think it's down to fiuring out what I've done wrong in my Panel. I  
get a classcastexception at the (Protocol) item.getModelObject();  
line. Listed below is both my Panel and the appropriate signature from  
ProtocolDAO.findAll().


public class ShowProtocolsPanel extends Panel {
@SpringBean(name=ProtocolDAO)
private ProtocolDAO dao;

public ShowProtocolsPanel(String id) {
super(id);

IModel protocolModel = new LoadableDetachableModel() {
protected Object load() {
return dao.findAll();
}
};

add(new ListView(eachItem, protocolModel) {
@Override protected void populateItem(ListItem item) {
final Protocol protocol = (Protocol)  
item.getModelObject();


item.add(new Label(keyword, protocol.getKeyword()));
item.add(new Label(description,  
protocol.getDescription()));

}
});
}
}


public class ProtocolDAO extends JpaDaoSupport implements IProtocolDAO {
...
   @Transactional(readOnly = true)
@SuppressWarnings(unchecked)
@Override
public ListProtocol findAll(final int... rowStartIdxAndCount) {
 ...
 }
 ...
}

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



Buehler? Packaged resources

2008-05-25 Thread David Nedrow
OK, I asked about this earlier, but maybe the question didn't make  
sense.


Asking another, and perhaps better, way:

What problems do packaged resources address? I'm unsure as to why I  
would encapsulate resources in the package, rather than using them as  
I normally would via the WEB-INF tree.


It seems as though encapsulating them would present a problem with  
separation of concerns, in which one team might be focusing just on  
presentation (eg. CSS, etc.) while another handles just the Java code.


Using packaged resources would seem to require that the presentation  
people have access not only to the sources, but also to the dev  
platform to rebuild the package just to test CSS changes.


-David

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



Re: Buehler? Packaged resources

2008-05-25 Thread David Nedrow


On May 25, 2008, at 12:42 PM, Igor Vaynberg wrote:


On Sun, May 25, 2008 at 9:05 AM, David Nedrow [EMAIL PROTECTED] wrote:


What problems do packaged resources address?


they address encapsulation. suppose you want to use a 3rd party
component in your webapp...

in most other frameworks you would have to put the jar on the
classpath, than copy js/css/html resources the component needs to some


snip/


in wicket the only step is to put the jar on the classpath. since
everything the component needs is packaged in the jar it can
immediately start working.


OK, that make sense. Thanks for the info.

-David.

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



Benefit of JavaScriptReference, etc..?

2008-05-24 Thread David Nedrow
Is there any benefit to using something like JavaScriptReference? It  
seems as though doing so would create a tight binding between the UI  
and the application, kind of negating what I think is one of the main  
benefits of Wicket. That being, UI people can work on straight HTML,  
while the app developers work on the Java side.


-David

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



Background image that resizes with window?

2008-05-23 Thread David Nedrow
I'd like to use an SVG file for a background image on every page. I'd  
like the image to fill 100% of the browser window and have it  
automatically resize if/when the user changes the size of the client  
window.


This clearly can't be done via CSS2 (maybe via CSS3?), so I'm looking  
for anyone who has a programmatic solution doing it the Wicket Way.  
BTW, I don't have a problem using CSS3 if necessary, since this is for  
internal users and I know exactly which browsers are available (IE7,  
FireFox 3RC1, Safari 3).


Here's a pretty good example of what I'm after

http://whatstheweather.net/

The page is using jquery, but if I try to use an img link in the  
page, it pushes all of my other content below the image.


Here's more information on what's being done on that page...

http://css-tricks.com/how-to-resizeable-background-image/

Ideas, comments?

-David

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



Re: Background image that resizes with window?

2008-05-23 Thread David Nedrow


On May 23, 2008, at 11:20 AM, Igor Vaynberg wrote:


dont really see what this has to do with wicket...sounds like you are
after some javascript.


I have the JavaScript, but I was having trouble with other Wicket  
elements being shunted aside by the image. I'll poke around again.


-David

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



Detachable confusion

2008-05-23 Thread David Nedrow

Assume the following...

v
@Entity
@Table(name = user, catalog = blah)
public class User implements java.io.Serializable {
private Long id;
private String name;

//  getters/setters for both
}

public interface IUserDAO {
//  public void save/delete/findAll/etc
}

public class UserDAO implements IUserDAO {

private EntityManager getEntityManager() {
return EntityManagerHelper.getEntityManager();
}

public void save(User entity) {
EntityManagerHelper.log(saving User instance, Level.INFO, 
null);
try {
getEntityManager().persist(entity);
EntityManagerHelper.log(save successful, Level.INFO, 
null);
} catch (RuntimeException re) {
EntityManagerHelper.log(save failed, Level.SEVERE, 
re);
throw re;
}
}

//etc
}


If I want to display the Users in a table contained in a re-usable  
Panel(), should I be able to do something like...


public final class UserListPanel extends Panel {
public UserListPanel(String id) {
super(id);

// Create a detachable model
IModel users = new LoadableDetachableModel() {
@SpringBean
UserDAO dao;
@Override protected Object load() {
return dao.findAll();
}
return users;
};

IColumn[] columns = { new PropertyColumn(new Model(ID),  
id),
  new PropertyColumn(new Model(Name),  
name) };

SomeTableType dataTable = new SomeTableType(users);

add(dataTable);
}
}


Part of my confusion comes from trying to work in a  
SortableDataProvider to use with a DefaultDataTable with columns  
sortable by header (th/) links.


-David

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



Re: OK, more JPA questions

2008-05-19 Thread David Nedrow
First, thanks for the help. Item 1 implemented via @SpringBean(name =  
blah). ;)


On May 16, 2008, at 3:31 PM, Igor Vaynberg wrote:


there are basically two things that you need no matter what web
framework you are integrating with:

1) a way to lookup your dao singleton

wicket-ioc allows you to quickly build an annotation based injection




2) a way to scope the entity manager to request

you need this so that lazy loading works. you are already doing this
with a threadlocal already, the only thing you need to do is to wire
in that closeEntityManager() call.

you can either do this with a servlet filter that sits around the
wicket filter, or you can hook into wicket's requestcycle and do it
from there. there are really no advantages either way.


I'll ask for help with this bit on the Spring list  to help avoid  
clutter here.


The filter route sounds like want I want, as I would prefer to keep as  
much of the bookkeeping as possible out of the application logic.


-David

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



OK, more JPA questions

2008-05-16 Thread David Nedrow
There doesn't seem to be one recommended way to inject/use JPA-based  
utility archives in Wicket. It looks as though most of it is based  
around Spring, which is fine, yet adds another app layer.


I've generated a tiny Derby db using the JPA facilities provided by  
MyEclipse.


The sources can be found at:

http://nedron.net/JpaTest.jar

A binary library was created, including the default generated  
persistence.xml file and can be downloaded at:


http://nedron.net/JpaTest-bin.jar

I think more people than just me would find it useful if someone could  
use this extremely simple database in a simple, single page Wicket app.


Note that I have zero problem using this type of library in a  
standalone Java app, and given that I'm relatively new to Wicket, I  
don't want to go to a bunch of effort only to find that I've gone  
about it the wrong way.


Basic questions...

Do I need to get hold of the com.foo.jpa.JpaNet.EntityManagerHelper in  
the main WicketApplication class and then serve that out to pages and  
panels as needed? The question here is, do I need  EntityManagerHelper  
transaction wrappers around my DAO operations? Or is that handled auto- 
magically by some other mechanism (JTA)?


I guess what I'm really getting at is, what is the recommended way to  
use the library directly without extracting it?


All of the examples I've found so far include the dao/etc. along with  
the app code, so there is no clear indication as to how a third- 
party java library is used in Wicket(/Spring). And many examples and  
much of the documentation is remarkably framdibulous, along the lines  
of What is session managed? Session managed is not container managed.  
What is container managed? Container managed is not session managed.


I've gotten myself pretty confused on this, as you can tell. ;)

-David

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



JPA suggestions?

2008-05-13 Thread David Nedrow
I have a data driver package built around JPA and an Entity Manager  
Factory (javax.persistence.EntityManagerFactory). This is currently  
used by a couple of standalone applications and works well.


What is the best way to leverage this package in the context of a  
Wicket-based web application? IE., how best to instantiate the factory  
(if necessary) and/or use the DAOs. Should this happen at the wicket  
application level, or somehow page/panel-based?


Thanks for any pointers,

-David

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



Re: TestingAuthenticationToken and AbstractAuthenticationToken

2008-05-07 Thread David Nedrow

On May 7, 2008, at 2:55 AM, Maurice Marrink wrote:


The 1.3.1-SNAPSHOT is not the latest snapshot, i should probably
delete it from the repo. The latest version is 1.3-SNAPSHOT.



D'oh! Thanks.

-David

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



Re: TestingAuthenticationToken and AbstractAuthenticationToken

2008-05-06 Thread David Nedrow


On May 6, 2008, at 1:17 PM, Maurice Marrink wrote:


SwarmPolicyFileHiveFactory is new in 1.3.1  due to a separation of
dependencies. It is equivalent to the old PolicyFileHiveFactory and
should be used instead if you are using 1.3.1 code.



Odd. I'm using 1.3.1-SNAPSHOT that I grabbed today (jar files) and  
there is no SwarmPolicyFileHiveFactory class in it.


Not a big deal if I can just swap in the old PolicyFileHiveFactory.

Thanks,

David

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



I give, anyone have a simplified (standalone) Acegi example

2008-05-05 Thread David Nedrow
I'm adding Acegi support to a Wicket project, but have been completely  
unable to get all the pieces correct. One of the main problems is that  
there appears to be no standalone example available. The acegi- 
security examples are awful, since all thirty of the samples are mixed  
with each other and re-use components, needlessly complicating each  
example. IE., there's no way to see what is actually required for a  
specific example.


The online guides (eg.http://wicketstuff.org/confluence/display/STUFFWIKI/Swarm+and+Acegi+HowTo 
 ) refer to existing mixed examples without providing a full sample.


Has anyone seen an Acegi+Wicket example that is:

1) Targeted at implementing Acegi in Wicket
2) Contains all the sample sources in a self-contained tree

-David

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



TestingAuthenticationToken and AbstractAuthenticationToken

2008-05-05 Thread David Nedrow
Using bits of the examples provided in wicket-security, I have the  
following method define in AcegiLoginContext...



private AbstractAuthenticationToken token;
public AcegiLoginContext(AbstractAuthenticationToken token) {
this.token = token;
}


Again, following the examples, I call the previous method from my  
login page as follows


  LoginContext ctx = AcegiLoginContext(new  
TestingAuthenticationToken(username, password,
   getAuthorities(username,  
password)));


However, the compiler (and NetBeans) complains that   
AcegiLoginContext(TestingAuthenticationToken, ...) isn't a valid  
method. NetBeans suggests creating the method. But given that these  
are drawn from the (presumably) working examples, what is the issue?  
TestingAuthenticationToken extends AbstractAuthenticationToken, so  
shouldn't it be acceptable as input to  
AcegiLoginContext(AbstractAuthenticationToken token)? My brain is so  
twisted around trying to find the relevant parts of the example that I  
must be missing something.


I feel like Dr. Thorndyke from High Anxiety, falling into a swirling  
morass of interleaved code. ;)


-David

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



Status of acegi/wasp/swarm?

2008-04-17 Thread David Nedrow
We use acegi for one purpose, and that is to authenticate  and  
authorize (AA) against our corporate SiteMinder server. We have  
existing Spring-based applications that successfully auth against  
SiteMinder via acegi.


We're starting a new project and are planning to use Wicket. It looks  
as though one currently has to use some Spring bridging to inject  
acegi into a Wicket application.


Are there plans to replicate the functionality of acegi as it relates  
to AA?


Basically, is there, or wlll there be, a means for me to authenticate/ 
authorize/etc against something like SiteMinder without having to  
slide in bits of Spring to do it?


-David

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