爪哇哇

一个软件分析师的博客

2007年12月29日 #

XFIRE的一个例子,发现左web service真是简单得要命!! 侧面印证了写代码越来越没前途了,哈

接口 interface
import J2EE技术的爬虫.util.Collection;
import J2EE技术的爬虫.util.List;

public interface IMathService {
 /**
  * 加
  * @param a
  * @param b
  * @return
  */
 public int add(int a,int b);
 /**
  * 减
  * @param a
  * @param b
  * @return
  */
 public int sub(int a,int b);
/**
上传二进制文件
*/
  public String sendFile(String fileName,byte[] file );
 
}

实现 implements

import J2EE技术的爬虫.io.File;
import J2EE技术的爬虫.io.FileOutputStream;
import J2EE技术的爬虫.sql.Connection;
import J2EE技术的爬虫.sql.ResultSet;
import J2EE技术的爬虫.sql.Statement;
import J2EE技术的爬虫.util.ArrayList;
import J2EE技术的爬虫.util.Collection;
import J2EE技术的爬虫.util.List;

import com.newsoft.oa.bean.User;
import com.newsoft.oa.uitl.Connector;
import com.thoughtworks.xstream.XStream;

public class MathServiceImpl implements IMathService{
  public int add(int a,int b){
   return a+b;
  }
 
  public int sub(int a,int b){
   return a-b;
  }
  public String getWelComeStr(String name){
   return "hi "+name+"! 欢迎你";
  }
  public List getUsers(){
   List l=new ArrayList();
   l.add("name");
   l.add("password");
   l.add("sex");
   return l;
  }

public String sendFile(String fileName, byte[] filebytes) {
 try{
  String path="";
   if(filebytes!=null&&filebytes.length>0){
    File file=new File("/"+fileName);
   
    file.createNewFile();
    FileOutputStream fos=new FileOutputStream(file);
    fos.write(filebytes);
    fos.close();
    path=file.getAbsolutePath();
    System.out.println(path);
   
    file=null;
   
   }
  
   return path;
 }catch(Exception ex){
  return "false";
 }
}

}

配置文件

放在 Classes/META-INF/xfire/service.xml;里面

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">
 <service>
  <name>MathService</name>
  <namespace>newsoft/oa/MathService</namespace>
  <serviceClass>
   com.newsoft.oa.services.IMathService
  </serviceClass>
  <implementationClass>
   com.newsoft.oa.services.MathServiceImpl
  </implementationClass>

 </service>
</beans>

其实是借鉴了Spring的写法,用过Spring不会对着陌生,(Application-context.xml)

WEB-XML加上

