梦在远方,路在脚下
posts - 2, comments - 1, trackbacks - 0, articles - 8

2009年2月3日

一件事无论太晚,或者对我来说太早,
都不会阻拦你成为你想成为的那个人
这个过程没有时间的限制
你要你想,随时都可以开始
要改变或者保留原状都无所谓
做事本不应有所束缚
我们可以办好这件事却也可以把它搞砸
但我希望最终你成为你想成为的人
我希望你有时能驻足于这个令你感到惊叹的世界
体会你从未有过的感觉
我希望你能见到其他与你观点不同的人们
我希望你能有一个值得自豪的一生
如果和你想象的生活不一样
我希望你能有勇气,重新启程。
For what is worse it's never too late or in my case too early to be whoever you wanna be.
There's no time limit,start whenever you want
You can change,or stay the same
There's no rule to the thing.
We can make the best or the worst time
I hope you make the best of it.
I hope you see things that startle you
I hope you feel things that you never felt before
I hope you meet people with the different points of  you
I hope you live life you proud of
If you find that you not,
I hope you, have strength to start all over again.

posted @ 2009-02-11 00:19 栗衙 阅读(151) | 评论 (0)编辑 收藏

 

1Web Service

Web Service:是一个较新得分布式服务组件。本质是以标准化得方式实现企业内外各个不同服务系统之间得互调或者集成。

Web Service:通过SOAPWeb上提供的软件服务,使用WSDL文件进行说明,并通过UDDI进行注册。



2WSDLWeb Service Description Lanaguage

基于Xml格式得关于Web服务得描述语言。

如一段代码:

package com.sample.ejb.sessionbean;

public interface UserAccountMgr extends javax.ejb.EJBObject {

   
public boolean checkUserLogin( java.lang.String loginName,java.lang.String password );

}


WSDL
得三部分得描述:


1) Type代码:

 <wsdl:types>
     
<!--服务接口方法-->  
     
<element name="checkUserLogin">
      
<complexType>
       
<sequence>
        
<!--输入参数及其类型-->
        
<element name="loginName" nillable="true" type="xsd:string"/>
        
<element name="password" nillable="true" type="xsd:string"/>
       
</sequence>
      
</complexType>
   
<!--返回结果的类型-->
      
<element name="checkUserLoginResponse">
       
<complexType>
        
<sequence>
         
<element name="checkUserLoginReturn"  type="xsd:boolean"/>
        
</sequence>
       
</complexType>
     
</element>
</wsdl:types>

 

2) Message代码

<!--请求消息--> 
  
<wsdl:message name="checkUserLoginRequest">

      
<wsdl:part name="in0" type="xsd:string"/>

      
<wsdl:part name="in1" type="xsd:string"/>

   
</wsdl:message>
<!--返回消息-->
   
<wsdl:message name="checkUserLoginResponse">

      
<wsdl:part name="checkUserLoginReturn" type="xsd:boolean"/>

   
</wsdl:message>


3) PortType代码

<!--服务接口-->
   
<wsdl:portType name="CheckUserLoginMgr">
<!--所包含得服务接口方法-->
      
<wsdl:operation name="checkUserLogin" parameterOrder="in0 in1">
<!--服务接口方法所对应得请求消息和返回消息-->
         
<wsdl:input message="impl:checkUserLoginRequest" name="checkUserLoginRequest"/>
         
<wsdl:output message="impl:checkUserLoginResponse" name="checkUserLoginResponse"/>
         
<wsdl:fault message="impl:ApplicationException" name="ApplicationException"/>
      
</wsdl:operation>
   
</wsdl:portType>


2How部分

<wsdl:binding name="checkUserLoginServiceSoapBinding" type="impl:CheckUserLoginMgr">
      
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
      
<wsdl:operation name="checkUserLogin">
         
<wsdlsoap:operation soapAction=""/>
         
<wsdl:input name="checkUserLoginRequest">
            
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:7001/webModule/services/checkUserLoginService" use="encoded"/>
         
