Zebra
33 |Fork Zebra-boot visit https://github.com/ae6623/Zebra to view more infomation.
Zebra4js
39 |Zebra4js use Zookeeper to connect the Zebra4j micro services
40 |
44 |
45 |
46 |
47 | ```
48 |
49 | *link image in css*
50 |
51 | ```css
52 | .a{
53 | background: url(../img/a.png) no-repeat;
54 | }
55 | ```
56 |
--------------------------------------------------------------------------------
/zebra4j/zebra-boot/src/test/java/com58/zhl/util/Convert.java:
--------------------------------------------------------------------------------
1 | package com58.zhl.util;
2 |
3 | public class Convert {
4 |
5 | public static String toHexString(byte b){
6 | StringBuilder sb=new StringBuilder();
7 | int n=b<<24>>>24; //因为位运算时都会转换为int型,因此需按照int型的去除符号位的方式来判断
8 | if(n<16){
9 | sb.append("0");
10 | sb.append(getHexChar((byte)(n%16)));
11 | }else{
12 | sb.append(getHexChar((byte)(n/16))).append(getHexChar((byte)(n%16)));
13 | }
14 | return sb.toString();
15 | }
16 |
17 | private static char getHexChar(byte b){
18 | switch(b){
19 | case 10:return 'A';
20 | case 11:return 'B';
21 | case 12:return 'C';
22 | case 13:return 'D';
23 | case 14:return 'E';
24 | case 15:return 'F';
25 | default:return ((char)(b%10+48));
26 | }
27 | }
28 |
29 | public static void main(String args[]){
30 | byte b=-66;
31 | int n=b<<24>>>24;
32 | System.out.println(Integer.toBinaryString(n)+"==="+n+"==="+(byte)b);
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/zebra4j/zebra-core/src/main/java/com/zebra/core/ConfigConstant.java:
--------------------------------------------------------------------------------
1 | package com.zebra.core;
2 |
3 | /**
4 | * Created by lzy@js-dev.cn on 2016/11/2 0002.
5 | */
6 | public class ConfigConstant {
7 | private static final String SMART_PREFIX = "zebra.core";
8 |
9 | /**
10 | * 默认配置文件名称
11 | */
12 | public static final String CONFIG_FILE = "app.properties";
13 |
14 | /**
15 | * JDBC
16 | */
17 | public static final String JDBC_DRIVER = SMART_PREFIX + ".jdbc.driver";
18 | public static final String JDBC_USERNAME = SMART_PREFIX + ".jdbc.username";
19 | public static final String JDBC_PASSWORD = SMART_PREFIX + ".jdbc.password";
20 |
21 | public static final String APP_ABASE_PACKAGE = SMART_PREFIX + ".app.base_package";
22 | public static final String APP_PATH_JSP = SMART_PREFIX + ".app.path_jsp";
23 | public static final String APP_PATH_ASSET= SMART_PREFIX + ".app.path_asset";
24 | public static final String APP_UPLOAD_LIMIT = SMART_PREFIX + ".app.upload_limit";
25 | }
26 |
--------------------------------------------------------------------------------
/zebra4j/zebra-boot/src/test/java/com58/zhl/util/DatabaseConnection.java:
--------------------------------------------------------------------------------
1 | package com58.zhl.util;
2 |
3 | import java.sql.Connection;
4 | import java.sql.DriverManager;
5 | import java.sql.SQLException;
6 |
7 | public class DatabaseConnection {
8 |
9 | private static final String DRIVER="oracle.jdbc.driver.OracleDriver";
10 |
11 | private static final String URL="jdbc:oracle:thin:@localhost:1521:orcl";
12 |
13 | private static final String pwd="scott";
14 |
15 | private static final String name="scott";
16 |
17 | public static Connection getConnection(){
18 | try {
19 | Class.forName(DRIVER);
20 | Connection conn=DriverManager.getConnection(URL, name, pwd);
21 | return conn;
22 | } catch (ClassNotFoundException e) {
23 | e.printStackTrace();
24 | } catch (SQLException e) {
25 | e.printStackTrace();
26 | }
27 | return null;
28 | }
29 |
30 | public static void closeConnection(Connection conn){
31 | try {
32 | conn.close();
33 | } catch (SQLException e) {
34 | e.printStackTrace();
35 | }
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/zebra4j/zebra-boot/src/main/java/com/zebra/boot/registry/RegistryConfig.java:
--------------------------------------------------------------------------------
1 | package com.zebra.boot.registry;
2 |
3 | import com.zebra.boot.registry.impl.ZebraRegistry;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 |
9 | /**
10 | * Created by ae6623 on 2016/11/23.
11 | * 通过该类配置注册中心,prefix注解是为了读取application.properties中的配置的前缀变量,比如registry.servers
12 | */
13 | @Configuration
14 | @ConfigurationProperties(prefix = "registry")
15 | public class RegistryConfig {
16 |
17 | /**
18 | * 会被Spring boot 自动塞入进来
19 | */
20 | private String servers;
21 |
22 | /**
23 | * 返回注册中心实例
24 | * @return
25 | */
26 | @Bean
27 | public IRegistry serviceRegistry() {
28 | return new ZebraRegistry(servers);
29 | }
30 |
31 | /**
32 | * 供Spring boot 自动注入
33 | * @param servers
34 | * @return
35 | */
36 | public void setServers(String servers) {
37 | this.servers = servers;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/zebra4j/zebra-boot/src/test/java/datatype/StackList.java:
--------------------------------------------------------------------------------
1 | package datatype;
2 |
3 | import java.util.Stack;
4 |
5 | /**
6 | * Created by lzy@js-dev.cn on 2017/1/15 0015.
7 | */
8 | public class StackListZebra4js | 落雨 微服务WEB中间件Fork Zebra-boot visit https://github.com/ae6623/Zebra to view more infomation.
Zebra4js use Zookeeper to connect the Zebra4j micro services
40 |Zebra | 落雨 微服务WEB中间件Based on Spring-Boot visit or fork https://github.com/ae6623/Zebra to view more infomation.
Zebra是基于Spring-Boot 开发的一款JavaWeb/Nodejs新企业级应用框架。
Zebra4js use Zookeeper client to connect the Zebra4j Micro Services
40 |Zebra-微服务文档 Zebra-doc and Spring boot can visit https://github.com/ae6623/Zebra
ERROR_MESSAGE
ERROR_MESSAGE