Skip to content

Commit

Permalink
write a line into test.file
Browse files Browse the repository at this point in the history
  • Loading branch information
huifer committed Jan 2, 2024
1 parent 4c8534f commit 5a1f105
Show file tree
Hide file tree
Showing 10 changed files with 510 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/spring/cs4b17d13c-a90f-11ee-b0cd-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package dolores.oauthserver.config;

import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(OAuth2Properties.class)
public class OAuth2CoreConfig {
}
40 changes: 40 additions & 0 deletions docs/spring/cs4b508e0a-a90f-11ee-b0cd-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Copyright 2009-2018 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ibatis.session;

import java.sql.Connection;

/**
* 事物级别, 封装 java.sql 的事物美剧
* @author Clinton Begin
*/
public enum TransactionIsolationLevel {
NONE(Connection.TRANSACTION_NONE),
READ_COMMITTED(Connection.TRANSACTION_READ_COMMITTED),
READ_UNCOMMITTED(Connection.TRANSACTION_READ_UNCOMMITTED),
REPEATABLE_READ(Connection.TRANSACTION_REPEATABLE_READ),
SERIALIZABLE(Connection.TRANSACTION_SERIALIZABLE);

private final int level;

TransactionIsolationLevel(int level) {
this.level = level;
}

public int getLevel() {
return level;
}
}
74 changes: 74 additions & 0 deletions docs/spring/cs4b881c6c-a90f-11ee-b0cd-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* Copyright 2009-2018 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ibatis.jdbc;

import org.apache.ibatis.type.*;

/**
* 对于 null 不同类型的描述, {类型处理器,jdbc类型}
* @author Clinton Begin
* @author Adam Gent
*/
public enum Null {
BOOLEAN(new BooleanTypeHandler(), JdbcType.BOOLEAN),

BYTE(new ByteTypeHandler(), JdbcType.TINYINT),
SHORT(new ShortTypeHandler(), JdbcType.SMALLINT),
INTEGER(new IntegerTypeHandler(), JdbcType.INTEGER),
LONG(new LongTypeHandler(), JdbcType.BIGINT),
FLOAT(new FloatTypeHandler(), JdbcType.FLOAT),
DOUBLE(new DoubleTypeHandler(), JdbcType.DOUBLE),
BIGDECIMAL(new BigDecimalTypeHandler(), JdbcType.DECIMAL),

STRING(new StringTypeHandler(), JdbcType.VARCHAR),
CLOB(new ClobTypeHandler(), JdbcType.CLOB),
LONGVARCHAR(new ClobTypeHandler(), JdbcType.LONGVARCHAR),

BYTEARRAY(new ByteArrayTypeHandler(), JdbcType.LONGVARBINARY),
BLOB(new BlobTypeHandler(), JdbcType.BLOB),
LONGVARBINARY(new BlobTypeHandler(), JdbcType.LONGVARBINARY),

OBJECT(new ObjectTypeHandler(), JdbcType.OTHER),
OTHER(new ObjectTypeHandler(), JdbcType.OTHER),
TIMESTAMP(new DateTypeHandler(), JdbcType.TIMESTAMP),
DATE(new DateOnlyTypeHandler(), JdbcType.DATE),
TIME(new TimeOnlyTypeHandler(), JdbcType.TIME),
SQLTIMESTAMP(new SqlTimestampTypeHandler(), JdbcType.TIMESTAMP),
SQLDATE(new SqlDateTypeHandler(), JdbcType.DATE),
SQLTIME(new SqlTimeTypeHandler(), JdbcType.TIME);

/**
* 类型处理器
*/
private TypeHandler<?> typeHandler;
/**
* jdbc 类型
*/
private JdbcType jdbcType;

Null(TypeHandler<?> typeHandler, JdbcType jdbcType) {
this.typeHandler = typeHandler;
this.jdbcType = jdbcType;
}

public TypeHandler<?> getTypeHandler() {
return typeHandler;
}

public JdbcType getJdbcType() {
return jdbcType;
}
}
35 changes: 35 additions & 0 deletions docs/spring/cs4bbe87d4-a90f-11ee-b0cd-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.huifer.design.proxy.cglib;

