@Override public void activateService() throws IOException { File tmp; if( fileConfig == null ) { tmp = new File( "polygene", app.name() + "-" + app.version() ); } else { tmp = fileConfig.temporaryDirectory(); } workDir = new File( tmp, "uowfile-" + me.identity().get() ); if( !workDir.exists() && !workDir.mkdirs() ) { throw new IOException( "Unable to create temporary directory: " + workDir ); } }
@SuppressWarnings( "SameParameterValue" ) protected void addEntityInfoToInsertToEntityTablePS( EntityState state, PreparedStatement ps, int startingIndex ) throws SQLException { ps.setString( startingIndex, state.entityReference().identity().toString() ); ps.setTimestamp( startingIndex + 1, Timestamp.from( state.lastModified() ) ); ps.setString( startingIndex + 2, state.version() ); ps.setString( startingIndex + 3, this._app.version() ); }
private void updateEntityInfoAndProperties( Connection connection, Map<QualifiedName, PreparedStatement> qNameInsertPSs, PreparedStatement insertAllQNamesPS, PreparedStatement clearPropertiesPS, PreparedStatement ps, EntityState state, Long entityPK, Map<Long, Integer> qNamePKs ) throws SQLException { this.clearAllEntitysQNames( clearPropertiesPS, entityPK ); // Update state ps.setString( 1, state.entityReference().identity().toString() ); ps.setTimestamp( 2, Timestamp.from( state.lastModified() ) ); ps.setString( 3, state.version() ); ps.setString( 4, this._app.version() ); ps.setLong( 5, entityPK ); ps.addBatch(); Integer nextUsableQNamePK = this.insertPropertyQNames( connection, qNameInsertPSs, insertAllQNamesPS, state, entityPK ); qNamePKs.put( entityPK, nextUsableQNamePK ); }
@Override public EntityState newEntityState( EntityStoreUnitOfWork uow, EntityReference reference, EntityDescriptor entityDescriptor ) { try { JsonObjectBuilder builder = jsonFactories.builderFactory().createObjectBuilder(); builder.add( JSONKeys.IDENTITY, reference.identity().toString() ); builder.add( JSONKeys.APPLICATION_VERSION, application.version() ); builder.add( JSONKeys.TYPE, entityDescriptor.types().findFirst().get().getName() ); builder.add( JSONKeys.VERSION, uow.identity().toString() ); builder.add( JSONKeys.MODIFIED, uow.currentTime().toEpochMilli() ); builder.add( JSONKeys.VALUE, jsonFactories.builderFactory().createObjectBuilder().build() ); JsonObject state = builder.build(); return new JSONEntityState( entityDescriptor.module(), serialization, jsonFactories, uow.identity().toString(), uow.currentTime(), reference, EntityStatus.NEW, entityDescriptor, state ); } catch( Exception e ) { throw new EntityStoreException( e ); } }
@Override public EntityState newEntityState( EntityStoreUnitOfWork uow, EntityReference reference, EntityDescriptor entityDescriptor ) { try { JsonObjectBuilder builder = jsonFactories.builderFactory().createObjectBuilder(); builder.add( JSONKeys.IDENTITY, reference.identity().toString() ); builder.add( JSONKeys.APPLICATION_VERSION, application.version() ); builder.add( JSONKeys.TYPE, entityDescriptor.types().findFirst().get().getName() ); builder.add( JSONKeys.VERSION, uow.identity().toString() ); builder.add( JSONKeys.MODIFIED, uow.currentTime().toEpochMilli() ); builder.add( JSONKeys.VALUE, jsonFactories.builderFactory().createObjectBuilder().build() ); JsonObject state = builder.build(); return new JSONEntityState( entityDescriptor.module(), serialization, jsonFactories, uow.identity().toString(), uow.currentTime(), reference, EntityStatus.NEW, entityDescriptor, state ); } catch( Exception e ) { throw new EntityStoreException( e ); } }
String appVersion = application.version(); String type = entityState.entityDescriptor().primaryType().getName(); Usecase usecase = unitOfWork.usecase();
json.add( JSONKeys.APPLICATION_VERSION, application.version() ); json.add( JSONKeys.TYPE, state.entityDescriptor().primaryType().getName() ); json.add( JSONKeys.VERSION, version );
json.add( JSONKeys.APPLICATION_VERSION, application.version() ); json.add( JSONKeys.TYPE, state.entityDescriptor().primaryType().getName() ); json.add( JSONKeys.VERSION, version );
String appVersion = this._app.version(); String dbAppVersion = this.readAppVersionFromDB( connection, schemaName );
prototype.version().set( application.version() ); prototype.timestamp().set( unitOfWork.currentTime() ); prototype.context().set( proxy.getClass().getSuperclass().getName().split( "\\$" )[ 0 ] );
prototype.version().set( application.version() ); prototype.timestamp().set( unitOfWork.currentTime() ); prototype.context().set( proxy.getClass().getSuperclass().getName().split( "\\$" )[ 0 ] );
@Test public void validateThatAssemblerCreatesApplication() throws AssemblyException, ActivationException { TestApplication assembler = new TestApplication( "Test Application", "1.0.1", Application.Mode.test ); assembler.initialize(); assembler.start(); assertThat( assembler.application().name(), equalTo("Test Application") ); assertThat( assembler.application().version(), equalTo("1.0.1") ); } }
ps.setString( 1, this._app.version() ); ps.execute();