Merge pull request 'active_mq 消息策略' (#65) from active_mq into main
Reviewed-on: https://src.ossez.com/Cwikius-Docs/java-tutorials/pulls/65
This commit is contained in:
commit
29381a633e
|
@ -8,34 +8,36 @@
|
||||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
<outputRelativeToContentRoot value="true" />
|
<outputRelativeToContentRoot value="true" />
|
||||||
<module name="assertion-libraries" />
|
<module name="assertion-libraries" />
|
||||||
<module name="core-java-annotations" />
|
|
||||||
<module name="core-java-numbers" />
|
|
||||||
<module name="core-java-strings" />
|
|
||||||
<module name="core-java-11" />
|
|
||||||
<module name="core-java-collections-conversions" />
|
|
||||||
<module name="core-java-collections" />
|
|
||||||
<module name="core-java-datetime-conversion" />
|
<module name="core-java-datetime-conversion" />
|
||||||
<module name="junit-5-basics" />
|
<module name="junit-5-basics" />
|
||||||
<module name="activejdbc" />
|
<module name="activejdbc" />
|
||||||
<module name="codebank" />
|
<module name="codebank" />
|
||||||
<module name="core-java-collections-list" />
|
|
||||||
<module name="spring-data-jpa-repo-2" />
|
<module name="spring-data-jpa-repo-2" />
|
||||||
<module name="core-java-streams" />
|
<module name="core-java-streams" />
|
||||||
<module name="core-java-io-2" />
|
<module name="core-java-io-2" />
|
||||||
<module name="core-java-io" />
|
<module name="core-java-io" />
|
||||||
<module name="core-java-8-2" />
|
|
||||||
<module name="discourse" />
|
<module name="discourse" />
|
||||||
<module name="image-processing" />
|
<module name="image-processing" />
|
||||||
<module name="spring-data-redis" />
|
<module name="spring-data-redis" />
|
||||||
<module name="core-java" />
|
<module name="core-java" />
|
||||||
<module name="core-java-collections-list-2" />
|
<module name="core-java-collections-list-2" />
|
||||||
<module name="core-java-collections-conversions-2" />
|
|
||||||
<module name="core-java-collections-list-3" />
|
|
||||||
<module name="core-java-8" />
|
<module name="core-java-8" />
|
||||||
<module name="core-java-collections-3" />
|
|
||||||
<module name="core-java-collections-2" />
|
|
||||||
</profile>
|
</profile>
|
||||||
</annotationProcessing>
|
</annotationProcessing>
|
||||||
|
<bytecodeTargetLevel>
|
||||||
|
<module name="core-java-11" target="11" />
|
||||||
|
<module name="core-java-8-2" target="11" />
|
||||||
|
<module name="core-java-annotations" target="11" />
|
||||||
|
<module name="core-java-collections" target="11" />
|
||||||
|
<module name="core-java-collections-2" target="11" />
|
||||||
|
<module name="core-java-collections-3" target="11" />
|
||||||
|
<module name="core-java-collections-conversions" target="11" />
|
||||||
|
<module name="core-java-collections-conversions-2" target="11" />
|
||||||
|
<module name="core-java-collections-list" target="11" />
|
||||||
|
<module name="core-java-collections-list-3" target="11" />
|
||||||
|
<module name="core-java-numbers" target="11" />
|
||||||
|
<module name="core-java-strings" target="11" />
|
||||||
|
</bytecodeTargetLevel>
|
||||||
</component>
|
</component>
|
||||||
<component name="JavacSettings">
|
<component name="JavacSettings">
|
||||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
<file url="file://$PROJECT_DIR$/core-java-modules/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/core-java-modules/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/image-processing/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/image-processing/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/image-processing/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/image-processing/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/parent-boot-2/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/parent-boot-2/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/persistence-modules/activejdbc/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/persistence-modules/activejdbc/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/persistence-modules/activejdbc/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/persistence-modules/activejdbc/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/persistence-modules/spring-data-jpa-repo-2/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/persistence-modules/spring-data-jpa-repo-2/src/main/java" charset="UTF-8" />
|
||||||
|
|
74
build.gradle
74
build.gradle
|
@ -1,74 +0,0 @@
|
||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.4.RELEASE")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id 'io.spring.dependency-management' version '1.0.8.RELEASE' apply false
|
|
||||||
id 'org.jetbrains.kotlin.jvm' version '1.3.50' apply false
|
|
||||||
id 'org.jetbrains.dokka' version '0.9.18' apply false
|
|
||||||
id 'org.asciidoctor.convert' version '1.5.8'
|
|
||||||
id 'io.spring.nohttp' version '0.0.3.RELEASE'
|
|
||||||
id 'de.undercouch.download' version '4.0.0'
|
|
||||||
id "com.jfrog.artifactory" version '4.9.8' apply false
|
|
||||||
id "io.freefair.aspectj" version "4.1.1" apply false
|
|
||||||
id "com.github.ben-manes.versions" version "0.24.0"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
apply plugin: 'java'
|
|
||||||
apply plugin: 'eclipse'
|
|
||||||
apply plugin: 'idea'
|
|
||||||
apply plugin: 'org.springframework.boot'
|
|
||||||
apply plugin: 'io.spring.dependency-management'
|
|
||||||
|
|
||||||
bootJar {
|
|
||||||
baseName = 'cwiki-us-spring-batch-processing'
|
|
||||||
version = '0.1.0'
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven { url "https://maven.ossez.com/repository/internal" }
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
|
||||||
targetCompatibility = 1.8
|
|
||||||
|
|
||||||
configure(allprojects) { project ->
|
|
||||||
apply plugin: 'java'
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
// LOG
|
|
||||||
compile 'ch.qos.logback:logback-classic:1.2.3'
|
|
||||||
|
|
||||||
compile 'org.hsqldb:hsqldb:2.5.0'
|
|
||||||
|
|
||||||
testCompile("junit:junit:4.12")
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven { url "https://maven.ossez.com/repository/internal" }
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
configure(rootProject) {
|
|
||||||
description = "Spring Framework"
|
|
||||||
|
|
||||||
apply plugin: "groovy"
|
|
||||||
apply plugin: "kotlin"
|
|
||||||
apply plugin: "io.spring.nohttp"
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
asciidoctor("io.spring.asciidoctor:spring-asciidoctor-extensions:0.1.3.RELEASE")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,453 +0,0 @@
|
||||||
#
|
|
||||||
# OWASP Enterprise Security API (ESAPI) Properties file -- PRODUCTION Version
|
|
||||||
#
|
|
||||||
# This file is part of the Open Web Application Security Project (OWASP)
|
|
||||||
# Enterprise Security API (ESAPI) project. For details, please see
|
|
||||||
# http://www.owasp.org/index.php/ESAPI.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2008,2009 - The OWASP Foundation
|
|
||||||
#
|
|
||||||
# DISCUSS: This may cause a major backwards compatibility issue, etc. but
|
|
||||||
# from a name space perspective, we probably should have prefaced
|
|
||||||
# all the property names with ESAPI or at least OWASP. Otherwise
|
|
||||||
# there could be problems is someone loads this properties file into
|
|
||||||
# the System properties. We could also put this file into the
|
|
||||||
# esapi.jar file (perhaps as a ResourceBundle) and then allow an external
|
|
||||||
# ESAPI properties be defined that would overwrite these defaults.
|
|
||||||
# That keeps the application's properties relatively simple as usually
|
|
||||||
# they will only want to override a few properties. If looks like we
|
|
||||||
# already support multiple override levels of this in the
|
|
||||||
# DefaultSecurityConfiguration class, but I'm suggesting placing the
|
|
||||||
# defaults in the esapi.jar itself. That way, if the jar is signed,
|
|
||||||
# we could detect if those properties had been tampered with. (The
|
|
||||||
# code to check the jar signatures is pretty simple... maybe 70-90 LOC,
|
|
||||||
# but off course there is an execution penalty (similar to the way
|
|
||||||
# that the separate sunjce.jar used to be when a class from it was
|
|
||||||
# first loaded). Thoughts?
|
|
||||||
###############################################################################
|
|
||||||
#
|
|
||||||
# WARNING: Operating system protection should be used to lock down the .esapi
|
|
||||||
# resources directory and all the files inside and all the directories all the
|
|
||||||
# way up to the root directory of the file system. Note that if you are using
|
|
||||||
# file-based implementations, that some files may need to be read-write as they
|
|
||||||
# get updated dynamically.
|
|
||||||
#
|
|
||||||
# Before using, be sure to update the MasterKey and MasterSalt as described below.
|
|
||||||
# N.B.: If you had stored data that you have previously encrypted with ESAPI 1.4,
|
|
||||||
# you *must* FIRST decrypt it using ESAPI 1.4 and then (if so desired)
|
|
||||||
# re-encrypt it with ESAPI 2.0. If you fail to do this, you will NOT be
|
|
||||||
# able to decrypt your data with ESAPI 2.0.
|
|
||||||
#
|
|
||||||
# YOU HAVE BEEN WARNED!!! More details are in the ESAPI 2.0 Release Notes.
|
|
||||||
#
|
|
||||||
#===========================================================================
|
|
||||||
# ESAPI Configuration
|
|
||||||
#
|
|
||||||
# If true, then print all the ESAPI properties set here when they are loaded.
|
|
||||||
# If false, they are not printed. Useful to reduce output when running JUnit tests.
|
|
||||||
# If you need to troubleshoot a properties related problem, turning this on may help.
|
|
||||||
# This is 'false' in the src/test/resources/.esapi version. It is 'true' by
|
|
||||||
# default for reasons of backward compatibility with earlier ESAPI versions.
|
|
||||||
ESAPI.printProperties=true
|
|
||||||
|
|
||||||
# ESAPI is designed to be easily extensible. You can use the reference implementation
|
|
||||||
# or implement your own providers to take advantage of your enterprise's security
|
|
||||||
# infrastructure. The functions in ESAPI are referenced using the ESAPI locator, like:
|
|
||||||
#
|
|
||||||
# String ciphertext =
|
|
||||||
# ESAPI.encryptor().encrypt("Secret message"); // Deprecated in 2.0
|
|
||||||
# CipherText cipherText =
|
|
||||||
# ESAPI.encryptor().encrypt(new PlainText("Secret message")); // Preferred
|
|
||||||
#
|
|
||||||
# Below you can specify the classname for the provider that you wish to use in your
|
|
||||||
# application. The only requirement is that it implement the appropriate ESAPI interface.
|
|
||||||
# This allows you to switch security implementations in the future without rewriting the
|
|
||||||
# entire application.
|
|
||||||
#
|
|
||||||
# ExperimentalAccessController requires ESAPI-AccessControlPolicy.xml in .esapi directory
|
|
||||||
ESAPI.AccessControl=org.owasp.esapi.reference.DefaultAccessController
|
|
||||||
# FileBasedAuthenticator requires users.txt file in .esapi directory
|
|
||||||
ESAPI.Authenticator=org.owasp.esapi.reference.FileBasedAuthenticator
|
|
||||||
ESAPI.Encoder=org.owasp.esapi.reference.DefaultEncoder
|
|
||||||
ESAPI.Encryptor=org.owasp.esapi.reference.crypto.JavaEncryptor
|
|
||||||
|
|
||||||
ESAPI.Executor=org.owasp.esapi.reference.DefaultExecutor
|
|
||||||
ESAPI.HTTPUtilities=org.owasp.esapi.reference.DefaultHTTPUtilities
|
|
||||||
ESAPI.IntrusionDetector=org.owasp.esapi.reference.DefaultIntrusionDetector
|
|
||||||
# Log4JFactory Requires log4j.xml or log4j.properties in classpath - http://www.laliluna.de/log4j-tutorial.html
|
|
||||||
ESAPI.Logger=org.owasp.esapi.reference.Log4JLogFactory
|
|
||||||
#ESAPI.Logger=org.owasp.esapi.reference.JavaLogFactory
|
|
||||||
ESAPI.Randomizer=org.owasp.esapi.reference.DefaultRandomizer
|
|
||||||
ESAPI.Validator=org.owasp.esapi.reference.DefaultValidator
|
|
||||||
|
|
||||||
#===========================================================================
|
|
||||||
# ESAPI Authenticator
|
|
||||||
#
|
|
||||||
Authenticator.AllowedLoginAttempts=3
|
|
||||||
Authenticator.MaxOldPasswordHashes=13
|
|
||||||
Authenticator.UsernameParameterName=username
|
|
||||||
Authenticator.PasswordParameterName=password
|
|
||||||
# RememberTokenDuration (in days)
|
|
||||||
Authenticator.RememberTokenDuration=14
|
|
||||||
# Session Timeouts (in minutes)
|
|
||||||
Authenticator.IdleTimeoutDuration=20
|
|
||||||
Authenticator.AbsoluteTimeoutDuration=120
|
|
||||||
|
|
||||||
#===========================================================================
|
|
||||||
# ESAPI Encoder
|
|
||||||
#
|
|
||||||
# ESAPI canonicalizes input before validation to prevent bypassing filters with encoded attacks.
|
|
||||||
# Failure to canonicalize input is a very common mistake when implementing validation schemes.
|
|
||||||
# Canonicalization is automatic when using the ESAPI Validator, but you can also use the
|
|
||||||
# following code to canonicalize data.
|
|
||||||
#
|
|
||||||
# ESAPI.Encoder().canonicalize( "%22hello world"" );
|
|
||||||
#
|
|
||||||
# Multiple encoding is when a single encoding format is applied multiple times. Allowing
|
|
||||||
# multiple encoding is strongly discouraged.
|
|
||||||
Encoder.AllowMultipleEncoding=false
|
|
||||||
|
|
||||||
# Mixed encoding is when multiple different encoding formats are applied, or when
|
|
||||||
# multiple formats are nested. Allowing multiple encoding is strongly discouraged.
|
|
||||||
Encoder.AllowMixedEncoding=false
|
|
||||||
|
|
||||||
# The default list of codecs to apply when canonicalizing untrusted data. The list should include the codecs
|
|
||||||
# for all downstream interpreters or decoders. For example, if the data is likely to end up in a URL, HTML, or
|
|
||||||
# inside JavaScript, then the list of codecs below is appropriate. The order of the list is not terribly important.
|
|
||||||
Encoder.DefaultCodecList=HTMLEntityCodec,PercentCodec,JavaScriptCodec
|
|
||||||
|
|
||||||
|
|
||||||
#===========================================================================
|
|
||||||
# ESAPI Encryption
|
|
||||||
#
|
|
||||||
# The ESAPI Encryptor provides basic cryptographic functions with a simplified API.
|
|
||||||
# To get started, generate a new key using java -classpath esapi.jar org.owasp.esapi.reference.crypto.JavaEncryptor
|
|
||||||
# There is not currently any support for key rotation, so be careful when changing your key and salt as it
|
|
||||||
# will invalidate all signed, encrypted, and hashed data.
|
|
||||||
#
|
|
||||||
# WARNING: Not all combinations of algorithms and key lengths are supported.
|
|
||||||
# If you choose to use a key length greater than 128, you MUST download the
|
|
||||||
# unlimited strength policy files and install in the lib directory of your JRE/JDK.
|
|
||||||
# See http://java.sun.com/javase/downloads/index.jsp for more information.
|
|
||||||
#
|
|
||||||
# Backward compatibility with ESAPI Java 1.4 is supported by the two deprecated API
|
|
||||||
# methods, Encryptor.encrypt(String) and Encryptor.decrypt(String). However, whenever
|
|
||||||
# possible, these methods should be avoided as they use ECB cipher mode, which in almost
|
|
||||||
# all circumstances a poor choice because of it's weakness. CBC cipher mode is the default
|
|
||||||
# for the new Encryptor encrypt / decrypt methods for ESAPI Java 2.0. In general, you
|
|
||||||
# should only use this compatibility setting if you have persistent data encrypted with
|
|
||||||
# version 1.4 and even then, you should ONLY set this compatibility mode UNTIL
|
|
||||||
# you have decrypted all of your old encrypted data and then re-encrypted it with
|
|
||||||
# ESAPI 2.0 using CBC mode. If you have some reason to mix the deprecated 1.4 mode
|
|
||||||
# with the new 2.0 methods, make sure that you use the same cipher algorithm for both
|
|
||||||
# (256-bit AES was the default for 1.4; 128-bit is the default for 2.0; see below for
|
|
||||||
# more details.) Otherwise, you will have to use the new 2.0 encrypt / decrypt methods
|
|
||||||
# where you can specify a SecretKey. (Note that if you are using the 256-bit AES,
|
|
||||||
# that requires downloading the special jurisdiction policy files mentioned above.)
|
|
||||||
#
|
|
||||||
# ***** IMPORTANT: Do NOT forget to replace these with your own values! *****
|
|
||||||
# To calculate these values, you can run:
|
|
||||||
# java -classpath esapi.jar org.owasp.esapi.reference.crypto.JavaEncryptor
|
|
||||||
#
|
|
||||||
Encryptor.MasterKey=tzfztf56ftv
|
|
||||||
Encryptor.MasterSalt=123456ztrewq
|
|
||||||
|
|
||||||
# Provides the default JCE provider that ESAPI will "prefer" for its symmetric
|
|
||||||
# encryption and hashing. (That is it will look to this provider first, but it
|
|
||||||
# will defer to other providers if the requested algorithm is not implemented
|
|
||||||
# by this provider.) If left unset, ESAPI will just use your Java VM's current
|
|
||||||
# preferred JCE provider, which is generally set in the file
|
|
||||||
# "$JAVA_HOME/jre/lib/security/java.security".
|
|
||||||
#
|
|
||||||
# The main intent of this is to allow ESAPI symmetric encryption to be
|
|
||||||
# used with a FIPS 140-2 compliant crypto-module. For details, see the section
|
|
||||||
# "Using ESAPI Symmetric Encryption with FIPS 140-2 Cryptographic Modules" in
|
|
||||||
# the ESAPI 2.0 Symmetric Encryption User Guide, at:
|
|
||||||
# http://owasp-esapi-java.googlecode.com/svn/trunk/documentation/esapi4java-core-2.0-symmetric-crypto-user-guide.html
|
|
||||||
# However, this property also allows you to easily use an alternate JCE provider
|
|
||||||
# such as "Bouncy Castle" without having to make changes to "java.security".
|
|
||||||
# See Javadoc for SecurityProviderLoader for further details. If you wish to use
|
|
||||||
# a provider that is not known to SecurityProviderLoader, you may specify the
|
|
||||||
# fully-qualified class name of the JCE provider class that implements
|
|
||||||
# java.security.Provider. If the name contains a '.', this is interpreted as
|
|
||||||
# a fully-qualified class name that implements java.security.Provider.
|
|
||||||
#
|
|
||||||
# NOTE: Setting this property has the side-effect of changing it in your application
|
|
||||||
# as well, so if you are using JCE in your application directly rather than
|
|
||||||
# through ESAPI (you wouldn't do that, would you? ;-), it will change the
|
|
||||||
# preferred JCE provider there as well.
|
|
||||||
#
|
|
||||||
# Default: Keeps the JCE provider set to whatever JVM sets it to.
|
|
||||||
Encryptor.PreferredJCEProvider=
|
|
||||||
|
|
||||||
# AES is the most widely used and strongest encryption algorithm. This
|
|
||||||
# should agree with your Encryptor.CipherTransformation property.
|
|
||||||
# By default, ESAPI Java 1.4 uses "PBEWithMD5AndDES" and which is
|
|
||||||
# very weak. It is essentially a password-based encryption key, hashed
|
|
||||||
# with MD5 around 1K times and then encrypted with the weak DES algorithm
|
|
||||||
# (56-bits) using ECB mode and an unspecified padding (it is
|
|
||||||
# JCE provider specific, but most likely "NoPadding"). However, 2.0 uses
|
|
||||||
# "AES/CBC/PKCSPadding". If you want to change these, change them here.
|
|
||||||
# Warning: This property does not control the default reference implementation for
|
|
||||||
# ESAPI 2.0 using JavaEncryptor. Also, this property will be dropped
|
|
||||||
# in the future.
|
|
||||||
# @deprecated
|
|
||||||
Encryptor.EncryptionAlgorithm=AES
|
|
||||||
# For ESAPI Java 2.0 - New encrypt / decrypt methods use this.
|
|
||||||
Encryptor.CipherTransformation=AES/CBC/PKCS5Padding
|
|
||||||
|
|
||||||
# Applies to ESAPI 2.0 and later only!
|
|
||||||
# Comma-separated list of cipher modes that provide *BOTH*
|
|
||||||
# confidentiality *AND* message authenticity. (NIST refers to such cipher
|
|
||||||
# modes as "combined modes" so that's what we shall call them.) If any of these
|
|
||||||
# cipher modes are used then no MAC is calculated and stored
|
|
||||||
# in the CipherText upon encryption. Likewise, if one of these
|
|
||||||
# cipher modes is used with decryption, no attempt will be made
|
|
||||||
# to validate the MAC contained in the CipherText object regardless
|
|
||||||
# of whether it contains one or not. Since the expectation is that
|
|
||||||
# these cipher modes support support message authenticity already,
|
|
||||||
# injecting a MAC in the CipherText object would be at best redundant.
|
|
||||||
#
|
|
||||||
# Note that as of JDK 1.5, the SunJCE provider does not support *any*
|
|
||||||
# of these cipher modes. Of these listed, only GCM and CCM are currently
|
|
||||||
# NIST approved. YMMV for other JCE providers. E.g., Bouncy Castle supports
|
|
||||||
# GCM and CCM with "NoPadding" mode, but not with "PKCS5Padding" or other
|
|
||||||
# padding modes.
|
|
||||||
Encryptor.cipher_modes.combined_modes=GCM,CCM,IAPM,EAX,OCB,CWC
|
|
||||||
|
|
||||||
# Applies to ESAPI 2.0 and later only!
|
|
||||||
# Additional cipher modes allowed for ESAPI 2.0 encryption. These
|
|
||||||
# cipher modes are in _addition_ to those specified by the property
|
|
||||||
# 'Encryptor.cipher_modes.combined_modes'.
|
|
||||||
# Note: We will add support for streaming modes like CFB & OFB once
|
|
||||||
# we add support for 'specified' to the property 'Encryptor.ChooseIVMethod'
|
|
||||||
# (probably in ESAPI 2.1).
|
|
||||||
# DISCUSS: Better name?
|
|
||||||
Encryptor.cipher_modes.additional_allowed=CBC
|
|
||||||
|
|
||||||
# 128-bit is almost always sufficient and appears to be more resistant to
|
|
||||||
# related key attacks than is 256-bit AES. Use '_' to use default key size
|
|
||||||
# for cipher algorithms (where it makes sense because the algorithm supports
|
|
||||||
# a variable key size). Key length must agree to what's provided as the
|
|
||||||
# cipher transformation, otherwise this will be ignored after logging a
|
|
||||||
# warning.
|
|
||||||
#
|
|
||||||
# NOTE: This is what applies BOTH ESAPI 1.4 and 2.0. See warning above about mixing!
|
|
||||||
Encryptor.EncryptionKeyLength=128
|
|
||||||
|
|
||||||
# Because 2.0 uses CBC mode by default, it requires an initialization vector (IV).
|
|
||||||
# (All cipher modes except ECB require an IV.) There are two choices: we can either
|
|
||||||
# use a fixed IV known to both parties or allow ESAPI to choose a random IV. While
|
|
||||||
# the IV does not need to be hidden from adversaries, it is important that the
|
|
||||||
# adversary not be allowed to choose it. Also, random IVs are generally much more
|
|
||||||
# secure than fixed IVs. (In fact, it is essential that feed-back cipher modes
|
|
||||||
# such as CFB and OFB use a different IV for each encryption with a given key so
|
|
||||||
# in such cases, random IVs are much preferred. By default, ESAPI 2.0 uses random
|
|
||||||
# IVs. If you wish to use 'fixed' IVs, set 'Encryptor.ChooseIVMethod=fixed' and
|
|
||||||
# uncomment the Encryptor.fixedIV.
|
|
||||||
#
|
|
||||||
# Valid values: random|fixed|specified 'specified' not yet implemented; planned for 2.1
|
|
||||||
Encryptor.ChooseIVMethod=random
|
|
||||||
# If you choose to use a fixed IV, then you must place a fixed IV here that
|
|
||||||
# is known to all others who are sharing your secret key. The format should
|
|
||||||
# be a hex string that is the same length as the cipher block size for the
|
|
||||||
# cipher algorithm that you are using. The following is an *example* for AES
|
|
||||||
# from an AES test vector for AES-128/CBC as described in:
|
|
||||||
# NIST Special Publication 800-38A (2001 Edition)
|
|
||||||
# "Recommendation for Block Cipher Modes of Operation".
|
|
||||||
# (Note that the block size for AES is 16 bytes == 128 bits.)
|
|
||||||
#
|
|
||||||
Encryptor.fixedIV=0x000102030405060708090a0b0c0d0e0f
|
|
||||||
|
|
||||||
# Whether or not CipherText should use a message authentication code (MAC) with it.
|
|
||||||
# This prevents an adversary from altering the IV as well as allowing a more
|
|
||||||
# fool-proof way of determining the decryption failed because of an incorrect
|
|
||||||
# key being supplied. This refers to the "separate" MAC calculated and stored
|
|
||||||
# in CipherText, not part of any MAC that is calculated as a result of a
|
|
||||||
# "combined mode" cipher mode.
|
|
||||||
#
|
|
||||||
# If you are using ESAPI with a FIPS 140-2 cryptographic module, you *must* also
|
|
||||||
# set this property to false.
|
|
||||||
Encryptor.CipherText.useMAC=true
|
|
||||||
|
|
||||||
# Whether or not the PlainText object may be overwritten and then marked
|
|
||||||
# eligible for garbage collection. If not set, this is still treated as 'true'.
|
|
||||||
Encryptor.PlainText.overwrite=true
|
|
||||||
|
|
||||||
# Do not use DES except in a legacy situations. 56-bit is way too small key size.
|
|
||||||
#Encryptor.EncryptionKeyLength=56
|
|
||||||
#Encryptor.EncryptionAlgorithm=DES
|
|
||||||
|
|
||||||
# TripleDES is considered strong enough for most purposes.
|
|
||||||
# Note: There is also a 112-bit version of DESede. Using the 168-bit version
|
|
||||||
# requires downloading the special jurisdiction policy from Sun.
|
|
||||||
#Encryptor.EncryptionKeyLength=168
|
|
||||||
#Encryptor.EncryptionAlgorithm=DESede
|
|
||||||
|
|
||||||
Encryptor.HashAlgorithm=SHA-512
|
|
||||||
Encryptor.HashIterations=1024
|
|
||||||
Encryptor.DigitalSignatureAlgorithm=SHA1withDSA
|
|
||||||
Encryptor.DigitalSignatureKeyLength=1024
|
|
||||||
Encryptor.RandomAlgorithm=SHA1PRNG
|
|
||||||
Encryptor.CharacterEncoding=UTF-8
|
|
||||||
|
|
||||||
# This is the Pseudo Random Function (PRF) that ESAPI's Key Derivation Function
|
|
||||||
# (KDF) normally uses. Note this is *only* the PRF used for ESAPI's KDF and
|
|
||||||
# *not* what is used for ESAPI's MAC. (Currently, HmacSHA1 is always used for
|
|
||||||
# the MAC, mostly to keep the overall size at a minimum.)
|
|
||||||
#
|
|
||||||
# Currently supported choices for JDK 1.5 and 1.6 are:
|
|
||||||
# HmacSHA1 (160 bits), HmacSHA256 (256 bits), HmacSHA384 (384 bits), and
|
|
||||||
# HmacSHA512 (512 bits).
|
|
||||||
# Note that HmacMD5 is *not* supported for the PRF used by the KDF even though
|
|
||||||
# the JDKs support it. See the ESAPI 2.0 Symmetric Encryption User Guide
|
|
||||||
# further details.
|
|
||||||
Encryptor.KDF.PRF=HmacSHA256
|
|
||||||
#===========================================================================
|
|
||||||
# ESAPI HttpUtilties
|
|
||||||
#
|
|
||||||
# The HttpUtilities provide basic protections to HTTP requests and responses. Primarily these methods
|
|
||||||
# protect against malicious data from attackers, such as unprintable characters, escaped characters,
|
|
||||||
# and other simple attacks. The HttpUtilities also provides utility methods for dealing with cookies,
|
|
||||||
# headers, and CSRF tokens.
|
|
||||||
#
|
|
||||||
# Default file upload location (remember to escape backslashes with \\)
|
|
||||||
HttpUtilities.UploadDir=C:\\ESAPI\\testUpload
|
|
||||||
HttpUtilities.UploadTempDir=C:\\temp
|
|
||||||
# Force flags on cookies, if you use HttpUtilities to set cookies
|
|
||||||
HttpUtilities.ForceHttpOnlySession=false
|
|
||||||
HttpUtilities.ForceSecureSession=false
|
|
||||||
HttpUtilities.ForceHttpOnlyCookies=true
|
|
||||||
HttpUtilities.ForceSecureCookies=true
|
|
||||||
# Maximum size of HTTP headers
|
|
||||||
HttpUtilities.MaxHeaderSize=4096
|
|
||||||
# File upload configuration
|
|
||||||
HttpUtilities.ApprovedUploadExtensions=.zip,.pdf,.doc,.docx,.ppt,.pptx,.tar,.gz,.tgz,.rar,.war,.jar,.ear,.xls,.rtf,.properties,.java,.class,.txt,.xml,.jsp,.jsf,.exe,.dll
|
|
||||||
HttpUtilities.MaxUploadFileBytes=500000000
|
|
||||||
# Using UTF-8 throughout your stack is highly recommended. That includes your database driver,
|
|
||||||
# container, and any other technologies you may be using. Failure to do this may expose you
|
|
||||||
# to Unicode transcoding injection attacks. Use of UTF-8 does not hinder internationalization.
|
|
||||||
HttpUtilities.ResponseContentType=text/html; charset=UTF-8
|
|
||||||
# This is the name of the cookie used to represent the HTTP session
|
|
||||||
# Typically this will be the default "JSESSIONID"
|
|
||||||
HttpUtilities.HttpSessionIdName=JSESSIONID
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#===========================================================================
|
|
||||||
# ESAPI Executor
|
|
||||||
# CHECKME - Not sure what this is used for, but surely it should be made OS independent.
|
|
||||||
Executor.WorkingDirectory=C:\\Windows\\Temp
|
|
||||||
Executor.ApprovedExecutables=C:\\Windows\\System32\\cmd.exe,C:\\Windows\\System32\\runas.exe
|
|
||||||
|
|
||||||
|
|
||||||
#===========================================================================
|
|
||||||
# ESAPI Logging
|
|
||||||
# Set the application name if these logs are combined with other applications
|
|
||||||
Logger.ApplicationName=ExampleApplication
|
|
||||||
# If you use an HTML log viewer that does not properly HTML escape log data, you can set LogEncodingRequired to true
|
|
||||||
Logger.LogEncodingRequired=false
|
|
||||||
# Determines whether ESAPI should log the application name. This might be clutter in some single-server/single-app environments.
|
|
||||||
Logger.LogApplicationName=true
|
|
||||||
# Determines whether ESAPI should log the server IP and port. This might be clutter in some single-server environments.
|
|
||||||
Logger.LogServerIP=true
|
|
||||||
# LogFileName, the name of the logging file. Provide a full directory path (e.g., C:\\ESAPI\\ESAPI_logging_file) if you
|
|
||||||
# want to place it in a specific directory.
|
|
||||||
Logger.LogFileName=ESAPI_logging_file
|
|
||||||
# MaxLogFileSize, the max size (in bytes) of a single log file before it cuts over to a new one (default is 10,000,000)
|
|
||||||
Logger.MaxLogFileSize=10000000
|
|
||||||
|
|
||||||
|
|
||||||
#===========================================================================
|
|
||||||
# ESAPI Intrusion Detection
|
|
||||||
#
|
|
||||||
# Each event has a base to which .count, .interval, and .action are added
|
|
||||||
# The IntrusionException will fire if we receive "count" events within "interval" seconds
|
|
||||||
# The IntrusionDetector is configurable to take the following actions: log, logout, and disable
|
|
||||||
# (multiple actions separated by commas are allowed e.g. event.test.actions=log,disable
|
|
||||||
#
|
|
||||||
# Custom Events
|
|
||||||
# Names must start with "event." as the base
|
|
||||||
# Use IntrusionDetector.addEvent( "test" ) in your code to trigger "event.test" here
|
|
||||||
# You can also disable intrusion detection completely by changing
|
|
||||||
# the following parameter to true
|
|
||||||
#
|
|
||||||
IntrusionDetector.Disable=false
|
|
||||||
#
|
|
||||||
IntrusionDetector.event.test.count=2
|
|
||||||
IntrusionDetector.event.test.interval=10
|
|
||||||
IntrusionDetector.event.test.actions=disable,log
|
|
||||||
|
|
||||||
# Exception Events
|
|
||||||
# All EnterpriseSecurityExceptions are registered automatically
|
|
||||||
# Call IntrusionDetector.getInstance().addException(e) for Exceptions that do not extend EnterpriseSecurityException
|
|
||||||
# Use the fully qualified classname of the exception as the base
|
|
||||||
|
|
||||||
# any intrusion is an attack
|
|
||||||
IntrusionDetector.org.owasp.esapi.errors.IntrusionException.count=1
|
|
||||||
IntrusionDetector.org.owasp.esapi.errors.IntrusionException.interval=1
|
|
||||||
IntrusionDetector.org.owasp.esapi.errors.IntrusionException.actions=log,disable,logout
|
|
||||||
|
|
||||||
# for test purposes
|
|
||||||
# CHECKME: Shouldn't there be something in the property name itself that designates
|
|
||||||
# that these are for testing???
|
|
||||||
IntrusionDetector.org.owasp.esapi.errors.IntegrityException.count=10
|
|
||||||
IntrusionDetector.org.owasp.esapi.errors.IntegrityException.interval=5
|
|
||||||
IntrusionDetector.org.owasp.esapi.errors.IntegrityException.actions=log,disable,logout
|
|
||||||
|
|
||||||
# rapid validation errors indicate scans or attacks in progress
|
|
||||||
# org.owasp.esapi.errors.ValidationException.count=10
|
|
||||||
# org.owasp.esapi.errors.ValidationException.interval=10
|
|
||||||
# org.owasp.esapi.errors.ValidationException.actions=log,logout
|
|
||||||
|
|
||||||
# sessions jumping between hosts indicates session hijacking
|
|
||||||
IntrusionDetector.org.owasp.esapi.errors.AuthenticationHostException.count=2
|
|
||||||
IntrusionDetector.org.owasp.esapi.errors.AuthenticationHostException.interval=10
|
|
||||||
IntrusionDetector.org.owasp.esapi.errors.AuthenticationHostException.actions=log,logout
|
|
||||||
|
|
||||||
|
|
||||||
#===========================================================================
|
|
||||||
# ESAPI Validation
|
|
||||||
#
|
|
||||||
# The ESAPI Validator works on regular expressions with defined names. You can define names
|
|
||||||
# either here, or you may define application specific patterns in a separate file defined below.
|
|
||||||
# This allows enterprises to specify both organizational standards as well as application specific
|
|
||||||
# validation rules.
|
|
||||||
#
|
|
||||||
Validator.ConfigurationFile=validation.properties
|
|
||||||
|
|
||||||
# Validators used by ESAPI
|
|
||||||
Validator.AccountName=^[a-zA-Z0-9]{3,20}$
|
|
||||||
Validator.SystemCommand=^[a-zA-Z\\-\\/]{1,64}$
|
|
||||||
Validator.RoleName=^[a-z]{1,20}$
|
|
||||||
|
|
||||||
#the word TEST below should be changed to your application
|
|
||||||
#name - only relative URL's are supported
|
|
||||||
Validator.Redirect=^\\/test.*$
|
|
||||||
|
|
||||||
# Global HTTP Validation Rules
|
|
||||||
# Values with Base64 encoded data (e.g. encrypted state) will need at least [a-zA-Z0-9\/+=]
|
|
||||||
Validator.HTTPScheme=^(http|https)$
|
|
||||||
Validator.HTTPServerName=^[a-zA-Z0-9_.\\-]*$
|
|
||||||
Validator.HTTPParameterName=^[a-zA-Z0-9_]{1,32}$
|
|
||||||
Validator.HTTPParameterValue=^[a-zA-Z0-9.\\-\\/+=@_ ]*$
|
|
||||||
Validator.HTTPCookieName=^[a-zA-Z0-9\\-_]{1,32}$
|
|
||||||
Validator.HTTPCookieValue=^[a-zA-Z0-9\\-\\/+=_ ]*$
|
|
||||||
Validator.HTTPHeaderName=^[a-zA-Z0-9\\-_]{1,32}$
|
|
||||||
Validator.HTTPHeaderValue=^[a-zA-Z0-9()\\-=\\*\\.\\?;,+\\/:&_ ]*$
|
|
||||||
Validator.HTTPContextPath=^\\/?[a-zA-Z0-9.\\-\\/_]*$
|
|
||||||
Validator.HTTPServletPath=^[a-zA-Z0-9.\\-\\/_]*$
|
|
||||||
Validator.HTTPPath=^[a-zA-Z0-9.\\-_]*$
|
|
||||||
Validator.HTTPQueryString=^[a-zA-Z0-9()\\-=\\*\\.\\?;,+\\/:&_ %]*$
|
|
||||||
Validator.HTTPURI=^[a-zA-Z0-9()\\-=\\*\\.\\?;,+\\/:&_ ]*$
|
|
||||||
Validator.HTTPURL=^.*$
|
|
||||||
Validator.HTTPJSESSIONID=^[A-Z0-9]{10,30}$
|
|
||||||
|
|
||||||
# Validation of file related input
|
|
||||||
Validator.FileName=^[a-zA-Z0-9!@#$%^&{}\\[\\]()_+\\-=,.~'` ]{1,255}$
|
|
||||||
Validator.DirectoryName=^[a-zA-Z0-9:/\\\\!@#$%^&{}\\[\\]()_+\\-=,.~'` ]{1,255}$
|
|
||||||
|
|
||||||
# Validation of dates. Controls whether or not 'lenient' dates are accepted.
|
|
||||||
# See DataFormat.setLenient(boolean flag) for further details.
|
|
||||||
Validator.AcceptLenientDates=false
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
|
|
||||||
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd" version="2.1">
|
|
||||||
|
|
||||||
<!-- JDO tutorial "unit" -->
|
|
||||||
<persistence-unit name="Tutorial">
|
|
||||||
<exclude-unlisted-classes/>
|
|
||||||
<properties>
|
|
||||||
<property name="javax.jdo.PersistenceManagerFactoryClass" value="org.datanucleus.api.jdo.JDOPersistenceManagerFactory"/>
|
|
||||||
<property name="javax.jdo.option.ConnectionURL" value="jdbc:h2:mem:mypersistence"/>
|
|
||||||
<property name="javax.jdo.option.ConnectionDriverName" value="org.h2.Driver"/>
|
|
||||||
<property name="javax.jdo.option.ConnectionUserName" value="sa"/>
|
|
||||||
<property name="javax.jdo.option.ConnectionPassword" value=""/>
|
|
||||||
<property name="datanucleus.schema.autoCreateAll" value="true"/>
|
|
||||||
</properties>
|
|
||||||
</persistence-unit>
|
|
||||||
</persistence>
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
com.ossez.javac.SampleJavacPlugin
|
|
|
@ -1,3 +0,0 @@
|
||||||
UK
|
|
||||||
US
|
|
||||||
Germany
|
|
|
@ -1,3 +0,0 @@
|
||||||
1|IND|India
|
|
||||||
2|MY|Malaysia
|
|
||||||
3|AU|Australia
|
|
|
|
@ -1,6 +0,0 @@
|
||||||
dataSourceClassName=//TBD
|
|
||||||
dataSource.user=//TBD
|
|
||||||
dataSource.password=//TBD
|
|
||||||
dataSource.databaseName=//TBD
|
|
||||||
dataSource.portNumber=//TBD
|
|
||||||
dataSource.serverName=//TBD
|
|
|
@ -1,15 +0,0 @@
|
||||||
var first = {
|
|
||||||
name: "Whiskey",
|
|
||||||
age: 5
|
|
||||||
};
|
|
||||||
|
|
||||||
var second = {
|
|
||||||
volume: 100
|
|
||||||
};
|
|
||||||
|
|
||||||
Object.bindProperties(first, second);
|
|
||||||
|
|
||||||
print(first.volume);
|
|
||||||
|
|
||||||
second.volume = 1000;
|
|
||||||
print(first.volume);
|
|
|
@ -1 +0,0 @@
|
||||||
print(__FILE__, __LINE__, __DIR__);
|
|
|
@ -1,19 +0,0 @@
|
||||||
var math = {
|
|
||||||
increment: function (num) {
|
|
||||||
return ++num;
|
|
||||||
},
|
|
||||||
|
|
||||||
failFunc: function () {
|
|
||||||
try {
|
|
||||||
throw "BOOM";
|
|
||||||
} catch (e if typeof e === 'string') {
|
|
||||||
print("String thrown: " + e);
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
print("this shouldn't happen!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
math;
|
|
|
@ -1,11 +0,0 @@
|
||||||
var demo = {
|
|
||||||
__noSuchProperty__: function (propName) {
|
|
||||||
print("Accessed non-existing property: " + propName);
|
|
||||||
},
|
|
||||||
|
|
||||||
__noSuchMethod__: function (methodName) {
|
|
||||||
print("Invoked non-existing method: " + methodName);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
demo;
|
|
|
@ -1 +0,0 @@
|
||||||
function increment(num) ++num;
|
|
|
@ -1,2 +0,0 @@
|
||||||
print(" hello world".trimLeft());
|
|
||||||
print("hello world ".trimRight());
|
|
|
@ -1,9 +0,0 @@
|
||||||
function arrays(arr) {
|
|
||||||
|
|
||||||
var javaIntArray = Java.to(arr, "int[]");
|
|
||||||
print(javaIntArray[0]);
|
|
||||||
print(javaIntArray[1]);
|
|
||||||
print(javaIntArray[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
arrays([100, "1654", true]);
|
|
|
@ -1,6 +0,0 @@
|
||||||
log4j.rootLogger=DEBUG, A1
|
|
||||||
|
|
||||||
log4j.appender.A1=org.apache.log4j.ConsoleAppender
|
|
||||||
|
|
||||||
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
|
|
|
@ -1,9 +0,0 @@
|
||||||
|
|
||||||
# Root logger
|
|
||||||
log4j.rootLogger=INFO, file, stdout
|
|
||||||
|
|
||||||
# Write to console
|
|
||||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
|
||||||
log4j.appender.stdout.Target=System.out
|
|
||||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
|
|
|
@ -7,11 +7,7 @@
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<logger name="org.springframework" level="WARN" />
|
<logger name="net.sf.jmimemagic" level="WARN" />
|
||||||
<logger name="org.springframework.transaction" level="WARN" />
|
|
||||||
|
|
||||||
<!-- in order to debug some marshalling issues, this needs to be TRACE -->
|
|
||||||
<logger name="org.springframework.web.servlet.mvc" level="WARN" />
|
|
||||||
|
|
||||||
<root level="INFO">
|
<root level="INFO">
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Test3.txt
|
|
@ -1,172 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
##
|
|
||||||
## Gradle start up script for UN*X
|
|
||||||
##
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
|
||||||
# Resolve links: $0 may be a link
|
|
||||||
PRG="$0"
|
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=`basename "$0"`
|
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
DEFAULT_JVM_OPTS=""
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
||||||
MAX_FD="maximum"
|
|
||||||
|
|
||||||
warn () {
|
|
||||||
echo "$*"
|
|
||||||
}
|
|
||||||
|
|
||||||
die () {
|
|
||||||
echo
|
|
||||||
echo "$*"
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
|
||||||
cygwin=false
|
|
||||||
msys=false
|
|
||||||
darwin=false
|
|
||||||
nonstop=false
|
|
||||||
case "`uname`" in
|
|
||||||
CYGWIN* )
|
|
||||||
cygwin=true
|
|
||||||
;;
|
|
||||||
Darwin* )
|
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
||||||
else
|
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
|
||||||
fi
|
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
JAVACMD="java"
|
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
|
||||||
if [ $? -eq 0 ] ; then
|
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
|
||||||
fi
|
|
||||||
ulimit -n $MAX_FD
|
|
||||||
if [ $? -ne 0 ] ; then
|
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
|
||||||
if $cygwin ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=$((i+1))
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
(0) set -- ;;
|
|
||||||
(1) set -- "$args0" ;;
|
|
||||||
(2) set -- "$args0" "$args1" ;;
|
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Escape application args
|
|
||||||
save () {
|
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
|
||||||
echo " "
|
|
||||||
}
|
|
||||||
APP_ARGS=$(save "$@")
|
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
|
|
@ -1,84 +0,0 @@
|
||||||
@if "%DEBUG%" == "" @echo off
|
|
||||||
@rem ##########################################################################
|
|
||||||
@rem
|
|
||||||
@rem Gradle startup script for Windows
|
|
||||||
@rem
|
|
||||||
@rem ##########################################################################
|
|
||||||
|
|
||||||
@rem Set local scope for the variables with windows NT shell
|
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
|
||||||
set APP_BASE_NAME=%~n0
|
|
||||||
set APP_HOME=%DIRNAME%
|
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
set DEFAULT_JVM_OPTS=
|
|
||||||
|
|
||||||
@rem Find java.exe
|
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
echo location of your Java installation.
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:findJavaFromJavaHome
|
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
echo location of your Java installation.
|
|
||||||
|
|
||||||
goto fail
|
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
|
||||||
@rem Setup the command line
|
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
|
||||||
|
|
||||||
:end
|
|
||||||
@rem End local scope for the variables with windows NT shell
|
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
|
||||||
|
|
||||||
:fail
|
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
||||||
rem the _cmd.exe /c_ return code!
|
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
|
||||||
exit /b 1
|
|
||||||
|
|
||||||
:mainEnd
|
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
|
||||||
|
|
||||||
:omega
|
|
|
@ -1,233 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
# or more contributor license agreements. See the NOTICE file
|
|
||||||
# distributed with this work for additional information
|
|
||||||
# regarding copyright ownership. The ASF licenses this file
|
|
||||||
# to you under the Apache License, Version 2.0 (the
|
|
||||||
# "License"); you may not use this file except in compliance
|
|
||||||
# with the License. You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing,
|
|
||||||
# software distributed under the License is distributed on an
|
|
||||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
# KIND, either express or implied. See the License for the
|
|
||||||
# specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Maven2 Start Up Batch script
|
|
||||||
#
|
|
||||||
# Required ENV vars:
|
|
||||||
# ------------------
|
|
||||||
# JAVA_HOME - location of a JDK home dir
|
|
||||||
#
|
|
||||||
# Optional ENV vars
|
|
||||||
# -----------------
|
|
||||||
# M2_HOME - location of maven2's installed home dir
|
|
||||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
|
||||||
# e.g. to debug Maven itself, use
|
|
||||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
|
||||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
|
||||||
|
|
||||||
if [ -f /etc/mavenrc ] ; then
|
|
||||||
. /etc/mavenrc
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$HOME/.mavenrc" ] ; then
|
|
||||||
. "$HOME/.mavenrc"
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# OS specific support. $var _must_ be set to either true or false.
|
|
||||||
cygwin=false;
|
|
||||||
darwin=false;
|
|
||||||
mingw=false
|
|
||||||
case "`uname`" in
|
|
||||||
CYGWIN*) cygwin=true ;;
|
|
||||||
MINGW*) mingw=true;;
|
|
||||||
Darwin*) darwin=true
|
|
||||||
#
|
|
||||||
# Look for the Apple JDKs first to preserve the existing behaviour, and then look
|
|
||||||
# for the new JDKs provided by Oracle.
|
|
||||||
#
|
|
||||||
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
|
|
||||||
#
|
|
||||||
# Apple JDKs
|
|
||||||
#
|
|
||||||
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
|
|
||||||
#
|
|
||||||
# Apple JDKs
|
|
||||||
#
|
|
||||||
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
|
|
||||||
#
|
|
||||||
# Oracle JDKs
|
|
||||||
#
|
|
||||||
export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
|
|
||||||
#
|
|
||||||
# Apple JDKs
|
|
||||||
#
|
|
||||||
export JAVA_HOME=`/usr/libexec/java_home`
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ] ; then
|
|
||||||
if [ -r /etc/gentoo-release ] ; then
|
|
||||||
JAVA_HOME=`java-config --jre-home`
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$M2_HOME" ] ; then
|
|
||||||
## resolve links - $0 may be a link to maven's home
|
|
||||||
PRG="$0"
|
|
||||||
|
|
||||||
# need this for relative symlinks
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG="`dirname "$PRG"`/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
saveddir=`pwd`
|
|
||||||
|
|
||||||
M2_HOME=`dirname "$PRG"`/..
|
|
||||||
|
|
||||||
# make it fully qualified
|
|
||||||
M2_HOME=`cd "$M2_HOME" && pwd`
|
|
||||||
|
|
||||||
cd "$saveddir"
|
|
||||||
# echo Using m2 at $M2_HOME
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
|
||||||
if $cygwin ; then
|
|
||||||
[ -n "$M2_HOME" ] &&
|
|
||||||
M2_HOME=`cygpath --unix "$M2_HOME"`
|
|
||||||
[ -n "$JAVA_HOME" ] &&
|
|
||||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
|
||||||
[ -n "$CLASSPATH" ] &&
|
|
||||||
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Migwn, ensure paths are in UNIX format before anything is touched
|
|
||||||
if $mingw ; then
|
|
||||||
[ -n "$M2_HOME" ] &&
|
|
||||||
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
|
||||||
[ -n "$JAVA_HOME" ] &&
|
|
||||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
|
||||||
# TODO classpath?
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ]; then
|
|
||||||
javaExecutable="`which javac`"
|
|
||||||
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
|
||||||
# readlink(1) is not available as standard on Solaris 10.
|
|
||||||
readLink=`which readlink`
|
|
||||||
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
|
||||||
if $darwin ; then
|
|
||||||
javaHome="`dirname \"$javaExecutable\"`"
|
|
||||||
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
|
||||||
else
|
|
||||||
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
|
||||||
fi
|
|
||||||
javaHome="`dirname \"$javaExecutable\"`"
|
|
||||||
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
|
||||||
JAVA_HOME="$javaHome"
|
|
||||||
export JAVA_HOME
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVACMD" ] ; then
|
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
||||||
else
|
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
JAVACMD="`which java`"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
|
||||||
echo "Error: JAVA_HOME is not defined correctly." >&2
|
|
||||||
echo " We cannot execute $JAVACMD" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ] ; then
|
|
||||||
echo "Warning: JAVA_HOME environment variable is not set."
|
|
||||||
fi
|
|
||||||
|
|
||||||
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
|
||||||
if $cygwin; then
|
|
||||||
[ -n "$M2_HOME" ] &&
|
|
||||||
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
|
||||||
[ -n "$JAVA_HOME" ] &&
|
|
||||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
|
||||||
[ -n "$CLASSPATH" ] &&
|
|
||||||
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# traverses directory structure from process work directory to filesystem root
|
|
||||||
# first directory with .mvn subdirectory is considered project base directory
|
|
||||||
find_maven_basedir() {
|
|
||||||
local basedir=$(pwd)
|
|
||||||
local wdir=$(pwd)
|
|
||||||
while [ "$wdir" != '/' ] ; do
|
|
||||||
if [ -d "$wdir"/.mvn ] ; then
|
|
||||||
basedir=$wdir
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
wdir=$(cd "$wdir/.."; pwd)
|
|
||||||
done
|
|
||||||
echo "${basedir}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# concatenates all lines of a file
|
|
||||||
concat_lines() {
|
|
||||||
if [ -f "$1" ]; then
|
|
||||||
echo "$(tr -s '\n' ' ' < "$1")"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
|
|
||||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
|
||||||
|
|
||||||
# Provide a "standardized" way to retrieve the CLI args that will
|
|
||||||
# work with both Windows and non-Windows executions.
|
|
||||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
|
||||||
export MAVEN_CMD_LINE_ARGS
|
|
||||||
|
|
||||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
|
||||||
|
|
||||||
exec "$JAVACMD" \
|
|
||||||
$MAVEN_OPTS \
|
|
||||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
|
||||||
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
|
||||||
${WRAPPER_LAUNCHER} "$@"
|
|
|
@ -1,145 +0,0 @@
|
||||||
@REM ----------------------------------------------------------------------------
|
|
||||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
@REM or more contributor license agreements. See the NOTICE file
|
|
||||||
@REM distributed with this work for additional information
|
|
||||||
@REM regarding copyright ownership. The ASF licenses this file
|
|
||||||
@REM to you under the Apache License, Version 2.0 (the
|
|
||||||
@REM "License"); you may not use this file except in compliance
|
|
||||||
@REM with the License. You may obtain a copy of the License at
|
|
||||||
@REM
|
|
||||||
@REM https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
@REM
|
|
||||||
@REM Unless required by applicable law or agreed to in writing,
|
|
||||||
@REM software distributed under the License is distributed on an
|
|
||||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
@REM KIND, either express or implied. See the License for the
|
|
||||||
@REM specific language governing permissions and limitations
|
|
||||||
@REM under the License.
|
|
||||||
@REM ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
@REM ----------------------------------------------------------------------------
|
|
||||||
@REM Maven2 Start Up Batch script
|
|
||||||
@REM
|
|
||||||
@REM Required ENV vars:
|
|
||||||
@REM JAVA_HOME - location of a JDK home dir
|
|
||||||
@REM
|
|
||||||
@REM Optional ENV vars
|
|
||||||
@REM M2_HOME - location of maven2's installed home dir
|
|
||||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
|
||||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
|
|
||||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
|
||||||
@REM e.g. to debug Maven itself, use
|
|
||||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
|
||||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
|
||||||
@REM ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
|
||||||
@echo off
|
|
||||||
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
|
|
||||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
|
||||||
|
|
||||||
@REM set %HOME% to equivalent of $HOME
|
|
||||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
|
||||||
|
|
||||||
@REM Execute a user defined script before this one
|
|
||||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
|
||||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
|
||||||
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
|
|
||||||
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
|
|
||||||
:skipRcPre
|
|
||||||
|
|
||||||
@setlocal
|
|
||||||
|
|
||||||
set ERROR_CODE=0
|
|
||||||
|
|
||||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
|
||||||
@setlocal
|
|
||||||
|
|
||||||
@REM ==== START VALIDATION ====
|
|
||||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo Error: JAVA_HOME not found in your environment. >&2
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
|
||||||
echo location of your Java installation. >&2
|
|
||||||
echo.
|
|
||||||
goto error
|
|
||||||
|
|
||||||
:OkJHome
|
|
||||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
|
||||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
|
||||||
echo location of your Java installation. >&2
|
|
||||||
echo.
|
|
||||||
goto error
|
|
||||||
|
|
||||||
@REM ==== END VALIDATION ====
|
|
||||||
|
|
||||||
:init
|
|
||||||
|
|
||||||
set MAVEN_CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
|
||||||
@REM Fallback to current working directory if not found.
|
|
||||||
|
|
||||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
|
||||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
|
||||||
|
|
||||||
set EXEC_DIR=%CD%
|
|
||||||
set WDIR=%EXEC_DIR%
|
|
||||||
:findBaseDir
|
|
||||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
|
||||||
cd ..
|
|
||||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
|
||||||
set WDIR=%CD%
|
|
||||||
goto findBaseDir
|
|
||||||
|
|
||||||
:baseDirFound
|
|
||||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
|
||||||
cd "%EXEC_DIR%"
|
|
||||||
goto endDetectBaseDir
|
|
||||||
|
|
||||||
:baseDirNotFound
|
|
||||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
|
||||||
cd "%EXEC_DIR%"
|
|
||||||
|
|
||||||
:endDetectBaseDir
|
|
||||||
|
|
||||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
|
||||||
|
|
||||||
@setlocal EnableExtensions EnableDelayedExpansion
|
|
||||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
|
||||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
|
||||||
|
|
||||||
:endReadAdditionalConfig
|
|
||||||
|
|
||||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
|
||||||
|
|
||||||
set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar""
|
|
||||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
|
||||||
|
|
||||||
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
|
|
||||||
if ERRORLEVEL 1 goto error
|
|
||||||
goto end
|
|
||||||
|
|
||||||
:error
|
|
||||||
set ERROR_CODE=1
|
|
||||||
|
|
||||||
:end
|
|
||||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
|
||||||
|
|
||||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
|
|
||||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
|
||||||
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
|
|
||||||
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
|
|
||||||
:skipRcPost
|
|
||||||
|
|
||||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
|
||||||
if "%MAVEN_BATCH_PAUSE%" == "on" pause
|
|
||||||
|
|
||||||
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
|
|
||||||
|
|
||||||
exit /B %ERROR_CODE%
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
## Parent Boot 3
|
||||||
|
|
||||||
|
This is a parent module for all projects using Spring Boot 3.
|
|
@ -0,0 +1,253 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>parent-boot-3</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>parent-boot-3</name>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<description>Parent for all Spring Boot 3 modules</description>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ossez</groupId>
|
||||||
|
<artifactId>parent-modules</artifactId>
|
||||||
|
<version>0.0.2-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit</groupId>
|
||||||
|
<artifactId>junit-bom</artifactId>
|
||||||
|
<version>${junit-jupiter.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>${logback.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-core</artifactId>
|
||||||
|
<version>${logback.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<version>${slf4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>jcl-over-slf4j</artifactId>
|
||||||
|
<version>${slf4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>${lombok.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
|
<version>${maven-clean-plugin.version}</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>${maven-compiler-plugin.version}</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>${maven-jar-plugin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<mainClass>${start-class}</mainClass>
|
||||||
|
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||||
|
</manifest>
|
||||||
|
</archive>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>${maven-surefire-plugin.version}</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<version>${maven-resources-plugin.version}</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.graalvm.buildtools</groupId>
|
||||||
|
<artifactId>native-maven-plugin</artifactId>
|
||||||
|
<version>${native-build-tools-plugin.version}</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>${start-class}</mainClass>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>repackage</id>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>native</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<image>
|
||||||
|
<builder>paketobuildpacks/builder:tiny</builder>
|
||||||
|
<env>
|
||||||
|
<BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
|
||||||
|
</env>
|
||||||
|
</image>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>process-aot</id>
|
||||||
|
<goals>
|
||||||
|
<goal>process-aot</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.graalvm.buildtools</groupId>
|
||||||
|
<artifactId>native-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
|
||||||
|
<metadataRepository>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</metadataRepository>
|
||||||
|
<requiredVersion>22.3</requiredVersion>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>add-reachability-metadata</id>
|
||||||
|
<goals>
|
||||||
|
<goal>add-reachability-metadata</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>nativeTest</id>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.platform</groupId>
|
||||||
|
<artifactId>junit-platform-launcher</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>process-test-aot</id>
|
||||||
|
<goals>
|
||||||
|
<goal>process-test-aot</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.graalvm.buildtools</groupId>
|
||||||
|
<artifactId>native-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
|
||||||
|
<metadataRepository>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</metadataRepository>
|
||||||
|
<requiredVersion>22.3</requiredVersion>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>native-test</id>
|
||||||
|
<goals>
|
||||||
|
<goal>test</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven-clean-plugin.version>3.2.0</maven-clean-plugin.version>
|
||||||
|
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
|
||||||
|
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
|
||||||
|
<maven-resources-plugin.version>3.3.0</maven-resources-plugin.version>
|
||||||
|
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
|
||||||
|
|
||||||
|
<spring-boot.version>3.1.3</spring-boot.version>
|
||||||
|
<junit-jupiter.version>5.8.2</junit-jupiter.version>
|
||||||
|
<native-build-tools-plugin.version>0.9.17</native-build-tools-plugin.version>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
|
<logback.version>1.4.4</logback.version>
|
||||||
|
<slf4j.version>2.0.3</slf4j.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
1
pom.xml
1
pom.xml
|
@ -44,6 +44,7 @@
|
||||||
<!-- <module>jackson-modules</module>-->
|
<!-- <module>jackson-modules</module>-->
|
||||||
<!-- <module>jackson-simple</module>-->
|
<!-- <module>jackson-simple</module>-->
|
||||||
<!-- <module>parent-java</module>-->
|
<!-- <module>parent-java</module>-->
|
||||||
|
<module>parent-boot-2</module>
|
||||||
<module>persistence-modules</module>
|
<module>persistence-modules</module>
|
||||||
<module>testing-modules</module>
|
<module>testing-modules</module>
|
||||||
<module>toolkits</module>
|
<module>toolkits</module>
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
pluginManagement {
|
|
||||||
repositories {
|
|
||||||
gradlePluginPortal()
|
|
||||||
maven { url 'https://maven.ossez.com/repository/internal' }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
buildCache {
|
|
||||||
local {
|
|
||||||
enabled = true
|
|
||||||
}
|
|
||||||
remote(HttpBuildCache) {
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
include "spring-batch"
|
|
||||||
|
|
||||||
rootProject.name = "cwiki-us-demo-tutorials"
|
|
||||||
|
|
||||||
rootProject.children.each { project ->
|
|
||||||
project.buildFileName = "${project.name}.gradle"
|
|
||||||
assert project.projectDir.isDirectory()
|
|
||||||
// assert project.buildFile.exists()
|
|
||||||
// assert project.buildFile.isFile()
|
|
||||||
}
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
## Spring Remoting
|
||||||
|
|
||||||
|
This module contains articles about Spring Remoting
|
||||||
|
|
||||||
|
|
||||||
|
### Overview
|
||||||
|
This Maven project contains the Java source code for various modules used in the Spring Remoting series of articles.
|
||||||
|
|
||||||
|
### Building the Project
|
||||||
|
You can build the project using Maven inside your IDE or from the command line:
|
||||||
|
```
|
||||||
|
mvn clean install
|
||||||
|
```
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>spring-remoting-modules-3</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<name>spring-remoting-modules-3</name>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<description>Parent for all projects related to Spring Remoting, except remoting-hessian-burlap</description>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ossez</groupId>
|
||||||
|
<artifactId>parent-boot-3</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<relativePath>parent-boot-3</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>remoting-jms-artemis</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<!-- companion modules -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>${maven-compiler-plugin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${maven.compiler.source}</source>
|
||||||
|
<target>${maven.compiler.target}</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,10 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Zeppelin ignored files
|
||||||
|
/ZeppelinRemoteNotebooks/
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CheckStyle-IDEA" serialisationVersion="2">
|
||||||
|
<checkstyleVersion>10.12.2</checkstyleVersion>
|
||||||
|
<scanScope>JavaOnly</scanScope>
|
||||||
|
<copyLibs>true</copyLibs>
|
||||||
|
<option name="thirdPartyClasspath" />
|
||||||
|
<option name="activeLocationIds" />
|
||||||
|
<option name="locations">
|
||||||
|
<list>
|
||||||
|
<ConfigurationLocation id="bundled-sun-checks" type="BUNDLED" scope="All" description="Sun Checks">(bundled)</ConfigurationLocation>
|
||||||
|
<ConfigurationLocation id="bundled-google-checks" type="BUNDLED" scope="All" description="Google Checks">(bundled)</ConfigurationLocation>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile default="true" name="Default" enabled="true" />
|
||||||
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<module name="remoting-jms-artemis-client" />
|
||||||
|
<module name="remoting-jms-artemis-server" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-jms-artemis-client/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-jms-artemis-client/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-jms-artemis-server/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-jms-artemis-server/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="ossez-repo-snapshots" />
|
||||||
|
<option name="name" value="OSSEZ Private Snapshots" />
|
||||||
|
<option name="url" value="https://repo.ossez.com/repository/maven-snapshots/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="ossez-repo-releases" />
|
||||||
|
<option name="name" value="OSSEZ Private Releases" />
|
||||||
|
<option name="url" value="https://repo.ossez.com/repository/maven-releases/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="https://repo.ossez.com/repository/maven-public/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Maven Central repository" />
|
||||||
|
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jboss.community" />
|
||||||
|
<option name="name" value="JBoss Community repository" />
|
||||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JpaBuddyIdeaProjectConfig">
|
||||||
|
<option name="defaultUnitInitialized" value="true" />
|
||||||
|
<option name="renamerInitialized" value="true" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="temurin-17" project-jdk-type="JavaSDK" />
|
||||||
|
<component name="ProjectType">
|
||||||
|
<option name="id" value="jpab" />
|
||||||
|
</component>
|
||||||
|
<component name="ThriftCompiler">
|
||||||
|
<compilers />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,8 @@
|
||||||
|
## Remoting JMS Artemis
|
||||||
|
|
||||||
|
This module contains articles about Spring Remoting with Java Message Service (JMS)
|
||||||
|
|
||||||
|
### Relevant Articles:
|
||||||
|
|
||||||
|
- [Spring Remoting with JMS and ActiveMQ](https://www.baeldung.com/spring-remoting-jms)
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>remoting-jms-artemis</artifactId>
|
||||||
|
<name>remoting-jms-artemis</name>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ossez</groupId>
|
||||||
|
<artifactId>spring-remoting-modules-3</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>remoting-jms-artemis-client</module>
|
||||||
|
<module>remoting-jms-artemis-server</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>remoting-jms-artemis-client</artifactId>
|
||||||
|
<name>remoting-jms-client</name>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ossez</groupId>
|
||||||
|
<artifactId>remoting-jms-artemis</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-artemis</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.ossez.artemis.client;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class JmsArtemisClientApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
JmsProducer jmsProducer = SpringApplication.run(JmsArtemisClientApplication.class, args).getBean(JmsProducer.class);
|
||||||
|
jmsProducer.send("xxxddx");;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.ossez.artemis.client;
|
||||||
|
|
||||||
|
import org.springframework.jms.core.JmsTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JmsProducer
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class JmsProducer {
|
||||||
|
|
||||||
|
private final JmsTemplate jmsTemplate;
|
||||||
|
|
||||||
|
public JmsProducer(JmsTemplate jmsTemplate) {
|
||||||
|
this.jmsTemplate = jmsTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void send(String message) {
|
||||||
|
jmsTemplate.convertAndSend("remotingQueue", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.ossez.artemis.client.controller;
|
||||||
|
|
||||||
|
import com.ossez.artemis.client.JmsProducer;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 承包商相关 API
|
||||||
|
*
|
||||||
|
* @author ForteScarlet
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping(MQController.BASE_URL)
|
||||||
|
public class MQController {
|
||||||
|
|
||||||
|
protected static final String BASE_URL = "/mq";
|
||||||
|
|
||||||
|
private final JmsProducer jmsProducer;
|
||||||
|
|
||||||
|
@PostMapping("/send")
|
||||||
|
public String addContractorInfo(@RequestBody String request) {
|
||||||
|
jmsProducer.send(request);
|
||||||
|
|
||||||
|
return "Send";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
spring.artemis.mode=native
|
||||||
|
spring.artemis.broker-url=tcp://nas1120:61616
|
||||||
|
#spring.artemis.host=nas1120
|
||||||
|
#spring.artemis.port=61616
|
||||||
|
spring.artemis.user=artemis
|
||||||
|
spring.artemis.password=artemis
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<timestamp key="bySecond" datePattern="yyyyMMdd'T'HHmmss"/>
|
||||||
|
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
<layout class="ch.qos.logback.classic.PatternLayout">
|
||||||
|
<Pattern>
|
||||||
|
%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n
|
||||||
|
</Pattern>
|
||||||
|
</layout>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- LOGGER -->
|
||||||
|
<logger name="com.ossez" level="DEBUG"/>
|
||||||
|
|
||||||
|
<!-- APPENDER -->
|
||||||
|
<root level="DEBUG">
|
||||||
|
<appender-ref ref="STDOUT"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.ossez.artemis;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import com.ossez.artemis.client.JmsArtemisClientApplication;
|
||||||
|
|
||||||
|
@SpringBootTest(classes = JmsArtemisClientApplication.class)
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
public class SpringContextTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>remoting-jms-artemis-server</artifactId>
|
||||||
|
<name>remoting-jms-server</name>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ossez</groupId>
|
||||||
|
<artifactId>remoting-jms-artemis</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-artemis</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.ossez.artemis.server;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.jms.annotation.JmsListener;
|
||||||
|
//import org.springframework.jmsremoting.JmsInvokerServiceExporter;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class JmsServer {
|
||||||
|
|
||||||
|
/*
|
||||||
|
This server needs to be connected to an ActiveMQ server.
|
||||||
|
To quickly spin up an ActiveMQ server, you can use Docker.
|
||||||
|
|
||||||
|
docker run -p 61616:61616 -p 8161:8161 rmohr/activemq:5.14.3
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@JmsListener(destination = "remotingQueue")
|
||||||
|
public void receive(String message) {
|
||||||
|
System.out.println("Received message: " + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(JmsServer.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
spring.artemis.mode=native
|
||||||
|
spring.artemis.broker-url=tcp://nas1120:61616
|
||||||
|
spring.artemis.user=artemis
|
||||||
|
spring.artemis.password=artemis
|
||||||
|
#spring.activemq.packages.trusted=org.springframework.remoting.support,java.lang,com.baeldung.api
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
logging.pattern.console=%d{mm:ss.SSS} %-5p [%-31t] [%-54logger{0}] %marker%m%ex{full} - %logger - %F:%L%n
|
||||||
|
logging.level.root=WARN
|
||||||
|
logging.level.org.apache.activemq=DEBUG
|
||||||
|
logging.level.org.springframework.jms=DEBUG
|
||||||
|
logging.level.org.springframework=WARN
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||||
|
</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.ossez.artemis;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import com.ossez.artemis.server.JmsServer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This Live Test requires:
|
||||||
|
* * the `com.baeldung:remoting-http-api:jar:1.0-SNAPSHOT` artifact accessible. For that we can run `mvn clean install` in the 'spring-remoting/remoting-http/remoting-http-api' module.
|
||||||
|
* * an ActiveMQ instance running (e.g. `docker run -p 61616:61616 -p 8161:8161 --name bael-activemq rmohr/activemq`)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@SpringBootTest(classes = JmsServer.class)
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
public class SpringContextLiveTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Zeppelin ignored files
|
||||||
|
/ZeppelinRemoteNotebooks/
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CheckStyle-IDEA" serialisationVersion="2">
|
||||||
|
<checkstyleVersion>10.12.2</checkstyleVersion>
|
||||||
|
<scanScope>JavaOnly</scanScope>
|
||||||
|
<copyLibs>true</copyLibs>
|
||||||
|
<option name="thirdPartyClasspath" />
|
||||||
|
<option name="activeLocationIds" />
|
||||||
|
<option name="locations">
|
||||||
|
<list>
|
||||||
|
<ConfigurationLocation id="bundled-sun-checks" type="BUNDLED" scope="All" description="Sun Checks">(bundled)</ConfigurationLocation>
|
||||||
|
<ConfigurationLocation id="bundled-google-checks" type="BUNDLED" scope="All" description="Google Checks">(bundled)</ConfigurationLocation>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<module name="remoting-jms-server" />
|
||||||
|
<module name="remoting-http-server" />
|
||||||
|
<module name="remoting-http-api" />
|
||||||
|
<module name="remoting-http-client" />
|
||||||
|
<module name="remoting-jms-client" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-http/remoting-http-api/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-http/remoting-http-api/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-http/remoting-http-client/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-http/remoting-http-client/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-http/remoting-http-server/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-http/remoting-http-server/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-http/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-http/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-jms/remoting-jms-client/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-jms/remoting-jms-client/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-jms/remoting-jms-server/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-jms/remoting-jms-server/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-jms/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/remoting-jms/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="ossez-repo-snapshots" />
|
||||||
|
<option name="name" value="OSSEZ Private Snapshots" />
|
||||||
|
<option name="url" value="https://repo.ossez.com/repository/maven-snapshots/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="ossez-repo-releases" />
|
||||||
|
<option name="name" value="OSSEZ Private Releases" />
|
||||||
|
<option name="url" value="https://repo.ossez.com/repository/maven-releases/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="https://repo.ossez.com/repository/maven-public/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Maven Central repository" />
|
||||||
|
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jboss.community" />
|
||||||
|
<option name="name" value="JBoss Community repository" />
|
||||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JpaBuddyIdeaProjectConfig">
|
||||||
|
<option name="defaultUnitInitialized" value="true" />
|
||||||
|
<option name="renamerInitialized" value="true" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="temurin-17" project-jdk-type="JavaSDK" />
|
||||||
|
<component name="ProjectType">
|
||||||
|
<option name="id" value="jpab" />
|
||||||
|
</component>
|
||||||
|
<component name="ThriftCompiler">
|
||||||
|
<compilers />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,13 @@
|
||||||
|
## Spring Remoting
|
||||||
|
|
||||||
|
This module contains articles about Spring Remoting
|
||||||
|
|
||||||
|
|
||||||
|
### Overview
|
||||||
|
This Maven project contains the Java source code for various modules used in the Spring Remoting series of articles.
|
||||||
|
|
||||||
|
### Building the Project
|
||||||
|
You can build the project using Maven inside your IDE or from the command line:
|
||||||
|
```
|
||||||
|
mvn clean install
|
||||||
|
```
|
|
@ -0,0 +1,58 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>spring-remoting-modules</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<name>spring-remoting-modules</name>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<description>Parent for all projects related to Spring Remoting, except remoting-hessian-burlap</description>
|
||||||
|
<!-- remoting-hessian-burlap needs to stick to spring-boot-1, -->
|
||||||
|
<!-- some classes were removed in spring 5 -->
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ossez</groupId>
|
||||||
|
<artifactId>parent-boot-2</artifactId>
|
||||||
|
<version>0.0.2-SNAPSHOT</version>
|
||||||
|
<relativePath>parent-boot-2</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<!-- <module>remoting-hessian-burlap</module>-->
|
||||||
|
<module>remoting-http</module>
|
||||||
|
<!-- <module>remoting-amqp</module>-->
|
||||||
|
<module>remoting-jms</module>
|
||||||
|
<!-- <module>remoting-rmi</module>-->
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<!-- companion modules -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>${maven-compiler-plugin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${maven.compiler.source}</source>
|
||||||
|
<target>${maven.compiler.target}</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,3 @@
|
||||||
|
### Relevant Articles
|
||||||
|
|
||||||
|
- [Spring Remoting with AMQP](https://www.baeldung.com/spring-remoting-amqp)
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>remoting-amqp</artifactId>
|
||||||
|
<name>remoting-amqp</name>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>spring-remoting-modules</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>remoting-amqp-server</module>
|
||||||
|
<module>remoting-amqp-client</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>remoting-amqp-client</artifactId>
|
||||||
|
<name>remoting-amqp-client</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>remoting-amqp</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>remoting-http-api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.baeldung.client;
|
||||||
|
|
||||||
|
import com.baeldung.api.BookingException;
|
||||||
|
import com.baeldung.api.CabBookingService;
|
||||||
|
import org.springframework.amqp.core.*;
|
||||||
|
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.amqp.remoting.client.AmqpProxyFactoryBean;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
||||||
|
import static java.lang.System.out;
|
||||||
|
|
||||||
|
@SpringBootApplication public class AmqpClient {
|
||||||
|
|
||||||
|
@Bean Queue queue() {
|
||||||
|
return new Queue("remotingQueue");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean AmqpProxyFactoryBean amqpFactoryBean(AmqpTemplate amqpTemplate) {
|
||||||
|
AmqpProxyFactoryBean factoryBean = new AmqpProxyFactoryBean();
|
||||||
|
factoryBean.setServiceInterface(CabBookingService.class);
|
||||||
|
factoryBean.setAmqpTemplate(amqpTemplate);
|
||||||
|
return factoryBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean Exchange directExchange(Queue someQueue) {
|
||||||
|
DirectExchange exchange = new DirectExchange("remoting.exchange");
|
||||||
|
BindingBuilder.bind(someQueue).to(exchange).with("remoting.binding");
|
||||||
|
return exchange;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean RabbitTemplate amqpTemplate(ConnectionFactory factory) {
|
||||||
|
RabbitTemplate template = new RabbitTemplate(factory);
|
||||||
|
template.setRoutingKey("remoting.binding");
|
||||||
|
template.setExchange("remoting.exchange");
|
||||||
|
return template;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws BookingException {
|
||||||
|
CabBookingService service = SpringApplication.run(AmqpClient.class, args).getBean(CabBookingService.class);
|
||||||
|
out.println(service.bookRide("13 Seagate Blvd, Key Largo, FL 33037"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
# This is true to make SpringBoot to automatically register a bean of type 'org.springframework.amqp.core.AmqpAdmin'.
|
||||||
|
# Check the org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration javadoc for details.
|
||||||
|
spring.rabbitmq.dynamic=true
|
||||||
|
|
||||||
|
# The port to which the client should connect defaults to 5672.
|
||||||
|
spring.rabbitmq.port=32769
|
||||||
|
|
||||||
|
# Username and password
|
||||||
|
spring.rabbitmq.username=guest
|
||||||
|
spring.rabbitmq.password=guest
|
||||||
|
|
||||||
|
# The host, defaults to localhost.
|
||||||
|
spring.rabbitmq.host=192.168.99.100
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
logging.pattern.console=%d{mm:ss.SSS} %-5p [%-31t] [%-54logger{0}] %marker%m%ex{full} - %logger - %F:%L%n
|
||||||
|
logging.level.root=WARN
|
||||||
|
logging.level.org.springframework.amqp=TRACE
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||||
|
</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,17 @@
|
||||||
|
package org.baeldung;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import com.baeldung.client.AmqpClient;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(classes = AmqpClient.class)
|
||||||
|
public class SpringContextTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>remoting-amqp-server</artifactId>
|
||||||
|
<name>remoting-amqp-server</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>remoting-amqp</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>remoting-http-api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>remoting-http-server</artifactId>
|
||||||
|
<version>${remoting-http-server.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<remoting-http-server.version>1.0-SNAPSHOT</remoting-http-server.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.baeldung.server;
|
||||||
|
|
||||||
|
import com.baeldung.api.CabBookingService;
|
||||||
|
import org.springframework.amqp.core.AmqpTemplate;
|
||||||
|
import org.springframework.amqp.core.Queue;
|
||||||
|
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||||
|
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
|
||||||
|
import org.springframework.amqp.remoting.service.AmqpInvokerServiceExporter;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration @ComponentScan @EnableAutoConfiguration
|
||||||
|
public class AmqpServer {
|
||||||
|
|
||||||
|
/*
|
||||||
|
Please note that
|
||||||
|
- CachingConnectionFactory
|
||||||
|
- RabbitAdmin
|
||||||
|
- AmqpTemplate
|
||||||
|
are automatically declared by SpringBoot.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Bean CabBookingService bookingService() {
|
||||||
|
return new CabBookingServiceImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean Queue queue() {
|
||||||
|
return new Queue("remotingQueue");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean AmqpInvokerServiceExporter exporter(CabBookingService implementation, AmqpTemplate template) {
|
||||||
|
AmqpInvokerServiceExporter exporter = new AmqpInvokerServiceExporter();
|
||||||
|
exporter.setServiceInterface(CabBookingService.class);
|
||||||
|
exporter.setService(implementation);
|
||||||
|
exporter.setAmqpTemplate(template);
|
||||||
|
return exporter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean SimpleMessageListenerContainer listener(ConnectionFactory factory, AmqpInvokerServiceExporter exporter, Queue queue) {
|
||||||
|
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(factory);
|
||||||
|
container.setMessageListener(exporter);
|
||||||
|
container.setQueueNames(queue.getName());
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(AmqpServer.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
# This is true to make SpringBoot to automatically register a bean of type 'org.springframework.amqp.core.AmqpAdmin'.
|
||||||
|
# Check the org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration javadoc for details.
|
||||||
|
spring.rabbitmq.dynamic=true
|
||||||
|
|
||||||
|
# The port to which the client should connect defaults to 5672.
|
||||||
|
spring.rabbitmq.port=32769
|
||||||
|
|
||||||
|
# Username and password
|
||||||
|
spring.rabbitmq.username=guest
|
||||||
|
spring.rabbitmq.password=guest
|
||||||
|
|
||||||
|
# The host, defaults to localhost.
|
||||||
|
spring.rabbitmq.host=192.168.99.100
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
logging.pattern.console=%d{mm:ss.SSS} %-5p [%-31t] [%-54logger{0}] %marker%m%ex{full} - %logger - %F:%L%n
|
||||||
|
logging.level.root=WARN
|
||||||
|
logging.level.org.springframework.amqp=TRACE
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||||
|
</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,17 @@
|
||||||
|
package org.baeldung;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import com.baeldung.server.AmqpServer;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(classes = AmqpServer.class)
|
||||||
|
public class SpringContextManualTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
## Spring Remoting with Hessian and Burlap
|
||||||
|
|
||||||
|
This module contains articles about Spring Remoting with Hessian and Burlap
|
||||||
|
|
||||||
|
### Relevant Articles
|
||||||
|
|
||||||
|
- [Spring Remoting with Hessian and Burlap](http://www.baeldung.com/spring-remoting-hessian-burlap)
|
||||||
|
|
||||||
|
### Overview
|
||||||
|
This Maven project contains the Java source code for the Hessian and Burlap modules
|
||||||
|
used in the [Spring Remoting](https://github.com/eugenp/tutorials/tree/master/spring-remoting)
|
||||||
|
series of articles.
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>remoting-hessian-burlap</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<name>remoting-hessian-burlap</name>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<!-- uses legacy spring, cannot upgrade to boot-2 -->
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>parent-boot-1</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<relativePath>../../parent-boot-1</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>remoting-hessian-burlap-server</module>
|
||||||
|
<module>remoting-hessian-burlap-client</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,79 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>remoting-hessian-burlap-client</artifactId>
|
||||||
|
<name>remoting-hessian-burlap-client</name>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>remoting-hessian-burlap</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>remoting-http-api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.caucho</groupId>
|
||||||
|
<artifactId>hessian</artifactId>
|
||||||
|
<version>${hessian.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- test -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>remoting-hessian-burlap-server</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- test -->
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<argLine>
|
||||||
|
--add-opens java.base/java.lang=ALL-UNNAMED
|
||||||
|
</argLine>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<hessian.version>4.0.38</hessian.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.baeldung.client;
|
||||||
|
|
||||||
|
import com.baeldung.api.BookingException;
|
||||||
|
import com.baeldung.api.CabBookingService;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.remoting.caucho.BurlapProxyFactoryBean;
|
||||||
|
|
||||||
|
import static java.lang.System.out;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class BurlapClient {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public BurlapProxyFactoryBean burlapInvoker() {
|
||||||
|
BurlapProxyFactoryBean invoker = new BurlapProxyFactoryBean();
|
||||||
|
invoker.setServiceUrl("http://localhost:8032/b_booking");
|
||||||
|
invoker.setServiceInterface(CabBookingService.class);
|
||||||
|
return invoker;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws BookingException {
|
||||||
|
CabBookingService service = SpringApplication.run(BurlapClient.class, args).getBean(CabBookingService.class);
|
||||||
|
out.println(service.bookRide("13 Seagate Blvd, Key Largo, FL 33037"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.baeldung.client;
|
||||||
|
|
||||||
|
import com.baeldung.api.BookingException;
|
||||||
|
import com.baeldung.api.CabBookingService;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.remoting.caucho.HessianProxyFactoryBean;
|
||||||
|
|
||||||
|
import static java.lang.System.out;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class HessianClient {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public HessianProxyFactoryBean hessianInvoker() {
|
||||||
|
HessianProxyFactoryBean invoker = new HessianProxyFactoryBean();
|
||||||
|
invoker.setServiceUrl("http://localhost:8032/booking");
|
||||||
|
invoker.setServiceInterface(CabBookingService.class);
|
||||||
|
return invoker;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws BookingException {
|
||||||
|
CabBookingService service = SpringApplication.run(HessianClient.class, args).getBean(CabBookingService.class);
|
||||||
|
out.println(service.bookRide("13 Seagate Blvd, Key Largo, FL 33037"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||||
|
</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.baeldung.client;
|
||||||
|
|
||||||
|
import com.baeldung.api.Booking;
|
||||||
|
import com.baeldung.api.BookingException;
|
||||||
|
import com.baeldung.api.CabBookingService;
|
||||||
|
import com.baeldung.server.Server;
|
||||||
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import static java.lang.Thread.sleep;
|
||||||
|
|
||||||
|
@SpringBootTest(classes = {BurlapClient.class, HessianClient.class})
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
public class CabBookingServiceIntegrationTest {
|
||||||
|
|
||||||
|
static Logger log = LoggerFactory.getLogger(CabBookingServiceIntegrationTest.class);
|
||||||
|
@Autowired @Qualifier("burlapInvoker") CabBookingService burlapClient;
|
||||||
|
@Autowired @Qualifier("hessianInvoker") CabBookingService hessianClient;
|
||||||
|
static Thread serverThread;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void startServer() throws InterruptedException {
|
||||||
|
serverThread = serverThread();
|
||||||
|
log.info("Starting server.");
|
||||||
|
serverThread.start();
|
||||||
|
// increase this enough to let the server start
|
||||||
|
sleep(6000);
|
||||||
|
}
|
||||||
|
|
||||||
|
@org.junit.Test
|
||||||
|
public void bookACabWithBurlapClient() throws InterruptedException {
|
||||||
|
bookACab(this.burlapClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
@org.junit.Test
|
||||||
|
public void bookACabWithHessianClient() throws InterruptedException {
|
||||||
|
bookACab(this.hessianClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void bookACab(CabBookingService burlapClient) {
|
||||||
|
Booking booking;
|
||||||
|
try {
|
||||||
|
booking = burlapClient.bookRide("Duomo place");
|
||||||
|
log.info("Booking success: {}", booking);
|
||||||
|
} catch (BookingException e) {
|
||||||
|
log.info("Booking failed: {}", e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void stopServer() throws InterruptedException {
|
||||||
|
serverThread.interrupt();
|
||||||
|
serverThread.join();
|
||||||
|
log.info("Server terminated.");
|
||||||
|
}
|
||||||
|
|
||||||
|
static Thread serverThread() {
|
||||||
|
Thread serverThread = new Thread(()-> {
|
||||||
|
log.info("Starting Burlap and Hessian server");
|
||||||
|
Server.main(new String[]{});
|
||||||
|
log.info("Burlap and Hessian server terminated");
|
||||||
|
});
|
||||||
|
serverThread.setDaemon(true);
|
||||||
|
return serverThread;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package org.baeldung;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import com.baeldung.client.BurlapClient;
|
||||||
|
import com.baeldung.client.HessianClient;
|
||||||
|
|
||||||
|
@SpringBootTest(classes = {BurlapClient.class, HessianClient.class})
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
public class SpringContextTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
application.properties=9999
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>remoting-hessian-burlap-server</artifactId>
|
||||||
|
<name>remoting-hessian-burlap-server</name>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>remoting-hessian-burlap</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>remoting-http-server</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.caucho</groupId>
|
||||||
|
<artifactId>hessian</artifactId>
|
||||||
|
<version>${hessian.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<argLine>
|
||||||
|
--add-opens java.base/java.lang=ALL-UNNAMED
|
||||||
|
</argLine>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<hessian.version>4.0.38</hessian.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.baeldung.server;
|
||||||
|
|
||||||
|
import com.baeldung.api.CabBookingService;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.remoting.caucho.BurlapServiceExporter;
|
||||||
|
import org.springframework.remoting.caucho.HessianServiceExporter;
|
||||||
|
import org.springframework.remoting.support.RemoteExporter;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
@Configuration @ComponentScan @EnableAutoConfiguration public class Server {
|
||||||
|
|
||||||
|
@Bean CabBookingService bookingService() {
|
||||||
|
return new CabBookingServiceImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean(name = "/booking") RemoteExporter hessianService(CabBookingService service) {
|
||||||
|
HessianServiceExporter exporter = new HessianServiceExporter();
|
||||||
|
exporter.setService(bookingService());
|
||||||
|
exporter.setServiceInterface(CabBookingService.class);
|
||||||
|
return exporter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean(name = "/b_booking") RemoteExporter burlapService(CabBookingService service) {
|
||||||
|
BurlapServiceExporter exporter = new BurlapServiceExporter();
|
||||||
|
exporter.setService(bookingService());
|
||||||
|
exporter.setServiceInterface(CabBookingService.class);
|
||||||
|
return exporter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication app = new SpringApplication(Server.class);
|
||||||
|
app.setDefaultProperties(Collections.singletonMap("server.port", "8032"));
|
||||||
|
app.run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||||
|
</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,17 @@
|
||||||
|
package org.baeldung;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import com.baeldung.server.Server;
|
||||||
|
|
||||||
|
@SpringBootTest(classes = Server.class)
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
public class SpringContextTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
## Remoting HTTP
|
||||||
|
|
||||||
|
This module contains articles about Spring Remoting over HTTP
|
||||||
|
|
||||||
|
### Relevant Articles:
|
||||||
|
|
||||||
|
- [Intro to Spring Remoting with HTTP Invokers](https://www.baeldung.com/spring-remoting-http-invoker)
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>remoting-http</artifactId>
|
||||||
|
<name>remoting-http</name>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<description>Parent for all modules related to HTTP Spring Remoting.</description>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ossez</groupId>
|
||||||
|
<artifactId>spring-remoting-modules</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>remoting-http-server</module>
|
||||||
|
<module>remoting-http-client</module>
|
||||||
|
<module>remoting-http-api</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>remoting-http-api</artifactId>
|
||||||
|
<name>remoting-http-api</name>
|
||||||
|
<description>API definition shared between client and server.</description>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ossez</groupId>
|
||||||
|
<artifactId>remoting-http</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.baeldung.api;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import static java.lang.String.format;
|
||||||
|
|
||||||
|
public class Booking implements Serializable {
|
||||||
|
private String bookingCode;
|
||||||
|
|
||||||
|
@Override public String toString() {
|
||||||
|
return format("Ride confirmed: code '%s'.", bookingCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Booking(String bookingCode) {
|
||||||
|
this.bookingCode = bookingCode;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.baeldung.api;
|
||||||
|
|
||||||
|
public class BookingException extends Exception {
|
||||||
|
public BookingException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.baeldung.api;
|
||||||
|
|
||||||
|
public interface CabBookingService {
|
||||||
|
Booking bookRide(String pickUpLocation) throws BookingException;
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>remoting-http-client</artifactId>
|
||||||
|
<name>remoting-http-client</name>
|
||||||
|
<description>Shows how to invoke a remote service using Spring Remoting HTTP.</description>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ossez</groupId>
|
||||||
|
<artifactId>remoting-http</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>remoting-http-api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.baeldug.client;
|
||||||
|
|
||||||
|
import com.baeldung.api.BookingException;
|
||||||
|
import com.baeldung.api.CabBookingService;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;
|
||||||
|
|
||||||
|
import static java.lang.System.out;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class Client {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public HttpInvokerProxyFactoryBean invoker() {
|
||||||
|
HttpInvokerProxyFactoryBean invoker = new HttpInvokerProxyFactoryBean();
|
||||||
|
invoker.setServiceUrl("http://localhost:8080/booking");
|
||||||
|
invoker.setServiceInterface(CabBookingService.class);
|
||||||
|
return invoker;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws BookingException {
|
||||||
|
CabBookingService service = SpringApplication.run(Client.class, args).getBean(CabBookingService.class);
|
||||||
|
out.println(service.bookRide("13 Seagate Blvd, Key Largo, FL 33037"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||||
|
</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>remoting-http-server</artifactId>
|
||||||
|
<name>remoting-http-server</name>
|
||||||
|
<description>Shows how to expose a service using Spring Remoting HTTP.</description>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ossez</groupId>
|
||||||
|
<artifactId>remoting-http</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>remoting-http-api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,12 @@
|
||||||
|
Build and launch with the following command.
|
||||||
|
|
||||||
|
mvn clean package tomcat7:run-war
|
||||||
|
|
||||||
|
Exposed service is available at following URL.
|
||||||
|
|
||||||
|
http://localhost:9090/spring-remoting-http-server/account
|
||||||
|
|
||||||
|
## References
|
||||||
|
|
||||||
|
<http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#remoting-httpinvoker>
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.baeldung.server;
|
||||||
|
|
||||||
|
import com.baeldung.api.Booking;
|
||||||
|
import com.baeldung.api.BookingException;
|
||||||
|
import com.baeldung.api.CabBookingService;
|
||||||
|
|
||||||
|
import static java.lang.Math.random;
|
||||||
|
import static java.util.UUID.randomUUID;
|
||||||
|
|
||||||
|
public class CabBookingServiceImpl implements CabBookingService {
|
||||||
|
|
||||||
|
@Override public Booking bookRide(String pickUpLocation) throws BookingException {
|
||||||
|
if (random() < 0.3) throw new BookingException("Cab unavailable");
|
||||||
|
return new Booking(randomUUID().toString());
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue