-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ab20ed
commit d243773
Showing
20 changed files
with
416 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
boot-api/src/main/java/com/github/bootapi/api/DemoService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* | ||
*/ | ||
package com.github.bootapi.api; | ||
|
||
import java.util.List; | ||
|
||
import com.github.bootapi.dto.UserDto; | ||
|
||
/** <p>Title: DemoService</p> | ||
* <p>Description: </p> | ||
* <p>Company: chinasi</p> | ||
* @author wgw | ||
* @date 2015-12-29 下午5:07:27 | ||
*/ | ||
public interface DemoService { | ||
|
||
String sayName(String name); | ||
|
||
List<UserDto> getUsers(List<UserDto> users); | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
boot-api/src/main/java/com/github/bootapi/common/CommonRopResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.github.bootapi.common; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlAttribute; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
|
||
/** | ||
* Created with IntelliJ IDEA. | ||
* | ||
* @author <a href="mailto:[email protected]">Xie Gengcai</a> | ||
* @version 1.0 | ||
* @date Jan 6, 2015 | ||
*/ | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
@XmlRootElement(name = "response") | ||
public class CommonRopResponse { | ||
@XmlAttribute | ||
private boolean successful = false; | ||
|
||
public static final CommonRopResponse SUCCESSFUL_RESPONSE = new CommonRopResponse(true); | ||
public static final CommonRopResponse FAILURE_RESPONSE = new CommonRopResponse(false); | ||
|
||
public CommonRopResponse() { | ||
} | ||
|
||
private CommonRopResponse(boolean successful) { | ||
this.successful = successful; | ||
} | ||
|
||
public boolean isSuccessful() { | ||
return successful; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
boot-api/src/main/java/com/github/bootapi/common/IceResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.github.bootapi.common; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
|
||
@XmlAccessorType(XmlAccessType.FIELD) | ||
@XmlRootElement(name = "response") | ||
public class IceResponse<T> | ||
{ | ||
|
||
@XmlElement | ||
private T result; | ||
|
||
@XmlElement | ||
private String code; | ||
|
||
public IceResponse() | ||
{ | ||
super(); | ||
} | ||
|
||
public IceResponse(T result, String code) | ||
{ | ||
super(); | ||
this.result = result; | ||
this.code = code; | ||
} | ||
|
||
public Object getResult() | ||
{ | ||
return result; | ||
} | ||
|
||
public void setResult(T result) | ||
{ | ||
this.result = result; | ||
} | ||
|
||
public String getCode() { | ||
return code; | ||
} | ||
|
||
public void setCode(String code) { | ||
this.code = code; | ||
} | ||
|
||
} |
50 changes: 50 additions & 0 deletions
50
boot-api/src/main/java/com/github/bootapi/dto/UserDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.github.bootapi.dto; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* User | ||
* | ||
*/ | ||
public class UserDto implements Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
private String name; | ||
|
||
public UserDto() { | ||
} | ||
|
||
public UserDto(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return name == null ? -1 : name.hashCode(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (!(obj instanceof UserDto)) { | ||
return false; | ||
} | ||
UserDto other = (UserDto) obj; | ||
if (this == other) { | ||
return true; | ||
} | ||
if (name != null && other.name != null) { | ||
return name.equals(other.name); | ||
} | ||
return false; | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
boot-api/src/main/java/com/github/bootapi/exception/ErrorType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.github.bootapi.exception; | ||
|
||
/** | ||
* 错误类型,暂时先这么干了 | ||
* @date 2014-06-01 | ||
*/ | ||
public abstract class ErrorType { | ||
|
||
public final static String noError = "0"; | ||
/**方法或版本找不到*/ | ||
public final static String methodError = "1"; | ||
|
||
/**时间戳错误*/ | ||
public final static String timestampError = "2"; | ||
|
||
/**方法已经被废弃*/ | ||
public final static String obsoletedError = "3"; | ||
|
||
/**post get 不支持*/ | ||
public final static String actionError = "4"; | ||
|
||
/**appKey不存在*/ | ||
public final static String appKeyError = "5"; | ||
|
||
/**会话超时*/ | ||
public final static String sessionError = "6"; | ||
|
||
/**签名错误*/ | ||
public final static String signError = "7"; | ||
|
||
/**参数不合法*/ | ||
public final static String parametersError = "8"; | ||
|
||
/**超出资源最大服务*/ | ||
public final static String maxSourcesError = "9"; | ||
|
||
/**执行超时*/ | ||
public final static String timeoutError = "10"; | ||
|
||
/**执行错误*/ | ||
public final static String executeError = "11"; | ||
|
||
/**异步执行错误*/ | ||
public final static String AsyncError="12"; | ||
|
||
} |
61 changes: 61 additions & 0 deletions
61
boot-api/src/main/java/com/github/bootapi/exception/IceErrorResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
package com.github.bootapi.exception; | ||
|
||
import java.util.List; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlElementWrapper; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
|
||
/** | ||
* <pre> | ||
* 功能说明: | ||
* </pre> | ||
* @version 1.0 | ||
*/ | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
@XmlRootElement(name = "response") | ||
public class IceErrorResponse { | ||
|
||
@XmlElement | ||
private String code; | ||
|
||
@XmlElement | ||
private String message; | ||
|
||
@XmlElementWrapper(name = "solutions") | ||
@XmlElement(name = "solution") | ||
private List<String> solutions; | ||
|
||
public String getCode() { | ||
return code; | ||
} | ||
|
||
public void setCode(String code) { | ||
this.code = code; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public void setMessage(String message) { | ||
this.message = message; | ||
} | ||
|
||
public List<String> getSolutions() { | ||
return solutions; | ||
} | ||
|
||
public void setSolutions(List<String> solutions) { | ||
this.solutions = solutions; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
} | ||
|
27 changes: 27 additions & 0 deletions
27
boot-api/src/main/java/com/github/bootapi/exception/IceException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.github.bootapi.exception; | ||
|
||
/** | ||
* ice异常 | ||
* | ||
* @author <a href="mailto:[email protected]">Xie Gengcai</a> | ||
* @version 1.0 | ||
*/ | ||
public class IceException extends RuntimeException { | ||
|
||
private static final long serialVersionUID = 4380345178425283103L; | ||
|
||
public IceException() { | ||
} | ||
|
||
public IceException(String message) { | ||
super(message); | ||
} | ||
|
||
public IceException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public IceException(Throwable cause) { | ||
super(cause); | ||
} | ||
} |
Binary file not shown.
Binary file added
BIN
+1013 Bytes
boot-api/target/classes/com/github/bootapi/common/CommonRopResponse.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+841 Bytes
boot-api/target/classes/com/github/bootapi/exception/ErrorType.class
Binary file not shown.
Binary file added
BIN
+1.57 KB
boot-api/target/classes/com/github/bootapi/exception/IceErrorResponse.class
Binary file not shown.
Binary file added
BIN
+825 Bytes
boot-api/target/classes/com/github/bootapi/exception/IceException.class
Binary file not shown.
26 changes: 26 additions & 0 deletions
26
boot-impl/src/main/java/com/github/bootimpl/manager/DemoServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.github.bootimpl.manager; | ||
|
||
import java.util.List; | ||
|
||
import com.github.bootapi.api.DemoService; | ||
import com.github.bootapi.dto.UserDto; | ||
|
||
|
||
|
||
/** | ||
* DemoServiceImpl | ||
* | ||
*/ | ||
public class DemoServiceImpl implements DemoService { | ||
|
||
public String sayName(String name) { | ||
return "say:" + name; | ||
} | ||
|
||
@Override | ||
public List<UserDto> getUsers(List<UserDto> users) { | ||
return users; | ||
} | ||
|
||
|
||
} |
45 changes: 45 additions & 0 deletions
45
boot-impl/src/test/java/com/github/bootimpl/test/TestGeneric.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* | ||
*/ | ||
package com.github.bootimpl.test; | ||
|
||
import java.io.IOException; | ||
|
||
import com.alibaba.dubbo.config.ApplicationConfig; | ||
import com.alibaba.dubbo.config.ProtocolConfig; | ||
import com.alibaba.dubbo.config.RegistryConfig; | ||
import com.alibaba.dubbo.config.ServiceConfig; | ||
import com.github.bootapi.api.DemoService; | ||
import com.github.bootimpl.manager.DemoServiceImpl; | ||
|
||
/** <p>Title: TestGeneric</p> | ||
* <p>Description: </p> | ||
* <p>Company: chinasi</p> | ||
* @author wgw | ||
* @date 2015-12-29 下午5:10:04 | ||
*/ | ||
public class TestGeneric { | ||
|
||
/** | ||
* TODO | ||
* @param args | ||
* void | ||
*/ | ||
public static void main(String[] args) { | ||
|
||
ServiceConfig<DemoService> service = new ServiceConfig<DemoService>(); | ||
service.setApplication(new ApplicationConfig("generic-provider")); | ||
service.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181")); | ||
service.setProtocol(new ProtocolConfig("dubbo", 29581)); | ||
service.setInterface(DemoService.class.getName()); | ||
service.setRef(new DemoServiceImpl()); | ||
service.export(); | ||
try { | ||
System.in.read(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
} | ||
|
||
} |
Binary file added
BIN
+1.05 KB
boot-impl/target/classes/com/github/bootimpl/manager/DemoServiceImpl.class
Binary file not shown.
Binary file added
BIN
+1.74 KB
boot-impl/target/test-classes/com/github/bootimpl/test/TestGeneric.class
Binary file not shown.
Oops, something went wrong.