Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.mortbay.hightide.example.auction.service;
 
 import java.util.Map;
 
 import  org.mortbay.cometd.BayeuxService;
public class BidService extends BayeuxService
    
    public BidService(Bayeux bayeuxAuctionManager auctionManager)
    {
        super(bayeux"bid");
         = auctionManager;
        subscribe("/service/auction/items/id/bids/new""addBid");
        subscribe("/service/auction/items/id/bids/highest""getHighestBid");
    }    
    
    public void addBid(Client sourceString channelMap<StringObjectdata
            String messageId)
    {
        Integer itemId = new Integer(((Number)data.get("itemId")).intValue());
        Double bidAmount = new Double(data.get("bidAmount").toString());
        String username = (String)data.get("username");
        
        Map<String,Objectresponse = new HashMap<String,Object>();
        response.put("handlerId"data.get("handlerId"));
        try
        {
            response.put("bid".addBid(itemIdbidAmountusername));
        }
        catch(Exception e)
        {
            response.put("errorMsg"e.getMessage());
        }
        source.deliver(getClient(), channelresponsenull);
    }
    
    public void getHighestBid(Client sourceString channelMap<StringObjectdata
            String messageId)
    {
        Integer itemId = new Integer(((Number)data.get("itemId")).intValue());
        
        Map<String,Objectresponse = new HashMap<String,Object>();
        response.put("handlerId"data.get("handlerId"));
        try
        {
            response.put("bid".getHighestBid(itemId));
        }
        catch(Exception e)
        {
            response.put("errorMsg"e.getMessage());
        }
        source.deliver(getClient(), channelresponsenull);
    }
    
New to GrepCode? Check out our FAQ X