Re: Improving maven/wicket deployment process

2009-08-15 Thread Cserep Janos
> 1.  Edit application.properties and comment out my local development
> database configuration and uncomment the production database
> configuration. The settings in this file (jdbc.driver, jdbc.url,
> jdbc.username, jdbc.password, hibernate.dialect,
> hibernate.hbm2ddl.auto) are used in my spring configuration files to
> create a datasource and sessionfactory.

I prefer JNDI bound datasources configured in the app server (running
mainly on glassfish), but you could use maven profiles and properties
defined in profiles with property substitution in
application.properties.

On profiles: 
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
On property substitution with a Hudson example:
http://weblogs.java.net/blog/johnsmart/archive/2008/03/using_hudson_en.html

> 2.  Edit web.xml and change the configuration context-param from
> development to deployment.

I use the jvm startup parameter: -Dwicket.configuration=deployment on
all production server instances as it overrides web.xml.

>
> 3.  Run mvn install

I use Hudson with standard maven build definitions to build everything
that ever gets deployed to stage and production servers.

> 4.  scp the newly built war file from my local maven repo to the
> jetty/webapps folder on my deployment server.

> 5.  Remove the existing ROOT.war file from the deployment server.
>
> 6.  Rename the new war file to ROOT.war
>
> 7.  Restart the deployment jetty server

I use a custom Hudson task to deploy the last successful build in
glassfish - a couple of shell commands do the trick. I even have
custom tasks to copy the production db to staging - it's very
convenient to automate such tasks with it.

Janos

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Improving maven/wicket deployment process

2009-08-15 Thread Tauren Mills
I currently don't have an automated deployment process in place for a
wicket/spring/hibernate/maven project and am looking for suggestions
on how to best implement one.  I'm open to any suggestions as well as
references to helpful URLs and other resources.

When it is time to deploy my project, I manually go through the following steps:

1.  Edit application.properties and comment out my local development
database configuration and uncomment the production database
configuration. The settings in this file (jdbc.driver, jdbc.url,
jdbc.username, jdbc.password, hibernate.dialect,
hibernate.hbm2ddl.auto) are used in my spring configuration files to
create a datasource and sessionfactory.

2.  Edit web.xml and change the configuration context-param from
development to deployment.

3.  Run mvn install

4.  scp the newly built war file from my local maven repo to the
jetty/webapps folder on my deployment server.

5.  Remove the existing ROOT.war file from the deployment server.

6.  Rename the new war file to ROOT.war

7.  Restart the deployment jetty server

Of course, this assumes there are no complex database changes required
by the new version that can't be handled by hbm2ddl.auto=update.  If
there are, then I also need to apply an sql update script to the
database.

I'm sure that this process can be streamlined.  I plan to look into
mvn deploy and see what I can accomplish.  I believe there are also
ways to use maven to have development and deployment versions of
different files such as application.properties.

If you have already solved these types of problems, I'd love to hear
how you did it.

Thanks!
Tauren

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Model question ?

2009-08-15 Thread Eelco Hillenius
> Is there any issues you need to be concerned with when using the page
> itself as the model object?

I don't think so.

Eelco

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Model question ?

2009-08-15 Thread Warren Bell
Is there any issues you need to be concerned with when using the page
itself as the model object?

Warren 

-Original Message-
From: jWeekend [mailto:jweekend_for...@cabouge.com] 
Sent: Friday, August 14, 2009 5:43 PM
To: users@wicket.apache.org
Subject: RE: Model question ?


Warren,

If you don't mind your "wicket:id"s becoming rather misleading and
arguably slightly harder to follow (magical) Java, you can even do ...

public class HomePage extends WebPage {
private List vendors = Arrays.asList(new Vendor("v1"), 
new Vendor("v2"));
private Vendor vendor = new Vendor("default vendor");
public HomePage(final PageParameters parameters) {
setDefaultModel(new CompoundPropertyModel(this));
Form form = new Form("form"); 
add(form); 
form.add(new ListChoice("vendor", vendors)); 
Form editForm = new Form("vendorEditForm");
add(editForm);
editForm.add(new TextField("vendor.name"));
}
private class Vendor {
private String name;
Vendor(String name) {this.name = name;}
@Override public String toString() {return name;}
}
}

I haven't worked out how to properly paste html into nabble, so drop me
a line at the jWeekend site if you want the template code to go with
this, or a QuickStart. 

Any comments on the type-parameters used above anybody?!

