Status

Blog::Calendar

« February 2010
SunMonTueWedThuFriSat
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
      
       
Today
XML

Blog::Navigation

Blog::Editing

Bookmarks::Blogroll

Blog::Referers

Today''s Page Hits: 278

Other sites

Google Analytics

Powered by Roller Weblogger.
All | JBoss&Seam | JSF | ZK | Music | General | Java
Main | Next page »
20091130 Monday November 30, 2009
When will seam create compoent instance.

When will seam cerate component instance?

20090728 Tuesday July 28, 2009
How to install JBPM4 into JBoss AS 4.2.3

Reference :
 http://www.mastertheboss.com/en/jbpm/209-jbpm-4-tutorial-installation.html
 http://www.li-zone.cn/index.php/2009/06/jbpm%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/

  1. Install JBPM Schema
    1. create a schema named "jbpm4" on your local MySQL database. Then add an user named "jboss" to the database.
      CREATE DATABASE jbpm4;

      GRANT ALL PRIVILEGES ON *.* TO jboss@localhost
      -> IDENTIFIED BY 'jboss' WITH GRANT OPTION;
    2. Then edit the file JBPM4_HOME\db\jdbc\mysql.properties so that it contains our database properties:
      jdbc.driver=com.mysql.jdbc.Driver
      jdbc.url=jdbc:mysql://localhost:3306/jbpm4
      jdbc.username=jboss
      jdbc.password=jboss
    3. Now move the the "db" folder where you will find a build.xml. Launch the following command
      ant -Ddatabase=mysql create.jbpm.schema
  2. Install JBPM4 on JBoss 4.2.3
    1. Move into the "jboss" folder and open the ant build.xml file, Configure the following properties, at the top of the file:
      <property name="jboss.version" value="4.2.3.GA" />
      <property name="jboss.home" value="/the_path_of_jboss_ap" /> <!-- ex :/user/home/dennis/jboss-4.2.3.GA -->
    2. Launch the command, it will create a folder (JBoss AS server/default/deploy/jbpm), and copy file into it.
      ant -Ddatabase=mysql install.jbpm.into.jboss
  3. Manually configuration, JBPM4 installation command is only for JBossAS 5, so we need to do some thing manually
    1. Create folder DEPLOY/jbpm/jbpm-service.sar/jbpm.deployer/jbpm.beans/META-INF
    2. Create folder DEPLOY/jbpm/jbpm-service.sar/jbpm.deployer/META-INF
    3. Copy file JBPM4_HOME/jboss/config.jboss4/deploy/jbpm/jbpm-service.sar/jboss-beans.xml to DEPLOY/jbpm/jbpm-service.sar/jbpm.deployer/jbpm.beans/META-INF
    4. Copy file JBPM4_HOME/jboss/config.jboss4/deploy/jbpm/jbpm-service.sar/META-INF/jboss-service.xml to DEPLOY/jbpm/jbpm-service.sar/jbpm.deployer/META-INF
    5. Copy JBPM4_HOME/lib, bpm-spi.jar and jbpm-jboss4.jar to DEPLOY/jbpm/jbpm-service.sar/jbpm.deployer
  4. Start JBoss AS and link to  http://localhost:8080/jbpm-console/ , login with alex(password) .

Make it more automatically

