private void createApplication ( DoradusClient client ) { ApplicationDefinition appDef = ApplicationDefinition . builder ( ) . withName ( "HelloSpider" ) . withKey ( "Arachnid" ) . withOption ( "StorageService" , "SpiderService" ) . withTable ( TableDefinition . builder ( ) . withName ( "Movies" ) . withField ( FieldDefinition . builder ( ) . withName ( "Name" ) . withType ( FieldType . TEXT ) . build ( ) ) . withField ( FieldDefinition . builder ( ) . withName ( "ReleaseDate" ) . withType ( FieldType . TIMESTAMP ) . build ( ) ) . withField ( FieldDefinition . builder ( ) . withName ( "Cancelled" ) . withType ( FieldType . BOOLEAN ) . build ( ) ) . withField ( FieldDefinition . builder ( ) . withName ( "Director" ) . withType ( FieldType . TEXT ) . build ( ) ) . withField ( FieldDefinition . builder ( ) . withName ( "Leads" ) . withType ( FieldType . LINK ) . withExtent ( "Actors" ) . withInverse ( "ActedIn" ) . build ( ) ) . withField ( FieldDefinition . builder ( ) . withName ( "Budget" ) . withType ( FieldType . INTEGER ) . build ( ) ) . build ( ) ) . withTable ( TableDefinition . builder ( ) . withName ( "Actors" ) . withField ( FieldDefinition . builder ( ) . withName ( "FirstName" ) . withType ( FieldType . TEXT ) . build ( ) ) . withField ( FieldDefinition . builder ( ) . withName ( "LastName" ) . withType ( FieldType . TEXT ) . build ( ) ) . withField ( FieldDefinition . builder ( ) . withName ( "ActedIn" ) . withType ( FieldType . LINK ) . withExtent ( "Movies" ) . withInverse ( "Leads" ) . build ( ) ) . build ( ) ) . build ( ) ; Command command = Command . builder ( ) . withName ( "DefineApp" ) . withParam ( "ApplicationDefinition" , appDef ) . build ( ) ; RESTResponse response = client . runCommand ( command ) ; if ( response . isFailed ( ) ) { throw new RuntimeException ( "DefineApp failed: " + response ) ; } }
Create the HelloSpider application definition .