Regards - Cemal
jWeekend
OO & Java Technologies, Wicket Training and Development
http://jWeekend.com


Warren Bell-3 wrote:
> 
> In your second example the Vendor in the vendorModel becomes the 
> selected Vendor from the ListChoice and that Vendor name property 
> becomes the value of the TextField?
> 
> -Original Message-
> From: jWeekend [mailto:jweekend_for...@cabouge.com]
> Sent: Friday, August 14, 2009 3:47 PM
> To: users@wicket.apache.org
> Subject: Re: Model question ?
> 
> 
> Warren,
> 
> ... and if you prefer using a CPM for your "vendorEditForm"s:
> 
> public class HomePage extends WebPage {
> private List vendors = Arrays.asList(new Vendor("v1"), 
>  new 
> Vendor("v2"));
> private Vendor vendor = new Vendor("default vendor");
> public HomePage(final PageParameters parameters) {
> IModel vendorModel = new PropertyModel(this,
"vendor");
> Form form = new Form("form");
> add(form);
> // use your existing LDM instead of this hard-wired 
> // List of vendors but 
> // make sure you merge your edits properly!
> form.add(new ListChoice("vendors", 
>  vendorModel, vendors));
> // using a PropertyModel per field
> Form editForm1 = new Form("vendorEditForm1");
> add(editForm1);
> editForm1.add(new TextField("name", 
> new PropertyModel(this, "vendor.name")));   
> // using a CompoundPropertyModel   
> Form editForm2 = new Form("vendorEditForm2", 
> new CompoundPropertyModel(vendorModel));
> add(editForm2);
> editForm2.add(new TextField("name")); 
> }
> 
> private class Vendor implements Serializable{
> private String name;
> protected Vendor(String name) {this.name = name;}
> public String toString(){return name;}
> // safer to have accessors & mutators
> }
> // safer to have accessors & mutators }
> 
> Regards - Cemal
> jWeekend
> OO & Java Technologies, Wicket Training and Development 
> http://jWeekend.com
> 
> 
> 
> Warren Bell-3 wrote:
>> 
>> How should I set up my model for the following situation. I have a 
>> form with a ListChoice and a TextField. The TextField needs to access

>> a property of the object selected of the ListChoice. I have it all 
>> working using a ValueMap, but that seems like overkill to use a 
>> ValueMap for one object. Here is how I have it:
>>  
>> super(new CompoundPropertyModel(new ValueMap()));
>> 
>> ListChoice vendorListChoice = new 
>> ListChoice("vendor",
> 
>> new LoadableDetachableModel>(){...}, new 
>> IChoiceRenderer(){...});
>> 
>> TextField accountNumberField = new 
>> TextField("vendor.accountNumber");
>> 
>> I thought I could do something like this:
>> 
>> super(new CompoundPropertyModel(new Vendor()));
>> 
>> The ListChoice is the same as above and the TextField like this:
>> 
>> TextField accountNumberField = new 
>> TextField("accountNumber");
>> 
>> The problem with this is that the ListChoice is trying to set a 
>> property on the model named vendor when I realy want the selected 
>> ListChoice vendor object be the model object and have the TextField 
>> access the accountNumber property of the ListChoice vendor.
>> 
>> How should I set up my model to deal with this type of situation or 
>> is
> 
>> a ValueMap the best way?
>> 
>> Thanks,
>> 
>> Warren
>> 
>> 
>> 
>> 
>> -
>> To unsubscribe, e-mail: users-uns

Re: Enum with RadioChoice leads to NumberFormatException

2009-08-15 Thread Mischa Dasberg

Hi Reinout,

I guess your Person object has a private int sex; instead of private  
SexType sex;
So what happens is that you are trying to convert a SexType to an  
Integer which obviously returns an

illegalArgumentException.

Put it like this and it should work.

public class Person {
private SexType sex;

public enum SexType {
SEX_UNKNOWN(0), SEX_MALE(1), SEX_FEMALE(2),  
SEX_NOT_APPLICABLE(9);

private int id;

SexType(int id) { this.id = id; }

public int getId() { return this.id; }
public String getName() { return this.name(); }
}


public Person() {}

public SexType getSex() { return sex; }
}

and the Page as follows:

public class TestPage extends WebPage {

public TestPage() {
Form form = new Form("form", new  
CompoundPropertyModel(new Person()));
form.add(new RadioChoice("sex",  
Arrays.asList(SexType.values()), new ChoiceRenderer() {

private static final long serialVersionUID = 1L;

@Override
public String getDisplayValue(SexType sexType) {
return getString(sexType.toString());
}
}));
add(form);
}
}

Kind regards,

Mischa Dasberg

Op 14 aug 2009, om 18:43 heeft Reinout van Schouwen het volgende  
geschreven:



Hi all,

If I have an enum 'SexTypes' in the class Person like this:


 public static enum SexTypes {
   SEX_UNKNOWN(0),
   SEX_MALE(1),
   SEX_FEMALE(2),
   SEX_NOT_APPLICABLE(9);
/* Values for sex are taken from ISO 5218:1977 Representation of  
Human Sexes  */

   private final int intValue;

   SexTypes(int intValue) {
 this.intValue = intValue;
   }

   public int getIntValue() {
 return this.intValue;
   }

   public String getName() {
 return this.name();
   }
 }


...And I want to display them, localized, in a Form like this:


ChoiceRenderer renderer = new ChoiceRenderer("name", "intValue")
 {
   @Override
   public String getDisplayValue(Object object) {
 return getString((String)super.getDisplayValue(object));
   }
 };
 form.add(new RadioChoice("sex",  
Arrays.asList(Person.SexTypes.values()), renderer));

   }


