blob: 9ef63b073e4366c3fd82dd82184bc17980265c22 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<!-- $PAGETITLE -->
<TITLE>OpenEJB - Xbean usage in OpenEJB</TITLE>
<LINK href="http://openejb.apache.org/all.css" rel="stylesheet" type="text/css">
<!--[if IE]><link rel="stylesheet" type="text/css" media="screen, projection" href="openejb.apache.org/ie.css"><![endif]-->
<LINK rel="SHORTCUT ICON" href="http://openejb.apache.org/images/favicon.ico">
<META http-equiv="Content-Type" content="text/html;charset=UTF-8">
<SCRIPT language="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></SCRIPT>
<SCRIPT language="javascript" src="http://openejb.apache.org/tweet/jquery.tweet.js" type="text/javascript"></SCRIPT>
<SCRIPT type="text/javascript">
$(document).ready(function(){
$(".tweet").tweet({
avatar_size: 32,
count: 4,
fetch:25,
username: "openejb",
list: "contributors",
template:"{avatar}{text}",
filter: function(t){ return /openejb/i.test(t["tweet_raw_text"]); },
loading_text: "loading list..."
});
});
</SCRIPT>
</HEAD>
<BODY>
<!-- Delay the loading of the external javascript file needed for labels (as it takes too long to load and visibly holds loading of the page body) -->
<!-- To do this without javascript errors over undefined functions, we need to declare stubs here (that are overrided later by the proper implementations) -->
<SCRIPT language="JavaScript" type="text/javascript">
function doAddLabel(hideTextfieldAfterAddParam)
{
// stub
}
function onAddLabel()
{
// stub
}
function showLabelsInput()
{
// stub
}
</SCRIPT>
<A name="top"></A>
<TABLE class="frameTable" cellpadding="0" cellspacing="0" border="0">
<TR class="Row1">
<TD class="Col1"><IMG alt="" src="http://openejb.apache.org/images/dotTrans.gif"></TD>
<TD class="Col2"><IMG alt="" src="http://openejb.apache.org/images/dotTrans.gif"></TD>
<TD class="Col3"><IMG alt="" src="http://openejb.apache.org/images/dotTrans.gif"></TD>
<TD class="Col4"><IMG alt="" src="http://openejb.apache.org/images/dotTrans.gif"></TD>
<TD class="Col5"><IMG alt="" src="http://openejb.apache.org/images/dotTrans.gif"></TD>
</TR>
<TR class="Row2">
<TD class="Col1"><IMG alt="" src="http://openejb.apache.org/images/dotTrans.gif"></TD>
<TD class="Col2">&nbsp;</TD>
<TD class="Col3" id="breadcrumbs">
<!-- $TOP_NAV_BAR -->
<A href="index.html" title="Index">Home</A> | <A href="news.html" title="News">News</A> | <A href="faq.html" title="FAQ">FAQ</A> | <A href="download.html" title="Download">Download</A> | <A href="mailing-lists.html" title="Mailing Lists">Lists</A> | <A href="http://issues.apache.org/jira/browse/OPENEJB" class="external-link" rel="nofollow">Issues</A>
</TD>
<TD class="Col4"><IMG alt="" src="http://openejb.apache.org/images/dotTrans.gif"></TD>
<TD class="Col5">&nbsp;</TD>
</TR>
<TR class="Row3">
<TD class="Col1"><IMG alt="" class="Row3Img" id="thinLine" src="http://openejb.apache.org/images/line_sm.gif"></TD>
<TD class="Col2"><IMG alt="" class="Row3Img" src="http://openejb.apache.org/images/dotTrans.gif"></TD>
<TD class="Col3"><IMG alt="" class="Row3Img" src="http://openejb.apache.org/images/dotTrans.gif"></TD>
<TD class="Col4"><IMG alt="" src="http://openejb.apache.org/images/dotTrans.gif"></TD>
<TD class="Col5"><IMG alt="" class="Row3Img" src="http://openejb.apache.org/images/dotTrans.gif"></TD>
</TR>
<TR class="Row4">
<TD class="Col1">
<SPAN id="Navigation">
<H3><A name="Navigation-Overview"></A>Overview</H3>
<UL class="alternate" type="square">
<LI><A href="index.html" title="Index">Home</A></LI>
<LI><A href="news.html" title="News">News</A></LI>
<LI><A href="faq.html" title="FAQ">FAQ</A></LI>
<LI><A href="download.html" title="Download">Download</A></LI>
<LI><A href="../OPENEJBx30/index.html" title="Index">Documentation</A></LI>
<LI><A href="examples.html" title="Examples">Examples</A></LI>
<LI><A href="http://cwiki.apache.org/confluence/display/OPENEJB/Lightening%20Demos" class="external-link" rel="nofollow">Lightning Demos</A></LI>
<LI><A href="mailing-lists.html" title="Mailing Lists">Mailing Lists</A></LI>
<LI><A href="source-code.html" title="Source Code">Source Code</A></LI>
<LI><A href="http://blogs.apache.org/openejb" class="external-link" rel="nofollow">Project Blog</A></LI>
</UL>
<H3><A name="Navigation-Servers"></A>Servers</H3>
<UL class="alternate" type="square">
<LI><A href="local-server.html" title="Local Server">Local</A></LI>
<LI><A href="remote-server.html" title="Remote Server">Remote</A></LI>
</UL>
<H3><A name="Navigation-Integrations"></A>Integrations</H3>
<UL class="alternate" type="square">
<LI><A href="../OPENEJBx30/tomcat.html" title="Tomcat">Tomcat</A></LI>
<LI><A href="geronimo.html" title="Geronimo">Geronimo</A></LI>
<LI><A href="webobjects.html" title="WebObjects">WebObjects</A></LI>
</UL>
<H3><A name="Navigation-Community"></A>Community</H3>
<UL class="alternate" type="square">
<LI><A href="team.html" title="Team">Team</A></LI>
<LI><A href="articles.html" title="Articles">Articles</A></LI>
<LI><A href="http://webchat.freenode.net/?channels=openejb" class="external-link" rel="nofollow">IRC</A></LI>
</UL>
<H3><A name="Navigation-RelatedProjects"></A>Related Projects</H3>
<UL class="alternate" type="square">
<LI><A href="http://activemq.apache.org/" class="external-link" rel="nofollow">ActiveMQ</A></LI>
<LI><A href="http://openjpa.apache.org/" class="external-link" rel="nofollow">OpenJPA</A></LI>
<LI><A href="http://cxf.apache.org/" class="external-link" rel="nofollow">CXF</A></LI>
</UL>
<H3><A name="Navigation-Index"></A>Index</H3>
<UL class="alternate" type="square">
<LI><A href="space-index.html" title="Space Index">Site Index</A></LI>
<LI><A href="../OPENEJBx30/space-index.html" title="Space Index">Doc Index</A></LI>
</UL>
<H3>
<A name="Navigation-Feeds"></A>
Feeds
</H3>
<UL class="feeds">
<LI>
<A href="http://cwiki.apache.org/confluence/spaces/rss.action?key=OPENEJB&newPages=false">
<IMG src="http://openejb.apache.org/images/rss.gif"></A>
<A class="feedsText" href="http://cwiki.apache.org/confluence/spaces/rss.action?key=OPENEJB&newPages=false">Site</A>
</LI>
<LI><A href="http://cwiki.apache.org/confluence/spaces/blogrss.action?key=OPENEJB">
<IMG src="http://openejb.apache.org/images/rss.gif"></A>
<A class="feedsText" href="http://cwiki.apache.org/confluence/spaces/blogrss.action?key=OPENEJB">News</A>
</LI>
</UL>
</SPAN>
</TD>
<TD class="Col2">&nbsp;</TD>
<TD class="Col3">
<TABLE id="PageHeader" border="0" width="100%">
<TR>
<TD>
<A href="http://openejb.org/">
<IMG hspace="0" src="http://openejb.apache.org/images/logo_openejb.gif" vspace="0">
</A>
</TD>
<TD align="right">
<A href="http://www.apache.org/">
<IMG src="http://www.apache.org/images/asf-logo.gif" width="258" height="66">
</A>
</TD>
</TR>
<TR>
<TD id="page_title">
<!-- $TITLE -->
Xbean usage in OpenEJB
</TD>
<TD align="right">
<BR><BR>
<!-- Google CSE Search Box Begins -->
<FORM id="searchbox_010475492895890475512:_t4iqjrgx90" action="http://www.google.com/cse">
<INPUT type="hidden" name="cx" value="010475492895890475512:_t4iqjrgx90">
<INPUT type="hidden" name="cof" value="FORID:0">
<INPUT name="q" type="text" size="25">
<INPUT type="submit" name="sa" value="Search">
</FORM>
<SCRIPT type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_010475492895890475512:_t4iqjrgx90"></SCRIPT>
<!-- Google CSE Search Box Ends -->
</TD>
</TR>
</TABLE>
<P>
<!-- $BODY -->
<DIV id="PageContent">
<H1><A name="XbeanusageinOpenEJB-HowXBeanisusedinOpenEJB"></A>How XBean is used in OpenEJB</H1>
<P>Below is an explanation by David Blevins on the usage of xbean in OpenEJB. This text was taken from an email conversation. To view the full conversation, click&nbsp;<A href="http://www.nabble.com/How-is-XBean-used-in-OpenEJB-3--tf2148639.html#a5959172" class="external-link" rel="nofollow">here</A></P>
<H2><A name="XbeanusageinOpenEJB-xbeanreflect"></A>xbean-reflect</H2>
<P> xbean-reflect is a beefed up reflection library.</P>
<P>Earlier all pluggable components had an &quot;init(Properties props)&quot; method? &nbsp;Same concept except now we throw the component class and the properties into an &quot;ObjectRecipe&quot; and call create(). &nbsp;The recipe will take the props out, convert them to the right data types, and construct the object using the right constructor and setters.</P>
<P>So our Containers and stuff now use constructors and setters. &nbsp;Same with anything in a &nbsp;<A href="http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/service-jar.xml?view=markup" class="external-link" rel="nofollow">service-jar.xml</A> file.</P>
<H4><A name="XbeanusageinOpenEJB-Somecoderefs%3A"></A>Some code refs:</H4>
<OL>
<LI><A href="http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java?revision=546308&view=markup" class="external-link" rel="nofollow">Assembler.java</A><BR>
We also use it to construct Stateful and Stateless session bean instances.</LI>
</OL>
<OL>
<LI><A href="http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulInstanceManager.java?revision=546308&view=markup" class="external-link" rel="nofollow">StatefulInstanceManager.java</A></LI>
<LI><A href="http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java?revision=546308&view=markup" class="external-link" rel="nofollow">StatelessInstanceManager.java</A></LI>
</OL>
<H2><A name="XbeanusageinOpenEJB-xbeanfinder"></A>xbean-finder</H2>
<P>xbean-finder is the second coolest library ever. &nbsp;It's a beefed up&nbsp; service finder for grabbing stuff in your classpath. &nbsp;We use it at a couple of places.</P>
<H3><A name="XbeanusageinOpenEJB-COMMANDLINETOOL%3A"></A>COMMAND LINE TOOL:</H3>
<P>The available commands are in properties files in &quot;META-INF/org.openejb.cli/{name}&quot;, where {name} is the name of the command. &nbsp;See:</P>
<OL>
<LI><A href="http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.cli/" class="external-link" rel="nofollow">openejb cli</A></LI>
<LI><A href="http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/src/main/resources/META-INF/org.openejb.cli/" class="external-link" rel="nofollow">openejb cli for itests</A></LI>
</OL>
<P>Earlier we had the &quot;test&quot;&nbsp; command hardcoded in a script, but the person may have uninstalled&nbsp; the itests? &nbsp;Well now, if you have the itests jar, the &quot;test&quot; command&nbsp; will be available. &nbsp;If you don't have the itests jar, the &quot;test&quot; &nbsp;<BR>
command won't be available. &nbsp;The &quot;test&quot; command itself is in the&nbsp; itests jar. &nbsp;You can put any command in any jar and it will&nbsp; automatically become available on the command line. &nbsp;Remove the jar&nbsp; and the command is gone.</P>
<P>When someone types &quot;java &#45;jar openejb.jar start&quot; this guy will look&nbsp; for &quot;META-INF/org.openejb.cli/start&quot;. &nbsp;If he finds it, he'll create&nbsp; it and execute it. &nbsp;If he doesn't find it, he'll list the available&nbsp; commands by enumerating over all the files he see's in the classpath&nbsp; under the &quot;META-INF/org.openejb.cli/&quot; directory. See <A href="http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cli/MainImpl.java?revision=546308&view=markup" class="external-link" rel="nofollow">MainImpl.java</A></P>
<P>An extra cool thing is that each command has in it's properties a&nbsp; &quot;description&quot; property. &nbsp;This is localized, so if the VM locale is&nbsp; &quot;pl&quot; it will look for a &quot;description.pl&quot; property and use its value&nbsp; when printing command line help.<BR>
I'd like to give Jeremy Whitlock a big shout-out for doing such a&nbsp; bang up job on this. &nbsp;He and I worked out the idea and white-boarded&nbsp; it in the wiki, then Jeremy went off and coded up the whole thing&#33;&nbsp; It was fantastic.</P>
<H3><A name="XbeanusageinOpenEJB-SERVERSERVICES%3A"></A>SERVER SERVICES:</H3>
<P>We also use the xbean-finder to create our Server Services (aka.&nbsp; protocols). &nbsp;Our ServerService implementations are in properties&nbsp; files under &quot;META-INF/org.openejb.server.ServerService/{protocolName}. See:</P>
<OL>
<LI><A href="http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-server/src/main/resources/META-INF/org.apache.openejb.server.ServerService/" class="external-link" rel="nofollow">OpenEJB Server - ServerService</A></LI>
<LI><A href="http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-ejbd/src/main/resources/META-INF/org.apache.openejb.server.ServerService/" class="external-link" rel="nofollow">OpenEJB ejbd - ServerService</A></LI>
<LI><A href="http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-telnet/src/main/resources/META-INF/org.apache.openejb.server.ServerService/" class="external-link" rel="nofollow">OpenEJB Telnet - ServerService</A></LI>
<LI><A href="http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-http/src/main/resources/META-INF/org.apache.openejb.server.ServerService/" class="external-link" rel="nofollow">OpenEJB HTTP - ServerService</A></LI>
</OL>
<P>The very first time a ServerService is constructed, we squirt the&nbsp; properties file into the openejb/conf/ directory so the user can edit&nbsp; it. &nbsp;The properties files for ServerServices are very xinet.d like.&nbsp; For example, here is the definition of the &quot;admin&quot; server service:</P>
<P>&nbsp; &nbsp; &nbsp;server &nbsp; &nbsp; &nbsp;= org.openejb.server.admin.AdminDaemon<BR>
&nbsp; &nbsp; &nbsp;bind &nbsp; &nbsp; &nbsp; &nbsp;= 127.0.0.1<BR>
&nbsp; &nbsp; &nbsp;port &nbsp; &nbsp; &nbsp; &nbsp;= 4200<BR>
&nbsp; &nbsp; &nbsp;disabled &nbsp; &nbsp;= false<BR>
&nbsp; &nbsp; &nbsp;threads &nbsp; &nbsp; = 1<BR>
&nbsp; &nbsp; &nbsp;only_from &nbsp; = localhost</P>
<P>You can reconfigure the &quot;admin&quot; server service, for example, via the&nbsp; properties file in openejb/conf/admin.properties. &nbsp;Or you can do it&nbsp; on the command line as such:</P>
<P>&lt;in-a-shell&gt;<BR>
$ ./bin/openejb start &#45;Dadmin.bind=192.168.42.13<BR>
OPENEJB_HOME=/Users/dblevins/work/openejb1/target/openejb-1.1-SNAPSHOT<BR>
OpenEJB 1.1-SNAPSHOT &nbsp; &nbsp;build: 20060420-2356<BR>
<A href="http://www.openejb.org/" class="external-link" rel="nofollow">http://www.openejb.org</A><BR>
resources 1<BR>
OpenEJB ready.<BR>
[init] OpenEJB Remote Server<BR>
&nbsp; &nbsp;*&#42; Starting Services &#42;&#42;<BR>
&nbsp; &nbsp;NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IP &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PORT<BR>
&nbsp; &nbsp;webadmin &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 127.0.0.1 &nbsp; &nbsp; &nbsp; 4203<BR>
&nbsp; &nbsp;httpejbd &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 127.0.0.1 &nbsp; &nbsp; &nbsp; 4204<BR>
&nbsp; &nbsp;telnet &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 127.0.0.1 &nbsp; &nbsp; &nbsp; 4202<BR>
&nbsp; &nbsp;ejbd &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 127.0.0.1 &nbsp; &nbsp; &nbsp; 4201<BR>
&nbsp; &nbsp;admin &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;192.168.42.13 &nbsp; 4200<BR>
&#45;-----&#45;<BR>
Ready&#33;<BR>
&lt;/in-a-shell&gt;</P>
<P>You can override any server service property in the same way. &nbsp;Here&nbsp; are a bunch more examples:</P>
<P>&nbsp; Option: &#45;D&lt;service&gt;.bind=&lt;address&gt;<BR>
&nbsp; &nbsp; openejb start &#45;Dejbd.bind=10.45.67.8<BR>
&nbsp; &nbsp; openejb start &#45;Dejbd.bind=myhost.foo.com<BR>
&nbsp; &nbsp; openejb start &#45;Dtelnet.bind=myhost.foo.com</P>
<P>&nbsp; Option: &#45;D&lt;service&gt;.port=&lt;port&gt;<BR>
&nbsp; &nbsp; openejb start &#45;Dejbd.port=8765<BR>
&nbsp; &nbsp; &nbsp;openejb start &#45;Dhttpejbd.port=8888</P>
<P>&nbsp; Option: &#45;D&lt;service&gt;.only_from=&lt;addresses&gt;<BR>
&nbsp; &nbsp; &nbsp;openejb start &#45;Dadmin.only_from=192.168.1.12<BR>
&nbsp; &nbsp; &nbsp;openejb start &#45;Dadmin.only_from=192.168.1.12,joe.foo.com,robert</P>
<P>&nbsp; Option: &#45;D&lt;service&gt;.threads=&lt;max&gt;<BR>
&nbsp; &nbsp; &nbsp;openejb start &#45;Dejbd.threads=200</P>
<P>&nbsp; Option: &#45;D&lt;service&gt;.disabled=&lt;true/false&gt;<BR>
&nbsp; &nbsp; &nbsp;openejb start &#45;Dtelnet.disabled=true</P>
</DIV>
</P>
</TD>
<TD class="Col4"><IMG src="http://openejb.apache.org/images/dotTrans.gif"></TD>
<TD class="Col5">
</TD>
</TR>
<TR class="Row5">
<TD class="Col1">&nbsp;</TD>
<TD class="Col2">&nbsp;</TD>
<TD class="Col3">
<BR>
<BR>
<IMG width="100%" height="1" src="http://openejb.apache.org/images/line_light.gif">
<TABLE width="100%">
<TR>
<TD>
<SPAN class="bodyGrey">
<SMALL>
<NOTICE><!-- $FOOTER -->
Apache OpenEJB is an project of The Apache Software Foundation (ASF)
</NOTICE>
<BR>
Site Powered by
<A href="http://atlassian.com/">Atlassian</A>
<A href="http://atlassian.com/confluence/">Confluence</A>
.
</SMALL>
</SPAN>
</TD>
<TD align="right">
<A style="color:#999;font-size:small;font-weight:normal;" href="https://cwiki.apache.org/confluence/pages/editpage.action?spaceKey=OPENEJB&title=Xbean%20usage%20in%20OpenEJB">[ edit ]</A>
</TD>
</TR>
</TABLE>
<BR>
</TD>
<TD class="Col4"><IMG src="http://openejb.apache.org/images/dotTrans.gif"></TD>
<TD class="Col5">&nbsp;</TD>
</TR>
</TABLE>
<!-- Needed for composition plugin -->
<!-- delay the loading of large javascript files to the end so that they don't interfere with the loading of page content -->
<SPAN style="display: none">
<SCRIPT type="text/javascript" language="JavaScript" src="http://cwiki.apache.org/confluence/labels-javascript"></SCRIPT>
<SCRIPT src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</SCRIPT>
<SCRIPT type="text/javascript">
_uacct = "UA-2717626-1";
urchinTracker();
</SCRIPT>
</SPAN>
</BODY>
</HTML>