<servlet>
  <servlet-name>XFireServlet</servlet-name>
  <servlet-class>
   org.codehaus.xfire.transport.http.XFireConfigurableServlet
  </servlet-class>
 </servlet>

 <servlet-mapping>
  <servlet-name>XFireServlet</servlet-name>
  <url-pattern>/servlet/XFireServlet/*</url-pattern>
 </servlet-mapping>

 <servlet-mapping>
  <servlet-name>XFireServlet</servlet-name>
  <url-pattern>/services/*</url-pattern>
 </servlet-mapping>


最后就是客户端了

/ /Create a metadata of the service             
 Service serviceModel = new ObjectServiceFactory().create(IMathService.class);
// Create a proxy for the deployed service     
 
 XFireProxyFactory factory = new XFireProxyFactory(XFireFactory.newInstance().getXFire());  
 String serviceUrl = "http://localhost:8080/ws/services/MathService";
  client = null;      
 try {         
   client = (IMathService) factory.create(serviceModel, serviceUrl); 
   File file=new File("c:\\SUPERMAP 白皮书.pdf");
   FileInputStream fis=new FileInputStream(file);
   byte[] b=new byte[fis.available()];
   fis.read(b);
  System.out.println(client.sendFile(file.getName(), b));
 } catch (Exception ex) {        
   ex.printStackTrace();
 }                           //Invoke the service   
 int serviceResponse = 0;
 int a=10,b=20;

就是

Service serviceModel = new ObjectServiceFactory().create(IMathService.class); 
 XFireProxyFactory factory = new XFireProxyFactory(XFireFactory.newInstance().getXFire());  
 String serviceUrl = http://localhost:8080/ws/services/MathService;

三行字建立连接请求,

太轻松了

传输文件速度也可以,二进制,2M多的文件,也能轻松传递

用.net和delphi平台测试,兼容性没问题(按道理 soap,也不应该有问题)

这是为客户搭建的在 档案系统和OA审批间作文件归档的尝试项目

哈,完整的项目代码,就不方便讲了。

posted @ 2007-12-29 14:59 李立波 阅读(2383) | 评论 (2)编辑 收藏

关于 DOMINO LS里面 view的Ftsearch的 "entry is no longer in view"的研究

1:
原因主要是 数据的不唯一性

domino文档数据库的弊病

而且 FTSearch查询起来也不很准确,三字符一下查询,命中率不是十分高,大约 80%-95%

2:
entry is no longer in view错误的避免方法是

用NotesViewEntry.IsValid方法先判断那 Entry是否能调用

如果不是调用里面很多方法 都会报  entry is no longer in view,就算 IsDocument也没用处

但这样,如果是自己手动分页,就会出现 GetNthEntry时候不太准确

但没办法了,两者弊,取其轻

主要是客户体验受点影响了

posted @ 2007-12-29 14:40 李立波 阅读(1233) | 评论 (0)编辑 收藏

近期负责公司的OA改造,接触了ext-js框架,自己动手写了些代码,最有成就感的是 extnd里分页的修改,一下是部分修改心得

一:

分页要自己重写:在 extnd-all-debug重写拿取数据部分

//自己重写分页拿数据的方法,这样数据行数会正确现实
  var ds = new Ext.nd.data.DominoViewStore({
          proxy: new Ext.data.HttpProxy({
              url: Ext.nd.extndUrl+'GetView?OpenAgent',
              method: "GET"
          }),
          baseParams: {db: "/"+Ext.nd.Session.CurrentDatabase.FilePath, vw: this.viewName },
          reader: viewEntryReader,
          remoteSort: true
      });

。。。。。。。。。。。。。。。

getView的ls代理如下

'GetView:

Option Public
Option Explicit


Sub Initialize
%REM
This agent can be called from the web to search any view and return results in the
same format as the ?ReadViewEntries command. This was created for use with the
NotesView2 class v1.3 and above.
%END REM
 
 On Error Goto ErrorHandler
 
 Dim session As New NotesSession
 Dim dbSearch As NotesDatabase
 Dim colEntries As NotesViewEntryCollection
 Dim vwSearch As NotesView
 Dim entryResult As NotesViewEntry
 Dim docCurrent As NotesDocument
 Dim docResult As NotesDocument
 Dim col As NotesViewColumn
 Dim strQuery As String
 Dim strDb As String
 Dim strView As String
 Dim strCategory As String
 Dim intMax As Integer
 Dim lngCount As Long, i As Long
 Dim lngStart As Long, lngEnd As Long
 Dim strParameters As String
 Dim lngResults As Long
 Dim x,n As Integer
 Dim xmlStr,resortdescending ,resortascending As String
 Dim nav As NotesViewNavigator
 
 
 'start the xml document
 Print "Content-Type:text/xml;"
 Print "<?xml version=""1.0"" encoding=""gb2312""?>"
 
 'first we get the search parameters out of the querystring
 'db, vw, query, searchmax, count, and start
 Set docCurrent = session.DocumentContext
 
 strParameters = docCurrent.GetItemValue("Query_String")(0)
 'Msgbox strParameters
 strDb = GetParameter("db",strParameters)
 strDb = Replace(Strright(strDb,"/"),"/","\")
 strView = GetParameter("vw",strParameters)
 strQuery = GetParameter("query",strParameters)
 strCategory= GetParameter("RestrictToCategory",strParameters)
 resortdescending=GetParameter("resortdescending",strParameters)
 resortascending=GetParameter("resortascending",strParameters)
 
 intMax = 0
 If Isnumeric(GetParameter("searchmax",strParameters)) Then intMax = Cint(GetParameter("searchmax",strParameters))
 lngCount = 20
 If Isnumeric(GetParameter("count",strParameters)) Then lngCount = Clng(GetParameter("count",strParameters))
 lngStart = 1
 If Isnumeric(GetParameter("start",strParameters)) Then lngStart = Clng(GetParameter("start",strParameters))
 
 'now we get the view to search
 Set dbSearch = session.GetDatabase("",strDb,False)
 Set vwSearch = dbSearch.GetView(strView)
 
 'Msgbox resortdescending +" && "+resortascending
 
 'now we run the search
 If   strCategory="" Then
  
  Set colEntries = vwSearch.AllEntries 
 Else
  Set colEntries = vwSearch.GetAllEntriesByKey(strCategory)
 End If 
 
 lngResults=colEntries.Count
 
 
 'now we spit out the results
 Print "<viewentries toplevelentries=""" & Cstr(lngResults) & """>"
 
 
 'set the starting point for the loop
 If lngStart > lngResults Then lngStart = lngResults
 
 'set the ending point for the loop
 lngEnd = lngStart + lngCount - 1
 If lngEnd > lngResults Then lngEnd = lngResults
 'now loop through the appropriate subset of results and print out a viewentry tag for each one
 i = lngStart
 While i <= lngEnd
  
  If i = lngStart Then
   Set entryResult = colEntries.GetNthEntry(i) 
  Else
   Set entryResult = colEntries.GetNextEntry(entryResult)
  End If
  
  
  If Not entryResult Is Nothing   Then
  'If Not entryResult Is Nothing And entryResult.IsValid  Then
   'If entryResult.IsDocument Then
   Set docResult = entryResult.Document
   Print  "<viewentry position=""" & Cstr(i) & """ unid=""" & Cstr(docResult.universalID) & """ noteid=""" & Cstr(docResult.NoteID) & """ siblings=""" & Cstr(entryResult.SiblingCount) & """>"
   x = 0
   n=0
   Forall value In entryResult.ColumnValues
    Set col=vwSearch.Columns(x)
    
    If Not col.isCategory And  Not col.IsHidden  Then
     Print "<entrydata columnnumber=""" & Cstr(n) & """ name=""" & col.itemName & """>"
     Print  "<text>" & XMLEscape(GetValue(value,Cstr(docResult.universalID))) & "</text>"
     Print  "</entrydata>"
     n=n+1
    End If
    x = x + 1
   End Forall
   Print "</viewentry>"
   'End If
  End If
  i = i + 1
 Wend
AtEnd:
 Print "</viewentries>"
 
 ''''Msgbox xmlStr
 Print xmlStr
 vwSearch.Clear
 Set dbSearch=Nothing
 Set vwSearch=Nothing
 Exit Sub
ErrorHandler:
 Msgbox "<error>" & "Error in ($Ext.nd.SearchView): " & Error & "---at " & Erl & "</error>"
 Print "<error>" & "Error in ($Ext.nd.SearchView): " & Error & "---at " & Erl & "</error>"
 Resume AtEnd
End Sub
Function GetParameter(strParamName As String, strQuery As String) As String
 'this gets a parameter out of a querystring
 Dim i As Integer
 Dim s As String
 Dim v As Variant
 
 GetParameter = ""
 
 i = Instr(Ucase(strQuery),"&" & Ucase(strParamName) & "=")
 If i <> 0 Then
  s = Strright(Mid(strQuery, i),"=")
  If Instr(s, "&") Then
   s = Strleft(s, "&")
  End If
  v = Evaluate("@UrlDecode(""Domino""; """ & s & """)")
  GetParameter = Cstr(v(0))
 End If
End Function
Function XMLEscape(strValue As String) As String
 'this escapes a string so it can be printed out to xml safely
 strValue = Replace(strValue, "&" , "&amp;")
 strValue = Replace(strValue, "<" , "&lt;")
 strValue = Replace(strValue, ">" , "&gt;")
 XMLEscape = strValue
End Function


Function GetValue(strValue As Variant,id As String) As String
 On Error Goto sErr
 
 'Forall vs In strValue
 ' Msgbox "vs=" &  Cstr(vs)
 'End Forall
 GetValue=Cstr(strValue)
 Exit Function
sErr:
 GetValue="文档" & id
 Exit Function
End Function

 

有兴趣可以研究下 ext-js的AJAX框架,确实很有趣

posted @ 2007-12-29 14:32 李立波 阅读(1785) | 评论 (1)编辑 收藏

2007年4月10日 #

JAVA的对LDAP操作代码(以DOMINO为例子)

LdapConnector  连接类

import J2EE技术的爬虫.util.Hashtable;

import javax.naming.Context;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import javax.naming.directory.SearchControls;

public class LdapConnector {
 public final static String INITCTX = "com.sun.jndi.ldap.LdapCtxFactory";
 public final static String HOST_URL = "ldap://128.8.1.8:389";
    public static LdapConnector connector=null;
 
 private DirContext ctx;

 private Hashtable<String,String> env;
   
 public LdapConnector(String principal, String credentials) {
  env = new Hashtable();
  try {
   env.put(Context.INITIAL_CONTEXT_FACTORY, INITCTX);
   env.put(Context.PROVIDER_URL, HOST_URL);
   env.put(Context.SECURITY_AUTHENTICATION, "simple");
   env.put(Context.SECURITY_PRINCIPAL, principal);
   env.put(Context.SECURITY_CREDENTIALS, credentials);
   ctx = new InitialDirContext(env);
  } catch (Exception ex) {
   ex.printStackTrace();
  }
  
 }
 
 public  DirContext getDirContext(){
  return ctx;
 }
 
 public static SearchControls getSearchControls(){
  SearchControls constraints;
  constraints = new SearchControls();
  constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
  return constraints;
 }
 
 
 public static LdapConnector  init(){
     synchronized (LdapConnector.class) {
      if(connector==null)
    connector=new LdapConnector("lilb","1"); 
 }  
   return connector;
 }
}

测试类:

import J2EE技术的爬虫.util.ArrayList;

import javax.naming.NamingEnumeration;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
import javax.naming.directory.SearchResult;

public class LdapText {

 /**
  * @param args
  */
 public static void main(String[] args) throws Exception{
  // TODO Auto-generated method stub
  String cn="";
  String dn="";
  
  String filter="";
  String searchBase="";
  NamingEnumeration<SearchResult> results;
  
  

DirContext ctx =LdapConnector.init().getDirContext();
        //先拿CN值 ================
        searchBase="";
        filter ="(uid=lilb)";
        results =
   ctx.search(searchBase, filter, LdapConnector.getSearchControls());
  while (results != null && results.hasMore()) {
   SearchResult sr2 =  results.next();
   cn=(String)sr2.getAttributes().get("cn").get();
   dn=sr2.getName();
   System.out.println(dn);
  }
        //=======================
       
        J2EE技术的爬虫.util.List<String> uidList=new ArrayList<String>();
  
        filter =
   "(&(objectClass=dominoGroup)(cn=IT事业部))";
       
   results =
   ctx.search(searchBase, filter, LdapConnector.getSearchControls());
  
  while (results != null && results.hasMore()) {
   SearchResult sr =  results.next();
   System.out.println(sr.getName());
   
   Attributes attrs = sr.getAttributes();
   NamingEnumeration attrsEnum=attrs.get("member").getAll();
   System.out.println("组织里的人员有 :"+attrs.get("member"));
   while (attrsEnum != null && attrsEnum.hasMore()) {
    String str=(String)attrsEnum.next();
    System.out.println(str.equalsIgnoreCase(dn));
    NamingEnumeration<SearchResult> resultsPerson =
     ctx.search(str, "(objectClass=*)", LdapConnector.getSearchControls());//根据DN,再重新查找
    while (resultsPerson != null && resultsPerson.hasMore()) { 
     SearchResult srPerson =  resultsPerson.next();
     System.out.println(srPerson.getAttributes().get("cn").get());//里面人的CN
     System.out.println(srPerson.getAttributes().get("uid").get()+"@");//里面人的UID
     uidList.add(srPerson.getAttributes().get("uid").get().toString().toLowerCase());
    }
   }
   System.out.println("本组织是否存在这用户 :"+uidList.contains("lilb"));
   
   
   
  }
 }

}