...then, when the form is submitted, I get an  
IllegalArgumentException:


Caused by: java.lang.IllegalArgumentException: Cannot format given  
Object as a Number

   at java.text.DecimalFormat.format(DecimalFormat.java:504)
   at java.text.Format.format(Format.java:157)
   at  
org 
.apache 
.wicket 
.util 
.convert 
.converters 
.AbstractNumberConverter 
.convertToString(AbstractNumberConverter.java:109)
   at  
org 
.apache 
.wicket 
.util 
.lang 
.PropertyResolverConverter.convert(PropertyResolverConverter.java:84)
   at org.apache.wicket.util.lang.PropertyResolver 
$MethodGetAndSet.setValue(PropertyResolver.java:1094)
   at org.apache.wicket.util.lang.PropertyResolver 
$ObjectAndGetSetter.setValue(PropertyResolver.java:589)
   at  
org 
.apache 
.wicket.util.lang.PropertyResolver.setValue(PropertyResolver.java:137)
   at  
org 
.apache 
.wicket 
.model.AbstractPropertyModel.setObject(AbstractPropertyModel.java:164)
   at org.apache.wicket.Component.setModelObject(Component.java: 
2934)
   at  
org 
.apache 
.wicket 
.markup.html.form.FormComponent.updateModel(FormComponent.java:1069)
   at org.apache.wicket.markup.html.form.Form 
$21.validate(Form.java:1866)
   at org.apache.wicket.markup.html.form.Form 
$ValidationVisitor.formComponent(Form.java:166)
   at  
org 
.apache 
.wicket 
.markup 
.html 
.form 
.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java: 
421)
   at  
org 
.apache 
.wicket 
.markup 
.html 
.form 
.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java: 
408)
   at  
org 
.apache 
.wicket 
.markup 
.html 
.form.FormComponent.visitFormComponentsPostOrder(FormComponent.java: 
385)
   at  
org 
.apache 
.wicket.markup.html.form.Form.visitFormComponentsPostOrder(Form.java: 
1089)
   at  
org 
.apache 
.wicket 
.markup.html.form.Form.internalUpdateFormComponentModels(Form.java: 
1858)
   at  
org 
.apache 
.wicket.markup.html.form.Form.updateFormComponentModels(Form.java: 
1825)
   at org.apache.wicket.markup.html.form.Form.process(Form.java: 
871)
   at  
org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:808)

   ... 30 moremberFormatException:


I believe this is caused because the DecimalFormat.format() method is
being passed a SexType instead of a Number object. My question is, how
can I solve this elegantly so that the radiochoice value will be
resolved to a number?

regards,

--
Reinout van Schouwen


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





Re: Wicket and JQuery - lavalamp

2009-08-15 Thread Martin Makundi
Cute :)

2009/8/15 Eyal Golan :
> Hi all,I've created a small Wicket module for the lavalamp JQuery library
> (some links below).
> It's very basic and I plan to work on it more.
>
> Please be kind and give me any suggestion and insights.
> Right now I'm thinking on how to keep the link pointer on the current page.
>
> Check the examples in that project.
>
> wicket-lavalamp code 
>
> Some lavalamp examples:
> http://mancub.net/tutorials/lavalamp-examples
>
> 
> http://www.2mellow.com/?page_id=264
>
> Thanks,
> 
> Eyal Golan
> egola...@gmail.com
>
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
>
> P  Save a tree. Please don't print this e-mail unless it's really necessary
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Wicket and JQuery - lavalamp

