tag:blogger.com,1999:blog-31618105558902142882024-03-06T10:49:42.121+05:30Technology ArticlesContains Configuration and articles on different java frameworks.Yogesh Totarehttp://www.blogger.com/profile/04713983039432517765noreply@blogger.comBlogger14125tag:blogger.com,1999:blog-3161810555890214288.post-14093633504846655292014-08-21T12:05:00.000+05:302014-08-21T12:05:03.276+05:30Thumbnailator to create a thumbnail.<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
Many time for the existing images or new images you have to create a thumbnails. This can be achieved by using the <b>Thumbnailator</b> API. Please refer to the following code to create a thumbnail from the source image. You can specify the thumbnail size and also the background color. Documentation for the <b>Thumbnailator </b>can be found<b> <a href="http://thumbnailator.googlecode.com/hg-history/10d498dbcafeeae4bf7a25b2d320d4fc1cdb9fb2/javadoc/overview-summary.html">here</a>. </b>You can download the jar file from <a href="http://code.google.com/p/thumbnailator/downloads/list">here</a>.</div>
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7Q8NztjA2y4kuvv9ONtxC0GKSb3A0z6Q-X_PMiyHVqYhOv3964hqK8U2Ciy7oKDCkh3aQYpcw_tLVEJNI25dkuEJreBIBkq5IBYb1bpg1yI2KlLYQa9QWcGIjsh1tNz3kwdMO2zGSb33p/s1600/Selection_063.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7Q8NztjA2y4kuvv9ONtxC0GKSb3A0z6Q-X_PMiyHVqYhOv3964hqK8U2Ciy7oKDCkh3aQYpcw_tLVEJNI25dkuEJreBIBkq5IBYb1bpg1yI2KlLYQa9QWcGIjsh1tNz3kwdMO2zGSb33p/s1600/Selection_063.png" height="384" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Code to create thumbnail<br />
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Output of the above program is :</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_1Xa52Hj4ZrTgkDVMLe1yyw0Kl1Idzw_XZ9WWfEpila3pH7cv62fhla3S2le2OtMb1JXlOsXEz_s91X9Smyx8zBcARou-7Z1EQFaTM1AYWlFdJNS5CvIoYV_Et7RHiTqrSrbBH6tFk8zW/s1600/download.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_1Xa52Hj4ZrTgkDVMLe1yyw0Kl1Idzw_XZ9WWfEpila3pH7cv62fhla3S2le2OtMb1JXlOsXEz_s91X9Smyx8zBcARou-7Z1EQFaTM1AYWlFdJNS5CvIoYV_Et7RHiTqrSrbBH6tFk8zW/s1600/download.png" height="240" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 12.727272033691406px; text-align: center;">Original image size 1600 x 1200 pixels</td></tr>
</tbody></table>
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvOgythG7z05jrTIuVtyclsBRyagaOa8B82EHHYYHjPsiblPhIDE52FkKsUlH_6U6le0QVTFXiny1xX-MNQg6JdVdBjebUGAPGn3GiF1vM1pBbyBq1XVwAnnWgwbYtvG1OHNvs2Ffy1Nhz/s1600/thumbnail.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvOgythG7z05jrTIuVtyclsBRyagaOa8B82EHHYYHjPsiblPhIDE52FkKsUlH_6U6le0QVTFXiny1xX-MNQg6JdVdBjebUGAPGn3GiF1vM1pBbyBq1XVwAnnWgwbYtvG1OHNvs2Ffy1Nhz/s1600/thumbnail.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvOgythG7z05jrTIuVtyclsBRyagaOa8B82EHHYYHjPsiblPhIDE52FkKsUlH_6U6le0QVTFXiny1xX-MNQg6JdVdBjebUGAPGn3GiF1vM1pBbyBq1XVwAnnWgwbYtvG1OHNvs2Ffy1Nhz/s1600/thumbnail.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a></div>
<div style="text-align: left;">
|</div>
<div style="text-align: left;">
|</div>
<div style="text-align: left;">
|</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvOgythG7z05jrTIuVtyclsBRyagaOa8B82EHHYYHjPsiblPhIDE52FkKsUlH_6U6le0QVTFXiny1xX-MNQg6JdVdBjebUGAPGn3GiF1vM1pBbyBq1XVwAnnWgwbYtvG1OHNvs2Ffy1Nhz/s1600/thumbnail.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvOgythG7z05jrTIuVtyclsBRyagaOa8B82EHHYYHjPsiblPhIDE52FkKsUlH_6U6le0QVTFXiny1xX-MNQg6JdVdBjebUGAPGn3GiF1vM1pBbyBq1XVwAnnWgwbYtvG1OHNvs2Ffy1Nhz/s1600/thumbnail.png" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 12.727272033691406px; text-align: center;">Thumbnail size 60 x 80 pixels</td></tr>
</tbody></table>
</div>
</td></tr>
</tbody></table>
</div>
Yogesh Totarehttp://www.blogger.com/profile/04713983039432517765noreply@blogger.com0tag:blogger.com,1999:blog-3161810555890214288.post-76168041135375945672014-08-18T15:05:00.001+05:302014-08-18T15:13:33.688+05:30HTML Alert Formatting in Microsoft Outlook <div dir="ltr" style="text-align: left;" trbidi="on">
<b>While implementing the HTML alert i have faced an issue where the outlook client (2003/2007/2010) are not shown in the correct format. If you can use the following embedded style class into you alert then it will work fine. I have used the different style will be used for the outlook client and the other web client. </b><br />
<b><br /></b>
<b>Note : Embedded style dose not work with the GMail client.</b><br />
<br />
<br />
<style type="text/css"><br />
<!--[if mso]><br />
.e-dumm<br />
{color:#0C74C1}<br />
a.e-link<br />
{color:#0C74C1}<br />
.e-heading<br />
{font-size:20px;<br />
color:#0C74C1;<br />
margin:5px 0}<br />
.e-subheading<br />
{font-size:16px;<br />
color:#A9A9A9;<br />
margin:0 0 10px 0}<br />
.e-signature<br />
{margin-top:25px;<br />
font-family:Arial,sans-serif;<br />
font-size:14px;<br />
line-height: 5px;<br />
color:#777777;<br />
}<br />
.e-signature p<br />
{<br />
margin:0px;<br />
}<br />
.e-footer<br />
{margin-top:50px;<br />
}<br />
.e-copyright<br />
{margin-top:5px;<br />
font-family:Arial,sans-serif;<br />
font-size:11px;<br />
color:#777777;<br />
}<br />
.e-copyright p{<br />
margin:0px;<br />
}<br />
.e-b-body{margin:10px 0px;<br />
font-family:Arial,sans-serif;<br />
font-size:14px;<br />
color:#777777}<br />
<![endif]--><br />
<!--[if !mso]><br />
.e-dumm<br />
{color:#0C74C1}<br />
a.e-link<br />
{color:#0C74C1}<br />
.e-heading<br />
{font-size:20px;<br />
color:#0C74C1;<br />
margin:5px 0}<br />
.e-subheading<br />
{font-size:16px;<br />
color:#A9A9A9;<br />
margin:0 0 10px 0}<br />
.e-signature<br />
{margin-top:25px;<br />
font-family:Arial,sans-serif;<br />
font-size:14px;<br />
line-height:5px;<br />
color:#777777;<br />
}<br />
.e-footer<br />
{margin-top:50px;<br />
}<br />
.e-copyright<br />
{margin-top:5px;<br />
font-family:Arial,sans-serif;<br />
font-size:11px;<br />
line-height:5px;<br />
color:#777777;<br />
}<br />
.e-b-body<br />
{margin:10px 0px;<br />
font-family:Arial,sans-serif !important;<br />
font-size:14px !important;<br />
color:#777777 !important}<br />
<![endif]--><br />
</style></div>
Yogesh Totarehttp://www.blogger.com/profile/04713983039432517765noreply@blogger.com0tag:blogger.com,1999:blog-3161810555890214288.post-16382895836575364592013-10-21T12:26:00.000+05:302013-10-21T12:26:48.440+05:30Mule connector development pointers<div dir="ltr" style="text-align: left;" trbidi="on">
This article will be helpful for the mule beginners.<br />
<br />
<div style="text-align: center;">
<b><span style="font-size: large;">ANNOTATIONS</span></b></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<ul style="text-align: left;">
<li>Following are some annotation and its meaning</li>
<ul>
<li><span style="font-family: inherit; font-size: 15px;">@<b>Connector</b> : To mark a class as a Connector.</span><span style="background-color: white; color: #222222; font-family: inherit; font-size: 15px; line-height: 22px;">The following is a description of the attributes for this annotation:</span></li>
<ul>
<li style="border: 0px; font-family: inherit; font-size: 15px; margin: 0px 0px 10px; outline: 0px; padding: 0px; vertical-align: baseline;"><em style="border: 0px; font-family: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><b>name</b></em>: The name of the connector. This is a simple string value which should not contain any spaces in it, it will be used to generate the namespace of the connector.</li>
<li style="border: 0px; font-family: inherit; font-size: 15px; margin: 0px 0px 10px; outline: 0px; padding: 0px; vertical-align: baseline;"><em style="border: 0px; font-family: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><b>schemaVersion</b></em>: The version of the generated schema. This usually should match Mule’s schema version, so for <a class="st_tag internal_tag" href="http://blogs.mulesoft.org/tag/mule-3/" rel="tag" style="border: 0px; color: #20328e; font-family: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;" title="Posts tagged with Mule 3">Mule 3</a>.3.1 use schemaVersion=”3.3.1″. Keep in mind that if you add or change methods marked as @Processors or add @Configurable fields the generated schema will change and you should bump the version to avoid compatibility issues.</li>
<li style="border: 0px; font-family: inherit; font-size: 15px; margin: 0px 0px 10px; outline: 0px; padding: 0px; vertical-align: baseline;"><em style="border: 0px; font-family: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><b>friendlyName</b></em>: This is the name of the connector and is meant to be used only in Studio. This name will appear as the module name in the palette. Contrary to the name parameter, this field can contain spaces.</li>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgivH4VL9g0cH7XcTOVvpGqOeySniLHZAFvwPeTorQKnagasJs_yUAjdE3b7yWeKtoYO3YUHSXZ4nr5NmjXAefQdK4sRJFvpLJ2HIG5QKdpTdn9pGF7datOJTdX5xTbx2nB_22eS1OI2TlW/s1600/Blog-1.png" imageanchor="1" style="clear: left; display: inline !important; font-family: inherit; margin-bottom: 1em; margin-left: auto; margin-right: auto; text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgivH4VL9g0cH7XcTOVvpGqOeySniLHZAFvwPeTorQKnagasJs_yUAjdE3b7yWeKtoYO3YUHSXZ4nr5NmjXAefQdK4sRJFvpLJ2HIG5QKdpTdn9pGF7datOJTdX5xTbx2nB_22eS1OI2TlW/s1600/Blog-1.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><b>Connector class</b></td></tr>
</tbody></table>
<li style="border: 0px; font-family: inherit; font-size: 15px; margin: 0px 0px 10px; outline: 0px; padding: 0px; vertical-align: baseline;"><em style="border: 0px; font-family: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><b>minMuleVersion</b></em>: The minimum version of Mule that this connector supports. A check will be generated for runtime verification that the Mule version this connector is running on is the correct one.</li>
</ul>
<li><span style="font-family: inherit; font-size: 15px;">@<b>Configurable</b> : To involve a field in configuration</span></li>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFmPlxSG03NLz4d4lUc_4lYH6yANuTC5lfQEA52V49-qaMoa2AU6Y0Ln76-G10j7V9EmtqcTRPAZ8luV92aEifPFwP8KWmvvfG2piN9RKw7ybUjVxvYNfvgf04yD3Iz5h2BFAiQCkoXhN6/s1600/Blog-2.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFmPlxSG03NLz4d4lUc_4lYH6yANuTC5lfQEA52V49-qaMoa2AU6Y0Ln76-G10j7V9EmtqcTRPAZ8luV92aEifPFwP8KWmvvfG2piN9RKw7ybUjVxvYNfvgf04yD3Iz5h2BFAiQCkoXhN6/s1600/Blog-2.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><b>Configurable Attribute</b></td></tr>
</tbody></table>
<li><span style="font-family: inherit; font-size: 15px;">@<b>Connect</b> : To establish connection to the Service</span></li>
<ul>
<li><span style="font-family: inherit; font-size: 15px;"><span style="background-color: white; color: #222222; line-height: 22px;"><b>ConnectionKey</b> : </span><span style="background-color: white; color: #222222; line-height: 22px;">annotated parameter is used as the key to the pool. Thus, the Connector can be invoked using a number of different credentials</span></span></li>
</ul>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN6c8LA3GML-9PwR9yEaaoNSDRvMhQ9D6wEhRb0iFqWBVjRA9k3f1lWJDwctEd8zgvKN5K5xLbgocxhsBaK539mAr39thOawKXI14T9y42G92LcqqTgykBAvOrmjfPCBUHOqIUAUcKKHIh/s1600/Blog-3.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN6c8LA3GML-9PwR9yEaaoNSDRvMhQ9D6wEhRb0iFqWBVjRA9k3f1lWJDwctEd8zgvKN5K5xLbgocxhsBaK539mAr39thOawKXI14T9y42G92LcqqTgykBAvOrmjfPCBUHOqIUAUcKKHIh/s1600/Blog-3.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><b>Connect method</b></td></tr>
</tbody></table>
<li><span style="font-family: inherit; font-size: 15px;">@<b>Start </b>:<span style="font-family: inherit;"> An alternative to connect annotation.</span></span><span style="font-family: inherit;"><span style="background-color: white; color: #222222; font-size: 15px; line-height: 22px;">If you don’t want to exploit the connection pool facility you can use this.</span><span style="background-color: white; color: #222222; font-size: 15px; line-height: 22px;">This will mean you can have a single instance per configuration.<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnC6Kx34xxxtMkhf4k3dmUmRtTYWb-jnr2X_mR9cJGOzoorbXk3QvfxKVEg_tZ4T46cY73AaK4kS7zfpgyc56l0ThEP5pi_yLtzQlMxTG9ex0N9Z59QIDI46IjpROxBEazLW_kQE17Je9e/s1600/Blog-4.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnC6Kx34xxxtMkhf4k3dmUmRtTYWb-jnr2X_mR9cJGOzoorbXk3QvfxKVEg_tZ4T46cY73AaK4kS7zfpgyc56l0ThEP5pi_yLtzQlMxTG9ex0N9Z59QIDI46IjpROxBEazLW_kQE17Je9e/s1600/Blog-4.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><b>Start method</b></td></tr>
</tbody></table>
</span></span></li>
<li><span style="font-family: inherit; font-size: 15px;">@<b>Processor</b> : To mark a method as an operation<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNfsTxLJCT7OMbofQ70Xzkkx6N2X9fnz24qvsxWbiXGehbuMFb65sNb0VgOeFjfYeAh3rBK4VdlN5pllpr7TpMmtCYQ4w2oGT0KkZ1lw5-EdiSAFUBbAJmpaAVKGXVURGSx4D49NFX23ol/s1600/Blog-7.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNfsTxLJCT7OMbofQ70Xzkkx6N2X9fnz24qvsxWbiXGehbuMFb65sNb0VgOeFjfYeAh3rBK4VdlN5pllpr7TpMmtCYQ4w2oGT0KkZ1lw5-EdiSAFUBbAJmpaAVKGXVURGSx4D49NFX23ol/s1600/Blog-7.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><b>Documentation</b></td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmZnKM1qddZGycQhOstCIWmsDW_UCoMg56KwBbYFUJdRorRUQhWhT__uZEqR0gXCRCeiP2aSgjB4ydXx9LAG6kkj_vuvJ4TzjDEM76dkrg50lY_tSY1jG5HQN9H3yvRJnJKhyphenhyphen-B8hy8yjA/s1600/Blog-6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmZnKM1qddZGycQhOstCIWmsDW_UCoMg56KwBbYFUJdRorRUQhWhT__uZEqR0gXCRCeiP2aSgjB4ydXx9LAG6kkj_vuvJ4TzjDEM76dkrg50lY_tSY1jG5HQN9H3yvRJnJKhyphenhyphen-B8hy8yjA/s1600/Blog-6.png" /></a></div>
</span></li>
<li><span style="font-family: inherit; font-size: 15px;">@<b>Disconnect</b> : Invoked when as part of the maintenance of the Connection Pool<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRrTHiqLPP-94PD78CxpNJu0sck3cUdaRl4V5YS_3hpG2nC4KBi30vOJAgvnOlmPC-UHvIHUwYCBfM84Yj_6JBzVEGCSOHZ2qxflkaZ3245Qg2k0kNxeIMr2kmtWkoIwA4ZZ91AMXQ7sCE/s1600/Blog-5.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRrTHiqLPP-94PD78CxpNJu0sck3cUdaRl4V5YS_3hpG2nC4KBi30vOJAgvnOlmPC-UHvIHUwYCBfM84Yj_6JBzVEGCSOHZ2qxflkaZ3245Qg2k0kNxeIMr2kmtWkoIwA4ZZ91AMXQ7sCE/s1600/Blog-5.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><b>Disconnect and Validation Connection method</b></td></tr>
</tbody></table>
</span></li>
<li><span style="font-family: inherit; font-size: 15px;">@<b>ValidateConnection</b> : Invoked before the invocation of an operatio</span></li>
</ul>
</ul>
<div>
<span style="font-size: 15px;"><br /></span></div>
<div style="text-align: center;">
<b><span style="font-size: large;">READING PROPERTY FILES</span></b></div>
<div>
<br />
<ul style="text-align: left;">
<li><span style="font-size: 15px;">To read the property files keys you need to put the property file under the folder <b>src/main/resources </b>and then in the flow file you have to add an entry </span></li>
<ul>
<li><span style="font-size: 15px;"><b><context:property-placeholder location="fusionlive.properties"/></b></span></li>
<li><span style="font-size: 15px;"><b>xmlns:context="http://www.springframework.org/schema/context"</b> </span></li>
</ul>
<li><span style="font-size: 15px;">You can read the attribute like<b> ${host}</b> in the flow file.</span></li>
</ul>
<span style="font-size: 15px;"><span style="font-size: 15px;"><br /></span></span><span style="text-align: center;"></span>
<div style="font-weight: bold; text-align: center;">
<span style="text-align: center;"><b><span style="font-size: large;">READING POST PARAM</span></b></span></div>
<span style="text-align: center;">
<div style="text-align: center;">
<ul>
<li style="text-align: left;">To read the http POST parameter you have to have the following entry in the flow file.</li>
</ul>
</div>
</span><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhknUu0rFE6AfHwrqo9eIwmx7K_m_7YOjFiJiqcgUN6RUyvqeKB7jVg-jnOrqeupSu7EqRzq3Hcj96LWucFlAQJt0O6VNjFcOOZXZYOyLXjtguYRRo6bOH7ItrTIMYOLo2gOslRfPAUxPWB/s1600/Blog-8.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhknUu0rFE6AfHwrqo9eIwmx7K_m_7YOjFiJiqcgUN6RUyvqeKB7jVg-jnOrqeupSu7EqRzq3Hcj96LWucFlAQJt0O6VNjFcOOZXZYOyLXjtguYRRo6bOH7ItrTIMYOLo2gOslRfPAUxPWB/s1600/Blog-8.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><b>Flow XML</b></td></tr>
</tbody></table>
<div style="text-align: left;">
<br /></div>
</div>
<div style="font-family: inherit; font-weight: bold; text-align: center;">
<b style="font-family: inherit;"><span style="font-size: large;">COMPILATION COMMANDS</span></b></div>
<div style="font-family: inherit; font-weight: bold; text-align: center;">
<b style="font-family: inherit;"><span style="font-size: large;"><br /></span></b></div>
<div style="text-align: left;">
<ul style="text-align: left;">
<li><b>Connector Compilation : </b>Go the the directory where the mule project is reside and run the following command to compile the connector. If the compilataion is success it will create a <b>target</b> folder under the mule project. This target folder intern have myconnector-1.0-javadoc.jar and UpdateSite.zip files which contains the documentation and the connector to export. The first command will generate the document but there are some missing element. If you want to resove this you have to run the second command. Second command will generate the document in apidocs folder under the target folder and not in the myconnector-1.0-javadoc.jar file.</li>
<br />
<ul>
<li><b>mvn3 clean package -Ddevkit.studio.package.skip=false -e</b></li>
<br />
<li><b>mvn3 javadoc:javadoc</b></li>
</ul>
<br />
<li><b>Importing third party library : </b>If you want to import the third party jar then you have to run the following commands</li>
<ul>
<br />
<li><b> mvn install:install-file -Dfile=/home/username/jdbc.jar -DgroupId=org.mule.modules -DartifactId=myconnector -Dversion=1.0 -Dpackaging=jar</b></li>
<br />
<li><b>mvn install:install-file -Dfile=/home/username/jdbc.jar -DgroupId=org.test -DartifactId=myconnector -Dversion=1.0 -Dpackaging=jar</b></li>
</ul>
</ul>
<br />
<ul style="text-align: left;">
</ul>
</div>
<div style="text-align: center;">
<span style="font-size: large;">DEPLOYING</span></div>
<div style="text-align: center;">
<ul>
<li style="text-align: left;"><span style="font-family: inherit;"><span style="font-family: inherit;"><b>Mule ESB / Mulesoft express deployment as Tomcat service</b></span></span></li>
<ul>
<br />
<li style="text-align: left;"><span style="font-family: inherit;"><span style="font-family: inherit;">Download Mule standalone.</span></span></li>
<li style="text-align: left;"><span style="font-family: inherit;">Unpack it in the server’s location of your desire. </span></li>
<li style="text-align: left;"><span style="font-family: inherit;">Place your zipped Mule application in the /mule-standalone/apps directory.</span></li>
<li style="text-align: left;"><span style="font-family: inherit;">If you have any kind of connector .jar, place it in the /mule-standalone/lib/mule directory.</span></li>
<li style="text-align: left;"><span style="font-family: inherit;">Now you’re ready to run your application, go to /mule-standalone/bin and you can do <span style="font-family: inherit;">./mule</span></span></li>
<li style="text-align: left;"><span style="font-family: inherit;">And stopping it using Crtl-C.</span></li>
<li style="text-align: left;"><span style="font-family: inherit;">Or you can manipulate it as a daemon using instead <span style="font-family: inherit;">mule start/stop/restart</span></span></li>
</ul>
</ul>
</div>
<ul style="text-align: left;"><ul>
</ul>
</ul>
</div>
Yogesh Totarehttp://www.blogger.com/profile/04713983039432517765noreply@blogger.com0tag:blogger.com,1999:blog-3161810555890214288.post-23074022332461709762013-10-17T21:19:00.001+05:302013-10-18T12:37:54.092+05:30Mule Upload Example with custom connector<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
</div>
<div>
Following code shows how the upload can be done via mule custom connector.</div>
<ul style="text-align: left;">
<li>Code for the custom upload connector :</li>
</ul>
<table border="0" style="background-color: #d0cfc7; text-align: left;">
<tbody>
<tr>
<td><pre></pre>
<pre></pre>
<pre>import java.io.BufferedInputStream;
import java.io.IOException;
import org.mule.api.ConnectionException;
import org.mule.api.annotations.Configurable;
import org.mule.api.annotations.ConnectionIdentifier;
import org.mule.api.annotations.Connector;
import org.mule.api.annotations.Disconnect;
import org.mule.api.annotations.Processor;
import org.mule.api.annotations.ValidateConnection;
import org.mule.api.annotations.lifecycle.Start;
import org.mule.api.annotations.param.Payload;
/**
* Upload Connector
*
* @author MuleSoft, Inc.
*/
@Connector(name="uploadconnector", schemaVersion="1.0", </pre>
<pre>friendlyName="UploadConnector", description="Upload Functioanlity")</pre>
<pre>public class UploadConnector {
private String connectionIdentifier = null;
private boolean isConnected = false;
/**
* Specifies to which server to connect.
*/</pre>
<pre> @Configurable
</pre>
<pre> private String host = null;
</pre>
<pre>/**
* @return the connectionIdentifier
*/
@ConnectionIdentifier
public String getConnectionIdentifier() {
return connectionIdentifier;
}
/**
* @param connectionIdentifier the connectionIdentifier to set
*/
public void setConnectionIdentifier(String connectionIdentifier) {
this.connectionIdentifier = connectionIdentifier;
}
/**
* @return the host
*/
public String getHost() {
return host;
}
/**
* @param host the host to set
*/
public void setHost(String host) {
this.host = host;
}
/**
* Connects to server.
*
* @throws ConnectionException, IOException
*/
@Start
public synchronized void connect()
throws ConnectionException, IOException {
}
/**
* Disconnect
*/
@Disconnect
public synchronized void disconnect() {
this.isConnected = false;
}
/**
* Are we connected
*/
@ValidateConnection
public boolean isConnected() {
return this.isConnected;
}
</pre>
<pre>/**
* Uploads the document
*
* {@sample.xml ../../
* ../doc/UploadConnector.xml.sample upload:publishdocument}
*
* @param payload File dat in the fromat of BufferedInputStream.
* @param fileName File name of the file to upload.
*
* @throws IOException If there is any exception while connecting
* to the server.
*/
@Processor
public void publishdocument(@Payload BufferedInputStream payload,
String fileName) throws IOException {</pre>
<pre></pre>
<pre> fileName = getFileName(fileName);</pre>
<pre> //TODO Proceed with your client library.
}
/**
* Parse the content-dispposition parameter and get the file name </pre>
<pre> * out of it.
*
* @param fileName content disposition parameter.
*/
private String getFileName(String fileName) {
String fileNameFinal = null;
if(fileName != null){
String filenameSplit[] = fileName.split(";");
for (String fn : filenameSplit) {
//filename="YT.jpg"
if(fn.contains("filename=")){
fileNameFinal = fn.substring("filename=".length() + 2, </pre>
<pre> fn.length()-1);</pre>
<pre> }
}
}
return fileNameFinal;
}</pre>
<pre>}</pre>
<pre></pre>
<pre></pre>
</td>
</tr>
</tbody>
</table>
<div style="text-align: left;">
</div>
<ul style="text-align: left;">
<li>Code in the UploadConnector.xml.sample file</li>
</ul>
<ol style="text-align: left;">
<li>Name of the method 'publishdocument' must be same as the name in the documentation file. i.e. UploadConnector.xml.sample</li>
<li>Parameter name fileName must be same as specified in the function in the connector.</li>
</ol>
<table border="0" style="background-color: #d0cfc7; text-align: left;">
<tbody>
<tr>
<td><pre></pre>
<pre></pre>
<pre><!-- BEGIN_INCLUDE(uploadconnector:publishdocument) -->
<uploadconnector:publishdocument </pre>
<pre> fileName="#[message.inboundProperties['content-disposition']]" </pre>
<pre> config-ref="uploadconnector"/>
<!-- END_INCLUDE(uploadconnector:publishdocument) --></pre>
<pre></pre>
</td></tr>
</tbody></table>
<br />
<div>
<ul style="text-align: left;">
<li>Entry in the UploadConnector.mflow file.</li>
</ul>
<div>
<ol style="text-align: left;">
<li>Need to specify the host and port property in the properties file. Otherwise one can hard code it.</li>
<li>Path attribute 'publishdocument' must be same as specified in the HTML form bellow. i.e. http://localhost:8081/<b>publishdocument</b></li>
</ol>
</div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
<br /></div>
<table border="0" style="background-color: #d0cfc7; text-align: left;">
<tbody>
<tr>
<td><pre></pre>
<pre></pre>
<pre><http:connector name="httpConnector" doc:name="HTTP\HTTPS">
<service-overrides </pre>
<pre> messageFactory="org.mule.transport.http.HttpMultipartMuleMessageFactory" />
</http:connector></pre>
<pre></pre>
<pre><flow name="publishdocument" doc:name="publishdocument"></pre>
<pre></pre>
<pre> <http:inbound-endpoint connector-ref="httpConnector" </pre>
<pre> exchange-pattern="request-response" host="${http.host}" </pre>
<pre> port="${http.port}" path="publishdocument" doc:name="HTTP"/></pre>
<pre></pre>
<pre> <fusionlive:publishdocument config-ref="uploadconnector" </pre>
<pre> fileName="#[message.inboundProperties['content-disposition']]" </pre>
<pre> doc:name="UploadCon"/></pre>
<pre></flow></pre>
<pre></pre>
<pre></pre>
</td>
</tr>
</tbody>
</table>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
HTML Upload Form
</div>
<div style="text-align: left;">
</div>
<ul style="text-align: left;">
<li>Name of the file type element must be payload.</li>
<li>Method must be post and encrypt attribute must be 'multipart/form-data'</li>
</ul>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
<br /></div>
<table border="0" style="background-color: #d0cfc7; text-align: left;">
<tbody>
<tr>
<td><pre></pre>
<pre><html></pre>
<pre> <head>
<title>UploadConnector</title>
</head>
<body>
</br>
Upload Form
<form action="http://localhost:8081/publishdocument" method="post" </pre>
<pre> enctype="multipart/form-data">
<input type="file" name ="payload"/>
<input type="submit" value="Upload" />
</form></pre>
<pre> </body>
</html></pre>
<pre></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
Yogesh Totarehttp://www.blogger.com/profile/04713983039432517765noreply@blogger.com1tag:blogger.com,1999:blog-3161810555890214288.post-11740422442903195302013-05-21T11:33:00.000+05:302013-05-21T11:33:28.881+05:30Integration with Dropbox including download and upload example.Easy step to integrate the Drop Box with your applications.<br />
<br />
<b>1. Setting up the dropbox account.</b><br />
<br />
<ol>
<li>Create a dropbox account <a href="https://www.dropbox.com/">https://www.dropbox.com/</a></li>
<li>Login to the dropbox</li>
<li>Change the current URL to <a href="https://www.dropbox.com/developers/apps/create">https://www.dropbox.com/developers/apps/create</a></li>
<li>Select app type as core and permission type as <b>full dropbox</b>.</li>
<li>Here you can create a app where you get the app_key and app_secret</li>
<li>This key will be used for the authentication.</li>
</ol>
<b>2. Java code.</b><br />
<div>
<ol>
<li>You will need following jar files to be in classpath.</li>
<ol>
<li>dropbox-client-1.5.3.jar, httpclient-4.0.jar, httpcore-4.0.jar, json-simple-1.1.jar and commons-logging-1.1.jar</li>
</ol>
</ol>
<br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">import java.io.File;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">import java.io.FileInputStream;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">import java.io.FileOutputStream;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">import java.io.InputStream;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">import java.io.OutputStream;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">import java.io.PrintWriter;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">import java.util.Scanner;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><br /></span>
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">import com.dropbox.client2.DropboxAPI;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">import com.dropbox.client2.DropboxAPI.DropboxInputStream;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">import com.dropbox.client2.DropboxAPI.Entry;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">import com.dropbox.client2.exception.DropboxException;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">import com.dropbox.client2.session.AccessTokenPair;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">import com.dropbox.client2.session.AppKeyPair;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">import com.dropbox.client2.session.RequestTokenPair;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">import com.dropbox.client2.session.WebAuthSession;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">import com.dropbox.client2.session.Session.AccessType;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><br /></span>
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">public class DropBoxAuthTest {</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><br /></span>
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// App key & secret that Dropbox's developer website gives your app</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// Key Received @ step 1.5</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private static final String APP_KEY = "your_key";</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// Secret Received @ step 1.5</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private static final String APP_SECRET = "your_secret";</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// Permission type created @ step 1.4</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>final static private AccessType ACCESS_TYPE = AccessType.DROPBOX;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private static DropboxAPI<WebAuthSession> mDBApi;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><br /></span>
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String[] args) throws Exception {</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"> </span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// Initialize the goods/session</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>AppKeyPair appKeys = new AppKeyPair(APP_KEY, APP_SECRET);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>WebAuthSession session = new WebAuthSession(appKeys, ACCESS_TYPE);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// Initialize DropboxAPI object</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>mDBApi = new DropboxAPI<WebAuthSession>(session);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// Get ready for user input</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Scanner input = new Scanner(System.in);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// Open file that stores tokens, MUST exist as a blank file</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>File tokensFile = new File("TOKENS");</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Enter 'a' to authenticate, or 'r' to reauthentication, 'd' to download, 'u' to upload ");</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String command = input.next();</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if(command.equals("a")){</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>try {</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// Present user with URL to allow app access to Dropbox account on</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Please go to this URL and hit \"Allow\": " + DBApi.getSession().getAuthInfo().url);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>AccessTokenPair tokenPair = mDBApi.getSession().getAccessTokenPair();</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// Wait for user to Allow app in browser</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Finished allowing? Enter 'next' if so: ");</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if(input.next().equals("next")){</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>RequestTokenPair tokens = new RequestTokenPair(tokenPair.key,tokenPair.secret);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>mDBApi.getSession().retrieveWebAccessToken(tokens);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>PrintWriter tokenWriter = new PrintWriter(tokensFile);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>tokenWriter.println(session.getAccessTokenPair().key);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>tokenWriter.println(session.getAccessTokenPair().secret);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>tokenWriter.close();</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Authentication Successful!");</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} catch (DropboxException e) {</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>e.printStackTrace();</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} else if(command.equals("r")){</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// Initiate Scanner to read tokens from TOKEN file</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Scanner tokenScanner = new Scanner(tokensFile); </span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String ACCESS_TOKEN_KEY = tokenScanner.nextLine(); // Read key</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String ACCESS_TOKEN_SECRET = tokenScanner.nextLine(); // Read secret</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>tokenScanner.close(); //Close Scanner</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>//Re-auth</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>AccessTokenPair reAuthTokens = new AccessTokenPair(ACCESS_TOKEN_KEY,ACCESS_TOKEN_SECRET);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>mDBApi.getSession().setAccessTokenPair(reAuthTokens);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Re-authentication Sucessful!");</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>//Run test command</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Hello there, " + mDBApi.accountInfo().displayName);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} else if(command.equals("d")){</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>//<span class="Apple-tab-span" style="white-space: pre;"> </span>Initiate Scanner to read tokens from TOKEN file</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Scanner tokenScanner = new Scanner(tokensFile); </span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String ACCESS_TOKEN_KEY = tokenScanner.nextLine(); // Read key</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String ACCESS_TOKEN_SECRET = tokenScanner.nextLine(); // Read secret</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>tokenScanner.close(); //Close Scanner</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>//Re-auth</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>AccessTokenPair reAuthTokens = new AccessTokenPair(ACCESS_TOKEN_KEY,ACCESS_TOKEN_SECRET);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>mDBApi.getSession().setAccessTokenPair(reAuthTokens);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Entry entries = mDBApi.metadata("/", 20, null, true, null);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for (Entry e: entries.contents) {</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if(!e.isDeleted){</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if(e.isDir){</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Folder ---> " + e.fileName() );</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} else {</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// <span class="Apple-tab-span" style="white-space: pre;"> </span>this will download the root level files.</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("File ---->" + e.fileName());</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>DropboxInputStream inputStream = mDBApi.getFileStream(e.path,null);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>OutputStream out=new FileOutputStream(e.fileName());</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>byte buf[]=new byte[1024];</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int len;</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>while((len=inputStream.read(buf))>0)</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>out.write(buf,0,len);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>out.close();</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>inputStream.close();</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("File is created....");</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} else if(command.equals("u")){</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// Initiate Scanner to read tokens from TOKEN file</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Scanner tokenScanner = new Scanner(tokensFile); </span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String ACCESS_TOKEN_KEY = tokenScanner.nextLine(); // Read key</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String ACCESS_TOKEN_SECRET = tokenScanner.nextLine(); // Read secret</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>tokenScanner.close(); //Close Scanner</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>//Re-auth</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>AccessTokenPair reAuthTokens = new AccessTokenPair(ACCESS_TOKEN_KEY, ACCESS_TOKEN_SECRET);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>mDBApi.getSession().setAccessTokenPair(reAuthTokens);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// <span class="Apple-tab-span" style="white-space: pre;"> </span>put Pic1.jpg file in the current directory.</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>File f = new File("Pic2.jpg");</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>InputStream inputStream = new FileInputStream(f);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>mDBApi.putFile("/Photos/", inputStream, f.length(), null, null);</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>inputStream.close();</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Times, 'Times New Roman', serif; font-size: x-small;">}</span><br />
<div style="font-weight: bold;">
<br /></div>
<br />
<b><br /></b>
<b>3. Execution</b><br />
<ol>
<li>When you run the above code, in the console you will asked to prompt for the options like a, r, d and u. </li>
<li>For the very first time you have to type <b>'a'</b>. After typing 'a' you will get an URL. Copy the URL and paste in browser and click on the <b>allow</b> button.</li>
<li>Once this process is done you can run the same program again and try different options like 'd', 'u' and 'r' as per you wish.</li>
</ol>
<b>4) Documentation</b><br />
<ol>
<li>Java api documentation is provided in the following location. <a href="https://www.dropbox.com/static/developers/dropbox-java-sdk-1.5-docs/allclasses-noframe.html">https://www.dropbox.com/static/developers/dropbox-java-sdk-1.5-docs/allclasses-noframe.html</a></li>
</ol>
<br />
<b><br /></b>
</div>
Yogesh Totarehttp://www.blogger.com/profile/04713983039432517765noreply@blogger.com8tag:blogger.com,1999:blog-3161810555890214288.post-87437688524142508442013-04-26T12:42:00.000+05:302013-04-26T12:42:26.930+05:30Java Security Warning : Block potentially unsafe components from being run?<div dir="ltr" style="text-align: left;" trbidi="on">
<b style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 18px;">Cause of the issue: </b><br />
<b style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 18px;"><br /></b>
<span style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 18px;">Signed Java Web Start applications and applets that contain signed and unsigned components could potentially be unsafe unless the mixed code was intended by the application vendor. As of the Java SE 6 Update 19 release, when a program contains both signed and unsigned components, a warning dialog is raised.</span><span style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 18px;"> </span><br />
<span style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 18px;"><br /></span>
<span style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 18px;"><b>Solution : </b></span><br />
<a href="" name="trusted_only" style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; font-size: 14px; text-align: -webkit-auto;"><code style="color: #444444; font-family: 'Courier New', Monaco, Courier, monospace;"><br /></code></a>
<b><code style="color: #444444; font-family: 'Courier New', Monaco, Courier, monospace;">Trusted-Only</code> Attribute</b><br />
<span style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; font-size: 12px; text-align: -webkit-auto;"><br /></span>
<span style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; font-size: 12px; text-align: -webkit-auto;">For applications and applets that do <b>not require unsigned components</b>, the</span><span style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; font-size: 12px; text-align: -webkit-auto;"> </span><code style="color: #444444; font-family: 'Courier New', Monaco, Courier, monospace; font-size: 12px; text-align: -webkit-auto;">Trusted-Only</code><span style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; font-size: 12px; text-align: -webkit-auto;"> </span><span style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; font-size: 12px; text-align: -webkit-auto;">attribute should be used. No warning dialog will be displayed and an application or applet that loads a jar file containing this attribute will not load any untrusted classes or resources. This attribute prevents a signed application or applet from being re-purposed with unsigned components. You can specify</span><span style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; font-size: 12px; text-align: -webkit-auto;"> </span><code style="color: #444444; font-family: 'Courier New', Monaco, Courier, monospace; font-size: 12px; text-align: -webkit-auto;">Trusted-Only</code><span style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; font-size: 12px; text-align: -webkit-auto;">: true in the manifest file. For example:</span><br />
<br />
<blockquote style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; font-size: 12px; text-align: -webkit-auto;">
<pre style="color: #444444; font-family: 'Courier New', Monaco, Courier, monospace;">Manifest-Version: 1.0
Trusted-Only: true
Created-By: 1.6.0-internal (Sun Microsystems Inc.)
</pre>
</blockquote>
<div style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; font-size: 12px; margin-bottom: 17px; margin-top: 3px; text-align: -webkit-auto;">
All classes and resources in the application or applet must be signed and trusted.</div>
<h4 style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 3px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto;">
<code style="color: #444444; font-family: 'Courier New', Monaco, Courier, monospace;">Trusted-Library</code> Attribute</h4>
<div>
<br /></div>
<div style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; font-size: 12px; margin-bottom: 17px; margin-top: 2px; text-align: -webkit-auto;">
For applications and applets that are designed to <b>allow unsigned components</b>, the <code style="color: #444444; font-family: 'Courier New', Monaco, Courier, monospace;">Trusted-Library</code> attribute should be used. No warning dialog will be displayed and an application or applet may load jar files containing untrusted classes or resources. This attribute prevents signed components in an application or applet from being re-purposed with unsigned components. You can specify <code style="color: #444444; font-family: 'Courier New', Monaco, Courier, monospace;">Trusted-Library: true</code> in the manifest file. For example:</div>
<blockquote style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; font-size: 12px; text-align: -webkit-auto;">
<pre style="color: #444444; font-family: 'Courier New', Monaco, Courier, monospace;">Manifest-Version: 1.0
Trusted-Library: true
Created-By: 1.6.0-internal (Sun Microsystems Inc.)
</pre>
</blockquote>
<div style="font-family: Arial, Helvetica, FreeSans, Luxi-sans, 'Nimbus Sans L', sans-serif; font-size: 12px; margin-bottom: 17px; margin-top: 3px; text-align: -webkit-auto;">
All classes and resources in a jar file containing this manifest attribute must be signed and trusted.</div>
<br />
<span style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;"><span style="font-size: 12px; line-height: 18px;">To fix the popup you need to add and extra attribute called <b>Trusted:Library : true</b> into the manifest file.</span></span><br />
<span style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;"><span style="font-size: 12px; line-height: 18px;"><br /></span></span>
<span style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;"><span style="font-size: 12px; line-height: 18px;"><b>How to add attribute to manifest file: </b></span></span><br />
<span style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 18px;"><b><br /></b></span>
<span style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 18px;">Basic command to create a jar file is : </span><br />
<span style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 18px;"><br /></span>
<span style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 18px;"> </span><b><span style="text-align: -webkit-auto;">jar cfm </span><span style="text-align: -webkit-auto;">jar-file manifest-addition input-file(s)</span></b><span style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 18px;"> </span><br />
<span style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 18px;"><br /></span>
<b><span style="text-align: -webkit-auto;">m</span></b><span style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 18px;"> option indicates that you want to merge information from an existing file to the manifest file of the jar file you are creating.</span><br />
<span style="text-align: -webkit-auto;"><tt><b>manifest-addition</b></tt></span><span style="text-align: -webkit-auto;"> </span><span style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 18px;">is the name( or path and name) of the existing text file whose content in our case will be either </span><code style="color: #444444; font-family: 'Courier New', Monaco, Courier, monospace;"><span style="font-size: 12px; text-align: -webkit-auto;">Trusted-Only: true</span><span style="text-align: -webkit-auto;"> </span><span style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 18px;">or </span><span style="font-size: 12px; text-align: -webkit-auto;">Trusted-Library: true</span></code><br />
<span style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;"><span style="font-size: 12px; line-height: 18px;"><br /></span></span>
<span style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 18px;">After the jar is create you have to sign the jar with your certificates and cross check f the manifest files has the correct attributes.</span><br />
<span style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 18px;"><br /></span></div>
Yogesh Totarehttp://www.blogger.com/profile/04713983039432517765noreply@blogger.com7tag:blogger.com,1999:blog-3161810555890214288.post-42645370960157230542013-04-26T12:11:00.001+05:302013-04-26T12:14:08.962+05:30Liveconnect call for Applet ID * is not allowed in this JVM instance <div dir="ltr" style="text-align: left;" trbidi="on">
<br />
The fix is to change the MANIFEST.MF file to have a Trusted-Library:true instead of Trusted-Only :true.<br />
<br />
MANIFIEST.MF File should have the following three line and code signing classes :<br />
<br />
<b>Manifest-Version: 1.0</b><br />
<b>Trusted-Library: true</b><br />
<b>Created-By: 1.6.0_16 (Sun Microsystems Inc.)</b><br />
<br />
<b>Modifying the manifest file :</b><br />
<br />
<div style="text-align: -webkit-auto;">
The basic command has this format:</div>
<div class="codeblock" style="margin-bottom: 0px; margin-left: 30px; margin-right: 30px; margin-top: 0px; text-align: -webkit-auto;">
<pre>jar cfm <i>jar-file manifest-addition input-file(s)</i></pre>
</div>
<div style="text-align: -webkit-auto;">
Let's look at the options and arguments used in this command:</div>
<ul style="text-align: -webkit-auto;">
<li>The <tt>c</tt> option indicates that you want to <em>create</em> a JAR file.</li>
<li>The <tt>m</tt> option indicates that you want to merge information from an existing file into the manifest file of the JAR file you're creating.</li>
<li>The <tt>f</tt> option indicates that you want the output to go to a <em>file</em> (the JAR file you're creating) rather than to standard output.</li>
<li><em><tt>manifest-addition</tt></em> is the name (or path and name) of the existing text file whose contents you want to add to the contents of JAR file's manifest.</li>
<li><em><tt>jar-file</tt></em> is the name that you want the resulting JAR file to have.</li>
<li>The <em><tt>input-file(s)</tt></em> argument is a space-separated list of one or more files that you want to be placed in your JAR file.</li>
</ul>
<div style="text-align: -webkit-auto;">
The <tt>m</tt> and <tt>f</tt> options must be in the same order as the corresponding arguments.</div>
<div style="text-align: -webkit-auto;">
<br /></div>
<div style="text-align: -webkit-auto;">
example : jar cvfm Test.jar manifestTest.text Upload.java</div>
<div style="text-align: -webkit-auto;">
<br /></div>
<div style="text-align: -webkit-auto;">
and <b>manifestTest.text</b> will have the <span style="text-align: left;">Trusted-Library: true line</span><span style="text-align: left;">.</span></div>
<div style="text-align: -webkit-auto;">
<br /></div>
<br /></div>
Yogesh Totarehttp://www.blogger.com/profile/04713983039432517765noreply@blogger.com1tag:blogger.com,1999:blog-3161810555890214288.post-61081975550901870942011-09-29T18:27:00.000+05:302011-09-29T18:28:54.384+05:30Extjs Applet Integration<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
In recent years most of the systems are getting upgraded with the new User Interface and Extjs is once of the most widely used technology for the rich look and feel. In most of the domain mostly in DMS (Document Management System) upload and download functionality is provided. To achieve the performance most of the system uses applets for upload and downloading the content from the systems. One of the major problem with applet is they used different tags (applet, object and embed) for different browsers. I came across such issues so decided to write a blog on it.</div>
<br />
To achieve the mention problem i am writing few steps that will be helpful to you guys.<br />
<br />
1) Create a <b>main.html</b> page and in the same directory put the <span class="Apple-style-span" style="background-color: white;"><b>ext-base.js </b>and<b> ext-all.js files</b>.</span><br />
<br />
<table border="1" cellpadding="0" cellspacing="0" style="background-color: lavender; border-bottom-style: hidden; border-left-style: hidden; border-right-style: hidden; border-top-style: hidden;"><tbody>
<tr><td><br />
<br />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><br />
<html><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><head><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><script type="text/javascript" src="ext-base.js"></script><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><script type="text/javascript" src="ext-all.js"></script><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><script type="text/javascript" src="applet.js"></script><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><script><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Ext.onReady(function(){<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-style-span" style="white-space: pre;"> my.appletRenderer.getFileSelector();</span><br />
<span class="Apple-style-span" style="white-space: pre;"> my.appletRenderer.getUploadApplet();</span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>});<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span></script><span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span></head><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><body scroll="no"><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><div id="center"><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><div id="x-desktop"><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><div id="center-panel-container" style="background:transparent;"></div><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span></div><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span></div><span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span></body><br />
</html><br />
<br />
<div>
<br /></div>
</td></tr>
</tbody></table>
<br />
2) Create an <b>applet.js</b> file in the same directory with following contents.<br />
<br />
<br />
<table border="1" cellpadding="0" cellspacing="0" style="background-color: lavender; border-bottom-style: hidden; border-left-style: hidden; border-right-style: hidden; border-top-style: hidden;"><tbody>
<tr><td>my.appletRenderer = {<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>getFileSelector : function() {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (new ActiveXObject("Scripting.Dictionary") != null) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return this.getActiveXFileSelector();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>} else {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return this.getSwingFileSelector();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>},<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>getSwingFileSelector : function(){<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (Ext.isIE || Ext.isChrome) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (Ext.isIE8 ) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return new Ext.Panel({<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>renderTo: <span class="Apple-tab-span" style="white-space: pre;"> </span>'center-panel-container',<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>height<span class="Apple-tab-span" style="white-space: pre;"> </span>: <span class="Apple-tab-span" style="white-space: pre;"> </span>0,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>html<span class="Apple-tab-span" style="white-space: pre;"> </span>: <span class="Apple-tab-span" style="white-space: pre;"> </span>'<object ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'id = "SwingFileSelectorApplet" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'name="SwingFileSelectorApplet" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'codebase="" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'archive="" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'code="" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'cache_archive="" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'cache_version="" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'width="0" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'height="0" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'mayscript="true" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'bodyStyle="display:none;"> ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'</object>'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>});<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}else{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return new Ext<span class="Apple-style-span">.Panel({</span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>renderTo:<span class="Apple-tab-span" style="white-space: pre;"> </span>'center-panel-container',<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>height <span class="Apple-tab-span" style="white-space: pre;"> </span>: <span class="Apple-tab-span" style="white-space: pre;"> </span>0,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>html <span class="Apple-tab-span" style="white-space: pre;"> </span>: <span class="Apple-tab-span" style="white-space: pre;"> </span>'<applet ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'id="SwingFileSelectorApplet" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'name="SwingFileSelectorApplet" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'codebase="" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'archive="" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'code="" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'width=0 ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'height=0 ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'mayscript="true">' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'<param name="cache_archive" value="" />'+<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'<param name="cache_version" value="" />'+<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'</applet>'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>});<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}else{<br />
<span class="Apple-style-span"><span class="Apple-tab-span" style="white-space: pre;"> </span>return new </span>Ext<span class="Apple-style-span">.Panel({</span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>renderTo:<span class="Apple-tab-span" style="white-space: pre;"> </span>'center-panel-container',<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>height <span class="Apple-tab-span" style="white-space: pre;"> </span>: <span class="Apple-tab-span" style="white-space: pre;"> </span>0,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>html<span class="Apple-tab-span" style="white-space: pre;"> </span>:<span class="Apple-tab-span" style="white-space: pre;"> </span>'<EMBED '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'id="SwingFileSelectorApplet" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'name="SwingFileSelectorApplet" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'codebase="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'archive="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'code="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'type="application/x-java-applet;version=1.4" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'cache_archive="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'cache_version="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'EMBEDDED="true" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'mayscript="true" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'width="0" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'height="0"> '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ '<NOEMBED> No Java 2 SDK, Standard Edition v 1.4.1 support for APPLET!! </NOEMBED> '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ '</EMBED>'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>});<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>},<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>getActiveXFileSelector : function() {<br />
<span class="Apple-style-span"><span class="Apple-tab-span" style="white-space: pre;"> </span>return new </span>Ext<span class="Apple-style-span">.Panel({</span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>renderTo:'center-panel-container',<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>height : 0,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>html : <span class="Apple-tab-span" style="white-space: pre;"> </span>' <object classid="" align="baseline" border="0">'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ <span class="Apple-tab-span" style="white-space: pre;"> </span>'<param name="LPKPath" value="">'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ '</object>'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ '<object classid="" codebase="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ <span class="Apple-tab-span" style="white-space: pre;"> </span>'VIEWASTEXT name="fileDialog" id="CommonDialog1"><param NAME="CancelError" VALUE="0">'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+<span class="Apple-tab-span" style="white-space: pre;"> </span>'<param NAME="DialogTitle" VALUE="'+ fs.locale.write("docUpload", "selectFile") +'">'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+<span class="Apple-tab-span" style="white-space: pre;"> </span>'<param NAME="" VALUE=""><param NAME="" VALUE="">'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+'</object>'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>});<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>},<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>getUploadApplet : function(){<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if(Ext.isWindows){<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return this.getWindowsUploadApplet();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>else{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return this.getUnixUploadApplet();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>},<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>getWindowsUploadApplet : function(){<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (Ext.isIE) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (Ext.isIE8 ) {<br />
<span class="Apple-style-span"><span class="Apple-tab-span" style="white-space: pre;"> </span>return new </span>Ext<span class="Apple-style-span">.Panel({</span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>renderTo:'center-panel-container',<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>height : 0,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>html : <span class="Apple-tab-span" style="white-space: pre;"> </span>'<object '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'id = "FileUpload" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'name="FileUpload" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'codebase="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'archive="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'code="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'width=0 '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'height=0 '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'mayscript="true" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'bodyStyle="display:none;">'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ '<param name="cache_archive" value="" />'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ '<param name="cache_version" value="" />'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ '</object>'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>});<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}else{<br />
<span class="Apple-style-span"><span class="Apple-tab-span" style="white-space: pre;"> </span>return new </span>Ext<span class="Apple-style-span">.Panel({</span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>renderTo:'center-panel-container',<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>height : 0,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>html : <span class="Apple-tab-span" style="white-space: pre;"> </span>'<applet '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'id = "FileUpload" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'name="FileUpload" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'codebase="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'archive="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'code="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'width=0 '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'height=0 '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'mayscript="true" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'bodyStyle="display:none;">'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ '<param name="cache_archive" value="" />'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ '<param name="cache_version" value="" />'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ '</applet>'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>});<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}else if (Ext.isChrome) {<br />
<span class="Apple-style-span"><span class="Apple-tab-span" style="white-space: pre;"> </span>return new </span>Ext<span class="Apple-style-span">.Panel({</span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>renderTo:'center-panel-container',<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>height : 0,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>html : <span class="Apple-tab-span" style="white-space: pre;"> </span>'<applet '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'id = "FileUpload" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'name="FileUpload" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'codebase="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'archive="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'code="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'width=0 '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'height=0 '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'mayscript="true" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'bodyStyle="display:none;">'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ '<param name="cache_archive" value="" />'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ '<param name="cache_version" value="" />'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ '</applet>'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>});<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}else{<br />
<span class="Apple-style-span"><span class="Apple-tab-span" style="white-space: pre;"> </span>return new </span>Ext<span class="Apple-style-span">.Panel({</span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>renderTo:<span class="Apple-tab-span" style="white-space: pre;"> </span>'center-panel-container',<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>height <span class="Apple-tab-span" style="white-space: pre;"> </span>: <span class="Apple-tab-span" style="white-space: pre;"> </span>0,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>html<span class="Apple-tab-span" style="white-space: pre;"> </span>:<span class="Apple-tab-span" style="white-space: pre;"> </span>'<EMBED ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'id="FileUpload" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'name="FileUpload" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'codebase="" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'archive="" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'code="" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'type="application/x-java-applet;version=1.4" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'cache_version="" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'cache_archive="" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'width="0" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'height="0" ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'mayscript="true"> ' +<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'<NOEMBED> No Java 2 SDK, Standard Edition v 1.4.1 support for APPLET!! </NOEMBED>'+<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>'</EMBED>'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>});<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>},<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>getUnixUploadApplet : function(){<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-style-span"><span class="Apple-tab-span" style="white-space: pre;"> </span>return new </span>Ext<span class="Apple-style-span">.Panel({</span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>renderTo:'center-panel-container',<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>height : 0,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>html : <span class="Apple-tab-span" style="white-space: pre;"> </span>'<applet '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'id = "FileUpload" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'name="FileUpload" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'codebase="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'archive="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'code="" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'width=0 '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'height=0 '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'mayscript="true" '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ 'bodyStyle="display:none;">'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ '<param name="cache_archive" value="" />'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ '<param name="cache_version" value="" />'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>+ '</applet>'<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>});<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
}<br />
<br />
<div>
<br /></div>
</td></tr>
</tbody></table>
<br />
<br />
3) In the <b>applet.js</b> file if you pass the proper values of the attribute which i have kept blank like codebase, archive,code,classid etc. the applets will get render.<br />
<br />
4) View the <b>main.html</b> and view source the applets be enabled.<br />
<br />
5) And this code will work for almost all the browser and OS. (Only you need to create your own jar files operating system specific)<br />
<br />
6) Same check can be applied for the download and other applet.<br />
<div>
<br /></div>
</div>
Yogesh Totarehttp://www.blogger.com/profile/04713983039432517765noreply@blogger.com0tag:blogger.com,1999:blog-3161810555890214288.post-2768110490657658912011-09-27T15:50:00.000+05:302011-09-28T14:08:16.821+05:30Extjs Fix For Firefox Text overflow.<div dir="ltr" style="text-align: left;" trbidi="on">
<title>HTML Online Editor Sample</title>
<br />
<div style="text-align: justify;">
<span class="Apple-style-span" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"> In the recent Extjs development i faced an issue related to the content overflow for Firefox. i was retrieving a data from the DB table which is having the CLOB field. CLOB type filed is used to store a data more than 4k. The CLOB field in My XML response have a data of around 8k. So i was not able to see the full data (8k) of that field. i was able to see only the 4k data in the Extjs text area. After doing a search i have got the following information.</span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">
<br /></div>
<div style="margin-bottom: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">
<span class="Apple-style-span" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"><span class="Apple-style-span" style="border-collapse: collapse; font-size: 14px; line-height: 18px;"> A text node in Firefox allows only 4K data. So an XML Ajax response gets split up into multiple text child nodes instead of only one node. Its fine in Internet Explorer(only up to 64k) and opera (only up to 32k). For Firefox, to get the full data you either need to use <b>node.normalize()</b> before you call <b>node.firstChild</b> or use <b>node.textContent</b>, or user <b>node.wholeText</b> both of which are Mozilla specific methods.</span></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"><span class="Apple-style-span" style="border-collapse: collapse; font-size: 14px; line-height: 18px;">To fix this issue in Extjs i did the following steps.</span></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"><span class="Apple-style-span" style="border-collapse: collapse; font-size: 14px; line-height: 18px;">If you are using the XmlReader then you need to override it.</span></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"><span class="Apple-style-span" style="border-collapse: collapse; font-size: 14px; line-height: 18px;"><br /></span></span></div>
<table border="1" cellpadding="1" cellspacing="0" style="width: 100%;">
<tbody>
<tr>
<td>/**<br />
<div>
* Copyright(c) 1998-2009, Sword-global.</div>
<div>
* </div>
<div>
* The class represents a custom XML reader component for FusionSaas. Hold</div>
<div>
* handle to the current viewer and configuration parameters for XML Reader.</div>
<div>
* </div>
<div>
*/</div>
<div>
my.XmlReader=Ext.extend(Ext.data.XmlReader,{</div>
<div>
constructor: function(meta, recordType){</div>
<div>
my.XmlReader.superclass.constructor.call(this, meta, (recordType || meta.fields));</div>
<div>
},</div>
<div>
</div>
<div>
/**</div>
<div>
* Create a data block containing Ext.data.Records from an XML document.</div>
<div>
* @param {Object} doc A parsed XML document.</div>
<div>
* @return {Object} records A data block which is used by an {@link Ext.data.Store} as</div>
<div>
* a cache of Ext.data.Records.</div>
<div>
*/</div>
<div>
</div>
<div>
readRecords : function(doc){</div>
<div>
this.xmlData = doc;</div>
<div>
var root = doc.documentElement || doc;</div>
<div>
var q = Ext.DomQuery;</div>
<div>
var recordType = this.recordType, fields = recordType.prototype.fields;</div>
<div>
var sid = this.meta.idPath || this.meta.id;</div>
<div>
var totalRecords = 0, success = true;</div>
<div>
if(this.meta.totalRecords){</div>
<div>
totalRecords = q.selectNumber(this.meta.totalRecords, root, 0);</div>
<div>
}</div>
<div>
</div>
<div>
if(this.meta.success){</div>
<div>
var sv = q.selectValue(this.meta.success, root, true);</div>
<div>
success = sv !== false && sv !== 'false';</div>
<div>
}</div>
<div>
var records = [];</div>
<div>
var ns = q.select(this.meta.record, root);</div>
<div>
for(var i = 0, len = ns.length; i < len; i++) {</div>
<div>
var n = ns[i];</div>
<div>
var values = {};</div>
<div>
var id = sid ? q.selectValue(sid, n) : undefined;</div>
<div>
for(var j = 0, jlen = fields.length; j < jlen; j++){</div>
<div>
var f = fields.items[j];</div>
<div>
var v = this.selectMoreThan4KValue(Ext.value(f.mapping, f.name, true), n, f.defaultValue);</div>
<div>
v = f.convert(v, n);</div>
<div>
values[f.name] = v;</div>
<div>
}</div>
<div>
var record = new recordType(values, id);</div>
<div>
record.node = n;</div>
<div>
records[records.length] = record;</div>
<div>
}</div>
<div>
</div>
<div>
return {</div>
<div>
success : success,</div>
<div>
records : records,</div>
<div>
totalRecords : totalRecords || records.length</div>
<div>
};</div>
<div>
},</div>
<div>
</div>
<div>
selectMoreThan4KValue : function(path, root, defaultValue){</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>trimRe = /^\s+|\s+$/g</div>
<div>
path = path.replace(trimRe, "");</div>
<div>
valueCache = {};</div>
<div>
if(!valueCache[path]){</div>
<div>
valueCache[path] = Ext.DomQuery.compile(path, "select");</div>
<div>
}</div>
<div>
var n = valueCache[path](root),</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>v;</div>
<div>
n = n[0] ? n[0] : n;</div>
<div>
if(n && Ext.isGecko){</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>v = (n && n.firstChild ? n.firstChild.wholeText : null);</div>
<div>
}else{</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>v = (n && n.firstChild ? n.firstChild.nodeValue : null);</div>
<div>
}</div>
<div>
return ((v === null||v === undefined||v==='') ? defaultValue : v);</div>
<div>
}</div>
<div>
});</div>
</td>
</tr>
</tbody>
</table>
</div>
Yogesh Totarehttp://www.blogger.com/profile/04713983039432517765noreply@blogger.com0Pune, Maharashtra, India18.5204303 73.856743718.3999798 73.6988152 18.6408808 74.014672199999993tag:blogger.com,1999:blog-3161810555890214288.post-54062808151385374602011-09-06T18:06:00.000+05:302011-09-12T13:21:01.259+05:30mxGraph Extjs Integration<div dir="ltr" style="text-align: left;" trbidi="on">
<title>HTML Online Editor Sample</title>
<br />
This article will help you to integrate the mxGraph in the Extjs.<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
Follow the following steps to create a setup.</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
1) Create a folder named <strong>mxgraph_extjs_integrtion</strong>.</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
2) Download <strong>ext-all.js, ext-base.js and mxClient.js</strong> files into mxgraph_extjs_integrtion folder.</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
3) Create a <strong>MxGraphExtjsIntegration.html</strong> file in the same folder with the following content.</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
<table border="1" cellpadding="0" cellspacing="0" style="background-color: lavender; border-style: hidden;">
<tbody>
<tr>
<td><br />
<div>
<html></div>
<div style="margin-left: 40px;">
<head></div>
<div style="margin-left: 80px;">
<title>Integrating mxGraph with Extjs</title></div>
<div style="margin-left: 80px;">
<style></div>
<div style="margin-left: 120px;">
div.styled {</div>
<div style="margin-left: 120px;">
border-width:2px;</div>
<div style="margin-left: 120px;">
border-color:#ff9900;</div>
<div style="margin-left: 120px;">
border-style: solid solid solid solid;</div>
<div style="margin-left: 120px;">
background: url('workflow-designer/grid_10.png');</div>
<div style="margin-left: 120px;">
}</div>
<div style="margin-left: 80px;">
</style></div>
<div style="margin-left: 80px;">
<script type="text/javascript" src="ext-base.js"></script></div>
<div style="margin-left: 80px;">
<script type="text/javascript" src="ext-all.js"></script></div>
<div style="margin-left: 80px;">
<script type="text/javascript" src="mxClient.js"></script> </div>
<div style="margin-left: 80px;">
<script></div>
<div style="margin-left: 80px;">
</div>
<div style="margin-left: 120px;">
Ext.onReady(function(){</div>
<div style="margin-left: 160px;">
var centerDiv <span class="Apple-tab-span" style="white-space: pre;"> </span>= document.getElementById('center-panel-container');</div>
<div style="margin-left: 160px;">
var mainDiv <span class="Apple-tab-span" style="white-space: pre;"> </span>= document.createElement('div');</div>
<div style="margin-left: 160px;">
mainDiv.id <span class="Apple-tab-span" style="white-space: pre;"> </span>= 'workflow-designer-main-panel';</div>
<div style="margin-left: 160px;">
// Process Container</div>
<div style="margin-left: 160px;">
var graphDiv= document.createElement('div');<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 160px;">
graphDiv.id = 'graph';</div>
<div style="margin-left: 160px;">
graphDiv.style.width = '900px';</div>
<div style="margin-left: 160px;">
graphDiv.style.height = '600px';</div>
<div style="margin-left: 160px;">
graphDiv.style.top = '30px';</div>
<div style="margin-left: 160px;">
graphDiv.className = 'styled';</div>
<div style="margin-left: 160px;">
// Toolbar</div>
<div style="margin-left: 160px;">
var tbarDiv = document.createElement('div');</div>
<div style="margin-left: 160px;">
tbarDiv.id = 'toolbar';</div>
<div style="margin-left: 160px;">
tbarDiv.style.height = '24px';</div>
<div style="margin-left: 160px;">
tbarDiv.style.left= '300px';</div>
<div style="margin-left: 160px;">
tbarDiv.style.width = '500px';</div>
<div style="margin-left: 160px;">
tbarDiv.style.overflow = 'hidden';</div>
<div style="margin-left: 160px;">
tbarDiv.style.display = 'block';</div>
<div style="margin-left: 160px;">
tbarDiv.style.position = 'absolute';</div>
<div style="margin-left: 160px;">
</div>
<div style="margin-left: 160px;">
mainDiv.appendChild(tbarDiv);</div>
<div style="margin-left: 160px;">
mainDiv.appendChild(graphDiv);<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 160px;">
centerDiv.appendChild(mainDiv);<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 160px;">
</div>
<div style="margin-left: 160px;">
new loadWFConfig('fsworkflowconfig.xml');</div>
<div style="margin-left: 120px;">
</div>
<div style="margin-left: 120px;">
});</div>
<div style="margin-left: 120px;">
</div>
<div style="margin-left: 120px;">
selectionChanged = function(graph) {</div>
<div style="margin-left: 120px;">
};</div>
<div style="margin-left: 120px;">
</div>
<div style="margin-left: 120px;">
loadWFConfig = function(config) {</div>
<div style="margin-left: 160px;">
try {</div>
<div style="margin-left: 200px;">
if (!mxClient.isBrowserSupported()) {</div>
<div style="margin-left: 240px;">
mxUtils.error('Browser is not supported!', 200, false);</div>
<div style="margin-left: 200px;">
}else {</div>
<div style="margin-left: 240px;">
var node = mxUtils.load(config).getDocumentElement();</div>
<div style="margin-left: 240px;">
var editor = new mxEditor(node);</div>
<div style="margin-left: 200px;">
}</div>
<div style="margin-left: 160px;">
} catch (e) {</div>
<div style="margin-left: 200px;">
// Shows an error message if the editor cannot start</div>
<div style="margin-left: 200px;">
mxUtils.alert('Cannot start application: ' + e.message);</div>
<div style="margin-left: 200px;">
throw e; // for debugging</div>
<div style="margin-left: 160px;">
}</div>
<div style="margin-left: 160px;">
return editor;</div>
<div style="margin-left: 120px;">
};</div>
<div style="margin-left: 120px;">
</div>
<div style="margin-left: 120px;">
onInit = function(editor, isFirstTime){</div>
<div style="margin-left: 160px;">
mxEvent.disableContextMenu(document.body);</div>
<div style="margin-left: 160px;">
editor.validation = true;</div>
<div style="margin-left: 160px;">
var editorGraph = editor.graph;</div>
<div style="margin-left: 160px;">
// Defines an icon for creating new connections in the connection handler.</div>
<div style="margin-left: 160px;">
// This will automatically disable the highlighting of the source vertex.</div>
<div style="margin-left: 160px;">
mxConnectionHandler.prototype.connectImage = new mxImage('workflow-designer/connector.gif', 16, 16);</div>
<div style="margin-left: 160px;">
// Highlights the vertices when the mouse enters</div>
<div style="margin-left: 160px;">
var highlight = new mxCellTracker(editorGraph, '#999900');</div>
<div style="margin-left: 160px;">
editorGraph.setConnectable(true);</div>
<div style="margin-left: 160px;">
editorGraph.setDropEnabled(true);</div>
<div style="margin-left: 160px;">
editorGraph.setPanning(true);</div>
<div style="margin-left: 160px;">
editorGraph.setTooltips(true);</div>
<div style="margin-left: 160px;">
editorGraph.setAllowDanglingEdges(false);</div>
<div style="margin-left: 160px;">
editorGraph.connectionHandler.setCreateTarget(true);</div>
<div style="margin-left: 160px;">
</div>
<div style="margin-left: 160px;">
mxGraphHandler.prototype.cloneEnabled = false;</div>
<div style="margin-left: 160px;">
// Sets the cursor</div>
<div style="margin-left: 160px;">
editorGraph.container.style.cursor = 'default';</div>
<div style="margin-left: 160px;">
</div>
<div style="margin-left: 160px;">
var listener = function(sender, evt){</div>
<div style="margin-left: 160px;">
// This code tests to see if a node is dragged to less than the far left or top and</div>
<div style="margin-left: 160px;">
// if so, re-positions it at the 0px left or top</div>
<div style="margin-left: 160px;">
try{</div>
<div style="margin-left: 200px;">
var change = evt.properties.changes[0];</div>
<div style="margin-left: 200px;">
var cell = change.hasOwnProperty("cell") ? change.cell : change.child;</div>
<div style="margin-left: 200px;">
var geometry = cell.getGeometry();</div>
<div style="margin-left: 200px;">
var x = geometry.x;</div>
<div style="margin-left: 200px;">
var y = geometry.y;</div>
<div style="margin-left: 200px;">
if(x < 0) geometry.x = 10;</div>
<div style="margin-left: 200px;">
if(y < 0) geometry.y = 10;</div>
<div style="margin-left: 200px;">
if(x < 0 || y < 0){</div>
<div style="margin-left: 200px;">
cell.setGeometry(geometry);</div>
<div style="margin-left: 240px;">
editorGraph.refresh();</div>
<div style="margin-left: 200px;">
}<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 160px;">
}</div>
<div style="margin-left: 160px;">
catch(e){}</div>
<div style="margin-left: 200px;">
// Perform validation after any change</div>
<div style="margin-left: 200px;">
editorGraph.validateGraph();</div>
<div style="margin-left: 160px;">
};</div>
<div style="margin-left: 160px;">
</div>
<div style="margin-left: 160px;">
editorGraph.model.addListener(mxEvent.CHANGE, listener);</div>
<div style="margin-left: 160px;">
// Creates rubberband selection</div>
<div style="margin-left: 160px;">
//var rubberband = new mxRubberband(editorGraph);</div>
<div style="margin-left: 160px;">
// Stop cells from being resized - this stops distortion of teh graphic and over / undersize imagery</div>
<div style="margin-left: 160px;">
editorGraph.setCellsResizable(false);</div>
<div style="margin-left: 160px;">
// mxCellAttributeChange to change properties</div>
<div style="margin-left: 160px;">
// Implements a properties panel that uses<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 160px;">
editorGraph.getSelectionModel().addListener(mxEvent.CHANGE, function(sender, evt){</div>
<div style="margin-left: 160px;">
//fs.BPDefinition.hasChange = true;</div>
<div style="margin-left: 160px;">
selectionChanged(editorGraph);</div>
<div style="margin-left: 160px;">
});<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 120px;">
};</div>
<div style="margin-left: 80px;">
</script></div>
<div style="margin-left: 40px;">
</head></div>
<div style="margin-left: 40px;">
<body></div>
<div style="margin-left: 80px;">
<div id="center-panel-container" ></div>
<div style="margin-left: 80px;">
</div></div>
<div style="margin-left: 40px;">
</body></div>
<div>
</html></div>
</td>
</tr>
</tbody>
</table>
<br />
4) Create a file named <strong>fsworkflowconfig.xml </strong>in the same folder with following content.<br />
<br />
<table border="1" cellpadding="0" cellspacing="0" style="background-color: lavender; border-style: hidden;">
<tbody>
<tr>
<td><br />
<div>
<mxEditor defaultGroup="group" defaultEdge="Connector"></div>
<div style="margin-left: 40px;">
<add as="onInit"><![CDATA[</div>
<div style="margin-left: 80px;">
function (isFirstTime){</div>
<div style="margin-left: 80px;">
onInit(this, isFirstTime);</div>
<div style="margin-left: 80px;">
}</div>
<div style="margin-left: 80px;">
]]></div>
<div style="margin-left: 40px;">
</add></div>
<div style="margin-left: 40px;">
<ui></div>
<div style="margin-left: 80px;">
<add as="graph" element="graph"/></div>
<div style="margin-left: 80px;">
<add as="toolbar" element="toolbar"/></div>
<div style="margin-left: 40px;">
</ui></div>
<div style="margin-left: 40px;">
<Array as="templates"></div>
<div style="margin-left: 80px;">
<add as="group"></div>
<div style="margin-left: 120px;">
<group name="Group" style="group" description=" "></div>
<div style="margin-left: 160px;">
<mxCell vertex="1" style="group" connectable="0"/></div>
<div style="margin-left: 120px;">
</group></div>
<div style="margin-left: 80px;">
</add></div>
<div style="margin-left: 80px;">
<add as="Connector"></div>
<div style="margin-left: 120px;">
<connector name="Connector" style="connector" transitionAction=" " actionRequired=" " description=" "></div>
<div style="margin-left: 160px;">
<mxCell edge="1"></div>
<div style="margin-left: 200px;">
<mxGeometry as="geometry" relative="1"/></div>
<div style="margin-left: 160px;">
</mxCell></div>
<div style="margin-left: 120px;">
</connector></div>
<div style="margin-left: 80px;">
</add></div>
<div style="margin-left: 80px;">
</div>
<div style="margin-left: 80px;">
<add as="text"></div>
<div style="margin-left: 120px;">
<Text name="Label" style="text" fsStyle=" " description=" "></div>
<div style="margin-left: 160px;">
<mxCell vertex="1" style="text" connectable="0"><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 200px;">
<mxGeometry as="geometry" width="120" height="40"/></div>
<div style="margin-left: 160px;">
</mxCell></div>
<div style="margin-left: 120px;">
</Text></div>
<div style="margin-left: 80px;">
</add></div>
<div style="margin-left: 80px;">
</div>
<div style="margin-left: 80px;">
<add as="start"></div>
<div style="margin-left: 120px;">
<start name="Start" style="start" description=" "></div>
<div style="margin-left: 160px;">
<mxCell vertex="1" style="start"><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 200px;">
<mxGeometry as="geometry" width="40" height="40"/></div>
<div style="margin-left: 160px;">
</mxCell></div>
<div style="margin-left: 120px;">
</start></div>
<div style="margin-left: 80px;">
</add></div>
<div style="margin-left: 80px;">
<add as="activity"></div>
<div style="margin-left: 120px;">
<activity name="Activity" style="activity" form=" " formId=" " description=" "></div>
<div style="margin-left: 160px;">
<mxCell vertex="1" style="activity"><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 200px;">
<mxGeometry as="geometry" width="80" height="50"/></div>
<div style="margin-left: 160px;">
</mxCell></div>
<div style="margin-left: 120px;">
</activity></div>
<div style="margin-left: 80px;">
</add></div>
<div style="margin-left: 80px;">
<add as="agent"></div>
<div style="margin-left: 120px;">
<agent name="Agent" style="agent" classname="" type="External" description=" "></div>
<div style="margin-left: 160px;">
<mxCell vertex="1" style="agent"><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 200px;">
<mxGeometry as="geometry" width="80" height="80"/></div>
<div style="margin-left: 160px;">
</mxCell></div>
<div style="margin-left: 120px;">
</agent></div>
<div style="margin-left: 80px;">
</add></div>
<div style="margin-left: 80px;">
<add as="timer"></div>
<div style="margin-left: 120px;">
<timer name="Timer" style="timer"></div>
<div style="margin-left: 160px;">
<mxCell vertex="1" style="timer"><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 200px;">
<mxGeometry as="geometry" width="80" height="80"/></div>
<div style="margin-left: 160px;">
</mxCell></div>
<div style="margin-left: 120px;">
</timer></div>
<div style="margin-left: 80px;">
</add><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 80px;">
<add as="cancel"></div>
<div style="margin-left: 120px;">
<cancel name="Cancel" style="cancel" description=" "></div>
<div style="margin-left: 160px;">
<mxCell vertex="1" style="cancel"><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 200px;">
<mxGeometry as="geometry" width="40" height="40"/></div>
<div style="margin-left: 160px;">
</mxCell></div>
<div style="margin-left: 120px;">
</cancel></div>
<div style="margin-left: 80px;">
</add><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 80px;">
<add as="finish"></div>
<div style="margin-left: 120px;">
<finish name="Finish" style="finish" description=" "></div>
<div style="margin-left: 160px;">
<mxCell vertex="1" style="finish"><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 200px;">
<mxGeometry as="geometry" width="40" height="40"/></div>
<div style="margin-left: 160px;">
</mxCell></div>
<div style="margin-left: 120px;">
</finish></div>
<div style="margin-left: 80px;">
</add><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 80px;">
<add as="andjoin"></div>
<div style="margin-left: 120px;">
<andjoin name="AND-Join" style="andjoin" description=" "></div>
<div style="margin-left: 160px;">
<mxCell vertex="1" style="andjoin"><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 200px;">
<mxGeometry as="geometry" width="40" height="40"/></div>
<div style="margin-left: 160px;">
</mxCell></div>
<div style="margin-left: 120px;">
</andjoin></div>
<div style="margin-left: 80px;">
</add></div>
<div style="margin-left: 80px;">
<add as="orjoin"></div>
<div style="margin-left: 120px;">
<orjoin name="OR-Join" style="orjoin" description=" "></div>
<div style="margin-left: 160px;">
<mxCell vertex="1" style="orjoin"><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 200px;">
<mxGeometry as="geometry" width="40" height="40"/></div>
<div style="margin-left: 160px;">
</mxCell></div>
<div style="margin-left: 120px;">
</orjoin></div>
<div style="margin-left: 80px;">
</add><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 80px;">
<add as="andsplit"></div>
<div style="margin-left: 120px;">
<andsplit name="AND-Split" style="andsplit" description=" "></div>
<div style="margin-left: 160px;">
<mxCell vertex="1" style="andsplit"><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 200px;">
<mxGeometry as="geometry" width="40" height="40"/></div>
<div style="margin-left: 160px;">
</mxCell></div>
<div style="margin-left: 120px;">
</andsplit></div>
<div style="margin-left: 80px;">
</add><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 80px;">
<add as="decision"></div>
<div style="margin-left: 120px;">
<decision name="Decision" style="decision" description=" " expression=" "></div>
<div style="margin-left: 160px;">
<mxCell vertex="1" style="decision"><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 200px;">
<mxGeometry as="geometry" width="40" height="40"/></div>
<div style="margin-left: 160px;">
</mxCell></div>
<div style="margin-left: 120px;">
</decision></div>
<div style="margin-left: 80px;">
</add><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 80px;">
<add as="conditionalor"></div>
<div style="margin-left: 120px;">
<conditionalor name="Conditional-OR" style="conditionalor" description=" "></div>
<div style="margin-left: 160px;">
<mxCell vertex="1" style="conditionalor"><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 200px;">
<mxGeometry as="geometry" width="40" height="80"/></div>
<div style="margin-left: 160px;">
</mxCell></div>
<div style="margin-left: 80px;">
</conditionalor></div>
<div style="margin-left: 80px;">
</add></div>
<div style="margin-left: 40px;">
</Array></div>
<div style="margin-left: 40px;">
<mxGraph as="graph" alternateEdgeStyle="verticalEdge"></div>
<div style="margin-left: 80px;">
<add as="getTooltipForCell"><![CDATA[</div>
<div style="margin-left: 120px;">
function(cell){</div>
<div style="margin-left: 120px;">
return cell.getAttribute('form');</div>
<div style="margin-left: 120px;">
}</div>
<div style="margin-left: 120px;">
]]></div>
<div style="margin-left: 80px;">
</add></div>
<div style="margin-left: 80px;">
<add as="convertValueToString"><![CDATA[</div>
<div style="margin-left: 120px;">
function(cell){</div>
<div style="margin-left: 120px;">
var cellTitle = cell.getAttribute('name');</div>
<div style="margin-left: 120px;">
return cellTitle;</div>
<div style="margin-left: 120px;">
}</div>
<div style="margin-left: 120px;">
]]></div>
<div style="margin-left: 80px;">
</add></div>
<div style="margin-left: 80px;">
<mxStylesheet as="stylesheet"></div>
<div style="margin-left: 120px;">
<add as="text"></div>
<div style="margin-left: 160px;">
<add as="shape" value="rectangle"/></div>
<div style="margin-left: 160px;">
<add as="perimeter" value="rectanglePerimeter"/></div>
<div style="margin-left: 160px;">
<add as="fontSize" value="12"/></div>
<div style="margin-left: 160px;">
<add as="fontStyle" value="1"/></div>
<div style="margin-left: 160px;">
<add as="align" value="center"/></div>
<div style="margin-left: 160px;">
<add as="verticalAlign" value="top"/></div>
<div style="margin-left: 160px;">
<add as="shadow" value="0"/></div>
<div style="margin-left: 160px;">
<add as="strokeColor" value="none"/></div>
<div style="margin-left: 160px;">
<add as="fillColor" value="none"/></div>
<div style="margin-left: 160px;">
<add as="gradientColor" value="none"/></div>
<div style="margin-left: 120px;">
</add></div>
<div style="margin-left: 120px;">
<add as="defaultEdge"></div>
<div style="margin-left: 160px;">
<add as="shape" value="connector"/></div>
<div style="margin-left: 160px;">
<add as="fontSize" value="10"/></div>
<div style="margin-left: 160px;">
<add as="rounded" value="1"/></div>
<div style="margin-left: 160px;">
<add as="strokeColor" value="#000000"/></div>
<div style="margin-left: 160px;">
<add as="strokeWidth" value="2"/></div>
<div style="margin-left: 160px;">
<add as="edgeStyle" value="elbowEdgeStyle"/></div>
<div style="margin-left: 160px;">
<add as="endArrow" value="classic"/></div>
<div style="margin-left: 160px;">
<add as="labelBackgroundColor" value="#f1f1f1"/></div>
<div style="margin-left: 160px;">
<add as="labelBorderColor" value="#aaa"/></div>
<div style="margin-left: 160px;">
<add as="fontColor" value="#111111"/></div>
<div style="margin-left: 120px;">
</add></div>
<div style="margin-left: 120px;">
<add as="verticalEdge" extend="defaultEdge"></div>
<div style="margin-left: 160px;">
<add as="elbow" value="vertical"/></div>
<div style="margin-left: 160px;">
<add as="strokeColor" value="#000000"/></div>
<div style="margin-left: 120px;">
</add><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 120px;">
<add as="group"></div>
<div style="margin-left: 160px;">
<add as="shape" value="group"/></div>
<div style="margin-left: 160px;">
<add as="perimeter" value="rectanglePerimeter"/></div>
<div style="margin-left: 160px;">
<add as="fontSize" value="10"/></div>
<div style="margin-left: 160px;">
<add as="align" value="center"/></div>
<div style="margin-left: 160px;">
<add as="verticalAlign" value="middle"/></div>
<div style="margin-left: 160px;">
<add as="strokeColor" value="#000000"/></div>
<div style="margin-left: 160px;">
<add as="dashed" value="1"/></div>
<div style="margin-left: 120px;">
</add></div>
<div style="margin-left: 120px;">
<add as="start"></div>
<div style="margin-left: 160px;">
<add as="shape" value="image"/></div>
<div style="margin-left: 160px;">
<add as="perimeter" value="rectanglePerimeter"/></div>
<div style="margin-left: 160px;">
<add as="fontSize" value="10"/></div>
<div style="margin-left: 160px;">
<add as="fontStyle" value="1"/></div>
<div style="margin-left: 160px;">
<add as="align" value="center"/></div>
<div style="margin-left: 160px;">
<add as="imageAlign" value="center"/></div>
<div style="margin-left: 160px;">
<add as="verticalAlign" value="top"/></div>
<div style="margin-left: 160px;">
<add as="verticalLabelPosition" value="bottom"/></div>
<div style="margin-left: 160px;">
<add as="labelBackgroundColor" value="#f1f1f1"/></div>
<div style="margin-left: 160px;">
<add as="labelBorderColor" value="#aaa"/></div>
<div style="margin-left: 160px;">
<add as="spacingTop" value="2"/></div>
<div style="margin-left: 160px;">
<add as="image" value="workflow-designer/BPMN-Start.gif"/></div>
<div style="margin-left: 120px;">
</add><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 160px;">
<add as="activity"></div>
<div style="margin-left: 160px;">
<add as="shape" value="image"/></div>
<div style="margin-left: 160px;">
<add as="perimeter" value="rectanglePerimeter"/></div>
<div style="margin-left: 160px;">
<add as="fontSize" value="10"/></div>
<div style="margin-left: 160px;">
<add as="fontStyle" value="1"/></div>
<div style="margin-left: 160px;">
<add as="align" value="center"/></div>
<div style="margin-left: 160px;">
<add as="verticalAlign" value="middle"/></div>
<div style="margin-left: 160px;">
<add as="image" value="workflow-designer/BPMN-Activity.gif"/></div>
<div style="margin-left: 120px;">
</add></div>
<div style="margin-left: 120px;">
<add as="agent"></div>
<div style="margin-left: 160px;">
<add as="shape" value="image"/></div>
<div style="margin-left: 160px;">
<add as="perimeter" value="rectanglePerimeter"/></div>
<div style="margin-left: 160px;">
<add as="fontSize" value="10"/></div>
<div style="margin-left: 160px;">
<add as="fontStyle" value="1"/></div>
<div style="margin-left: 160px;">
<add as="align" value="center"/></div>
<div style="margin-left: 160px;">
<add as="verticalAlign" value="middle"/></div>
<div style="margin-left: 160px;">
<add as="image" value="workflow-designer/Agent.gif"/></div>
<div style="margin-left: 120px;">
</add><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 120px;">
<add as="timer"></div>
<div style="margin-left: 160px;">
<add as="shape" value="image"/></div>
<div style="margin-left: 160px;">
<add as="perimeter" value="rectanglePerimeter"/></div>
<div style="margin-left: 160px;">
<add as="fontSize" value="10"/></div>
<div style="margin-left: 160px;">
<add as="fontStyle" value="1"/></div>
<div style="margin-left: 160px;">
<add as="align" value="center"/></div>
<div style="margin-left: 160px;">
<add as="verticalAlign" value="middle"/></div>
<div style="margin-left: 160px;">
<add as="image" value="workflow-designer/Timer.gif"/></div>
<div style="margin-left: 120px;">
</add><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 120px;">
<add as="cancel"></div>
<div style="margin-left: 160px;">
<add as="shape" value="image"/></div>
<div style="margin-left: 160px;">
<add as="perimeter" value="rectanglePerimeter"/></div>
<div style="margin-left: 160px;">
<add as="fontSize" value="10"/></div>
<div style="margin-left: 160px;">
<add as="fontStyle" value="1"/></div>
<div style="margin-left: 160px;">
<add as="align" value="center"/></div>
<div style="margin-left: 160px;">
<add as="imageAlign" value="center"/></div>
<div style="margin-left: 160px;">
<add as="verticalAlign" value="top"/></div>
<div style="margin-left: 160px;">
<add as="verticalLabelPosition" value="bottom"/></div>
<div style="margin-left: 160px;">
<add as="spacingTop" value="2"/></div>
<div style="margin-left: 160px;">
<add as="image" value="workflow-designer/BPMN-Cancel.gif"/></div>
<div style="margin-left: 160px;">
<add as="labelBackgroundColor" value="#f1f1f1"/></div>
<div style="margin-left: 160px;">
<add as="labelBorderColor" value="#aaa"/></div>
<div style="margin-left: 120px;">
</add><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 120px;">
<add as="finish"></div>
<div style="margin-left: 160px;">
<add as="shape" value="image"/></div>
<div style="margin-left: 160px;">
<add as="perimeter" value="rectanglePerimeter"/></div>
<div style="margin-left: 160px;">
<add as="fontSize" value="10"/></div>
<div style="margin-left: 160px;">
<add as="fontStyle" value="1"/></div>
<div style="margin-left: 160px;">
<add as="align" value="center"/></div>
<div style="margin-left: 160px;">
<add as="imageAlign" value="center"/></div>
<div style="margin-left: 160px;">
<add as="verticalAlign" value="top"/></div>
<div style="margin-left: 160px;">
<add as="verticalLabelPosition" value="bottom"/></div>
<div style="margin-left: 160px;">
<add as="spacingTop" value="2"/></div>
<div style="margin-left: 160px;">
<add as="image" value="workflow-designer/BPMN-End.gif"/></div>
<div style="margin-left: 160px;">
<add as="labelBackgroundColor" value="#f1f1f1"/></div>
<div style="margin-left: 160px;">
<add as="labelBorderColor" value="#aaa"/></div>
<div style="margin-left: 120px;">
</add><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 120px;">
<add as="andjoin"></div>
<div style="margin-left: 160px;">
<add as="shape" value="image"/></div>
<div style="margin-left: 160px;">
<add as="perimeter" value="rectanglePerimeter"/></div>
<div style="margin-left: 160px;">
<add as="fontSize" value="10"/></div>
<div style="margin-left: 160px;">
<add as="fontStyle" value="1"/></div>
<div style="margin-left: 160px;">
<add as="align" value="center"/></div>
<div style="margin-left: 160px;">
<add as="imageAlign" value="center"/></div>
<div style="margin-left: 160px;">
<add as="verticalAlign" value="top"/></div>
<div style="margin-left: 160px;">
<add as="verticalLabelPosition" value="bottom"/></div>
<div style="margin-left: 160px;">
<add as="spacingTop" value="2"/></div>
<div style="margin-left: 160px;">
<add as="image" value="workflow-designer/BPMN-And-Join.gif"/></div>
<div style="margin-left: 160px;">
<add as="labelBackgroundColor" value="#f1f1f1"/></div>
<div style="margin-left: 160px;">
<add as="labelBorderColor" value="#aaa"/></div>
<div style="margin-left: 120px;">
</add><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 120px;">
<add as="andsplit"></div>
<div style="margin-left: 160px;">
<add as="shape" value="image"/></div>
<div style="margin-left: 160px;">
<add as="perimeter" value="rectanglePerimeter"/></div>
<div style="margin-left: 160px;">
<add as="fontSize" value="10"/></div>
<div style="margin-left: 160px;">
<add as="fontStyle" value="1"/></div>
<div style="margin-left: 160px;">
<add as="align" value="center"/></div>
<div style="margin-left: 160px;">
<add as="imageAlign" value="center"/></div>
<div style="margin-left: 160px;">
<add as="verticalAlign" value="top"/></div>
<div style="margin-left: 160px;">
<add as="verticalLabelPosition" value="bottom"/></div>
<div style="margin-left: 160px;">
<add as="spacingTop" value="2"/></div>
<div style="margin-left: 160px;">
<add as="image" value="workflow-designer/BPMN-And-Split.gif"/></div>
<div style="margin-left: 160px;">
<add as="labelBackgroundColor" value="#f1f1f1"/></div>
<div style="margin-left: 160px;">
<add as="labelBorderColor" value="#aaa"/></div>
<div style="margin-left: 120px;">
</add><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 120px;">
<add as="decision"></div>
<div style="margin-left: 160px;">
<add as="shape" value="image"/></div>
<div style="margin-left: 160px;">
<add as="perimeter" value="rectanglePerimeter"/></div>
<div style="margin-left: 160px;">
<add as="fontSize" value="10"/></div>
<div style="margin-left: 160px;">
<add as="fontStyle" value="1"/></div>
<div style="margin-left: 160px;">
<add as="align" value="center"/></div>
<div style="margin-left: 160px;">
<add as="imageAlign" value="center"/></div>
<div style="margin-left: 160px;">
<add as="verticalAlign" value="top"/></div>
<div style="margin-left: 160px;">
<add as="verticalLabelPosition" value="bottom"/></div>
<div style="margin-left: 160px;">
<add as="spacingTop" value="2"/></div>
<div style="margin-left: 160px;">
<add as="image" value="workflow-designer/BPMN-Conditional.gif"/></div>
<div style="margin-left: 160px;">
<add as="labelBackgroundColor" value="#f1f1f1"/></div>
<div style="margin-left: 160px;">
<add as="labelBorderColor" value="#aaa"/></div>
<div style="margin-left: 120px;">
</add><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 120px;">
<add as="orjoin"></div>
<div style="margin-left: 160px;">
<add as="shape" value="image"/></div>
<div style="margin-left: 160px;">
<add as="perimeter" value="rectanglePerimeter"/></div>
<div style="margin-left: 160px;">
<add as="fontSize" value="10"/></div>
<div style="margin-left: 160px;">
<add as="fontStyle" value="1"/></div>
<div style="margin-left: 160px;">
<add as="align" value="center"/></div>
<div style="margin-left: 160px;">
<add as="imageAlign" value="center"/></div>
<div style="margin-left: 160px;">
<add as="verticalAlign" value="top"/></div>
<div style="margin-left: 160px;">
<add as="verticalLabelPosition" value="bottom"/></div>
<div style="margin-left: 160px;">
<add as="spacingTop" value="2"/></div>
<div style="margin-left: 160px;">
<add as="image" value="workflow-designer/BPMN-Or-Join.gif"/></div>
<div style="margin-left: 160px;">
<add as="labelBackgroundColor" value="#f1f1f1"/></div>
<div style="margin-left: 160px;">
<add as="labelBorderColor" value="#aaa"/></div>
<div style="margin-left: 120px;">
</add><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 120px;">
<add as="conditionalor"></div>
<div style="margin-left: 160px;">
<add as="shape" value="image"/></div>
<div style="margin-left: 160px;">
<add as="perimeter" value="rectanglePerimeter"/></div>
<div style="margin-left: 160px;">
<add as="fontSize" value="10"/></div>
<div style="margin-left: 160px;">
<add as="fontStyle" value="1"/></div>
<div style="margin-left: 160px;">
<add as="align" value="right"/></div>
<div style="margin-left: 160px;">
<add as="verticalAlign" value="bottom"/></div>
<div style="margin-left: 160px;">
<add as="image" value="workflow-designer/Conditional-OR-Split.gif"/></div>
<div style="margin-left: 120px;">
</add></div>
<div style="margin-left: 80px;">
</mxStylesheet></div>
<div style="margin-left: 80px;">
<mxGraphModel as="model"></div>
<div style="margin-left: 120px;">
<add as="valueForCellChanged"><![CDATA[</div>
<div style="margin-left: 160px;">
function(cell, value){</div>
<div style="margin-left: 200px;">
var previous = null;</div>
<div style="margin-left: 200px;">
if (isNaN(value.nodeType)){</div>
<div style="margin-left: 240px;">
previous = cell.getAttribute('name');</div>
<div style="margin-left: 240px;">
cell.setAttribute('name', value);</div>
<div style="margin-left: 200px;">
}else{</div>
<div style="margin-left: 240px;">
previous = cell.value;</div>
<div style="margin-left: 240px;">
cell.value = value;</div>
<div style="margin-left: 200px;">
}</div>
<div style="margin-left: 200px;">
modified = true;</div>
<div style="margin-left: 200px;">
return previous;</div>
<div style="margin-left: 160px;">
}</div>
<div style="margin-left: 160px;">
]]></div>
<div style="margin-left: 120px;">
</add></div>
<div style="margin-left: 80px;">
</mxGraphModel></div>
<div style="margin-left: 40px;">
</mxGraph></div>
<div style="margin-left: 40px;">
<mxDefaultKeyHandler as="keyHandler"></div>
<div style="margin-left: 80px;">
<add as="46" action="delete"/><span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="margin-left: 40px;">
</mxDefaultKeyHandler></div>
<div style="margin-left: 40px;">
<mxDefaultToolbar as="toolbar" spacing="8"></div>
<div style="margin-left: 80px;">
<add as="text" template="text" icon="workflow-designer/text.gif"/></div>
<div style="margin-left: 80px;">
<add as="start" template="start" icon="workflow-designer/Start-24.gif"/></div>
<div style="margin-left: 80px;">
<add as="cancel" template="cancel" icon="workflow-designer/Cancel-24.gif"/></div>
<div style="margin-left: 80px;">
<add as="finish" template="finish" icon="workflow-designer/Finish-24.gif"/></div>
<div style="margin-left: 80px;">
<add as="activity" template="activity" icon="workflow-designer/Workflow-Activity-24.gif"/></div>
<div style="margin-left: 80px;">
<add as="andjoin" template="andjoin" icon="workflow-designer/AND-Join-24.gif"/></div>
<div style="margin-left: 80px;">
<add as="andsplit" template="andsplit" icon="workflow-designer/AND-Split-24.gif"/></div>
<div style="margin-left: 80px;">
<add as="orjoin" template="orjoin" icon="workflow-designer/OR-Join-24.gif"/></div>
<div style="margin-left: 80px;">
<add as="decision" template="decision" icon="workflow-designer/BPMN-Conditional-24.gif"/></div>
<div style="margin-left: 40px;">
</mxDefaultToolbar></div>
<div>
</mxEditor></div>
</td>
</tr>
</tbody>
</table>
<br />
5) Create <strong>workflow-designer </strong>folder under the same folder. and put your images mentioned in the <strong>fsworkflowconfig.xml </strong>file.<br />
<br />
6) Open the <strong>MxGraphExtjsIntegration.html</strong> in the fireforx browser.<br />
.</div>
Yogesh Totarehttp://www.blogger.com/profile/04713983039432517765noreply@blogger.com0tag:blogger.com,1999:blog-3161810555890214288.post-68616709037166754282011-09-06T12:05:00.000+05:302011-09-07T11:08:34.944+05:30Generate Unique String with only Special Characters.<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Following code will generate the unique string containing the special characters. You can specify the length of the string to generate.<br />
<br />
<table border="1" cellpadding="0" cellspacing="0" style="background-color: lavender; border-bottom-style: hidden; border-left-style: hidden; border-right-style: hidden; border-top-style: hidden; width: 100%;">
<tbody>
<tr>
<td><div>
</div>
<div>
public class UniqueStringGenerator {<br />
<br /></div>
<div>
</div>
<div>
/** </div>
<div>
* Minimum length for a decent string </div>
<div>
*/ </div>
<div>
public static final int MIN_LENGTH = 5; </div>
<div>
</div>
<div>
/** </div>
<div>
* The random number generator. </div>
<div>
*/ </div>
<div>
protected static java.util.Random r = new java.util.Random(); </div>
<div>
</div>
<div>
protected static char[] goodChar = { </div>
<div>
// Comment out next two lines to make upper-case-only, then </div>
<div>
// use String toUpper() on the user's input before validating. </div>
<div>
'~', '`', '@', '#', '$', '%', '^','&','*','(',')','{','}','[', ']',':'</div>
<div>
}; </div>
<div>
</div>
<div>
//Generate a Password object with a random password. </div>
<div>
public static String getNext() { </div>
<div>
return getNext(MIN_LENGTH); </div>
<div>
} </div>
<div>
</div>
<div>
// Generate a unique string with a random function. </div>
<div>
public static String getNext(int length) { </div>
<div>
if (length < 1) { </div>
<div>
throw new IllegalArgumentException( </div>
<div>
"Ridiculous password length " + length); </div>
<div>
} </div>
<div>
StringBuffer sb = new StringBuffer(); </div>
<div>
for (int i = 0; i < length; i++) { </div>
<div>
sb.append(goodChar[r.nextInt(goodChar.length)]); </div>
<div>
} </div>
<div>
return sb.toString(); </div>
<div>
} </div>
<div>
</div>
<div>
public static void main(String[] args) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> System.out.println(getNext());</div>
<div>
}</div>
<div>
}</div>
<div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
Yogesh Totarehttp://www.blogger.com/profile/04713983039432517765noreply@blogger.com0tag:blogger.com,1999:blog-3161810555890214288.post-31083815561068540572011-09-05T13:09:00.000+05:302011-09-06T20:26:15.672+05:30Convert JSON String to Java Object (POJO)<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
During the recent development came to a scenario where I want to convert the JSON string into the java object (POJO). to achieve this i decided to use the "gson" API provided by the google. Following the is example how i have converted the JSON to POJO.<br />
<br />
<b>External API</b> : gson-1.3.jar from google.<br />
<br />
<br />
<br />
<table border="1" cellpadding="0" cellspacing="0" style="background-color: lavender; border-bottom-style: hidden; border-left-style: hidden; border-right-style: hidden; border-top-style: hidden; width: 100%;">
<tbody>
<tr>
<td><div style="margin-left: 40px;">
import com.google.gson.Gson;</div>
<div>
<div>
<div style="margin-bottom: 0px; margin-left: 40px; margin-right: 0px; margin-top: 0px;">
import com.google.gson.GsonBuilder;</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 40px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 40px; margin-right: 0px; margin-top: 0px;">
public class JsonToPojo {</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 40px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 40px; margin-right: 0px; margin-top: 0px;">
/**</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 40px; margin-right: 0px; margin-top: 0px;">
* @param args</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 40px; margin-right: 0px; margin-top: 0px;">
*/</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
public static void main(String[] args) {</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 40px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 120px; margin-right: 0px; margin-top: 0px;">
String jsonString= "[{name:'Yogesh',address : 'Pimple Saudagar',age:29},</div>
<div style="margin-bottom: 0px; margin-left: 240px; margin-right: 0px; margin-top: 0px;">
{name:'Puneet',address :'Hadapsar',age:27}, {name:'Sameer',address:'Wagholi',age:31}]";</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 120px; margin-right: 0px; margin-top: 0px;">
Student [] students = getJsonFormString(jsonString, Student[].class);</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 120px; margin-right: 0px; margin-top: 0px;">
for (Student student : students) {</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 160px; margin-right: 0px; margin-top: 0px;">
System.out.println("Name <span class="Apple-tab-span" style="white-space: pre;"> </span>--> " + student.getName());</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 160px; margin-right: 0px; margin-top: 0px;">
System.out.println("Address --> " + student.getAddress());</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 160px; margin-right: 0px; margin-top: 0px;">
System.out.println("Age<span class="Apple-tab-span" style="white-space: pre;"> </span>--> " + student.getAge());</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 120px; margin-right: 0px; margin-top: 0px;">
}</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
}</div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
<br /></div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
/**</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
* Returns the JSON representation from string.</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
* </div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
* @param <T></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
* @param json</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
* @param type</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
* </div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
*/</div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
public static <T> T getJsonFormString(String json, Class<T> type) {</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 120px; margin-right: 0px; margin-top: 0px;">
GsonBuilder gsonBuilder = new GsonBuilder();</div>
<div style="margin-bottom: 0px; margin-left: 120px; margin-right: 0px; margin-top: 0px;">
gsonBuilder.serializeNulls();</div>
<div style="margin-bottom: 0px; margin-left: 120px; margin-right: 0px; margin-top: 0px;">
Gson gson = gsonBuilder.create();</div>
<div style="margin-bottom: 0px; margin-left: 120px; margin-right: 0px; margin-top: 0px;">
return (T) gson.fromJson(json, type);</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
}</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 40px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 40px; margin-right: 0px; margin-top: 0px;">
}</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 40px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 40px; margin-right: 0px; margin-top: 0px;">
class Student {</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 40px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
private String name;</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
private String address;</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
private int age;</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
/**</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
* Constructor</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
*/</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
public Student (){</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
}</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
/**</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
* @return the name</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
*/</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
public String getName() {</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 120px; margin-right: 0px; margin-top: 0px;">
return name;</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
}</div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
/**</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
* @param name the name to set</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
*/</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
public void setName(String name) {</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 120px; margin-right: 0px; margin-top: 0px;">
this.name = name;</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
}</div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
/**</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
* @return the address</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
*/</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
public String getAddress() {</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 120px; margin-right: 0px; margin-top: 0px;">
return address;</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
}</div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
/**</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
* @param address the address to set</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
*/</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
public void setAddress(String address) {</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 120px; margin-right: 0px; margin-top: 0px;">
this.address = address;</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
}</div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
/**</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
* @return the age</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
*/</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
public int getAge() {</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 120px; margin-right: 0px; margin-top: 0px;">
return age;</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
}</div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
/**</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
* @param age the age to set</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
*/</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
public void setAge(int age) {</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 120px; margin-right: 0px; margin-top: 0px;">
this.age = age;</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 80px; margin-right: 0px; margin-top: 0px;">
}</div>
</div>
<div>
<div style="margin-bottom: 0px; margin-left: 40px; margin-right: 0px; margin-top: 0px;">
}</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
Yogesh Totarehttp://www.blogger.com/profile/04713983039432517765noreply@blogger.com3tag:blogger.com,1999:blog-3161810555890214288.post-40108780209454525792011-09-05T12:37:00.000+05:302011-09-12T13:35:45.768+05:30Validate Java Expression<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="text-align: justify;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
You may come under a scenario where you want to check at runtime if the given expression is valid or not. For example you are building a expression builder on the client side. With the help of of expression builder you can create a expression. Expression may contains different data types like Integer, String and Date. Now the question is how can any one check if the build expression is valid or not. I have the following code that will ensure given expression is valid or not.</div>
</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<b>Assumption </b>:</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
1) This code will work on java 6 and above.</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
2) You have to pass the expression in the form of values.</div>
<br />
<table border="1" cellpadding="0" cellspacing="0" style="background-color: lavender; border-bottom-style: hidden; border-left-style: hidden; border-right-style: hidden; border-top-style: hidden; width: 100%;">
<tbody>
<tr>
<td><br />
<div>
import java.io.PrintWriter;</div>
<div>
import java.io.StringWriter;</div>
<div>
import java.net.URI;</div>
<div>
import java.util.Arrays;</div>
<div>
</div>
<div>
import javax.tools.DiagnosticCollector;</div>
<div>
import javax.tools.JavaCompiler;</div>
<div>
import javax.tools.JavaFileObject;</div>
<div>
import javax.tools.SimpleJavaFileObject;</div>
<div>
import javax.tools.ToolProvider;</div>
<div>
import javax.tools.JavaCompiler.CompilationTask;</div>
<div>
</div>
<div>
public class ExpressionEvaluator {<br />
<br /></div>
<div>
</div>
<div style="margin-left: 40px;">
public static boolean isValidExpression( String expression) {</div>
<div style="margin-left: 80px;">
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();</div>
<div style="margin-left: 80px;">
System.out.println("compiler = " + compiler);</div>
<div style="margin-left: 80px;">
System.out.println("JAVA HOME = " + System.getProperty("java.home"));</div>
<div style="margin-left: 80px;">
System.out.println("CLASSPATH = " + System.getProperty("java.class.path"));</div>
<div style="margin-left: 80px;">
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();</div>
<div style="margin-left: 80px;">
StringWriter writer = new StringWriter();</div>
<div style="margin-left: 80px;">
PrintWriter out = new PrintWriter(writer);</div>
<div style="margin-left: 80px;">
out.println("public class TextExpression {");</div>
<div style="margin-left: 80px;">
out.println(" public static void main(String args[]) {");</div>
<div style="margin-left: 80px;">
out.println(" if(" + expression + "){}");</div>
<div style="margin-left: 80px;">
out.println(" }");</div>
<div style="margin-left: 80px;">
out.println("}");</div>
<div style="margin-left: 80px;">
out.close();</div>
<div style="margin-left: 80px;">
JavaFileObject file = new JavaSourceFromString("TextExpression", writer.toString());</div>
<div style="margin-left: 80px;">
Iterable<? extends JavaFileObject> compilationUnits = Arrays.asList(file);</div>
<div style="margin-left: 80px;">
CompilationTask task = compiler.getTask(null, null, diagnostics, null, null, compilationUnits);</div>
<div style="margin-left: 80px;">
boolean success = task.call();</div>
<div style="margin-left: 80px;">
return success;</div>
<div style="margin-left: 40px;">
}</div>
<div>
}<br />
<br />
<br /></div>
<div>
</div>
<div>
class JavaSourceFromString extends SimpleJavaFileObject {<br />
<br /></div>
<div>
</div>
<div style="margin-left: 40px;">
final String code;</div>
<div style="margin-left: 40px;">
JavaSourceFromString(String name, String code) {</div>
<div style="margin-left: 80px;">
super(URI.create("string:///" + name.replace('.', '/')+ Kind.SOURCE.extension), Kind.SOURCE);</div>
<div style="margin-left: 80px;">
this.code = code;</div>
<div style="margin-left: 40px;">
}</div>
<div>
</div>
<div style="margin-left: 40px;">
@Override</div>
<div style="margin-left: 40px;">
public CharSequence getCharContent(boolean ignoreEncodingErrors) {</div>
<div style="margin-left: 80px;">
return code;</div>
<div style="margin-left: 40px;">
}</div>
<div>
}</div>
</td>
</tr>
</tbody>
</table>
</div>
Yogesh Totarehttp://www.blogger.com/profile/04713983039432517765noreply@blogger.com0Satara Rd, Maharashtra, India17.895114303749143 73.74023437510.391702803749142 63.632812375 25.398525803749145 83.847656375tag:blogger.com,1999:blog-3161810555890214288.post-13671383023765407522011-09-02T13:45:00.000+05:302011-09-27T16:06:15.992+05:30JBPM and JEXL Integration<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;">Following steps need to perform to configure the JEXL as a expression language for the JBPM.</span><br />
<div>
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div>
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;">1) Create a jbpm.default.scriptmanager.xml file.</span></div>
<div>
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"> File contains following tag.</span><br />
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div class="e">
<div>
<div>
<div>
<pre class="programlisting" style="background-color: whitesmoke; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; display: block; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 25px; padding-right: 15px; padding-top: 5px;"><span class="m" style="font-family: Times, 'Times New Roman', serif;"><span class="Apple-style-span" style="-webkit-text-decorations-in-effect: none; color: black; font-size: small; line-height: normal; white-space: normal;"><div class="e">
<div class="c" style="margin-left: 1em; text-indent: -2em;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">
<span class="m"><?</span><span class="pi">xml</span><span class="Apple-style-span" style="-webkit-text-decorations-in-effect: none; color: black;"></span> <span class="pi"> version="1.0" encoding="UTF-8" </span><span class="m">?></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">
<span class="m"></span><span class="m"><</span><span class="t">jbpm-configuration</span><span class="m">></span></div>
</div>
<div>
<div class="e">
<div class="c" style="margin-left: 1em; text-indent: -2em;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">
<span class="m"><</span><span class="t">process-engine-context</span><span class="m">></span></div>
</div>
<div>
<div class="e">
<div class="c" style="margin-left: 1em; text-indent: -2em;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">
<span class="m"><</span><span class="t">script-manager </span><span class="t">default-expression-language</span><span class="m">="</span><b>jexl</b><span class="m">"</span><span class="t"> default-script-language</span><span class="m">="</span><b>jexl</b><span class="m">"</span><span class="m">></span></div>
</div>
<div class="c" style="margin-left: 1em; text-indent: -2em;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">
<span class="m"><span class="m"><</span><span class="t">script-language</span> <span class="t">name</span><span class="m">="</span><b>jexl</b><span class="m">"</span><span class="t"> </span></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">
<span class="m"><span class="t"> factory</span><span class="m">="<span class="Apple-style-span" style="white-space: pre;"><b>org.apache.commons.jexl2.scripting.JexlScriptEngineFactory</b></span></span></span><span class="m">"</span><span class="m"> /></span></div>
</div>
<div>
<div class="e">
<div style="margin-left: 1em; text-indent: -2em;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">
<span class="m"><</span><span class="t">script-language</span> <span class="t">name</span><span class="m">="</span><b>juel</b><span class="m">"</span><span class="t"> factory</span><span class="m">="</span><b>org.jbpm.pvm.internal.script.JuelScriptEngineFactory</b><span class="m">"</span><span class="m"> /></span></div>
</div>
</div>
<div class="e">
<div style="margin-left: 1em; text-indent: -2em;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">
<span class="m"><</span><span class="t">script-language</span> <span class="t">name</span><span class="m">="</span><b>bsh</b><span class="m">"</span><span class="t"> factory</span><span class="m">="</span><b>org.jbpm.pvm.internal.script.BshScriptEngineFactory</b><span class="m">"</span><span class="m"> /></span></div>
</div>
</div>
<div class="e">
<div style="margin-left: 1em; text-indent: -2em;">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">
<span class="m"><</span><span class="t">script-language</span> <span class="t">name</span><span class="m">="</span><b>groovy</b><span class="m">"</span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">
<span class="m"></span> factory="<b>org.jbpm.pvm.internal.script.GroovyScriptEngineFactory</b><span class="m">"</span><span class="m"> /></span></div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="m"></span><span class="Apple-style-span" style="-webkit-text-decorations-in-effect: none; color: #333333; font-size: 12px; line-height: 18px; white-space: pre;"><span class="Apple-style-span" style="-webkit-text-decorations-in-effect: none; color: black; font-size: small; line-height: normal; white-space: normal;"></span></span></div>
<div class="e" style="display: inline !important;">
<div style="text-align: justify;">
<span class="m"></</span><span class="t">script-manager</span><span class="m">></span></div>
</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="-webkit-text-decorations-in-effect: none; color: #333333; font-size: 12px; line-height: 18px; white-space: pre;"><span class="Apple-style-span" style="-webkit-text-decorations-in-effect: none; color: black; font-size: small; line-height: normal; white-space: normal;"></span></span></div>
<div class="e" style="display: inline !important;">
<div style="text-align: justify;">
<span class="m"></</span><span class="t">process-engine-context</span><span class="m">></span></div>
</div>
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<a href="http://www.blogger.com/blogger.g?blogID=3161810555890214288" id="process.decision.condition"><span class="Apple-style-span" style="color: #333333; font-size: 12px; line-height: 18px; white-space: pre;"><span class="Apple-style-span" style="-webkit-text-decorations-in-effect: none; color: black; font-size: small; line-height: normal; white-space: normal;"></span></span></a></div>
<div class="e" style="display: inline !important;">
<div style="text-align: justify;">
<span class="m"></</span><span class="t">jbpm-configuration</span><span class="m">></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</span></span></pre>
</div>
</div>
</div>
<div>
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="m"><br /></span></span><br />
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><span class="m">2) Import </span>jbpm.default.scriptmanager.xml file into jbpm.default.cfg.xml file.</span></div>
<div>
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;">3) For the decision node specify the condition as follows.</span><br />
<span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div>
<pre class="programlisting" style="background-color: whitesmoke; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; color: #333333; display: block; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 25px; padding-right: 15px; padding-top: 5px;"><span class="Apple-style-span" style="color: #333333; font-family: Times, 'Times New Roman', serif; font-size: 12px; line-height: 18px;"> <decision name="evaluate document">
<transition to="submit document">
<span class="bold"><strong><condition expr="content=='good'" lang="jexl" /></strong></span>
</transition>
<transition to="try again">
<span class="bold"><strong><condition expr="content=='not so good'" lang="jexl"/></strong></span>
</transition>
<transition to="give up" />
</decision></span></pre>
</div>
</div>
</div>
Yogesh Totarehttp://www.blogger.com/profile/04713983039432517765noreply@blogger.com1