أحدث إصدار: 5.7.0
هذه هي الوحدة النمطية الأساسية لمنصة Holon وتمثل مؤسسة Platform Foundation ، مما يوفر تعريف الهندسة المعمارية العامة والهياكل الأساسية وواجهة برمجة التطبيقات.
أبرز الوحدة هي:
ContextProperty و API DatastoreJWT )انظر وثائق الوحدة للحصول على التفاصيل.
تمامًا مثل أي وحدة منصة أخرى ، تعد هذه القطع الأثرية جزءًا من نظام Holon Platform ، ولكن يمكن استخدامه أيضًا كمكتبة مستقلة .
انظر البدء ووثائق النظام الأساسي لمزيد من التفاصيل.
تعريف نموذج الخصائص:
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 ));Propertyses و 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 ); توطين context:
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 والاتفاقيات للتعرف على فلسفة "java api الحقيقية" التي يتم بها تطوير وتنظيم قاعدة كود المشروع.
تم تصميم منصة Holon باستخدام Java 11 ، لذلك تحتاج إلى إصدار JRE/JDK 11 أو أعلى لاستخدام القطع الأثرية منصة.
انظر الإصدارات للإصدارات المتاحة. توفر كل علامة إصدار رابط للمشكلات المغلقة.
منصة Holon مفتوحة المصدر ومرخص لها بموجب ترخيص Apache 2.0. جميع القطع الأثرية (بما في ذلك الثنائيات والمصادر و javadocs) متوفرة من مستودع مافن المركزي.
معرف مجموعة Maven لهذه الوحدة هو com.holon-platform.core ويتم توفير 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 (فاتورة المواد) بشكل عام للحصول على جميع القطع الأثرية المتاحة:
منصة مافن بوم:
< 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 Platform هي برنامج مفتوح المصدر تم إصداره بموجب ترخيص Apache 2.0.
معرف مجموعة Maven: com.holon-platform.core
| معرف القطع الأثرية | وصف |
|---|---|
holon-core | المكونات الأساسية والخدمات الأساسية و APIs |
holon-http | دعم رسائل HTTP |
holon-async-http | دعم رسائل HTTP غير المتزامن |
holon-async-datastore | API DataSore غير المتزامن |
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 | الوثائق |