incubator-olio-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r822866 [2/3] - in /incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp: controller/ fileupload/ model/ rest/ util/
Date Wed, 07 Oct 2009 19:33:00 GMT
Modified: incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/rest/EventRestAction.java
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/rest/EventRestAction.java?rev=822866&r1=822865&r2=822866&view=diff
==============================================================================
--- incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/rest/EventRestAction.java (original)
+++ incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/rest/EventRestAction.java Wed Oct  7 19:32:59 2009
@@ -15,7 +15,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.olio.webapp.rest;
 
 import org.apache.olio.webapp.controller.Action;
@@ -45,6 +44,7 @@
 import java.util.GregorianCalendar;
 import java.util.Hashtable;
 import java.util.TimeZone;
+import java.util.logging.Logger;
 
 /**
  * handles all request related to users
@@ -53,189 +53,189 @@
  * @author Binu John
  */
 public class EventRestAction implements Action {
-    private static final String comma=", ";
-    private static final String dq_cm="\", ";
+
+    private static final String comma = ", ";
+    private static final String dq_cm = "\", ";
     private ServletContext context;
-    private static final boolean bDebug=false;
     private static final int UPDATE_MODE_ADD_ATTENDEE = 1;
     private static final int UPDATE_MODE_DELETE_ATTENDEE = 2;
-    
+    private Logger logger = Logger.getLogger(EventRestAction.class.getName());
+
     public EventRestAction(ServletContext context) {
-        this.context=context;
+        this.context = context;
     }
-    
+
     public String process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-        String path=request.getPathInfo();
-        if(bDebug) System.out.println("\n*** pathinfo = " + path);
-        ModelFacade modelFacade=(ModelFacade)context.getAttribute(MF_KEY);
+        String path = request.getPathInfo();
+        logger.finer("\n*** pathinfo = " + path);
+        ModelFacade modelFacade = (ModelFacade) context.getAttribute(MF_KEY);
         if (path.equals("/event")) {
             // This is not really rest
         } else if (path.equals("/event/updateRating")) {
             updateSocialEventRating(request, response, modelFacade);
         } else if (path.equals("/event/getComments")) {
             getSocialEventComments(request, response, modelFacade);
-        }else if (path.equals("/event/updateCommentsRating")) {
-            updateSocialEventComment (request, response, modelFacade);
+        } else if (path.equals("/event/updateCommentsRating")) {
+            updateSocialEventComment(request, response, modelFacade);
         } else if (path.equals("/event/deleteCommentsRating")) {
-            deleteSocialEventComment (request, response, modelFacade);
-        } else if(path.equals("/event/addEvent") || path.equals("updateEvent")) {
+            deleteSocialEventComment(request, response, modelFacade);
+        } else if (path.equals("/event/addEvent") || path.equals("updateEvent")) {
             // file upload
-            System.out.println ("AddEvent ... ");
-            FileUploadHandler fuh=new FileUploadHandler();
-            Hashtable<String, String> htUpload=fuh.handleFileUpload(request, response);
+            logger.finer("AddEvent ... ");
+            FileUploadHandler fuh = new FileUploadHandler();
+            Hashtable<String, String> htUpload = fuh.handleFileUpload(request, response);
             // file is upload check for error and then write to database
-            if(htUpload != null) {
-                if(bDebug) {
-                    StringBuilder sb=new StringBuilder();
-                    for(String key : htUpload.keySet()) {
-                        sb.append(key);
-                        sb.append(comma);
-                    }
-                    if (bDebug)System.out.println("\n***elements  = " + sb.toString());
+            if (htUpload != null) {
+                StringBuilder sb = new StringBuilder();
+                for (String key : htUpload.keySet()) {
+                    sb.append(key);
+                    sb.append(comma);
                 }
-                
+                logger.finer("\n***elements  = " + sb.toString());
                 SocialEvent event = null;
-                
                 String type = htUpload.get("submit");
-                
-                if (type == null)
+                if (type == null) {
                     return "/site.jsp?page=error.jsp";
-                
-                if (type != null && type.equals("Update")) {
-                    event = updateEvent (request, modelFacade, htUpload);
                 }
-                else {
+
+                if (type != null && type.equals("Update")) {
+                    event = updateEvent(request, modelFacade, htUpload);
+                } else {
                     event = createEvent(request, modelFacade, htUpload);
                     if (request.getSession(true).getAttribute("userBean") != null) {
                         UserBean uBean = (UserBean) request.getSession(true).getAttribute("userBean");
                         uBean.setDisplayMessage("Event added successfully");
-                        WebappUtil.getLogger().log(Level.FINE, "A new Event has been added and persisted");
+                        logger.log(Level.FINER, "A new Event has been added and persisted");
                     }
                 }
                 // clear the cache 
                 WebappUtil.clearCache("/event/list");
-                response.sendRedirect (request.getContextPath()+"/event/detail?socialEventID=" + event.getSocialEventID());
+                response.sendRedirect(request.getContextPath() + "/event/detail?socialEventID=" + event.getSocialEventID());
                 return null;
             }
-        } else if(path.equals("/event/fileuploadEventFinal")) {
+        } else if (path.equals("/event/fileuploadEventFinal")) {
             // file upload status request
             FileUploadHandler.handleFileUploadFinal(request, response);
         } else if (path.equals("/event/getAttendees")) {
-        getAttendees(request, response, modelFacade);
-        } else if(path.equals("/event/addAttendee")) {
-        updateAttendee(request, response, modelFacade, UPDATE_MODE_ADD_ATTENDEE);
+            getAttendees(request, response, modelFacade);
+        } else if (path.equals("/event/addAttendee")) {
+            updateAttendee(request, response, modelFacade, UPDATE_MODE_ADD_ATTENDEE);
         } else if (path.equals("/event/deleteAttendee")) {
-            updateAttendee (request, response, modelFacade, UPDATE_MODE_DELETE_ATTENDEE);
-        }else {
+            updateAttendee(request, response, modelFacade, UPDATE_MODE_DELETE_ATTENDEE);
+        } else {
             // file upload status request
             FileUploadHandler.handleFileStatus(request, response);
         }
-        
+
         return null;
     }
-    
-    public void updateAttendee(HttpServletRequest request, HttpServletResponse response, 
+
+    public void updateAttendee(HttpServletRequest request, HttpServletResponse response,
             ModelFacade modelFacade, int mode) {
-        Person person=SecurityHandler.getInstance().getLoggedInPerson(request);
-        if(person == null) {
+        Person person = SecurityHandler.getInstance().getLoggedInPerson(request);
+        if (person == null) {
             // This is an error condition -- ignore
             return;
         }
-        String sxEventId=request.getParameter("socialEventID");
-        if (sxEventId == null)
-           throw new RuntimeException ("Couldnot find event with socialEventID = " +
-                            sxEventId);
+        String sxEventId = request.getParameter("socialEventID");
+        if (sxEventId == null) {
+            throw new RuntimeException("Couldnot find event with socialEventID = " +
+                    sxEventId);
+        }
         try {
-            int eventId=Integer.parseInt(sxEventId);
-            SocialEvent event=modelFacade.getSocialEvent(eventId);
-            if (event == null)
-                throw new RuntimeException ("Couldnot find event with socialEventID = " +
+            int eventId = Integer.parseInt(sxEventId);
+            SocialEvent event = modelFacade.getSocialEvent(eventId);
+            if (event == null) {
+                throw new RuntimeException("Couldnot find event with socialEventID = " +
                         eventId);
-            
+            }
+
             boolean attending = event.isAttending(person);
-            
+
             boolean already = false;
-            String status="success";
+            String status = "success";
             if (mode == UPDATE_MODE_ADD_ATTENDEE && attending) {
-                    already = true;
-                    status = "attending";
+                already = true;
+                status = "attending";
             }
-            if (!attending && mode==UPDATE_MODE_DELETE_ATTENDEE) {
+            if (!attending && mode == UPDATE_MODE_DELETE_ATTENDEE) {
                 already = true;
                 status = "not_attending";
             }
-            
+
             if (!already) {
                 if (mode == UPDATE_MODE_ADD_ATTENDEE) {
                     event.getAttendees().add(person);
                     person.getSocialEvents().add(event);
                     status = "added";
-                }
-                else {
+                } else {
                     event.getAttendees().remove(person);
                     person.getSocialEvents().remove(event);
                     status = "deleted";
                 }
-                
+
                 modelFacade.updateSocialEvent(event);
             }
             String s = this.getAttendeesAsJson(event.getAttendees(), status);
-            
-            if (bDebug) System.out.println("\n*** people = " + s);
+
+            logger.finer("\n*** people = " + s);
             response.setContentType("application/json;charset=UTF-8");
             response.setHeader("Cache-Control", "no-cache");
             response.getWriter().write(s);
             response.flushBuffer();
-            
+
             // Before we return, set the userBean's upcomingEvents as dirty since 
             // the event add/deleted may be in the list
             UserBean uBean = (UserBean) request.getSession(true).getAttribute("userBean");
-            if (uBean != null)
+            if (uBean != null) {
                 uBean.setUpcomingEventsDirty(true);
+            }
         } catch (Exception e) {
             e.printStackTrace();
             throw new RuntimeException(e);
         }
     }
-    
-    private void getAttendees (HttpServletRequest request, HttpServletResponse response, 
+
+    private void getAttendees(HttpServletRequest request, HttpServletResponse response,
             ModelFacade modelFacade) throws IOException {
-        Person person=SecurityHandler.getInstance().getLoggedInPerson(request);
+        Person person = SecurityHandler.getInstance().getLoggedInPerson(request);
         String status = null;
         String uname = null;
-        if(person == null) {
+        if (person == null) {
             // Check wehther the userName parameter is passed in
             uname = request.getParameter("userName");
             if (uname == null || uname.length() == 0);
-                status = "not_logged_in";
-        }
-        else
+            status = "not_logged_in";
+        } else {
             uname = person.getUserName();
-        
-        String sxEventId=request.getParameter("socialEventID");
-        if (sxEventId == null)
-           throw new RuntimeException ("Couldnot find event with socialEventID = " +
-                            sxEventId);
-        SocialEvent event=null;
+        }
+
+        String sxEventId = request.getParameter("socialEventID");
+        if (sxEventId == null) {
+            throw new RuntimeException("Couldnot find event with socialEventID = " +
+                    sxEventId);
+        }
+        SocialEvent event = null;
         try {
-            int eventId=Integer.parseInt(sxEventId);
-            event=modelFacade.getSocialEvent(eventId);
-            if (event == null)
-                throw new RuntimeException ("Couldnot find event with socialEventID = " +
+            int eventId = Integer.parseInt(sxEventId);
+            event = modelFacade.getSocialEvent(eventId);
+            if (event == null) {
+                throw new RuntimeException("Couldnot find event with socialEventID = " +
                         eventId);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException("Couldnot find event with socialEventID = " +
+                    sxEventId);
         }
-        catch (Exception e) {
-            throw new RuntimeException ("Couldnot find event with socialEventID = " +
-                            sxEventId);
-        }
-        if (uname != null && uname.length()>0) {
-            if (event.isAttending(uname)) 
+        if (uname != null && uname.length() > 0) {
+            if (event.isAttending(uname)) {
                 status = "attending";
-            else
+            } else {
                 status = "not_attending";
+            }
         }
-        
-        String s = getAttendeesAsJson (event.getAttendees(), status);
+
+        String s = getAttendeesAsJson(event.getAttendees(), status);
         // Faban does not understand the content type application/json
         //response.setContentType("application/json;charset=UTF-8");
         response.setContentType("text/plain;charset=UTF-8");
@@ -243,109 +243,112 @@
         response.getWriter().write(s);
         response.flushBuffer();
     }
-            
-    private static String getAttendeesAsJson (Collection<Person> attendees, String status) {
-        StringBuilder sb=new StringBuilder("{ \"result\": {\"status\":");
+
+    private static String getAttendeesAsJson(Collection<Person> attendees, String status) {
+        StringBuilder sb = new StringBuilder("{ \"result\": {\"status\":");
         sb.append("\"" + status + "\"");
-        sb.append (", \"attendees\":[");
+        sb.append(", \"attendees\":[");
         if (attendees != null) {
-            for(Person psx : attendees) {
+            for (Person psx : attendees) {
                 sb.append("{\"userName\":\"");
                 sb.append(WebappUtil.encodeJSONString(psx.getUserName()));
                 sb.append("\"}, ");
             }
-            if(attendees.size() > 0) {
-                sb.deleteCharAt(sb.length()-1);
-                sb.deleteCharAt(sb.length()-1);
+            if (attendees.size() > 0) {
+                sb.deleteCharAt(sb.length() - 1);
+                sb.deleteCharAt(sb.length() - 1);
             }
         }
-        
+
         sb.append("] } }");
         return sb.toString();
     }
-    
+
     public SocialEvent createEvent(HttpServletRequest request, ModelFacade modelFacade, Hashtable<String, String> htUpload) {
-        String street1=htUpload.get(STREET1_PARAM);
-        String street2=htUpload.get(STREET2_PARAM);
-        String city=htUpload.get(CITY_PARAM);
-        String state=htUpload.get(STATE_PARAM);
-        String country=htUpload.get(COUNTRY_PARAM);
-        String zip=htUpload.get(ZIP_PARAM);
-        Address address=WebappUtil.handleAddress(context, street1, street2, city, state, zip, country);
-        
-        String title=htUpload.get(TITLE_PARAM);
-        String description=htUpload.get(DESCRIPTION_PARAM);
-        String summary=htUpload.get(SUMMARY_PARAM);
-        String tags=htUpload.get(TAGS_PARAM);
-        String telephone=htUpload.get(TELEPHONE_PARAM);
-        String monthx=htUpload.get("month");
-        String dayx=htUpload.get("day");
-        String yearx=htUpload.get("year");
-        String hourx=htUpload.get("hour");
-        String minutex=htUpload.get("minute");
+        String street1 = htUpload.get(STREET1_PARAM);
+        String street2 = htUpload.get(STREET2_PARAM);
+        String city = htUpload.get(CITY_PARAM);
+        String state = htUpload.get(STATE_PARAM);
+        String country = htUpload.get(COUNTRY_PARAM);
+        String zip = htUpload.get(ZIP_PARAM);
+        Address address = WebappUtil.handleAddress(context, street1, street2, city, state, zip, country);
+
+        String title = htUpload.get(TITLE_PARAM);
+        String description = htUpload.get(DESCRIPTION_PARAM);
+        String summary = htUpload.get(SUMMARY_PARAM);
+        String tags = htUpload.get(TAGS_PARAM);
+        String telephone = htUpload.get(TELEPHONE_PARAM);
+        String monthx = htUpload.get("month");
+        String dayx = htUpload.get("day");
+        String yearx = htUpload.get("year");
+        String hourx = htUpload.get("hour");
+        String minutex = htUpload.get("minute");
         String timezonex = htUpload.get(TIMEZONE_PARAM);
-        
+
         // SECURITY get submitter from session
-        String submitterUserName=null;
-        Person person=SecurityHandler.getInstance().getLoggedInPerson(request);
-        if(person != null) {
-            submitterUserName=person.getUserName();
+        String submitterUserName = null;
+        Person person = SecurityHandler.getInstance().getLoggedInPerson(request);
+        if (person != null) {
+            submitterUserName = person.getUserName();
         } else {
             // error, submitter must be there
             // you shouldn't be able to get here unless there is a hole in the security mechanism
-            
+
             // ADDENDUM - need to ommenting out the security check for now
-             // because of the Faban issues with two HTTP Sessions 
+            // because of the Faban issues with two HTTP Sessions
             //(one from Java HTTP Client, the other from Apache HTTP client
             // workaround - if user is not in session, then get Person from username in JSP
-             //modification for getting using username in JSP
+            //modification for getting using username in JSP
             //submitterUserName = htUpload.get("submitter_user_name");
             submitterUserName = htUpload.get("submitter_user_name");
             request.setAttribute("submitter_user_name", submitterUserName);
-            if(bDebug)System.out.println("EventRestAction:  other session--> username is " + submitterUserName);            
+            logger.finer("EventRestAction:  other session--> username is " + submitterUserName);
             person = modelFacade.getPerson(submitterUserName);
-            //throw new RuntimeException(WebappUtil.getMessage("person_not_logged_in"));
+        //throw new RuntimeException(WebappUtil.getMessage("person_not_logged_in"));
         }
-                                               
+
         //end modification
-        
-        String literaturex=htUpload.get(UPLOAD_LITERATURE_PARAM);
-        if(literaturex == null) literaturex="";
-        String imagex=htUpload.get(UPLOAD_EVENT_IMAGE_PARAM);
+
+        String literaturex = htUpload.get(UPLOAD_LITERATURE_PARAM);
+        if (literaturex == null) {
+            literaturex = "";
+        }
+        String imagex = htUpload.get(UPLOAD_EVENT_IMAGE_PARAM);
         String thumbImage;
         thumbImage = htUpload.get(UPLOAD_EVENT_IMAGE_THUMBNAIL_PARAM);
-        if (thumbImage == null)
+        if (thumbImage == null) {
             thumbImage = "";
+        }
         // get upload location from map
-        String imageLocation=htUpload.get(UPLOAD_EVENT_IMAGE_PARAM + FileUploadUtil.FILE_LOCATION_KEY);
-        if(bDebug) System.out.println("\n image path = " + imageLocation);
+        String imageLocation = htUpload.get(UPLOAD_EVENT_IMAGE_PARAM + FileUploadUtil.FILE_LOCATION_KEY);
+        logger.finer("\n image path = " + imageLocation);
         // This is done during upload for efficiency.
         // thumbImage=WebappUtil.constructThumbnail(imageLocation);
-        if(bDebug) System.out.println("\n thumb path = " + thumbImage);
-   
-        
+        logger.finer("\n thumb path = " + thumbImage);
+
+
         // gat time in utc milliseconds...
         //adding timezone specific info for social event
-        Calendar localCal=GregorianCalendar.getInstance(TimeZone.getTimeZone(timezonex));
+        Calendar localCal = GregorianCalendar.getInstance(TimeZone.getTimeZone(timezonex));
         localCal.set(Calendar.MONTH, Integer.parseInt(monthx) - 1);
         localCal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(dayx));
         localCal.set(Calendar.YEAR, Integer.parseInt(yearx));
         localCal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(hourx));
         localCal.set(Calendar.MINUTE, Integer.parseInt(minutex));
         localCal.set(Calendar.SECOND, 0);
-        if(bDebug) System.out.println("\n***local = " + localCal + "\n Millis = " + localCal.getTimeInMillis());
-        Timestamp eventTimestamp=new Timestamp(localCal.getTimeInMillis());
-        
+        logger.finer("\n***local = " + localCal + "\n Millis = " + localCal.getTimeInMillis());
+        Timestamp eventTimestamp = new Timestamp(localCal.getTimeInMillis());
+
         SocialEvent socialEvent = new SocialEvent(title, summary, description, submitterUserName, address, telephone, 0, 0,
                 imagex, thumbImage, literaturex, eventTimestamp);
-        if(bDebug) System.out.println("Event title = " + socialEvent.getTitle());
-        
-        
+        logger.finer("Event title = " + socialEvent.getTitle());
+
+
         // Submitter is not necessarily an attendde
-        
+
         socialEvent = modelFacade.addSocialEvent(socialEvent, tags);
-        WebappUtil.getLogger().log(Level.FINE, "SocialEvent " + socialEvent.getSocialEventID() + " has been persisted");
-        
+        logger.log(Level.FINER, "SocialEvent " + socialEvent.getSocialEventID() + " has been persisted");
+
         return socialEvent;
     }
 
@@ -353,70 +356,69 @@
         // Update requires an id
         String sids = htUpload.get("socialEventID");
         if (sids == null) {
-            throw new RuntimeException ("socialEventID is not set for updateEVent"); 
+            throw new RuntimeException("socialEventID is not set for updateEVent");
         }
         SocialEvent event = null;
         try {
             int id = Integer.parseInt(sids);
             event = modelFacade.getSocialEvent(id);
-        }
-        catch (Exception e) {
-            throw new RuntimeException ("updateSocialEvent: SocialEvent could not be retrieved - id = " +
+        } catch (Exception e) {
+            throw new RuntimeException("updateSocialEvent: SocialEvent could not be retrieved - id = " +
                     sids);
         }
-        
-        String street1=htUpload.get(STREET1_PARAM);
-        String street2=htUpload.get(STREET2_PARAM);
-        String city=htUpload.get(CITY_PARAM);
-        String state=htUpload.get(STATE_PARAM);
-        String country=htUpload.get(COUNTRY_PARAM);
-        String zip=htUpload.get(ZIP_PARAM);
-        Address address=WebappUtil.handleAddress(context, street1, street2, city, state, zip, country);
+
+        String street1 = htUpload.get(STREET1_PARAM);
+        String street2 = htUpload.get(STREET2_PARAM);
+        String city = htUpload.get(CITY_PARAM);
+        String state = htUpload.get(STATE_PARAM);
+        String country = htUpload.get(COUNTRY_PARAM);
+        String zip = htUpload.get(ZIP_PARAM);
+        Address address = WebappUtil.handleAddress(context, street1, street2, city, state, zip, country);
         event.setAddress(address);
-        
+
         event.setTitle(htUpload.get(TITLE_PARAM));
         event.setDescription(htUpload.get(DESCRIPTION_PARAM));
         event.setSummary(htUpload.get(SUMMARY_PARAM));
         event.setTelephone(htUpload.get(TELEPHONE_PARAM));
-        
-        String tags=htUpload.get(TAGS_PARAM);
-        
-        Calendar localCal=GregorianCalendar.getInstance();
-        String monthx=htUpload.get("month");
-        String dayx=htUpload.get("day");
-        String yearx=htUpload.get("year");
-        String hourx=htUpload.get("hour");
-        String minutex=htUpload.get("minute");
+
+        String tags = htUpload.get(TAGS_PARAM);
+
+        Calendar localCal = GregorianCalendar.getInstance();
+        String monthx = htUpload.get("month");
+        String dayx = htUpload.get("day");
+        String yearx = htUpload.get("year");
+        String hourx = htUpload.get("hour");
+        String minutex = htUpload.get("minute");
         localCal.set(Calendar.MONTH, Integer.parseInt(monthx) - 1);
         localCal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(dayx));
         localCal.set(Calendar.YEAR, Integer.parseInt(yearx));
         localCal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(hourx));
         localCal.set(Calendar.MINUTE, Integer.parseInt(minutex));
         localCal.set(Calendar.SECOND, 0);
-        if(bDebug) System.out.println("\n***local = " + localCal + "\n Millis = " + localCal.getTimeInMillis());
-        Timestamp eventTimestamp=new Timestamp(localCal.getTimeInMillis());
+        logger.finer("\n***local = " + localCal + "\n Millis = " + localCal.getTimeInMillis());
+        Timestamp eventTimestamp = new Timestamp(localCal.getTimeInMillis());
         event.setEventTimestamp(eventTimestamp);
-        
+
         // SECURITY get submitter from session
-        String submitterUserName=null;
-        Person person=SecurityHandler.getInstance().getLoggedInPerson(request);
-        if(person != null) {
-            submitterUserName=person.getUserName();
+        String submitterUserName = null;
+        Person person = SecurityHandler.getInstance().getLoggedInPerson(request);
+        if (person != null) {
+            submitterUserName = person.getUserName();
         } else {
-            throw new RuntimeException ("Unknown user");
+            throw new RuntimeException("Unknown user");
         }
-                                               
-        String literaturex=htUpload.get(UPLOAD_LITERATURE_PARAM);
-        String imagex=htUpload.get(UPLOAD_EVENT_IMAGE_PARAM);
+
+        String literaturex = htUpload.get(UPLOAD_LITERATURE_PARAM);
+        String imagex = htUpload.get(UPLOAD_EVENT_IMAGE_PARAM);
         String thumbImage;
         thumbImage = htUpload.get(UPLOAD_EVENT_IMAGE_THUMBNAIL_PARAM);
         // get upload location from map
-        String imageLocation=htUpload.get(UPLOAD_EVENT_IMAGE_PARAM + FileUploadUtil.FILE_LOCATION_KEY);
-        if(bDebug) System.out.println("\n image path = " + imageLocation);
+        String imageLocation = htUpload.get(UPLOAD_EVENT_IMAGE_PARAM + FileUploadUtil.FILE_LOCATION_KEY);
+        logger.finer("\n image path = " + imageLocation);
         // This is done during upload for efficiency.
         // thumbImage=WebappUtil.constructThumbnail(imageLocation);
-        if(bDebug) System.out.println("\n thumb path = " + thumbImage);
-        
+        logger.finer("\n thumb path = " + thumbImage);
+
         // Set the image and thumbnail location if the image location is not empty.
         // If empty, leave the old one alone
         // Delete the old images since it is being replaced
@@ -424,27 +426,30 @@
         ServiceLocator locator = ServiceLocator.getInstance();
         FileSystem fs = (FileSystem) locator.getFileSystem();
         if (imagex != null) {
-            if (event.getImageURL() != null)
+            if (event.getImageURL() != null) {
                 fs.delete(event.getImageURL());
+            }
             event.setImageURL(imagex);
-            if (event.getImageThumbURL() != null)
+            if (event.getImageThumbURL() != null) {
                 fs.delete(event.getImageThumbURL());
+            }
             event.setImageThumbURL(thumbImage);
         }
         if (literaturex != null) {
-            if (event.getLiteratureURL() != null)
+            if (event.getLiteratureURL() != null) {
                 fs.delete(event.getLiteratureURL());
+            }
             event.setLiteratureURL(literaturex);
         }
-        
+
         // Submitter is not necessarily an attendde
         event = modelFacade.updateSocialEvent(event, tags);
-        
-        WebappUtil.getLogger().log(Level.FINE, "SocialEvent " + event.getSocialEventID() + " has been updated");
-        
+
+        logger.log(Level.FINER, "SocialEvent " + event.getSocialEventID() + " has been updated");
+
         return event;
     }
-    
+
     private void updateSocialEventRating(HttpServletRequest request, HttpServletResponse response, ModelFacade modelFacade) throws IOException {
         String eventID = request.getParameter("socialEventID");
         int eid;
@@ -453,18 +458,18 @@
         } catch (Exception e) {
             throw new RuntimeException("Incorrect eventID = " + eventID);
         }
-        
-        Person person=SecurityHandler.getInstance().getLoggedInPerson(request);
-        
+
+        Person person = SecurityHandler.getInstance().getLoggedInPerson(request);
+
         int rating = 0;
-        
+
         try {
             rating = Integer.parseInt(request.getParameter("rating"));
+        } catch (Exception e) {
         }
-        catch (Exception e) {}
-        
+
         SocialEvent event = modelFacade.updateSocialEventRating(person, eid, rating);
-        
+
         /*
         response.setContentType("text/json");
         PrintWriter out = response.getWriter();
@@ -472,11 +477,11 @@
         
         boolean first=true;
         for (CommentsRating cr: event.getComments()) {
-            if (!first)
-                out.print(",");
-            else
-                first = false;
-            out.print(cr.toJSON());
+        if (!first)
+        out.print(",");
+        else
+        first = false;
+        out.print(cr.toJSON());
         }
          * */
         response.setContentType("text/plain");
@@ -484,8 +489,8 @@
         out.print("Your rating is " + rating);
         out.flush();
     }
-    
-    public void getSocialEventComments (HttpServletRequest request, HttpServletResponse response, ModelFacade modelFacade) throws IOException {
+
+    public void getSocialEventComments(HttpServletRequest request, HttpServletResponse response, ModelFacade modelFacade) throws IOException {
         String eventID = request.getParameter("socialEventID");
         SocialEvent event = null;
         try {
@@ -497,10 +502,10 @@
         response.setContentType("application/json;charset=UTF-8");
         response.setHeader("Cache-Control", "no-cache");
         PrintWriter out = response.getWriter();
-        out.print (getCommentsRatingAsJson(event));
+        out.print(getCommentsRatingAsJson(event));
         out.flush();
     }
-    
+
     private void updateSocialEventComment(HttpServletRequest request, HttpServletResponse response, ModelFacade modelFacade) throws IOException {
         String eventID = request.getParameter("socialEventID");
         int eid;
@@ -509,20 +514,20 @@
         } catch (Exception e) {
             throw new RuntimeException("Incorrect eventID");
         }
-        
-        Person person=SecurityHandler.getInstance().getLoggedInPerson(request);
-        
+
+        Person person = SecurityHandler.getInstance().getLoggedInPerson(request);
+
         String comment = request.getParameter("comment");
-        
+
         SocialEvent event = modelFacade.updateSocialEventComment(person, eid, comment);
-        
+
         response.setContentType("application/json;charset=UTF-8");
         response.setHeader("Cache-Control", "no-cache");
         PrintWriter out = response.getWriter();
-        out.print (getCommentsRatingAsJson(event));
+        out.print(getCommentsRatingAsJson(event));
         out.flush();
     }
-    
+
     private void deleteSocialEventComment(HttpServletRequest request, HttpServletResponse response, ModelFacade modelFacade) throws IOException {
         int eid, commentId;
         try {
@@ -533,34 +538,35 @@
                     request.getParameter("socialEventID") + " commentId = " +
                     request.getParameter("commentId"));
         }
-        
-        Person person=SecurityHandler.getInstance().getLoggedInPerson(request);
+
+        Person person = SecurityHandler.getInstance().getLoggedInPerson(request);
         SocialEvent event = modelFacade.getSocialEvent(eid);
-        
+
         if (event == null) {
-           throw new RuntimeException("Incorrect eventID or commentId. eventId = " +
+            throw new RuntimeException("Incorrect eventID or commentId. eventId = " +
                     request.getParameter("socialEventID") + " commentId = " +
                     request.getParameter("commentId"));
         }
-        
+
         modelFacade.deleteCommentFromSocialEvent(event, commentId);
-        
+
         response.setContentType("application/json;charset=UTF-8");
         response.setHeader("Cache-Control", "no-cache");
         PrintWriter out = response.getWriter();
-        out.print (getCommentsRatingAsJson(event));
+        out.print(getCommentsRatingAsJson(event));
         out.flush();
     }
-    
-    private String getCommentsRatingAsJson (SocialEvent event) {
+
+    private String getCommentsRatingAsJson(SocialEvent event) {
         StringBuilder strb = new StringBuilder();
         strb.append("{\"commentsratings\":[");
-        boolean first=true;
-        for (CommentsRating cr: event.getComments()) {
-            if (!first)
+        boolean first = true;
+        for (CommentsRating cr : event.getComments()) {
+            if (!first) {
                 strb.append(",");
-            else
+            } else {
                 first = false;
+            }
             strb.append(cr.toJSON());
         }
         strb.append("]}");

Modified: incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/rest/PersonRestAction.java
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/rest/PersonRestAction.java?rev=822866&r1=822865&r2=822866&view=diff
==============================================================================
--- incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/rest/PersonRestAction.java (original)
+++ incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/rest/PersonRestAction.java Wed Oct  7 19:32:59 2009
@@ -15,7 +15,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.olio.webapp.rest;
 
 import org.apache.olio.webapp.controller.Action;
@@ -39,6 +38,7 @@
 import org.apache.olio.webapp.util.UserBean;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.logging.Logger;
 
 /**
  * handles all request related to users
@@ -48,14 +48,14 @@
  * @author Kim Lichong
  */
 public class PersonRestAction implements Action {
-    
+
     private ServletContext context;
-    private static final boolean bDebug=false;
-    
+    private Logger logger = Logger.getLogger(PersonRestAction.class.getName());
+
     public PersonRestAction(ServletContext context) {
         this.context = context;
     }
-    
+
     /**
      * You can test this action by putting a url in your browser such as
      * http://localhost:8080/webapp/api/person?user_name=bob123
@@ -64,14 +64,13 @@
         PrintWriter out = response.getWriter();
         String actionType = request.getParameter(ACTION_TYPE_PARAM);
         String method = request.getMethod();
-        WebappUtil.getLogger().log(Level.FINE, "PERSON-REST-ACTION:process:: " + ACTION_TYPE_PARAM +"=" + actionType);
-        
+        logger.log(Level.FINER, "PERSON-REST-ACTION:process:: " + ACTION_TYPE_PARAM + "=" + actionType);
+
         if (actionType == null) { // treat it as a read
             // need to check for fileupload.  Will not have an action because it is in multi-part mime format
             String path = request.getPathInfo();
-            if (bDebug) {
-                System.out.println("\n*** pathinfo = " + path);
-            }
+            logger.finer("\n*** pathinfo = " + path);
+
             ModelFacade modelFacade = (ModelFacade) context.getAttribute(MF_KEY);
             if (path.equals("/person/fileuploadPerson")) {
                 // file upload
@@ -79,14 +78,12 @@
                 Hashtable<String, String> htUpload = fuh.handleFileUpload(request, response);
                 // file is upload check for error and then write to database
                 if (htUpload != null) {
-                    if (bDebug) {
-                        StringBuilder sb = new StringBuilder();
-                        for (String key : htUpload.keySet()) {
-                            sb.append(key);
-                            sb.append(",");
-                        }
-                    //System.out.println("\n***elements  = " + sb.toString());
+                    StringBuilder sb = new StringBuilder();
+                    for (String key : htUpload.keySet()) {
+                        sb.append(key);
+                        sb.append(",");
                     }
+                    //logger.finer("\n***elements  = " + sb.toString());
 
                     //createUser(request, htUpload);
                     // just for now comment out the above line
@@ -100,7 +97,7 @@
                         newEditPerson = createUser(request, htUpload, fuh);
                     }
 
-                    WebappUtil.getLogger().log(Level.FINE, "A new Person has been added and persisted");
+                    logger.log(Level.FINER, "A new Person has been added and persisted");
                     request.setAttribute("displayPerson", newEditPerson);
 
                 }
@@ -116,14 +113,14 @@
                 FileUploadHandler.handleFileStatus(request, response);
                 return null;
             } else {
-                if (method.equals("GET"))
-                // default to a read action
-                actionType = AT_READ_PARAMVALUE;
+                if (method.equals("GET")) // default to a read action
+                {
+                    actionType = AT_READ_PARAMVALUE;
+                }
             }
-        }
-        else {
-            ModelFacade modelFacade=(ModelFacade)context.getAttribute(MF_KEY);
-            UserBean userBean = (UserBean)request.getSession().getAttribute("userBean");
+        } else {
+            ModelFacade modelFacade = (ModelFacade) context.getAttribute(MF_KEY);
+            UserBean userBean = (UserBean) request.getSession().getAttribute("userBean");
             Person loggedInPerson = userBean.getLoggedInPerson();
             if (loggedInPerson == null) {
                 userBean.setDisplayMessage("Log in to manage invitations");
@@ -131,23 +128,23 @@
             }
             String requestorUsername = request.getParameter(USER_NAME_PARAM);
             String friendUsername = request.getParameter(FRIEND_PARAM);
-                
+
             if (actionType.equals(GET_FRIENDS)) {
-                Person p = getPerson (request);
+                Person p = getPerson(request);
                 if (p != null) {
                     out.write(p.getFriendsAsJson());
                 }
                 out.close();
                 return null;
             } else if (actionType.equals(GET_POSTED_EVENTS)) {
-                Person p = getPerson (request);
+                Person p = getPerson(request);
                 if (p != null) {
                     out.write(modelFacade.getPostedEventsAsJson(p));
                 }
                 out.close();
                 return null;
             } else if (actionType.equals(GET_ATTEND_EVENTS)) {
-                Person p = getPerson (request);
+                Person p = getPerson(request);
                 if (p != null) {
                     out.write(p.getAttendEventsAsJson());
                 }
@@ -158,8 +155,8 @@
                 //Person friend = getFriend(request);
                 //String requestorUsername = request.getParameter(USER_NAME_PARAM);
                 //String friendUsername = request.getParameter(FRIEND_PARAM);
-                Invitation inv = modelFacade.findInvitation(loggedInPerson.getUserName(), friendUsername);                
-                if (inv!=null){
+                Invitation inv = modelFacade.findInvitation(loggedInPerson.getUserName(), friendUsername);
+                if (inv != null) {
                     modelFacade.deleteInvitation(loggedInPerson, inv);
                 }
                 //update outgoing invitation list
@@ -171,36 +168,35 @@
                 out.close();
 
 
-            } else if (actionType.equals(APPROVE_FRIEND)) {                
+            } else if (actionType.equals(APPROVE_FRIEND)) {
                 Invitation acceptedInv = modelFacade.findInvitation(friendUsername, loggedInPerson.getUserName());
                 modelFacade.addFriend(loggedInPerson.getUserName(), friendUsername);
-                modelFacade.deleteInvitation(loggedInPerson,acceptedInv);
+                modelFacade.deleteInvitation(loggedInPerson, acceptedInv);
 
             } else if (actionType.equals(REJECT_INVITE)) {
                 //this is an incoming friendship request so the friend is the requestor
                 //Invitation revokedInv = modelFacade.findInvitation(friendUsername, loggedInPerson.getUserName());                
                 //let do this in memory
-                
-               // Invitation foundInv = null;
-               Collection <Invitation> invs = loggedInPerson.getIncomingInvitations();
-               Iterator<Invitation> invsIter = invs.iterator();
-               Invitation revokedInv = null;
-               while (invsIter.hasNext()){
-                   revokedInv = invsIter.next();
-                   //incoming
-                   if ((revokedInv.getRequestor().getUserName().equalsIgnoreCase(friendUsername)) 
-                           && (revokedInv.getCandidate().getUserName().equalsIgnoreCase(requestorUsername))){
-                       break;
-                   }
-               }
-               modelFacade.deleteInvitation(loggedInPerson, revokedInv);
+
+                // Invitation foundInv = null;
+                Collection<Invitation> invs = loggedInPerson.getIncomingInvitations();
+                Iterator<Invitation> invsIter = invs.iterator();
+                Invitation revokedInv = null;
+                while (invsIter.hasNext()) {
+                    revokedInv = invsIter.next();
+                    //incoming
+                    if ((revokedInv.getRequestor().getUserName().equalsIgnoreCase(friendUsername)) && (revokedInv.getCandidate().getUserName().equalsIgnoreCase(requestorUsername))) {
+                        break;
+                    }
+                }
+                modelFacade.deleteInvitation(loggedInPerson, revokedInv);
 
             }
         }
 
         response.setContentType("application/json;charset=UTF-8");
         response.setHeader("Cache-Control", "no-cache");
-        
+
         Person p = null;
         if (AT_CREATE_PARAMVALUE.equals(actionType)) {
             // this shouldn't be hit anymore because the person will be created by a fileupload
@@ -214,37 +210,35 @@
         } else if (AT_ADD_FRIEND.equals(actionType)) {
             p = addFriend(request);
         }
-        
+
         if (p != null) {
             out.write(p.toJson());
         }
         out.close();
         return null;
     }
-    
+
     /*
      * example url = http://localhost:8080/webapp/api/person?user_name=bob123
      **/
     private Person getPerson(HttpServletRequest request) {
         String userName = request.getParameter(USER_NAME_PARAM);
-        ModelFacade mf= (ModelFacade) context.getAttribute(MF_KEY);
+        ModelFacade mf = (ModelFacade) context.getAttribute(MF_KEY);
         Person person = mf.getPerson(userName);
         return person;
     }
-    
-    
+
     /*
      * example url = http://localhost:8080/webapp/api/person?user_name=bob123
      **/
     private Person getFriend(HttpServletRequest request) {
         String userName = request.getParameter(FRIEND_PARAM);
-        ModelFacade mf= (ModelFacade) context.getAttribute(MF_KEY);
+        ModelFacade mf = (ModelFacade) context.getAttribute(MF_KEY);
         Person person = mf.getPerson(userName);
-        System.out.println("inside getFriend - the friend's username is "+ person.getUserName());
+        logger.finer("inside getFriend - the friend's username is " + person.getUserName());
         return person;
     }
-    
-    
+
 //    private Person createUser(HttpServletRequest request, Hashtable<String, String> htUpload) {
     private Person createUser(HttpServletRequest request, Hashtable<String, String> htUpload, FileUploadHandler fuh) {
         String userName = htUpload.get(USER_NAME_PARAM);
@@ -252,39 +246,40 @@
         String firstName = htUpload.get(FIRST_NAME_PARAM);
         String lastName = htUpload.get(LAST_NAME_PARAM);
         String summary = htUpload.get(SUMMARY_PARAM);
-        String street1=htUpload.get(STREET1_PARAM);
-        String street2=htUpload.get(STREET2_PARAM);
-        String city=htUpload.get(CITY_PARAM);
-        String state=htUpload.get(STATE_PARAM);
-        String country=htUpload.get(COUNTRY_PARAM);
-        String zip=htUpload.get(ZIP_PARAM);
-        String timezone=htUpload.get(TIMEZONE_PARAM);
-        String telephone=htUpload.get(TELEPHONE_PARAM);
-        String email=htUpload.get(EMAIL_PARAM);
-        Address address=WebappUtil.handleAddress(context, street1, street2, city, state, zip, country);
-         
+        String street1 = htUpload.get(STREET1_PARAM);
+        String street2 = htUpload.get(STREET2_PARAM);
+        String city = htUpload.get(CITY_PARAM);
+        String state = htUpload.get(STATE_PARAM);
+        String country = htUpload.get(COUNTRY_PARAM);
+        String zip = htUpload.get(ZIP_PARAM);
+        String timezone = htUpload.get(TIMEZONE_PARAM);
+        String telephone = htUpload.get(TELEPHONE_PARAM);
+        String email = htUpload.get(EMAIL_PARAM);
+        Address address = WebappUtil.handleAddress(context, street1, street2, city, state, zip, country);
+
         // get image from fileupload
-        String imageURL=htUpload.get(UPLOAD_PERSON_IMAGE_PARAM);
+        String imageURL = htUpload.get(UPLOAD_PERSON_IMAGE_PARAM);
         String thumbImage;
         thumbImage = htUpload.get(UPLOAD_PERSON_IMAGE_THUMBNAIL_PARAM);
-        if (thumbImage == null)
+        if (thumbImage == null) {
             thumbImage = "";
-        
-        if(bDebug) System.out.println("************** data entered is*** " + "user_name*" + userName +
+        }
+
+        logger.finer("************** data entered is*** " + "user_name*" + userName +
                 " password=" + password +
                 " first_name=*" + firstName +
                 " last_name" + lastName +
                 " summary" + summary);
-        
+
         Person person = new Person(userName, password, firstName, lastName, summary, email, telephone, imageURL, thumbImage, timezone, address);
-        ModelFacade mf= (ModelFacade) context.getAttribute(MF_KEY);
+        ModelFacade mf = (ModelFacade) context.getAttribute(MF_KEY);
         //do not really need username since you set this value, not sure why it is returned
         //String userName = mf.addPerson(person, userSignOn);
         //changed above line to this since username already a variable name
         //userName = mf.addPerson(person, userSignOn);
-        
-        userName = mf.addPerson(person);        
-        WebappUtil.getLogger().log(Level.FINE, "Person " + userName + " has been persisted");
+
+        userName = mf.addPerson(person);
+        logger.log(Level.FINER, "Person " + userName + " has been persisted");
         // retrieve again ???
         //person=mf.getPerson(userName);
         // login person
@@ -292,59 +287,61 @@
         return person;
     }
 
-    
-     private Person updateUser(HttpServletRequest request, Hashtable<String, String> htUpload, FileUploadHandler fuh) {
+    private Person updateUser(HttpServletRequest request, Hashtable<String, String> htUpload, FileUploadHandler fuh) {
         String userName = htUpload.get(USER_NAME_PARAM);
         String password = htUpload.get(PASSWORD_PARAM);
         String firstName = htUpload.get(FIRST_NAME_PARAM);
         String lastName = htUpload.get(LAST_NAME_PARAM);
         String summary = htUpload.get(SUMMARY_PARAM);
-        String street1=htUpload.get(STREET1_PARAM);
-        String street2=htUpload.get(STREET2_PARAM);
-        String city=htUpload.get(CITY_PARAM);
-        String state=htUpload.get(STATE_PARAM);
-        String country=htUpload.get(COUNTRY_PARAM);
-        String zip=htUpload.get(ZIP_PARAM);
-        String timezone=htUpload.get(TIMEZONE_PARAM);
-        String telephone=htUpload.get(TELEPHONE_PARAM);
-        String email=htUpload.get(EMAIL_PARAM);
-        Address address=WebappUtil.handleAddress(context, street1, street2, city, state, zip, country);
+        String street1 = htUpload.get(STREET1_PARAM);
+        String street2 = htUpload.get(STREET2_PARAM);
+        String city = htUpload.get(CITY_PARAM);
+        String state = htUpload.get(STATE_PARAM);
+        String country = htUpload.get(COUNTRY_PARAM);
+        String zip = htUpload.get(ZIP_PARAM);
+        String timezone = htUpload.get(TIMEZONE_PARAM);
+        String telephone = htUpload.get(TELEPHONE_PARAM);
+        String email = htUpload.get(EMAIL_PARAM);
+        Address address = WebappUtil.handleAddress(context, street1, street2, city, state, zip, country);
 
         // get image from fileupload
-        String imageURL=htUpload.get(UPLOAD_PERSON_IMAGE_PARAM);
+        String imageURL = htUpload.get(UPLOAD_PERSON_IMAGE_PARAM);
         String thumbImage;
         thumbImage = htUpload.get(UPLOAD_PERSON_IMAGE_THUMBNAIL_PARAM);
-        
+
         //if these fields are null, then reuse the old file information stored
-        
+
         //Person loggedInPerson = this.getPerson(request);
-        ModelFacade mf= (ModelFacade) context.getAttribute(MF_KEY);
+        ModelFacade mf = (ModelFacade) context.getAttribute(MF_KEY);
         Person loggedInPerson = mf.getPerson(userName);
-        
-        if (thumbImage == null)thumbImage = loggedInPerson.getImageThumbURL();
-        if (imageURL == null) imageURL = loggedInPerson.getImageURL();
-        
-        
-        if(bDebug) System.out.println("************** data entered is*** " + "user_name*" + userName +
+
+        if (thumbImage == null) {
+            thumbImage = loggedInPerson.getImageThumbURL();
+        }
+        if (imageURL == null) {
+            imageURL = loggedInPerson.getImageURL();
+        }
+
+
+        logger.finer("************** data entered is*** " + "user_name*" + userName +
                 " password=" + password +
                 " first_name=*" + firstName +
                 " last_name" + lastName +
                 " summary" + summary);
-        
+
         Person person = new Person(userName, password, firstName, lastName, summary, email, telephone, imageURL, thumbImage, timezone, address);
         //ModelFacade mf= (ModelFacade) context.getAttribute(MF_KEY);
         //do not really need username since you set this value, not sure why it is returned
         //String userName = mf.addPerson(person, userSignOn);
         //changed above line to this since username already a variable name
         //userName = mf.addPerson(person, userSignOn);
-        
+
         person = mf.updatePerson(person);
-        WebappUtil.getLogger().log(Level.FINE, "Person " + userName + " has been updated");
-                
+        logger.log(Level.FINER, "Person " + userName + " has been updated");
+
         return person;
     }
-    
-    
+
     // should need this method anymore, we should only create person from multi-part mime form now
     private Person createUser(HttpServletRequest request) {
         String userName = request.getParameter(USER_NAME_PARAM);
@@ -352,32 +349,32 @@
         String firstName = request.getParameter(FIRST_NAME_PARAM);
         String lastName = request.getParameter(LAST_NAME_PARAM);
         String summary = request.getParameter(SUMMARY_PARAM);
-        String email="";
-        String telephone="";
-        String imageURL="";
-        String imageThumbURL="";
-        String timezone="";
-        Address address=new Address();
-        
-        if(bDebug) System.out.println("************** data entered is*** " + "user_name*" + userName +
+        String email = "";
+        String telephone = "";
+        String imageURL = "";
+        String imageThumbURL = "";
+        String timezone = "";
+        Address address = new Address();
+
+        logger.finer("************** data entered is*** " + "user_name*" + userName +
                 " password=" + password +
                 " first_name=*" + firstName +
                 " last_name" + lastName +
                 " summary" + summary);
-        
+
         Person person = new Person(userName, password, firstName, lastName, summary, email, telephone, imageURL, imageThumbURL, timezone, address);
-        
-        ModelFacade mf= (ModelFacade) context.getAttribute(MF_KEY);
-        
+
+        ModelFacade mf = (ModelFacade) context.getAttribute(MF_KEY);
+
         //do not really need username since you set this value, not sure why it is returned
         //String userName = mf.addPerson(person, userSignOn);
         //changed above line to this since username already a variable name
         //userName = mf.addPerson(person, userSignOn);
         userName = mf.addPerson(person);
-        WebappUtil.getLogger().log(Level.FINE, "Person " + userName + " has been persisted");
+        logger.log(Level.FINER, "Person " + userName + " has been persisted");
         return mf.getPerson(userName);
     }
-    
+
     private Person updateUser(HttpServletRequest request) {
         //String personId = request.getParameter(PERSON_ID_PARAM);
         String userName = request.getParameter(USER_NAME_PARAM);
@@ -385,53 +382,53 @@
         String firstName = request.getParameter(FIRST_NAME_PARAM);
         String lastName = request.getParameter(LAST_NAME_PARAM);
         String summary = request.getParameter(SUMMARY_PARAM);
-        String email="";
-        String telephone="";
-        String imageURL="";
-        String imageThumbURL="";
-        String timezone="";
-        Address address=new Address();
-        
+        String email = "";
+        String telephone = "";
+        String imageURL = "";
+        String imageThumbURL = "";
+        String timezone = "";
+        Address address = new Address();
+
         Person person = new Person(userName, password, firstName, lastName, summary, email, telephone, imageURL, imageThumbURL, timezone, address);
-        
-        ModelFacade mf= (ModelFacade) context.getAttribute(MF_KEY);
+
+        ModelFacade mf = (ModelFacade) context.getAttribute(MF_KEY);
         person = mf.updatePerson(person);
-        
-        WebappUtil.getLogger().log(Level.FINE, "Person " + userName + " has been updated");
+
+        logger.log(Level.FINER, "Person " + userName + " has been updated");
         return person;
     }
-    
+
     private void deleteUser(HttpServletRequest request) {
         //String personId = request.getParameter(PERSON_ID_PARAM);
         String userName = request.getParameter(USER_NAME_PARAM);
-        ModelFacade mf= (ModelFacade) context.getAttribute(MF_KEY);
+        ModelFacade mf = (ModelFacade) context.getAttribute(MF_KEY);
         mf.deletePerson(userName);
-        WebappUtil.getLogger().log(Level.FINE, "Person " + userName + " has been deleted");
+        logger.log(Level.FINER, "Person " + userName + " has been deleted");
     }
-    
+
     /*
      * example url = http://localhost:8080/webapp/api/person?actionType=add_friend&user_name=bob123&friend_user_name=sue
      */
     private Person addFriend(HttpServletRequest request) {
         String userName = request.getParameter(USER_NAME_PARAM);
         String friendUserName = request.getParameter(FRIEND_USER_NAME_PARAM);
-        
-        if(bDebug) System.out.println("***** PERSON-REST-ACTION:addFriend: " + USER_NAME_PARAM + "=" + userName +
+
+        logger.finer("***** PERSON-REST-ACTION:addFriend: " + USER_NAME_PARAM + "=" + userName +
                 " and " + FRIEND_USER_NAME_PARAM + "=" + friendUserName);
-        
-        ModelFacade mf= (ModelFacade) context.getAttribute(MF_KEY);
+
+        ModelFacade mf = (ModelFacade) context.getAttribute(MF_KEY);
         Person person = mf.addFriend(userName, friendUserName);
-        
-        WebappUtil.getLogger().log(Level.FINE, "Person " + userName + " has been updated to add friend=" + friendUserName);
+
+        logger.log(Level.FINER, "Person " + userName + " has been updated to add friend=" + friendUserName);
         return person;
     }
 
-     private static String OutgoingInvitationsAsJson (Person loggedInPerson, String status) {
-        StringBuilder sb=new StringBuilder("{ \"result\": {\"status\":");
+    private static String OutgoingInvitationsAsJson(Person loggedInPerson, String status) {
+        StringBuilder sb = new StringBuilder("{ \"result\": {\"status\":");
         sb.append("\"" + status + "\"");
-        sb.append (", \"outgoingInvitations\":[");
+        sb.append(", \"outgoingInvitations\":[");
         if (loggedInPerson != null) {
-            for(Invitation inv : loggedInPerson.getOutgoingInvitations()) {
+            for (Invitation inv : loggedInPerson.getOutgoingInvitations()) {
                 sb.append("{\"username\":\"");
                 sb.append(WebappUtil.encodeJSONString(inv.getCandidate().getUserName()));
                 sb.append(COMMA);
@@ -444,14 +441,13 @@
                 sb.append(DOUBLE_QUOTE);
                 sb.append("\"}, ");
             }
-            if(loggedInPerson.getOutgoingInvitations().size() > 0) {
-                sb.deleteCharAt(sb.length()-1);
-                sb.deleteCharAt(sb.length()-1);
+            if (loggedInPerson.getOutgoingInvitations().size() > 0) {
+                sb.deleteCharAt(sb.length() - 1);
+                sb.deleteCharAt(sb.length() - 1);
             }
         }
 
         sb.append("] } }");
         return sb.toString();
     }
-    
 }

Modified: incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/rest/UsersResource.java
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/rest/UsersResource.java?rev=822866&r1=822865&r2=822866&view=diff
==============================================================================
--- incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/rest/UsersResource.java (original)
+++ incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/rest/UsersResource.java Wed Oct  7 19:32:59 2009
@@ -51,7 +51,7 @@
 
 import java.util.HashMap;
 import java.util.StringTokenizer;
-
+import java.util.logging.Logger;
 
 
 /**
@@ -89,6 +89,8 @@
 
   private static final String FILE_LOCATION = "image_location";
   private static final String THUMBNAIL_LOCATION = "thumbnail_location";
+  private Logger logger = Logger.getLogger(UsersResource.class.getName());
+
     public UsersResource() {
                  
     }
@@ -102,7 +104,7 @@
   @Produces("application/json")
     //public JSONObject getUser(@PathParam("userid") String userid) throws JSONException, Exception {
        public JSONArray getUsers() throws JSONException, Exception {
-      System.out.println(" get USERs is here !");
+      logger.finer(" get USERs is here !");
       mf = (ModelFacade)getServletContext().getAttribute(WebConstants.MF_KEY);
       List<Person> allUsers = mf.getAllPersons();
        JSONArray uriArray = new JSONArray();
@@ -171,7 +173,7 @@
 
          Map<String,FormDataBodyPart> bodyList =multiPart.getFields();
          for (String key:bodyList.keySet()){
-             System.out.println("key is "+ key);
+             logger.finer("key is "+ key);
          }
          //if(multiPart.getField("first_name")!=null) firstName = multiPart.getField("first_name").getValue();
          userName = getFieldValue(multiPart, USERNAME, true);
@@ -185,7 +187,7 @@
          summary = getFieldValue(multiPart, SUMMARY, false);
          telephone = getFieldValue(multiPart,TELEPHONE, false);
          email = getFieldValue(multiPart, EMAIL, false);
-         System.out.println("in POST - multipart first name is "+ firstName);
+         logger.finer("in POST - multipart first name is "+ firstName);
 
          //address
          street1 = getFieldValue(multiPart, STREET1, false);
@@ -200,7 +202,7 @@
          //image processing
          if(multiPart.getField("imagefile")!=null){
             bpe = ((BodyPartEntity) multiPart.getField("imagefile").getEntity());
-            System.out.println("the value of the imageFile body part is "+ multiPart.getField("imagefile").getHeaders());
+            logger.finer("the value of the imageFile body part is "+ multiPart.getField("imagefile").getHeaders());
             mvMap = multiPart.getField("imagefile").getHeaders();
             headerList  =  (List)mvMap.get("Content-Disposition");
             contentHeader = headerList.get(0);
@@ -234,7 +236,7 @@
             userName = mf.addPerson(person);
          else
             mf.updatePerson(person);
-         System.out.println("after adding/updating person " + userName);
+         logger.finer("after adding/updating person " + userName);
 
          //cleanup
          imageStream.close();
@@ -259,10 +261,10 @@
             String ext=null;
 
              ext = WebappUtil.getFileExtension(filename);
-            System.out.println(" ext is "+ ext);
+            logger.finer(" ext is "+ ext);
             WebappUtil.setArtifactPath();
             String serverLocationDir = WebappUtil.getArtifactLocalionDir();
-            System.out.println("serverLocationDir is "+ serverLocationDir);
+            logger.finer("serverLocationDir is "+ serverLocationDir);
             
             fileName = "p" + userName;
                 thumbnailName = fileName + "_thumb" + ext;

Modified: incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/util/CacheControlFilter.java
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/util/CacheControlFilter.java?rev=822866&r1=822865&r2=822866&view=diff
==============================================================================
--- incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/util/CacheControlFilter.java (original)
+++ incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/util/CacheControlFilter.java Wed Oct  7 19:32:59 2009
@@ -15,7 +15,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.olio.webapp.util;
 
 import java.io.File;
@@ -47,23 +46,23 @@
  * By default, the filter is not enabled. 
  */
 public class CacheControlFilter implements Filter {
+
     private FilterConfig config;
     private Map<String, String> mimeMap = new HashMap<String, String>();
     boolean isWildCardSpecified = false;
-    
-    private boolean cacheEnabled = true; // Provide a System property based over ride mechanism 
-    
+    private boolean cacheEnabled = true; // Provide a System property based over ride mechanism
+    Logger logger = Logger.getLogger(CacheControlFilter.class.getName());
+
     public void init(FilterConfig config) throws ServletException {
         this.config = config;
         // Populate the map. 
         configureCache();
-        
+
         if (!cacheEnabled) {
-            System.out.println ("static content caching is disabled");
+            logger.info("static content caching is disabled");
             return;
-        }
-        else {
-            System.out.println ("static content caching is enabled");
+        } else {
+            logger.info("static content caching is enabled");
         }
     }
 
@@ -80,7 +79,7 @@
                 if (isWildCardSpecified) {
                     int index = mimeType.indexOf("/");
                     if (index != -1) {
-                        String mime = mimeType.substring(0, index+1);
+                        String mime = mimeType.substring(0, index + 1);
                         if (mimeMap.containsKey(mime)) {
                             hres.addHeader("Cache-Control", mimeMap.get(mime));
                             found = true;
@@ -92,11 +91,10 @@
                 }
             }
         }
-        chain.doFilter(request, response);      
+        chain.doFilter(request, response);
     }
 
     public void destroy() {
-        
     }
 
     private void configureCache() {
@@ -105,11 +103,12 @@
         // 2. If caching is enabled, check the file specified by the System property first
         //    This is an over ride mechanism that allows the deployer to modify the behavior
         // 3. Default behavior is taken from the Filter init params (web.xml)
-        
+
         cacheEnabled = !Boolean.getBoolean("disableStaticContentCaching");
-        if (!cacheEnabled) 
+        if (!cacheEnabled) {
             return;
-        
+        }
+
         // Overwrite the default if specified
         String str = System.getProperty("staticContentCachingConfigurationFile");
         if (str != null && new File(str).exists()) {
@@ -119,46 +118,47 @@
                     Properties props = new Properties();
                     props.load(is);
                     is.close();
-                    
+
                     // Parse the properties
                     Set<String> keys = props.stringPropertyNames();
                     Iterator<String> iter = keys.iterator();
                     while (iter.hasNext()) {
                         String key = iter.next();
-                        processMimeType (key, props.getProperty(key));
+                        processMimeType(key, props.getProperty(key));
                     }
                     return;
                 }
-            }
-            catch (IOException ex) {
+            } catch (IOException ex) {
                 Logger.getLogger(CacheControlFilter.class.getName()).log(Level.SEVERE, null, ex);
             }
-        }
-        else {
+        } else {
             Enumeration<String> emimes = config.getInitParameterNames();
             while (emimes.hasMoreElements()) {
                 String mime = emimes.nextElement();
                 String value = config.getInitParameter(mime);
-                processMimeType (mime, value);
+                processMimeType(mime, value);
             }
-        } 
+        }
     }
 
     private void processMimeType(String mime, String value) {
-        if (value == null)
+        if (value == null) {
             return;
-        
+        }
+
         int index = mime.indexOf("/");
-        if (index == -1 || mime.length() < 3)  // Incorrect mime specification
+        if (index == -1 || mime.length() < 3) // Incorrect mime specification
+        {
             return;
-        
+        }
+
         // Check for wild cards
-        if (mime.charAt(mime.length()-1) == '*') {
-            String wcard = mime.substring(0, index+1);
+        if (mime.charAt(mime.length() - 1) == '*') {
+            String wcard = mime.substring(0, index + 1);
             mimeMap.put(wcard, value);
             isWildCardSpecified = true;
-        }
-        else
+        } else {
             mimeMap.put(mime, value);
+        }
     }
 }

Modified: incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/util/ContentCachingFilter.java
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/util/ContentCachingFilter.java?rev=822866&r1=822865&r2=822866&view=diff
==============================================================================
--- incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/util/ContentCachingFilter.java (original)
+++ incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/util/ContentCachingFilter.java Wed Oct  7 19:32:59 2009
@@ -15,8 +15,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
- 
-
 package org.apache.olio.webapp.util;
 
 import org.apache.olio.webapp.cache.Cache;
@@ -25,6 +23,7 @@
 import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.util.HashMap;
+import java.util.logging.Logger;
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
@@ -43,12 +42,14 @@
  * @author Binu John
  */
 public class ContentCachingFilter implements Filter {
+
     private Cache cache; // For caching static content
     private FilterConfig fConfig;
     private long nextRefresh;
     private static final int CACHE_LOOP_TIME = 10 * 1000; // 10 seconds
     private static final int CACHE_CHECK_INTERVAL = 100; // in millisecs
-    
+    private Logger logger = Logger.getLogger(ContentCachingFilter.class.getName());
+
     /** Creates a new instance of ContentCachingFilter */
     public ContentCachingFilter() {
     }
@@ -63,73 +64,69 @@
         HttpServletRequest hReq = (HttpServletRequest) request;
         String path = hReq.getRequestURI();
         String cPath = hReq.getContextPath();
-        
+
         // We will pass along the content to the Filter chain if other filter nood to do
         // something about it. The flush is carried out here since JSPs can only
         // ouput char[] or String. Writing as byte[] allows us to eliminate the 
         // char decoding expense.
-        
+
         // The following pages are going to be cached - index.jsp, home_content.jsp. Teh rest are ignored.
-        if (path.equals(cPath + "/index.jsp") || path.equals (cPath + "/")) {
+        if (path.equals(cPath + "/index.jsp") || path.equals(cPath + "/")) {
             HttpSession session = hReq.getSession(false);
             if (session == null || session.getAttribute("LoggedInPerson") == null) {
                 String cacheKey = "home";
                 Object obj = getContent(cacheKey, path, request, response, chain);
-                
+
                 if (obj != null) {
                     // Write the content and return. 
                     // Important to note that this will eliminate calling
                     // other filters if any are present.
                     // Ok since we don't have any other filters.
-                    
+
                     if (obj instanceof byte[]) {
                         byte[] content = (byte[]) obj;
                         OutputStream out = response.getOutputStream();
                         out.write(content);
                         out.flush();
-                    }
-                    else {
+                    } else {
                         char[] content = (char[]) obj;
                         PrintWriter out = response.getWriter();
                         out.print(content);
                         out.flush();
                     }
-                    
+
                     return;
-                }
-                else
+                } else {
                     chain.doFilter(request, response);
-            }
-            else { // USer is logged in
+                }
+            } else { // USer is logged in
                 // Try to get the home_content from the cache
                 String cacheKey = "home_partial";
-                //System.out.println ("User logged in - using the home_content.jsp cache ");
+                //logger.finer ("User logged in - using the home_content.jsp cache ");
                 path = "/home_content.jsp";
                 Object content = getContent(cacheKey, path, request, response, chain);
                 HashMap<String, Object> contentMap = new HashMap<String, Object>();
-                contentMap.put (path, content);
+                contentMap.put(path, content);
                 request.setAttribute("contentMap", contentMap);
                 chain.doFilter(request, response);
                 request.removeAttribute("contentMap");
             }
-        }
-        else {        
+        } else {
             chain.doFilter(request, response);
         }
     }
-    
+
     /**
-     The caching works as follows -
-     1. Try to get the content from the cache
-     2. If the content is null, no one has populated the cache. 
-         We will try to acquire the lock to update the cache.
-     3a. If we are successful in acquiring the lock, we will populate the cache and release the lock
-     3b. If we are not successful in populating the cache, 
-          that means that someone else has acquired the lock. We will wait in a loop
-          for a while to get the content or acquire the lock
-     4. If we are unable to get a repsonse from the cache within a certain threashold, regenrate the data. 
+    The caching works as follows -
+    1. Try to get the content from the cache
+    2. If the content is null, no one has populated the cache.
+    We will try to acquire the lock to update the cache.
+    3a. If we are successful in acquiring the lock, we will populate the cache and release the lock
+    3b. If we are not successful in populating the cache,
+    that means that someone else has acquired the lock. We will wait in a loop
+    for a while to get the content or acquire the lock
+    4. If we are unable to get a repsonse from the cache within a certain threashold, regenrate the data.
      **/
-    
     /**
      * 
      * @param key
@@ -142,42 +139,41 @@
      * @throws java.io.IOException
      * @throws javax.servlet.ServletException
      */
-    private Object getContent (String key, String path, ServletRequest request, 
+    private Object getContent(String key, String path, ServletRequest request,
             ServletResponse response, FilterChain chain) throws IOException, ServletException {
-        return getContent (key, path, request, response, chain, true);
+        return getContent(key, path, request, response, chain, true);
     }
-    
-    private Object getContent (String key, String path, ServletRequest request, 
+
+    private Object getContent(String key, String path, ServletRequest request,
             ServletResponse response, FilterChain chain, boolean asBytes) throws IOException, ServletException {
         // First get the page from cache
         Object obj = cache.get(key);
-        
+
         char[] content = null;
         Object retObj = null;
-        
+
         if (obj != null) {
             // The page is cached. But does it need a refresh?
             if (cache.needsRefresh(true, key)) {
                 // We own the lock, so we need to refresh it
-                String str = acquirePageContent (path, request, response, chain);
+                String str = acquirePageContent(path, request, response, chain);
                 if (str != null) {
                     if (!asBytes) {
                         content = new char[str.length()];
                         str.getChars(0, str.length(), content, 0);
                         retObj = content;
-                    }
-                    else
+                    } else {
                         retObj = str.getBytes();
-                    
+                    }
+
                     cache.put(key, retObj, CacheFactory.getInstance().getCacheExpireInSeconds());
                     // Release the lock
-                    cache.doneRefresh(key, CacheFactory.getInstance().getCacheExpireInSeconds());               
+                    cache.doneRefresh(key, CacheFactory.getInstance().getCacheExpireInSeconds());
                     return retObj;
                 }
             }
             return obj;
-        }
-        else {
+        } else {
             // No one has populated the cache.
             // Do the following in a loop
             // 1. Try to acquire the lock
@@ -188,72 +184,71 @@
             long start = System.currentTimeMillis();
             int attemptCount = 1;
             while (true) {
-                System.out.println ("needsRefreshAttempt = " + attemptCount++);
+                logger.finer("needsRefreshAttempt = " + attemptCount++);
                 if (cache.needsRefresh(false, key)) {
                     // We have the lock, refresh the content
-                    String str = acquirePageContent (path, request, response, chain);
+                    String str = acquirePageContent(path, request, response, chain);
                     if (str != null) {
                         if (!asBytes) {
                             content = new char[str.length()];
                             str.getChars(0, str.length(), content, 0);
                             retObj = content;
-                        }
-                        else
+                        } else {
                             retObj = str.getBytes();
-                        
+                        }
+
                         cache.put(key, retObj);
-                        
+
                         // Release the lock
                         cache.doneRefresh(key, CacheFactory.getInstance().getCacheExpireInSeconds());
-                        //System.out.println ("Acquired lock and put Content in cache - path = " + path);
+                    //logger.finer ("Acquired lock and put Content in cache - path = " + path);
                     }
                     return retObj;
-                }
-                else {
+                } else {
                     // Someone else has the lock. Sleep for a while and then try again
                     try {
                         Thread.sleep(CACHE_CHECK_INTERVAL);
+                    } catch (InterruptedException e) {
                     }
-                    catch (InterruptedException e) {}
                     retObj = cache.get(key);
-                    if (retObj != null)
+                    if (retObj != null) {
                         return retObj;
-                    
+                    }
+
                     if ((System.currentTimeMillis() - start) > CACHE_LOOP_TIME) {
-                        System.out.println ("Tries too many times to refresh giving up");
+                        logger.info("Tries too many times to refresh - giving up");
                         break;
                     }
                 }
             }
             // We could not get the content from the cache within the specified time.
             // Regenerate
-            //System.out.println ("Timeed out in getting content from cache - path = " + path);
-            String str = acquirePageContent (path, request, response, chain);
+            //logger.finer ("Timed out in getting content from cache - path = " + path);
+            String str = acquirePageContent(path, request, response, chain);
             if (str != null) {
                 if (!asBytes) {
                     content = new char[str.length()];
                     str.getChars(0, str.length(), content, 0);
                     retObj = content;
-                }
-                else
+                } else {
                     retObj = str.getBytes();
+                }
             }
             return content;
         }
     }
-    
-    private String acquirePageContent (String path, ServletRequest request, 
+
+    private String acquirePageContent(String path, ServletRequest request,
             ServletResponse response, FilterChain chain) throws IOException, ServletException {
-        ContentCacheResponseWrapper wrapper = new ContentCacheResponseWrapper (
-                                (HttpServletResponse)response);
+        ContentCacheResponseWrapper wrapper = new ContentCacheResponseWrapper(
+                (HttpServletResponse) response);
         if (path.equals("/home_content.jsp")) {
             // This is a special case of inclusion
             fConfig.getServletContext().getRequestDispatcher(path).include(request, wrapper);
-        }
-        else {
+        } else {
             chain.doFilter(request, wrapper);
         }
-        //System.out.println ("acquirePageContent called - path = " + path);
+        //logger.finer ("acquirePageContent called - path = " + path);
         return new String(wrapper.getData());
     }
 

Modified: incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/util/GeoCoder.java
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/util/GeoCoder.java?rev=822866&r1=822865&r2=822866&view=diff
==============================================================================
--- incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/util/GeoCoder.java (original)
+++ incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/util/GeoCoder.java Wed Oct  7 19:32:59 2009
@@ -44,14 +44,16 @@
 public class GeoCoder {
     
     private String applicationId = APPLICATION_ID;
-    private Logger logger = WebappUtil.getLogger();
+    //private Logger logger = WebappUtil.getLogger();
+    private static Logger logger = Logger.getLogger(GeoCoder.class.getName());
+
     private String proxyHost = null;
     private int proxyPort = 0;
     private boolean proxySet = false;
     
     //private static DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
     private static JAXBContext jaxbContext;
-    
+
     /**
      * <p>The URL of the geocoding service we will be using.</p>
      */
@@ -62,7 +64,7 @@
         SERVICE_URL = System.getProperty("webapp.geocoderURL");
         if (SERVICE_URL == null)
             SERVICE_URL = ServiceLocator.getInstance().getString("geocoderURL");
-        System.out.println ("geocoder ServiceURL = " + SERVICE_URL);
+        logger.finer ("geocoder ServiceURL = " + SERVICE_URL);
         // Fall back to default
         if (SERVICE_URL == null)
             SERVICE_URL = "http://localhost:8000/Web20Emulator/geocode";



Mime
View raw message