</wsdl:input>
         
<wsdl:output name="checkUserLoginResponse">
            
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:7001/webModule/services/checkUserLoginService" use="encoded"/>
         
</wsdl:output>
         
<wsdl:fault name="ApplicationException">
            
<wsdlsoap:fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="ApplicationException" namespace="http://localhost:7001/webModule/services/checkUserLoginService" use="encoded"/>
         
</wsdl:fault>
      
</wsdl:operation>
   
</wsdl:binding>

   

3Where部分

   <wsdl:service name="CheckUserLoginMgrService">

      
<wsdl:port binding="impl:checkUserLoginServiceSoapBinding" name="checkUserLoginService">

         
<wsdlsoap:address location="http://localhost:7001/webModule/services/checkUserLoginService"/>

      
</wsdl:port>

   
</wsdl:service>


3SOAPSimple Object Application Propotol

SOAP作用:请求(request)消息将客户端请求消息发给服务器

            答复(response)消息,从服务器返回给客户端消息

服务A需要创建相应得SOAP请求消息,并发给服务B。包括服务接口,服务接口方法,参数值等信息。通过SOAP/HTTP传输方式传到服务BWSDL文件中指定得URL地址

4UDDL

Universal Description, Discovery and Integration将自己得服务注册到相应得UDDL商用注册网站上去

以资源共享的方式由多个运作者一起以Web Service的形式运作UDDI商业注册中心。

  UDDI计划的核心组件是UDDI商业注册,它使用XML文档来描述企业及其提供的Web Service

  UDDI商业注册提供三种信息:

  White Page包含地址、联系方法、已知的企业标识。

  Yellow Page包含基于标准分类法的行业类别。

  Green Page包含关于该企业所提供的Web Service的技术信息,其形式可能是指向文件或URL的指针,而这些文件或URL是为服务发现机制服务的。

posted @ 2009-02-11 00:08 栗衙 阅读(525) | 评论 (0)编辑 收藏

抽象类与接口

1 定义

抽象类:所有的对象都是通过类来描绘的,但是反过来却不是这样。并不是所有的类都是用来描绘对象的,如果一个类中没有包含足够的信息来描绘一个具体的对象,这样的类就是抽象类。

例如

2 语法

2.1 abstract class

可以有自己的数据成员

有非abstarct的成员方法

继承关系,一个类只能使用一次继承关系

可以赋予方法的默认行为

因为如果后来想修改类的界面(一般通过abstract class或者interface来表示)以适应新的情况(比如,添加新的方法或者给已用的方法中添加新的参数)时,就会非常的麻烦,可能要花费很多的时间(对于派生类很多的情况,尤为如此)。但是如果界面是通过abstract class来实现的,那么可能就只需要修改定义在abstract class中的默认行为就可以了。

    同样,如果不能在抽象类中定义默认行为,就会导致同样的方法实现出现在该抽象类的每一个派生类中,违反了"one ruleone place"原则,造成代码重复,同样不利于以后的维护。因此,在abstract classinterface间进行选择时要非常的小心。

2.2 interface

只能够有静态的不能被修改的数据成员

所有的成员方法都是abstract

实现关系,一个类却可以实现多个interface

不可以赋予方法的默认行为

3 设计理念

abstarct class:父类和派生类之间必须存在"is a"关系,即父类和派生类在概念本质上应该是相同的

3.1 interface

不要求interface的实现者和interface定义在概念本质上是一致的,仅仅是实现了interface定义的契约而已

4 实例

AlarmDoor在概念本质上是Door

同时它有具有报警的功能

abstract class Door {

abstract void open();

abstract void close()

}

interface Alarm {

void alarm();

}

class AlarmDoor extends Door implements Alarm {

void open() { … }

void close() { … }

void alarm() { … }

}

posted @ 2009-02-03 12:21 栗衙 阅读(183) | 评论 (1)编辑 收藏