|
ADF Designtime | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.jdevimpl.ejb.codegen.JavaClassGenerator
oracle.adf.dt.factories.ejb.EjbDataControlGenerator
EjbDataControlGenerator builds a JavaBean to wrapper a Session EJB, exposing the EJB's Component interface, while implicitly creating Session bean instances to service requests. package mypackage1; import java.util.Hashtable; import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import mypackage1.Sales; import mypackage1.SalesHome; import oracle.adf.model.generic.DCGenericDataControl; import oracle.adf.model.generic.ejb.EjbDataControl; /** * The client is expected to initialize a Hashtable with * the following properties and pass them to the * setEnvironment() method prior to performing any service * requests on the data control. * * final Hashtable env = new Hashtable(); * env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory"); * env.put(Context.SECURITY_PRINCIPAL, "admin"); * env.put(Context.SECURITY_CREDENTIALS, "welcome"); * env.put(Context.PROVIDER_URL, "ormi://localhost/__ejbapp__"); *_/ public class SalesDataControl extends DCGenericDataControl implements EjbDataCotrol { private Hashtable _environment; private InitialContext _initialContext; private SalesHome _salesHome; private Sales _sales; public SalesDataControl() { super( "Sales" ); // !jwetherb REMOVEME temp hard-wired context init code _environment = new Hashtable(); _environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory"); _environment.put(Context.SECURITY_PRINCIPAL, "admin"); _environment.put(Context.SECURITY_CREDENTIALS, "welcome"); _environment.put(Context.PROVIDER_URL, "ormi://localhost/__ejbapp__"); } //-------------------------------------------------------------------------- // DataControl methods //-------------------------------------------------------------------------- public void setEnvironment( Hashtable environment ) { // !jwetherb REMOVEME _environment = environment; } //-------------------------------------------------------------------------- // Service methods //-------------------------------------------------------------------------- public String getSalesRep( String zipCode ) { return getSales().getSalesRep( zipCode ); } //-------------------------------------------------------------------------- // Private methods //-------------------------------------------------------------------------- private SalesHome getSalesHome() throws NamingException { if (_salesHome == null) { final Context context = getInitialContext(); try { _salesHome = (SalesHome)PortableRemoteObject.narrow(context.lookup("Sales"), SalesHome.class); } catch (NamingException e) { final NamingException ex = new NamingException( "A NamingException occurred when looking up EJB 'Sales' with Home interface 'model.SalesHome'. This may indicate that a 'jndi.properties' file was not present in the classpath, or that its data is invalid." ); ex.setRootCause( e ); throw ex; } } return _salesHome; } private Sales getSales() { if ( _sales == null ) { _sales = getSalesHome().create(); } return _sales; } private Context getInitialContext() { if ( _initialContext == null ) { _initialContext = new InitialContext(_environment); } return _initialContext; } }
Field Summary | |
static boolean |
DATA_CONTROL_MODE
|
static boolean |
INCLUDE_ENVIRONMENT
|
Fields inherited from class oracle.jdevimpl.ejb.codegen.JavaClassGenerator |
_defaultConstructor, _jotClass, _jotFile, _jotManager, _mainMethod, _project, _sourceDirectoryURL, _url, exists, extendedName, extendedPackageName, extendedShortName, extendsClass, genDefaultConstructor, genHeaderComments, genMainMethod, isAbstract, isExtendedValid, isInterface, isPublic, isValid, JAVA_OBJECT, JAVA_OBJECT_PACKAGE, JAVA_OBJECT_SHORT_NAME, JAVA_SUFFIX, name, node, packageName, shortName |
Constructor Summary | |
EjbDataControlGenerator(oracle.jdeveloper.ejb.EjbEngine ejbEngine)
|
Method Summary | |
protected void |
code()
Top-level codegen routine |
void |
generate()
|
oracle.jdeveloper.model.JavaNode |
getBeanInfoNode()
|
void |
setConnectionDescriptor(oracle.jdeveloper.cm.ConnectionDescriptor connDesc)
|
void |
setJ2eeApplicationName(java.lang.String j2eeAppName)
|
protected boolean |
validateExtended()
|
Methods inherited from class oracle.jdevimpl.ejb.codegen.JavaClassGenerator |
addHeaderComments, addInterface, buildMethodSpec, commitFile, copyMethod, copyMethod, doesExist, doesSourceExist, generateId, generateMainMethod, getExtendedName, getFile, getGenDefaultConstructor, getGenHeaderComments, getGenMainMethod, getIsPublic, getJotClass, getJotManager, getMethodHash, getName, getNode, getPackageName, getShortName, getSourceDirectoryURL, getURL, isAbstract, isExtendedValid, isInterface, isSubclass, isValid, resetJOTPackages, setExtendedName, setGenDefaultConstructor, setGenHeaderComments, setGenMainMethod, setIsPublic, setName, setSourceDirectoryURL, throwsException, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final boolean DATA_CONTROL_MODE
public static final boolean INCLUDE_ENVIRONMENT
Constructor Detail |
public EjbDataControlGenerator(oracle.jdeveloper.ejb.EjbEngine ejbEngine)
Method Detail |
public void generate()
public oracle.jdeveloper.model.JavaNode getBeanInfoNode()
protected void code()
protected boolean validateExtended()
public void setJ2eeApplicationName(java.lang.String j2eeAppName)
public void setConnectionDescriptor(oracle.jdeveloper.cm.ConnectionDescriptor connDesc)
|
ADF Designtime | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.