Friday, October 21, 2011

Installing the Vaadin plugin for eclipse.

I had a few issues loading the Vaadin plugin, so I created these note to remind me of the stepf for the next time. Also maybe these notes will help someone else too.

First load the Vaadin-Eclipse plugin.

1. Run eclipse.

2. In eclipse from the help menu, Select Install New Software...

3. Add new update site: http://vaadin.com/eclipse
(reference, http://vaadin.com/eclipse for details)

Now get XULRunner. (this is required by Vaadin)

1. Go to http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases
-->click on the 1.9.1.19 link and then the runtimes link. (the version 1.9.1.19 seems to change as time goes on and then direct links to this location are no longer working)
-->Select the correct version (for windows it is.....)
http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.9.1.19/runtimes/xulrunner-1.9.1.19.en-US.win32.zip

2. Unzip the file to a directory of your choice. I used c:\Apps\xulrunner

3. go to that directory
and issue the following command for windows,
xulrunner.exe --register-global

(reference https://developer.mozilla.org/en/XULRunner_1.9_Release_Notes)


4. Edit the eclipse configuration,
add the following to the bottom of the eclipse.ini file. (it should be in your eclipse directory)
-Dorg.eclipse.swt.browser.XULRunnerPath=C:/Apps/xulrunner
(likely your xulrunner will be if a different directory, so update this location appropriately.)

Now restart eclipse. If everything is ok, you should not see an xul errors like,
Could not start XULRunner (version 1.9 or higher required)

Wednesday, December 23, 2009

Generated Jsp Java files from Glassfish

generated java files from jsp are written to a directory structure similar to the following


C:\apps\glassfish\domains\domain1\generated\jsp\j2ee-modules\cce-web\org\apache\jsp\WEB_002dINF\jsp\secure

The sun-web.xml file must have the following markup.


...




Sunday, November 15, 2009

groovyws with soap header mods for security


import groovyx.net.ws.WSClient
import groovyx.net.ws.cxf.SoapVersion
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import javax.xml.namespace.QName;

String WSDL_URL ="file:///C:/project/wsdl/CU_SCHOOL_COURSES_CI%20WSDL.xml";

@Grab(group='org.codehaus.groovy.modules', module='groovyws', version='0.5.0-SNAPSHOT')
def getProxy(wsdl, classLoader) {
  new WSClient(wsdl, classLoader)
}

proxy = getProxy( WSDL_URL, this.class.classLoader)
proxy.initialize()
proxy.setPreferredSoapVersion(SoapVersion.SOAP_1_1)

def ci =  proxy.create("com.peoplesoft.cu_school_courses_ci.FindCompIntfcCUSCHOOLCOURSESCITypeShape")
def orgId = proxy.create("com.peoplesoft.cu_school_courses_ci.EXTORGIDTypeShape")
def subj = proxy.create("com.peoplesoft.cu_school_courses_ci.SCHOOLSUBJECTTypeShape")

subj.value="ADM";
orgId.value="1132700";
ci.EXTORGID=orgId;
ci.SCHOOLSUBJECT=subj;

proxy.client.getInInterceptors().add(new LoggingInInterceptor())
proxy.client.getOutInterceptors().add(new HeaderInInterceptor(proxy))
proxy.client.getOutInterceptors().add(new LoggingOutInterceptor())

QName q = new  QName("http://peoplesoft.com/CU_SCHOOL_COURSES_CI","Find__CompIntfc__CU_SCHOOL_COURSES_CI");
result = proxy.client.invokeWrapped(q,ci)
println result.length




//////////////////////////////////



import java.util.List;
import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.phase.Phase;
import org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor;
import org.apache.cxf.headers.Header;
import javax.xml.namespace.QName;
import org.apache.cxf.jaxb.JAXBDataBinding;


public class HeaderInInterceptor extends SoapPreProtocolOutInterceptor {
    Object security;

    public HeaderInInterceptor(Object proxy) {
        super();//Phase.POST_LOGICAL);
       
        def security = proxy.create("org.xmlsoap.schemas.ws._2002.xx.secext.SecurityTypeShape");
        def usernameToken = proxy.create("org.xmlsoap.schemas.ws._2002.xx.secext.UsernameTokenTypeShape");
        def username = proxy.create("org.xmlsoap.schemas.ws._2002.xx.secext.UsernameTypeShape");
        def password = proxy.create("org.xmlsoap.schemas.ws._2002.xx.secext.PasswordTypeShape");

        password.value="myPassword";
        username.value="myUser";
        usernameToken.username=username;
        usernameToken.password=password;
        security.usernameToken=usernameToken;
        this.security= security;
       
    }

   
/*
 <scx:Security xmlns:scx="http://schemas.xmlsoap.org/ws/2002/xx/secext">
      <scx:UsernameToken>
        <scx:Username>USERNAME</scx:Username>
        <scx:Password>PASSWORD</scx:Password>
      </scx:UsernameToken>
    </scx:Security>
*/

    public void handleMessage(SoapMessage message) throws Fault {
       
        def list =message.getHeaders();
       
        QName q = new  QName("http://schemas.xmlsoap.org/ws/2002/xx/secext","Security","scx");
         
        Header hdr = new Header( q,   security,  new JAXBDataBinding(security.getClass()));

        list.add(hdr)
           
    }
   
   
}

Sunday, April 12, 2009

missing sun.tools.native2ascii.Main

You probably only installed the JRE.
Try installing the JDK. It has the tools.jar

keywords: ubuntu grails java

Tuesday, September 30, 2008

Sample Mule config file with a Quartz connector

Sample Mule config file.

I tried to find an example of a config file that would look in a directory once a hour and forward any files on to a component. The documentation on the quartz connector is a bit thin so it wasn't as easy as I expected. Finally I came up this.




<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.0"
xmlns:file="http://www.mulesource.org/schema/mule/file/2.0"
xmlns:ftp="http://www.mulesource.org/schema/mule/ftp/2.0"
xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.0"
xmlns:quartz="http://www.mulesource.org/schema/mule/quartz/2.0"
xmlns:smtp="http://www.mulesource.org/schema/mule/smtp/2.0"

xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.mulesource.org/schema/mule/core/2.0 http://www.mulesource.org/schema/mule/core/2.0/mule.xsd
http://www.mulesource.org/schema/mule/stdio/2.0 http://www.mulesource.org/schema/mule/stdio/2.0/mule-stdio.xsd
http://www.mulesource.org/schema/mule/vm/2.0 http://www.mulesource.org/schema/mule/vm/2.0/mule-vm.xsd
http://www.mulesource.org/schema/mule/file/2.0 http://www.mulesource.org/schema/mule/file/2.0/mule-file.xsd
http://www.mulesource.org/schema/mule/ftp/2.0 http://www.mulesource.org/schema/mule/ftp/2.0/mule-ftp.xsd
http://www.mulesource.org/schema/mule/quartz/2.0 http://www.mulesource.org/schema/mule/quartz/2.0/mule-quartz.xsd
http://www.mulesource.org/schema/mule/smtp/2.0 http://www.mulesource.org/schema/mule/smtp/2.0/mule-smtp.xsd
">



<file:endpoint name="fileReader" path="/home/ubuntu/inbound"
reverseOrder="false"
pollingFrequency="30000"
comparator=
org.mule.transport.file.comparator.OlderFirstComparator"/>


<stdio:endpoint name="stdio1" system="IN"/>

<model name="testModel">
<service name="Echo">
<inbound>
<quartz:inbound-endpoint jobName="myServiceJob"
cronExpression="0 0 * ? * *">
<quartz:endpoint-polling-job>
<quartz:job-endpoint ref="fileReader" />
</quartz:endpoint-polling-job>
</quartz:inbound-endpoint>
</inbound>

<echo-component />

<outbound>
<outbound-pass-through-router>
<stdio:outbound-endpoint system="OUT" />
</outbound-pass-through-router>
</outbound>
</service>
</model>
</mule>

Friday, August 8, 2008

Tibco PageBus

Tibco pagebus is an effective tool to pass messages between various widgets and page snippets.
Sometimes you need to look at the full list of subscriptions (especially for debugging) and pagebus is not much help.

The Javascript below will display all the subscriptions by traversing the tree data structure that pagebus keeps.

put this in your javascript in your code somewhere,

testExist(window["OpenAjax"].hub._subscriptions,"com.bigcompany.onClick",0)


window["OpenAjax"].hub._subscriptions is the PageBus object that holds a tree of the PageBus subscriptions.
(Note the period "." separators are also tree nodes.)



The following is the function that actually searches the tree.

function testExist(objectTree, path, i) {
//8 is some arbitrary limit to keep the recursion under control
if(!objectTree || !path || i>8) {
return false;
}
var myPath = path.split(".");

if(myPath.length<=i) {
return true;
}
var newTree=objectTree[myPath[i]];

if(newTree) {
return testExist(newTree, path, i+1);
} else {
//if false, check for "." separator--don't increment i
return testExist(objectTree["."], path, i);
}
}

Wednesday, January 16, 2008

for the html link onclick attribute, the function must return false to ignore href

<a href="http://test.com" onClick="return funcName()" >Text</a>

Must use the "return" command, or the funcName return value (true or false) is ignored.
A common issue is forgetting the return. This will cause the href to always execute.