├── .gitignore
├── README.md
├── pom.xml
├── xultimate-context-support
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── org
│ │ └── danielli
│ │ └── xultimate
│ │ ├── context
│ │ ├── dfs
│ │ │ ├── DistributedFileSystemException.java
│ │ │ └── fastdfs
│ │ │ │ ├── AbstractStorageClientCallback.java
│ │ │ │ ├── AbstractStorageClientReturnedCallback.java
│ │ │ │ ├── StorageClientCallback.java
│ │ │ │ ├── StorageClientReturnedCallback.java
│ │ │ │ ├── support
│ │ │ │ ├── ClientGlobalInitializer.java
│ │ │ │ └── StorageClientTemplate.java
│ │ │ │ └── util
│ │ │ │ └── FastDFSUtils.java
│ │ ├── format
│ │ │ ├── FormatException.java
│ │ │ ├── Formatter.java
│ │ │ ├── FormatterUtils.java
│ │ │ └── support
│ │ │ │ ├── FreeMarkerTemplateFormatter.java
│ │ │ │ ├── HTTLEngineFormatter.java
│ │ │ │ ├── MessageFormatter.java
│ │ │ │ ├── SpelFormatter.java
│ │ │ │ ├── StringTemplateV3Formatter.java
│ │ │ │ ├── StringTemplateV4Formatter.java
│ │ │ │ └── VelocityEngineFormatter.java
│ │ ├── kvStore
│ │ │ ├── AbstractKeyValueStoreTemplate.java
│ │ │ ├── KeyValueStoreException.java
│ │ │ ├── db
│ │ │ │ ├── KeyValueIterator.java
│ │ │ │ ├── KeyValueStore.java
│ │ │ │ ├── KeyValueStoreException.java
│ │ │ │ ├── serializer
│ │ │ │ │ └── Serializer.java
│ │ │ │ └── support
│ │ │ │ │ ├── RocksDbKeyValueStore.java
│ │ │ │ │ └── SerializableKeyValueStore.java
│ │ │ ├── memcached
│ │ │ │ ├── AbstractMemcachedTemplate.java
│ │ │ │ ├── MemcachedException.java
│ │ │ │ └── xmemcached
│ │ │ │ │ ├── BaseSerializingTranscoder.java
│ │ │ │ │ ├── SerializingTranscoder.java
│ │ │ │ │ ├── XMemcachedClient.java
│ │ │ │ │ ├── callback
│ │ │ │ │ ├── CallbackLockConfig.java
│ │ │ │ │ ├── SelectObjectCallback.java
│ │ │ │ │ ├── SelectObjectListCallback.java
│ │ │ │ │ └── XMemcachedClientCallback.java
│ │ │ │ │ ├── spring
│ │ │ │ │ ├── XMemcache.java
│ │ │ │ │ ├── XMemcachedCache.java
│ │ │ │ │ └── XMemcachedCacheManager.java
│ │ │ │ │ ├── support
│ │ │ │ │ ├── MemcachedLimiterFactory.java
│ │ │ │ │ ├── MemcachedLockFactory.java
│ │ │ │ │ └── XMemcachedClientTemplate.java
│ │ │ │ │ └── util
│ │ │ │ │ └── XMemcachedClientUtils.java
│ │ │ └── redis
│ │ │ │ ├── AbstractRedisTemplate.java
│ │ │ │ ├── RedisException.java
│ │ │ │ └── jedis
│ │ │ │ ├── JedisCallback.java
│ │ │ │ ├── ShardedJedisCallback.java
│ │ │ │ ├── support
│ │ │ │ ├── JedisTemplate.java
│ │ │ │ └── ShardedJedisTemplate.java
│ │ │ │ └── util
│ │ │ │ ├── JedisPoolUtils.java
│ │ │ │ └── ShardedJedisPoolUtils.java
│ │ └── scheduling
│ │ │ └── quartz
│ │ │ ├── MethodInvokingJobDetailFactoryBean.java
│ │ │ └── util
│ │ │ └── SchedulerUtils.java
│ │ ├── jdbc
│ │ └── support
│ │ │ └── incrementer
│ │ │ ├── JedisMaxValueIncrementer.java
│ │ │ └── ShardedJedisMaxValueIncrementer.java
│ │ ├── mail
│ │ └── EmailAddressBuilder.java
│ │ └── ui
│ │ ├── freemarker
│ │ └── FreeMarkerTemplateUtils.java
│ │ ├── httl
│ │ └── HTTLEngineUtils.java
│ │ ├── stringtemplate
│ │ ├── v3
│ │ │ └── StringTemplateUtils.java
│ │ └── v4
│ │ │ └── StringTemplateUtils.java
│ │ └── velocity
│ │ └── VelocityEngineUtils.java
│ └── test
│ ├── java
│ ├── com
│ │ └── thimbleware
│ │ │ └── jmemcached
│ │ │ └── protocol
│ │ │ └── MemcachedCommandHandler.java
│ └── org
│ │ ├── danielli
│ │ └── xultimate
│ │ │ ├── context
│ │ │ ├── dfs
│ │ │ │ └── fastdfs
│ │ │ │ │ ├── DownloadFileWriter.java
│ │ │ │ │ ├── Monitor.java
│ │ │ │ │ ├── Test.java
│ │ │ │ │ ├── Test1.java
│ │ │ │ │ ├── TestAppender.java
│ │ │ │ │ ├── TestAppender1.java
│ │ │ │ │ ├── TestClient.java
│ │ │ │ │ ├── TestClient1.java
│ │ │ │ │ ├── TestLoad.java
│ │ │ │ │ └── UploadLocalFileSender.java
│ │ │ ├── format
│ │ │ │ └── FormatterTest.java
│ │ │ ├── kvStore
│ │ │ │ ├── memcached
│ │ │ │ │ ├── CacheService.java
│ │ │ │ │ ├── MemcachedDaemon.java
│ │ │ │ │ ├── MemcachedDaemonTest.java
│ │ │ │ │ └── xmemcached
│ │ │ │ │ │ ├── Person.java
│ │ │ │ │ │ └── XMemcachedClientTest.java
│ │ │ │ └── redis
│ │ │ │ │ └── jedis
│ │ │ │ │ ├── Person.java
│ │ │ │ │ └── ShardedJedisTemplateTest.java
│ │ │ ├── mail
│ │ │ │ ├── JavaMailSenderTest.java
│ │ │ │ └── template
│ │ │ │ │ └── hello_world.httl
│ │ │ └── scheduling
│ │ │ │ └── quartz
│ │ │ │ ├── ExampleBusinessObject.java
│ │ │ │ ├── SchedulerTest.java
│ │ │ │ └── SimpleJob.java
│ │ │ └── jdbc
│ │ │ └── support
│ │ │ └── incrementer
│ │ │ └── ShardedJedisMaxValueIncrementerTest.java
│ │ └── quartz
│ │ └── impl
│ │ └── jdbcjobstore
│ │ ├── StdJDBCDelegate.java
│ │ └── StdRowLockSemaphore.java
│ └── resources
│ ├── applicationContext-dao-base.xml
│ ├── applicationContext-service-config.xml
│ ├── applicationContext-service-crypto.xml
│ ├── dfs
│ └── fastdfs
│ │ ├── README
│ │ ├── applicationContext-service-fastdfs.xml
│ │ └── fdfs_client.conf
│ ├── formatter
│ └── applicationContext-service-formatter.xml
│ ├── kvStore
│ ├── applicationContext-service-serializer.xml
│ ├── memcached
│ │ ├── applicationContext-service-memcached-daemon.xml
│ │ └── applicationContext-service-memcached.xml
│ └── redis
│ │ ├── README
│ │ └── applicationContext-service-redis.xml
│ ├── mail
│ ├── applicationContext-service-mail.xml
│ ├── file1.zip
│ ├── file2.doc
│ ├── img01.png
│ ├── mail.properties
│ └── mail.properties.bak
│ └── quartz
│ ├── applicationContext-dao-quartz.xml
│ ├── applicationContext-service-quartz.xml
│ ├── quartz.properties
│ └── tables_mysql_innodb.sql
├── xultimate-context
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── org
│ │ └── danielli
│ │ └── xultimate
│ │ └── context
│ │ ├── chardet
│ │ ├── CharsetDetector.java
│ │ ├── CharsetDetectorException.java
│ │ ├── cpdetector
│ │ │ └── InputStreamCharsetDetector.java
│ │ ├── icu4j
│ │ │ └── InputStreamCharsetDetector.java
│ │ ├── jchardet
│ │ │ ├── DefaultCharsetDetectionObserver.java
│ │ │ └── InputStreamCharsetDetector.java
│ │ ├── juniversalchardet
│ │ │ ├── DefaultCharsetListener.java
│ │ │ └── InputStreamCharsetDetector.java
│ │ └── support
│ │ │ ├── AbstractCharsetDetector.java
│ │ │ ├── FileCharsetDetector.java
│ │ │ └── URLCharsetDetector.java
│ │ ├── codec
│ │ ├── Decoder.java
│ │ ├── DecoderException.java
│ │ ├── Encoder.java
│ │ ├── EncoderException.java
│ │ └── support
│ │ │ ├── AbstractCoder.java
│ │ │ ├── Base64Codec.java
│ │ │ ├── ByteArrayStringCoder.java
│ │ │ ├── HexCodec.java
│ │ │ ├── StringStringCoder.java
│ │ │ └── URLCodec.java
│ │ ├── crypto
│ │ ├── Decryptor.java
│ │ ├── DecryptorException.java
│ │ ├── Encryptor.java
│ │ ├── EncryptorException.java
│ │ └── support
│ │ │ ├── AbstractCryptor.java
│ │ │ ├── AsymmetricAlgorithmsCryptor.java
│ │ │ ├── StringStringCryptor.java
│ │ │ └── SymmetricAlgorithmsCryptor.java
│ │ ├── i18n
│ │ ├── Message.java
│ │ ├── MessageType.java
│ │ └── MessageUtils.java
│ │ ├── image
│ │ ├── AbstractImageTemplate.java
│ │ ├── ImageCompositeTemplate.java
│ │ ├── ImageCropTemplate.java
│ │ ├── ImageException.java
│ │ ├── ImageInfoException.java
│ │ ├── ImageInfoTemplate.java
│ │ ├── ImageResizeTemplate.java
│ │ ├── awt
│ │ │ ├── ImageUtils.java
│ │ │ └── support
│ │ │ │ ├── ImageCompositeTemplateImpl.java
│ │ │ │ ├── ImageCropTemplateImpl.java
│ │ │ │ ├── ImageInfoTemplateImpl.java
│ │ │ │ └── ImageResizeTemplateImpl.java
│ │ ├── im4java
│ │ │ ├── AbstractIm4javaImageTemplate.java
│ │ │ ├── ImageCommandPostProcessor.java
│ │ │ └── support
│ │ │ │ ├── ImageCompositeTemplateImpl.java
│ │ │ │ ├── ImageCropTemplateImpl.java
│ │ │ │ ├── ImageInfoTemplateImpl.java
│ │ │ │ ├── ImageResizeTemplateImpl.java
│ │ │ │ └── RunCommandPostProcessor.java
│ │ └── model
│ │ │ ├── GeometryOperator.java
│ │ │ ├── Gravity.java
│ │ │ ├── ImageCoordinate.java
│ │ │ ├── ImageFormat.java
│ │ │ ├── ImageGeometry.java
│ │ │ ├── ImageGeometryCoordinate.java
│ │ │ ├── ImageInfo.java
│ │ │ └── ImageSize.java
│ │ ├── image2
│ │ ├── AbstractImageTemplate.java
│ │ ├── ImageCompositeTemplate.java
│ │ ├── ImageCropTemplate.java
│ │ ├── ImageException.java
│ │ ├── ImageInfoException.java
│ │ ├── ImageInfoTemplate.java
│ │ ├── ImageResizeTemplate.java
│ │ ├── awt
│ │ │ ├── ImageUtils.java
│ │ │ └── support
│ │ │ │ ├── ImageCompositeTemplateImpl.java
│ │ │ │ ├── ImageCropTemplateImpl.java
│ │ │ │ ├── ImageInfoTemplateImpl.java
│ │ │ │ └── ImageResizeTemplateImpl.java
│ │ ├── config
│ │ │ ├── DefaultImageResource.java
│ │ │ ├── GeometryOperator.java
│ │ │ ├── Gravity.java
│ │ │ ├── ImageCoordinate.java
│ │ │ ├── ImageFormat.java
│ │ │ ├── ImageGeometry.java
│ │ │ ├── ImageGeometryCoordinate.java
│ │ │ ├── ImageInfo.java
│ │ │ ├── ImageResource.java
│ │ │ ├── ImageSize.java
│ │ │ └── WrapperImageResource.java
│ │ └── im4java
│ │ │ ├── AbstractIm4javaImageTemplate.java
│ │ │ ├── ImageCommandPostProcessor.java
│ │ │ └── support
│ │ │ ├── ImageCompositeTemplateImpl.java
│ │ │ ├── ImageCropTemplateImpl.java
│ │ │ ├── ImageInfoTemplateImpl.java
│ │ │ ├── ImageResizeTemplateImpl.java
│ │ │ └── RunCommandPostProcessor.java
│ │ ├── net
│ │ └── netty
│ │ │ ├── codec
│ │ │ ├── JavaObjectCodec.java
│ │ │ ├── RpcKryoObjectCodec.java
│ │ │ ├── RpcProtobufObjectCodec.java
│ │ │ └── RpcProtostuffObjectCodec.java
│ │ │ └── support
│ │ │ ├── BootstrapFactoryBean.java
│ │ │ ├── ServerBootstrapFactoryBean.java
│ │ │ └── SocketChannelInitializerFactoryBean.java
│ │ ├── performance
│ │ ├── AbstractMonitoringInterceptor.java
│ │ ├── AbstractStopWatchMonitoringInterceptor.java
│ │ ├── AbstractTraceInterceptor.java
│ │ ├── PerformanceMonitor.java
│ │ ├── PerformanceMonitorForEachMethodInterceptor.java
│ │ └── PerformanceMonitorForOneMethodInterceptor.java
│ │ ├── support
│ │ └── EncryptPropertyPlaceholderConfigurer.java
│ │ └── util
│ │ ├── ApplicationContextUtils.java
│ │ └── BeanFactoryContext.java
│ └── test
│ ├── java
│ └── org
│ │ └── danielli
│ │ └── xultimate
│ │ └── context
│ │ ├── chardet
│ │ ├── FileCharsetDetectorTest.java
│ │ └── URLCharsetDetectorTest.java
│ │ ├── codec
│ │ ├── Base64CodecTest.java
│ │ ├── HexCodecTest.java
│ │ └── URLCodecTest.java
│ │ ├── config
│ │ ├── Boss.java
│ │ ├── Car.java
│ │ ├── CustomCarEditor.java
│ │ └── CustomCardEditorTest.java
│ │ ├── crypto
│ │ ├── AESCryptorTest.java
│ │ └── RSACryptorTest.java
│ │ ├── event
│ │ ├── EventTest.java
│ │ ├── Log1Listener.java
│ │ ├── Log2Listener.java
│ │ └── LogEvent.java
│ │ ├── i18n
│ │ └── MessageTest.java
│ │ ├── image
│ │ ├── ImageCompositeTemplateTest.java
│ │ ├── ImageCropTemplateTest.java
│ │ ├── ImageInfoTemplateTest.java
│ │ └── ImageResizeTemplateTest.java
│ │ ├── image2
│ │ ├── ImageCompositeTemplateTest.java
│ │ ├── ImageCropTemplateTest.java
│ │ ├── ImageInfoTemplateTest.java
│ │ └── ImageResizeTemplateTest.java
│ │ ├── performance
│ │ ├── PerformanceMonitorForEachMethodInterceptorTest.java
│ │ ├── PerformanceMonitorForOneMethodInterceptorTest.java
│ │ ├── biz
│ │ │ └── TestBiz.java
│ │ └── service
│ │ │ └── TestService.java
│ │ ├── support
│ │ └── EncryptPropertyPlaceholderConfigurerTest.java
│ │ └── util
│ │ └── ApplicationContextUtilsTest.java
│ └── resources
│ ├── applicationContext-config.xml
│ ├── applicationContext-service-codec.xml
│ ├── applicationContext-service-config.xml
│ ├── applicationContext-service-crypto.xml
│ ├── applicationContext-service-event.xml
│ ├── applicationContext-service-util.xml
│ ├── chardet
│ ├── applicationContext-service-chardet.xml
│ └── test.txt
│ ├── i18n
│ ├── applicationContext-service-i18n.xml
│ ├── test_en_US.properties
│ └── test_zh_CN.properties
│ ├── image
│ ├── applicationContext-service-image.xml
│ ├── go-home.png
│ └── test.jpg
│ ├── image2
│ ├── applicationContext-service-image.xml
│ ├── go-home.png
│ └── test.jpg
│ ├── performance
│ ├── applicationContext-service-performance-each.xml
│ └── applicationContext-service-performance-one.xml
│ └── support
│ ├── applicationContext-service-support.xml
│ └── test.properties
├── xultimate-core
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── danielli
│ │ │ └── xultimate
│ │ │ ├── core
│ │ │ ├── ClassTypeSupporter.java
│ │ │ ├── compression
│ │ │ │ ├── Compressor.java
│ │ │ │ ├── CompressorException.java
│ │ │ │ ├── Decompressor.java
│ │ │ │ ├── DecompressorException.java
│ │ │ │ └── support
│ │ │ │ │ ├── GZipCompressor.java
│ │ │ │ │ ├── NullCompressor.java
│ │ │ │ │ └── SnappyJavaCompressor.java
│ │ │ ├── io
│ │ │ │ ├── AbstractObjectInput.java
│ │ │ │ ├── AbstractObjectOutput.java
│ │ │ │ └── support
│ │ │ │ │ ├── JavaObjectInput.java
│ │ │ │ │ ├── JavaObjectOutput.java
│ │ │ │ │ ├── RpcKryoObjectInput.java
│ │ │ │ │ ├── RpcKryoObjectOutput.java
│ │ │ │ │ ├── RpcProtobufObjectInput.java
│ │ │ │ │ ├── RpcProtobufObjectOutput.java
│ │ │ │ │ ├── RpcProtostuffObjectInput.java
│ │ │ │ │ ├── RpcProtostuffObjectOutput.java
│ │ │ │ │ ├── UnicodeInputStream.java
│ │ │ │ │ └── UnicodeReader.java
│ │ │ ├── json
│ │ │ │ ├── JSONException.java
│ │ │ │ ├── JSONTemplate.java
│ │ │ │ ├── JsonUtils.java
│ │ │ │ ├── ValueType.java
│ │ │ │ ├── fastjson
│ │ │ │ │ ├── FastJSONTemplate.java
│ │ │ │ │ └── ValueTypeAdapter.java
│ │ │ │ └── jackson
│ │ │ │ │ ├── JacksonTemplate.java
│ │ │ │ │ └── ValueTypeAdapter.java
│ │ │ ├── serializer
│ │ │ │ ├── AbstractClassTypeSupporterSerializer.java
│ │ │ │ ├── ClassTypeSupporterSerializer.java
│ │ │ │ ├── Deserializer.java
│ │ │ │ ├── DeserializerException.java
│ │ │ │ ├── RpcSerializer.java
│ │ │ │ ├── Serializer.java
│ │ │ │ ├── SerializerException.java
│ │ │ │ ├── java
│ │ │ │ │ ├── JavaObjectSerializer.java
│ │ │ │ │ └── util
│ │ │ │ │ │ └── SerializerUtils.java
│ │ │ │ ├── kryo
│ │ │ │ │ ├── KryoGenerator.java
│ │ │ │ │ ├── RpcKryoSerializer.java
│ │ │ │ │ └── support
│ │ │ │ │ │ ├── DefaultKryoGenerator.java
│ │ │ │ │ │ ├── KryoContext.java
│ │ │ │ │ │ └── ThreadLocalKryoGenerator.java
│ │ │ │ └── protostuff
│ │ │ │ │ ├── RpcProtobufSerializer.java
│ │ │ │ │ ├── RpcProtostuffSerializer.java
│ │ │ │ │ ├── support
│ │ │ │ │ └── ProtobufClassTypeNotSupporter.java
│ │ │ │ │ └── util
│ │ │ │ │ └── LinkedBufferUtils.java
│ │ │ └── support
│ │ │ │ ├── DefaultClassTypeNotSupporter.java
│ │ │ │ └── DefaultClassTypeSupporter.java
│ │ │ └── util
│ │ │ ├── ArrayUtils.java
│ │ │ ├── Assert.java
│ │ │ ├── BooleanUtils.java
│ │ │ ├── CharUtils.java
│ │ │ ├── CharsetUtils.java
│ │ │ ├── EnumUtils.java
│ │ │ ├── StringUtils.java
│ │ │ ├── builder
│ │ │ ├── BuildType.java
│ │ │ ├── Buildable.java
│ │ │ ├── CompareToBuilderUtils.java
│ │ │ ├── EqualsBuilderUtils.java
│ │ │ ├── HashCodeBuilderUtils.java
│ │ │ └── ToStringBuilderUtils.java
│ │ │ ├── collections
│ │ │ ├── CollectionUtils.java
│ │ │ ├── ListBuilder.java
│ │ │ ├── MapBuilder.java
│ │ │ ├── MapUtils.java
│ │ │ └── SetBuilder.java
│ │ │ ├── crypto
│ │ │ ├── AsymmetricAlgorithms.java
│ │ │ ├── CipherUtils.java
│ │ │ ├── CryptoException.java
│ │ │ ├── DigestUtils.java
│ │ │ ├── MessageDigestAlgorithms.java
│ │ │ └── SymmetricAlgorithms.java
│ │ │ ├── exception
│ │ │ └── ExceptionUtils.java
│ │ │ ├── io
│ │ │ ├── FileUtils.java
│ │ │ ├── FilenameUtils.java
│ │ │ └── IOUtils.java
│ │ │ ├── math
│ │ │ ├── NumberUtils.java
│ │ │ └── RandomNumberUtils.java
│ │ │ ├── performance
│ │ │ └── PerformanceMonitor.java
│ │ │ ├── pinyin
│ │ │ ├── PinyinCallback.java
│ │ │ └── PinyinUtils.java
│ │ │ ├── reflect
│ │ │ ├── AnnotationUtils.java
│ │ │ ├── BeanUtils.java
│ │ │ └── ClassUtils.java
│ │ │ ├── thread
│ │ │ └── ThreadUtils.java
│ │ │ └── time
│ │ │ ├── ChineseCalendarGB.java
│ │ │ ├── DateUtils.java
│ │ │ ├── DurationFormatUtils.java
│ │ │ └── stopwatch
│ │ │ ├── StopWatch.java
│ │ │ ├── StopWatchContext.java
│ │ │ ├── StopWatchState.java
│ │ │ ├── StopWatchSummary.java
│ │ │ └── support
│ │ │ ├── AbstractStopWatchSummary.java
│ │ │ ├── AdvancedStopWatchSummary.java
│ │ │ ├── DefaultStopWatchSummary.java
│ │ │ └── SimpleStopWatchSummary.java
│ └── resources
│ │ ├── log4j2.sync.xml
│ │ ├── log4j2.xml
│ │ ├── logback.xml
│ │ └── org
│ │ └── ocpsoft
│ │ └── prettytime
│ │ └── i18n
│ │ └── Resources_zh_CN.properties
│ └── test
│ ├── java
│ └── org
│ │ └── danielli
│ │ └── xultimate
│ │ ├── DateTimeTest.java
│ │ ├── PrettyTimeTest.java
│ │ ├── ProxyTest.java
│ │ ├── SiftingAppenderTest.java
│ │ ├── core
│ │ ├── compression
│ │ │ └── CompressorTest.java
│ │ ├── json
│ │ │ └── JSONTemplateTest.java
│ │ └── serializer
│ │ │ ├── JavaSerializingTest.java
│ │ │ ├── KryoSerializingTest.java
│ │ │ ├── ProtobufSerializingTest.java
│ │ │ ├── ProtostuffSerializingTest.java
│ │ │ ├── SerializerTest.java
│ │ │ ├── User.java
│ │ │ ├── kryo
│ │ │ └── LocalKryoSerializer.java
│ │ │ ├── protostuff
│ │ │ ├── LocalProtobufSerializer.java
│ │ │ └── LocalProtostuffSerializer.java
│ │ │ └── support
│ │ │ ├── BaseTypeDeserializer.java
│ │ │ ├── BaseTypeSerializer.java
│ │ │ ├── DeserializerFactory.java
│ │ │ └── SerializerFactory.java
│ │ └── util
│ │ ├── builder
│ │ ├── CompareToBuilderUtilsTest.java
│ │ ├── Employee.java
│ │ ├── EqualsBuilderUtilsTest.java
│ │ ├── HashCodeBuilderUtilsTest.java
│ │ ├── Manager.java
│ │ ├── Person.java
│ │ └── ToStringBuilderUtilsTest.java
│ │ ├── crypto
│ │ ├── CipherUtilsTest.java
│ │ └── DigestUtilsTest.java
│ │ ├── math
│ │ └── NumberUtilsTest.java
│ │ ├── performance
│ │ └── PerformanceMonitorTest.java
│ │ ├── pinyin
│ │ └── PinyinUtilsTest.java
│ │ ├── reflect
│ │ ├── BeanUtilsTest.java
│ │ └── ReflectTest.java
│ │ └── time
│ │ ├── ChineseCalendarGBTest.java
│ │ └── StopWatchTest.java
│ └── resources
│ ├── applicationContext-service-compression.xml
│ ├── applicationContext-service-json.xml
│ ├── applicationContext-service-serializer.xml
│ └── source
├── xultimate-jdbc
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── danielli
│ │ │ └── xultimate
│ │ │ ├── jdbc
│ │ │ ├── datasource
│ │ │ │ └── lookup
│ │ │ │ │ ├── DataSourceContext.java
│ │ │ │ │ ├── RoutingDataSource.java
│ │ │ │ │ └── RoutingProxyDataSourceFactoryBean.java
│ │ │ ├── support
│ │ │ │ └── incrementer
│ │ │ │ │ ├── AbstractDataFieldMaxValueIncrementer.java
│ │ │ │ │ ├── AbstractKeyMaxValueIncrementer.java
│ │ │ │ │ ├── AbstractSequenceMaxValueIncrementer.java
│ │ │ │ │ ├── H2SequenceMaxValueIncrementer.java
│ │ │ │ │ ├── MySQLMaxValueIncrementer.java
│ │ │ │ │ └── OracleSequenceMaxValueIncrementer.java
│ │ │ └── type
│ │ │ │ ├── CodeEnum.java
│ │ │ │ ├── CodeEnums.java
│ │ │ │ └── StateSet.java
│ │ │ └── transaction
│ │ │ ├── ChainedTransactionManager.java
│ │ │ ├── MultiTransactionStatus.java
│ │ │ ├── RoutingDataSourceTransactionManager.java
│ │ │ ├── SpringTransactionSynchronizationManager.java
│ │ │ └── SynchronizationManager.java
│ └── webapp
│ │ └── WEB-INF
│ │ └── web.xml
│ └── test
│ ├── java
│ └── org
│ │ └── danielli
│ │ └── xultimate
│ │ ├── jdbc
│ │ ├── DataSourceTest.java
│ │ ├── support
│ │ │ └── incrementer
│ │ │ │ └── DataFieldMaxValueIncrementerTest.java
│ │ └── type
│ │ │ └── StateSetTest.java
│ │ └── transaction
│ │ ├── ChainedTransactionManagerTest.java
│ │ ├── biz
│ │ ├── OtherBiz.java
│ │ ├── UserBiz.java
│ │ └── impl
│ │ │ ├── OtherBizImpl.java
│ │ │ └── UserBizImpl.java
│ │ ├── dao
│ │ ├── OtherDAO.java
│ │ ├── UserDAO.java
│ │ └── impl
│ │ │ ├── OtherDAOImpl.java
│ │ │ └── UserDAOImpl.java
│ │ └── service
│ │ ├── UserService.java
│ │ └── impl
│ │ └── UserServiceImpl.java
│ └── resources
│ ├── applicationContext-dao-base.xml
│ ├── applicationContext-dao-datasource.xml
│ ├── applicationContext-service-config.xml
│ ├── applicationContext-service-crypto.xml
│ ├── primaryKey
│ ├── applicationContext-dao-primaryKey.xml
│ ├── databases.properties
│ ├── primary_key_1_destroy.sql
│ ├── primary_key_1_init.sql
│ ├── primary_key_2_destroy.sql
│ └── primary_key_2_init.sql
│ └── transaction
│ ├── applicationContext-service-transaction.xml
│ ├── other_destroy.sql
│ ├── other_init.sql
│ ├── user_destroy.sql
│ └── user_init.sql
├── xultimate-orm
├── pom.xml
├── xultimate-hibernate
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── org
│ │ │ │ └── danielli
│ │ │ │ └── xultimate
│ │ │ │ └── orm
│ │ │ │ └── jpa
│ │ │ │ ├── DefaultGenericBiz.java
│ │ │ │ ├── GenericBiz.java
│ │ │ │ ├── GenericDAO.java
│ │ │ │ ├── config
│ │ │ │ ├── DatabaseNamingStrategy.java
│ │ │ │ ├── DatabaseNamingStrategyModel.java
│ │ │ │ ├── ProxyInitializer.java
│ │ │ │ ├── SessionCallback.java
│ │ │ │ ├── SessionFactoryUtils.java
│ │ │ │ └── support
│ │ │ │ │ └── HibernateProxyInitializer.java
│ │ │ │ ├── ds
│ │ │ │ ├── ComparsionOperator.java
│ │ │ │ ├── Item.java
│ │ │ │ ├── ItemsSpecification.java
│ │ │ │ ├── LogicalOperator.java
│ │ │ │ ├── Value.java
│ │ │ │ ├── ValueUtils.java
│ │ │ │ └── support
│ │ │ │ │ ├── GenericValue.java
│ │ │ │ │ ├── Pair.java
│ │ │ │ │ └── StringValue.java
│ │ │ │ └── id
│ │ │ │ ├── DateEntity.java
│ │ │ │ ├── IDEntity.java
│ │ │ │ ├── NormsEntity.java
│ │ │ │ ├── NormsListener.java
│ │ │ │ └── VersionEntity.java
│ │ └── webapp
│ │ │ └── WEB-INF
│ │ │ └── web.xml
│ │ └── test
│ │ ├── java
│ │ └── org
│ │ │ └── danielli
│ │ │ └── xultimate
│ │ │ └── orm
│ │ │ └── jpa
│ │ │ ├── BaseEntity.java
│ │ │ ├── area
│ │ │ ├── AreaServiceImplTest.java
│ │ │ ├── biz
│ │ │ │ ├── AreaBiz.java
│ │ │ │ └── impl
│ │ │ │ │ └── AreaBizImpl.java
│ │ │ ├── dao
│ │ │ │ ├── AreaDAO.java
│ │ │ │ ├── AreaDAOExt.java
│ │ │ │ └── AreaDAOImpl.java
│ │ │ ├── domain
│ │ │ │ ├── Area.java
│ │ │ │ └── AreaEntityListener.java
│ │ │ └── service
│ │ │ │ ├── AreaService.java
│ │ │ │ └── impl
│ │ │ │ └── AreaServiceImpl.java
│ │ │ └── cache
│ │ │ ├── CacheUsage.java
│ │ │ └── domain
│ │ │ ├── Address.java
│ │ │ └── Person.java
│ │ └── resources
│ │ ├── README
│ │ ├── applicationContext-dao-base.xml
│ │ ├── applicationContext-dao-generic.xml
│ │ ├── applicationContext-service-config.xml
│ │ ├── applicationContext-service-crypto.xml
│ │ ├── applicationContext-service-generic.xml
│ │ ├── applicationContext-service-util.xml
│ │ ├── databases.properties
│ │ └── orm.properties
└── xultimate-mybatis
│ ├── pom.xml
│ └── src
│ ├── main
│ └── java
│ │ └── org
│ │ └── danielli
│ │ └── xultimate
│ │ └── orm
│ │ └── mybatis
│ │ ├── MyBatisRepository.java
│ │ ├── SqlSessionFactoryBean.java
│ │ ├── ds
│ │ ├── ComparsionOperator.java
│ │ ├── Item.java
│ │ ├── LogicalOperator.java
│ │ ├── Value.java
│ │ ├── ValueUtils.java
│ │ └── support
│ │ │ ├── GenericValue.java
│ │ │ ├── Pair.java
│ │ │ └── StringValue.java
│ │ └── type
│ │ ├── AbstractNullParameterTypeHandler.java
│ │ ├── BigDecimalTypeHandler.java
│ │ ├── BooleanTypeHandler.java
│ │ ├── ClobNullParameterTypeHandler.java
│ │ ├── CodeEnumOrdinalTypeHandler.java
│ │ ├── IntegerNullParameterTypeHandler.java
│ │ ├── LongNullParameterTypeHandler.java
│ │ ├── ReverseStringNullParameterTypeHandler.java
│ │ ├── StateSetTypeHandler.java
│ │ └── StringNullParameterTypeHandler.java
│ └── test
│ ├── java
│ └── org
│ │ └── danielli
│ │ └── xultimate
│ │ └── orm
│ │ └── mybatis
│ │ ├── area
│ │ ├── AreaServiceImplTest.java
│ │ ├── PerformanceTest.java
│ │ ├── biz
│ │ │ ├── AreaBiz.java
│ │ │ └── impl
│ │ │ │ └── AreaBizImpl.java
│ │ ├── dao
│ │ │ └── AreaDAO.java
│ │ └── service
│ │ │ ├── AreaService.java
│ │ │ └── impl
│ │ │ └── AreaServiceImpl.java
│ │ ├── po
│ │ ├── Area.java
│ │ ├── TestPo.java
│ │ └── e
│ │ │ ├── Sex.java
│ │ │ └── TestEnum.java
│ │ └── type
│ │ ├── NetworkUtils.java
│ │ ├── TestPoServiceTest.java
│ │ ├── biz
│ │ ├── TestPoBiz.java
│ │ └── impl
│ │ │ └── TestPoBizImpl.java
│ │ ├── dao
│ │ └── TestPoDAO.java
│ │ └── service
│ │ ├── TestPoService.java
│ │ └── impl
│ │ └── TestPoServiceImpl.java
│ └── resources
│ ├── README
│ ├── applicationContext-dao-base.xml
│ ├── applicationContext-dao-generic.xml
│ ├── applicationContext-dao-generic.xml.bak
│ ├── applicationContext-service-config.xml
│ ├── applicationContext-service-crypto.xml
│ ├── applicationContext-service-generic.xml
│ ├── databases.properties
│ ├── mybatis
│ ├── AreaDAO.xml
│ ├── TestPoDAO.xml
│ └── mybatis-3-mapper.dtd
│ └── mybatis_init.sql
├── xultimate-shard
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── danielli
│ │ │ └── xultimate
│ │ │ └── shard
│ │ │ ├── Action.java
│ │ │ ├── Filter.java
│ │ │ ├── Operator.java
│ │ │ ├── ShardInfoGenerator.java
│ │ │ ├── ShardUtils.java
│ │ │ ├── dto
│ │ │ └── ShardInfo.java
│ │ │ ├── mybatis
│ │ │ ├── MyBatisShardInfoGenerator.java
│ │ │ ├── biz
│ │ │ │ ├── PartitionedTableIntervalBiz.java
│ │ │ │ ├── VirtualSocketBindRecordBiz.java
│ │ │ │ ├── VirtualTableBiz.java
│ │ │ │ ├── VirtualTableIntervalBiz.java
│ │ │ │ └── impl
│ │ │ │ │ ├── PartitionedTableIntervalBizImpl.java
│ │ │ │ │ ├── VirtualSocketBindRecordBizImpl.java
│ │ │ │ │ ├── VirtualTableBizImpl.java
│ │ │ │ │ └── VirtualTableIntervalBizImpl.java
│ │ │ └── dao
│ │ │ │ ├── PartitionedTableIntervalDAO.java
│ │ │ │ ├── VirtualSocketBindRecordDAO.java
│ │ │ │ ├── VirtualTableDAO.java
│ │ │ │ └── VirtualTableIntervalDAO.java
│ │ │ └── po
│ │ │ ├── PartitionedTable.java
│ │ │ ├── PartitionedTableInterval.java
│ │ │ ├── VirtualDatabase.java
│ │ │ ├── VirtualSocket.java
│ │ │ ├── VirtualSocketBindRecord.java
│ │ │ ├── VirtualTable.java
│ │ │ └── VirtualTableInterval.java
│ └── resources
│ │ └── mybatis
│ │ ├── PartitionedTableDAO.xml
│ │ ├── PartitionedTableIntervalDAO.xml
│ │ ├── VirtualSocketBindRecordDAO.xml
│ │ ├── VirtualSocketDAO.xml
│ │ ├── VirtualTableDAO.xml
│ │ ├── VirtualTableIntervalDAO.xml
│ │ └── mybatis-3-mapper.dtd
│ └── test
│ ├── java
│ └── org
│ │ └── danielli
│ │ └── xultimate
│ │ └── shard
│ │ └── ShardInfoGeneratorTest.java
│ └── resources
│ ├── applicationContext-dao-base.xml
│ ├── applicationContext-service-config.xml
│ ├── applicationContext-service-crypto.xml
│ ├── primaryKey
│ ├── applicationContext-dao-primaryKey.xml
│ ├── databases.properties
│ ├── primary_key_1_destroy.sql
│ └── primary_key_1_init.sql
│ └── shard
│ ├── applicationContext-dao-generic.xml
│ ├── applicationContext-dao-shard.xml
│ ├── applicationContext-service-generic.xml
│ ├── applicationContext-service-memcached.xml
│ ├── applicationContext-service-serializer.xml
│ ├── databases.properties
│ └── shard_db_init.sql
├── xultimate-test
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── danielli
│ │ │ └── xultimate
│ │ │ └── test
│ │ │ ├── vo
│ │ │ └── User.java
│ │ │ └── web
│ │ │ ├── controller
│ │ │ ├── AnalysisController.java
│ │ │ └── UserController.java
│ │ │ └── converter
│ │ │ └── UserConverter.java
│ ├── resources
│ │ ├── applicationContext-service-i18n.xml
│ │ ├── applicationContext-service-util.xml
│ │ ├── applicationContext-servlet.xml
│ │ ├── shell
│ │ │ └── mysql
│ │ │ │ ├── analyze.sh
│ │ │ │ └── collect.sh
│ │ └── test_zh_CN.properties
│ └── webapp
│ │ ├── META-INF
│ │ └── context.xml
│ │ ├── WEB-INF
│ │ ├── template
│ │ │ ├── error
│ │ │ │ └── throwable.httl
│ │ │ └── httl
│ │ │ │ ├── analysis
│ │ │ │ ├── mysql_status.httl
│ │ │ │ └── tprofiler_topmethod.httl
│ │ │ │ ├── error.httl
│ │ │ │ ├── param1.httl
│ │ │ │ ├── param2.httl
│ │ │ │ ├── param2_error.httl
│ │ │ │ └── test1.httl
│ │ └── web.xml
│ │ └── resources
│ │ ├── highcharts
│ │ ├── exporting.js
│ │ └── highcharts.js
│ │ └── js
│ │ ├── jquery-2.0.3.js
│ │ └── jquery.form.js
│ └── test
│ ├── java
│ ├── CharTest.java
│ └── org
│ │ └── danielli
│ │ └── xultimate
│ │ ├── test
│ │ ├── custom
│ │ │ ├── CharacterTest.java
│ │ │ ├── ErrorTest.java
│ │ │ ├── IntegerDecodeTest.java
│ │ │ ├── RuntimeConstantPoolOOMTest.java
│ │ │ ├── audition
│ │ │ │ ├── Count.java
│ │ │ │ ├── QuickSort.java
│ │ │ │ ├── ThreadIncDec.java
│ │ │ │ └── ThreadReadWrite.java
│ │ │ └── cglib
│ │ │ │ ├── Action.java
│ │ │ │ ├── CglibClass.java
│ │ │ │ ├── CglibInterface.java
│ │ │ │ ├── callback
│ │ │ │ ├── DefaultActionInvocationHandler.java
│ │ │ │ └── DefaultActionMethodInterceptor.java
│ │ │ │ └── support
│ │ │ │ └── DefaultAction.java
│ │ ├── io
│ │ │ ├── aio
│ │ │ │ ├── Client.java
│ │ │ │ ├── ClientWithHandler.java
│ │ │ │ ├── Server.java
│ │ │ │ └── ServerWithHandler.java
│ │ │ └── nio
│ │ │ │ ├── Client.java
│ │ │ │ └── Server.java
│ │ ├── jvm
│ │ │ ├── chapter2
│ │ │ │ ├── DirectMemoryOOM.java
│ │ │ │ ├── HeapOOM.java
│ │ │ │ ├── JavaMethodAreaOOM.java
│ │ │ │ ├── JavaVMStackOOM.java
│ │ │ │ ├── JavaVMStackSOF.java
│ │ │ │ ├── RuntimeConstantPoolOOM.java
│ │ │ │ └── RuntimeConstantPoolOOM1.java
│ │ │ ├── chapter3
│ │ │ │ ├── FinalizeEscapeGC.java
│ │ │ │ ├── GCSample1.java
│ │ │ │ ├── GCSample2.java
│ │ │ │ ├── GCSample3.java
│ │ │ │ ├── GCSample4.java
│ │ │ │ ├── GCSample5.java
│ │ │ │ └── ReferenceCountingGC.java
│ │ │ ├── chapter4
│ │ │ │ ├── JConsoleSample1.java
│ │ │ │ ├── JConsoleSample2.java
│ │ │ │ └── JConsoleSample3.java
│ │ │ └── chapter8
│ │ │ │ └── ClassLoaderTest.java
│ │ └── thread
│ │ │ ├── CountDownLatchCase.java
│ │ │ ├── CyclicBarrierCase.java
│ │ │ ├── ExchangerCase.java
│ │ │ ├── LongCase.java
│ │ │ ├── SemaphoreCase.java
│ │ │ ├── SynchronousQueueCase.java
│ │ │ ├── VolatileCase.java
│ │ │ ├── atom
│ │ │ └── AtomicInteger.java
│ │ │ ├── disruptor
│ │ │ ├── LongEvent.java
│ │ │ ├── LongEventCase.java
│ │ │ ├── LongEventFactory.java
│ │ │ ├── LongEventHandler.java
│ │ │ ├── LongEventProducer.java
│ │ │ └── LongEventProducerWithTranslator.java
│ │ │ ├── forkjoin
│ │ │ ├── CalculatorTest.java
│ │ │ └── SortTaskTest.java
│ │ │ └── linkedhashmap
│ │ │ └── ConcurrentLinkedHashMapTest.java
│ │ └── testexample
│ │ ├── UserControllerTest.java
│ │ ├── junit
│ │ ├── GroupTest.java
│ │ └── support
│ │ │ ├── ConstructorTest.java
│ │ │ ├── ExampleTest.java
│ │ │ └── ExceptionTest.java
│ │ └── mock
│ │ └── support
│ │ ├── User.java
│ │ ├── UserService.java
│ │ ├── UserServiceImpl.java
│ │ └── UserServiceMockTest.java
│ └── resources
│ ├── lock
│ └── README
│ └── threadpool
│ └── README
├── xultimate-web
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── danielli
│ │ │ └── xultimate
│ │ │ ├── context
│ │ │ └── config
│ │ │ │ └── StringToFileArrayPropertyEditor.java
│ │ │ ├── util
│ │ │ └── io
│ │ │ │ └── ResourceUtils.java
│ │ │ └── web
│ │ │ ├── context
│ │ │ └── response
│ │ │ │ ├── GzipResponseStream.java
│ │ │ │ └── GzipResponseWrapper.java
│ │ │ ├── filter
│ │ │ └── GzipCompressFilter.java
│ │ │ ├── listener
│ │ │ └── LoggerHostListener.java
│ │ │ └── util
│ │ │ ├── BrowserCacheGenerator.java
│ │ │ ├── CookieGenerator.java
│ │ │ ├── HtmlUtils.java
│ │ │ ├── MobileChecker.java
│ │ │ ├── NetworkUtils.java
│ │ │ ├── PasswordCallback.java
│ │ │ ├── PropertyCallback.java
│ │ │ ├── RememberMeService.java
│ │ │ ├── ServletRequestUtils.java
│ │ │ ├── ShortURLGenerator.java
│ │ │ └── WebUtils.java
│ └── webapp
│ │ └── WEB-INF
│ │ └── web.xml
│ └── test
│ ├── java
│ └── org
│ │ └── danielli
│ │ └── xultimate
│ │ └── web
│ │ └── RestTemplateTest.java
│ └── resources
│ ├── applicationContext-web-cache.xml
│ ├── applicationContext-web-cookie.xml
│ ├── applicationContext-web-rememberme.xml
│ ├── applicationContext-web-rest.xml
│ └── cookie.properties
└── xultimate-webmvc
├── pom.xml
└── src
└── main
└── java
└── org
└── danielli
└── xultimate
└── web
├── filter
├── BrowseLimiterFilter.java
└── BrowserCacheFilter.java
└── servlet
├── i18n
└── RequestContextInterceptor.java
└── view
└── httl
└── HttlViewResolver.java
/.gitignore:
--------------------------------------------------------------------------------
1 | .settings
2 | .project
3 | .classpath
4 |
5 | .idea
6 | *.ipr
7 | *.iml
8 | *.iws
9 |
10 | .DS_Store
11 | Thumbs.db
12 |
13 | *.class
14 |
15 | target
16 |
17 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/dfs/DistributedFileSystemException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.dfs;
2 |
3 | import org.springframework.core.NestedRuntimeException;
4 |
5 | /**
6 | * 分布式文件系统异常。
7 | *
8 | * @author Daniel Li
9 | * @since 19 Jun 2013
10 | * @see NestedRuntimeException
11 | */
12 | public class DistributedFileSystemException extends NestedRuntimeException {
13 |
14 | private static final long serialVersionUID = -5363328862858087052L;
15 |
16 | public DistributedFileSystemException(String message) {
17 | super(message);
18 | }
19 |
20 | public DistributedFileSystemException(String message, Throwable cause) {
21 | super(message, cause);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/dfs/fastdfs/support/ClientGlobalInitializer.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.dfs.fastdfs.support;
2 |
3 | import org.csource.fastdfs.ClientGlobal;
4 | import org.springframework.beans.factory.InitializingBean;
5 | import org.springframework.core.io.Resource;
6 |
7 | /**
8 | * 客户端配置初始化器。
9 | *
10 | * @author Daniel Li
11 | * @since 19 Jun 2013
12 | */
13 | public class ClientGlobalInitializer implements InitializingBean {
14 |
15 | private Resource configResource;
16 |
17 | /**
18 | * 设置客户端配置资源。
19 | *
20 | * @param configResource 客户端配置资源。
21 | */
22 | public void setConfigResource(Resource configResource) {
23 | this.configResource = configResource;
24 | }
25 |
26 | /**
27 | * 初始化配置信息。
28 | */
29 | @Override
30 | public void afterPropertiesSet() throws Exception {
31 | ClientGlobal.init(configResource.getFile().getAbsolutePath());
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/format/FormatException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.format;
2 |
3 | import org.springframework.core.NestedRuntimeException;
4 |
5 | /**
6 | * 格式化异常。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | * @see NestedRuntimeException
11 | */
12 | public class FormatException extends NestedRuntimeException {
13 |
14 | private static final long serialVersionUID = 2303266621170729888L;
15 |
16 | public FormatException(String message) {
17 | super(message);
18 | }
19 |
20 | public FormatException(String message, Throwable cause) {
21 | super(message, cause);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/format/Formatter.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.format;
2 |
3 | /**
4 | * 格式化器。
5 | *
6 | * @author Daniel Li
7 | * @since 18 Jun 2013
8 | *
9 | * @param 原始源。
10 | * @param
源始源参数。
11 | * @param 目标源。
12 | */
13 | public interface Formatter {
14 |
15 | /**
16 | * 格式化。
17 | *
18 | * @param source 原始源。
19 | * @param parameter 源始源参数。
20 | * @return 目标源。
21 | * @throws FormatException 格式化异常,会对格式化过程中出现的异常封装并抛出。
22 | */
23 | T format(S source, P parameter) throws FormatException;
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/format/FormatterUtils.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.format;
2 |
3 | import org.danielli.xultimate.context.format.support.MessageFormatter;
4 |
5 | /**
6 | * 格式化工具类。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | */
11 | public class FormatterUtils {
12 |
13 | /**
14 | * 格式化。
15 | *
16 | * @param source 原始源。
17 | * @param parameter 源始源参数。
18 | * @return 目标源。
19 | * @throws FormatException 格式化异常,会对格式化过程中出现的异常封装并抛出。
20 | */
21 | public static String format(String source, Object... parameter) throws FormatException {
22 | return MessageFormatter.FORMATTER.format(source, parameter);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/format/support/MessageFormatter.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.format.support;
2 |
3 | import java.text.MessageFormat;
4 |
5 | import org.danielli.xultimate.context.format.FormatException;
6 | import org.danielli.xultimate.context.format.Formatter;
7 |
8 | /**
9 | * 格式化器。是{@link MessageFormat}的实现。
10 | *
11 | * @author Daniel Li
12 | * @since 18 Jun 2013
13 | * @see Formatter
14 | * @see MessageFormat
15 | */
16 | public class MessageFormatter implements Formatter {
17 |
18 | public static final MessageFormatter FORMATTER = new MessageFormatter();
19 |
20 | private MessageFormatter() {
21 | }
22 |
23 | @Override
24 | public String format(String source, Object[] parameter) throws FormatException {
25 | try {
26 | return MessageFormat.format(source, parameter);
27 | } catch (Exception e) {
28 | throw new FormatException(e.getMessage(), e);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/format/support/StringTemplateV3Formatter.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.format.support;
2 |
3 | import java.util.Map;
4 |
5 | import org.antlr.stringtemplate.StringTemplate;
6 | import org.danielli.xultimate.context.format.FormatException;
7 | import org.danielli.xultimate.context.format.Formatter;
8 | import org.danielli.xultimate.ui.stringtemplate.v3.StringTemplateUtils;
9 |
10 | /**
11 | * 格式化器。是StringTemplate 3.x版本的实现。
12 | *
13 | * @author Daniel Li
14 | * @since 18 Jun 2013
15 | * @see Formatter
16 | */
17 | public class StringTemplateV3Formatter implements Formatter, String> {
18 |
19 | @Override
20 | public String format(String source, Map parameter) throws FormatException {
21 | StringTemplate template = new StringTemplate(source);
22 | return StringTemplateUtils.processTemplateIntoString(template, parameter);
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/format/support/StringTemplateV4Formatter.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.format.support;
2 |
3 | import java.util.Map;
4 |
5 | import org.danielli.xultimate.context.format.FormatException;
6 | import org.danielli.xultimate.context.format.Formatter;
7 | import org.danielli.xultimate.ui.stringtemplate.v4.StringTemplateUtils;
8 | import org.stringtemplate.v4.ST;
9 |
10 | /**
11 | * 格式化器。是StringTemplate 4.x版本的实现。
12 | *
13 | * @author Daniel Li
14 | * @since 18 Jun 2013
15 | * @see Formatter
16 | */
17 | public class StringTemplateV4Formatter implements Formatter, String> {
18 |
19 | @Override
20 | public String format(String source, Map parameter) throws FormatException {
21 | ST template = new ST(source);
22 | return StringTemplateUtils.processTemplateIntoString(template, parameter);
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/kvStore/AbstractKeyValueStoreTemplate.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.kvStore;
2 |
3 | /**
4 | * 抽象K/V存储模板类。主要提供异常处理功能。
5 | *
6 | * @author Daniel Li
7 | * @since 19 Jun 2013
8 | */
9 | public abstract class AbstractKeyValueStoreTemplate {
10 |
11 | /**
12 | * 处理异常。
13 | *
14 | * @param e 异常。
15 | */
16 | protected abstract void handleException(KeyValueStoreException e);
17 |
18 | /**
19 | * 包装异常。
20 | * @param e 实际异常。
21 | * @return 包装后的异常。
22 | */
23 | protected abstract KeyValueStoreException wrapperException(Exception e);
24 | }
25 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/kvStore/KeyValueStoreException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.kvStore;
2 |
3 | import org.springframework.core.NestedRuntimeException;
4 |
5 | /**
6 | * K/V存储异常。
7 | *
8 | * @author Daniel Li
9 | * @since 19 Jun 2013
10 | * @see NestedRuntimeException
11 | */
12 | public abstract class KeyValueStoreException extends NestedRuntimeException {
13 | private static final long serialVersionUID = -5363328862858087052L;
14 |
15 | public KeyValueStoreException(String message) {
16 | super(message);
17 | }
18 |
19 | public KeyValueStoreException(String message, Throwable cause) {
20 | super(message, cause);
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/kvStore/db/KeyValueIterator.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.kvStore.db;
2 |
3 | import java.util.Iterator;
4 |
5 | /**
6 | * K/V迭代器。
7 | *
8 | * @author Daniel Li
9 | * @since 13 September 2015
10 | */
11 | public interface KeyValueIterator extends Iterator> {
12 |
13 | void close();
14 |
15 | /**
16 | * K/V元素。
17 | *
18 | * @author Daniel Li
19 | * @since 13 September 2015
20 | */
21 | public class Entry {
22 |
23 | private final K key;
24 | private final V value;
25 |
26 | public Entry(K key, V value) {
27 | this.key = key;
28 | this.value = value;
29 | }
30 |
31 | public K getKey() {
32 | return this.key;
33 | }
34 |
35 | public V getValue() {
36 | return this.value;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/kvStore/db/KeyValueStore.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.kvStore.db;
2 |
3 | import org.danielli.xultimate.context.kvStore.KeyValueStoreException;
4 |
5 | import java.util.Comparator;
6 | import java.util.List;
7 |
8 | /**
9 | * K/V存储。
10 | *
11 | * @author Daniel Li
12 | * @since 13 September 2015
13 | */
14 | public interface KeyValueStore {
15 |
16 | V get(K key) throws KeyValueStoreException;
17 |
18 | void put(K key, V value) throws KeyValueStoreException;
19 |
20 | void putAll(List> entries) throws KeyValueStoreException;
21 |
22 | void remove(K key) throws KeyValueStoreException;
23 |
24 | KeyValueIterator range(K from, K to, Comparator comparator);
25 |
26 | KeyValueIterator all();
27 |
28 | void close();
29 |
30 | void flush() throws KeyValueStoreException;
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/kvStore/db/KeyValueStoreException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.kvStore.db;
2 |
3 | /**
4 | * K/V存储异常。
5 | *
6 | * @author Daniel Li
7 | * @since 13 September 2015
8 | */
9 | public class KeyValueStoreException extends RuntimeException {
10 |
11 | public KeyValueStoreException(Throwable cause) {
12 | super(cause);
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/kvStore/db/serializer/Serializer.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.kvStore.db.serializer;
2 |
3 | /**
4 | * 序列化器。
5 | *
6 | * @author Daniel Li
7 | * @since 13 September 2015
8 | */
9 | public interface Serializer {
10 |
11 | byte[] serialize(T value);
12 |
13 | T deserializer(byte[] bytes);
14 | }
15 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/kvStore/memcached/AbstractMemcachedTemplate.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.kvStore.memcached;
2 |
3 | import org.danielli.xultimate.context.kvStore.AbstractKeyValueStoreTemplate;
4 | import org.danielli.xultimate.context.kvStore.KeyValueStoreException;
5 |
6 | /**
7 | * 抽象Memcached模板类。主要提供异常记录功能。
8 | *
9 | * @author Daniel Li
10 | * @since 19 Jun 2013
11 | */
12 | public abstract class AbstractMemcachedTemplate extends AbstractKeyValueStoreTemplate {
13 |
14 | /**
15 | * 抛出异常。
16 | */
17 | @Override
18 | protected void handleException(KeyValueStoreException e) {
19 | throw e;
20 | }
21 |
22 | @Override
23 | protected MemcachedException wrapperException(Exception e) {
24 | if (e instanceof MemcachedException) {
25 | return (MemcachedException) e;
26 | }
27 | return new MemcachedException(e.getMessage(), e);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/kvStore/memcached/MemcachedException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.kvStore.memcached;
2 |
3 | import org.danielli.xultimate.context.kvStore.KeyValueStoreException;
4 |
5 | /**
6 | * Memcached异常。
7 | *
8 | * @author Daniel Li
9 | * @since 19 Jun 2013
10 | * @see KeyValueStoreException
11 | */
12 | public class MemcachedException extends KeyValueStoreException {
13 |
14 | private static final long serialVersionUID = 1723710559096203019L;
15 |
16 | public MemcachedException(String message) {
17 | super(message);
18 | }
19 |
20 | public MemcachedException(String message, Throwable cause) {
21 | super(message, cause);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/kvStore/memcached/xmemcached/callback/XMemcachedClientCallback.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.kvStore.memcached.xmemcached.callback;
2 |
3 | import org.danielli.xultimate.context.kvStore.memcached.xmemcached.XMemcachedClient;
4 |
5 |
6 | /**
7 | * XMemcached回调。
8 | *
9 | * @author Daniel Li
10 | * @since 19 Jun 2013
11 | *
12 | * @param 回调返回值。
13 | */
14 | public interface XMemcachedClientCallback {
15 |
16 | /**
17 | * 回调实现。
18 | *
19 | * @param xMemcachedClient XMemcached客户端。
20 | * @return 回调返回值。
21 | * @exception Exception 任何可能出现的异常。
22 | */
23 | T doInXMemcached(XMemcachedClient xMemcachedClient) throws Exception;
24 | }
25 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/kvStore/redis/AbstractRedisTemplate.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.kvStore.redis;
2 |
3 | import org.danielli.xultimate.context.kvStore.AbstractKeyValueStoreTemplate;
4 | import org.danielli.xultimate.context.kvStore.KeyValueStoreException;
5 |
6 | /**
7 | * 抽象Redis模板类。主要提供异常记录功能。
8 | *
9 | * @author Daniel Li
10 | * @since 19 Jun 2013
11 | */
12 | public abstract class AbstractRedisTemplate extends AbstractKeyValueStoreTemplate {
13 |
14 | /**
15 | * 抛出异常。
16 | */
17 | @Override
18 | protected void handleException(KeyValueStoreException e) throws RedisException {
19 | throw e;
20 | }
21 |
22 | @Override
23 | protected RedisException wrapperException(Exception e) {
24 | if (e instanceof RedisException) {
25 | return (RedisException) e;
26 | }
27 | return new RedisException(e.getMessage(), e);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/kvStore/redis/RedisException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.kvStore.redis;
2 |
3 | import org.danielli.xultimate.context.kvStore.KeyValueStoreException;
4 |
5 | /**
6 | * Redis异常。
7 | *
8 | * @author Daniel Li
9 | * @since 19 Jun 2013
10 | * @see KeyValueStoreException
11 | */
12 | public class RedisException extends KeyValueStoreException {
13 |
14 | private static final long serialVersionUID = 1723710559096203019L;
15 |
16 | public RedisException(String message) {
17 | super(message);
18 | }
19 |
20 | public RedisException(String message, Throwable cause) {
21 | super(message, cause);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/kvStore/redis/jedis/JedisCallback.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.kvStore.redis.jedis;
2 |
3 | import redis.clients.jedis.Jedis;
4 |
5 | /**
6 | * Jedis回调。
7 | *
8 | * @author Daniel Li
9 | * @since 19 Jun 2013
10 | *
11 | * @param 回调返回值。
12 | */
13 | public interface JedisCallback {
14 |
15 | /**
16 | * 回调实现。
17 | *
18 | * @param jedis Jedis客户端。
19 | * @return 回调返回值。
20 | * @exception Exception 任何可能出现的异常。
21 | */
22 | T doInJedis(Jedis jedis) throws Exception;
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/kvStore/redis/jedis/ShardedJedisCallback.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.kvStore.redis.jedis;
2 |
3 | import redis.clients.jedis.ShardedJedis;
4 |
5 | /**
6 | * ShardedJedis回调。
7 | *
8 | * @author Daniel Li
9 | * @since 19 Jun 2013
10 | *
11 | * @param 回调返回值。
12 | */
13 | public interface ShardedJedisCallback {
14 |
15 | /**
16 | * 回调实现。
17 | *
18 | * @param shardedJedis Jedis客户端。
19 | * @return 回调返回值。
20 | * @exception Exception 任何可能出现的异常。
21 | */
22 | T doInShardedJedis(ShardedJedis shardedJedis) throws Exception;
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/context/kvStore/redis/jedis/util/JedisPoolUtils.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.kvStore.redis.jedis.util;
2 |
3 | import org.danielli.xultimate.context.kvStore.redis.jedis.JedisCallback;
4 | import org.danielli.xultimate.context.kvStore.redis.jedis.JedisCallback;
5 |
6 | import redis.clients.jedis.Jedis;
7 | import redis.clients.jedis.JedisPool;
8 |
9 | /**
10 | * JedisPool工具类。
11 | *
12 | * @author Daniel Li
13 | * @since 19 Jun 2013
14 | */
15 | public class JedisPoolUtils {
16 |
17 | /**
18 | * 执行回调。
19 | *
20 | * @param jedisPool Jedis客户端。
21 | * @param jedisReturnedCallback 回调。
22 | * @return 回调返回值。
23 | * @exception Exception 任何可能出现的异常。
24 | */
25 | public static T execute(JedisPool jedisPool, JedisCallback jedisReturnedCallback) throws Exception {
26 | Jedis jedis = null;
27 | try {
28 | jedis = jedisPool.getResource();
29 | return jedisReturnedCallback.doInJedis(jedis);
30 | } finally{
31 | if (jedis != null) {
32 | jedisPool.returnResource(jedis);
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/ui/httl/HTTLEngineUtils.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.ui.httl;
2 |
3 | import httl.Template;
4 |
5 | import java.text.ParseException;
6 | import java.util.Map;
7 |
8 | /**
9 | * Utility class for working with a HTTL Engine.
10 | * Provides convenience methods to merge a HTTL template with a model.
11 | *
12 | * @author Daniel Li
13 | * @since 18 Jun 2013
14 | */
15 | public class HTTLEngineUtils {
16 |
17 | /**
18 | * Merge the specified HTTL template with the given model into a String.
19 | * @see org.springframework.mail.MailPreparationException
20 | */
21 | public static String processTemplateIntoString(Template template, Map model) throws ParseException {
22 | return (String) template.evaluate(model);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/ui/stringtemplate/v3/StringTemplateUtils.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.ui.stringtemplate.v3;
2 |
3 | import java.util.Map;
4 |
5 | import org.antlr.stringtemplate.StringTemplate;
6 |
7 | /**
8 | * StringTemplate V3模板处理工具。
9 | *
10 | * @author Daniel Li
11 | * @since 18 Jun 2013
12 | */
13 | public class StringTemplateUtils {
14 |
15 | /**
16 | * 处理模板为字符串。
17 | *
18 | * @param template 模板。
19 | * @param model 数据模型。
20 | * @return 字符串。
21 | */
22 | public static String processTemplateIntoString(StringTemplate template, Map model) {
23 | template.setAttributes(model);
24 | return template.toString();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/main/java/org/danielli/xultimate/ui/stringtemplate/v4/StringTemplateUtils.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.ui.stringtemplate.v4;
2 |
3 | import java.util.Map;
4 |
5 | import org.stringtemplate.v4.ST;
6 |
7 | /**
8 | * StringTemplate V4模板处理工具。
9 | *
10 | * @author Daniel Li
11 | * @since 18 Jun 2013
12 | */
13 | public class StringTemplateUtils {
14 | /**
15 | * 处理模板为字符串。
16 | *
17 | * @param template 模板。
18 | * @param model 数据模型。
19 | * @return 字符串。
20 | */
21 | public static String processTemplateIntoString(ST template, Map model) {
22 | for (Map.Entry entry : model.entrySet()) {
23 | template.add(entry.getKey(), entry.getValue());
24 | }
25 | return template.render();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/test/java/org/danielli/xultimate/context/kvStore/memcached/CacheService.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.kvStore.memcached;
2 |
3 | import org.springframework.cache.annotation.CacheEvict;
4 | import org.springframework.cache.annotation.Cacheable;
5 |
6 | public class CacheService {
7 |
8 | @Cacheable(value="user", key="#userId")
9 | public String addUser(Integer userId, String userName) {
10 | System.out.println(userId + ":" + userName);
11 | return userName;
12 | }
13 |
14 | @Cacheable(value="user", key="#userId")
15 | public String getUserNameById(Integer userId) {
16 | System.out.println(userId);
17 | return "Name";
18 | }
19 |
20 | @CacheEvict(value="user",key="#userId")
21 | public void deleteUser(Integer userId) {
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/test/java/org/danielli/xultimate/context/kvStore/memcached/xmemcached/Person.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.kvStore.memcached.xmemcached;
2 |
3 | import java.io.Serializable;
4 |
5 | public class Person implements Serializable {
6 |
7 | private static final long serialVersionUID = -1738355062692076549L;
8 |
9 | private String name;
10 |
11 | private Integer age;
12 |
13 | public String getName() {
14 | return name;
15 | }
16 |
17 | public void setName(String name) {
18 | this.name = name;
19 | }
20 |
21 | public Integer getAge() {
22 | return age;
23 | }
24 |
25 | public void setAge(Integer age) {
26 | this.age = age;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/test/java/org/danielli/xultimate/context/kvStore/redis/jedis/Person.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.kvStore.redis.jedis;
2 |
3 | import java.io.Serializable;
4 |
5 | public class Person implements Serializable {
6 |
7 | private static final long serialVersionUID = -1738355062692076549L;
8 |
9 | private String name;
10 |
11 | private Integer age;
12 |
13 | public String getName() {
14 | return name;
15 | }
16 |
17 | public void setName(String name) {
18 | this.name = name;
19 | }
20 |
21 | public Integer getAge() {
22 | return age;
23 | }
24 |
25 | public void setAge(Integer age) {
26 | this.age = age;
27 | }
28 | }
--------------------------------------------------------------------------------
/xultimate-context-support/src/test/java/org/danielli/xultimate/context/mail/template/hello_world.httl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Hello World, ${userName}!
8 |
9 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/test/java/org/danielli/xultimate/context/scheduling/quartz/ExampleBusinessObject.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.scheduling.quartz;
2 |
3 | import java.util.Date;
4 |
5 | import org.slf4j.Logger;
6 | import org.slf4j.LoggerFactory;
7 |
8 | public class ExampleBusinessObject {
9 |
10 | private static Logger logger = LoggerFactory.getLogger(ExampleBusinessObject.class);
11 |
12 | public void doIt() {
13 | logger.info("{}", new Date());
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/test/resources/dfs/fastdfs/README:
--------------------------------------------------------------------------------
1 | Copyright (C) 2008 Happy Fish / YuQing
2 |
3 | FastDFS Java Client API may be copied only under the terms of
4 | the BSD license.
5 | Please visit the FastDFS Home Page for more detail.
6 | English language: http://english.csource.org/
7 | Chinese language: http://www.csource.org/
8 |
9 |
10 | The jar file is compiled by JDK1.5, you can download the last version
11 | from google code: http://code.google.com/p/fastdfs/downloads/list
12 |
13 | run the FastDFS Java Client test:
14 | java -cp org.csource.fastdfs.test.TestClient
15 |
16 | eg.:
17 | java -cp fastdfs_client_v1.22.jar org.csource.fastdfs.test.TestClient fdfs_client.conf c:\windows\system32\notepad.exe
18 |
19 | or:
20 | java -cp fastdfs_client_v1.22.jar org.csource.fastdfs.test.TestClient fdfs_client.conf /usr/include/stdlib.h
21 |
22 |
23 | run the FastDFS monitor:
24 | java -cp org.csource.fastdfs.test.Monitor
25 |
26 | eg.:
27 | java -cp fastdfs_client_v1.22.jar org.csource.fastdfs.test.Monitor fdfs_client.conf
28 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/test/resources/dfs/fastdfs/fdfs_client.conf:
--------------------------------------------------------------------------------
1 | connect_timeout = 2
2 | network_timeout = 30
3 | charset = ISO8859-1
4 | # http.tracker_http_port = 8080
5 | http.anti_steal_token = no
6 | http.secret_key = FastDFS1234567890
7 |
8 | tracker_server = 192.168.10.103:22122
9 |
--------------------------------------------------------------------------------
/xultimate-context-support/src/test/resources/kvStore/redis/README:
--------------------------------------------------------------------------------
1 | 一.Sharded
2 | TreeMap nodes = new TreeMap();
3 | void initialize(List shards)
4 | 遍历shards,索引为i
5 | 如果shardInfo的getName()方法为空,循环160 * shardInfo.getWeight()次,索引为n,根据算法计算"SHARD-" + i + "-NODE-" + n的hash值,将hash值和shardInfo存入nodes中。
6 | 否则循环160 * shardInfo.getWeight()次,索引为n,根据算法计算shardInfo.getName() + "*" + shardInfo.getWeight() + n的hash值,将hash值和shardInfo存入nodes中。
7 | S getShardInfo(byte[] key)
8 | 计算算法计算key的hash值,调用nodes.tailMap(hash)得到SortedMap tail。
9 | 如果tail的个数为0,则返回nodes中第一个key对应的ShardInfo。
10 | 否则返回tail中第一个key对应的ShardInfo。
--------------------------------------------------------------------------------
/xultimate-context-support/src/test/resources/mail/file1.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daniellitoc/xultimate-toolkit/d3224632489626e7ab5a708821f4189c5e6d8764/xultimate-context-support/src/test/resources/mail/file1.zip
--------------------------------------------------------------------------------
/xultimate-context-support/src/test/resources/mail/file2.doc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daniellitoc/xultimate-toolkit/d3224632489626e7ab5a708821f4189c5e6d8764/xultimate-context-support/src/test/resources/mail/file2.doc
--------------------------------------------------------------------------------
/xultimate-context-support/src/test/resources/mail/img01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daniellitoc/xultimate-toolkit/d3224632489626e7ab5a708821f4189c5e6d8764/xultimate-context-support/src/test/resources/mail/img01.png
--------------------------------------------------------------------------------
/xultimate-context-support/src/test/resources/mail/mail.properties:
--------------------------------------------------------------------------------
1 | mail.host=localhost
2 | mail.port=6025
3 | mail.protocol=smtp
4 | mail.auth=true
5 | mail.username=c67594724f6a768e9865d1fa29f29513cfb8086f2b35a7c3a9bb05c066b4ba70
6 | mail.password=c67594724f6a768e9865d1fa29f29513cfb8086f2b35a7c3a9bb05c066b4ba70
7 | mail.debug=true
--------------------------------------------------------------------------------
/xultimate-context-support/src/test/resources/mail/mail.properties.bak:
--------------------------------------------------------------------------------
1 | mail.host=smtp.gmail.com
2 | mail.port=465
3 | mail.protocol=smtps
4 | mail.auth=true
5 | mail.username=c67594724f6a768e9865d1fa29f29513cfb8086f2b35a7c3a9bb05c066b4ba70
6 | mail.password=c67594724f6a768e9865d1fa29f29513cfb8086f2b35a7c3a9bb05c066b4ba70
7 | mail.debug=true
--------------------------------------------------------------------------------
/xultimate-context-support/src/test/resources/quartz/quartz.properties:
--------------------------------------------------------------------------------
1 | #===============================================================
2 | # Quartz Scheduler Clustered Database Configuration
3 | #===============================================================
4 | datasource.quartz.jdbc.driver=com.mysql.jdbc.Driver
5 | datasource.quartz.jdbc.url=jdbc:mysql://127.0.0.1:3306/quartz_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
6 | datasource.quartz.jdbc.username=1f226dc04f6dbe1d89a36e1800cd9b28
7 | datasource.quartz.jdbc.password=1f226dc04f6dbe1d89a36e1800cd9b28
8 | datasource.quartz.pool.maxActive=20
9 | datasource.quartz.pool.minIdle=10
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/chardet/CharsetDetector.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.chardet;
2 |
3 | import java.nio.charset.Charset;
4 | import java.util.Set;
5 |
6 | /**
7 | * 字符集检测器。
8 | *
9 | * @author Daniel Li
10 | * @since 18 Jun 2013
11 | *
12 | * @param 输入源。
13 | */
14 | public interface CharsetDetector {
15 |
16 | /**
17 | * 检测指定输入源的字符集。
18 | *
19 | * @param source 输入源。
20 | * @return 字符集集合。
21 | * @throws CharsetDetectorException 检测过程中的出现的异常,都由{@link CharsetDetectorException }封装并抛出。
22 | */
23 | Set detect(S source) throws CharsetDetectorException;
24 | }
25 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/chardet/CharsetDetectorException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.chardet;
2 |
3 | import org.springframework.core.NestedRuntimeException;
4 |
5 | /**
6 | * 字符集检测器异常。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | * @see NestedRuntimeException
11 | */
12 | public class CharsetDetectorException extends NestedRuntimeException {
13 |
14 | private static final long serialVersionUID = 2303266621170729888L;
15 |
16 | public CharsetDetectorException(String message) {
17 | super(message);
18 | }
19 |
20 | public CharsetDetectorException(String message, Throwable cause) {
21 | super(message, cause);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/chardet/support/FileCharsetDetector.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.chardet.support;
2 |
3 | import java.io.File;
4 | import java.io.IOException;
5 | import java.io.InputStream;
6 |
7 | import org.danielli.xultimate.context.chardet.CharsetDetectorException;
8 | import org.danielli.xultimate.util.io.FileUtils;
9 |
10 | /**
11 | * 文件类字符集检测器。
12 | *
13 | * @author Daniel Li
14 | * @since 18 Jun 2013
15 | * @see AbstractCharsetDetector
16 | */
17 | public class FileCharsetDetector extends AbstractCharsetDetector {
18 |
19 | @Override
20 | public InputStream createInputStream(File source) throws CharsetDetectorException {
21 | try {
22 | return FileUtils.openInputStream(source);
23 | } catch (IOException e) {
24 | throw new CharsetDetectorException(e.getMessage(), e);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/chardet/support/URLCharsetDetector.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.chardet.support;
2 |
3 | import java.io.IOException;
4 | import java.io.InputStream;
5 | import java.net.URL;
6 |
7 | import org.danielli.xultimate.context.chardet.CharsetDetectorException;
8 |
9 | /**
10 | * URL类字符集检测器。
11 | *
12 | * @author Daniel Li
13 | * @since 18 Jun 2013
14 | * @see AbstractCharsetDetector
15 | */
16 | public class URLCharsetDetector extends AbstractCharsetDetector {
17 |
18 | @Override
19 | public InputStream createInputStream(URL source) throws CharsetDetectorException {
20 | try {
21 | return source.openStream();
22 | } catch (IOException e) {
23 | throw new CharsetDetectorException(e.getMessage(), e);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/codec/Decoder.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.codec;
2 |
3 | /**
4 | * 解码器。
5 | *
6 | * @author Daniel Li
7 | * @since 18 Jun 2013
8 | *
9 | * @param 原始源。
10 | * @param 目标源。
11 | */
12 | public interface Decoder {
13 |
14 | /**
15 | * 解码。
16 | *
17 | * @param source 原始源。
18 | * @return 目标源。
19 | * @throws DecoderException 解码异常,在解码过程中出现的任何异常都会使用{@link DecoderException}封装并抛出。
20 | */
21 | T decode(S source) throws DecoderException;
22 | }
23 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/codec/DecoderException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.codec;
2 |
3 | import org.springframework.core.NestedRuntimeException;
4 |
5 | /**
6 | * 解码异常。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | * @see NestedRuntimeException
11 | */
12 | public class DecoderException extends NestedRuntimeException {
13 |
14 | private static final long serialVersionUID = 8862452193888553128L;
15 |
16 | public DecoderException(String message) {
17 | super(message);
18 | }
19 |
20 | public DecoderException(String message, Throwable cause) {
21 | super(message, cause);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/codec/Encoder.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.codec;
2 |
3 | /**
4 | * 编码器。
5 | *
6 | * @author Daniel Li
7 | * @since 18 Jun 2013
8 | *
9 | * @param 原始源。
10 | * @param 目标源。
11 | */
12 | public interface Encoder {
13 |
14 | /**
15 | * 编码。
16 | *
17 | * @param source 原始源。
18 | * @return 目标源。
19 | * @throws EncoderException 编码异常,在编码过程中出现的任何异常都会使用{@link EncoderException}封装并抛出。
20 | */
21 | T encode(S source) throws EncoderException;
22 | }
23 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/codec/EncoderException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.codec;
2 |
3 | import org.springframework.core.NestedRuntimeException;
4 |
5 | /**
6 | * 编码异常。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | * @see NestedRuntimeException
11 | */
12 | public class EncoderException extends NestedRuntimeException {
13 |
14 | private static final long serialVersionUID = 8862452193888553128L;
15 |
16 | public EncoderException(String message) {
17 | super(message);
18 | }
19 |
20 | public EncoderException(String message, Throwable cause) {
21 | super(message, cause);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/codec/support/ByteArrayStringCoder.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.codec.support;
2 |
3 | import org.danielli.xultimate.context.codec.DecoderException;
4 | import org.danielli.xultimate.context.codec.EncoderException;
5 |
6 | /**
7 | * 处理{@link String}到{@link byte[]}类型的编码和解码器。
8 | *
9 | * @author Daniel Li
10 | * @since 18 Jun 2013
11 | * @see AbstractCoder
12 | */
13 | public class ByteArrayStringCoder extends AbstractCoder {
14 |
15 | @Override
16 | public String encode(byte[] source) throws EncoderException {
17 | return new String(innerEncode(source));
18 | }
19 |
20 | @Override
21 | public byte[] decode(String source) throws DecoderException {
22 | return innerDecode(source.toCharArray());
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/codec/support/StringStringCoder.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.codec.support;
2 |
3 | import org.danielli.xultimate.context.codec.DecoderException;
4 | import org.danielli.xultimate.context.codec.EncoderException;
5 | import org.danielli.xultimate.util.StringUtils;
6 |
7 | /**
8 | * 处理{@link String}到{@link String}类型的编码和解码器。
9 | *
10 | * @author Daniel Li
11 | * @since 18 Jun 2013
12 | * @see AbstractCoder
13 | */
14 | public class StringStringCoder extends AbstractCoder {
15 |
16 | @Override
17 | public String encode(String source) throws EncoderException {
18 | return StringUtils.newStringUtf8(innerEncode(StringUtils.getBytesUtf8(source)));
19 | }
20 |
21 | @Override
22 | public String decode(String source) throws DecoderException {
23 | return StringUtils.newStringUtf8(innerDecode(StringUtils.getBytesUtf8(source)));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/codec/support/URLCodec.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.codec.support;
2 |
3 | import org.danielli.xultimate.context.codec.Decoder;
4 | import org.danielli.xultimate.context.codec.DecoderException;
5 | import org.danielli.xultimate.context.codec.Encoder;
6 | import org.danielli.xultimate.context.codec.EncoderException;
7 |
8 |
9 | /**
10 | * URL编码和解码器。处理byte[]到byte[]类型。
11 | *
12 | * @author Daniel Li
13 | * @since 18 Jun 2013
14 | * @see Encoder
15 | * @see Decoder
16 | */
17 | public class URLCodec implements Encoder, Decoder {
18 |
19 | @Override
20 | public byte[] decode(byte[] source) throws DecoderException {
21 | try {
22 | return org.apache.commons.codec.net.URLCodec.decodeUrl(source);
23 | } catch (Exception e) {
24 | throw new DecoderException(e.getMessage(), e);
25 | }
26 | }
27 |
28 | @Override
29 | public byte[] encode(byte[] source) throws EncoderException {
30 | try {
31 | return org.apache.commons.codec.net.URLCodec.encodeUrl(null, source);
32 | } catch (Exception e) {
33 | throw new EncoderException(e.getMessage(), e);
34 | }
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/crypto/Decryptor.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.crypto;
2 |
3 | /**
4 | * 解密器。
5 | *
6 | * @author Daniel Li
7 | * @since 18 Jun 2013
8 | *
9 | * @param 原始源。
10 | * @param 目标源。
11 | */
12 | public interface Decryptor {
13 |
14 | /**
15 | * 解密。
16 | *
17 | * @param source 原始源。
18 | * @return 目标源。
19 | * @throws DecryptorException 解密异常,在解密过程中出现的任何异常都会使用{@link DecryptorException}封装并抛出。
20 | */
21 | T decrypt(S source) throws DecryptorException;
22 | }
23 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/crypto/DecryptorException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.crypto;
2 |
3 | import org.springframework.core.NestedRuntimeException;
4 |
5 | /**
6 | * 解密异常。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | * @see NestedRuntimeException
11 | */
12 | public class DecryptorException extends NestedRuntimeException {
13 |
14 | private static final long serialVersionUID = 8862452193888553128L;
15 |
16 | public DecryptorException(String message) {
17 | super(message);
18 | }
19 |
20 | public DecryptorException(String message, Throwable cause) {
21 | super(message, cause);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/crypto/Encryptor.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.crypto;
2 |
3 | /**
4 | * 加密器。
5 | *
6 | * @author Daniel Li
7 | * @since 18 Jun 2013
8 | *
9 | * @param 原始源。
10 | * @param 目标源。
11 | */
12 | public interface Encryptor {
13 |
14 | /**
15 | * 加密。
16 | *
17 | * @param source 原始源。
18 | * @return 目标源。
19 | * @throws EncryptorException 编码异常,在编码过程中出现的任何异常都会使用{@link EncryptorException}封装并抛出。
20 | */
21 | T encrypt(S source) throws EncryptorException;
22 | }
23 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/crypto/EncryptorException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.crypto;
2 |
3 | import org.springframework.core.NestedRuntimeException;
4 |
5 | /**
6 | * 加密异常。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | * @see NestedRuntimeException
11 | */
12 | public class EncryptorException extends NestedRuntimeException {
13 |
14 | private static final long serialVersionUID = 8862452193888553128L;
15 |
16 | public EncryptorException(String message) {
17 | super(message);
18 | }
19 |
20 | public EncryptorException(String message, Throwable cause) {
21 | super(message, cause);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/i18n/Message.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.i18n;
2 |
3 | /**
4 | * 消息体。
5 | *
6 | * @author Daniel Li
7 | * @since 18 Jun 2013
8 | */
9 | public class Message {
10 |
11 | /** 消息类型 */
12 | protected MessageType type;
13 |
14 | /** 消息内容 */
15 | protected T content;
16 |
17 | public Message(MessageType type, T content) {
18 | this.type = type;
19 | this.content = content;
20 | }
21 |
22 | /**
23 | * 获取消息类型。
24 | *
25 | * @return 消息类型。
26 | */
27 | public MessageType getType() {
28 | return type;
29 | }
30 |
31 | /**
32 | * 获取消息内容。
33 | *
34 | * @return 消息内容。
35 | */
36 | public T getContent() {
37 | return content;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/i18n/MessageType.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.i18n;
2 |
3 | /**
4 | * 消息类型。
5 | *
6 | * @author Daniel Li
7 | * @since 18 Jun 2013
8 | */
9 | public enum MessageType {
10 |
11 | /** 错误类型 */
12 | ERROR,
13 |
14 | /** 警告类型 */
15 | WARN,
16 |
17 | /** 成功类型 */
18 | SUCCESS;
19 | }
20 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image/AbstractImageTemplate.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image;
2 |
3 | import java.awt.Color;
4 |
5 | /**
6 | * 抽像图片模板工具类。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | */
11 | public abstract class AbstractImageTemplate {
12 |
13 | /** 背景颜色 */
14 | protected Color backgroundColor = Color.black;
15 |
16 | /** 目标图片品质(取值范围: 0 - 100) */
17 | protected Integer quality = 50;
18 |
19 | /**
20 | * 设置背景颜色。
21 | * @param backgroundColor
22 | * 背景颜色。
23 | */
24 | public void setBackgroundColor(Color backgroundColor) {
25 | this.backgroundColor = backgroundColor;
26 | }
27 |
28 | /**
29 | * 设置目标图片品质(取值范围: 0 - 100)。
30 | * @param backgroundColor
31 | * 目标图片品质(取值范围: 0 - 100)。
32 | */
33 | public void setQuality(Integer quality) {
34 | this.quality = quality;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image/ImageException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image;
2 |
3 | import org.springframework.core.NestedRuntimeException;
4 |
5 | /**
6 | * 图片异常。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | * @see NestedRuntimeException
11 | */
12 | public class ImageException extends NestedRuntimeException {
13 |
14 | private static final long serialVersionUID = -4680588316992658546L;
15 |
16 | public ImageException(String message) {
17 | super(message);
18 | }
19 |
20 | public ImageException(String message, Throwable cause) {
21 | super(message, cause);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image/ImageInfoException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image;
2 |
3 |
4 | /**
5 | * 图片信息异常。
6 | *
7 | * @author Daniel Li
8 | * @since 18 Jun 2013
9 | */
10 | public class ImageInfoException extends ImageException {
11 |
12 | private static final long serialVersionUID = 3522360189078014666L;
13 |
14 | public ImageInfoException(String message) {
15 | super(message);
16 | }
17 |
18 | public ImageInfoException(String message, Throwable cause) {
19 | super(message, cause);
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image/ImageInfoTemplate.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image;
2 |
3 | import java.io.File;
4 |
5 | import org.danielli.xultimate.context.image.model.ImageInfo;
6 |
7 | /**
8 | * 图片信息模板工具类。
9 | *
10 | * @author Daniel Li
11 | * @since 18 Jun 2013
12 | */
13 | public interface ImageInfoTemplate {
14 |
15 | /**
16 | * 获取图片信息。
17 | *
18 | * @param imageFile
19 | * 图片文件。
20 | * @return 图片信息。
21 | */
22 | ImageInfo getImageInfo(File imageFile) throws ImageInfoException;
23 |
24 | /**
25 | * 转换图片。
26 | *
27 | * @param srcImageFile
28 | * 原图片文件。
29 | * @param destImageFile
30 | * 目标图片文件。
31 | */
32 | void convertImage(File srcImageFile, File destImageFile) throws ImageException;
33 | }
34 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image/im4java/ImageCommandPostProcessor.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image.im4java;
2 |
3 | import org.danielli.xultimate.context.image.ImageException;
4 | import org.im4java.core.IMOperation;
5 | import org.im4java.core.ImageCommand;
6 |
7 | /**
8 | * 图片命令后处理器。
9 | *
10 | * @author Daniel Li
11 | * @since 18 Jun 2013
12 | */
13 | public interface ImageCommandPostProcessor {
14 |
15 | /**
16 | * 初始化图片命令和操作后,此方法被执行。
17 | */
18 | void postProcessAfterInitialization(ImageCommand imageCommand, IMOperation operation, Object... params) throws ImageException;
19 | }
20 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image/im4java/support/RunCommandPostProcessor.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image.im4java.support;
2 |
3 | import org.danielli.xultimate.context.image.ImageException;
4 | import org.danielli.xultimate.context.image.im4java.ImageCommandPostProcessor;
5 | import org.im4java.core.IMOperation;
6 | import org.im4java.core.ImageCommand;
7 |
8 | /**
9 | * 默认实现。运行命令后处理器。用于执行图片命令。
10 | *
11 | * @author Daniel Li
12 | * @since 18 Jun 2013
13 | */
14 | public class RunCommandPostProcessor implements ImageCommandPostProcessor {
15 |
16 | @Override
17 | public void postProcessAfterInitialization(ImageCommand imageCommand, IMOperation operation, Object... params) throws ImageException {
18 | try {
19 | imageCommand.run(operation, params);
20 | } catch (Exception e) {
21 | throw new ImageException(e.getMessage(), e);
22 | }
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image/model/GeometryOperator.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image.model;
2 |
3 | /**
4 | * 几何操作。
5 | *
6 | * @author Daniel Li
7 | * @since JDK 1.7
8 | */
9 | public enum GeometryOperator {
10 | /**
11 | * 保留宽度或高度中的最小值,宽度与高度比保存。
12 | */
13 | Minimum(null),
14 | /**
15 | * 保留宽度或高度中的最大值,宽度与高度比保存。
16 | */
17 | Maximum('^'),
18 | /**
19 | * 保留宽度与高度,忽略原始宽度与高度。
20 | */
21 | Emphasize('!'),
22 | /**
23 | * 若宽度或高度小于原始宽度或高度,保留宽度或高度中的最小值,并缩小图片,宽度与高度比保存;否则使用原始宽度与高度。
24 | */
25 | Shrink('>'),
26 | /**
27 | * 若宽度或高度大于原始宽度或高度,保留宽度或高度中的最大值,并放大图片,宽度与高度比保存;否则使用原始宽度与高度。
28 | */
29 | Enlarge('<');
30 |
31 | private Character special;
32 |
33 | private GeometryOperator(Character special) {
34 | this.special = special;
35 | }
36 |
37 | public Character getSpecial() {
38 | return special;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image/model/Gravity.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image.model;
2 |
3 | /**
4 | * 方位。
5 | *
6 | * @author Daniel Li
7 | * @since 18 Jun 2013
8 | */
9 | public enum Gravity {
10 | /**
11 | * 没有。
12 | */
13 | None,
14 |
15 |
16 | /**
17 | * 西北。
18 | */
19 | NorthWest,
20 | /**
21 | * 北。
22 | */
23 | North,
24 | /**
25 | * 东北。
26 | */
27 | NorthEast,
28 | /**
29 | * 西。
30 | */
31 | West,
32 | /**
33 | * 中间。
34 | */
35 | Center,
36 | /**
37 | * 东。
38 | */
39 | East,
40 | /**
41 | * 西南。
42 | */
43 | SouthWest,
44 | /**
45 | * 南。
46 | */
47 | South,
48 | /**
49 | * 东南。
50 | */
51 | SouthEast;
52 | }
53 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image/model/ImageFormat.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image.model;
2 |
3 | /**
4 | * 图片格式。
5 | *
6 | * @author Daniel Li
7 | * @since 18 Jun 2013
8 | */
9 | public enum ImageFormat {
10 | JPEG("JPG", "JPEG"),
11 | GIF("GIF"),
12 | BMP("BMP"),
13 | PNG("PNG");
14 |
15 | private String[] extensions;
16 |
17 | private ImageFormat(String... extensions) {
18 | this.extensions = extensions;
19 | }
20 |
21 | public String[] getExtensions() {
22 | return extensions;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image/model/ImageInfo.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image.model;
2 |
3 | /**
4 | * 图片信息。
5 | *
6 | * @author Daniel Li
7 | * @since 18 Jun 2013
8 | */
9 | public class ImageInfo {
10 | private ImageSize imageSize;
11 | private ImageFormat imageFormat;
12 |
13 | /**
14 | * 创建图片信息。
15 | *
16 | * @param width
17 | * 图片宽度。
18 | * @param height
19 | * 图片高度。
20 | * @param format
21 | * 图片格式。
22 | */
23 | public ImageInfo(Integer width, Integer height, ImageFormat imageFormat) {
24 | this.imageSize = new ImageSize(width, height);
25 | this.imageFormat = imageFormat;
26 | }
27 |
28 | public ImageSize getImageSize() {
29 | return imageSize;
30 | }
31 |
32 | public ImageFormat getImageFormat() {
33 | return imageFormat;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image2/AbstractImageTemplate.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image2;
2 |
3 | import java.awt.Color;
4 |
5 | /**
6 | * 抽像图片模板工具类。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | */
11 | public abstract class AbstractImageTemplate {
12 |
13 | /** 背景颜色 */
14 | protected Color backgroundColor = Color.black;
15 |
16 | /** 目标图片品质(取值范围: 0 - 100) */
17 | protected Integer quality = 50;
18 |
19 | /**
20 | * 设置背景颜色。
21 | * @param backgroundColor
22 | * 背景颜色。
23 | */
24 | public void setBackgroundColor(Color backgroundColor) {
25 | this.backgroundColor = backgroundColor;
26 | }
27 |
28 | /**
29 | * 设置目标图片品质(取值范围: 0 - 100)。
30 | * @param backgroundColor
31 | * 目标图片品质(取值范围: 0 - 100)。
32 | */
33 | public void setQuality(Integer quality) {
34 | this.quality = quality;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image2/ImageException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image2;
2 |
3 | import org.springframework.core.NestedRuntimeException;
4 |
5 | /**
6 | * 图片异常。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | * @see NestedRuntimeException
11 | */
12 | public class ImageException extends NestedRuntimeException {
13 |
14 | private static final long serialVersionUID = -4680588316992658546L;
15 |
16 | public ImageException(String message) {
17 | super(message);
18 | }
19 |
20 | public ImageException(String message, Throwable cause) {
21 | super(message, cause);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image2/ImageInfoException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image2;
2 |
3 |
4 | /**
5 | * 图片信息异常。
6 | *
7 | * @author Daniel Li
8 | * @since 18 Jun 2013
9 | */
10 | public class ImageInfoException extends ImageException {
11 |
12 | private static final long serialVersionUID = 3522360189078014666L;
13 |
14 | public ImageInfoException(String message) {
15 | super(message);
16 | }
17 |
18 | public ImageInfoException(String message, Throwable cause) {
19 | super(message, cause);
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image2/ImageInfoTemplate.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image2;
2 |
3 | import org.danielli.xultimate.context.image2.config.DefaultImageResource;
4 | import org.danielli.xultimate.context.image2.config.WrapperImageResource;
5 |
6 | /**
7 | * 图片信息模板工具类。
8 | *
9 | * @author Daniel Li
10 | * @since 18 Jun 2013
11 | */
12 | public interface ImageInfoTemplate {
13 |
14 | /**
15 | * 转换图片。
16 | *
17 | * @param srcImageResource
18 | * 原图片资源。
19 | * @param destImageResource
20 | * 目标图片资源。
21 | */
22 | void convertImage(DefaultImageResource srcImageResource, WrapperImageResource destImageResource) throws ImageException;
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image2/config/GeometryOperator.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image2.config;
2 |
3 | /**
4 | * 几何操作。
5 | *
6 | * @author Daniel Li
7 | * @since JDK 1.7
8 | */
9 | public enum GeometryOperator {
10 | /**
11 | * 保留宽度或高度中的最小值,宽度与高度比保存。
12 | */
13 | Minimum(null),
14 | /**
15 | * 保留宽度或高度中的最大值,宽度与高度比保存。
16 | */
17 | Maximum('^'),
18 | /**
19 | * 保留宽度与高度,忽略原始宽度与高度。
20 | */
21 | Emphasize('!'),
22 | /**
23 | * 若宽度或高度小于原始宽度或高度,保留宽度或高度中的最小值,并缩小图片,宽度与高度比保存;否则使用原始宽度与高度。
24 | */
25 | Shrink('>'),
26 | /**
27 | * 若宽度或高度大于原始宽度或高度,保留宽度或高度中的最大值,并放大图片,宽度与高度比保存;否则使用原始宽度与高度。
28 | */
29 | Enlarge('<');
30 |
31 | private Character special;
32 |
33 | private GeometryOperator(Character special) {
34 | this.special = special;
35 | }
36 |
37 | public Character getSpecial() {
38 | return special;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image2/config/Gravity.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image2.config;
2 |
3 | /**
4 | * 方位。
5 | *
6 | * @author Daniel Li
7 | * @since 18 Jun 2013
8 | */
9 | public enum Gravity {
10 | /**
11 | * 没有。
12 | */
13 | None,
14 |
15 |
16 | /**
17 | * 西北。
18 | */
19 | NorthWest,
20 | /**
21 | * 北。
22 | */
23 | North,
24 | /**
25 | * 东北。
26 | */
27 | NorthEast,
28 | /**
29 | * 西。
30 | */
31 | West,
32 | /**
33 | * 中间。
34 | */
35 | Center,
36 | /**
37 | * 东。
38 | */
39 | East,
40 | /**
41 | * 西南。
42 | */
43 | SouthWest,
44 | /**
45 | * 南。
46 | */
47 | South,
48 | /**
49 | * 东南。
50 | */
51 | SouthEast;
52 | }
53 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image2/config/ImageFormat.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image2.config;
2 |
3 | /**
4 | * 图片格式。
5 | *
6 | * @author Daniel Li
7 | * @since 18 Jun 2013
8 | */
9 | public enum ImageFormat {
10 | JPEG("JPG", "JPEG"),
11 | GIF("GIF"),
12 | BMP("BMP"),
13 | PNG("PNG");
14 |
15 | private String[] extensions;
16 |
17 | private ImageFormat(String... extensions) {
18 | this.extensions = extensions;
19 | }
20 |
21 | public String[] getExtensions() {
22 | return extensions;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image2/config/ImageInfo.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image2.config;
2 |
3 | /**
4 | * 图片信息。
5 | *
6 | * @author Daniel Li
7 | * @since 18 Jun 2013
8 | */
9 | public class ImageInfo {
10 | private ImageSize imageSize;
11 | private ImageFormat imageFormat;
12 |
13 | /**
14 | * 创建图片信息。
15 | *
16 | * @param width
17 | * 图片宽度。
18 | * @param height
19 | * 图片高度。
20 | * @param format
21 | * 图片格式。
22 | */
23 | public ImageInfo(Integer width, Integer height, ImageFormat imageFormat) {
24 | this.imageSize = new ImageSize(width, height);
25 | this.imageFormat = imageFormat;
26 | }
27 |
28 | public ImageSize getImageSize() {
29 | return imageSize;
30 | }
31 |
32 | public ImageFormat getImageFormat() {
33 | return imageFormat;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image2/config/ImageResource.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image2.config;
2 |
3 | import java.awt.image.BufferedImage;
4 | import java.io.File;
5 |
6 | import org.danielli.xultimate.context.image2.ImageInfoException;
7 |
8 | /**
9 | * 图片资源。
10 | *
11 | * @author Daniel Li
12 | * @since 18 Jun 2013
13 | */
14 | public interface ImageResource {
15 |
16 | /**
17 | * 获取图片文件。
18 | * @return 图片文件。
19 | */
20 | File getImageFile();
21 |
22 | /**
23 | * 获取缓冲图片。
24 | * @return 缓冲图片。
25 | */
26 | BufferedImage getBufferedImage() throws ImageInfoException;
27 |
28 | /**
29 | * 获取图片信息。
30 | * @return 图片信息。
31 | */
32 | ImageInfo getImageInfo() throws ImageInfoException;
33 | }
34 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/image2/im4java/ImageCommandPostProcessor.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.image2.im4java;
2 |
3 | import org.danielli.xultimate.context.image2.ImageException;
4 | import org.danielli.xultimate.context.image2.config.DefaultImageResource;
5 | import org.danielli.xultimate.context.image2.config.WrapperImageResource;
6 | import org.im4java.core.IMOperation;
7 | import org.im4java.core.ImageCommand;
8 |
9 | /**
10 | * 图片命令后处理器。
11 | *
12 | * @author Daniel Li
13 | * @since 18 Jun 2013
14 | */
15 | public interface ImageCommandPostProcessor {
16 |
17 | /**
18 | * 初始化图片命令和操作后,此方法被执行。
19 | */
20 | void postProcessAfterInitialization(ImageCommand imageCommand, IMOperation operation, WrapperImageResource destImageResource, DefaultImageResource... parameterImageResources) throws ImageException;
21 | }
22 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/performance/AbstractStopWatchMonitoringInterceptor.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.performance;
2 |
3 | import org.danielli.xultimate.util.time.stopwatch.support.AbstractStopWatchSummary;
4 | import org.springframework.aop.interceptor.PerformanceMonitorInterceptor;
5 |
6 | /**
7 | * 抽象秒表监测拦截器。
8 | *
9 | * Uses a {@code StopWatch} for the actual performance measuring.
10 | *
11 | * @author Daniel Li
12 | * @since 18 Jun 2013
13 | * @see PerformanceMonitorInterceptor
14 | */
15 | public abstract class AbstractStopWatchMonitoringInterceptor extends AbstractMonitoringInterceptor {
16 |
17 | protected AbstractStopWatchSummary stopWatchSummary;
18 |
19 | public void setStopWatchSummary(AbstractStopWatchSummary stopWatchSummary) {
20 | this.stopWatchSummary = stopWatchSummary;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/xultimate-context/src/main/java/org/danielli/xultimate/context/performance/PerformanceMonitor.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.performance;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Inherited;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * 性能检测注解。
12 | *
13 | * @author Daniel Li
14 | * @since 18 Jun 2013
15 | * @see PerformanceMonitorForEachMethodInterceptor
16 | * @see PerformanceMonitorForOneMethodInterceptor
17 | */
18 | @Inherited
19 | @Target({ ElementType.METHOD })
20 | @Retention(RetentionPolicy.RUNTIME)
21 | @Documented
22 | public @interface PerformanceMonitor {
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/xultimate-context/src/test/java/org/danielli/xultimate/context/config/Boss.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.config;
2 |
3 | public class Boss {
4 | private Car car;
5 |
6 | public Car getCar() {
7 | return car;
8 | }
9 |
10 | public void setCar(Car car) {
11 | this.car = car;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/xultimate-context/src/test/java/org/danielli/xultimate/context/config/Car.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.config;
2 |
3 | public class Car {
4 | private int maxSpeed;
5 | private String brand;
6 | private double price;
7 | public int getMaxSpeed() {
8 | return maxSpeed;
9 | }
10 | public void setMaxSpeed(int maxSpeed) {
11 | this.maxSpeed = maxSpeed;
12 | }
13 | public String getBrand() {
14 | return brand;
15 | }
16 | public void setBrand(String brand) {
17 | this.brand = brand;
18 | }
19 | public double getPrice() {
20 | return price;
21 | }
22 | public void setPrice(double price) {
23 | this.price = price;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/xultimate-context/src/test/java/org/danielli/xultimate/context/config/CustomCarEditor.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.config;
2 |
3 | import java.beans.PropertyEditorSupport;
4 |
5 | import org.springframework.stereotype.Service;
6 |
7 | @Service("customCarEditor")
8 | public class CustomCarEditor extends PropertyEditorSupport {
9 |
10 | @Override
11 | public void setAsText(String text) throws IllegalArgumentException {
12 | String[] infos = text.split(",");
13 | Car car = new Car();
14 | car.setBrand(infos[0]);
15 | car.setMaxSpeed(Integer.parseInt(infos[1]));
16 | car.setPrice(Double.parseDouble(infos[2]));
17 | setValue(car);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/xultimate-context/src/test/java/org/danielli/xultimate/context/config/CustomCardEditorTest.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.config;
2 |
3 | import javax.annotation.Resource;
4 |
5 | import org.junit.Test;
6 | import org.junit.runner.RunWith;
7 | import org.slf4j.Logger;
8 | import org.slf4j.LoggerFactory;
9 | import org.springframework.test.context.ContextConfiguration;
10 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
11 |
12 | @RunWith(SpringJUnit4ClassRunner.class)
13 | @ContextConfiguration(locations = { "classpath:/applicationContext-config.xml" })
14 | public class CustomCardEditorTest {
15 |
16 | @Resource
17 | private Boss boss;
18 |
19 | private static final Logger LOGGER = LoggerFactory.getLogger(CustomCardEditorTest.class);
20 |
21 | @Test
22 | public void test() {
23 | LOGGER.info("Brand:" + boss.getCar().getBrand());
24 | LOGGER.info("MaxSpeed:" + boss.getCar().getMaxSpeed());
25 | LOGGER.info("Price:" + boss.getCar().getPrice());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/xultimate-context/src/test/java/org/danielli/xultimate/context/event/EventTest.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.event;
2 |
3 | import org.danielli.xultimate.context.util.BeanFactoryContext;
4 | import org.junit.Test;
5 | import org.junit.runner.RunWith;
6 | import org.springframework.test.context.ContextConfiguration;
7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
8 |
9 | @RunWith(SpringJUnit4ClassRunner.class)
10 | @ContextConfiguration(locations = { "classpath:/applicationContext-service-event.xml", "classpath:/applicationContext-service-util.xml" })
11 | public class EventTest {
12 |
13 | @Test
14 | public void testEvent() {
15 | LogEvent logEvent = new LogEvent(BeanFactoryContext.currentApplicationContext(), Thread.currentThread().toString());
16 | // 为单线程,事件监听器和发布器是同步的调用关系。
17 | // 可通过taskExecutor配置实现异步,SimpleApplicationEventMulticaster
18 | BeanFactoryContext.currentApplicationContext().publishEvent(logEvent);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/xultimate-context/src/test/java/org/danielli/xultimate/context/event/Log1Listener.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.event;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import org.springframework.context.ApplicationListener;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * 日志监听器,当使用ApplicationContext.publishEvent(LogEvent)时,监听器起作用。
10 | * @author Daniel Li
11 | * @since 29 July 2012
12 | */
13 | @Service
14 | public class Log1Listener implements ApplicationListener {
15 |
16 | private static final Logger LOGGER = LoggerFactory.getLogger(Log1Listener.class);
17 |
18 | @Override
19 | public void onApplicationEvent(LogEvent event) {
20 | String message = event.getMessage();
21 | LOGGER.info("{}:{}", Thread.currentThread(), message);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/xultimate-context/src/test/java/org/danielli/xultimate/context/event/Log2Listener.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.event;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import org.springframework.context.ApplicationListener;
6 | import org.springframework.stereotype.Service;
7 |
8 | /**
9 | * 日志监听器,当使用ApplicationContext.publishEvent(LogEvent)时,监听器起作用。
10 | * @author Daniel Li
11 | * @since 29 July 2012
12 | */
13 | @Service
14 | public class Log2Listener implements ApplicationListener {
15 |
16 | private static final Logger LOGGER = LoggerFactory.getLogger(Log2Listener.class);
17 |
18 | @Override
19 | public void onApplicationEvent(LogEvent event) {
20 | String message = event.getMessage();
21 | LOGGER.info("{}:{}", Thread.currentThread(), message);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/xultimate-context/src/test/java/org/danielli/xultimate/context/event/LogEvent.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.event;
2 |
3 | import org.springframework.context.ApplicationContext;
4 | import org.springframework.context.event.ApplicationContextEvent;
5 |
6 | public class LogEvent extends ApplicationContextEvent {
7 |
8 | private static final long serialVersionUID = 1L;
9 |
10 | private String message;
11 |
12 | public LogEvent(ApplicationContext source, String message) {
13 | super(source);
14 | this.message = message;
15 | }
16 |
17 | public String getMessage() {
18 | return message;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/xultimate-context/src/test/java/org/danielli/xultimate/context/performance/PerformanceMonitorForEachMethodInterceptorTest.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.performance;
2 |
3 | import javax.annotation.Resource;
4 |
5 | import org.danielli.xultimate.context.performance.service.TestService;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 | import org.springframework.test.context.ContextConfiguration;
9 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
10 |
11 | @RunWith(SpringJUnit4ClassRunner.class)
12 | @ContextConfiguration(locations = { "classpath:/performance/applicationContext-service-performance-each.xml" })
13 | public class PerformanceMonitorForEachMethodInterceptorTest {
14 |
15 | @Resource(name = "testService")
16 | private TestService testService;
17 |
18 | @Test
19 | public void test() {
20 | testService.doSomething();
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-context/src/test/java/org/danielli/xultimate/context/performance/PerformanceMonitorForOneMethodInterceptorTest.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.performance;
2 |
3 | import javax.annotation.Resource;
4 |
5 | import org.danielli.xultimate.context.performance.service.TestService;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 | import org.springframework.test.context.ContextConfiguration;
9 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
10 |
11 | @RunWith(SpringJUnit4ClassRunner.class)
12 | @ContextConfiguration(locations = { "classpath:/performance/applicationContext-service-performance-one.xml" })
13 | public class PerformanceMonitorForOneMethodInterceptorTest {
14 |
15 | @Resource(name = "testService")
16 | private TestService testService;
17 |
18 | @Test
19 | public void test() {
20 | testService.doSomething();
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-context/src/test/java/org/danielli/xultimate/context/performance/biz/TestBiz.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.performance.biz;
2 |
3 | import org.danielli.xultimate.context.performance.PerformanceMonitor;
4 | import org.springframework.stereotype.Service;
5 |
6 | @Service("testBiz")
7 | public class TestBiz {
8 |
9 | @PerformanceMonitor
10 | public void doSomething1() {
11 | try {
12 | Thread.sleep(5 * 1000);
13 | } catch (InterruptedException e) {
14 | e.printStackTrace();
15 | };
16 | }
17 |
18 | @PerformanceMonitor
19 | public void doSomething2() {
20 | try {
21 | Thread.sleep(3 * 1000);
22 | } catch (InterruptedException e) {
23 | e.printStackTrace();
24 | };
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/xultimate-context/src/test/java/org/danielli/xultimate/context/performance/service/TestService.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.performance.service;
2 |
3 | import javax.annotation.Resource;
4 |
5 | import org.danielli.xultimate.context.performance.PerformanceMonitor;
6 | import org.danielli.xultimate.context.performance.biz.TestBiz;
7 | import org.springframework.stereotype.Service;
8 |
9 | @Service("testService")
10 | public class TestService {
11 |
12 | @Resource(name = "testBiz")
13 | private TestBiz testBiz;
14 |
15 | @PerformanceMonitor
16 | public void doSomething() {
17 | try {
18 | Thread.sleep(4 * 1000);
19 | } catch (InterruptedException e) {
20 | e.printStackTrace();
21 | }
22 | testBiz.doSomething1();
23 | try {
24 | Thread.sleep(4 * 1000);
25 | } catch (InterruptedException e) {
26 | e.printStackTrace();
27 | }
28 | testBiz.doSomething2();
29 | try {
30 | Thread.sleep(4 * 1000);
31 | } catch (InterruptedException e) {
32 | e.printStackTrace();
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/xultimate-context/src/test/java/org/danielli/xultimate/context/support/EncryptPropertyPlaceholderConfigurerTest.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.context.support;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.slf4j.Logger;
6 | import org.slf4j.LoggerFactory;
7 | import org.springframework.beans.factory.annotation.Value;
8 | import org.springframework.test.context.ContextConfiguration;
9 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
10 |
11 | @RunWith(SpringJUnit4ClassRunner.class)
12 | @ContextConfiguration(locations = { "classpath*:applicationContext-service-config.xml", "classpath:applicationContext-service-crypto.xml", "classpath:/support/applicationContext-service-support.xml" })
13 | public class EncryptPropertyPlaceholderConfigurerTest {
14 |
15 | @Value("${test.value}")
16 | private String value;
17 |
18 | private static final Logger LOGGER = LoggerFactory.getLogger(EncryptPropertyPlaceholderConfigurerTest.class);
19 |
20 | @Test
21 | public void test() {
22 | LOGGER.info(value);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/xultimate-context/src/test/resources/chardet/test.txt:
--------------------------------------------------------------------------------
1 | 我是中国人。
2 | I'm Chinese.
--------------------------------------------------------------------------------
/xultimate-context/src/test/resources/i18n/test_en_US.properties:
--------------------------------------------------------------------------------
1 | helloWorld=Hello World!
--------------------------------------------------------------------------------
/xultimate-context/src/test/resources/i18n/test_zh_CN.properties:
--------------------------------------------------------------------------------
1 | helloWorld=\u4E16\u754C\u4F60\u597D\uFF01
--------------------------------------------------------------------------------
/xultimate-context/src/test/resources/image/go-home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daniellitoc/xultimate-toolkit/d3224632489626e7ab5a708821f4189c5e6d8764/xultimate-context/src/test/resources/image/go-home.png
--------------------------------------------------------------------------------
/xultimate-context/src/test/resources/image/test.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daniellitoc/xultimate-toolkit/d3224632489626e7ab5a708821f4189c5e6d8764/xultimate-context/src/test/resources/image/test.jpg
--------------------------------------------------------------------------------
/xultimate-context/src/test/resources/image2/go-home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daniellitoc/xultimate-toolkit/d3224632489626e7ab5a708821f4189c5e6d8764/xultimate-context/src/test/resources/image2/go-home.png
--------------------------------------------------------------------------------
/xultimate-context/src/test/resources/image2/test.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daniellitoc/xultimate-toolkit/d3224632489626e7ab5a708821f4189c5e6d8764/xultimate-context/src/test/resources/image2/test.jpg
--------------------------------------------------------------------------------
/xultimate-context/src/test/resources/support/test.properties:
--------------------------------------------------------------------------------
1 | test.value=dcbe8df70f8da53e3a323ccf7e9ed758
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/ClassTypeSupporter.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core;
2 |
3 | /**
4 | * 类型支持器。
5 | *
6 | * @author Daniel Li
7 | * @since 18 Jun 2013
8 | */
9 | public interface ClassTypeSupporter {
10 |
11 | /**
12 | * 是否支持此类型。
13 | * @param classType 类型。
14 | * @return 如果为true,则表示可以,否则为false。
15 | */
16 | boolean support(Class> classType);
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/compression/Compressor.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.compression;
2 |
3 | import java.io.OutputStream;
4 |
5 | /**
6 | * 压缩器。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | *
11 | * @param 原始源。
12 | * @param 目标源。
13 | */
14 | public interface Compressor {
15 |
16 | /**
17 | * 压缩。
18 | *
19 | * @param source 原始源。
20 | * @return 目标源。
21 | * @throws CompressorException 压缩异常,在压缩过程中出现的任何异常都会使用{@link CompressorException}封装并抛出。
22 | */
23 | T compress(S source) throws CompressorException;
24 |
25 | /**
26 | * 包装输出流。
27 | *
28 | * @param sourceInputStream 原始输出流。
29 | * @return 包装后的输出流。
30 | * @throws CompressorException 压缩异常,在包装过程中出现的任何异常都会使用{@link CompressorException}封装并抛出。
31 | */
32 | OutputStream wrapper(OutputStream sourceOutputStream) throws CompressorException;
33 | }
34 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/compression/CompressorException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.compression;
2 |
3 | import org.springframework.core.NestedRuntimeException;
4 |
5 | /**
6 | * 压缩异常。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | * @see NestedRuntimeException
11 | */
12 | public class CompressorException extends NestedRuntimeException {
13 |
14 | private static final long serialVersionUID = 8862452193888553128L;
15 |
16 | public CompressorException(String message) {
17 | super(message);
18 | }
19 |
20 | public CompressorException(String message, Throwable cause) {
21 | super(message, cause);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/compression/Decompressor.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.compression;
2 |
3 | import java.io.InputStream;
4 |
5 | /**
6 | * 解压缩器。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | *
11 | * @param 原始源。
12 | * @param 目标源。
13 | */
14 | public interface Decompressor {
15 |
16 | /**
17 | * 解压缩。
18 | *
19 | * @param source 原始源。
20 | * @return 目标源。
21 | * @throws DecompressorException 解压缩异常,在解压缩过程中出现的任何异常都会使用{@link DecompressorException}封装并抛出。
22 | */
23 | T decompress(S source) throws DecompressorException;
24 |
25 | /**
26 | * 包装输入流。
27 | *
28 | * @param sourceInputStream 原始输入流。
29 | * @return 包装后的输入流。
30 | * @throws DecompressorException 解压缩异常,在包装过程中出现的任何异常都会使用{@link DecompressorException}封装并抛出。
31 | */
32 | InputStream wrapper(InputStream sourceInputStream) throws DecompressorException;
33 | }
34 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/compression/DecompressorException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.compression;
2 |
3 | import org.springframework.core.NestedRuntimeException;
4 |
5 | /**
6 | * 解压缩异常。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | * @see NestedRuntimeException
11 | */
12 | public class DecompressorException extends NestedRuntimeException {
13 |
14 | private static final long serialVersionUID = 8862452193888553128L;
15 |
16 | public DecompressorException(String message) {
17 | super(message);
18 | }
19 |
20 | public DecompressorException(String message, Throwable cause) {
21 | super(message, cause);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/io/AbstractObjectInput.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.io;
2 |
3 | import java.io.IOException;
4 | import java.io.InputStream;
5 |
6 | import com.esotericsoftware.kryo.io.Input;
7 |
8 | /**
9 | * 抽象对象输入流。
10 | *
11 | * @author Daniel Li
12 | * @since 10 May 2014
13 | */
14 | public abstract class AbstractObjectInput extends Input {
15 |
16 | public AbstractObjectInput (int bufferSize) {
17 | super(bufferSize);
18 | }
19 |
20 | public AbstractObjectInput (byte[] buffer) {
21 | super(buffer);
22 | }
23 |
24 | public AbstractObjectInput (byte[] buffer, int offset, int count) {
25 | super(buffer, offset, count);
26 | }
27 |
28 | public AbstractObjectInput (InputStream inputStream, int bufferSize) {
29 | super(inputStream, bufferSize);
30 | }
31 |
32 | public abstract Object readObject() throws IOException, ClassNotFoundException;
33 |
34 | public abstract T readObject(Class cls) throws IOException, ClassNotFoundException;
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/json/JSONException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.json;
2 |
3 | import org.springframework.core.NestedRuntimeException;
4 |
5 | /**
6 | * JSON异常。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | * @see NestedRuntimeException
11 | */
12 | public class JSONException extends NestedRuntimeException {
13 |
14 | private static final long serialVersionUID = -9198606590046525595L;
15 |
16 | public JSONException(String message) {
17 | super(message);
18 | }
19 |
20 | public JSONException(String message, Throwable cause) {
21 | super(message, cause);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/json/ValueType.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.json;
2 |
3 | import java.lang.reflect.ParameterizedType;
4 | import java.lang.reflect.Type;
5 |
6 | import org.danielli.xultimate.core.json.JSONException;
7 | import org.danielli.xultimate.core.json.ValueType;
8 | import org.danielli.xultimate.util.Assert;
9 |
10 | /**
11 | * 当JSON转换Java类型时,通过此类的范型元素标识转换的类。
12 | *
13 | * @author Daniel Li
14 | * @since 18 Jun 2013
15 | *
16 | * @param 被转换成的类型。
17 | */
18 | public abstract class ValueType {
19 | /** 范型元素的类型 */
20 | private Type type;
21 |
22 | public ValueType() {
23 | Type type = this.getClass().getGenericSuperclass();
24 | if (type instanceof ParameterizedType) {
25 | Type[] parameterizedType = ((ParameterizedType) type).getActualTypeArguments();
26 | this.type = parameterizedType[0];
27 | }
28 | Assert.notNull(type, new JSONException("Type has not been set before usage"));
29 | }
30 |
31 | /**
32 | * 获取范型元素的类型。
33 | *
34 | * @return 范型元素的类型。
35 | */
36 | public final Type getType() {
37 | return this.type;
38 | }
39 | }
40 |
41 |
42 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/json/fastjson/ValueTypeAdapter.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.json.fastjson;
2 |
3 | import java.lang.reflect.Type;
4 |
5 | import org.danielli.xultimate.core.json.ValueType;
6 |
7 | import com.alibaba.fastjson.TypeReference;
8 |
9 | /**
10 | * {@link TypeReference}适配器。
11 | *
12 | * @author Daniel Li
13 | * @since 18 Jun 2013
14 | * @see TypeReference
15 | *
16 | * @param
17 | */
18 | public class ValueTypeAdapter extends TypeReference {
19 |
20 | private ValueType valueType;
21 |
22 | public ValueTypeAdapter(ValueType valueType) {
23 | this.valueType = valueType;
24 | }
25 |
26 | @Override
27 | public Type getType() {
28 | return valueType.getType();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/json/jackson/ValueTypeAdapter.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.json.jackson;
2 |
3 | import java.lang.reflect.Type;
4 |
5 | import org.danielli.xultimate.core.json.ValueType;
6 |
7 | import com.fasterxml.jackson.core.type.TypeReference;
8 |
9 | /**
10 | * {@link TypeReference}适配器。
11 | *
12 | * @author Daniel Li
13 | * @since 18 Jun 2013
14 | * @see TypeReference
15 | *
16 | * @param
17 | */
18 | public class ValueTypeAdapter extends TypeReference {
19 |
20 | private ValueType valueType;
21 |
22 | public ValueTypeAdapter(ValueType valueType) {
23 | this.valueType = valueType;
24 | }
25 |
26 | @Override
27 | public Type getType() {
28 | return valueType.getType();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/serializer/AbstractClassTypeSupporterSerializer.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.serializer;
2 |
3 | import org.danielli.xultimate.core.ClassTypeSupporter;
4 |
5 | public abstract class AbstractClassTypeSupporterSerializer implements ClassTypeSupporterSerializer {
6 |
7 | protected ClassTypeSupporter classTypeSupporter;
8 |
9 | @Override
10 | public boolean support(Class> classType) {
11 | return classTypeSupporter.support(classType);
12 | }
13 |
14 | public void setClassTypeSupporter(ClassTypeSupporter classTypeSupporter) {
15 | this.classTypeSupporter = classTypeSupporter;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/serializer/ClassTypeSupporterSerializer.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.serializer;
2 |
3 | import org.danielli.xultimate.core.ClassTypeSupporter;
4 |
5 | public interface ClassTypeSupporterSerializer extends Serializer, Deserializer, ClassTypeSupporter {
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/serializer/Deserializer.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.serializer;
2 |
3 | import java.io.InputStream;
4 |
5 | /**
6 | * 反序列化处理器。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | */
11 | public interface Deserializer {
12 |
13 | /**
14 | * 反序列化。
15 | *
16 | * @param bytes 序列化数据。
17 | * @param clazz 返序列化后的类型。
18 | * @return 类型为clazz的实例。
19 | */
20 | T deserialize(byte[] bytes, Class clazz) throws DeserializerException;
21 |
22 | /**
23 | * 从输入流中反序列化。
24 | *
25 | * @param inputStream 输入流。
26 | * @param clazz 返序列化后的类型。
27 | * @return 类型为clazz的实例。
28 | */
29 | T deserialize(InputStream inputStream, Class clazz) throws DeserializerException;
30 | }
31 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/serializer/DeserializerException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.serializer;
2 |
3 | import org.springframework.core.NestedRuntimeException;
4 |
5 | /**
6 | * 反序列化异常。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | * @see NestedRuntimeException
11 | */
12 | public class DeserializerException extends NestedRuntimeException {
13 |
14 | private static final long serialVersionUID = 3488287486491666049L;
15 |
16 | public DeserializerException(String message) {
17 | super(message);
18 | }
19 |
20 | public DeserializerException(String message, Throwable cause) {
21 | super(message, cause);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/serializer/RpcSerializer.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.serializer;
2 |
3 |
4 | public abstract class RpcSerializer implements ClassTypeSupporterSerializer {
5 |
6 | @Override
7 | public boolean support(Class> classType) {
8 | return true;
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/serializer/Serializer.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.serializer;
2 |
3 | import java.io.OutputStream;
4 |
5 | /**
6 | * 序列化处理器。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | */
11 | public interface Serializer {
12 |
13 | /**
14 | * 序列化。
15 | *
16 | * @param source 需要序列化的对像实例。
17 | * @return 序列化后的数据。
18 | */
19 | byte[] serialize(T source) throws SerializerException;
20 |
21 | /**
22 | * 序列化一个对像到给定的输出流。
23 | *
24 | * @param source 需要序列化的对像实例。
25 | * @param outputStream 输出流。
26 | */
27 | void serialize(T source, OutputStream outputStream) throws SerializerException;
28 | }
29 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/serializer/SerializerException.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.serializer;
2 |
3 | import org.springframework.core.NestedRuntimeException;
4 |
5 | /**
6 | * 序列化异常。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | * @see NestedRuntimeException
11 | */
12 | public class SerializerException extends NestedRuntimeException {
13 |
14 | private static final long serialVersionUID = 3488287486491666049L;
15 |
16 | public SerializerException(String message) {
17 | super(message);
18 | }
19 |
20 | public SerializerException(String message, Throwable cause) {
21 | super(message, cause);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/serializer/kryo/KryoGenerator.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.serializer.kryo;
2 |
3 | import com.esotericsoftware.kryo.Kryo;
4 |
5 | /**
6 | * Kryo实例生成器。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | */
11 | public interface KryoGenerator {
12 |
13 | Kryo generate();
14 | }
15 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/serializer/kryo/support/KryoContext.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.serializer.kryo.support;
2 |
3 | import com.esotericsoftware.kryo.Kryo;
4 |
5 | public class KryoContext {
6 |
7 | private static final ThreadLocal currentKryo = new ThreadLocal();
8 |
9 | public static void setCurrentKryo(Kryo kryo) {
10 | if (kryo != null) {
11 | currentKryo.set(kryo);
12 | }
13 | else {
14 | currentKryo.remove();
15 | }
16 | }
17 |
18 | public static Kryo currentKryo() {
19 | return currentKryo.get();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/serializer/kryo/support/ThreadLocalKryoGenerator.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.serializer.kryo.support;
2 |
3 | import org.danielli.xultimate.core.serializer.kryo.KryoGenerator;
4 |
5 | import com.esotericsoftware.kryo.Kryo;
6 |
7 | public class ThreadLocalKryoGenerator implements KryoGenerator {
8 |
9 | public static final ThreadLocalKryoGenerator INSTANCE = new ThreadLocalKryoGenerator();
10 |
11 | private KryoGenerator kryoGenerator = DefaultKryoGenerator.INSTANCE;
12 |
13 | private ThreadLocalKryoGenerator() {
14 | }
15 |
16 | @Override
17 | public Kryo generate() {
18 | Kryo currentKryo = KryoContext.currentKryo();
19 | if (currentKryo == null) {
20 | currentKryo = kryoGenerator.generate();
21 | KryoContext.setCurrentKryo(currentKryo);
22 | }
23 | return currentKryo;
24 | }
25 |
26 | public KryoGenerator getKryoGenerator() {
27 | return kryoGenerator;
28 | }
29 |
30 | public void setKryoGenerator(KryoGenerator kryoGenerator) {
31 | this.kryoGenerator = kryoGenerator;
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/serializer/protostuff/support/ProtobufClassTypeNotSupporter.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.serializer.protostuff.support;
2 |
3 | import java.util.Collection;
4 | import java.util.Date;
5 | import java.util.Map;
6 |
7 | import org.danielli.xultimate.core.support.DefaultClassTypeNotSupporter;
8 | import org.joda.time.DateTime;
9 |
10 | /**
11 | * 序列化性能不太好。
12 | *
13 | * @author Daniel Li
14 | * @since 18 Jun 2013
15 | */
16 | public class ProtobufClassTypeNotSupporter extends DefaultClassTypeNotSupporter {
17 |
18 | public static final ProtobufClassTypeNotSupporter INSTANCE = new ProtobufClassTypeNotSupporter();
19 |
20 | private ProtobufClassTypeNotSupporter() {
21 | Class>[] notSupportClassTypes = new Class>[5];
22 | notSupportClassTypes[0] = Number.class;
23 | notSupportClassTypes[1] = Date.class;
24 | notSupportClassTypes[2] = DateTime.class;
25 | notSupportClassTypes[3] = Collection.class;
26 | notSupportClassTypes[4] = Map.class;
27 | }
28 |
29 | @Override
30 | public boolean support(Class> classType) {
31 | return classType.isArray() ? false : super.support(classType);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/serializer/protostuff/util/LinkedBufferUtils.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.serializer.protostuff.util;
2 |
3 | import com.dyuproject.protostuff.LinkedBuffer;
4 |
5 | /**
6 | * LinkedBuffer工具类。
7 | *
8 | * @author Daniel Li
9 | * @since 18 Jun 2013
10 | */
11 | public class LinkedBufferUtils {
12 |
13 | private static ThreadLocal currentLinkedBuffer = new ThreadLocal();
14 |
15 | /**
16 | * 获取LinkedBuffer实例。
17 | * @return LinkedBuffer实例。
18 | */
19 | public static LinkedBuffer getCurrentLinkedBuffer(int bufferSize) {
20 | LinkedBuffer linkedBuffer = currentLinkedBuffer.get();
21 | if (linkedBuffer == null) {
22 | linkedBuffer = LinkedBuffer.allocate(bufferSize);
23 | currentLinkedBuffer.set(linkedBuffer);
24 | }
25 | return linkedBuffer;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/support/DefaultClassTypeNotSupporter.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.support;
2 |
3 | import org.danielli.xultimate.core.ClassTypeSupporter;
4 | import org.danielli.xultimate.util.ArrayUtils;
5 | import org.danielli.xultimate.util.reflect.ClassUtils;
6 |
7 | public class DefaultClassTypeNotSupporter implements ClassTypeSupporter{
8 |
9 | /** 不支持类型列表 */
10 | protected Class>[] notSupportClassTypes;
11 |
12 | @Override
13 | public boolean support(Class> classType) {
14 | if (ArrayUtils.isNotEmpty(notSupportClassTypes)) {
15 | for (Class> c : notSupportClassTypes) {
16 | if (ClassUtils.isAssignable(c, classType)) {
17 | return false;
18 | }
19 | }
20 | }
21 | return true;
22 | }
23 |
24 | /**
25 | * 设置不支持类型列表。
26 | * @param notSupportClassTypes 不支持类型列表
27 | */
28 | public void setNotSupportClassTypes(Class>[] notSupportClassTypes) {
29 | this.notSupportClassTypes = notSupportClassTypes;
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/core/support/DefaultClassTypeSupporter.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.core.support;
2 |
3 | import org.danielli.xultimate.core.ClassTypeSupporter;
4 | import org.danielli.xultimate.util.ArrayUtils;
5 | import org.danielli.xultimate.util.reflect.ClassUtils;
6 |
7 | public class DefaultClassTypeSupporter implements ClassTypeSupporter {
8 |
9 | /** 支持类型列表 */
10 | protected Class>[] supportClassTypes;
11 |
12 | @Override
13 | public boolean support(Class> classType) {
14 | if (ArrayUtils.isNotEmpty(supportClassTypes)) {
15 | for (Class> c : supportClassTypes) {
16 | if (ClassUtils.isAssignable(c, classType)) {
17 | return true;
18 | }
19 | }
20 | }
21 | return false;
22 | }
23 |
24 | /**
25 | * 设置支持类型列表。
26 | * @param supportClassTypes 支持类型列表
27 | */
28 | public void setSupportClassTypes(Class>[] supportClassTypes) {
29 | this.supportClassTypes = supportClassTypes;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/util/builder/BuildType.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.util.builder;
2 |
3 | /**
4 | * 构建类型。
5 | *
6 | * @author Daniel Li
7 | * @since 16 Jun 2013
8 | */
9 | public enum BuildType {
10 |
11 | /** equals方法 */
12 | EQUALS,
13 |
14 | /** toString方法 */
15 | TO_STRING,
16 |
17 | /** hashCode方法 */
18 | HASH_CODE,
19 |
20 | /** compareTo方法 */
21 | COMPARE_TO
22 | }
23 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/util/builder/Buildable.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.util.builder;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Inherited;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | /**
11 | * 构建标识,用于表示是否支持ToString、HashCode、Equals、CompareTo。
12 | *
13 | * @author Daniel Li
14 | * @since 16 Jun 2013
15 | */
16 | @Target({ElementType.FIELD, ElementType.TYPE})
17 | @Retention(RetentionPolicy.RUNTIME)
18 | @Inherited
19 | @Documented
20 | public @interface Buildable {
21 |
22 | BuildType[] value() default {};
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/xultimate-core/src/main/java/org/danielli/xultimate/util/collections/MapBuilder.java:
--------------------------------------------------------------------------------
1 | package org.danielli.xultimate.util.collections;
2 |
3 | import java.util.Map;
4 |
5 | import org.apache.commons.lang3.builder.Builder;
6 |
7 | /**
8 | * 创建Map的Builder设计模式。
9 | *
10 | * @author Daniel Li
11 | * @since 16 Jun 2013
12 | *
13 | * @param Map键类型。
14 | * @param Map值类型。
15 | */
16 | public class MapBuilder implements Builder