posted @ 2007-04-10 14:21 李立波 阅读(1484) | 评论 (0)编辑 收藏

我心目中中国队的理想阵容

     我心目中的理想阵容 

     于大宝(韩鹏)

于海   郑智   董方卓
    邵佳一 
         周海宾  
孙详 李伟峰 冯萧庭 孙继海



前提试换了鬼老教练

posted @ 2007-04-10 14:14 李立波 阅读(142) | 评论 (0)编辑 收藏

2007年2月9日 #

国奥队又打架了

       又一中国球员没脑袋,没思维,没智慧的佐证
我整天对中国球员的想法就是

技术没问题

身体没问题

速度没问题

就是脑袋有问题

讲了不学,学了不做,做了又做不好

很简单的战术,分边,ONE TWO ,假动作,总是失误,怪谁呢

中国的教练不是没知识,但是是不会教

道理就象一个好的技术人员未必是一个好的老师一样

侯捷老师为何出名,不是因为他的技术(我没贬低他技术的意思),是因为他能把他懂的技术说清楚

加上中国人脑袋思维特别复杂,所以球员战术素养极其底下

哎,没救的中国足球

但为何我还是爱看?

看来我也是没救了

posted @ 2007-02-09 11:40 李立波 阅读(248) | 评论 (4)编辑 收藏

