隨筆-26  評論-111  文章-19  trackbacks-0
           
               摘要: 經過一段時間終于把分頁完善了,可以實現JDBC分頁(可以根據配置屏蔽不同的數據庫之間的差異,并能對自動根據具體的數據庫類型進行SQL優化),HIBERNATE2,和HIBERNATE3的分頁,對內存中的數組進行分頁,并且都支持快速的查詢功能,不過hibernate分頁的除外.使用HIBERNATE進行分頁的時候,需要實現一個接口,將POJO轉換成二維數組的形式.同時支持將已經讀取到的數據在顯示到表...  閱讀全文
          posted @ 2006-02-16 10:09 snoics 閱讀(2763) | 評論 (4)編輯 收藏



          能實現整個網站的抓取,暫時還不支持javascript形式的連接

          能抓取網頁,網頁中的所有的URL重新生成,圖片,文件,包括所有格式的文件,全部都能保持原有的路徑結構

          抓取下的網頁,通過apache搭建成網站,能在本地保持成一個完整的網站的形式

          能直接使用,也能支持二次開發使用,不過暫時還會存在比較多的不完善的地方.

          提供內置線程,能控制抓取操作執行的時間,循環執行

          東西還不是很完善,歡迎大家提出意見

          下載地址  http://www.aygfsteel.com/Files/snoics/snoics-reptile.rar

          posted @ 2006-02-10 09:20 snoics 閱讀(2984) | 評論 (11)編輯 收藏
          首先配置摸板

           <!-- 代理模板 -->
           <bean id="txProxy" lazy-init="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true">
            <property name="transactionManager"><ref local="transactionManager"/></property>
            <property name="transactionAttributes">
                <props>
                          <prop key="*">PROPAGATION_REQUIRED</prop>
                      </props>
            </property>
           </bean>


          摸板配置好以后,每次要添加一個新的代理,只需要類似下面這樣添加

           <bean id="servicerProxy" parent="txProxy">
                  <property name="target">
                        <ref local="serviceTarget"/>
                  </property>
              </bean>

          從而大大簡化了代理的配置
          posted @ 2005-12-13 10:25 snoics 閱讀(632) | 評論 (0)編輯 收藏

          --角色繼承關系表
          create table SNOICS_RI  (
             RI_PARE_ROLEID       VARCHAR2(32)                    not null,
             RI_CHILD_ROLEID      VARCHAR2(32)                    not null,
             constraint PK_SNOICS_RI primary key (RI_PARE_ROLEID, RI_CHILD_ROLEID)
          );

          --角色表
          create table SNOICS_ROLE  (
             ROLE_ID              VARCHAR2(32)                    not null,
             ROLE_NAME            VARCHAR2(32)                    not null,
             ROLE_FORBID          VARCHAR2(1),
             ROLE_DESCRIPT        VARCHAR2(500),
             constraint PK_SNOICS_ROLE primary key (ROLE_ID)
          );

          角色資料存放在SNOICS_ROLE中
          角色之間可以繼承,而且可以多重繼承,
          角色的繼承關系存放在SNOICS_RI

          可以使用SNOICS_ROLE自己到自己的多對多的關系來進行配置

          -----------------------------------------------------------------------------------------------------
          POJO:

          package com.snoics.cmp.security.dao.spring.hibernate.pojo;

          import java.io.Serializable;
          import java.util.Set;

          public class RolePOJO implements Serializable {
           private static final long serialVersionUID = -4776193447586778294L;
           private String roleid;
           private String rolename;
           private String roleforbid;
           private String roledescript;
           
           private Set user;
           private Set rolePermission;
           private Set roleP;
           private Set roleC;

           /**
            * @return Returns the roleC.
            */
           public Set getRoleC() {
            return roleC;
           }

           /**
            * @param roleC The roleC to set.
            */
           public void setRoleC(Set roleC) {
            this.roleC = roleC;
           }

           /**
            * @return Returns the roleP.
            */
           public Set getRoleP() {
            return roleP;
           }

           /**
            * @param roleP The roleP to set.
            */
           public void setRoleP(Set roleP) {
            this.roleP = roleP;
           }

           /**
            * @return Returns the rolePermission.
            */
           public Set getRolePermission() {
            return rolePermission;
           }

           /**
            * @param rolePermission The rolePermission to set.
            */
           public void setRolePermission(Set rolePermission) {
            this.rolePermission = rolePermission;
           }

           /**
            * @return Returns the user.
            */
           public Set getUser() {
            return user;
           }

           /**
            * @param user The user to set.
            */
           public void setUser(Set user) {
            this.user = user;
           }

           /**
            * @return Returns the roledescript.
            */
           public String getRoledescript() {
            return roledescript;
           }

           /**
            * @param roledescript The roledescript to set.
            */
           public void setRoledescript(String roledescript) {
            this.roledescript = roledescript;
           }

           /**
            * @return Returns the roleforbid.
            */
           public String getRoleforbid() {
            return roleforbid;
           }

           /**
            * @param roleforbid The roleforbid to set.
            */
           public void setRoleforbid(String roleforbid) {
            this.roleforbid = roleforbid;
           }

           /**
            * @return Returns the roleid.
            */
           public String getRoleid() {
            return roleid;
           }

           /**
            * @param roleid The roleid to set.
            */
           public void setRoleid(String roleid) {
            this.roleid = roleid;
           }

           /**
            * @return Returns the rolename.
            */
           public String getRolename() {
            return rolename;
           }

           /**
            * @param rolename The rolename to set.
            */
           public void setRolename(String rolename) {
            this.rolename = rolename;
           }
          }

          -----------------------------------------------------------------------------------------------------
          role.hbm.xml中的繼承關系部分的配置

            <set name="roleP" table="SNOICS_RI" cascade="all" inverse="false" lazy="true">
                 <key column="RI_CHILD_ROLEID"/>
                <many-to-many column="RI_PARE_ROLEID" class="com.snoics.cmp.security.dao.spring.hibernate.pojo.RolePOJO"/>
            </set>
            <set name="roleC" table="SNOICS_RI" cascade="all" inverse="false" lazy="true">
               <key column="RI_PARE_ROLEID"/>
               <many-to-many column="RI_CHILD_ROLEID" class="com.snoics.cmp.security.dao.spring.hibernate.pojo.RolePOJO"/>
            </set>

          posted @ 2005-12-12 16:28 snoics 閱讀(696) | 評論 (1)編輯 收藏

           

           1    /**
           2     * 取得當前執行程序使用的classpath
           3     * @author snoics
           4     * @param theclass Class
           5     * @param path "" or "/"
           6     * @param encoding 如果encoding==null將默認使用utf-8進行解碼
           7     * @return String
           8     */

           9    public static String getRealPath(Class theclass,String path,String encoding){
          10     String realpath="";
          11     if(encoding==null{
          12      encoding="utf-8";
          13     }
                      //如果path==null則把它設置為""
          14     path=getString(path);
          15     if(path.equals("")) {
          16      path="/";
          17     }

          18     String jarflag="";
          19     String classflag="";
          20     
          21     String window_jarflag="jar:file:/";
          22     String window_classfalg="file:/";
          23     
          24     String other_jarflag="jar:file:";
          25     String other_classflag="file:";
          26     
          27     String endstring="!";
          28     String systemtype="";
          29     
          30     String systemtype_windows="WINDOWS";
          31     
          32     String pachnamestringendstring="package ";
          33     
          34     String packagestring=theclass.getPackage().toString();
          35     
          36     packagestring=packagestring.substring(pachnamestringendstring.length());
          37     packagestring=getSpecialReplaceString(packagestring,".","/");
          38
          39     String packagestringtemp=packagestring+"/";
          40     
          41     realpath=theclass.getResource(path).toString();
          42     try{
          43         realpath=URLDecoder.decode(realpath,encoding);
          44     }
          catch(Exception e){
          45      e.printStackTrace() ;
          46     }

          47     
          48     systemtype=System.getProperty("os.name").toUpperCase().trim();
          49
          50     if(systemtype.startsWith(systemtype_windows)){
          51      jarflag=window_jarflag;
          52      classflag=window_classfalg;
          53     }
          else{
          54      jarflag=other_jarflag;
          55      classflag=other_classflag;
          56     }

          57     
          58     if(realpath.length()>=jarflag.length()){
          59      String flagstring="";
          60      flagstring=realpath.substring(0,jarflag.length());
          61      if(!flagstring.equals(jarflag)){
          62       flagstring=realpath.substring(0,classflag.length());
          63      }

          64      if(flagstring.equals(jarflag)){
          65       realpath=realpath.substring(jarflag.length());
                        //取得realpath中從開始到最后一個endstring字符串之前的
          66       realpath=StringClass.getPreString(realpath,endstring);
                        //取得realpath中從開始到最后一個"/"字符串之前的
          67       realpath=StringClass.getPreString(realpath,"/")+"/";
          68      }
          else{
          69       realpath=realpath.substring(classflag.length());
          70       if(realpath.length()>packagestringtemp.length()) {
          71           String subrelapath=realpath.substring(realpath.length()-packagestringtemp.length());
          72           if(subrelapath.equals(packagestringtemp)){
                             //取得realpath中從開始到最后一個packagestring字符串之前的
          73            realpath=StringClass.getPreString(realpath,packagestring);
          74           }

          75       }

          76      }

          77     }
          else if((realpath.length()>=classflag.length())&&(realpath.length()<jarflag.length())){
          78   realpath=realpath.substring(classflag.length());
          79   if(realpath.length()>packagestringtemp.length()) {
          80    String subrelapath=realpath.substring(realpath.length()-packagestringtemp.length());
          81    if(subrelapath.equals(packagestringtemp)){
                      //取得realpath中從開始到最后一個packagestring字符串之前的
          82     realpath=StringClass.getPreString(realpath,packagestring);
          83    }

          84   }

          85     }
                      //返回經過格式化的路徑,把"\"全部替換為"/"
          86     return StringClass.getFormatPath(realpath);
          87    }

          88
          posted @ 2005-11-11 09:06 snoics 閱讀(753) | 評論 (0)編輯 收藏
               摘要: 今天寫了一個簡單的RMI程序一、開發工具 eclipse3.1        JDK1.4二、目錄結構 E:\SHIWEI\STUDY\RMI│  .classpath│  .project│├─bin│  └─com│      └─sn...  閱讀全文
          posted @ 2005-10-14 17:29 snoics 閱讀(1665) | 評論 (0)編輯 收藏
          僅列出標題
          共2頁: 上一頁 1 2 
          主站蜘蛛池模板: 涞源县| 木兰县| 焦作市| 凤阳县| 肃南| 临海市| 东台市| 邓州市| 吴川市| 金阳县| 咸阳市| 昌平区| 思茅市| 来凤县| 高青县| 济南市| 漠河县| 沁水县| 永城市| 乌海市| 巫溪县| 泰兴市| 武山县| 虞城县| 阜康市| 开化县| 县级市| 沧州市| 仙桃市| 宁蒗| 垦利县| 南阳市| 仁寿县| 琼中| 兴城市| 宿松县| 乐平市| 湘阴县| 慈利县| 汶上县| 奉化市|