Letzte Veröffentlichung: 5.7.0
Dies ist das Kernmodul der Holon -Plattform und repräsentiert die Plattformstiftung und bietet die Definition der gesamten Architektur, der Basisstrukturen und der APIs.
Die Modul -Highlights sind:
ContextProperty und die Datastore -APIJWT ) SupportEinzelheiten finden Sie in der Moduldokumentation.
Wie bei jedem anderen Plattformmodul ist dieses Artefakt Teil des Ökosystems zur Holon-Plattform, kann aber auch als eigenständige Bibliothek verwendet werden.
Weitere Informationen finden Sie unter Erste Schritte und die Plattformdokumentation.
Eigenschaftsmodelldefinition:
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 );
}Eigenschaftskonfiguration:
static StringProperty NAME = StringProperty . create ( "name" ). message ( "Name" ). messageCode ( "localization.name" )
. withConfiguration ( "my-config" , "my-value" );Eigenschaftswertkonverter:
static StringProperty INTEGER_MODEL = StringProperty . create ( "integer_value" ). converter ( Integer . class ,
integer -> String . valueOf ( integer ), string -> Integer . valueOf ( string ));Eigenschaftsbestimmungen:
static StringProperty NAME = StringProperty . create ( "name" )
. withValidator ( Validator . notBlank ()). withValidator ( Validator . max ( 50 ));Immobilien -Moderatoren und Renderer:
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 ();
});Datenspeicher:
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 und Datenspeicher:
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 ());Reich:
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 ); LokalisierungContext:
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 ();In der Moduldokumentation für die Benutzerhandbuch und eine vollständige Reihe von Beispielen finden Sie.
Siehe Holon Plattform -Code -Struktur und -Konventionen, um die Philosophie "Real Java API" zu erfahren, mit der die Projektcodebasis entwickelt und organisiert wird.
Die Holon -Plattform wurde mit Java 11 erstellt, sodass Sie eine JRE/JDK -Version 11 oder höher benötigen, um die Plattformartefakte zu verwenden.
Siehe Veröffentlichungen für die verfügbaren Veröffentlichungen. Jedes Release -Tag bietet einen Link zu den geschlossenen Problemen.
Die Holon -Plattform ist Open Source und lizenziert unter der Apache 2.0 -Lizenz. Alle Artefakte (einschließlich Binärdateien, Quellen und Javadocs) sind im MAVEN -Zentral -Repository erhältlich.
Die Maven Group ID für dieses Modul ist com.holon-platform.core und eine BOM (MATERIALE) wird bereitgestellt, um die Modulartefakte zu erhalten:
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 >In der Liste der Artefakte finden Sie eine Liste der verfügbaren Artefakte dieses Moduls.
Die Holon -Plattform bietet eine allgemeine Maven -BOM (Materialrechnung), um problemlos alle verfügbaren Plattformartefakte zu erhalten:
Plattform Maven Bom:
< dependencyManagement >
< dependency >
< groupId >com.holon-platform</ groupId >
< artifactId >bom</ artifactId >
< version >${platform-version}</ version >
< type >pom</ type >
< scope >import</ scope >
</ dependency >
</ dependencyManagement >In der Liste der Artefakte finden Sie eine Liste der verfügbaren Artefakte dieses Moduls.
Sie können die Quellen mit Maven erstellen (Version 3.3.x oder höher wird empfohlen) wie folgt:
mvn clean install
Überprüfen Sie die Plattformdokumentation oder die spezifische Moduldokumentation.
Stellen Sie eine Frage zum Stapelüberlauf. Wir überwachen das holon-platform -Tag.
Ein Problem melden.
Eine kommerzielle Unterstützung ist ebenfalls verfügbar.
Weitere Beispiele finden Sie im Repository des Repositorys von Holon Platform.
Siehe Beitrag zur Holon -Plattform.
Treten Sie dem Gitterraum für jede Frage bei und kontaktieren Sie uns.
Alle Holon -Plattform -Module sind Open -Source -Software, die unter der Apache 2.0 -Lizenz veröffentlicht wurden.
Maven Group ID : com.holon-platform.core
| Artefakt -ID | Beschreibung |
|---|---|
holon-core | Plattform -Kernkomponenten, Dienste und APIs |
holon-http | HTTP -Nachrichten unterstützen |
holon-async-http | Asynchrone HTTP -Nachrichten unterstützen |
holon-async-datastore | Asynchrone DataStore -API |
holon-auth | Authentifizierung und Autorisierung |
holon-auth-jwt | JSON -Web -Token -Unterstützung |
holon-spring | Frühlingsintegration |
holon-spring-security | Integration der Frühlingssicherheit |
holon-spring-boot | Spring -Boot -Integration |
holon-starter | Basis -Federstiefel Starter |
holon-starter-security | Basis -Feder -Boot -Starter mit Spring Security Integration |
holon-starter-test | Basis -Feder -Boot -Starter für Einheitstests |
holon-bom | Materialversorgungsrechnung |
holon-bom-platform | Materialversorgungsrechnung einschließlich externer Abhängigkeiten |
documentation-core | Dokumentation |