import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
* <p>Title : CGLIBZhiLian </p>
* <p>Description : </p>
*
* @author huifer
* @date 2019-05-17
*/
public class CGLIBZhiLian {

public Object getInstance(Class<?> clazz) throws Exception {
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(clazz);

enhancer.setCallback(new MethodInterceptor() {
@Override
public Object intercept(Object o, Method method, Object[] args,
MethodProxy methodProxy) throws Throwable {
System.out.println("CGLIB 代理智联");
Object o1 = methodProxy.invokeSuper(o, args);
return o1;
}
});

return enhancer.create();

}
}
141 changes: 141 additions & 0 deletions docs/spring/cs4bf48604-a90f-11ee-b0cd-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
/**
* Copyright 2009-2019 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ibatis.logging;

import java.lang.reflect.Constructor;

/**
* <p>日志工厂,实现内容:</p>
* <ol>
* <li>org.slf4j.Logger 日志框架 slf4j</li>
* <li>org.apache.commons.logging.Log 日志框架 apache</li>
* <li>org.apache.logging.log4j.Logger 日志框架 log4j2</li>
* <li>org.apache.log4j.Logger 日志框架 log4j </li>
* <li>java.util.logging.Logger 日志框架,JDK的logger</li>
*
* </ol>
* @author Clinton Begin
* @author Eduardo Macarron
*/
public final class LogFactory {

/**
* Marker to be used by logging implementations that support markers.
*/
public static final String MARKER = "MYBATIS";

private static Constructor<? extends Log> logConstructor;

/**
* 日志的实现类的具体选择
*/
static {
// slf4j 日志
tryImplementation(LogFactory::useSlf4jLogging);
// apache 日志
tryImplementation(LogFactory::useCommonsLogging);
// log4j2 日志
tryImplementation(LogFactory::useLog4J2Logging);
// log4 日志
tryImplementation(LogFactory::useLog4JLogging);
// JDK 日志
tryImplementation(LogFactory::useJdkLogging);
// 空 日志
tryImplementation(LogFactory::useNoLogging);
}

/**
* 私有化构造方法,这是一个单例
*/
private LogFactory() {
// disable construction
}

public static Log getLog(Class<?> aClass) {
return getLog(aClass.getName());
}

public static Log getLog(String logger) {
try {
return logConstructor.newInstance(logger);
} catch (Throwable t) {
throw new LogException("Error creating logger for logger " + logger + ". Cause: " + t, t);
}
}

public static synchronized void useCustomLogging(Class<? extends Log> clazz) {
setImplementation(clazz);
}

public static synchronized void useSlf4jLogging() {
setImplementation(org.apache.ibatis.logging.slf4j.Slf4jImpl.class);
}

public static synchronized void useCommonsLogging() {
setImplementation(org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl.class);
}

public static synchronized void useLog4JLogging() {
setImplementation(org.apache.ibatis.logging.log4j.Log4jImpl.class);
}

public static synchronized void useLog4J2Logging() {
setImplementation(org.apache.ibatis.logging.log4j2.Log4j2Impl.class);
}

public static synchronized void useJdkLogging() {
setImplementation(org.apache.ibatis.logging.jdk14.Jdk14LoggingImpl.class);
}

public static synchronized void useStdOutLogging() {
setImplementation(org.apache.ibatis.logging.stdout.StdOutImpl.class);
}

public static synchronized void useNoLogging() {
setImplementation(org.apache.ibatis.logging.nologging.NoLoggingImpl.class);
}

/**
* 选择具体的日志实现
*/
private static void tryImplementation(Runnable runnable) {
if (logConstructor == null) {
try {
// run()? 似乎违背了代码的语义, 看静态方法.静态方法多行同类型的操作我认为是一个多线程
runnable.run();
} catch (Throwable t) {
// ignore
}
}
}

/**
* 选择具体的日志实现
*/
private static void setImplementation(Class<? extends Log> implClass) {
try {
Constructor<? extends Log> candidate = implClass.getConstructor(String.class);
Log log = candidate.newInstance(LogFactory.class.getName());
if (log.isDebugEnabled()) {
log.debug("Logging initialized using '" + implClass + "' adapter.");
}
logConstructor = candidate;
} catch (Throwable t) {
throw new LogException("Error setting Log implementation. Cause: " + t, t);
}
}

}
34 changes: 34 additions & 0 deletions docs/spring/cs4c2a4b40-a90f-11ee-b0cd-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.github.huifer.netty.learn.hello;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;

public class HelloNetty {

public static void main(String[] args) {
EventLoopGroup boosGroup = new NioEventLoopGroup();
EventLoopGroup workerGroup = new NioEventLoopGroup();

try {
ServerBootstrap serverBootstrap
= new ServerBootstrap()
.group(boosGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.childHandler(
new HttpServerHandler()
);
ChannelFuture sync = serverBootstrap.bind(1010).sync();
sync.channel().closeFuture().sync();
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
boosGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}

}

}
21 changes: 21 additions & 0 deletions docs/spring/cs4c5f653c-a90f-11ee-b0cd-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright 2009-2015 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* <p>
* Hyper-simple Datasource.
*/
/**
* Hyper-simple Datasource.
*/
package org.apache.ibatis.datasource.unpooled;
Loading

0 comments on commit 5a1f105

Please sign in to comment.