you can modify JBPM4_HOME/jboss/build.xml to make it automatically configure on JBoss 4.2.3.

  1. Move into the "jboss" folder and open the ant build.xml file, configure the following properties, at the top of the file:
    <property name="jboss.version" value="4.2.3.GA" />
    <property name="jboss.home" value="/the_path_of_jboss_ap" /> <!-- ex :/user/home/dennis/jboss-4.2.3.GA -->
  2. Search <antcall target="internal.install.jbpm.into.jboss.500specifics" /> , append this line below it.
    <antcall target="internal.install.jbpm.into.jboss.400specifics" />
    1, Search <condition property="jboss.version.5">, append a condition declaration below the condition
    <condition property="jboss.version.4">
    <or>
    <equals arg1="${jboss.version}" arg2="4.2.3.GA" />
    </or>
    </condition>
  3. Search <target name="internal.install.jbpm.into.jboss.500specifics" if="jboss.version.5">, append a target below the target.
      <!-- ### THE JBOSS 4 SPECIFIC PART ############################### -->
    <target name="internal.install.jbpm.into.jboss.400specifics" if="jboss.version.4">
    <copy todir="${jboss.server.config.dir}/deploy/jbpm/jbpm-service.sar/jbpm.deployer/jbpm.beans/META-INF/" overwrite="true">
    <fileset dir="${jbpm.home}/jboss/config.jboss4/deploy/jbpm/jbpm-service.sar/" >
    <include name="jboss-beans.xml"/>
    </fileset>
    </copy>
    <copy todir="${jboss.server.config.dir}/deploy/jbpm/jbpm-service.sar/jbpm.deployer/META-INF/" overwrite="true">
    <fileset dir="${jbpm.home}/jboss/config.jboss4/deploy/jbpm/jbpm-service.sar/META-INF/" >
    <include name="jboss-service.xml"/>
    </fileset>
    </copy>
    <copy todir="${jboss.server.config.dir}/deploy/jbpm/jbpm-service.sar/jbpm.deployer/" overwrite="true">
    <fileset dir="${jbpm.home}/lib">
    <include name="jbpm-spi.jar"/>
    <include name="jbpm-jboss4.jar"/>
    </fileset>
    </copy>
  4. Launch the command
    ant -Ddatabase=mysql install.jbpm.into.jboss
20090718 Saturday July 18, 2009
Run seam register example in WAR

In past of two days, I was studying JBoss Seam, reading the document and trying to run the tutorial example.
I did a stupid thing that spent me half a day, the example must run in EAR deployment, but I ran it in WAR mode.

I am curious how to make it run in WAR mode.
Cause of the example is made for a EJB, so you need to declare @Stateless/@Stateful for the controller.
In document of Seam, it can control any bean to be a controller, no need to EJB , so we should able to remove EJB annotation.
However cause we still need an entity manager,that annotated by @PersistenceContext, to work, so we don't remove @Stateless/@Stateful directly.
Thanks Seam, it is easy to fix, use @In annotation, you can get a entity manager with out @PersistenceContext

following is the steps to run example in WAR mode.

  1. Remove @Stateless/@Stateful in RegisterAction
  2. Change @PersistenceContext to @In(value="entityManager") , or @In if the EntityManager value name is already "entityManager"
  3. Remove @Local in Register, keep Register interface, I think this interface is still good for a OO Design.
that's all, you only need to care about is the the name of "entityManager" must same as the declartion in components.xml

20090519 Tuesday May 19, 2009
雞生蛋,蛋生雞
在不作商業行銷,這種靠口碑推產品的行銷模式裏.
User買不買你的產品的單,是雞生蛋蛋生雞的問題嗎?

"因為你的產品好,所以User肯花錢買單,所以你的產品更好,所以更多User買單.."
往負的方面想,
"如果你的產品還不夠好,所以User不肯花錢買單,所以這產品就不作了,因為產品不夠好,當然更不可能有User買單.."

這不是雞生蛋,蛋生雞的問題.
這個世界不會發生,"你的產品不夠好,但幸運的,User肯買單,所以你把產品作的更好,所以更多User買單.."


這是因果的問題..
只要你的東西還不夠好, 沒能滿足User的基本需求, User就不可能買單, 所以這個東西就沒價值, 整個產品就Fail, 投入的心力就是白費.

有些事情,是全有全無, 而不是作一半就能看到完成之後的結果的..

----
我一向視完成上面的要求,為我工作的最大目標.
猜老闆要什麼,作他想要的
不論那種行業,都是服務業,你的老闆就是你的客人.

但,我最近常在困擾著,
老闆的要求,之間似乎存在著互斥.
我有辦法跳脫自我,成為雙重人格的人嗎?
一個我,
想法要脫疆,視任何不可能為可能,不在乎怎麼該完成它,無視要多久才能完成他,只在乎他是否該值得被執行.
另一個我,
在人員隨時會被抽動的狀況下,必需估算人員的進度,規劃架構,解決人員技術問題,Review人員的程式,負責部份程式實作,策畫下一批工作項目,..

在人員跟工作項目隨時可能異動的狀態下,時程還有其意義嗎?

