spark的自留地(ofbiz/eclipse rcp/shark/opentaps)

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            54 Posts :: 0 Stories :: 112 Comments :: 0 Trackbacks

          2010年8月12日 #

          到阿里工作快一年了,這一年回顧來最主要的成果還是在這里成功了推行了自己的領(lǐng)域建模方法與對應(yīng)的技術(shù)框架。總是想同更多的同學(xué)分享一下。

          為了幫助更多人了解如何應(yīng)用領(lǐng)域建模知識在實際項目中,我在InfoQ中發(fā)表了一篇題為“大型網(wǎng)站復(fù)雜業(yè)務(wù)持續(xù)重構(gòu)之道——全程領(lǐng)域建模實踐”的文章。為了增加趣味性,我用了個故事來展開內(nèi)容,請大家不要對號入座(特別是老板們)。請有興趣了解這一話題的同學(xué)可以閱讀一下

          原文在
          http://www.infoq.com/cn/articles/sb-complex-business-continuity-refact
          posted @ 2012-03-28 15:07 shanghai_spark 閱讀(374) | 評論 (0)編輯 收藏

          默認Opentaps是基于derby的安裝,這個在實際生產(chǎn)環(huán)境是不太可能會使用的。往往我們會實際需要使用Oracle作為生產(chǎn)數(shù)據(jù)庫。很多人問我怎么去修改Opentaps與Oracle的支持。修改方法如下:

          1、編輯 framework/entity/config/entityengine.xml,修改default delegate為 localoracle

          <delegator name="default" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false">
          <group-map group-name="org.ofbiz" datasource-name="localoracle"/>
          <group-map group-name="org.ofbiz.olap" datasource-name="localoracle"/>
          <group-map group-name="org.ofbiz.tenant" datasource-name="localoracle"/>
          <group-map group-name="org.opentaps.analytics" datasource-name="localoracle"/>
          <group-map group-name="org.opentaps.testing" datasource-name="localoracle"/>
          </delegator>


          2、修改同個文件中的的localoracle 的datasource節(jié)點
              <datasource name="localoracle"
                      helper
          -class="org.ofbiz.entity.datasource.GenericHelperDAO"
                      schema
          -name="OFBIZ"
                      field
          -type-name="oracle"
                      check
          -on-start="true"
                      add
          -missing-on-start="true"
                      alias
          -view-columns="false"
                      join
          -style="ansi">
                  
          <read-data reader-name="seed"/>
                  
          <read-data reader-name="seed-initial"/>
                  
          <read-data reader-name="demo"/>
                  
          <read-data reader-name="ext"/>
                  
          <inline-jdbc
                          jdbc
          -driver="oracle.jdbc.driver.OracleDriver"
                          jdbc
          -uri="jdbc:oracle:thin:@127.0.0.1:1521:orcl"
                          jdbc
          -username="ofbiz"
                          jdbc
          -password="ofbiz"
                          pool
          -minsize="2"
                          pool
          -maxsize="250"
                          time
          -between-eviction-runs-millis="600000"/>
              
          </datasource>

          3、將{ORACLE_HOME}\product\10.2.0\db_1\jdbc\lib目錄下的ojdbc14.jar拷貝到framework/entity/lib/jdbc目錄下

          4、重新運行ant run-install生成數(shù)據(jù)庫對象

          5、現(xiàn)在Oracle數(shù)據(jù)庫已經(jīng)就緒OK啦


          posted @ 2012-03-07 10:56 shanghai_spark 閱讀(799) | 評論 (0)編輯 收藏

          我一直期望可以提供一個高性能、高定制性的電子商務(wù)套件,它不應(yīng)局限于傳統(tǒng)的ERP應(yīng)用或簡單的線上商城應(yīng)用。而是應(yīng)將線上發(fā)生的產(chǎn)品展示、線上營銷、在線客戶服務(wù)與線下的倉儲發(fā)貨、經(jīng)營分析、關(guān)鍵客戶識別有機結(jié)合起來。

          開始Opentaps開發(fā)已經(jīng)兩年多了,對它的理解也越來越深。做為一個完整的ERP套件來說我覺得它足夠應(yīng)付我們的日常業(yè)務(wù):客戶、訂單、倉儲、采購、財務(wù)等。并且它從應(yīng)用層和開發(fā)層都已經(jīng)提供了足夠的支持與擴展空間。

          我始終覺得Ofbiz提供的ecommerce模塊過于簡單,或者說它與我們國人想象中的電子商城有比較大的差距。如果我們在這之上來開發(fā)的話可以需要付出很多的effort才可能達到我們想要的效果。當(dāng)然opentaps也提供了另一個選擇gracious,但從個人角度來說我并不喜歡這個模塊,它為用戶提供的定制選項太少了,只能作為有經(jīng)驗的開發(fā)者定制自己應(yīng)用的一個基礎(chǔ)。

          在為Opentaps開發(fā)Magento開發(fā)Integration Feature時,我接觸到了Magento這個最廣泛被使用的電子商務(wù)套件。不過當(dāng)時只是淺嘗即止并未做太多的功能研究,最近這些日子里我在不斷深入了解了這個產(chǎn)品后越來越嘆服其功能的強大。我想我想要的所有功能應(yīng)該都被包括在這個產(chǎn)品已完成的feature中了。但同樣我更期望是一個完整的線上線下相貫通的網(wǎng)絡(luò)商城運營方案,離這樣的要求Magento在財務(wù)結(jié)算、倉儲管理、采購管理這些ERP功能方面又明顯的偏弱。

          我想Opentaps與Magento的整合可能不應(yīng)僅限與原來所提供的產(chǎn)品、訂單信息的貫通,或許我們應(yīng)該嘗試提供更密切的信息聯(lián)系。至少第一步應(yīng)該要把客戶資料信息進行雙向的同步,然后是庫存信息。

          考慮更遠一點的話,在Magento或Opentaps中引入在線客服與呼叫中心的Feature也是一個非常讓人振奮的事情。發(fā)展到這一步,我們就可以簡單的集成這兩個優(yōu)秀開源產(chǎn)品來為我們的線上線下提供全方面的服務(wù)了。

          在以后的文章里,我會繼續(xù)在這個方面做更多的設(shè)計與實現(xiàn)工作。如果有童鞋對此話題感興趣,可以把你的想法告訴我看是否可以一起來做點事。


          BTW: 現(xiàn)在opentaps已完成的magento整合內(nèi)容可以在這里找到 http://www.opentaps.org/docs/index.php/Opentaps_Magento_Integration
          posted @ 2011-03-01 09:42 shanghai_spark 閱讀(5820) | 評論 (5)編輯 收藏

          現(xiàn)在google,yahoo這些免費的群組都在大陸不好用,打算自己裝個群組系統(tǒng)給自己的team用。用萬能的google出Simple Groupware,看了特性描述好象還不錯。那就先裝上它試試吧。

          1、安裝apache、mysql、php

          yum install mysql mysql-devel mysql-server php php-cli httpd


          2、安裝php所需的支持的包

          yum install php-zlib php-gd php-mysql php-mbstring


          3、啟動mysqld與httpd服務(wù)

          4、創(chuàng)建/var/www/html/sgs目錄,并在該目錄下下載Simple Groupware installer文件后解壓,這樣在/var/www/html/sgs目錄下存在sgs_installer.php文件

          5、打開瀏覽器訪問http://your_server/sgs/sgs_installer.php選擇你要的版本上面的Install,然后按照屏幕提示作下去就好啦


          posted @ 2011-02-17 22:43 shanghai_spark 閱讀(1993) | 評論 (2)編輯 收藏

          打算在自己申請的Free Amazon EC2上放個Magento,看了下Magento的幫助也整理內(nèi)容如下:

          1、安裝apache、mysql、php

          yum install mysql mysql-devel mysql-server php php-cli httpd

          2、安裝php所需的支持的包

          yum install php-dom php-mcrypt php-gd

          3、創(chuàng)建magento數(shù)據(jù)庫

          4、下載magento full release package并解壓到/var/www/html下,并設(shè)置目錄權(quán)限為777

          5、通過瀏覽器訪問安裝magento http://localhost/magento
          posted @ 2011-02-11 12:14 shanghai_spark 閱讀(1928) | 評論 (0)編輯 收藏

          現(xiàn)在在用一個20寸的廈新電視機在做我的顯示器,它是寬屏的,最高可以支持1344x768的分辨率。可是裝了Fedora 14以后,只能發(fā)現(xiàn)最高支持的分辨率是1024x768。字體看起來都是扁扁的,很不爽!

          得想個法把這個分辨率調(diào)整過來:

          1) 打開一個Terminal窗口,切換到root身份后運行

          Xorg -configure :1

          這個命令會在/root下生成一個叫xorg.conf.new的文件,我們運行以下命令把它移到/etc/X11下
          mv /root/xorg.conf.new /etc/X11/xorg.conf

          2) reboot系統(tǒng)

          3)在終端中輸入 gtf 1344 768 60 -x 命令, 這樣就會在終端中顯示一些內(nèi)容. 類似下面的:
          # 1344x768 @ 60.00 Hz (GTF) hsync: 47.70 kHz; pclk: 83.95 MHz
            Modeline 
          "1344x768_60.00"  83.95  1344 1408 1552 1760  768 769 772 795  -HSync +Vsync

          把它復(fù)制到 /etc/X11/xorg.conf中的[Moniter]段中,復(fù)制后的文件中[Moniter]段如下:
          Section "Monitor"
                  Identifier   
          "Monitor0"
                  VendorName   
          "Monitor Vendor"
                  ModelName    
          "Monitor Model"
                  # 1344x768 @ 
          60.00 Hz (GTF) hsync: 47.70 kHz; pclk: 83.95 MHz
                  Modeline 
          "1344x768_60.00"  83.95  1344 1408 1552 1760  768 769 772 795  -HSync +Vsync
          EndSection

          4) reboot系統(tǒng)后就會在System->Preferences->Moniters中發(fā)現(xiàn)1344x768的選項啦!

          5) 收工!

          posted @ 2011-02-10 16:29 shanghai_spark 閱讀(5119) | 評論 (4)編輯 收藏

          在Opentaps 1.4版本我將AOP由原來的AspectJ替換為現(xiàn)在Aspectwerkz。結(jié)果我自己就首先在64bit的windows系統(tǒng)下遇到ant編譯出錯,現(xiàn)在把解決方法列在這里

          將opentaps/opentaps-common/build-aspects.xml中的weave任務(wù)內(nèi)容替換為以下內(nèi)容(其實就是把原來的ant的替換jar內(nèi)容任務(wù)分成兩部來執(zhí)行):

          <!-- ================================================================== --> 
                  
          <!-- Weave advice into target jars                                      --> 
                  
          <!-- ================================================================== --> 
                  
          <target name="weave" depends="detect-dependencies" if="processRequired"> 
                    
          <echo message="[build] =========== Start Building Aspect (Weave) ============="/> 
                    
          <java classname="org.codehaus.aspectwerkz.compiler.AspectWerkzC" fork="true"> 
                      
          <jvmarg value="-Daspectwerkz.definition.file=${aopConfig}"/> 
                      
          <jvmarg value="-Daspectwerkz.transform.filter=no"/> 
                      
          <!-- <jvmarg value="-Daspectwerkz.transform.verbose=true"/> --> 
                      
          <!-- <jvmarg value="-Daspectwerkz.transform.details=true"/> --> 
                      
          <arg value="-verify"/> 
                      
          <classpath refid="local.class.path" /> 
                      
          <classpath> 
                        
          <pathelement path="${build.dir}/classes/common"/> 
                      
          </classpath> 
                      
          <!-- below is the jars to post-process --> 
                      
          <arg value="${ofbiz.dir}/framework/entity/build/lib/ofbiz-entity.jar"/> 
                    
          </java> 
                    
          <java classname="org.codehaus.aspectwerkz.compiler.AspectWerkzC" fork="true"> 
                      
          <jvmarg value="-Daspectwerkz.definition.file=${aopConfig}"/> 
                      
          <jvmarg value="-Daspectwerkz.transform.filter=no"/> 
                      
          <!-- <jvmarg value="-Daspectwerkz.transform.verbose=true"/> --> 
                      
          <!-- <jvmarg value="-Daspectwerkz.transform.details=true"/> --> 
                      
          <arg value="-verify"/> 
                      
          <classpath refid="local.class.path" /> 
                      
          <classpath> 
                        
          <pathelement path="${build.dir}/classes/common"/> 
                      
          </classpath> 
                      
          <!-- below is the jars to post-process, if these jar not effect each other you can put them in same pos, else please seperate them into another task --> 
                      
          <arg value="${ofbiz.dir}/framework/common/build/lib/ofbiz-common.jar"/> 
                    
          </java> 
                    
          <java classname="org.codehaus.aspectwerkz.compiler.AspectWerkzC" fork="true"> 
                      
          <jvmarg value="-Daspectwerkz.definition.file=${aopConfig}"/> 
                      
          <jvmarg value="-Daspectwerkz.transform.filter=no"/> 
                      
          <!-- <jvmarg value="-Daspectwerkz.transform.verbose=true"/> --> 
                      
          <!-- <jvmarg value="-Daspectwerkz.transform.details=true"/> --> 
                      
          <arg value="-verify"/> 
                      
          <classpath refid="local.class.path" /> 
                      
          <classpath> 
                        
          <pathelement path="${build.dir}/classes/common"/> 
                      
          </classpath> 
                      
          <!-- below is the jars to post-process --> 
                      
          <arg value="${ofbiz.dir}/applications/order/build/lib/ofbiz-order.jar"/> 
                    
          </java> 
                    
          <jar jarfile="${lib.dir}/${name}.jar" update="true" basedir="${build.dir}/classes/common" includes="org/opentaps/aspect/secas/**" /> 
                      
          <!-- put aop.xml into target jar META-INF dir --> 
                       
          <mkdir dir="${build.dir}/classes/META-INF" /> 
                       
          <copy file="${aopConfig}" tofile="${build.dir}/classes/META-INF/aop.xml" overwrite="true"/> 
                     
          <!-- create new jar with aop.xml, then copy it to orign location, using these for avoid unable rename error on windows 64bit system--> 
                         
          <zip destfile="${lib.dir}/ofbiz-entity.jar"> 
                         
          <zipfileset src="${ofbiz.dir}/framework/entity/build/lib/ofbiz-entity.jar"/> 
                         
          <fileset dir="${build.dir}/classes/"> 
                           
          <include name="META-INF/aop.xml"/> 
                         
          </fileset> 
                         
          </zip> 
                     
          <delete file="${ofbiz.dir}/framework/entity/build/lib/ofbiz-entity.jar" failonerror="false"/> 
                         
          <move file="${lib.dir}/ofbiz-entity.jar" tofile="${ofbiz.dir}/framework/entity/build/lib/ofbiz-entity.jar"/> 

                         
          <zip destfile="${lib.dir}/ofbiz-common.jar"> 
                         
          <zipfileset src="${ofbiz.dir}/framework/common/build/lib/ofbiz-common.jar"/> 
                         
          <fileset dir="${build.dir}/classes/"> 
                           
          <include name="META-INF/aop.xml"/> 
                         
          </fileset> 
                         
          </zip> 
                     
          <delete file="${ofbiz.dir}/framework/common/build/lib/ofbiz-common.jar" failonerror="false"/> 
                         
          <move file="${lib.dir}/ofbiz-common.jar" tofile="${ofbiz.dir}/framework/common/build/lib/ofbiz-common.jar"/> 

                     
          <zip destfile="${lib.dir}/ofbiz-order.jar"> 
                         
          <zipfileset src="${ofbiz.dir}/applications/order/build/lib/ofbiz-order.jar"/> 
                         
          <fileset dir="${build.dir}/classes/"> 
                           
          <include name="META-INF/aop.xml"/> 
                         
          </fileset> 
                         
          </zip> 
                     
          <delete file="${ofbiz.dir}/applications/order/build/lib/ofbiz-order.jar" failonerror="false"/> 
                         
          <move file="${lib.dir}/ofbiz-order.jar" tofile="${ofbiz.dir}/applications/order/build/lib/ofbiz-order.jar"/> 

                       
          <echo message="[build] =========== Done Building Aspect (Weave) =============="/> 
                     
          </target>


          以上方法已經(jīng)在opentaps wiki [http://www.opentaps.org/docs/index.php/General_Installation_of_Opentaps#Build_Aspect_class_Errors] 中加上過了。
          posted @ 2011-02-09 22:18 shanghai_spark 閱讀(1638) | 評論 (0)編輯 收藏

          OFBIZ為我們提供了POS模塊,它已經(jīng)可以滿足我們?nèi)粘J浙y的大部分要求了。但是美中不足的是它沒有提供庫存查詢功能。我也沒看出來OFBIZ有近期實現(xiàn)此功能的計劃,所以打算自己做一個。

          首先研究一下POS模塊的代碼結(jié)構(gòu):

          1、POS模塊同其它模塊的實現(xiàn)方式有所區(qū)別,它用了XUL技術(shù)來定制展示的界面。所有屏幕文件使用XUL格式定義于screens目錄之下

          2、按鈕事件與java代碼映射關(guān)系,記錄在config\buttonevents.xml下

          3、資源文件存放在XuiLabels_[locale].properties與config\PosUiLabels.xml中

          了解結(jié)構(gòu)后,加上庫存查詢功能就很簡單了,我是這樣做的:

          1、在screens/default/menu/mgrmain.xml中增加一個mgrInquiryInventory庫存查詢按鈕,它會出現(xiàn)在POS的“經(jīng)理”界面中的

          2、在buttonevents.xml中加上以下行,映射事件代碼
          <event button-name="mgrInquiryInventory" class-name="org.ofbiz.pos.event.ManagerEvents" method-name="inquiryInventory" disable-lock="false"/>


          3、在ManagerEvents.java中加入inquiryInventory方法代碼(我是使用了一個ShowInventory的XPage來展現(xiàn)當(dāng)前選中項的庫存分布)

          4、完工。

          算了算,包括閱讀代碼和編寫這些東東總共也就花了七八個小時的effort,不知道為什么ofbiz就不肯加上這個功能呢?或者pos模塊不再發(fā)展了?





          posted @ 2011-02-08 11:29 shanghai_spark 閱讀(2302) | 評論 (4)編輯 收藏

          原來opentaps中的entity model文件中大量使用了floating-point來定義數(shù)值內(nèi)容,現(xiàn)在我們要使用fixed-point來替換它們,以保證它的java type使用BigDecimal而不是Double.

          這樣就有了這次的替換任務(wù),把所有model文件中的floating-point替換成為fixed-point。

          方法對我來說有三:
          1, 在eclipse或其它ide中查找出所有的包括floating-point文件來手工修改
          2, 在UltraEdit或其它文本編程器中進行批量文件內(nèi)容替換
          3, 嘗試一下linux的下的sed命令?

          評估一下,3肯定是一個最有效率的選擇。那么說干就干,let's go!

          命令如下:

          sed -"s/floating-point/fixed-point/g" `find . -name "*.xml"|xargs grep floating-point -rl`

          一句話就搞掂了,真棒!
          posted @ 2010-08-14 17:16 shanghai_spark 閱讀(1436) | 評論 (0)編輯 收藏

          莫名其妙,日志中老是有無法連接oracle的異常
          java.sql.SQLException: Io 異常: The Network Adapter could not establish the connection

          先用oracle用戶登錄到服務(wù)器上
          sqlplus /nolog

          conn 
          / as sysdba

          運行了一些sql,一切正常呀,奇怪!

          仔細想想,可能是lsnrctl的問題,打開listener.ora在下面插入以下內(nèi)容:
              (SID_DESC=
               (GLOBAL_DBNAME 
          = ORCL)
               (ORACLE_HOME 
          = /oracle/10g)
               (SID_NAME 
          = ORCL)
              )
          完成后的listener.ora如下
          SID_LIST_LISTENER =
            (SID_LIST 
          =
              (SID_DESC 
          =
                (SID_NAME 
          = PLSExtProc)
                (ORACLE_HOME 
          = /oracle/10g)
                (PROGRAM 
          = extproc)
              )
              (SID_DESC
          =
               (GLOBAL_DBNAME 
          = ORCL)
               (ORACLE_HOME 
          = /oracle/10g)
               (SID_NAME 
          = ORCL)
              )
            )

          LISTENER 
          =
            (DESCRIPTION_LIST 
          =
              (DESCRIPTION 
          =
                (ADDRESS 
          = (PROTOCOL = IPC)(KEY = EXTPROC1))
                (ADDRESS 
          = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
              )
            )

          保存后,重啟lsnrctl服務(wù)后就可以正常聯(lián)接了。


          posted @ 2010-08-12 17:39 shanghai_spark 閱讀(480) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 防城港市| 广州市| 莆田市| 尉犁县| 林西县| 邓州市| 阜新市| 咸宁市| 凉城县| 旌德县| 宁化县| 新乡市| 都兰县| 乾安县| 建阳市| 英德市| 崇州市| 郁南县| 南安市| 朝阳区| 清水县| 桃源县| 津市市| 嫩江县| 天津市| 伽师县| 宁强县| 宁海县| 星座| 宜良县| 宣化县| 德保县| 三河市| 海宁市| 普宁市| 仁怀市| 本溪| 新绛县| 潜山县| 平湖市| 宁都县|