2009-08-15 Thread Eyal Golan
Hi all,I've created a small Wicket module for the lavalamp JQuery library
(some links below).
It's very basic and I plan to work on it more.

Please be kind and give me any suggestion and insights.
Right now I'm thinking on how to keep the link pointer on the current page.

Check the examples in that project.

wicket-lavalamp code 

Some lavalamp examples:
http://mancub.net/tutorials/lavalamp-examples


http://www.2mellow.com/?page_id=264

Thanks,

Eyal Golan
egola...@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


RE: how to monitor session memory usage

2009-08-15 Thread Russell Simpkins

Try this program, its free and very well written:
http://www.eclipse.org/mat/
You can configure to take heap dumps a couple of different ways. 
I haven't done any profiling in a while, but I googled and found this article 
for you.
http://www.eclipse.org/articles/Article-TPTP-Profiling-Tool/tptpProfilingArticle.html
Russ

> From: nhsoft@gmail.com
> Date: Sat, 15 Aug 2009 09:20:45 +0800
> Subject: Re: how to monitor session memory usage
> To: users@wicket.apache.org
> 
> thanks alot for your reply, but i can not resolve my problem.
> 
> >>Monitor Wicket page request using JAMon,
> http://blog.xebia.com/2008/02/02/monitor-wicket-page-request-using-jamon/
> 
> it only trace the request time, but i mainly want to know why the
> application session occupy so many memory.
> 
> >>try RequestLogger at first.
> i add code in application init method
> 
> if(DEVELOPMENT.equalsIgnoreCase(getConfigurationType())){
> //Get the logger
> IRequestLoggerSettings reqLogger =
> Application.get().getRequestLoggerSettings();
> 
> //Enable the logger
> reqLogger.setRequestLoggerEnabled(true);
> 
> /**
>  * Set the window of all the requests that is kept in memory for
> viewing. Default is 2000, You
>  * can set this to 0 then only Sessions data is recorded (number
> of request, total time, latest
>  * size)
>  */
> reqLogger.setRequestsWindowSize(3000);
> }
> 
> and add log4j configure as:
> 
> 
> log4j.category.org.apache.wicket.protocol.http.RequestLogger
> =debug,reqLogger
> log4j.additivity.org.apache.wicket.protocol.http.RequestLogger=false
> log4j.appender.reqLogger=org.apache.log4j.RollingFileAppender
> 
> log4j.appender.reqLogger.File=D:/517wm_data/logs/wicketRequestLogger.log
> log4j.appender.reqLogger.MaxFileSize=10MB
> log4j.appender.reqLogger.MaxBackupIndex=10
> log4j.appender.reqLogger.layout=org.apache.log4j.PatternLayout
> log4j.appender.reqLogger.layout.ConversionPattern=%d %-5p -
> %-26.26c{1} - %m\n
> 
> here is result:
> 
> 2009-08-14 22:17:47,421 INFO  - RequestLogger  -
> time=78,event=null,response=[resourcestreamrequesttarget[resourcestream=org.apache.wicket.markup.html.dynamicwebresourc...@14d11bd,fileName=null],sessionid=15iahjrthemeq,sessionsize=258022,sessionstart=Fri
> Aug 14 21:38:50 CST
> 2009,requests=129,totaltime=28780,activerequests=1,maxmem=266M,total=133M,used=113M
> 2009-08-14 22:17:48,546 INFO  - RequestLogger  -
> time=109,event=Interface[target:ShareShopPage$LastestShopPanel$1$1(wmcNavigator:searchBox:panel:wmcLastestShopPanel:lastestShops:65:cols:68:shop),
> page: wm.wicket.pages.shareshop.ShareShopPage(2), interface:
> IBehaviorListener.onRequest],response=PageRequest[wm.wicket.pages.shareshop.ShareShopPage(2)],sessionid=15iahjrthemeq,sessionsize=240557,sessionstart=Fri
> Aug 14 21:38:50 CST
> 2009,requests=130,totaltime=28889,activerequests=1,maxmem=266M,total=133M,used=118M
> 2009-08-14 22:17:48,734 INFO  - RequestLogger  -
> time=63,event=null,response=[resourcestreamrequesttarget[resourcestream=org.apache.wicket.markup.html.dynamicwebresourc...@b9af2c,fileName=null],sessionid=15iahjrthemeq,sessionsize=240789,sessionstart=Fri
> Aug 14 21:38:50 CST
> 2009,requests=131,totaltime=28952,activerequests=1,maxmem=266M,total=133M,used=120M
> 2009-08-14 22:17:50,484 INFO  - RequestLogger  -
> time=141,event=Interface[target:ShareShopPage$LastestShopPanel$1$1(wmcNavigator:searchBox:panel:wmcLastestShopPanel:lastestShops:73:cols:75:shop),
> page: wm.wicket.pages.shareshop.ShareShopPage(2), interface:
> IBehaviorListener.onRequest],response=PageRequest[wm.wicket.pages.shareshop.ShareShopPage(2)],sessionid=15iahjrthemeq,sessionsize=269258,sessionstart=Fri
> Aug 14 21:38:50 CST
> 2009,requests=132,totaltime=29093,activerequests=1,maxmem=266M,total=133M,used=119M
> 2009-08-14 22:17:50,953 INFO  - RequestLogger  -
> time=141,event=null,response=[resourcestreamrequesttarget[resourcestream=org.apache.wicket.markup.html.dynamicwebresourc...@1f8f606,fileName=null],sessionid=15iahjrthemeq,sessionsize=269490,sessionstart=Fri
> Aug 14 21:38:50 CST
> 2009,requests=133,totaltime=29234,activerequests=1,maxmem=266M,total=133M,used=121M
> 2009-08-14 22:17:52,250 INFO  - RequestLogger  -
> time=125,event=Interface[target:ShareShopPage$LastestShopPanel$1$1(wmcNavigator:searchBox:panel:wmcLastestShopPanel:lastestShops:69:cols:71:shop),
> page: wm.wicket.pages.shareshop.ShareShopPage(2), interface:
> IBehaviorListener.onRequest],response=PageRequest[wm.wicket.pages.shareshop.ShareShopPage(2)],sessionid=15iahjrthemeq,sessionsize=252607,sessionstart=Fri
> Aug 14 21:38:50 CST
> 2009,requests=134,totaltime=29359,activerequests=1,maxmem=266M,total=133M,used=118M
> 2009-08-14 22:17:52,468 INFO  - Reques

Re: Announcing: Scala-Wicket Extensions Project

2009-08-15 Thread Martin Sachs
Thanks for that variant of programming wicket-application!

I like scala and its concepts, very much.  Using scala with wicket would
properbly make wicketapplications a little faster, more refactor-safe
and better maintainable.

Do you have good IDE for scala ? If the IDE (e.g. Plugin for eclipse) is
as well as java-IDE, scala would be the better java. But without IDE,
many enterprises wont use scala.

Martin

Antony Stubbs schrieb:
> Hello People,
>
> Today, I am proud to announce that I have now uploaded the first
> version of the new Scala-Wicket Extensions.
>
> The project aims to be a central point for Scala related extensions to
> the Wicket framework.
>
> At the moment, the project consists of an Archetype, Sample
> application and Core libraries.
>
> The core libraries at this point consist of some useful implicit
> conversation functions (Scala -> Java list conversion, Closure ->
> Fodel conversion, etc... ScalaWicket.scala) a collection of simple
> extensions to existing components and the Fodel class. The Fodel class
> allows us to use closures and pass by name parameters in Scala to
> avoid some explicit construction of Models.
>
> For example:
> new SLabel("name", person.name )
> This actually constructs a Model which just like a Property Model
> looks up and re-evaluates the name property of the Person during each
> render time (i.e. this is a dynamic model, not a static model as it
> may appear to be, or would be if it were Java).
> Also:
> new SPropertyListView[String]("presentations", list, _.add(new
> SLabel("name", "asdp name")))
>
> There are a whole lot of examples in the Specification files, as the
> whole library as it stands is covered by Specs unit tests.
>
> It also includes SBT (simple build tool) code AND Maven build code
> (take your pick).
>
> I invite all those who are currently using Scala with Wicket to submit
> there odds and ends that make life easy for them - I'm sure there's a
> whole bunch of stuff out there!
>
> Special thanks to Stuq.nl
>
> P.s. it seems wicketstuff team city is stuck, so the SNAPSHOT won't be
> on the Wicket Stuff repo atm, but I'll try and get that sorted out asap.
>
> Maven signature:
> 
> org.wicketstuff.scala
> wicket-scala
> 1.4-SNAPSHOT
> 
>
> Cheers,
> Antony Stubbs,
>
> sharca.com
>
>


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org