2007年1月31日 #

一个yale-cas实现单点登录(OSS)的简单例子实现


Tomcat5.5.9 
Jdk 1.5.0.1
按照如下的配置成功:
1首先我打开tomcat5.5的SSL
修改Tomcat配置文件server.xml,去掉对于SSL的注释,即开放8443端口
(注意:不用添加任何东西)
2.生成安全证书
首先在命令行中切换到 %java_home%\jre\lib\security目录
%java_home%\bin\keytool -genkey -alias tomcat -keyalg RSA
密码是:changeit
姓名是:localhost
其他随便写的
之后是
%java_home%\bin\keytool -export -alias tomcat -file server.crt

%java_home%\bin\keytool -import -file server.crt -keystore %java_home%/jre/lib/security/cacerts 
3.将CAS server3.0.2中target目录中的CAS.war复制到%tomcat_home%\webapps目录下.
(或者\cas-server-2.0.12\lib目录中的CAS.war也可以)
4.将cas-client-2.0.11\java\lib文件复制到%tomcat_home%\webapps\servlets-examples\WEB-INF\lib中(没有lib文件夹,自己建一个)
5.修改tomcat自带的servlet-examples的web.xml, 加入cas的过滤器:

<filter> 
    <filter-name>CASFilter</filter-name>
    <filter-class>edu.yale.its.tp.cas.client.filter.CASFilter</filter-class>
    <init-param>
        <param-name>edu.yale.its.tp.cas.client.filter.loginUrl</param-name>
        <param-value>https://localhost:8443/cas/login</param-value>
    </init-param>
    <init-param>
        <param-name>edu.yale.its.tp.cas.client.filter.validateUrl</param-name>
        <param-value>https://localhost:8443/cas/proxyValidate</param-value>
    </init-param>
    <init-param>
        <param-name>edu.yale.its.tp.cas.client.filter.serverName</param-name>
        <param-value>localhost:8080</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>CASFilter</filter-name>
    <url-pattern>/servlet/*</url-pattern>
</filter-mapping>
6.启动tomcat !,CAS.war文件被自动在webapps下释放出CAS目录
进入http://localhost:8080/servlets-examples,随便点击一个Execute,系统 被自动转发到CAS的登陆页面.
输入相同的用户名和密码,之后跳转回原来页面
注意:
在制作一个自签名的credential了, 在生成keystore文件的时候密码是:changeit(这是tomcat默认的),你的名字一定要是:localhost,当然这是你需要把CAS client和CAS server放在同一台机器上进行测试用的.

posted @ 2007-01-31 10:23 李立波 阅读(2542) | 评论 (1)编辑 收藏

2007年1月25日 #

诗一首,曾国藩赠与其弟所书

左列钟铭右谤书

人间随处有乘除
低头一拜屠羊说

万事浮云过太虚

http://googlechinablog.com/2006/08/google.html

posted @ 2007-01-25 17:21 李立波 阅读(188) | 评论 (0)编辑 收藏

SPRING + HIBERNATE +OSWORKFLOW 的配置文件(2)

applicationContext-hibernate.xml
=============================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
 <bean id="sessionFactory"
  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="configLocation">
   <value>classpath:hibernate.cfg.xml</value>
  </property>
 </bean>
</beans>

applicationContext-hibernate和applicationContext-service分开容易管理

hibernate.cfg.xml
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
        <property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
        <property name="hibernate.connection.url">jdbc:jtds:sqlserver://172.1.1.11:1433/EMMS2 </property>
        <property name="hibernate.connection.username">sa</property>
        <property name="hibernate.connection.password">8888</property>
        <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>

        <property name="hibernate.query.substitutions">false 0, true 1</property>
        <!-- c3p0 connection pooling properties -->
        <property name="hibernate.c3p0.min_size">1</property>
        <property name="hibernate.c3p0.max_size">3</property>
        <!-- other hibernate properties -->
        <property name="hibernate.show_sql">true</property>
        <!-- <property name="hbm2ddl.auto">update</property> -->
        
        <mapping resource="com/opensymphony/workflow/spi/hibernate3/HibernateCurrentStep.hbm.xml"/>
   <mapping resource="com/opensymphony/workflow/spi/hibernate3/HibernateHistoryStep.hbm.xml"/>
   <mapping resource="com/opensymphony/workflow/spi/hibernate3/HibernateWorkflowEntry.hbm.xml"/>

    </session-factory>
</hibernate-configuration>

posted @ 2007-01-25 16:08 李立波 阅读(718) | 评论 (0)编辑 收藏

SPRING + HIBERNATE +OSWORKFLOW 的配置文件(1)

 这是我实际项目经验中配置,还有一个applicationContext-hibernate.xml,和hibernate.cfg.xml下遍文档发


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
 <!--  hibernate configuration -->
 <import resource="applicationContext-hibernate.xml" />

 <!--  ========================  dao helper ,set to service,transation ============  -->


 <bean id="transactionManager"
  class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
  </property>
 </bean>

 

 <!--  ========================  end dao setup ============  -->
 
 <!--  ============================================================================  -->
 <!--  ======================== 系统业务层 =======================================  -->
 <!--  ============================================================================  -->


 <!--  ========================  begin to setup dgsei System Service ============  -->
 <!-- ************  公共transactionManager proxy 继承后就能有事务管理 方法是set parent="baseServiceProxy"  === -->
 <bean id="baseServiceProxy" lazy-init="true"
  class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
  <property name="transactionManager">
   <ref local="transactionManager" />
  </property>
  <property name="transactionAttributes">
   <props>
    <prop key="modify*">
     PROPAGATION_REQUIRED,-com.newsoft.notMoneyException
    </prop>
    <prop key="update*">
     PROPAGATION_REQUIRED,-Exception
    </prop>
    <prop key="add*">PROPAGATION_REQUIRED,-Exception</prop>
    <prop key="create*">
     PROPAGATION_REQUIRED,-Exception
    </prop>
    <prop key="save*">PROPAGATION_REQUIRED,-Exception</prop>
    <prop key="delete*">
     PROPAGATION_REQUIRED,-Exception
    </prop>
    <prop key="remove*">
     PROPAGATION_REQUIRED,-Exception
    </prop>
    <prop key="do*">PROPAGATION_REQUIRED,-Exception</prop>
    <prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
    <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
    <!-- prop key="query*">PROPAGATION_REQUIRED,readOnly</prop>
     <prop key="someOtherBusinessMethod">PROPAGATION_MANDATORY</prop-->
   </props>
  </property>
 </bean>

 <!--  =============   end ==== -->
    <!--
  OS
 -->
 <bean id="workflowStore"
  class="com.opensymphony.workflow.spi.hibernate3.SpringHibernateWorkflowStore" >
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
    </property>
 <property name="propertySetDelegate">
  <bean id="propertySetDelegate"
  class="com.opensymphony.workflow.util.PropertySetDelegateImpl" />
 </property>
   </bean>
 <bean id="workflowFactory"
  class="com.opensymphony.workflow.spi.hibernate.SpringWorkflowFactory"
  init-method="init">
  <property name="resource">
   <value>workflows.xml</value>
  </property>
 </bean>
 <bean id="workflowConfiguration"
  class="com.opensymphony.workflow.config.SpringConfiguration">
  <property name="store">
   <ref local="workflowStore" />
  </property>
  <property name="factory">
   <ref local="workflowFactory" />
  </property>
 </bean>
 <bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
        <property name="transactionManager">
              <ref local="transactionManager" />
        </property>
        <property name="transactionAttributes">
              <props>
                  <prop key="*">PROPAGATION_REQUIRED</prop>
              </props>
        </property>
    </bean>
    <bean id="workflowTarget" class="com.opensymphony.workflow.basic.BasicWorkflow" singleton="false">
        <constructor-arg>
              <value>admin</value>
        </constructor-arg>
        <property name="configuration">
              <ref local="workflowConfiguration" />
        </property>
    </bean>
    <bean id="workflow" class="org.springframework.aop.framework.ProxyFactoryBean">
        <property name="singleton">
              <value>false</value>
        </property>
        <property name="proxyInterfaces">
              <value>com.opensymphony.workflow.Workflow</value>
        </property>
        <property name="interceptorNames">
              <list>
                  <value>transactionInterceptor</value>
                  <value>workflowTarget</value>
              </list>
        </property>
    </bean>
   

 <!-- OS END -->
 
 <!-- 监管中心创建记录 -->
 <!-- dao的实现  sessionFactory用的是前面Spring定义的-->
 <bean id="maintRecordDao"
  class="com.newsoft.equipmentMaintenance.dao.MaintRecordDaoImpl">
  <property name="sessionFactory" ref="sessionFactory" />
 </bean>
 <!-- BO的接口 target 是指向BO实现类id parent是事物代理类的ID ,proxyInterfaces是被代理的接口类-->

 <bean id="maintRecordService" parent="baseServiceProxy">
  <property name="target">
   <ref local="maintRecordImpl" />
  </property>
  <property name="proxyInterfaces">
   <value>
    com.newsoft.equipmentMaintenance.bo.maintenanceRecord.MaintRecordService
   </value>
  </property>
 </bean>
 <!-- BO的实现 MaintRecordDao 是指向DAO接口类id-->
 <bean id="maintRecordImpl"
  class="com.newsoft.equipmentMaintenance.bo.maintenanceRecord.impl.MaintRecordImpl">
  <property name="maintRecordDao">
   <ref local="maintRecordDao" />
  </property>
  <property name="workflow">
   <ref local="workflow" />
  </property>
 </bean>
 
</beans>
 

posted @ 2007-01-25 16:05 李立波 阅读(872) | 评论 (0)编辑 收藏

仅列出标题  下一页

My Links

Blog Stats

News

常用链接

留言簿(5)

随笔分类

随笔档案

文章档案

相册

搜索

最新评论

阅读排行榜

评论排行榜