<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to blog</title><link href="https://sourceforge.net/p/unbbayes/blog/" rel="alternate"/><link href="https://sourceforge.net/p/unbbayes/blog/feed.atom" rel="self"/><id>https://sourceforge.net/p/unbbayes/blog/</id><updated>2014-09-04T02:21:07.174000Z</updated><subtitle>Recent posts to blog</subtitle><entry><title>My First Plug-In</title><link href="https://sourceforge.net/p/unbbayes/blog/2014/09/my-first-plug-in/" rel="alternate"/><published>2014-09-04T02:21:07.174000Z</published><updated>2014-09-04T02:21:07.174000Z</updated><author><name>Laecio</name><uri>https://sourceforge.net/u/userid-1469330/</uri></author><id>https://sourceforge.net960e98ca13b8a045e0dcdace230a46e67e4f70c0</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;b&gt;by Estevão Aguiar, 2012&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The Plug-in structure provides a way to run a new project inside the run environment of UnBBayes. The bind between the new plug-in and the core from UnBBayes happens in a way that no changes are needed in the core.&lt;/p&gt;
&lt;p&gt;First, to starting the building of a new plug-in for UnBBayes it will be necessary to install &lt;a href="http://maven.apache.org" rel="nofollow"&gt;Apache Maven&lt;/a&gt;. Maven is a tool for management of a software project. Maven can manage the building and documentation of a project. Second, it will be necessary to install the Maven plug-in in the Eclipse IDE. Finally, a new Maven project must be build using the IDE.&lt;/p&gt;
&lt;p&gt;A plug-in for UnBBayes must contain the following elements: &lt;br /&gt;
&lt;ul&gt;&lt;br /&gt;
&lt;li&gt;Descriptor file of the plug-in: A XML file which contains metadata about the new plug-in.&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;Classes: Java code file.&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;Resources: Images, icons, message files and text.&lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The new Maven project must contain, essencially, the following structure:&lt;br /&gt;
&lt;ul&gt;&lt;br /&gt;
&lt;li&gt; src/main/java: Default directory from Maven. The java code from plug-in must be inside it.&lt;/li&gt;&lt;br /&gt;
&lt;li&gt; src/test/java: Default directory from Maven. The code of the test stub "UnBBayesMainDelegator" must be inside it. The stub is used in order to test the new plug-in running inside UnBBayes. &lt;/li&gt;&lt;br /&gt;
&lt;li&gt; JRE System Dependencies: Default directory from Maven. Libraries from java environment.&lt;/li&gt;&lt;br /&gt;
&lt;li&gt; Maven Dependencies: Default directory from Maven. Maven dependencies which are referenced from Maven repository. The dependencies specifications are in pom.xml file. &lt;/li&gt;&lt;br /&gt;
&lt;li&gt; plugins: Essencial directory for UnBBayes plug-in structure. All the used plugins in UnBBayes must be inside it. Essencially it must contain the following plugins, that cam be get from the directory with the same name in UnBBayes core: unbbayes.core and unbbayes.io.NetIO. The new plug-in must be here too, as well. &lt;/li&gt; &lt;br /&gt;
&lt;ul&gt; &lt;li&gt; new plugin name (e.g. unbbayes.plugin.module.stub): Subdirectory of plugins. Plug-in directory. Must contain the itens below:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;  icons: The new plug-in icon that will appear on the interface could be here.&lt;/li&gt;&lt;br /&gt;
&lt;li&gt; plugin.xml: It contains informations about the plug-in (e.g. necessary plugins and resources, informations about extension point that binds UnBBayes to the plug-in)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt; &lt;br /&gt;
&lt;li&gt; pom.xml: Configuration file from a Maven project. It contains the great part of necessary informations for the plug-in building. It is a complex file and it is not necessary to understand all it does, just to know how to use it effectively. It brings plug-in identification informations, besides other informations that could be added, like: licence, mailing and developers. It must have, essencially, plug-in dependencies information.&lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Tip: Download an existing plug-in file for UnBBayes and analyze its operation in order to learn how to build yours.&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;After all, there is necessary to run the program from the stub test class called UnBBayesMainDelegator. See its code below:&lt;/p&gt;
&lt;p&gt;&lt;code&gt; &lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.util.Locale;&lt;br /&gt;
import unbbayes.util.Debug;&lt;/code&gt;&lt;/p&gt;&lt;code&gt;
&lt;p&gt;/&lt;em&gt;&lt;/em&gt;&lt;em&gt;&lt;br /&gt;
 * This is just a stub in order to test this plugin&lt;br /&gt;
 * on UnBBayes&lt;br /&gt;
 * @author Shou Matsumoto&lt;br /&gt;
&lt;/em&gt;&lt;br /&gt;
/&lt;br /&gt;
public class UnBBayesMainDelegator {&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="cm"&gt;/**&lt;/span&gt;
&lt;span class="cm"&gt; * Default empty constructor&lt;/span&gt;
&lt;span class="cm"&gt; */&lt;/span&gt;
&lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="n"&gt;UnBBayesMainDelegator&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// TODO Auto-generated constructor stub&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="cm"&gt;/**&lt;/span&gt;
&lt;span class="cm"&gt; * It just delegates to UnBBayes' main&lt;/span&gt;
&lt;span class="cm"&gt; * @param args&lt;/span&gt;
&lt;span class="cm"&gt; * @throws AclFormatException &lt;/span&gt;
&lt;span class="cm"&gt; * @throws IOException &lt;/span&gt;
&lt;span class="cm"&gt; */&lt;/span&gt;
&lt;span class="n"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;throws&lt;/span&gt; &lt;span class="n"&gt;IOException&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// change default locale&lt;/span&gt;
    &lt;span class="n"&gt;Locale&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setDefault&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Locale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"pt"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="c1"&gt;// enable debug mode &lt;/span&gt;
    &lt;span class="n"&gt;Debug&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setDebug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="c1"&gt;// delegate to UnBBayes     &lt;/span&gt;
    &lt;span class="n"&gt;unbbayes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/code&gt;&lt;p&gt;&lt;code&gt;}&lt;br /&gt;
&lt;/code&gt; &lt;/p&gt;&lt;/div&gt;</summary></entry></feed>