在我心中,這兩個角色一直是互相衝突的角色...
當你手下有人得安排工作時,你怎麼可能一邊想法脫疆不拘細節,一邊要規劃細節,設計,實作,管理會異動的其他人員符合時程?

我有法子嗎?
誰有法子?

有,唯一的法子就是,當你是一個不被時程約束,不必向上報告,不用向上負責,也就是當你就是老闆的時候..
相對的,也就是你燒錢的時候....
20090514 Thursday May 14, 2009
[ZK]Databinding with macro component

Databinding is a very useful feature to help us bind UI and model together, It decrease the line number of code of our project.;

Here, is example to show how to bind bean with macro component with data binding feature.

In this example, I have a PriceComp macro component , and have a Decimalbox inside it as a number member field. PriceComp delegates the number and forward the value to a decimalbox inside it.

public class PriceComp extends HtmlMacroComponent {
    private int number;
    Decimalbox db;
    public void afterCompose(){
        super.afterCompose();
        db = (Decimalbox)getFellowIfAny("value");
        if(db!=null){
            db.setValue(new BigDecimal(number));
        }else{
            throw new IllegalStateException("component value not found");
        }
    }
    public int getNumber() {
        if(db!=null){
            return db.getValue().intValue();
        }
        return number;
    }
    public void setNumber(int number) {
        if(db!=null){
            db.setValue(new BigDecimal(number));
        }else{
            this.number = number;
        }
    }
}

In the macro component template (~./myPrice.zul), it has a decimalbox , and it also forwards onChange event out to PriceComp as onNumberChange event

<zk>
     <decimalbox id="value" forward="onChange=onNumberChange"/>               
</zk>

You also need to write some configuration of this macro component. to enable default binding behavior, for example default save-when behavior of 'number' property is onNumberChange

<?xml version="1.0" encoding="UTF-8"?>
<language-addon>
    <addon-name>testapp</addon-name>
    <language-name>xul/html</language-name>
    <component>
        <component-name>myPriceComponent</component-name>
        <component-class>com.test.PriceComp
        </component-class>
        <macro-uri>~./myPrice.zul</macro-uri>
        <extends>decimalbox</extends>
        <annotation>
            <annotation-name>default-bind</annotation-name>
            <property-name>number</property-name>
            <attribute>
                <attribute-name>access</attribute-name>
                <attribute-value>both</attribute-value>
            </attribute>
            <attribute>
                <attribute-name>save-when</attribute-name>
                <attribute-value>self.onNumberChange</attribute-value>
            </attribute>
        </annotation>
    </component>
</language-addon>

Finally, a example to use databinding with this macro component.

<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>
<zk>
    <window title="bind macro component" border="normal" id="win">
    <zscript><![CDATA[//@IMPORT
    import com.test.*;
    ]]><![CDATA[//@DECLARATION
    ]]><![CDATA[
    Bean bean = new Bean("Cat",35);            
    ]]>
    </zscript>
        <hbox>
            Name :  <textbox value="@{bean.name}" /> |
            Number : <myPriceComponent number="@{bean.amount}" />
        </hbox>
        <hbox>
            Name : <label value="@{bean.name}" />
        </hbox>
        <hbox>
            Number : <label value="@{bean.amount}" />
        </hbox>
    </window>
</zk>
20090416 Thursday April 16, 2009
ZK, A tricky example to connect size between window and other components.

Very tricky, use data binder can even link size of a window with other components.

try following example in zkdemo , click overlapped, resize the window.

<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>
<zk>
    <button label="overlapped" onClick="winActif.doOverlapped()" />
    <label id="info" />
    <window visible="false" title="Les actifs" id="winActif"
        border="normal" closable="true" left="300px" top="100px" width="200px"
        height="200px"
        onClose="self.setVisible(false); event.stopPropagation();"
        onSize='info.setValue(winActif.getWidth()+","+winActif.getHeight());'
        sizable="true">
    </window>
    <hbox style="background-color:red"
        width="@{winActif.width,load-when=winActif.onSize}"
        height="@{winActif.height,load-when=winActif.onSize}">
        Connected Box
    </hbox>
</zk>
Copyright (C) 2003, 閣樓貓的五四三 (About Cat)