รุ่นล่าสุด: 5.7.0
นี่คือโมดูล หลัก ของแพลตฟอร์ม Holon และแสดงถึงฐานรากแพลตฟอร์มให้คำจำกัดความของสถาปัตยกรรมโดยรวมโครงสร้างพื้นฐานและ API
ไฮไลท์ของโมดูลคือ:
ContextProperty และ 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 ();
});Datastore:
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 และ Dataastore:
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 ();ดูเอกสารประกอบโมดูลสำหรับคู่มือผู้ใช้และชุดตัวอย่างเต็มรูปแบบ
ดูโครงสร้างรหัสแพลตฟอร์ม Holon และการประชุมเพื่อเรียนรู้เกี่ยวกับปรัชญา "Real Java API" ซึ่งโครงการ Codebase ได้รับการพัฒนาและจัดระเบียบ
แพลตฟอร์ม Holon สร้างขึ้นโดยใช้ Java 11 ดังนั้นคุณต้องใช้ JRE/JDK เวอร์ชัน 11 หรือสูงกว่าเพื่อใช้สิ่งประดิษฐ์แพลตฟอร์ม
ดูรุ่นสำหรับรุ่นที่มีอยู่ แต่ละแท็กรีลีสให้ลิงก์ไปยังปัญหาที่ปิด
แพลตฟอร์ม Holon เป็นโอเพ่นซอร์สและได้รับใบอนุญาตภายใต้ใบอนุญาต Apache 2.0 สิ่งประดิษฐ์ทั้งหมด (รวมถึงไบนารีแหล่งที่มาและ Javadocs) มีให้บริการจากที่เก็บ Maven Central Central
Maven Group ID สำหรับโมดูลนี้คือ com.holon-platform.core และ BOM (Bill of Materials) มีไว้เพื่อให้ได้สิ่งประดิษฐ์โมดูล:
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 โดยรวม (Bill of Materials) เพื่อรับสิ่งประดิษฐ์แพลตฟอร์มทั้งหมดที่มีอยู่:
แพลตฟอร์ม 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
เข้าร่วมห้อง Gitter สำหรับคำถามใด ๆ และติดต่อเรา
โมดูลแพลตฟอร์ม Holon ทั้งหมดเป็นซอฟต์แวร์ โอเพ่นซอร์ส ที่เปิดตัวภายใต้ใบอนุญาต Apache 2.0
Maven Group ID : com.holon-platform.core
| ID สิ่งประดิษฐ์ | คำอธิบาย |
|---|---|
holon-core | ส่วนประกอบหลักของแพลตฟอร์มบริการและ APIs |
holon-http | สนับสนุนข้อความ HTTP |
holon-async-http | การสนับสนุนข้อความ HTTP แบบอะซิงโครนัส |
holon-async-datastore | ASYNCHRONOUS DATASTORE API |
holon-auth | การรับรองความถูกต้องและการอนุญาต |
holon-auth-jwt | การสนับสนุนโทเค็นเว็บ JSON |
holon-spring | การรวมฤดูใบไม้ผลิ |
holon-spring-security | การรวมความปลอดภัยในฤดูใบไม้ผลิ |
holon-spring-boot | การรวมการบูตฤดูใบไม้ผลิ |
holon-starter | ฐานสตาร์ทสปริงสปริง |
holon-starter-security | Base Spring Boot Starter พร้อมการรวมความปลอดภัยของฤดูใบไม้ผลิ |
holon-starter-test | Base Spring Boot Starter สำหรับการทดสอบหน่วย |
holon-bom | ใบเรียกเก็บเงิน |
holon-bom-platform | ใบเรียกเก็บเงินรวมถึงการพึ่งพาภายนอก |
documentation-core | เอกสาร |