<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6128507250560175298</id><updated>2024-08-28T05:47:10.794-07:00</updated><category term="Java"/><category term="ALBPM"/><category term="GnuPG"/><category term="Oracle"/><category term="PGP"/><category term="Performance"/><title type='text'>Clever Cup</title><subtitle type='html'>...the professor teaches you, from the master... you learn</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://clevercup.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6128507250560175298/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://clevercup.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>machaval</name><uri>http://www.blogger.com/profile/03720251255386608215</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6128507250560175298.post-6403680679558818080</id><published>2011-03-24T08:15:00.000-07:00</published><updated>2011-03-24T08:16:57.518-07:00</updated><title type='text'>How to design an API</title><content type='html'>While watching some google tech talks I found this video. Really good one.&lt;br /&gt;&lt;br /&gt;&lt;iframe title=&quot;YouTube video player&quot; width=&quot;480&quot; height=&quot;390&quot; src=&quot;http://www.youtube.com/embed/aAb7hSCtvGw&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;</content><link rel='replies' type='application/atom+xml' href='http://clevercup.blogspot.com/feeds/6403680679558818080/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://clevercup.blogspot.com/2011/03/how-to-design-api.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6128507250560175298/posts/default/6403680679558818080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6128507250560175298/posts/default/6403680679558818080'/><link rel='alternate' type='text/html' href='http://clevercup.blogspot.com/2011/03/how-to-design-api.html' title='How to design an API'/><author><name>machaval</name><uri>http://www.blogger.com/profile/03720251255386608215</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/aAb7hSCtvGw/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6128507250560175298.post-4751475638022891380</id><published>2011-03-16T06:28:00.000-07:00</published><updated>2011-03-16T14:24:01.204-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="GnuPG"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="PGP"/><title type='text'>Encrypting using  PGP (GnuPG) and Java</title><content type='html'>So I was required to encrypt some files in a bpm process using GNUPPGP.  There are not too many libraries out there that makes this and are for  free. So after some googling I found this site &lt;a href=&quot;http://www.cryptix.org/&quot;&gt;http://www.cryptix.org/&lt;/a&gt; . Very cool !!!!&lt;br /&gt;&lt;br /&gt;After I download this two links&lt;br /&gt;&lt;br /&gt;&lt;table border=&quot;1&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Cryptix OpenPGP&lt;/td&gt;  &lt;td&gt;snapshot&lt;/td&gt;  &lt;td&gt;2005/04/18&lt;/td&gt;  &lt;td&gt;&lt;a href=&quot;http://www.cryptix.org/cryptix-openpgp-20050418-snap.zip&quot;&gt;cryptix-openpgp-20050418-snap.zip&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;  &lt;td&gt;Cryptix JCE&lt;/td&gt;  &lt;td&gt;snapshot&lt;/td&gt;  &lt;td&gt;2005/03/28&lt;/td&gt;  &lt;td&gt;&lt;a href=&quot;http://www.cryptix.org/cryptix-jce-20050328-snap.zip&quot;&gt;cryptix-jce-20050328-snap.zip&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;I create I simple Helper that will simplify the final user to use them.&lt;br /&gt;&lt;br /&gt;My helper looks like this&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;First register the Crypto&lt;/span&gt; :&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p style=&quot;border: 1px solid gray; margin: 0pt 10px 15px; padding: 5px; background-color: rgb(248, 248, 248); font-size: 1em;&quot;&gt;private static final String OPEN_PGP = &quot;OpenPGP&quot;;&lt;br /&gt;static {&lt;br /&gt;//**********************************************************************&lt;br /&gt;// Dynamically register both the Cryptix JCE and Cryptix OpenPGP&lt;br /&gt;// providers.&lt;br /&gt;//**********************************************************************&lt;br /&gt;java.security.Security.addProvider(new CryptixCrypto());&lt;br /&gt;java.security.Security.addProvider(new CryptixOpenPGP());&lt;br /&gt;}&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Second create a simple helper method that accepts a byte[] or Binary in BPM and returns the encrypted byte[].&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;border: 1px solid gray; margin: 0pt 10px 15px; padding: 5px; background-color: rgb(248, 248, 248); font-size: 1em;&quot;&gt;&lt;br /&gt;public static byte[] encryptFile(File publicKey, byte[] contentToEncrypt) {&lt;br /&gt; //**********************************************************************&lt;br /&gt; // First read the key.&lt;br /&gt; //**********************************************************************&lt;br /&gt; KeyBundle publicBob = null;&lt;br /&gt; FileInputStream in = null;&lt;br /&gt;&lt;br /&gt; try {&lt;br /&gt;     MessageFactory mf = MessageFactory.getInstance(OPEN_PGP);&lt;br /&gt;     in = new FileInputStream(publicKey);&lt;br /&gt;     Collection msgs = mf.generateMessages(in);&lt;br /&gt;     KeyBundleMessage kbm = (KeyBundleMessage) msgs.iterator().next();&lt;br /&gt;     publicBob = kbm.getKeyBundle();&lt;br /&gt; } catch (IOException ioe) {&lt;br /&gt;     throw new RuntimeException(&quot;IOException... You did remember to run the &quot; + &quot;GenerateAndWriteKey example first, right?&quot;, ioe);&lt;br /&gt; } catch (NoSuchAlgorithmException nsae) {&lt;br /&gt;     nsae.printStackTrace();&lt;br /&gt;     throw new RuntimeException(&quot;Cannot find the OpenPGP MessageFactory. &quot; + &quot;This usually means that the Cryptix OpenPGP provider is not &quot; + &quot;installed correctly.&quot;, nsae);&lt;br /&gt; } catch (MessageException me) {&lt;br /&gt;     me.printStackTrace();&lt;br /&gt;     throw new RuntimeException(&quot;Reading keybundle failed.&quot;, me);&lt;br /&gt; } finally {&lt;br /&gt;     if (in != null)&lt;br /&gt;         try {&lt;br /&gt;             in.close();&lt;br /&gt;         } catch (IOException e) {&lt;br /&gt;             //ignore this exception!!!&lt;br /&gt;         }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; //**********************************************************************&lt;br /&gt; //  The actual stream encryption.&lt;br /&gt; //**********************************************************************&lt;br /&gt; BufferedInputStream bin = null;&lt;br /&gt; LiteralMessageOutputStream literalMessageOutputStream = null;&lt;br /&gt; try {&lt;br /&gt;     ByteArrayOutputStream encryptedFileOutputStream = new ByteArrayOutputStream();&lt;br /&gt;     literalMessageOutputStream = LiteralMessageOutputStream.getInstance(OPEN_PGP);&lt;br /&gt;     EncryptedMessageOutputStream encryptedMessage = EncryptedMessageOutputStream.getInstance(OPEN_PGP);&lt;br /&gt;     SecureRandom sr = new SecureRandom();&lt;br /&gt;     literalMessageOutputStream.init(encryptedMessage, sr);   // Literal writes to Encrypted&lt;br /&gt;     encryptedMessage.init(encryptedFileOutputStream, sr);   // Encrypted writes to file&lt;br /&gt;     encryptedMessage.addRecipient(publicBob);&lt;br /&gt;     //&lt;br /&gt;     literalMessageOutputStream.write(contentToEncrypt);&lt;br /&gt;     return encryptedFileOutputStream.toByteArray();&lt;br /&gt;&lt;br /&gt; } catch (NoSuchAlgorithmException nsae) {&lt;br /&gt;     throw new RuntimeException(&quot;Cannot find OpenPGP implementation.&quot; +&lt;br /&gt;             &quot; This usually means that the Cryptix OpenPGP provider is not &quot; +&lt;br /&gt;             &quot;installed correctly.&quot;, nsae);&lt;br /&gt; } catch (MessageStreamException me) {&lt;br /&gt;     throw new RuntimeException(&quot;Streaming the message failed.&quot;, me);&lt;br /&gt; } catch (IOException ioe) {&lt;br /&gt;     throw new RuntimeException(&quot;IO error.&quot;, ioe);&lt;br /&gt; } finally {&lt;br /&gt;     if (bin != null) {&lt;br /&gt;         try {&lt;br /&gt;             bin.close();&lt;br /&gt;         } catch (IOException e) {&lt;br /&gt;             //ignore error&lt;br /&gt;         }&lt;br /&gt;     }&lt;br /&gt;     if (literalMessageOutputStream != null) {&lt;br /&gt;         try {&lt;br /&gt;             literalMessageOutputStream.close();&lt;br /&gt;         } catch (IOException e) {&lt;br /&gt;             //ignore error&lt;br /&gt;         }&lt;br /&gt;     }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Issues I found&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;pre&gt;java.security.InvalidKeyException: Illegal key size&lt;br /&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Solution  replace the security files&lt;br /&gt;&lt;ol&gt;&lt;li&gt; Suppose you are using jdk15. Go to http://java.sun.com/javase/downloads/index_jdk5.jsp&lt;/li&gt;&lt;li&gt; Go to the Other Downloads section and click on download link next to &quot;Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 5.0&quot;&lt;/li&gt;&lt;li&gt;Download jce_policy-1_5_0.zip and extract it in to a directory.&lt;/li&gt;&lt;li&gt;You will find local_policy.jar and US_export_policy.jar files there in the extracted directory. Copy these two files to $JAVA_HOME/jre/lib/security directory. (These files will already be there. you may replace them)&lt;/li&gt;&lt;/ol&gt;</content><link rel='replies' type='application/atom+xml' href='http://clevercup.blogspot.com/feeds/4751475638022891380/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://clevercup.blogspot.com/2011/03/encrypting-using-gnu-pgp-and-java.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6128507250560175298/posts/default/4751475638022891380'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6128507250560175298/posts/default/4751475638022891380'/><link rel='alternate' type='text/html' href='http://clevercup.blogspot.com/2011/03/encrypting-using-gnu-pgp-and-java.html' title='Encrypting using  PGP (GnuPG) and Java'/><author><name>machaval</name><uri>http://www.blogger.com/profile/03720251255386608215</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6128507250560175298.post-9035749628846747056</id><published>2011-03-14T12:45:00.000-07:00</published><updated>2011-03-16T14:23:30.230-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ALBPM"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="Performance"/><title type='text'>Oracle ALBPM Performance Monitoring</title><content type='html'>Currently I&#39;m working at credit suisse as a BPM Consultant and I will like to create a tool to monitor the performance of the engine.  This must show :&lt;br /&gt;&lt;ol&gt;&lt;li&gt;DB usage&lt;/li&gt;&lt;li&gt;JMS usage&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Prepare statement pool&lt;/li&gt;&lt;/ol&gt;In order to implement this I will try to connect with JMX to the Weblogic server. Let see if I can...&lt;br /&gt;Links :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://download.oracle.com/docs/cd/E11035_01/wls100/jmx/accessWLS.html#wp1119237&quot;&gt;Weblogic JMX Documentation&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;First item: Connect to the JMX weblogic Server&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;My First approach was to use an external (&lt;span style=&quot;color: rgb(255, 102, 102);&quot;&gt;Failed&lt;/span&gt;)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;The external resource of bpm is too old and does not allow me to connect to Weblogic 10&lt;ul&gt;&lt;li&gt;Second approach  Is to create my Java Library and catalog it as a Java Component (&lt;span style=&quot;color: rgb(51, 204, 0);&quot;&gt;Succedded&lt;/span&gt;)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;I can not connect to the server using JMX from outside , for security reasons,  but I do can connect using the local connection. That is why I use&lt;br /&gt;&lt;pre name=&quot;code&quot; class=&quot;java&quot;&gt;&lt;br /&gt;private MBeanServer getMBeanServer() throws NamingException {&lt;br /&gt; MBeanServer server;&lt;br /&gt; InitialContext ctx = new InitialContext();&lt;br /&gt; server = (MBeanServer) ctx.lookup(&quot;java:comp/env/jmx/runtime&quot;);&lt;br /&gt; return server;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So this is how I will get my connection to the Weblogic MBeanServer access. Things I need to take care of :&lt;br /&gt;&lt;ol&gt;&lt;li&gt;This method need to be runs on server since I like to monitor the engine I need to get the MBeanServer from the engine not PAPI&lt;/li&gt;&lt;/ol&gt;So in order to finish this I create my library with only one class and catalog it&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import javax.management.MBeanServer;&lt;br /&gt;import javax.management.ObjectName;&lt;br /&gt;import javax.naming.InitialContext;&lt;br /&gt;import javax.naming.NamingException;&lt;br /&gt;&lt;br /&gt;public class JMXMonitor {&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; public static void main(String[] args) throws Exception {&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public Object invokeMBeanMethod(String mBeanName, String methodName, Object[] args, String[] signature) throws Exception {&lt;br /&gt;     MBeanServer mBeanServer = getMBeanServer();&lt;br /&gt;     ObjectName name = new ObjectName(mBeanName);&lt;br /&gt;     return mBeanServer.invoke(name, methodName, args, signature);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public Object getMBeanAttributeValue(String mBeanName, String attributeName) throws Exception {&lt;br /&gt;     MBeanServer server = getMBeanServer();&lt;br /&gt;     ObjectName name = new ObjectName(mBeanName);&lt;br /&gt;     return server.getAttribute(name, attributeName);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; private MBeanServer getMBeanServer() throws NamingException {&lt;br /&gt;     MBeanServer server;&lt;br /&gt;     InitialContext ctx = new InitialContext();&lt;br /&gt;     server = (MBeanServer) ctx.lookup(&quot;java:comp/env/jmx/runtime&quot;);&lt;br /&gt;     return server;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So once I can get the this done I have 50% of the problem resolved.</content><link rel='replies' type='application/atom+xml' href='http://clevercup.blogspot.com/feeds/9035749628846747056/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://clevercup.blogspot.com/2011/03/me-credit-suisse_14.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6128507250560175298/posts/default/9035749628846747056'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6128507250560175298/posts/default/9035749628846747056'/><link rel='alternate' type='text/html' href='http://clevercup.blogspot.com/2011/03/me-credit-suisse_14.html' title='Oracle ALBPM Performance Monitoring'/><author><name>machaval</name><uri>http://www.blogger.com/profile/03720251255386608215</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6128507250560175298.post-5309667535382241313</id><published>2011-03-14T12:35:00.000-07:00</published><updated>2011-03-14T12:45:30.808-07:00</updated><title type='text'>Start up</title><content type='html'>I&#39;m starting this blog with the purpose of writing Ideas... what ever goes trough my mind... ;)</content><link rel='replies' type='application/atom+xml' href='http://clevercup.blogspot.com/feeds/5309667535382241313/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://clevercup.blogspot.com/2011/03/me-credit-suisse.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6128507250560175298/posts/default/5309667535382241313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6128507250560175298/posts/default/5309667535382241313'/><link rel='alternate' type='text/html' href='http://clevercup.blogspot.com/2011/03/me-credit-suisse.html' title='Start up'/><author><name>machaval</name><uri>http://www.blogger.com/profile/03720251255386608215</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>