User: jules_gosnell
Date: 02/01/03 12:51:05
Added: jetty/src/main/org/jboss/jetty/ejb
CoarseHttpSessionBean.java
Log:
Infrastructure for the first cut of distributed HttpSessions - including
changes to Jetty. NB - implementation to follow....
Revision Changes Path
1.1
contrib/jetty/src/main/org/jboss/jetty/ejb/CoarseHttpSessionBean.java
Index: CoarseHttpSessionBean.java
===================================================================
package org.jboss.jetty.ejb;
import java.util.Map;
import java.util.Collection;
import java.util.Iterator;
import javax.ejb.CreateException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;
import org.apache.log4j.Category;
import org.jboss.jetty.interfaces.CoarseHttpSession;
/**
* The Entity bean represents an HttpSession.
*
* @author [EMAIL PROTECTED]
* @version $Revision: 1.1 $
*
* @ejb:bean name="jetty/CoarseHttpSession" type="CMP"
jndi-name="ejb/jetty/CoarseHttpSession" primkey-field="id"
* @ejb:pk class="java.lang.Integer"
*
* @jboss:table-name "Jetty_CoarseHttpSession"
* @jboss:create-table "true"
* @jboss:remove-table "true"
* @jboss:tuned-updates "true"
* @jboss:read-only "false"
**/
public abstract class CoarseHttpSessionBean
implements EntityBean
{
Category _log=Category.getInstance(getClass().getName());
//----------------------------------------
// Home
//----------------------------------------
// /**
// * Transfer money
// *
// * @ejb:home-method
// */
// public void ejbHomeTransfer(HttpSession from, HttpSession to, float amount)
// {
// try
// {
// from.withdraw(amount);
// to.deposit(amount);
// } catch (java.rmi.RemoteException e)
// {
// throw new EJBException(e);
// }
// }
//----------------------------------------
// Lifecycle
//----------------------------------------
/**
* Create httpSession.
*
* @ejb:create-method
* @ejb:permission role-name="Administrator"
*/
public Integer ejbCreate(Integer id)
throws CreateException
{
_log.info("ejbCreate("+id+")");
setId(id);
return null;
}
/**
* Create httpSession.
*
*/
public void ejbPostCreate(Integer id)
throws CreateException
{
_log.info("ejbPostCreate("+id+")");
}
public void
setEntityContext(EntityContext ctx)
{
// _log.info("setEntityContext("+ctx+")");
}
public void
ejbLoad()
{
_log.info("ejbLoad()");
}
public void
ejbActivate()
{
_log.info("ejbActivate()");
}
public void
ejbPassivate()
{
_log.info("ejbPassivate()");
}
public void
ejbStore()
{
_log.info("ejbStore()");
}
public void
unsetEntityContext()
{
// _log.info("unsetEntityContext()");
}
/**
* @ejb:transaction type="Mandatory"
*/
public void
ejbRemove()
throws RemoveException
{
_log.info("ejbRemove("+getId()+")");
}
//----------------------------------------
// Accessors
//----------------------------------------
// Id
/**
* @ejb:pk-field
* @ejb:persistent-field
*
* @jboss:column-name "pk"
*/
public abstract Integer getId();
/**
* @ejb:pk-field
* @ejb:persistent-field
*
* @jboss:column-name "pk"
*/
public abstract void setId(Integer id);
//----------------------------------------
// Attributes
/**
* @ejb:interface-method
* @ejb:persistent-field
* @ejb:transaction type="Supports"
*/
public abstract Map getAttributes();
/**
* @ejb:interface-method
* @ejb:persistent-field
* @ejb:transaction type="Supports"
*/
public abstract void setAttributes(Map attributes);
/**
* @ejb:interface-method
* @ejb:transaction type="Supports"
*/
public void
addAttribute(Object key, Object value)
{
Map attrs=getAttributes();
attrs.put(key, value);
setAttributes(attrs);
}
/**
* @ejb:interface-method
* @ejb:transaction type="Supports"
*/
public void
addAttributes(Map attributes)
{
Map attrs=getAttributes();
attrs.putAll(attributes);
setAttributes(attrs);
}
/**
* @ejb:interface-method
* @ejb:transaction type="Supports"
*/
public void
removeAttribute(Object key)
{
Map attrs=getAttributes();
attrs.remove(key);
setAttributes(attrs);
}
/**
* @ejb:interface-method
* @ejb:transaction type="Supports"
*/
public void
removeAttributes(Collection keys)
{
Map attrs=getAttributes();
Iterator i=keys.iterator();
while (i.hasNext())
attrs.remove(i.next());
setAttributes(attrs);
}
// /**
// * Generated bulk accessor.
// *
// * Not remote, but could be.
// *
// */
// public abstract void setData(HttpSessionData data);
//
// /**
// * Generated bulk accessor.
// *
// * This is set as remote to allow clients to
// * get all data in one call.
// *
// * @ejb:interface-method
// * @ejb:permission role-name="Administrator"
// * @ejb:transaction type="Supports"
// */
// public abstract HttpSessionData getData();
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development