최신 릴리스 : 5.7.0
이것은 Holon 플랫폼의 핵심 모듈이며 플랫폼 재단을 나타내며 전체 아키텍처, 기본 구조 및 API의 정의를 제공합니다.
모듈 하이라이트는 다음과 같습니다.
Context 자원Property 모델 및 Datastore APIJWT ) 지원자세한 내용은 모듈 문서를 참조하십시오.
다른 플랫폼 모듈과 마찬가지로이 아티팩트는 Holon 플랫폼 생태계의 일부이지만 독립형 라이브러리로도 사용할 수 있습니다.
자세한 내용은 시작과 플랫폼 문서를 참조하십시오.
속성 모델 정의 :
public interface Subject {
static NumericProperty < Long > ID = NumericProperty . longType ( "id" );
static StringProperty NAME = StringProperty . create ( "name" );
static StringProperty SURNAME = StringProperty . create ( "surname" );
static TemporalProperty < LocalDate > BIRTH = TemporalProperty . localDate ( "birth" );
static BooleanProperty ACTIVE = BooleanProperty . create ( "active" );
static VirtualProperty < String > FULL_NAME = VirtualProperty . create ( String . class ,
propertyBox -> propertyBox . getValue ( NAME ) + " " + propertyBox . getValue ( SURNAME ));
static PropertySet <?> SUBJECT = PropertySet . of ( ID , NAME , SURNAME , BIRTH , ACTIVE , FULL_NAME );
}속성 구성 :
static StringProperty NAME = StringProperty . create ( "name" ). message ( "Name" ). messageCode ( "localization.name" )
. withConfiguration ( "my-config" , "my-value" );속성 값 변환기 :
static StringProperty INTEGER_MODEL = StringProperty . create ( "integer_value" ). converter ( Integer . class ,
integer -> String . valueOf ( integer ), string -> Integer . valueOf ( string ));속성 유효성 검사기 :
static StringProperty NAME = StringProperty . create ( "name" )
. withValidator ( Validator . notBlank ()). withValidator ( Validator . max ( 50 ));속성 발표자 및 렌더러 :
String value = NAME . present ( "A value" );
MyType myType = NAME . render ( MyType . class );PropertyBox :
PropertyBox propertyBox = PropertyBox . create ( SUBJECT );
String name = propertyBox . getValue ( NAME );
Optional < String > oname = propertyBox . getValueIfPresent ( NAME );
propertyBox . setValue ( NAME , "John" );
propertyBox . propertyValues (). forEach ( propertyValue -> {
Property <?> property = propertyValue . getProperty ();
Object value = propertyValue . getValue ();
});데이터 저장소 :
DataTarget <?> TARGET = DataTarget . named ( "subjects" );
Datastore datastore = getDatastore ();
Stream < PropertyBox > results = datastore . query (). target ( TARGET )
. filter ( NAME . contains ( "a" ). and ( SURNAME . isNotNull ())). sort ( BIRTH . desc ()). stream ( SUBJECT );
Stream < String > names = datastore . query ( TARGET ). aggregate ( SURNAME ). stream ( NAME . max ());
Optional < String > name = datastore . query ( TARGET ). filter ( ID . eq ( 1L )). findOne ( NAME );
datastore . insert ( TARGET , PropertyBox . builder ( SUBJECT ). set ( ID , 1L ). set ( NAME , "John" ). set ( ACTIVE , true ). build ());
datastore . bulkUpdate ( TARGET ). set ( ACTIVE , true ). filter ( BIRTH . lt ( LocalDate . now ())). execute ();
datastore . query ( TARGET ). filter ( ID . eq ( 1L )). findOne ( SUBJECT ). ifPresent ( subject -> datastore . delete ( TARGET , subject ));Bean PropertySet 및 DataStore :
class MyBean {
private @ NotNull Long id ;
private @ Caption ( "The name" ) String name ;
private @ Caption ( "The surname" ) String surname ;
/* getters and setters omitted */
}
BeanPropertySet < MyBean > propertySet = BeanPropertySet . create ( MyBean . class );
PathProperty <?> name = propertySet . property ( "name" );
PathProperty < String > typedName = propertySet . property ( "name" , String . class );
BeanDatastore datastore = BeanDatastore . of ( getDatastore ());
Stream < MyBean > results = datastore . query ( MyBean . class ). filter ( propertySet . property ( "name" ). eq ( "John" )). stream ();
datastore . save ( new MyBean ());왕국:
Realm realm = Realm . builder (). withAuthenticator ( Authenticator . create ( MyAuthenticationToken . class , token -> {
if ( "test" . equals ( token . getPrincipal ())) {
return Authentication . builder ( "test" ). withPermission ( "ROLE1" ). build ();
}
throw new UnknownAccountException ();
}))
. withDefaultAuthorizer (). build ();
Realm . builder (). withAuthenticator ( Account . authenticator ( id -> Optional . of ( Account . builder ( id ). build ()))). build ();AuthContext :
AuthContext context = AuthContext . create ( realm );
context . authenticate ( AuthenticationToken . accountCredentials ( "test" , "pwd" ));
Optional < Authentication > authentication = context . getAuthentication ();
boolean permitted = context . isPermitted ( "ROLE1" , "ROLE2" );Restclient :
RestClient client = RestClient . forTarget ( "https://rest.api.example" );
ResponseEntity < TestData > response = client . request ()
. path ( "test/{id}" ). resolve ( "id" , 123 )
. accept ( MediaType . APPLICATION_JSON )
. header ( "MY_HEADER" , "my-value" )
. authorizationBearer ( "An389fz56xsr7" )
. get ( TestData . class );
HttpStatus status = response . getStatus ();
Optional < TestData > payload = response . getPayload ();
Optional < TestData > data = client . request (). path ( "test/{id}" ). resolve ( "id" , 123 )
. getForEntity ( TestData . class );
List < TestData > results = client . request (). path ( "test" ). getAsList ( TestData . class );
client . request (). path ( "test" ). post ( RequestEntity . json ( new TestData ()));
Optional < PropertyBox > propertyBox = client . request (). path ( "test2" )
. propertySet ( PROPERTIES ). getForEntity ( PropertyBox . class ); LocalizationContext :
LocalizationContext localizationContext = LocalizationContext . builder ()
. withMessageProvider ( MessageProvider . fromProperties ( "messages" ). build ())
. withDefaultDateTemporalFormat ( TemporalFormat . MEDIUM )
. withInitialLocale ( Locale . US )
. build ();
localizationContext . localize ( Locale . ITALY );
String localized = localizationContext . getMessage ( "message.code" , "Default message" );
String formatted = localizationContext . format ( LocalDate . now ());
formatted = localizationContext . format ( 123.4d );
Optional < LocalizationContext > current = LocalizationContext . getCurrent ();사용자 안내서의 모듈 문서와 전체 예제를 참조하십시오.
프로젝트 코드베이스가 개발되고 구성된 "실제 Java API" 철학에 대해 배우려면 Holon 플랫폼 코드 구조 및 컨벤션을 참조하십시오.
Holon 플랫폼은 Java 11을 사용하여 구축되므로 플랫폼 아티팩트를 사용하려면 JRE/JDK 버전 11 이상이 필요합니다.
사용 가능한 릴리스는 릴리스를 참조하십시오. 각 릴리스 태그는 폐쇄 된 문제에 대한 링크를 제공합니다.
Holon 플랫폼은 오픈 소스이며 Apache 2.0 라이센스에 따라 라이센스가 부여됩니다. 모든 인공물 (바이너리, 출처 및 Javadocs 포함)은 Maven Central Repository에서 구입할 수 있습니다.
이 모듈의 Maven Group ID는 com.holon-platform.core 이며 모듈 아티팩트를 얻기 위해 BOM (재료 청구서)이 제공됩니다.
Maven Bom :
< dependencyManagement >
< dependency >
< groupId >com.holon-platform.core</ groupId >
< artifactId >holon-bom</ artifactId >
< version >5.7.0</ version >
< type >pom</ type >
< scope >import</ scope >
</ dependency >
</ dependencyManagement >이 모듈의 사용 가능한 아티팩트 목록은 아티팩트 목록을 참조하십시오.
Holon 플랫폼은 사용 가능한 모든 플랫폼 아티팩트를 쉽게 얻을 수있는 전체 Maven Bom (재료 청구서)을 제공합니다.
플랫폼 Maven Bom :
< dependencyManagement >
< dependency >
< groupId >com.holon-platform</ groupId >
< artifactId >bom</ artifactId >
< version >${platform-version}</ version >
< type >pom</ type >
< scope >import</ scope >
</ dependency >
</ dependencyManagement >이 모듈의 사용 가능한 아티팩트 목록은 아티팩트 목록을 참조하십시오.
다음과 같이 Maven (버전 3.3.x 이상)을 사용하여 소스를 구축 할 수 있습니다.
mvn clean install
플랫폼 문서 또는 특정 모듈 문서를 확인하십시오.
스택 오버플로에 대한 질문을하십시오. holon-platform 태그를 모니터링합니다.
문제를보고하십시오.
상업적 지원도 제공됩니다.
예제 프로젝트 세트는 Holon 플랫폼 예제 저장소를 참조하십시오.
Holon 플랫폼에 기여하는 것을 참조하십시오.
질문을 받으려면 기고 방에 가입 하고 저희에게 연락하십시오.
모든 Holon 플랫폼 모듈은 Apache 2.0 라이센스에 따라 출시 된 오픈 소스 소프트웨어입니다.
Maven Group ID : com.holon-platform.core
| 아티팩트 ID | 설명 |
|---|---|
holon-core | 플랫폼 핵심 구성 요소, 서비스 및 API |
holon-http | HTTP 메시지 지원 |
holon-async-http | 비동기 HTTP 메시지 지원 |
holon-async-datastore | 비동기 데이터 스토어 API |
holon-auth | 인증 및 승인 |
holon-auth-jwt | JSON 웹 토큰 지원 |
holon-spring | 봄 통합 |
holon-spring-security | 스프링 보안 통합 |
holon-spring-boot | 스프링 부트 통합 |
holon-starter | 기본 스프링 부트 스타터 |
holon-starter-security | 스프링 보안 통합이있는 기본 스프링 부팅 스타터 |
holon-starter-test | 단위 테스트 용 기본 스프링 부팅 스타터 |
holon-bom | 자료 청구서 |
holon-bom-platform | 외부 의존성을 포함한 자료 청구서 |
documentation-core | 선적 서류 비치 |