Skip to content

Commit

Permalink
Added server settings for mapped item optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
rubendel committed Nov 10, 2017
1 parent 4b95e2c commit 4f004a3
Show file tree
Hide file tree
Showing 40 changed files with 5,508 additions and 5,545 deletions.
10,210 changes: 5,106 additions & 5,104 deletions BimServer/generated/org/bimserver/interfaces/SConverter.java

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions BimServer/models/models.ecore
Original file line number Diff line number Diff line change
Expand Up @@ -19928,6 +19928,8 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="icon" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="storeLastLogin" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="storeServiceRuns" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="optimizeMappedItems"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="UserSettings">
<eStructuralFeatures xsi:type="ecore:EReference" name="serializers" upperBound="-1"
Expand Down
3 changes: 2 additions & 1 deletion BimServer/src/org/bimserver/database/Database.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class Database implements BimDatabase {
* database-schema change. Do not change this variable when nothing has
* changed in the schema!
*/
public static final int APPLICATION_SCHEMA_VERSION = 35;
public static final int APPLICATION_SCHEMA_VERSION = 36;

public Database(BimServer bimServer, Set<? extends EPackage> emfPackages, KeyValueStore keyValueStore, MetaDataManager metaDataManager) throws DatabaseInitException {
this.cidToEclass = new EClass[Short.MAX_VALUE];
Expand Down Expand Up @@ -236,6 +236,7 @@ public ServerSettings createDefaultSettings(DatabaseSession databaseSession) thr
settings.getWhitelistedDomains().add("localhost");
settings.getWhitelistedDomains().add("localhost:8080");
settings.setPluginStrictVersionChecking(true);
settings.setOptimizeMappedItems(false);
return settings;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public void migrate(Schema schema, DatabaseSession databaseSession) {
schema.createEAttribute(vector4f, "z", EcorePackage.eINSTANCE.getEFloat());
schema.createEAttribute(vector4f, "w", EcorePackage.eINSTANCE.getEFloat());

EClass geometryInfo = schema.getEClass("geometry", "GeometryInfo");
EClass geometryData = schema.getEClass("geometry", "GeometryData");

EReference reference = schema.createEReference(geometryData, "color", vector4f);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.bimserver.database.migrations.steps;

/******************************************************************************
* Copyright (C) 2009-2017 BIMserver.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see {@literal<http://www.gnu.org/licenses/>}.
*****************************************************************************/

import org.bimserver.database.DatabaseSession;
import org.bimserver.database.migrations.Migration;
import org.bimserver.database.migrations.Schema;
import org.eclipse.emf.ecore.EcorePackage;

public class Step0036 extends Migration {

@Override
public void migrate(Schema schema, DatabaseSession databaseSession) {
schema.createEAttribute(schema.getEClass("store", "ServerSettings"), "optimizeMappedItems", EcorePackage.eINSTANCE.getEBoolean());
}

@Override
public String getDescription() {
return "Added optimizeMappedItems setting";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@ public QueryIncludeStackFrame(QueryObjectProvider queryObjectProvider, QueryCont

@SuppressWarnings("unchecked")
@Override
public boolean process() throws BimserverDatabaseException, QueryException {
feature = featureIterator.next();
public boolean process() throws BimserverDatabaseException, QueryException {
if (!featureIterator.hasNext()) {
return true;
}
feature = featureIterator.next();
Object value = currentObject.eGet(feature);
if (value != null) {
if (feature.isMany()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ public RevisionStackFrame(QueryObjectProvider queryObjectProvider, long roid) th

@Override
public boolean process() {
queryObjectProvider.push(new ConcreteRevisionStackFrame(queryObjectProvider, this.concreteRevisionIterator.next()));
if (!concreteRevisionIterator.hasNext()) {
return true;
}
queryObjectProvider.push(new ConcreteRevisionStackFrame(queryObjectProvider, this.concreteRevisionIterator.next()));
if (concreteRevisionIterator.hasNext()) {
return false;
}
Expand Down
10 changes: 9 additions & 1 deletion BimServer/src/org/bimserver/database/queries/StackFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ public boolean isDone() {
public void setDone(boolean done) {
this.done = done;
}


/**
* @return True when it's done
* @throws BimserverDatabaseException
* @throws QueryException
* @throws JsonParseException
* @throws JsonMappingException
* @throws IOException
*/
abstract boolean process() throws BimserverDatabaseException, QueryException, JsonParseException, JsonMappingException, IOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public String toHtml() {
builder.append("<table><tbody>");
builder.append("<tr><td>Max objects per file</td><td>" + maxObjectsPerFile + "</td></tr>");
builder.append("<tr><td>Reuse geometry</td><td>" + reuseGeometry + "</td></tr>");
builder.append("<tr><td>Using mapping optimization</td><td>" + useMappingOptimization + "</td></tr>");
builder.append("<tr><td>Optimize mapped items</td><td>" + useMappingOptimization + "</td></tr>");
builder.append("</tbody></table>");

builder.append("<h3>Deserializer</h3>");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ public class StreamingGeometryGenerator extends GenericGeometryGenerator {
private String renderEngineName;

private Long eoid = -1L;
private boolean useMapping = true;
private GeometryGenerationReport report;

private boolean reuseGeometry;
private boolean optimizeMappedItems;

public StreamingGeometryGenerator(final BimServer bimServer, ProgressListener progressListener, Long eoid, GeometryGenerationReport report) {
this.bimServer = bimServer;
Expand Down Expand Up @@ -149,11 +149,12 @@ public GenerateGeometryResult generateGeometry(long uoid, final DatabaseSession
}

reuseGeometry = bimServer.getServerSettingsCache().getServerSettings().isReuseGeometry();
optimizeMappedItems = bimServer.getServerSettingsCache().getServerSettings().isOptimizeMappedItems();

report.setStart(new GregorianCalendar());
report.setIfcSchema(queryContext.getPackageMetaData().getSchema());
report.setMaxPerFile(maxObjectsPerFile);
report.setUseMappingOptimization(useMapping);
report.setUseMappingOptimization(optimizeMappedItems);
report.setReuseGeometry(reuseGeometry);

try {
Expand Down Expand Up @@ -371,13 +372,13 @@ public GenerateGeometryResult generateGeometry(long uoid, final DatabaseSession
long masterOid = map.values().iterator().next().getOid();
for (ProductDef pd : map.values()) {
done.add(pd.getOid());
if (!useMapping) {
if (!optimizeMappedItems) {
queryPart.addOid(pd.getOid());
} else {
pd.setMasterOid(masterOid);
}
}
if (useMapping) {
if (optimizeMappedItems) {
queryPart.addOid(masterOid);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1101,11 +1101,7 @@ private Long checkinInternal(Long topicId, final Long poid, final String comment
@Override
public Long checkin(final Long poid, final String comment, Long deserializerOid, Long fileSize, String fileName, DataHandler dataHandler, Boolean merge, Boolean sync) throws ServerException, UserException {
Long topicId = initiateCheckin(poid, deserializerOid);
try {
checkinInitiated(topicId, poid, comment, deserializerOid, fileSize, fileName, dataHandler, merge, sync);
} finally {
cleanupLongAction(topicId);
}
checkinInitiated(topicId, poid, comment, deserializerOid, fileSize, fileName, dataHandler, merge, sync);
return topicId;
}

Expand Down
10 changes: 5 additions & 5 deletions BimServerWar/.settings/org.eclipse.wst.common.component
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="bimserverwar-1.5.90-SNAPSHOT">
<wb-module deploy-name="bimserverwar-1.5.91-SNAPSHOT">
<wb-resource deploy-path="/WEB-INF/web.xml" source-path="/web.xml"/>
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<dependent-module archiveName="bimserver-1.5.90-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/BimServer/BimServer">
<dependent-module archiveName="bimserver-1.5.91-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/BimServer/BimServer">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="bimserverclientlib-1.5.90-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/BimServerClientLib/BimServerClientLib">
<dependent-module archiveName="bimserverclientlib-1.5.91-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/BimServerClientLib/BimServerClientLib">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="shared-1.5.90-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/Shared/Shared">
<dependent-module archiveName="shared-1.5.91-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/Shared/Shared">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="pluginbase-1.5.90-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/PluginBase/PluginBase">
<dependent-module archiveName="pluginbase-1.5.91-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/PluginBase/PluginBase">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/BimServerWar/target/classes"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class SServerSettings implements SDataBase
private java.lang.String icon;
private boolean storeLastLogin;
private boolean storeServiceRuns;
private boolean optimizeMappedItems;

public long getOid() {
return this.oid;
Expand Down Expand Up @@ -186,6 +187,9 @@ public Object sGet(SField sField) {
if (sField.getName().equals("storeServiceRuns")) {
return isStoreServiceRuns();
}
if (sField.getName().equals("optimizeMappedItems")) {
return isOptimizeMappedItems();
}
if (sField.getName().equals("oid")) {
return getOid();
}
Expand Down Expand Up @@ -325,6 +329,10 @@ public void sSet(SField sField, Object val) {
setStoreServiceRuns((Boolean)val);
return;
}
if (sField.getName().equals("optimizeMappedItems")) {
setOptimizeMappedItems((Boolean)val);
return;
}
if (sField.getName().equals("oid")) {
setOid((Long)val);
return;
Expand Down Expand Up @@ -593,6 +601,14 @@ public void setStoreServiceRuns(boolean storeServiceRuns) {
this.storeServiceRuns = storeServiceRuns;
}

public boolean isOptimizeMappedItems() {
return optimizeMappedItems;
}

public void setOptimizeMappedItems(boolean optimizeMappedItems) {
this.optimizeMappedItems = optimizeMappedItems;
}

@Override
public int hashCode() {
final int prime = 31;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ public enum NotifictionResultEnum implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
private static final NotifictionResultEnum[] VALUES_ARRAY = new NotifictionResultEnum[] { NR_ERROR, SUCCESS,
PROGRESS_UNKNOWN, PROGRESS_PERCENTAGE, };
private static final NotifictionResultEnum[] VALUES_ARRAY = new NotifictionResultEnum[] { NR_ERROR, SUCCESS, PROGRESS_UNKNOWN, PROGRESS_PERCENTAGE, };

/**
* A public read-only list of all the '<em><b>Notifiction Result Enum</b></em>' enumerators.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,7 @@ public enum PluginType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
private static final PluginType[] VALUES_ARRAY = new PluginType[] { SERIALIZER, DESERIALIZER, RENDER_ENGINE,
QUERY_ENGINE, OBJECT_IDM, WEB_MODULE, MODEL_MERGER, MODEL_COMPARE, MODEL_CHECKER, STILL_IMAGE_RENDER,
SERVICE, };
private static final PluginType[] VALUES_ARRAY = new PluginType[] { SERIALIZER, DESERIALIZER, RENDER_ENGINE, QUERY_ENGINE, OBJECT_IDM, WEB_MODULE, MODEL_MERGER, MODEL_COMPARE, MODEL_CHECKER, STILL_IMAGE_RENDER, SERVICE, };

/**
* A public read-only list of all the '<em><b>Plugin Type</b></em>' enumerators.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ public enum PrimitiveEnum implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
private static final PrimitiveEnum[] VALUES_ARRAY = new PrimitiveEnum[] { LONG, DOUBLE, BOOLEAN, STRING,
BYTE_ARRAY, };
private static final PrimitiveEnum[] VALUES_ARRAY = new PrimitiveEnum[] { LONG, DOUBLE, BOOLEAN, STRING, BYTE_ARRAY, };

/**
* A public read-only list of all the '<em><b>Primitive Enum</b></em>' enumerators.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ public enum ProgressTopicType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
private static final ProgressTopicType[] VALUES_ARRAY = new ProgressTopicType[] { DOWNLOAD, UPLOAD, RUNNING_SERVICE,
BRANCH, };
private static final ProgressTopicType[] VALUES_ARRAY = new ProgressTopicType[] { DOWNLOAD, UPLOAD, RUNNING_SERVICE, BRANCH, };

/**
* A public read-only list of all the '<em><b>Progress Topic Type</b></em>' enumerators.
Expand Down
5 changes: 2 additions & 3 deletions PluginBase/generated/org/bimserver/models/store/SIPrefix.java
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,8 @@ public enum SIPrefix implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
private static final SIPrefix[] VALUES_ARRAY = new SIPrefix[] { METER, ATTOMETER, FEMTOMETER, PICOMETER, NANOMETER,
MICROMETER, MILLIMETER, CENTIMETER, DECIMETER, DECAMETER, HECTOMETER, KILOMETER, MEGAMETER, GIGAMETER,
TERAMETER, PETAMETER, EXAMETER, };
private static final SIPrefix[] VALUES_ARRAY = new SIPrefix[] { METER, ATTOMETER, FEMTOMETER, PICOMETER, NANOMETER, MICROMETER, MILLIMETER, CENTIMETER, DECIMETER, DECAMETER, HECTOMETER, KILOMETER, MEGAMETER, GIGAMETER, TERAMETER,
PETAMETER, EXAMETER, };

/**
* A public read-only list of all the '<em><b>SI Prefix</b></em>' enumerators.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
* <li>{@link org.bimserver.models.store.ServerSettings#getIcon <em>Icon</em>}</li>
* <li>{@link org.bimserver.models.store.ServerSettings#isStoreLastLogin <em>Store Last Login</em>}</li>
* <li>{@link org.bimserver.models.store.ServerSettings#isStoreServiceRuns <em>Store Service Runs</em>}</li>
* <li>{@link org.bimserver.models.store.ServerSettings#isOptimizeMappedItems <em>Optimize Mapped Items</em>}</li>
* </ul>
*
* @see org.bimserver.models.store.StorePackage#getServerSettings()
Expand Down Expand Up @@ -889,4 +890,30 @@ public interface ServerSettings extends IdEObject {
*/
void setStoreServiceRuns(boolean value);

/**
* Returns the value of the '<em><b>Optimize Mapped Items</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Optimize Mapped Items</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Optimize Mapped Items</em>' attribute.
* @see #setOptimizeMappedItems(boolean)
* @see org.bimserver.models.store.StorePackage#getServerSettings_OptimizeMappedItems()
* @model
* @generated
*/
boolean isOptimizeMappedItems();

/**
* Sets the value of the '{@link org.bimserver.models.store.ServerSettings#isOptimizeMappedItems <em>Optimize Mapped Items</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Optimize Mapped Items</em>' attribute.
* @see #isOptimizeMappedItems()
* @generated
*/
void setOptimizeMappedItems(boolean value);

} // ServerSettings
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,7 @@ public enum ServerState implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
private static final ServerState[] VALUES_ARRAY = new ServerState[] { UNDEFINED, NOT_SETUP, SETUP,
MIGRATION_REQUIRED, MIGRATION_IMPOSSIBLE, FATAL_ERROR, RUNNING, };
private static final ServerState[] VALUES_ARRAY = new ServerState[] { UNDEFINED, NOT_SETUP, SETUP, MIGRATION_REQUIRED, MIGRATION_IMPOSSIBLE, FATAL_ERROR, RUNNING, };

/**
* A public read-only list of all the '<em><b>Server State</b></em>' enumerators.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,7 @@ public enum ServiceSimpleType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
private static final ServiceSimpleType[] VALUES_ARRAY = new ServiceSimpleType[] { ENUM, STRING, LONG, INT, BOOLEAN,
FLOAT, DOUBLE, DATE, CLASS, DATAHANDLER, BYTEARRAY, LIST, SET, VOID, UNKNOWN, };
private static final ServiceSimpleType[] VALUES_ARRAY = new ServiceSimpleType[] { ENUM, STRING, LONG, INT, BOOLEAN, FLOAT, DOUBLE, DATE, CLASS, DATAHANDLER, BYTEARRAY, LIST, SET, VOID, UNKNOWN, };

/**
* A public read-only list of all the '<em><b>Service Simple Type</b></em>' enumerators.
Expand Down
Loading

0 comments on commit 4f004a3

Please sign in to comment.