blob: c88c9f3bcb368e4cec156f2dcecda84e4342ca26 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Apache TomEE</title>
<meta name="description"
content="Apache TomEE is a lightweight, yet powerful, JavaEE Application server with feature rich tooling." />
<meta name="keywords" content="tomee,asf,apache,javaee,jee,shade,embedded,test,junit,applicationcomposer,maven,arquillian" />
<meta name="author" content="Luka Cvetinovic for Codrops" />
<link rel="icon" href="../favicon.ico">
<link rel="icon" type="image/png" href="../favicon.png">
<meta name="msapplication-TileColor" content="#80287a">
<meta name="theme-color" content="#80287a">
<link rel="stylesheet" type="text/css" href="../css/normalize.css">
<link rel="stylesheet" type="text/css" href="../css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="../css/owl.css">
<link rel="stylesheet" type="text/css" href="../css/animate.css">
<link rel="stylesheet" type="text/css" href="../fonts/font-awesome-4.1.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="../fonts/eleganticons/et-icons.css">
<link rel="stylesheet" type="text/css" href="../css/jqtree.css">
<link rel="stylesheet" type="text/css" href="../css/idea.css">
<link rel="stylesheet" type="text/css" href="../css/cardio.css">
<script type="text/javascript">
<!-- Matomo -->
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
/* We explicitly disable cookie tracking to avoid privacy issues */
_paq.push(['disableCookies']);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function () {
var u = "//matomo.privacy.apache.org/";
_paq.push(['setTrackerUrl', u + 'matomo.php']);
_paq.push(['setSiteId', '5']);
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g.async = true;
g.src = u + 'matomo.js';
s.parentNode.insertBefore(g, s);
})();
<!-- End Matomo Code -->
</script>
</head>
<body>
<div class="preloader">
<img src="../img/loader.gif" alt="Preloader image">
</div>
<nav class="navbar">
<div class="container">
<div class="row"> <div class="col-md-12">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/" title="Apache TomEE">
<span>
<img
src="../img/apache_tomee-logo.svg"
onerror="this.src='../img/apache_tomee-logo.jpg'"
height="50"
>
</span>
</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right main-nav">
<li><a href="../docs.html">Documentation</a></li>
<li><a href="../community/index.html">Community</a></li>
<li><a href="../security/security.html">Security</a></li>
<li><a class="btn btn-accent accent-orange no-shadow" href="../download.html">Downloads</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div></div>
</div>
<!-- /.container-fluid -->
</nav>
<div id="main-block" class="container main-block">
<div class="row title">
<div class="col-md-12">
<div class='page-header'>
<h1>Xbean usage in OpenEJB</h1>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="sect1">
<h2 id="_how_xbean_is_used_in_openejb">How XBean is used in OpenEJB</h2>
<div class="sectionbody">
<div class="paragraph">
<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 <a href="http://www.nabble.com/How-is-XBean-used-in-OpenEJB-3&#8212;&#8203;tf2148639.html#a5959172">here</a></p>
</div>
<div class="sect2">
<h3 id="_xbean_reflect">xbean-reflect</h3>
<div class="paragraph">
<p>xbean-reflect is a beefed up reflection library.</p>
</div>
<div class="paragraph">
<p>Earlier all pluggable components had an "init(Properties props)" method?
Same concept except now we throw the component class and the properties into an "ObjectRecipe" and call create().
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>
</div>
<div class="paragraph">
<p>So our Containers and stuff now use constructors and setters.
Same with anything in a <a href="http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/service-jar.xml?view=markup">service-jar.xml</a> file.</p>
</div>
<div class="sect3">
<h4 id="_some_code_refs">Some code refs:</h4>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><a href="http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java?revision=546308&amp;view=markup">Assembler.java</a> We also use it to construct Stateful and Stateless session bean instances.</p>
</li>
<li>
<p><a href="http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulInstanceManager.java?revision=546308&amp;view=markup">StatefulInstanceManager.java</a></p>
</li>
<li>
<p><a href="http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java?revision=546308&amp;view=markup">StatelessInstanceManager.java</a></p>
</li>
</ol>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_xbean_finder">xbean-finder</h3>
<div class="paragraph">
<p>xbean-finder is the second coolest library ever.
It&#8217;s a beefed up
service finder for grabbing stuff in your classpath.
We use it at a couple of places.</p>
</div>
<div class="sect3">
<h4 id="_command_line_tool">COMMAND LINE TOOL:</h4>
<div class="paragraph">
<p>The available commands are in properties files in "META-INF/org.openejb.cli/{name}", where {name} is the name of the command.
See:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><a href="http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.cli/">openejb cli</a></p>
</li>
<li>
<p><a href="http://svn.apache.org/viewvc/tomee/tomee/trunk/itests/openejb-itests-client/src/main/resources/META-INF/org.openejb.cli/">openejb cli for itests</a></p>
</li>
</ol>
</div>
<div class="paragraph">
<p>Earlier we had the "test"
command hardcoded in a script, but the person may have uninstalled
the itests?
Well now, if you have the itests jar, the "test" command
will be available.
If you don&#8217;t have the itests jar, the "test"
command won&#8217;t be available.
The "test" command itself is in the
itests jar.
You can put any command in any jar and it will
automatically become available on the command line.
Remove the jar
and the command is gone.</p>
</div>
<div class="paragraph">
<p>When someone types "java -jar openejb.jar start" this guy will look
for "META-INF/org.openejb.cli/start".
If he finds it, he&#8217;ll create
it and execute it.
If he doesn&#8217;t find it, he&#8217;ll list the available
commands by enumerating over all the files he see&#8217;s in the classpath
under the "META-INF/org.openejb.cli/" directory.
See <a href="http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cli/MainImpl.java?revision=546308&amp;view=markup">MainImpl.java</a></p>
</div>
<div class="paragraph">
<p>An extra cool thing is that each command has in it&#8217;s properties a
"description" property.
This is localized, so if the VM locale is
"pl" it will look for a "description.pl" property and use its value
when printing command line help.
I&#8217;d like to give Jeremy Whitlock a big shout-out for doing such a
bang up job on this.
He and I worked out the idea and white-boarded
it in the wiki, then Jeremy went off and coded up the whole thing!
It was fantastic.</p>
</div>
</div>
<div class="sect3">
<h4 id="_server_services">SERVER SERVICES:</h4>
<div class="paragraph">
<p>We also use the xbean-finder to create our Server Services (aka.
protocols).
Our ServerService implementations are in properties
files under "META-INF/org.openejb.server.ServerService/{protocolName}.
See:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><a href="http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-server/src/main/resources/META-INF/org.apache.openejb.server.ServerService/">OpenEJB Server - ServerService</a></p>
</li>
<li>
<p><a href="http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-ejbd/src/main/resources/META-INF/org.apache.openejb.server.ServerService/">OpenEJB ejbd - ServerService</a></p>
</li>
<li>
<p><a href="http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-telnet/src/main/resources/META-INF/org.apache.openejb.server.ServerService/">OpenEJB Telnet - ServerService</a></p>
</li>
<li>
<p><a href="http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-http/src/main/resources/META-INF/org.apache.openejb.server.ServerService/">OpenEJB HTTP - ServerService</a></p>
</li>
</ol>
</div>
<div class="paragraph">
<p>The very first time a ServerService is constructed, we squirt the properties file into the openejb/conf/ directory so the user can edit it.
The properties files for ServerServices are very xinet.d like.
For example, here is the definition of the "admin" server service:</p>
</div>
<div class="listingblock">
<div class="content">
<pre>server = org.openejb.server.admin.AdminDaemon
bind = 127.0.0.1
port = 4200
disabled = false
threads = 1
only_from = localhost</pre>
</div>
</div>
<div class="paragraph">
<p>You can reconfigure the "admin" server service, for example, via the properties file in openejb/conf/admin.properties.
Or you can do it on the command line as such: in-a-shell</p>
</div>
<div class="paragraph">
<p>$ ./bin/openejb start \-Dadmin.bind=192.168.42.13 OPENEJB_HOME=/Users/dblevins/work/openejb1/target/openejb-1.1-SNAPSHOT OpenEJB 1.1-SNAPSHOT build: 20060420-2356 [<a href="http://www.openejb.org" class="bare">http://www.openejb.org</a>](<a href="http://www.openejb.org" class="bare">http://www.openejb.org</a>) resources 1 OpenEJB ready. \[init\](init\.html) OpenEJB Remote Server <strong>\</strong> Starting Services *\* NAME IP PORT webadmin 127.0.0.1 4203 httpejbd 127.0.0.1 4204 telnet 127.0.0.1 4202 ejbd 127.0.0.1 4201 admin 192.168.42.13 4200 \------\- Ready\!</in-a-shell></p>
</div>
<div class="paragraph">
<p>You can override any server service property in the same way.
Here
are a bunch more examples:</p>
</div>
<div class="paragraph">
<p>Option: -D<service>.bind=&lt;address&gt;</p>
</div>
<div class="paragraph">
<p>openejb start \-Dejbd.bind=10.45.67.8</p>
</div>
<div class="paragraph">
<p>openejb start \-Dejbd.bind=myhost.foo.com</p>
</div>
<div class="paragraph">
<p>openejb start \-Dtelnet.bind=myhost.foo.com</service></p>
</div>
<div class="paragraph">
<p>Option: -D<service>.port=<port></p>
</div>
<div class="paragraph">
<p>openejb start \-Dejbd.port=8765</p>
</div>
<div class="literalblock">
<div class="content">
<pre>openejb start \-Dhttpejbd.port=8888+++&lt;/port&gt;++++++&lt;/service&gt;+++</pre>
</div>
</div>
<div class="paragraph">
<p>Option: -D<service>.only_from=<addresses></p>
</div>
<div class="literalblock">
<div class="content">
<pre>openejb start \-Dadmin.only_from=192.168.1.12</pre>
</div>
</div>
<div class="literalblock">
<div class="content">
<pre>openejb start \-Dadmin.only_from=192.168.1.12,joe.foo.com,robert+++&lt;/addresses&gt;++++++&lt;/service&gt;+++</pre>
</div>
</div>
<div class="paragraph">
<p>Option: -D<service>.threads=<max></p>
</div>
<div class="literalblock">
<div class="content">
<pre>openejb start \-Dejbd.threads=200+++&lt;/max&gt;++++++&lt;/service&gt;+++</pre>
</div>
</div>
<div class="paragraph">
<p>Option: -D<service>.disabled=&lt;true/false&gt;</p>
</div>
<div class="literalblock">
<div class="content">
<pre>openejb start \-Dtelnet.disabled=true+++&lt;/service&gt;+++</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="margin-bottom: 30px;"></div>
<footer>
<div class="container">
<div class="row">
<div class="col-sm-6 text-center-mobile">
<h3 class="white">Be simple. Be certified. Be Tomcat.</h3>
<h5 class="light regular light-white">"A good application in a good server"</h5>
<ul class="social-footer">
<li><a href="https://www.facebook.com/ApacheTomEE/"><i class="fa fa-facebook"></i></a></li>
<li><a href="https://twitter.com/apachetomee"><i class="fa fa-twitter"></i></a></li>
</ul>
<h5 class="light regular light-white">
<a href="../privacy-policy.html" class="white">Privacy Policy</a>
</h5>
</div>
<div class="col-sm-6 text-center-mobile">
<div class="row opening-hours">
<div class="col-sm-3 text-center-mobile">
<h5><a href="../latest/docs/" class="white">Documentation</a></h5>
<ul class="list-unstyled">
<li><a href="../latest/docs/admin/configuration/index.html" class="regular light-white">How to configure</a></li>
<li><a href="../latest/docs/admin/file-layout.html" class="regular light-white">Dir. Structure</a></li>
<li><a href="../latest/docs/developer/testing/index.html" class="regular light-white">Testing</a></li>
<li><a href="../latest/docs/admin/cluster/index.html" class="regular light-white">Clustering</a></li>
</ul>
</div>
<div class="col-sm-3 text-center-mobile">
<h5><a href="../latest/examples/" class="white">Examples</a></h5>
<ul class="list-unstyled">
<li><a href="../latest/examples/simple-cdi-interceptor.html" class="regular light-white">CDI Interceptor</a></li>
<li><a href="../latest/examples/rest-cdi.html" class="regular light-white">REST with CDI</a></li>
<li><a href="../latest/examples/ejb-examples.html" class="regular light-white">EJB</a></li>
<li><a href="../latest/examples/jsf-managedBean-and-ejb.html" class="regular light-white">JSF</a></li>
</ul>
</div>
<div class="col-sm-3 text-center-mobile">
<h5><a href="../community/index.html" class="white">Community</a></h5>
<ul class="list-unstyled">
<li><a href="../community/contributors.html" class="regular light-white">Contributors</a></li>
<li><a href="../community/social.html" class="regular light-white">Social</a></li>
<li><a href="../community/sources.html" class="regular light-white">Sources</a></li>
</ul>
</div>
<div class="col-sm-3 text-center-mobile">
<h5><a href="../security/index.html" class="white">Security</a></h5>
<ul class="list-unstyled">
<li><a href="https://apache.org/security" target="_blank" class="regular light-white">Apache Security</a></li>
<li><a href="https://apache.org/security/projects.html" target="_blank" class="regular light-white">Security Projects</a></li>
<li><a href="https://cve.mitre.org" target="_blank" class="regular light-white">CVE</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="row bottom-footer text-center-mobile">
<div class="col-sm-12 light-white">
<p>Copyright &copy; 1999-2022 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache TomEE, TomEE, Apache, the Apache feather logo, and the Apache TomEE project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.</p>
</div>
</div>
</div>
</footer>
<!-- Holder for mobile navigation -->
<div class="mobile-nav">
<ul>
<li><a hef="../latest/docs/admin/index.html">Administrators</a>
<li><a hef="../latest/docs/developer/index.html">Developers</a>
<li><a hef="../latest/docs/advanced/index.html">Advanced</a>
<li><a hef="../community/index.html">Community</a>
</ul>
<a href="#" class="close-link"><i class="arrow_up"></i></a>
</div>
<!-- Scripts -->
<script src="../js/jquery-1.11.1.min.js"></script>
<script src="../js/owl.carousel.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/wow.min.js"></script>
<script src="../js/typewriter.js"></script>
<script src="../js/jquery.onepagenav.js"></script>
<script src="../js/tree.jquery.js"></script>
<script src="../js/highlight.pack.js"></script>
<script src="../js/main.js"></script>
</body>
</html>