You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ge...@apache.org on 2009/05/13 23:09:49 UTC

svn commit: r774537 [2/3] - in /incubator/openwebbeans/trunk/samples/reservation: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/webbeans/ src/main/java/org/apache/webbeans/reservation/ src/main/j...

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/Hotel.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/Hotel.java?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/Hotel.java (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/Hotel.java Wed May 13 21:09:47 2009
@@ -0,0 +1,134 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.reservation.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Version;
+
+@Entity
+public class Hotel
+{
+    @Id
+    @GeneratedValue
+    private int id;
+    
+    @Column(length=100,nullable=false)
+    private String name;
+    
+    @Column
+    private int star;
+    
+    @Column(nullable=false, length=100)
+    private String city;
+    
+    @Column(nullable=false, length=100)
+    private String country;
+    
+    @Version
+    private int version;
+    
+    public Hotel()
+    {
+        
+    }
+
+    /**
+     * @return the name
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    /**
+     * @param name the name to set
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+
+    /**
+     * @return the star
+     */
+    public int getStar()
+    {
+        return star;
+    }
+
+    /**
+     * @param star the star to set
+     */
+    public void setStar(int star)
+    {
+        this.star = star;
+    }
+
+    /**
+     * @return the city
+     */
+    public String getCity()
+    {
+        return city;
+    }
+
+    /**
+     * @param city the city to set
+     */
+    public void setCity(String city)
+    {
+        this.city = city;
+    }
+
+    /**
+     * @return the country
+     */
+    public String getCountry()
+    {
+        return country;
+    }
+
+    /**
+     * @param country the country to set
+     */
+    public void setCountry(String country)
+    {
+        this.country = country;
+    }
+
+    /**
+     * @return the id
+     */
+    public int getId()
+    {
+        return id;
+    }
+
+    /**
+     * @return the version
+     */
+    protected int getVersion()
+    {
+        return version;
+    }
+    
+    
+    
+}

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/Hotel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/Reservation.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/Reservation.java?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/Reservation.java (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/Reservation.java Wed May 13 21:09:47 2009
@@ -0,0 +1,127 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.reservation.entity;
+
+import java.util.Date;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Version;
+
+@Entity
+public class Reservation
+{
+    @Id
+    @GeneratedValue
+    private int id;
+    
+    @ManyToOne
+    private User user;
+    
+    @OneToOne
+    private Hotel hotel;
+    
+    @Temporal(TemporalType.DATE)
+    private Date reservationDate;
+    
+    @Version
+    private int version;
+    
+    public Reservation()
+    {
+        
+    }
+
+    /**
+     * @return the user
+     */
+    public User getUser()
+    {
+        return user;
+    }
+
+    /**
+     * @param user the user to set
+     */
+    public void setUser(User user)
+    {
+        this.user = user;
+    }
+
+    /**
+     * @return the reservationDate
+     */
+    public Date getReservationDate()
+    {
+        return reservationDate;
+    }
+
+    /**
+     * @param reservationDate the reservationDate to set
+     */
+    public void setReservationDate(Date reservationDate)
+    {
+        this.reservationDate = reservationDate;
+    }
+
+    /**
+     * @return the version
+     */
+    public int getVersion()
+    {
+        return version;
+    }
+
+    /**
+     * @param version the version to set
+     */
+    public void setVersion(int version)
+    {
+        this.version = version;
+    }
+
+    /**
+     * @return the id
+     */
+    public int getId()
+    {
+        return id;
+    }
+
+    /**
+     * @return the hotel
+     */
+    public Hotel getHotel()
+    {
+        return hotel;
+    }
+
+    /**
+     * @param hotel the hotel to set
+     */
+    public void setHotel(Hotel hotel)
+    {
+        this.hotel = hotel;
+    }
+
+    
+}

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/Reservation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/User.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/User.java?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/User.java (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/User.java Wed May 13 21:09:47 2009
@@ -0,0 +1,254 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.reservation.entity;
+
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Version;
+
+@Entity
+public class User
+{
+    @Id
+    @GeneratedValue
+    private int id;
+    
+    @Column(length=64,nullable=false)
+    private String name;
+    
+    @Column(length=64,nullable=false)
+    private String surname;
+    
+    @Column
+    private int age;
+    
+    @Column(length=50,nullable=false,unique=true)
+    private String userName;
+    
+    @Column(nullable=false,length=20)
+    private String password;
+    
+    @Temporal(value=TemporalType.DATE)
+    private Date registerDate;
+    
+    @OneToMany(mappedBy="user",cascade={CascadeType.ALL})
+    private Set<Reservation> reservations = new HashSet<Reservation>();
+    
+    @Version
+    private int version;
+    
+    @Column
+    private boolean admin;
+    
+
+    @Temporal(value=TemporalType.TIMESTAMP)
+    private Date lastLoginDate;
+
+    public User()
+    {
+        
+    }
+
+    
+    /**
+     * @return the name
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    /**
+     * @param name the name to set
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+
+    /**
+     * @return the surname
+     */
+    public String getSurname()
+    {
+        return surname;
+    }
+
+    /**
+     * @param surname the surname to set
+     */
+    public void setSurname(String surname)
+    {
+        this.surname = surname;
+    }
+
+    /**
+     * @return the age
+     */
+    public int getAge()
+    {
+        return age;
+    }
+
+    /**
+     * @param age the age to set
+     */
+    public void setAge(int age)
+    {
+        this.age = age;
+    }
+
+    /**
+     * @return the reservations
+     */
+    public Set<Reservation> getReservations()
+    {
+        return reservations;
+    }
+
+    /**
+     * @param reservations the reservations to set
+     */
+    public void setReservations(Set<Reservation> reservations)
+    {
+        this.reservations = reservations;
+    }
+
+    /**
+     * @return the id
+     */
+    public int getId()
+    {
+        return id;
+    }
+    
+    public void addHotel(Reservation hotel)
+    {
+        this.reservations.add(hotel);
+        
+        hotel.setUser(this);
+    }
+
+    /**
+     * @return the password
+     */
+    public String getPassword()
+    {
+        return password;
+    }
+
+    /**
+     * @param password the password to set
+     */
+    public void setPassword(String password)
+    {
+        this.password = password;
+    }
+
+
+    /**
+     * @return the userName
+     */
+    public String getUserName()
+    {
+        return userName;
+    }
+
+
+    /**
+     * @param userName the userName to set
+     */
+    public void setUserName(String userName)
+    {
+        this.userName = userName;
+    }
+
+
+    /**
+     * @return the version
+     */
+    public int getVersion()
+    {
+        return version;
+    }
+
+
+    /**
+     * @return the registerDate
+     */
+    public Date getRegisterDate()
+    {
+        return registerDate;
+    }
+
+
+    /**
+     * @param registerDate the registerDate to set
+     */
+    public void setRegisterDate(Date registerDate)
+    {
+        this.registerDate = registerDate;
+    }
+
+
+    /**
+     * @return the admin
+     */
+    public boolean isAdmin()
+    {
+        return admin;
+    }
+
+
+    /**
+     * @param admin the admin to set
+     */
+    public void setAdmin(boolean admin)
+    {
+        this.admin = admin;
+    }
+
+
+    /**
+     * @return the lastLoginDate
+     */
+    public Date getLastLoginDate()
+    {
+        return lastLoginDate;
+    }
+
+
+    /**
+     * @param lastLoginDate the lastLoginDate to set
+     */
+    public void setLastLoginDate(Date lastLoginDate)
+    {
+        this.lastLoginDate = lastLoginDate;
+    }
+    
+    
+}

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/entity/User.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/events/LoggedInEvent.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/events/LoggedInEvent.java?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/events/LoggedInEvent.java (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/events/LoggedInEvent.java Wed May 13 21:09:47 2009
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.reservation.events;
+
+
+import org.apache.webbeans.reservation.entity.User;
+
+/**
+ * Events that is fired when user logged into the system.
+ */
+public class LoggedInEvent
+{
+    private User user;
+
+    public LoggedInEvent(User user)
+    {
+        this.user = user; 
+    }
+
+    
+    public User getUser()
+    {
+        return this.user;
+    }
+}

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/events/LoggedInEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/intercept/LoginDecorator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/intercept/LoginDecorator.java?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/intercept/LoginDecorator.java (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/intercept/LoginDecorator.java Wed May 13 21:09:47 2009
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.reservation.intercept;
+
+
+import javax.decorator.Decorates;
+import javax.decorator.Decorator;
+
+import org.apache.commons.logging.Log;
+import org.apache.webbeans.reservation.bindings.ApplicationLog;
+import org.apache.webbeans.reservation.bindings.DatabaseLogin;
+import org.apache.webbeans.reservation.controller.api.ILoginController;
+import org.apache.webbeans.reservation.entity.User;
+
+@Decorator
+public class LoginDecorator implements ILoginController 
+{
+    @Decorates @DatabaseLogin ILoginController decorator;
+    
+    private @ApplicationLog Log logger;
+
+    /* (non-Javadoc)
+     * @see org.apache.webbeans.reservation.controller.LoginController#checkLogin(java.lang.String, java.lang.String)
+     */
+    public User checkLogin(String userName, String password)
+    {
+        logger.info("Login process is started. Use tries to login with user name : " + userName );
+        
+        return null;
+    }
+
+    
+}

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/intercept/LoginDecorator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/intercept/TransactionalInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/intercept/TransactionalInterceptor.java?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/intercept/TransactionalInterceptor.java (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/intercept/TransactionalInterceptor.java Wed May 13 21:09:47 2009
@@ -0,0 +1,73 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.reservation.intercept;
+
+import javax.inject.Current;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityTransaction;
+
+import org.apache.commons.logging.Log;
+import org.apache.webbeans.reservation.bindings.ApplicationLog;
+import org.apache.webbeans.reservation.bindings.intercep.Transactional;
+
+@Interceptor
+@Transactional
+public class TransactionalInterceptor
+{
+    private @Current EntityManager entityManager;
+    
+    private @ApplicationLog Log logger; 
+    
+    @AroundInvoke
+    public Object invoke(InvocationContext context) throws Exception
+    {
+        EntityTransaction transaction = entityManager.getTransaction();
+        
+        try
+        {
+            if(!transaction.isActive())
+            {
+                transaction.begin();    
+            }
+                        
+            return context.proceed();
+            
+        }catch(Exception e)
+        {
+            logger.error("Exception in transactional method call", e);
+            
+            if(transaction != null)
+            {
+                transaction.rollback();
+            }
+            
+            throw e;
+            
+        }finally
+        {
+            if(transaction != null && transaction.isActive())
+            {
+                transaction.commit();
+            }
+        }        
+        
+    }
+
+}

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/intercept/TransactionalInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/model/ReservationModel.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/model/ReservationModel.java?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/model/ReservationModel.java (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/model/ReservationModel.java Wed May 13 21:09:47 2009
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.reservation.model;
+
+import java.util.Date;
+
+import javax.faces.model.SelectItem;
+
+public class ReservationModel
+{
+    private SelectItem item;
+    
+    private Date date;
+
+    public ReservationModel(SelectItem item, Date date)
+    {
+        this.item = item;
+        this.date = date;
+    }
+
+    /**
+     * @return the item
+     */
+    public SelectItem getItem()
+    {
+        return item;
+    }
+
+    /**
+     * @param item the item to set
+     */
+    public void setItem(SelectItem item)
+    {
+        this.item = item;
+    }
+
+    /**
+     * @return the date
+     */
+    public Date getDate()
+    {
+        return date;
+    }
+
+    /**
+     * @param date the date to set
+     */
+    public void setDate(Date date)
+    {
+        this.date = date;
+    }
+    
+    
+}

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/model/ReservationModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/security/JSFSecurityPhaseListener.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/security/JSFSecurityPhaseListener.java?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/security/JSFSecurityPhaseListener.java (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/security/JSFSecurityPhaseListener.java Wed May 13 21:09:47 2009
@@ -0,0 +1,80 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.reservation.security;
+
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+import org.apache.webbeans.reservation.entity.User;
+import org.apache.webbeans.reservation.session.SessionTracker;
+
+public class JSFSecurityPhaseListener implements PhaseListener
+{
+
+    private static final long serialVersionUID = -1308051590485364148L;
+    
+    public void afterPhase(PhaseEvent event)
+    {        
+        FacesContext context = event.getFacesContext();
+        String pathInfo = context.getExternalContext().getRequestServletPath();
+        
+        if(pathInfo.startsWith("/admin") || pathInfo.startsWith("/user"))
+        {
+            SessionTracker tracker = null;
+            User user = null;
+            try
+            {
+                tracker = (SessionTracker)context.getApplication().evaluateExpressionGet(context, "#{sessionTracker}", SessionTracker.class);
+                user = tracker.getUser();
+                
+            }catch(Exception e)
+            {
+                //Tracker is null
+                System.out.println("Context is not active");
+            }
+            
+            if(tracker == null || user == null)
+            {
+                try
+                {
+                    context.getExternalContext().redirect(context.getExternalContext().getRequestContextPath() + "/login.jsf");
+                }
+                catch (IOException e)
+                {
+                    throw new RuntimeException(e);
+                }
+            }
+            
+        }
+         
+        
+    }
+
+    public void beforePhase(PhaseEvent event)
+    {
+    }
+
+    public PhaseId getPhaseId()
+    {
+        return PhaseId.RESTORE_VIEW;
+    }
+
+}

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/security/JSFSecurityPhaseListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/session/SessionTracker.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/session/SessionTracker.java?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/session/SessionTracker.java (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/session/SessionTracker.java Wed May 13 21:09:47 2009
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.reservation.session;
+
+
+import java.io.Serializable;
+
+import javax.annotation.Named;
+import javax.context.SessionScoped;
+
+import org.apache.webbeans.reservation.entity.User;
+import org.apache.webbeans.reservation.events.LoggedInEvent;
+import javax.event.Observes;
+import javax.inject.manager.Manager;
+
+@SessionScoped
+@Named
+public class SessionTracker implements Serializable
+{
+    private static final long serialVersionUID = 6365740106065427860L;
+
+    private User user;
+     
+    /**
+     * When event fires, this observer method is called
+     * by the {@link Manager} interface.
+     * 
+     * @param loggedInEvent event 
+     */
+    public void userAdded(@Observes LoggedInEvent loggedInEvent)
+    {
+        this.user = loggedInEvent.getUser();
+    }
+
+    public User getUser()
+    {
+        return this.user;
+    }
+
+    /**
+     * @param user the user to set
+     */
+    public void setUser(User user)
+    {
+        this.user = user;
+    }
+    
+    
+}

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/session/SessionTracker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/CalendarUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/CalendarUtil.java?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/CalendarUtil.java (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/CalendarUtil.java Wed May 13 21:09:47 2009
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.reservation.util;
+
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+public class CalendarUtil
+{
+
+    /**
+     * Gets date.
+     * 
+     * @return the date
+     */
+    public static Date getCurrentDate()
+    {
+        return GregorianCalendar.getInstance().getTime();
+    }
+}

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/CalendarUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/EntityManagerUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/EntityManagerUtil.java?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/EntityManagerUtil.java (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/EntityManagerUtil.java Wed May 13 21:09:47 2009
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.reservation.util;
+
+import javax.context.RequestScoped;
+import javax.inject.Current;
+import javax.inject.Disposes;
+import javax.inject.Produces;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+@RequestScoped
+public class EntityManagerUtil
+{
+    private @PersistenceContext(unitName="reservation")
+    EntityManager entityManager;
+    
+    public EntityManagerUtil()
+    {
+        
+    }
+    
+    @Produces @RequestScoped @Current
+    public EntityManager createEntityManager()
+    {        
+        return entityManager;
+    }
+    
+    public void dispose(@Disposes @Current EntityManager entityManager)
+    {
+        entityManager.close();        
+    }
+    
+}

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/EntityManagerUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/JSFUtility.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/JSFUtility.java?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/JSFUtility.java (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/JSFUtility.java Wed May 13 21:09:47 2009
@@ -0,0 +1,82 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.reservation.util;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpSession;
+
+/**
+ * Simple JSF Utility methods.
+ */
+public class JSFUtility
+{
+
+    /**
+     * Getting current faces context
+     * 
+     * @return current context
+     */
+    public static FacesContext getCurrentContext()
+    {
+        return FacesContext.getCurrentInstance();
+    }
+    
+    /**
+     * Gets current http session
+     * 
+     * @return current http session
+     */
+    public static HttpSession getCurrentSession()
+    {
+        HttpSession session = (HttpSession) getCurrentContext().getExternalContext().getSession(false);
+        
+        return session;
+    }
+    
+    /**
+     * Creates and adds error message.
+     * 
+     * @param summary summary 
+     * @param detail detail
+     */
+    public static void addInfoMessage(String summary, String detail)
+    {
+        addMessage(summary, detail, FacesMessage.SEVERITY_INFO);
+    }
+    
+    /**
+     * Creates and adds error message.
+     * 
+     * @param summary summary 
+     * @param detail detail
+     */
+    public static void addErrorMessage(String summary, String detail)
+    {
+        addMessage(summary, detail, FacesMessage.SEVERITY_ERROR);
+    }
+    
+    
+    private static void addMessage(String summary, String detail, Severity severity)
+    {
+        FacesMessage facesMessage = new FacesMessage(severity,summary,detail);
+        
+        getCurrentContext().addMessage(null, facesMessage);
+        
+    }
+}

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/JSFUtility.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/LogUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/LogUtil.java?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/LogUtil.java (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/LogUtil.java Wed May 13 21:09:47 2009
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.reservation.util;
+
+import javax.annotation.Named;
+import javax.inject.Produces;
+import javax.inject.manager.InjectionPoint;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.webbeans.reservation.bindings.ApplicationLog;
+
+public class LogUtil
+{
+    
+    @Produces @ApplicationLog @Named
+    public Log getLogger(InjectionPoint injectionPoint)
+    {
+        Class<?> clazz = injectionPoint.getMember().getDeclaringClass();
+        
+        return LogFactory.getLog(clazz);
+    }
+
+}

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/java/org/apache/webbeans/reservation/util/LogUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/resources/META-INF/beans.xml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/resources/META-INF/beans.xml?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/resources/META-INF/beans.xml (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/resources/META-INF/beans.xml Wed May 13 21:09:47 2009
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<WebBeans 	xmlns="urn:java:ee"
+ 			xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+			xsi:schemaLocation="urn:java:ee http://java.sun.com/jee/beans-1.0.xsd">	
+</WebBeans>
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/resources/META-INF/beans.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/resources/META-INF/beans.xml
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/resources/META-INF/persistence.xml?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/resources/META-INF/persistence.xml (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/resources/META-INF/persistence.xml Wed May 13 21:09:47 2009
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+    
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements. See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version
+    2.0 (the "License"); you may not use this file except in compliance
+    with the License. You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+    applicable law or agreed to in writing, software distributed under the
+    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+    CONDITIONS OF ANY KIND, either express or implied. See the License for
+    the specific language governing permissions and limitations under the
+    License.
+-->
+
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+    version="1.0">
+
+    <persistence-unit name="reservation" transaction-type="RESOURCE_LOCAL">
+        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+          
+          <class>org.apache.webbeans.reservation.entity.Hotel</class>
+  		  <class>org.apache.webbeans.reservation.entity.User</class>
+  		  <class>org.apache.webbeans.reservation.entity.Reservation</class>
+         
+        <properties>
+            <property name="openjpa.jdbc.DBDictionary" value="hsql" />
+            <property name="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" />
+            <property name="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:test" />
+            <property name="openjpa.ConnectionUserName" value="sa" />
+            <property name="openjpa.ConnectionPassword" value="" />
+			<property name="openjpa.Log" value="DefaultLevel=TRACE"/>  
+  			<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+        </properties>
+
+    </persistence-unit>
+</persistence>
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/resources/META-INF/persistence.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/resources/log4j.properties?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/resources/log4j.properties (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/resources/log4j.properties Wed May 13 21:09:47 2009
@@ -0,0 +1,36 @@
+#	Licensed to the Apache Software Foundation (ASF) under one or more
+#	contributor license agreements. See the NOTICE file distributed with
+#	this work for additional information regarding copyright ownership.
+#	The ASF licenses this file to You under the Apache License, Version
+#	2.0 (the "License"); you may not use this file except in compliance
+#	with the License. You may obtain a copy of the License at
+#	
+#	http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+#	applicable law or agreed to in writing, software distributed under the
+#	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+#	CONDITIONS OF ANY KIND, either express or implied. See the License for
+#	the specific language governing permissions and limitations under the
+#	License.
+#
+### direct log messages to stdout ###
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
+#%c category,p priority,d time,L line number,m message, n newline;
+
+
+#log4j.appender.file=org.apache.log4j.RollingFileAppender
+#log4j.appender.file.File=hsm-application.log
+#log4j.appender.file.MaxFileSize=10MB
+#log4j.appender.file.MaxBackupIndex=2
+#log4j.appender.file.Encoding=UTF-8
+#log4j.appender.file.layout=org.apache.log4j.PatternLayout
+#log4j.appender.file.layout.ConversionPattern=<%d> %-5p [%c] : %m%n
+
+
+log4j.rootLogger=INFO,stdout
+
+
+### Main project logger to info
+log4j.logger.org.apache.webbeans=INFO
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/resources/log4j.properties
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/META-INF/MANIFEST.MF?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/META-INF/MANIFEST.MF (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/META-INF/MANIFEST.MF Wed May 13 21:09:47 2009
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: 
+

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/WEB-INF/beans.xml?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/WEB-INF/beans.xml (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/WEB-INF/beans.xml Wed May 13 21:09:47 2009
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<WebBeans 	xmlns="urn:java:ee"
+			xmlns:myapp="urn:java:org.apache.webbeans.reservation.intercept"
+ 			xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+			xsi:schemaLocation="urn:java:ee http://java.sun.com/jee/beans-1.0.xsd">
+	
+	<Deploy>
+		<Standard/>
+		<Production/>
+	</Deploy>
+	
+	<Decorators>
+		<myapp:LoginDecorator/>
+	</Decorators>
+	
+	<Interceptors>
+		<myapp:TransactionalInterceptor/>
+	</Interceptors>
+		
+</WebBeans>
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/WEB-INF/beans.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/WEB-INF/beans.xml
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/WEB-INF/faces-config.xml?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/WEB-INF/faces-config.xml (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/WEB-INF/faces-config.xml Wed May 13 21:09:47 2009
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+ <navigation-rule>
+  <from-view-id>*</from-view-id>
+  <navigation-case>
+   <from-outcome>register</from-outcome>
+   <to-view-id>/register.xhtml</to-view-id>
+  </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+  <from-view-id>*</from-view-id>
+  <navigation-case>
+   <from-outcome>login</from-outcome>
+   <to-view-id>/login.xhtml</to-view-id>
+  </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+  <from-view-id>/login.xhtml</from-view-id>
+  <navigation-case>
+   <from-outcome>adminHome</from-outcome>
+   <to-view-id>/admin/menu.xhtml</to-view-id>
+  </navigation-case>
+  <navigation-case>
+   <from-outcome>userHome</from-outcome>
+   <to-view-id>/user/menu.xhtml</to-view-id>
+  </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+  <from-view-id>*</from-view-id>
+  <navigation-case>
+   <from-outcome>toUpdatePage</from-outcome>
+   <to-view-id>/user/updateInfo.xhtml</to-view-id>
+  </navigation-case>
+ </navigation-rule>
+  <navigation-rule>
+  <from-view-id>*</from-view-id>
+  <navigation-case>
+   <from-outcome>toReservePage</from-outcome>
+   <to-view-id>/user/listReservations.xhtml</to-view-id>
+  </navigation-case>
+ </navigation-rule>
+ 
+ <application>
+  <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
+ <lifecycle>
+  <phase-listener>org.apache.webbeans.reservation.security.JSFSecurityPhaseListener</phase-listener>
+ </lifecycle>
+</faces-config>

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/WEB-INF/faces-config.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/WEB-INF/web.xml?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/WEB-INF/web.xml (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/WEB-INF/web.xml Wed May 13 21:09:47 2009
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<web-app id="WebApp_ID" version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <display-name>guess</display-name>
+ <context-param>
+  <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+  <param-value>.xhtml</param-value>
+ </context-param>
+ <filter>
+  <filter-name>webbeans</filter-name>
+  <filter-class>org.apache.webbeans.jsf.WebBeansJSFFilter</filter-class>
+ </filter>
+ <filter-mapping>
+  <filter-name>webbeans</filter-name>
+  <servlet-name>Faces Servlet</servlet-name>
+ </filter-mapping>
+ <listener>
+  <listener-class>org.apache.webbeans.servlet.WebBeansConfigurationListener</listener-class>
+ </listener>
+ <servlet>
+  <servlet-name>Faces Servlet</servlet-name>
+  <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+  <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+  <servlet-name>Faces Servlet</servlet-name>
+  <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <welcome-file-list>
+  <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+ <error-page>
+  <exception-type>java.lang.Exception</exception-type>
+  <location>/src/main/webapp/index.html</location>
+ </error-page>
+ <login-config>
+  <auth-method>BASIC</auth-method>
+ </login-config>
+</web-app>

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/defineHotel.xhtml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/defineHotel.xhtml?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/defineHotel.xhtml (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/defineHotel.xhtml Wed May 13 21:09:47 2009
@@ -0,0 +1,80 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+	
+	Licensed to the Apache Software Foundation (ASF) under one or more
+	contributor license agreements. See the NOTICE file distributed with
+	this work for additional information regarding copyright ownership.
+	The ASF licenses this file to You under the Apache License, Version
+	2.0 (the "License"); you may not use this file except in compliance
+	with the License. You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+	applicable law or agreed to in writing, software distributed under the
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+	CONDITIONS OF ANY KIND, either express or implied. See the License for
+	the specific language governing permissions and limitations under the
+	License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:f="http://java.sun.com/jsf/core"
+    xmlns:h="http://java.sun.com/jsf/html"
+    xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+  <title>OpenWebBeans :: Examples :: Reservation</title>
+  <link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/main.css"/>
+</head>
+
+<body>
+  
+  	<ui:composition template="/admin/menu.xhtml">
+  		  				
+		<ui:define name="caption">
+			<h:outputText value="Define New Hotel" styleClass="captionTitle" />	
+		</ui:define>
+			
+		<ui:define name="body">
+		
+			<h:form id="form">
+					
+				<h:panelGrid columns="2" styleClass="table" cellspacing="2" cellpadding="5" columnClasses="leftColumns,rightColumns">
+					
+					<h:outputLabel for="name">
+						<h:outputText value="Name" />
+					</h:outputLabel>
+					
+					<h:inputText value="#{adminBean.name}" id="name" required="true" requiredMessage="Name is required!"/>
+					
+					<h:outputLabel for="star">
+						<h:outputText value="Star" />
+					</h:outputLabel>
+					
+					<h:inputText value="#{adminBean.star}" id="star" required="true" requiredMessage="Star is required!" converterMessage="Star must between [1-5]" validatorMessage="Star must between [1-5]">
+						<f:convertNumber integerOnly="true"/>
+						<f:validateLongRange maximum="5" minimum="1"/>
+					</h:inputText>
+		
+					<h:outputLabel for="city">
+						<h:outputText value="City" />
+					</h:outputLabel>
+					
+					<h:inputText value="#{adminBean.city}" id="city" required="true" requiredMessage="City is required">
+					</h:inputText>
+					
+					<h:outputLabel for="country">
+						<h:outputText value="Country" />
+					</h:outputLabel>
+					
+					<h:inputText value="#{adminBean.country}" id="country" required="true" requiredMessage="Country name is required!">
+					</h:inputText>
+		
+					
+					<h:commandButton action="#{adminBean.addNewHotel}" value="Add Hotel" />
+					<h:commandButton action="false" value="Clear Form" immediate="true" onclick="document.forms[0].reset();document.getElementById('form:name').focus();return false;" />					
+				
+				</h:panelGrid>
+			</h:form>
+		</ui:define>
+	</ui:composition>
+</body>
+</html>
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/defineHotel.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/listHotels.xhtml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/listHotels.xhtml?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/listHotels.xhtml (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/listHotels.xhtml Wed May 13 21:09:47 2009
@@ -0,0 +1,115 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+	
+	Licensed to the Apache Software Foundation (ASF) under one or more
+	contributor license agreements. See the NOTICE file distributed with
+	this work for additional information regarding copyright ownership.
+	The ASF licenses this file to You under the Apache License, Version
+	2.0 (the "License"); you may not use this file except in compliance
+	with the License. You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+	applicable law or agreed to in writing, software distributed under the
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+	CONDITIONS OF ANY KIND, either express or implied. See the License for
+	the specific language governing permissions and limitations under the
+	License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:f="http://java.sun.com/jsf/core"
+    xmlns:h="http://java.sun.com/jsf/html"
+    xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+  <title>OpenWebBeans :: Examples :: Reservation</title>
+  <link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/main.css"/>
+</head>
+
+<body>
+  
+  	<ui:composition template="/admin/menu.xhtml">
+  		  				
+		<ui:define name="caption">
+			<h:outputText value="List Hotels" styleClass="captionTitle" />	
+		</ui:define>
+			
+		<ui:define name="body">
+			
+		<h:form id="form">
+			
+			<h:dataTable id="dt" cellpadding="5" value="#{adminListBean.hotels}" binding="#{adminListBean.model}" var="model" styleClass="table dataTable" rowClasses="oddRow,evenRow">
+				
+				<h:column id="dt1">
+					<f:facet name="header">
+						<h:outputText id="col1" value="Name" />
+					</f:facet>
+					
+					<h:outputText id="col11" value="#{model.name}" />					
+				</h:column>
+				
+				<h:column id="dt2">
+					<f:facet name="header">
+						<h:outputText id="col2" value="Star" />
+					</f:facet>
+					
+					<h:outputText id="col22" value="#{model.star}" />					
+				</h:column>
+				
+				<h:column id="dt5">
+					<h:commandLink action="#{adminListBean.getForUpdate}" value="Show Detail" />					
+				</h:column>
+
+				<h:column id="dt6">
+					<h:commandLink action="#{adminListBean.delete}" value="Delete" />					
+				</h:column>
+				
+															
+			</h:dataTable>	
+			
+		</h:form>
+			
+			<div class="caption">
+				<h:outputText value="Hotel Details" styleClass="captionTitle" />	
+			</div>
+			
+			<h:form>
+			<h:panelGrid columns="2" styleClass="table" cellspacing="2" cellpadding="5" columnClasses="leftColumns,rightColumns">
+				
+				<h:outputLabel for="name">
+					<h:outputText value="Name" />
+				</h:outputLabel>
+				
+				<h:inputText  value="#{adminListBean.selected.name}" id="name" required="true" requiredMessage="Name is required!"/>
+				
+				<h:outputLabel for="star">
+					<h:outputText value="Star" />
+				</h:outputLabel>
+				
+				<h:inputText  value="#{adminListBean.selected.star}" id="star" required="true" requiredMessage="Star is required!" converterMessage="Star must between [1-5]" validatorMessage="Star must between [1-5]">
+					<f:validateLongRange maximum="5" minimum="1"/>
+				</h:inputText>
+	
+				<h:outputLabel for="city">
+					<h:outputText value="City" id="cityCol" />
+				</h:outputLabel>
+				
+				<h:inputText  value="#{adminListBean.selected.city}" id="city" required="true" requiredMessage="City is required">
+				</h:inputText>
+				
+				<h:outputLabel for="country">
+					<h:outputText id="countryCol" value="Country" />
+				</h:outputLabel>
+				
+				<h:inputText  value="#{adminListBean.selected.country}" id="country" required="true" requiredMessage="Country name is required!">
+				</h:inputText>
+				
+				<f:verbatim></f:verbatim>
+				<h:commandButton action="#{adminListBean.update}" value="Update" />
+					
+			</h:panelGrid>		
+			</h:form>											
+			
+	</ui:define>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/listHotels.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/listUsers.xhtml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/listUsers.xhtml?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/listUsers.xhtml (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/listUsers.xhtml Wed May 13 21:09:47 2009
@@ -0,0 +1,141 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+	
+	Licensed to the Apache Software Foundation (ASF) under one or more
+	contributor license agreements. See the NOTICE file distributed with
+	this work for additional information regarding copyright ownership.
+	The ASF licenses this file to You under the Apache License, Version
+	2.0 (the "License"); you may not use this file except in compliance
+	with the License. You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+	applicable law or agreed to in writing, software distributed under the
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+	CONDITIONS OF ANY KIND, either express or implied. See the License for
+	the specific language governing permissions and limitations under the
+	License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:f="http://java.sun.com/jsf/core"
+    xmlns:h="http://java.sun.com/jsf/html"
+    xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+  <title>OpenWebBeans :: Examples :: Reservation</title>
+  <link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/main.css"/>
+</head>
+
+<body>
+  
+  	<ui:composition template="/admin/menu.xhtml">
+  		  				
+		<ui:define name="caption">
+			<h:outputText value="List Reservations" styleClass="captionTitle" />	
+		</ui:define>
+			
+		<ui:define name="body">
+			
+		<h:form id="form">
+			
+			<h:dataTable id="dt" cellpadding="5" value="#{adminListUser.users}" binding="#{adminListUser.model}" var="model" styleClass="table dataTable" rowClasses="oddRow,evenRow">
+				
+				<h:column id="dt1">
+					<f:facet name="header">
+						<h:outputText id="col1" value="Name" />
+					</f:facet>
+					
+					<h:outputText id="col11" value="#{model.name}" />					
+				</h:column>
+				
+				<h:column id="dt2">
+					<f:facet name="header">
+						<h:outputText id="col2" value="Surname" />
+					</f:facet>
+					
+					<h:outputText id="col221" value="#{model.surname}" />					
+				</h:column>
+				
+				<h:column id="dt3">
+					<f:facet name="header">
+						<h:outputText id="col3" value="Age" />
+					</f:facet>
+					
+					<h:outputText id="col222" value="#{model.age}" />					
+				</h:column>
+				
+				<h:column id="dt4">
+					<f:facet name="header">
+						<h:outputText id="col4" value="User Name" />
+					</f:facet>
+					
+					<h:outputText id="col223" value="#{model.userName}" />					
+				</h:column>
+				
+				<h:column id="dt5">
+					<f:facet name="header">
+						<h:outputText id="col5" value="Password" />
+					</f:facet>
+					
+					<h:outputText id="col224" value="#{model.password}" />					
+				</h:column>
+	
+				<h:column id="dt6">
+					<f:facet name="header">
+						<h:outputText id="col6" value="Registered Date" />
+					</f:facet>
+					
+					<h:outputText id="col225" value="#{model.registerDate}" />					
+				</h:column>
+				
+				<h:column id="dt7">
+					<h:commandLink action="#{adminListUser.getReservations}" value="Show Reservations" />					
+				</h:column>
+
+			</h:dataTable>	
+			
+			<div class="caption">
+				<h:outputText value="User Reservations" styleClass="captionTitle" />	
+			</div>
+			
+			<h:dataTable id="dt2" cellpadding="5" value="#{adminListUser.hotels}" var="model" styleClass="table dataTable" rowClasses="oddRow,evenRow">
+				
+				<h:column id="dt21">
+					<f:facet name="header">
+						<h:outputText id="col1" value="Name" />
+					</f:facet>
+					
+					<h:outputText id="col111" value="#{model.name}" />					
+				</h:column>
+				
+				<h:column id="dt22">
+					<f:facet name="header">
+						<h:outputText id="col222" value="Star" />
+					</f:facet>
+					
+					<h:outputText id="col322" value="#{model.star}" />					
+				</h:column>
+				
+				<h:column id="dt23">
+					<f:facet name="header">
+						<h:outputText id="col2" value="City" />
+					</f:facet>
+					
+					<h:outputText id="col42" value="#{model.city}" />					
+				</h:column>
+
+				<h:column id="dt24">
+					<f:facet name="header">
+						<h:outputText id="co5l2" value="Country" />
+					</f:facet>
+					
+					<h:outputText id="col622" value="#{model.country}" />					
+				</h:column>
+				
+																			
+			</h:dataTable>	
+									
+		</h:form>
+	</ui:define>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/listUsers.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/menu.xhtml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/menu.xhtml?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/menu.xhtml (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/menu.xhtml Wed May 13 21:09:47 2009
@@ -0,0 +1,77 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+	
+	Licensed to the Apache Software Foundation (ASF) under one or more
+	contributor license agreements. See the NOTICE file distributed with
+	this work for additional information regarding copyright ownership.
+	The ASF licenses this file to You under the Apache License, Version
+	2.0 (the "License"); you may not use this file except in compliance
+	with the License. You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+	applicable law or agreed to in writing, software distributed under the
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+	CONDITIONS OF ANY KIND, either express or implied. See the License for
+	the specific language governing permissions and limitations under the
+	License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:f="http://java.sun.com/jsf/core"
+    xmlns:h="http://java.sun.com/jsf/html"
+    xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+  <title>OpenWebBeans :: Examples :: Reservation</title>
+  <link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/main.css"/>
+</head>
+
+<body>
+  
+ <div id="main">		
+  
+	<h:messages globalOnly="false" showSummary="true" infoClass="message infoMessage" errorClass="message errorMessage"></h:messages>	
+	
+	<div class="logout">
+		
+		<h:outputLink value="#{facesContext.externalContext.requestContextPath}/admin/menu.jsf" style="float:left;">
+			<h:outputText value="Home Page" />
+		</h:outputLink>
+		
+		<h:form style="margin-left:10px;float:left;">
+			<h:commandLink action="#{logoutBean.logout}" value="Logout"/>
+		</h:form>
+	</div>
+
+
+	<div class="caption">
+		<h:outputText value="Welcome, "/>
+		<h:outputText value="#{sessionTracker.user.name} #{sessionTracker.user.surname}" style="color:red;font-weight:bold;"/>
+		
+		<br/>
+		
+		<h:outputText value="Last Login Date : "/>
+		<h:outputText value="#{sessionTracker.user.lastLoginDate}" style="color:red;font-weight:bold;"/>
+		
+		<ul style="display: block;margin-top: 15px;clear: both;">
+			<h:outputLink value="#{facesContext.externalContext.requestContextPath}/admin/defineHotel.jsf" styleClass="menuItem">
+				<h:outputText value="Define New Hotel" />
+			</h:outputLink>
+	
+			<h:outputLink value="#{facesContext.externalContext.requestContextPath}/admin/listHotels.jsf" styleClass="menuItem">
+				<h:outputText value="List Hotels" />
+			</h:outputLink>
+	
+			<h:outputLink value="#{facesContext.externalContext.requestContextPath}/admin/listUsers.jsf" styleClass="menuItem">
+				<h:outputText value="Show User Reservations" />
+			</h:outputLink>			
+		</ul>
+						
+		<ui:insert name="caption"></ui:insert>		
+												
+	</div>		
+				
+		<ui:insert name="body"></ui:insert>		
+		
+</div>		
+</body>
+</html>
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/admin/menu.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/index.html?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/index.html (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/index.html Wed May 13 21:09:47 2009
@@ -0,0 +1,21 @@
+<html>
+<!--
+	
+	Licensed to the Apache Software Foundation (ASF) under one or more
+	contributor license agreements. See the NOTICE file distributed with
+	this work for additional information regarding copyright ownership.
+	The ASF licenses this file to You under the Apache License, Version
+	2.0 (the "License"); you may not use this file except in compliance
+	with the License. You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+	applicable law or agreed to in writing, software distributed under the
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+	CONDITIONS OF ANY KIND, either express or implied. See the License for
+	the specific language governing permissions and limitations under the
+	License.
+-->
+<head>
+  <meta http-equiv="Refresh" content="0; URL=login.jsf">
+</head>
+</html>
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/login.xhtml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/login.xhtml?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/login.xhtml (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/login.xhtml Wed May 13 21:09:47 2009
@@ -0,0 +1,73 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+	
+	Licensed to the Apache Software Foundation (ASF) under one or more
+	contributor license agreements. See the NOTICE file distributed with
+	this work for additional information regarding copyright ownership.
+	The ASF licenses this file to You under the Apache License, Version
+	2.0 (the "License"); you may not use this file except in compliance
+	with the License. You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+	applicable law or agreed to in writing, software distributed under the
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+	CONDITIONS OF ANY KIND, either express or implied. See the License for
+	the specific language governing permissions and limitations under the
+	License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:f="http://java.sun.com/jsf/core"
+    xmlns:h="http://java.sun.com/jsf/html"
+    xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+  <title>OpenWebBeans :: Examples :: Reservation</title>
+  <link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/main.css"/>
+</head>
+
+<body>
+  
+    <div id="main">
+		
+
+		<h:messages globalOnly="false" showSummary="true" infoClass="message infoMessage" errorClass="message errorMessage"></h:messages>
+		
+		
+		<div class="caption">
+			<h:outputText value="User Logged-In Page" />			
+			<div align="center" style="font-size: 14px;color: #203360">
+				Apache OpenWebBeans Hotel Reservation Sample Using JPA, JSF and OWB;
+			</div>			
+		</div>
+		
+		<h:form id="form">
+			
+			<h:panelGrid columns="2" styleClass="table" cellspacing="2">
+				
+				<h:outputLabel for="userName">
+					<h:outputText value="User Name" />
+				</h:outputLabel>
+				
+				<h:inputText id="userName" value="#{loginBean.userName}"></h:inputText>	
+
+				<h:outputLabel for="password">
+					<h:outputText value="User Password"></h:outputText>
+				</h:outputLabel>
+				
+				<h:inputSecret id="password" value="#{loginBean.password}"></h:inputSecret>	
+				
+				<h:panelGroup>					
+					<h:commandButton action="#{loginBean.login}" value="Login" />
+					<h:commandButton action="false" value="Clear Form" onclick="document.forms[0].reset();document.getElementById('form:userName').focus();return false;" />					
+				</h:panelGroup>
+				
+				<h:outputLink value="#{facesContext.externalContext.requestContextPath}/register.jsf">
+					<h:outputText value="Not a registered! Register here..." />
+				</h:outputLink>				
+								
+			</h:panelGrid>
+			
+		</h:form>		
+		</div>		    
+	</body>
+</html>
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/login.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/main.css
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/main.css?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/main.css (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/main.css Wed May 13 21:09:47 2009
@@ -0,0 +1,90 @@
+body{
+	
+	font-size: 12px;
+	margin: 0px;
+	padding: 0px;
+	margin: auto;
+	width: 980px;
+}
+
+#main{
+	margin: auto;
+}
+
+.logout{
+	float: right;
+	font-weight: bold;
+	color: black;
+	font-size: 14px;
+}
+
+.caption{
+	padding : 10px;
+	border-bottom: 10px solid black;
+	font-weight: bold;
+	color: gray; 
+	text-align: left;
+}
+
+.captionTitle{
+	color: #880000;
+	font-size: 14px;
+}
+
+.menuItem{
+	padding: 10px;
+	font-weight: bold;	
+	color: #203360;
+	text-decoration: none;
+}
+
+.table{
+	border : 1px solid black;
+	border-collapse: collapse;
+}
+
+.dataTable{
+	
+	margin : 15px 0px;
+}
+
+.oddRow{	
+	border: 1px solid black;
+	background-color: #FFF9D7;
+}
+
+.evenRow{	
+	border: 1px solid black;
+}
+
+
+.leftColumns{
+	text-align: right;
+}
+
+.rightColumns{
+	text-align: left;
+}
+
+
+.message{
+	margin : 10px 10px 10px 25px;
+	padding : 15px;
+	font-size: 12px;
+	font-weight: bold;	
+	display: block;
+	list-style-type: none;
+	list-style-image: none;
+}
+
+.errorMessage{
+	background-color: #FFEBE8;
+	border : 1px solid #DD3C10;	
+	color: black;
+}
+
+.infoMessage{
+	background-color:#FFF9D7;
+	border: 1px solid #E2C822;
+	color: #333333;
+}
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/main.css
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/register.xhtml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/register.xhtml?rev=774537&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/register.xhtml (added)
+++ incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/register.xhtml Wed May 13 21:09:47 2009
@@ -0,0 +1,91 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+	
+	Licensed to the Apache Software Foundation (ASF) under one or more
+	contributor license agreements. See the NOTICE file distributed with
+	this work for additional information regarding copyright ownership.
+	The ASF licenses this file to You under the Apache License, Version
+	2.0 (the "License"); you may not use this file except in compliance
+	with the License. You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+	applicable law or agreed to in writing, software distributed under the
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+	CONDITIONS OF ANY KIND, either express or implied. See the License for
+	the specific language governing permissions and limitations under the
+	License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:f="http://java.sun.com/jsf/core"
+    xmlns:h="http://java.sun.com/jsf/html"
+    xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+  <title>OpenWebBeans :: Examples :: Reservation</title>
+  <link type="text/css" rel="stylesheet" href="#{facesContext.externalContext.requestContextPath}/main.css"/>
+</head>
+
+<body>
+  
+    <div id="main">
+		
+		<h:messages globalOnly="false" showSummary="true" infoClass="message infoMessage" errorClass="message errorMessage"></h:messages>
+		
+		<div class="caption">
+			<h:outputText value="New User Register" />
+		</div>
+			
+		<h:form id="form">
+				
+			<h:panelGrid columns="2" styleClass="table" cellspacing="2" cellpadding="5" columnClasses="leftColumns,rightColumns">
+				
+				<h:outputLabel for="name">
+					<h:outputText value="Name" />
+				</h:outputLabel>
+				
+				<h:inputText value="#{register.name}" id="name" required="true" requiredMessage="Name is required!"/>
+				
+				<h:outputLabel for="surname">
+					<h:outputText value="Surname" />
+				</h:outputLabel>
+				
+				<h:inputText value="#{register.surname}" id="surname" required="true" requiredMessage="Surname is required!"/>
+
+				<h:outputLabel for="age">
+					<h:outputText value="Age" />
+				</h:outputLabel>
+				
+				<h:inputText value="#{register.age}" id="age" required="true" requiredMessage="Age is required">
+				</h:inputText>
+				
+				<h:outputLabel for="userName">
+					<h:outputText value="User Name" />
+				</h:outputLabel>
+				
+				<h:inputText value="#{register.userName}" id="userName" required="true" requiredMessage="User name is required and minumum 8 characters!">
+					<f:validateLength minimum="8" maximum="50"/>
+				</h:inputText>
+
+				<h:outputLabel for="password">
+					<h:outputText value="Password" />
+				</h:outputLabel>
+				
+				<h:inputSecret value="#{register.password}" id="password" required="true" requiredMessage="Password must be minumum 4 and maximum 8 characters!">
+					<f:validateLength  minimum="4" maximum="20"/>
+				</h:inputSecret>
+
+				<h:outputLabel for="admin">
+					<h:outputText value="Admin Authorization" />
+				</h:outputLabel>
+				
+				<h:selectBooleanCheckbox value="#{register.admin}">
+				</h:selectBooleanCheckbox>
+				
+				<h:commandButton action="#{register.register}" value="Register" />
+				<h:commandButton action="false" value="Clear Form" immediate="true" onclick="document.forms[0].reset();document.getElementById('form:name').focus();return false;" />					
+			
+			</h:panelGrid>
+		</h:form>
+	   </div>
+</body>
+</html>
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/reservation/src/main/webapp/register.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native