JEntityContext.java

00001 /*
00002  * JOnAS: Java(TM) Open Application Server
00003  * Copyright (C) 1999 Bull S.A.
00004  * Contact: jonas-team@objectweb.org
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00019  * USA
00020  *
00021  * Initial developer(s): Sebastien Chassande
00022  * Contributor(s):
00023  *
00024  * --------------------------------------------------------------------------
00025  * $Id: JEntityContext.java,v 1.4 2004/03/19 14:31:52 sauthieg Exp $
00026  * --------------------------------------------------------------------------
00027  */
00028 
00029 
00030 package org.objectweb.jonas_ejb.container.jorm;
00031 
00032 import javax.ejb.EntityBean;
00033 
00034 import org.objectweb.jonas_ejb.container.JEntityFactory;
00035 import org.objectweb.jorm.naming.api.PName;
00036 
00044 public class JEntityContext
00045     extends org.objectweb.jonas_ejb.container.JEntityContext {
00046 
00047     public JEntityContext(JEntityFactory bf, EntityBean eb) {
00048         super(bf, eb);
00049     }
00050 
00059     public Object getPrimaryKey() throws IllegalStateException {
00060         PName pn = (PName) super.getPrimaryKey();
00061         Coder c = (Coder) bf.getLocalHome();
00062         if (c==null) {
00063             c = (Coder) bf.getHome();
00064         }
00065         try {
00066             return c.encode(pn);
00067         }
00068         catch (Exception e) {
00069             throw new IllegalStateException("Inner: Encoding error:"
00070                                             + e.getMessage());
00071         }
00072     }
00073 }

Generated on Tue Feb 15 15:05:37 2005 for JOnAS by  doxygen 1.3.9.1