conflict_resolution
stringlengths
27
16k
<<<<<<< /* * Copyright (C) 2012-2019 52°North Initiative for Geospatial Open Source ======= /** * Copyright (C) 2012-2020 52°North Initiative for Geospatial Open Source >>>>>>> /* * Copyright (C) 2012-2020 52°North Initiative for Geospatial Open Source
<<<<<<< CryptoModule cryptoModule = AccumuloVFSClassLoader.loadClass(cryptoModuleClassname).asSubclass(CryptoModule.class).newInstance(); ======= cryptoModuleClazz = AccumuloVFSClassLoader.loadClass(cryptoModuleClassname); } catch (ClassNotFoundException e1) { log.warn(String.format( "Could not find configured crypto module \"%s\". No encryption will be used.", cryptoModuleClassname)); return new NullCryptoModule(); } >>>>>>> CryptoModule cryptoModule = AccumuloVFSClassLoader.loadClass(cryptoModuleClassname) .asSubclass(CryptoModule.class).newInstance(); <<<<<<< return cryptoModule; } catch (ClassNotFoundException e1) { throw new IllegalArgumentException("Could not find configured crypto module " + cryptoModuleClassname); } catch (ClassCastException cce) { throw new IllegalArgumentException("Configured Accumulo crypto module " + cryptoModuleClassname + " does not implement the CryptoModule interface."); } catch (InstantiationException | IllegalAccessException e) { throw new IllegalArgumentException("Unable to instantiate the crypto module: " + cryptoModuleClassname, e); ======= for (Class clazz : interfaces) { if (clazz.equals(CryptoModule.class)) { implementsCryptoModule = true; break; } } if (!implementsCryptoModule) { log.warn("Configured Accumulo crypto module \"" + cryptoModuleClassname + "\" does not implement the CryptoModule interface. No encryption will be used."); return new NullCryptoModule(); } else { try { cryptoModule = (CryptoModule) cryptoModuleClazz.newInstance(); log.debug("Successfully instantiated crypto module " + cryptoModuleClassname); } catch (InstantiationException e) { log.warn(String.format( "Got instantiation exception %s when instantiating crypto module \"%s\". No encryption will be used.", e.getCause().getClass().getName(), cryptoModuleClassname)); log.warn("InstantiationException", e.getCause()); return new NullCryptoModule(); } catch (IllegalAccessException e) { log.warn(String.format( "Got illegal access exception when trying to instantiate crypto module \"%s\". No encryption will be used.", cryptoModuleClassname)); log.warn("IllegalAccessException", e); return new NullCryptoModule(); } >>>>>>> return cryptoModule; } catch (ClassNotFoundException e1) { throw new IllegalArgumentException( "Could not find configured crypto module " + cryptoModuleClassname); } catch (ClassCastException cce) { throw new IllegalArgumentException("Configured Accumulo crypto module " + cryptoModuleClassname + " does not implement the CryptoModule interface."); } catch (InstantiationException | IllegalAccessException e) { throw new IllegalArgumentException( "Unable to instantiate the crypto module: " + cryptoModuleClassname, e); <<<<<<< private static SecretKeyEncryptionStrategy instantiateSecreteKeyEncryptionStrategy(String className) { ======= @SuppressWarnings("rawtypes") private static SecretKeyEncryptionStrategy instantiateSecreteKeyEncryptionStrategy( String className) { >>>>>>> private static SecretKeyEncryptionStrategy instantiateSecreteKeyEncryptionStrategy( String className) { <<<<<<< SecretKeyEncryptionStrategy strategy = AccumuloVFSClassLoader.loadClass(className).asSubclass(SecretKeyEncryptionStrategy.class).newInstance(); ======= keyEncryptionStrategyClazz = AccumuloVFSClassLoader.loadClass(className); } catch (ClassNotFoundException e1) { log.warn(String.format( "Could not find configured secret key encryption strategy \"%s\". No encryption will be used.", className)); return new NullSecretKeyEncryptionStrategy(); } >>>>>>> SecretKeyEncryptionStrategy strategy = AccumuloVFSClassLoader.loadClass(className) .asSubclass(SecretKeyEncryptionStrategy.class).newInstance(); <<<<<<< return strategy; } catch (ClassNotFoundException e1) { throw new IllegalArgumentException("Could not find configured secret key encryption strategy: " + className); } catch (ClassCastException e) { throw new IllegalArgumentException("Configured Accumulo secret key encryption strategy \"" + className + "\" does not implement the SecretKeyEncryptionStrategy interface."); } catch (InstantiationException | IllegalAccessException e) { throw new IllegalArgumentException("Unable to instantiate the secret key encryption strategy: " + className, e); ======= for (Class clazz : interfaces) { if (clazz.equals(SecretKeyEncryptionStrategy.class)) { implementsSecretKeyStrategy = true; break; } } if (!implementsSecretKeyStrategy) { log.warn( "Configured Accumulo secret key encryption strategy \"%s\" does not implement the SecretKeyEncryptionStrategy interface. No encryption will be used."); return new NullSecretKeyEncryptionStrategy(); } else { try { strategy = (SecretKeyEncryptionStrategy) keyEncryptionStrategyClazz.newInstance(); log.debug("Successfully instantiated secret key encryption strategy " + className); } catch (InstantiationException e) { log.warn(String.format( "Got instantiation exception %s when instantiating secret key encryption strategy \"%s\". No encryption will be used.", e.getCause().getClass().getName(), className)); log.warn("InstantiationException", e.getCause()); return new NullSecretKeyEncryptionStrategy(); } catch (IllegalAccessException e) { log.warn(String.format( "Got illegal access exception when trying to instantiate secret key encryption strategy \"%s\". No encryption will be used.", className)); log.warn("IllegalAccessException", e); return new NullSecretKeyEncryptionStrategy(); } >>>>>>> return strategy; } catch (ClassNotFoundException e1) { throw new IllegalArgumentException( "Could not find configured secret key encryption strategy: " + className); } catch (ClassCastException e) { throw new IllegalArgumentException("Configured Accumulo secret key encryption strategy \"" + className + "\" does not implement the SecretKeyEncryptionStrategy interface."); } catch (InstantiationException | IllegalAccessException e) { throw new IllegalArgumentException( "Unable to instantiate the secret key encryption strategy: " + className, e); <<<<<<< public static CryptoModuleParameters createParamsObjectFromAccumuloConfiguration(AccumuloConfiguration conf) { ======= public static String[] parseCipherTransform(String cipherTransform) { if (cipherTransform == null) { return new String[3]; } return cipherTransform.split("/"); } public static CryptoModuleParameters createParamsObjectFromAccumuloConfiguration( AccumuloConfiguration conf) { >>>>>>> public static CryptoModuleParameters createParamsObjectFromAccumuloConfiguration( AccumuloConfiguration conf) { <<<<<<< cryptoOpts.put(Property.CRYPTO_BLOCK_STREAM_SIZE.getKey(), Integer.toString((int) conf.getAsBytes(Property.CRYPTO_BLOCK_STREAM_SIZE))); ======= cryptoOpts.put(Property.CRYPTO_BLOCK_STREAM_SIZE.getKey(), Integer.toString((int) conf.getMemoryInBytes(Property.CRYPTO_BLOCK_STREAM_SIZE))); >>>>>>> cryptoOpts.put(Property.CRYPTO_BLOCK_STREAM_SIZE.getKey(), Integer.toString((int) conf.getAsBytes(Property.CRYPTO_BLOCK_STREAM_SIZE))); <<<<<<< public static CryptoModuleParameters fillParamsObjectFromStringMap(CryptoModuleParameters params, Map<String,String> cryptoOpts) { params.setCipherSuite(cryptoOpts.get(Property.CRYPTO_CIPHER_SUITE.getKey())); ======= public static CryptoModuleParameters fillParamsObjectFromStringMap(CryptoModuleParameters params, Map<String,String> cryptoOpts) { // Parse the cipher suite for the mode and padding options String[] cipherTransformParts = parseCipherTransform( cryptoOpts.get(Property.CRYPTO_CIPHER_SUITE.getKey())); >>>>>>> public static CryptoModuleParameters fillParamsObjectFromStringMap(CryptoModuleParameters params, Map<String,String> cryptoOpts) { params.setCipherSuite(cryptoOpts.get(Property.CRYPTO_CIPHER_SUITE.getKey())); <<<<<<< params.setKeyAlgorithmName(cryptoOpts.get(Property.CRYPTO_CIPHER_KEY_ALGORITHM_NAME.getKey())); params.setKeyEncryptionStrategyClass(cryptoOpts.get(Property.CRYPTO_SECRET_KEY_ENCRYPTION_STRATEGY_CLASS.getKey())); params.setKeyLength(Integer.parseInt(cryptoOpts.get(Property.CRYPTO_CIPHER_KEY_LENGTH.getKey()))); params.setOverrideStreamsSecretKeyEncryptionStrategy(Boolean.parseBoolean(cryptoOpts.get(Property.CRYPTO_OVERRIDE_KEY_STRATEGY_WITH_CONFIGURED_STRATEGY .getKey()))); ======= params.setAlgorithmName(cryptoOpts.get(Property.CRYPTO_CIPHER_ALGORITHM_NAME.getKey())); params.setEncryptionMode(cipherTransformParts[1]); params.setKeyEncryptionStrategyClass( cryptoOpts.get(Property.CRYPTO_SECRET_KEY_ENCRYPTION_STRATEGY_CLASS.getKey())); params .setKeyLength(Integer.parseInt(cryptoOpts.get(Property.CRYPTO_CIPHER_KEY_LENGTH.getKey()))); params.setOverrideStreamsSecretKeyEncryptionStrategy(Boolean.parseBoolean( cryptoOpts.get(Property.CRYPTO_OVERRIDE_KEY_STRATEGY_WITH_CONFIGURED_STRATEGY.getKey()))); params.setPadding(cipherTransformParts[2]); >>>>>>> params.setKeyAlgorithmName(cryptoOpts.get(Property.CRYPTO_CIPHER_KEY_ALGORITHM_NAME.getKey())); params.setKeyEncryptionStrategyClass( cryptoOpts.get(Property.CRYPTO_SECRET_KEY_ENCRYPTION_STRATEGY_CLASS.getKey())); params .setKeyLength(Integer.parseInt(cryptoOpts.get(Property.CRYPTO_CIPHER_KEY_LENGTH.getKey()))); params.setOverrideStreamsSecretKeyEncryptionStrategy(Boolean.parseBoolean( cryptoOpts.get(Property.CRYPTO_OVERRIDE_KEY_STRATEGY_WITH_CONFIGURED_STRATEGY.getKey()))); <<<<<<< params.setRandomNumberGeneratorProvider(cryptoOpts.get(Property.CRYPTO_SECURE_RNG_PROVIDER.getKey())); params.setSecurityProvider(cryptoOpts.get(Property.CRYPTO_SECURITY_PROVIDER.getKey())); ======= params.setRandomNumberGeneratorProvider( cryptoOpts.get(Property.CRYPTO_SECURE_RNG_PROVIDER.getKey())); >>>>>>> params.setRandomNumberGeneratorProvider( cryptoOpts.get(Property.CRYPTO_SECURE_RNG_PROVIDER.getKey())); params.setSecurityProvider(cryptoOpts.get(Property.CRYPTO_SECURITY_PROVIDER.getKey()));
<<<<<<< // Pending step strategy says to fail so treat this step as having failed. failedSteps.add(currentStep); ======= notifier.fireTestFinished(currentStep); >>>>>>> // Pending step strategy says to fail so treat this step as having failed. failedSteps.add(currentStep); notifier.fireTestFinished(currentStep);
<<<<<<< import sparksoniq.jsoniq.runtime.iterator.primary.VariableReferenceIterator; ======= import sparksoniq.jsoniq.runtime.iterator.functions.base.LocalFunctionCallIterator; >>>>>>> import sparksoniq.jsoniq.runtime.iterator.primary.VariableReferenceIterator; import sparksoniq.jsoniq.runtime.iterator.functions.base.LocalFunctionCallIterator; <<<<<<< super(arguments, AggregateFunctionOperator.COUNT, iteratorMetadata); ======= super(arguments, iteratorMetadata); >>>>>>> super(arguments, iteratorMetadata);
<<<<<<< private StructType _inputSchema; Map<String, DynamicContext.VariableDependency> _dependencies; ======= Set<String> _dependencies; >>>>>>> Map<String, DynamicContext.VariableDependency> _dependencies;
<<<<<<< * Visit a parse tree produced by {@link JsoniqParser#keyWordBase64Binary}. * @param ctx the parse tree * @return the visitor result */ T visitKeyWordBase64Binary(JsoniqParser.KeyWordBase64BinaryContext ctx); /** * Visit a parse tree produced by {@link JsoniqParser#keyWordDateTime}. * @param ctx the parse tree * @return the visitor result */ T visitKeyWordDateTime(JsoniqParser.KeyWordDateTimeContext ctx); /** ======= * Visit a parse tree produced by {@link JsoniqParser#keyWordBase64Binary}. * @param ctx the parse tree * @return the visitor result */ T visitKeyWordBase64Binary(JsoniqParser.KeyWordBase64BinaryContext ctx); /** * Visit a parse tree produced by {@link JsoniqParser#typesKeywords}. * @param ctx the parse tree * @return the visitor result */ T visitTypesKeywords(JsoniqParser.TypesKeywordsContext ctx); /** >>>>>>> * Visit a parse tree produced by {@link JsoniqParser#keyWordBase64Binary}. * @param ctx the parse tree * @return the visitor result */ T visitKeyWordBase64Binary(JsoniqParser.KeyWordBase64BinaryContext ctx); /** * Visit a parse tree produced by {@link JsoniqParser#keyWordDateTime}. * @param ctx the parse tree * @return the visitor result */ T visitKeyWordDateTime(JsoniqParser.KeyWordDateTimeContext ctx); /** * Visit a parse tree produced by {@link JsoniqParser#typesKeywords}. * @param ctx the parse tree * @return the visitor result */ T visitTypesKeywords(JsoniqParser.TypesKeywordsContext ctx); /**
<<<<<<< import sparksoniq.jsoniq.runtime.iterator.primary.VariableReferenceIterator; ======= import sparksoniq.jsoniq.runtime.iterator.functions.base.LocalFunctionCallIterator; >>>>>>> import sparksoniq.jsoniq.runtime.iterator.primary.VariableReferenceIterator; import sparksoniq.jsoniq.runtime.iterator.functions.base.LocalFunctionCallIterator;
<<<<<<< import org.rumbledb.context.DynamicContext; ======= import org.rumbledb.exceptions.ExceptionMetadata; >>>>>>> import org.rumbledb.context.DynamicContext; import org.rumbledb.exceptions.ExceptionMetadata;
<<<<<<< import java.io.ByteArrayInputStream; ======= import static java.nio.charset.StandardCharsets.UTF_8; >>>>>>> import static java.nio.charset.StandardCharsets.UTF_8; import java.io.ByteArrayInputStream; <<<<<<< import java.io.UncheckedIOException; import java.nio.charset.StandardCharsets; ======= >>>>>>> import java.io.UncheckedIOException;
<<<<<<< import sparksoniq.exceptions.UnexpectedTypeException; import sparksoniq.jsoniq.compiler.translator.expr.operational.base.OperationalExpressionBase; import sparksoniq.jsoniq.runtime.metadata.IteratorMetadata; import sparksoniq.semantics.types.SingleType; ======= >>>>>>> import sparksoniq.exceptions.UnexpectedTypeException; import sparksoniq.jsoniq.compiler.translator.expr.operational.base.OperationalExpressionBase; import sparksoniq.jsoniq.runtime.metadata.IteratorMetadata;
<<<<<<< import sparksoniq.semantics.types.ItemType; import sparksoniq.semantics.types.ItemTypes; ======= >>>>>>>
<<<<<<< private static final Map<String, ItemType> itemTypes; static { itemTypes = new HashMap<>(); itemTypes.put("item", ItemType.item); itemTypes.put("object", ItemType.objectItem); itemTypes.put("array", ItemType.arrayItem); itemTypes.put("atomic", ItemType.atomicItem); itemTypes.put("string", ItemType.stringItem); itemTypes.put("integer", ItemType.integerItem); itemTypes.put("decimal", ItemType.decimalItem); itemTypes.put("double", ItemType.doubleItem); itemTypes.put("boolean", ItemType.booleanItem); itemTypes.put("duration", ItemType.durationItem); itemTypes.put("yearMonthDuration", ItemType.yearMonthDurationItem); itemTypes.put("dayTimeDuration", ItemType.dayTimeDurationItem); itemTypes.put("dateTime", ItemType.dateTimeItem); itemTypes.put("date", ItemType.dateItem); itemTypes.put("time", ItemType.timeItem); itemTypes.put("anyURI", ItemType.anyURIItem); itemTypes.put("hexBinary", ItemType.hexBinaryItem); itemTypes.put("base64Binary", ItemType.base64BinaryItem); itemTypes.put("null", ItemType.nullItem); } ======= >>>>>>> <<<<<<< sequenceTypes.put("boolean", new SequenceType(itemTypes.get("boolean"), SequenceType.Arity.One)); sequenceTypes.put("boolean?", new SequenceType(itemTypes.get("boolean"), SequenceType.Arity.OneOrZero)); ======= sequenceTypes.put("boolean", new SequenceType(ItemType.booleanItem, SequenceType.Arity.One)); >>>>>>> sequenceTypes.put("boolean", new SequenceType(ItemType.booleanItem, SequenceType.Arity.One)); sequenceTypes.put("boolean?", new SequenceType(ItemType.booleanItem, SequenceType.Arity.OneOrZero)); <<<<<<< sequenceTypes.put("anyURI?", new SequenceType(itemTypes.get("anyURI"), SequenceType.Arity.OneOrZero)); sequenceTypes.put("hexBinary?", new SequenceType(itemTypes.get("hexBinary"), SequenceType.Arity.OneOrZero)); ======= sequenceTypes.put("hexBinary?", new SequenceType(ItemType.hexBinaryItem, SequenceType.Arity.OneOrZero)); >>>>>>> sequenceTypes.put("anyURI?", new SequenceType(ItemType.anyURIItem, SequenceType.Arity.OneOrZero)); sequenceTypes.put("hexBinary?", new SequenceType(ItemType.hexBinaryItem, SequenceType.Arity.OneOrZero));
<<<<<<< import sparksoniq.jsoniq.compiler.translator.metadata.ExpressionMetadata; import sparksoniq.semantics.visitor.AbstractNodeVisitor; ======= import sparksoniq.semantics.visitor.AbstractExpressionOrClauseVisitor; >>>>>>> import sparksoniq.semantics.visitor.AbstractNodeVisitor; <<<<<<< import org.rumbledb.expressions.Node; ======= import org.rumbledb.exceptions.ExceptionMetadata; import org.rumbledb.expressions.ExpressionOrClause; >>>>>>> import org.rumbledb.expressions.Node; import org.rumbledb.exceptions.ExceptionMetadata;
<<<<<<< throw new TreatException(ItemTypes.getItemTypeName(_nextResult.getClass().getSimpleName()) + " cannot be treated as type " + sequenceTypeName + _sequenceType.getArity().getSymbol(), getMetadata()); ======= throw new TreatException( " " + ItemTypes.getItemTypeName(_nextResult.getClass().getSimpleName()) + " cannot be treated as type " + sequenceTypeName + _sequenceType.getArity().getSymbol(), getMetadata() ); >>>>>>> throw new TreatException( ItemTypes.getItemTypeName(_nextResult.getClass().getSimpleName()) + " cannot be treated as type " + sequenceTypeName + _sequenceType.getArity().getSymbol(), getMetadata() );
<<<<<<< import sparksoniq.jsoniq.compiler.translator.metadata.ExpressionMetadata; import sparksoniq.semantics.visitor.AbstractNodeVisitor; ======= import org.rumbledb.exceptions.ExceptionMetadata; import sparksoniq.semantics.visitor.AbstractExpressionOrClauseVisitor; >>>>>>> import sparksoniq.semantics.visitor.AbstractNodeVisitor; import org.rumbledb.exceptions.ExceptionMetadata;
<<<<<<< import sparksoniq.jsoniq.compiler.translator.metadata.ExpressionMetadata; import sparksoniq.semantics.visitor.AbstractNodeVisitor; ======= import sparksoniq.semantics.visitor.AbstractExpressionOrClauseVisitor; >>>>>>> import sparksoniq.semantics.visitor.AbstractNodeVisitor;
<<<<<<< import java.util.Arrays; ======= import java.util.HashSet; >>>>>>> import java.util.Arrays; import java.util.HashSet; <<<<<<< @Override public Dataset<Row> getDataFrame(DynamicContext context) { if (this._child == null) { throw new SparksoniqRuntimeException("Invalid count clause."); } Dataset<Row> df = _child.getDataFrame(context); StructType inputSchema = df.schema(); int duplicateVariableIndex = Arrays.asList(inputSchema.fieldNames()).indexOf(_variableName); String selectSQL = DataFrameUtils.getSQL(inputSchema, duplicateVariableIndex, true); Dataset<Row> dfWithIndex = DataFrameUtils.zipWithIndex(df, new Long(1), _variableName); df.sparkSession().udf().register("serializeCountIndex", new CountClauseSerializeUDF(), DataTypes.BinaryType); dfWithIndex.createOrReplaceTempView("input"); dfWithIndex = dfWithIndex.sparkSession().sql( String.format("select %s serializeCountIndex(`%s`) as `%s` from input", selectSQL, _variableName, _variableName) ); return dfWithIndex; } ======= public Set<String> getVariableDependencies() { Set<String> result = new HashSet<String>(); result.addAll(_child.getVariableDependencies()); return result; } public Set<String> getVariablesBoundInCurrentFLWORExpression() { Set<String> result = new HashSet<String>(); result.addAll(_child.getVariablesBoundInCurrentFLWORExpression()); result.add(_variableName); return result; } public void print(StringBuffer buffer, int indent) { super.print(buffer, indent); for (int i = 0; i < indent + 1; ++i) { buffer.append(" "); } buffer.append("Variable " + _variableName); buffer.append("\n"); } >>>>>>> @Override public Dataset<Row> getDataFrame(DynamicContext context) { if (this._child == null) { throw new SparksoniqRuntimeException("Invalid count clause."); } Dataset<Row> df = _child.getDataFrame(context); StructType inputSchema = df.schema(); int duplicateVariableIndex = Arrays.asList(inputSchema.fieldNames()).indexOf(_variableName); String selectSQL = DataFrameUtils.getSQL(inputSchema, duplicateVariableIndex, true); Dataset<Row> dfWithIndex = DataFrameUtils.zipWithIndex(df, new Long(1), _variableName); df.sparkSession().udf().register("serializeCountIndex", new CountClauseSerializeUDF(), DataTypes.BinaryType); dfWithIndex.createOrReplaceTempView("input"); dfWithIndex = dfWithIndex.sparkSession().sql( String.format("select %s serializeCountIndex(`%s`) as `%s` from input", selectSQL, _variableName, _variableName) ); return dfWithIndex; } public Set<String> getVariableDependencies() { Set<String> result = new HashSet<String>(); result.addAll(_child.getVariableDependencies()); return result; } public Set<String> getVariablesBoundInCurrentFLWORExpression() { Set<String> result = new HashSet<String>(); result.addAll(_child.getVariablesBoundInCurrentFLWORExpression()); result.add(_variableName); return result; } public void print(StringBuffer buffer, int indent) { super.print(buffer, indent); for (int i = 0; i < indent + 1; ++i) { buffer.append(" "); } buffer.append("Variable " + _variableName); buffer.append("\n"); }
<<<<<<< import sparksoniq.exceptions.IteratorFlowException; import sparksoniq.exceptions.UnexpectedTypeException; import sparksoniq.jsoniq.compiler.translator.expr.operational.base.OperationalExpressionBase; import sparksoniq.jsoniq.runtime.metadata.IteratorMetadata; import sparksoniq.semantics.types.SingleType; ======= >>>>>>> import sparksoniq.exceptions.IteratorFlowException; import sparksoniq.exceptions.UnexpectedTypeException; import sparksoniq.jsoniq.compiler.translator.expr.operational.base.OperationalExpressionBase; import sparksoniq.jsoniq.runtime.metadata.IteratorMetadata;
<<<<<<< import org.rumbledb.expressions.ExecutionMode; ======= import org.rumbledb.exceptions.MoreThanOneItemException; import org.rumbledb.exceptions.NoItemException; >>>>>>> import org.rumbledb.expressions.ExecutionMode; import org.rumbledb.exceptions.MoreThanOneItemException; import org.rumbledb.exceptions.NoItemException;
<<<<<<< /* * Copyright (C) 2012-2019 52°North Initiative for Geospatial Open Source ======= /** * Copyright (C) 2012-2020 52°North Initiative for Geospatial Open Source >>>>>>> /* * Copyright (C) 2012-2020 52°North Initiative for Geospatial Open Source
<<<<<<< import java.util.Arrays; ======= import java.util.HashSet; >>>>>>> import java.util.Arrays; import java.util.HashSet; <<<<<<< @Override public Dataset<Row> getDataFrame(DynamicContext context) { // if it's a starting clause if (this._child == null) { // create initial RDD from expression JavaRDD<Item> initialRdd = _expression.getRDD(context); // define a schema List<StructField> fields = new ArrayList<>(); StructField field = DataTypes.createStructField(_variableName, DataTypes.BinaryType, true); fields.add(field); StructType schema = DataTypes.createStructType(fields); JavaRDD<Row> rowRDD = initialRdd.map(new ForClauseSerializeClosure()); // apply the schema to row RDD return SparkSessionManager.getInstance().getOrCreateSession().createDataFrame(rowRDD, schema); } if (_child.isDataFrame()) { Dataset<Row> df = this._child.getDataFrame(context); StructType inputSchema = df.schema(); df.sparkSession().udf().register("forClauseUDF", new ForClauseUDF(_expression, inputSchema), DataTypes.createArrayType(DataTypes.BinaryType)); int duplicateVariableIndex = Arrays.asList(inputSchema.fieldNames()).indexOf(_variableName); String selectSQL = DataFrameUtils.getSQL(inputSchema, duplicateVariableIndex, true); String udfSQL = DataFrameUtils.getSQL(inputSchema, -1, false); df.createOrReplaceTempView("input"); df = df.sparkSession().sql( String.format("select %s explode(forClauseUDF(array(%s))) as `%s` from input", selectSQL, udfSQL, _variableName) ); return df; } // if child is locally evaluated // _expression is definitely an RDD if execution flows here Dataset<Row> df = null; _child.open(_currentDynamicContext); _tupleContext = new DynamicContext(_currentDynamicContext); // assign current context as parent while (_child.hasNext()) { _inputTuple = _child.next(); _tupleContext.removeAllVariables(); // clear the previous variables _tupleContext.setBindingsFromTuple(_inputTuple); // assign new variables from new tuple JavaRDD<Item> expressionRDD = _expression.getRDD(_tupleContext); // TODO - Optimization: Iterate schema creation only once Set<String> oldColumnNames = _inputTuple.getKeys(); List<String> newColumnNames = new ArrayList<>(); oldColumnNames.forEach(fieldName -> newColumnNames.add(fieldName)); newColumnNames.add(_variableName); List<StructField> fields = new ArrayList<>(); for (String columnName : newColumnNames) { StructField field = DataTypes.createStructField(columnName, DataTypes.BinaryType, true); fields.add(field); } StructType schema = DataTypes.createStructType(fields); JavaRDD<Row> rowRDD = expressionRDD.map(new ForClauseLocalToRowClosure(_inputTuple)); if (df == null) { df = SparkSessionManager.getInstance().getOrCreateSession().createDataFrame(rowRDD, schema); } else { df = df.union(SparkSessionManager.getInstance().getOrCreateSession().createDataFrame(rowRDD, schema)); } } _child.close(); return df; } ======= public Set<String> getVariableDependencies() { Set<String> result = new HashSet<String>(); result.addAll(_expression.getVariableDependencies()); if(_child != null) { result.removeAll(_child.getVariablesBoundInCurrentFLWORExpression()); result.addAll(_child.getVariableDependencies()); } return result; } public Set<String> getVariablesBoundInCurrentFLWORExpression() { Set<String> result = new HashSet<String>(); if(_child != null) { result.addAll(_child.getVariablesBoundInCurrentFLWORExpression()); } result.add(_variableName); return result; } public void print(StringBuffer buffer, int indent) { super.print(buffer, indent); for (int i = 0; i < indent + 1; ++i) { buffer.append(" "); } buffer.append("Variable " + _variableName); buffer.append("\n"); _expression.print(buffer, indent+1); } >>>>>>> @Override public Dataset<Row> getDataFrame(DynamicContext context) { // if it's a starting clause if (this._child == null) { // create initial RDD from expression JavaRDD<Item> initialRdd = _expression.getRDD(context); // define a schema List<StructField> fields = new ArrayList<>(); StructField field = DataTypes.createStructField(_variableName, DataTypes.BinaryType, true); fields.add(field); StructType schema = DataTypes.createStructType(fields); JavaRDD<Row> rowRDD = initialRdd.map(new ForClauseSerializeClosure()); // apply the schema to row RDD return SparkSessionManager.getInstance().getOrCreateSession().createDataFrame(rowRDD, schema); } if (_child.isDataFrame()) { Dataset<Row> df = this._child.getDataFrame(context); StructType inputSchema = df.schema(); df.sparkSession().udf().register("forClauseUDF", new ForClauseUDF(_expression, inputSchema), DataTypes.createArrayType(DataTypes.BinaryType)); int duplicateVariableIndex = Arrays.asList(inputSchema.fieldNames()).indexOf(_variableName); String selectSQL = DataFrameUtils.getSQL(inputSchema, duplicateVariableIndex, true); String udfSQL = DataFrameUtils.getSQL(inputSchema, -1, false); df.createOrReplaceTempView("input"); df = df.sparkSession().sql( String.format("select %s explode(forClauseUDF(array(%s))) as `%s` from input", selectSQL, udfSQL, _variableName) ); return df; } // if child is locally evaluated // _expression is definitely an RDD if execution flows here Dataset<Row> df = null; _child.open(_currentDynamicContext); _tupleContext = new DynamicContext(_currentDynamicContext); // assign current context as parent while (_child.hasNext()) { _inputTuple = _child.next(); _tupleContext.removeAllVariables(); // clear the previous variables _tupleContext.setBindingsFromTuple(_inputTuple); // assign new variables from new tuple JavaRDD<Item> expressionRDD = _expression.getRDD(_tupleContext); // TODO - Optimization: Iterate schema creation only once Set<String> oldColumnNames = _inputTuple.getKeys(); List<String> newColumnNames = new ArrayList<>(); oldColumnNames.forEach(fieldName -> newColumnNames.add(fieldName)); newColumnNames.add(_variableName); List<StructField> fields = new ArrayList<>(); for (String columnName : newColumnNames) { StructField field = DataTypes.createStructField(columnName, DataTypes.BinaryType, true); fields.add(field); } StructType schema = DataTypes.createStructType(fields); JavaRDD<Row> rowRDD = expressionRDD.map(new ForClauseLocalToRowClosure(_inputTuple)); if (df == null) { df = SparkSessionManager.getInstance().getOrCreateSession().createDataFrame(rowRDD, schema); } else { df = df.union(SparkSessionManager.getInstance().getOrCreateSession().createDataFrame(rowRDD, schema)); } } _child.close(); return df; } public Set<String> getVariableDependencies() { Set<String> result = new HashSet<String>(); result.addAll(_expression.getVariableDependencies()); if(_child != null) { result.removeAll(_child.getVariablesBoundInCurrentFLWORExpression()); result.addAll(_child.getVariableDependencies()); } return result; } public Set<String> getVariablesBoundInCurrentFLWORExpression() { Set<String> result = new HashSet<String>(); if(_child != null) { result.addAll(_child.getVariablesBoundInCurrentFLWORExpression()); } result.add(_variableName); return result; } public void print(StringBuffer buffer, int indent) { super.print(buffer, indent); for (int i = 0; i < indent + 1; ++i) { buffer.append(" "); } buffer.append("Variable " + _variableName); buffer.append("\n"); _expression.print(buffer, indent+1); }
<<<<<<< public abstract boolean isDataFrame(); public abstract Dataset<Row> getDataFrame(DynamicContext context); ======= /* * Variable dependencies are variables that MUST be provided in the dynamic context * for successful execution. * * These variables are: * 1. All variables that the expression of the clause depends on (recursive call of getVariableDependencies on the expression) * 2. Except those variables bound in the current FLWOR (obtained from the auxiliary method getVariablesBoundInCurrentFLWORExpression), because those are provided in the Tuples * 3.Plus (recursively calling getVariableDependencies) all the Variable Dependencies of the child clause if it exists. * */ public Set<String> getVariableDependencies() { Set<String> result = new HashSet<String>(); result.addAll(_child.getVariableDependencies()); return result; } >>>>>>> public abstract boolean isDataFrame(); public abstract Dataset<Row> getDataFrame(DynamicContext context); /* * Variable dependencies are variables that MUST be provided in the dynamic context * for successful execution. * * These variables are: * 1. All variables that the expression of the clause depends on (recursive call of getVariableDependencies on the expression) * 2. Except those variables bound in the current FLWOR (obtained from the auxiliary method getVariablesBoundInCurrentFLWORExpression), because those are provided in the Tuples * 3.Plus (recursively calling getVariableDependencies) all the Variable Dependencies of the child clause if it exists. * */ public Set<String> getVariableDependencies() { Set<String> result = new HashSet<String>(); result.addAll(_child.getVariableDependencies()); return result; }
<<<<<<< import sparksoniq.exceptions.UnexpectedTypeException; import sparksoniq.jsoniq.compiler.translator.expr.operational.base.OperationalExpressionBase; import sparksoniq.jsoniq.runtime.metadata.IteratorMetadata; import sparksoniq.semantics.types.SingleType; ======= >>>>>>> import sparksoniq.exceptions.UnexpectedTypeException; import sparksoniq.jsoniq.compiler.translator.expr.operational.base.OperationalExpressionBase; import sparksoniq.jsoniq.runtime.metadata.IteratorMetadata; <<<<<<< if (type.getType() == AtomicTypes.IntegerItem) { Integer.parseInt(this._value); } else if (type.getType() == AtomicTypes.DecimalItem) { if (this._value.contains("e") || this._value.contains("E")) return false; Float.parseFloat(this._value); } else if (type.getType() == AtomicTypes.DoubleItem) { Double.parseDouble(this._value); } else if (type.getType() == AtomicTypes.NullItem) { return isNullLiteral(this._value); } else if (type.getType() == AtomicTypes.DurationItem) { DurationItem.getDurationFromString(this._value, AtomicTypes.DurationItem); ======= if (itemType == AtomicTypes.IntegerItem) { Integer.parseInt(this.getValue()); } else if (itemType == AtomicTypes.DecimalItem) { if (this.getValue().contains("e") || this.getValue().contains("E")) return false; Float.parseFloat(this.getValue()); } else if (itemType == AtomicTypes.DoubleItem) { Double.parseDouble(this.getValue()); } else if (itemType == AtomicTypes.NullItem) { return isNullLiteral(this.getValue()); >>>>>>> if (itemType == AtomicTypes.IntegerItem) { Integer.parseInt(this.getValue()); } else if (itemType == AtomicTypes.DecimalItem) { if (this.getValue().contains("e") || this.getValue().contains("E")) return false; Float.parseFloat(this.getValue()); } else if (itemType == AtomicTypes.DoubleItem) { Double.parseDouble(this.getValue()); } else if (itemType == AtomicTypes.NullItem) { return isNullLiteral(this.getValue()); } else if (itemType == AtomicTypes.DurationItem) { DurationItem.getDurationFromString(this._value, AtomicTypes.DurationItem); <<<<<<< else return isBooleanLiteral(this._value); } catch (IllegalArgumentException e) { ======= else return isBooleanLiteral(this.getValue()); } catch (NumberFormatException e) { >>>>>>> else return isBooleanLiteral(this.getValue()); } catch (NumberFormatException e) { <<<<<<< public boolean isString() { return true; } @Override public AtomicItem castAs(AtomicItem atomicItem) { return atomicItem.createFromString(this); } @Override public AtomicItem createFromBoolean(BooleanItem booleanItem) { return ItemFactory.getInstance().createStringItem(String.valueOf(booleanItem.getBooleanValue())); } @Override public AtomicItem createFromString(StringItem stringItem) { return stringItem; } @Override public AtomicItem createFromInteger(IntegerItem integerItem) { return ItemFactory.getInstance().createStringItem(String.valueOf(integerItem.getIntegerValue())); } @Override public AtomicItem createFromDecimal(DecimalItem decimalItem) { return ItemFactory.getInstance().createStringItem(String.valueOf(decimalItem.getDecimalValue())); } @Override public AtomicItem createFromDouble(DoubleItem doubleItem) { return ItemFactory.getInstance().createStringItem(String.valueOf(doubleItem.getDoubleValue())); } @Override public AtomicItem createFromDuration(DurationItem durationItem) { return ItemFactory.getInstance().createStringItem(durationItem.serialize()); } @Override ======= >>>>>>> public Item castAs(AtomicTypes itemType) { switch (itemType) { case BooleanItem: return ItemFactory.getInstance().createBooleanItem(Boolean.parseBoolean(this.getStringValue())); case DoubleItem: return ItemFactory.getInstance().createDoubleItem(Double.parseDouble(this.getStringValue())); case DecimalItem: return ItemFactory.getInstance().createDecimalItem(new BigDecimal(this.getStringValue())); case IntegerItem: return ItemFactory.getInstance().createIntegerItem(Integer.parseInt(this.getStringValue())); case NullItem: return ItemFactory.getInstance().createNullItem(); case DurationItem: return ItemFactory.getInstance().createDurationItem(DurationItem.getDurationFromString(this.getStringValue(), AtomicTypes.DurationItem)); case StringItem: return this; default: throw new ClassCastException(); } } public boolean getEffectiveBooleanValue() { return !this.getStringValue().isEmpty(); } @Override public boolean isTypeOf(ItemType type) { return type.getType().equals(ItemTypes.StringItem) || super.isTypeOf(type); } @Override public boolean isCastableAs(AtomicTypes itemType) { if (itemType == AtomicTypes.StringItem) return true; try { if (itemType == AtomicTypes.IntegerItem) { Integer.parseInt(this.getValue()); } else if (itemType == AtomicTypes.DecimalItem) { if (this.getValue().contains("e") || this.getValue().contains("E")) return false; Float.parseFloat(this.getValue()); } else if (itemType == AtomicTypes.DoubleItem) { Double.parseDouble(this.getValue()); } else if (itemType == AtomicTypes.NullItem) { return isNullLiteral(this.getValue()); } else if (itemType == AtomicTypes.DurationItem) { DurationItem.getDurationFromString(this._value, AtomicTypes.DurationItem); } else return isBooleanLiteral(this.getValue()); } catch (NumberFormatException e) { return false; } return true; }
<<<<<<< import sparksoniq.jsoniq.compiler.translator.metadata.ExpressionMetadata; import sparksoniq.semantics.visitor.AbstractNodeVisitor; ======= import sparksoniq.semantics.visitor.AbstractExpressionOrClauseVisitor; >>>>>>> import sparksoniq.semantics.visitor.AbstractNodeVisitor;
<<<<<<< import sparksoniq.jsoniq.runtime.iterator.primary.VariableReferenceIterator; ======= import sparksoniq.jsoniq.runtime.iterator.functions.base.LocalFunctionCallIterator; >>>>>>> import sparksoniq.jsoniq.runtime.iterator.primary.VariableReferenceIterator; import sparksoniq.jsoniq.runtime.iterator.functions.base.LocalFunctionCallIterator;
<<<<<<< return ItemFactory.getInstance().createDateItem(DateTimeItem.getDateTimeFromString(this.getStringValue(), AtomicTypes.DateItem)); case TimeItem: return ItemFactory.getInstance().createDateTimeItem(DateTimeItem.getDateTimeFromString(this.getStringValue(), AtomicTypes.TimeItem)); ======= return ItemFactory.getInstance().createDateItem(this.getStringValue()); >>>>>>> return ItemFactory.getInstance().createDateItem(this.getStringValue()); case TimeItem: return ItemFactory.getInstance().createTimeItem(this.getStringValue()); <<<<<<< DateTimeItem.getDateTimeFromString(this.getValue(), AtomicTypes.DateItem); } else if (itemType == AtomicTypes.TimeItem) { DateTimeItem.getDateTimeFromString(this.getValue(), AtomicTypes.TimeItem); ======= DateTimeItem.parseDateTime(this.getValue(), AtomicTypes.DateItem); >>>>>>> DateTimeItem.parseDateTime(this.getValue(), AtomicTypes.DateItem); } else if (itemType == AtomicTypes.TimeItem) { DateTimeItem.parseDateTime(this.getValue(), AtomicTypes.TimeItem);
<<<<<<< * Visit a parse tree produced by {@link JsoniqParser#keyWordDuration}. * @param ctx the parse tree * @return the visitor result */ T visitKeyWordDuration(JsoniqParser.KeyWordDurationContext ctx); /** ======= * Visit a parse tree produced by {@link JsoniqParser#keyWordHexBinary}. * @param ctx the parse tree * @return the visitor result */ T visitKeyWordHexBinary(JsoniqParser.KeyWordHexBinaryContext ctx); /** >>>>>>> * Visit a parse tree produced by {@link JsoniqParser#keyWordDuration}. * @param ctx the parse tree * @return the visitor result */ T visitKeyWordDuration(JsoniqParser.KeyWordDurationContext ctx); /** * Visit a parse tree produced by {@link JsoniqParser#keyWordHexBinary}. * @param ctx the parse tree * @return the visitor result */ T visitKeyWordHexBinary(JsoniqParser.KeyWordHexBinaryContext ctx); /**
<<<<<<< import sparksoniq.jsoniq.runtime.iterator.functions.io.JsonDocFunctionIterator; ======= import sparksoniq.jsoniq.runtime.iterator.functions.datetime.DateFunctionIterator; import sparksoniq.jsoniq.runtime.iterator.functions.datetime.DateTimeFunctionIterator; import sparksoniq.jsoniq.runtime.iterator.functions.datetime.TimeFunctionIterator; import sparksoniq.jsoniq.runtime.iterator.functions.datetime.components.*; >>>>>>> import sparksoniq.jsoniq.runtime.iterator.functions.io.JsonDocFunctionIterator; import sparksoniq.jsoniq.runtime.iterator.functions.datetime.DateFunctionIterator; import sparksoniq.jsoniq.runtime.iterator.functions.datetime.DateTimeFunctionIterator; import sparksoniq.jsoniq.runtime.iterator.functions.datetime.TimeFunctionIterator; import sparksoniq.jsoniq.runtime.iterator.functions.datetime.components.*; <<<<<<< import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.ABS; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.ACCUMULATE; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.ACOS; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.ASIN; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.ATAN; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.ATAN2; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.AVG; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.BASE64BINARY; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.BOOLEAN; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.CEILING; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.CONCAT; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.CONTAINS; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.COS; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.COUNT; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.DAYTIMEDURATION; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.DEEPEQUAL; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.DESCENDANTARRAYS; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.DESCENDANTOBJECTS; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.DESCENDANTPAIRS; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.DISTINCTVALUES; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.DURATION; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.EMPTY; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.ENDSWITH; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.EXACTLYONE; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.EXISTS; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.EXP; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.EXP10; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.FLATTEN; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.FLOOR; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.HEAD; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.HEXBINARY; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.INDEXOF; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.INSERTBEFORE; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.INTERSECT; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.JSON_FILE; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.JSON_DOC; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.KEYS; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.LOG; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.LOG10; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.MATCHES; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.MAX; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.MEMBERS; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.MIN; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.NORMALIZESPACE; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.NULL; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.ONEORMORE; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.PARALLELIZE; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.PI; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.POW; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.PROJECT; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.REMOVE; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.REMOVEKEYS; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.REVERSE; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.ROUND; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.ROUNDHALFTOEVEN; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.SIN; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.SIZE; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.SQRT; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.STARTSWITH; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.STRINGJOIN; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.STRINGLENGTH; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.SUBSEQUENCE; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.SUBSTRING; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.SUBSTRING_AFTER; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.SUBSTRING_BEFORE; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.SUM; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.TAIL; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.TAN; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.TEXT_FILE; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.TOKENIZE; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.VALUES; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.YEARMONTHDURATION; import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.ZEROORONE; ======= import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.*; >>>>>>> import static sparksoniq.jsoniq.runtime.iterator.functions.base.Functions.FunctionNames.*;
<<<<<<< import java.util.Arrays; ======= import java.util.HashSet; >>>>>>> import java.util.Arrays; import java.util.HashSet; <<<<<<< @Override public Dataset<Row> getDataFrame(DynamicContext context) { //if it's not a start clause if (this._child != null) { Dataset<Row> df = _child.getDataFrame(context); StructType inputSchema = df.schema(); df.sparkSession().udf().register("letClauseUDF", new LetClauseUDF(_expression, inputSchema), DataTypes.BinaryType); int duplicateVariableIndex = Arrays.asList(inputSchema.fieldNames()).indexOf(_variableName); String selectSQL = DataFrameUtils.getSQL(inputSchema, duplicateVariableIndex, true); String udfSQL = DataFrameUtils.getSQL(inputSchema, -1, false); df.createOrReplaceTempView("input"); df = df.sparkSession().sql( String.format("select %s letClauseUDF(array(%s)) as `%s` from input", selectSQL, udfSQL, _variableName) ); return df; } throw new SparksoniqRuntimeException("Initial letClauses don't support DataFrames"); } ======= public Set<String> getVariableDependencies() { Set<String> result = new HashSet<String>(); result.addAll(_expression.getVariableDependencies()); if(_child != null) { result.removeAll(_child.getVariablesBoundInCurrentFLWORExpression()); result.addAll(_child.getVariableDependencies()); } return result; } public Set<String> getVariablesBoundInCurrentFLWORExpression() { Set<String> result = new HashSet<String>(); if(_child != null) { result.addAll(_child.getVariablesBoundInCurrentFLWORExpression()); } result.add(_variableName); return result; } public void print(StringBuffer buffer, int indent) { super.print(buffer, indent); for (int i = 0; i < indent + 1; ++i) { buffer.append(" "); } buffer.append("Variable " + _variableName); buffer.append("\n"); _expression.print(buffer, indent+1); } >>>>>>> @Override public Dataset<Row> getDataFrame(DynamicContext context) { //if it's not a start clause if (this._child != null) { Dataset<Row> df = _child.getDataFrame(context); StructType inputSchema = df.schema(); df.sparkSession().udf().register("letClauseUDF", new LetClauseUDF(_expression, inputSchema), DataTypes.BinaryType); int duplicateVariableIndex = Arrays.asList(inputSchema.fieldNames()).indexOf(_variableName); String selectSQL = DataFrameUtils.getSQL(inputSchema, duplicateVariableIndex, true); String udfSQL = DataFrameUtils.getSQL(inputSchema, -1, false); df.createOrReplaceTempView("input"); df = df.sparkSession().sql( String.format("select %s letClauseUDF(array(%s)) as `%s` from input", selectSQL, udfSQL, _variableName) ); return df; } throw new SparksoniqRuntimeException("Initial letClauses don't support DataFrames"); } public Set<String> getVariableDependencies() { Set<String> result = new HashSet<String>(); result.addAll(_expression.getVariableDependencies()); if(_child != null) { result.removeAll(_child.getVariablesBoundInCurrentFLWORExpression()); result.addAll(_child.getVariableDependencies()); } return result; } public Set<String> getVariablesBoundInCurrentFLWORExpression() { Set<String> result = new HashSet<String>(); if(_child != null) { result.addAll(_child.getVariablesBoundInCurrentFLWORExpression()); } result.add(_variableName); return result; } public void print(StringBuffer buffer, int indent) { super.print(buffer, indent); for (int i = 0; i < indent + 1; ++i) { buffer.append(" "); } buffer.append("Variable " + _variableName); buffer.append("\n"); _expression.print(buffer, indent+1); }
<<<<<<< setState(157); _errHandler.sync(this); ======= setState(153); >>>>>>> setState(157); <<<<<<< setState(219); _errHandler.sync(this); ======= setState(215); >>>>>>> setState(219); <<<<<<< match(T__1); setState(237); _errHandler.sync(this); ======= >>>>>>> match(T__1); setState(237); <<<<<<< setState(249); _errHandler.sync(this); ======= setState(245); >>>>>>> setState(249); <<<<<<< setState(256); _errHandler.sync(this); ======= setState(252); >>>>>>> setState(256); <<<<<<< setState(265); _errHandler.sync(this); ======= setState(261); >>>>>>> setState(265); <<<<<<< setState(263); _errHandler.sync(this); ======= setState(259); >>>>>>> setState(263); <<<<<<< setState(276); _errHandler.sync(this); ======= setState(272); >>>>>>> setState(276); <<<<<<< setState(281); _errHandler.sync(this); ======= setState(277); >>>>>>> setState(281); <<<<<<< setState(288); _errHandler.sync(this); ======= setState(284); >>>>>>> setState(288); <<<<<<< setState(294); _errHandler.sync(this); ======= setState(290); >>>>>>> setState(294); <<<<<<< setState(301); _errHandler.sync(this); ======= setState(297); >>>>>>> setState(301); <<<<<<< setState(327); _errHandler.sync(this); ======= setState(323); >>>>>>> setState(327); <<<<<<< setState(335); _errHandler.sync(this); ======= setState(331); >>>>>>> setState(335); <<<<<<< setState(355); _errHandler.sync(this); ======= setState(351); >>>>>>> setState(355); <<<<<<< setState(359); _errHandler.sync(this); ======= setState(355); >>>>>>> setState(359); <<<<<<< setState(363); _errHandler.sync(this); ======= setState(359); >>>>>>> setState(363); <<<<<<< setState(380); _errHandler.sync(this); ======= setState(376); >>>>>>> setState(380); <<<<<<< setState(405); _errHandler.sync(this); ======= setState(401); >>>>>>> setState(405); <<<<<<< setState(401); _errHandler.sync(this); ======= setState(397); >>>>>>> setState(401); <<<<<<< setState(409); _errHandler.sync(this); ======= setState(405); >>>>>>> setState(409); <<<<<<< setState(416); _errHandler.sync(this); ======= setState(412); >>>>>>> setState(416); <<<<<<< setState(429); _errHandler.sync(this); ======= setState(425); >>>>>>> setState(429); <<<<<<< setState(436); _errHandler.sync(this); ======= setState(432); >>>>>>> setState(436); <<<<<<< setState(434); _errHandler.sync(this); ======= setState(430); >>>>>>> setState(434); <<<<<<< setState(440); _errHandler.sync(this); ======= setState(436); >>>>>>> setState(440); <<<<<<< setState(447); _errHandler.sync(this); ======= setState(443); >>>>>>> setState(447); <<<<<<< setState(463); _errHandler.sync(this); ======= setState(459); >>>>>>> setState(463); <<<<<<< setState(501); _errHandler.sync(this); ======= setState(497); >>>>>>> setState(501); <<<<<<< match(Kcase); setState(510); _errHandler.sync(this); ======= >>>>>>> match(Kcase); setState(510); <<<<<<< setState(566); _errHandler.sync(this); ======= setState(562); >>>>>>> setState(566); <<<<<<< setState(673); _errHandler.sync(this); ======= setState(669); >>>>>>> setState(673); <<<<<<< setState(685); _errHandler.sync(this); ======= setState(681); >>>>>>> setState(685); <<<<<<< setState(715); _errHandler.sync(this); ======= setState(710); >>>>>>> setState(715); <<<<<<< setState(729); _errHandler.sync(this); ======= setState(724); >>>>>>> setState(729); <<<<<<< setState(740); _errHandler.sync(this); ======= setState(735); >>>>>>> setState(740); <<<<<<< setState(750); _errHandler.sync(this); ======= setState(745); >>>>>>> setState(750); <<<<<<< setState(768); _errHandler.sync(this); ======= setState(763); >>>>>>> setState(768); <<<<<<< setState(761); _errHandler.sync(this); ======= setState(756); >>>>>>> setState(761); <<<<<<< setState(773); _errHandler.sync(this); ======= setState(768); >>>>>>> setState(773); <<<<<<< setState(786); match(T__66); ======= setState(772); _la = _input.LA(1); if ( !(((((_la - 62)) & ~0x3f) == 0 && ((1L << (_la - 62)) & ((1L << (T__61 - 62)) | (1L << (T__62 - 62)) | (1L << (T__63 - 62)) | (1L << (T__64 - 62)) | (1L << (T__65 - 62)) | (1L << (T__66 - 62)) | (1L << (NullLiteral - 62)))) != 0)) ) { _errHandler.recoverInline(this); } else { consume(); >>>>>>> setState(777); match(T__61); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; } public static class AtomicTypeContext extends ParserRuleContext { public KeyWordBooleanContext keyWordBoolean() { return getRuleContext(KeyWordBooleanContext.class,0); } public AtomicTypeContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } @Override public int getRuleIndex() { return RULE_atomicType; } @Override public <T> T accept(ParseTreeVisitor<? extends T> visitor) { if ( visitor instanceof JsoniqVisitor ) return ((JsoniqVisitor<? extends T>)visitor).visitAtomicType(this); else return visitor.visitChildren(this); } } public final AtomicTypeContext atomicType() throws RecognitionException { AtomicTypeContext _localctx = new AtomicTypeContext(_ctx, getState()); enterRule(_localctx, 134, RULE_atomicType); try { setState(786); switch (_input.LA(1)) { case T__62: enterOuterAlt(_localctx, 1); { setState(779); match(T__62); } break; case T__63: enterOuterAlt(_localctx, 2); { setState(780); match(T__63); } break; case T__64: enterOuterAlt(_localctx, 3); { setState(781); match(T__64); } break; case T__65: enterOuterAlt(_localctx, 4); { setState(782); match(T__65); } break; case T__66: enterOuterAlt(_localctx, 5); { setState(783); match(T__66); } break; case T__61: enterOuterAlt(_localctx, 6); { setState(784); keyWordBoolean(); } break; case NullLiteral: enterOuterAlt(_localctx, 7); { setState(785); match(NullLiteral); } break; default: throw new NoViableAltException(this);
<<<<<<< YearMonthDurationItem, DayTimeDurationItem, DateTimeItem, DateItem, HexBinaryItem, Base64BinaryItem, FunctionItem, ======= YearMonthDurationItem, DayTimeDurationItem, DateTimeItem, DateItem, TimeItem, >>>>>>> YearMonthDurationItem, DayTimeDurationItem, DateTimeItem, DateItem, HexBinaryItem, Base64BinaryItem, TimeItem, FunctionItem, <<<<<<< if (!itemPostfix.equals(fullTypeName) && fullTypeName.endsWith("Item")) { return Character.toLowerCase(fullTypeName.charAt(0)) + fullTypeName.substring(1, fullTypeName.length()-itemPostfix.length()); ======= if (fullTypeName.endsWith("Item")) { return Character.toLowerCase(fullTypeName.charAt(0)) + fullTypeName.substring(1, fullTypeName.length()-itemPostfix.length()); >>>>>>> if (!itemPostfix.equals(fullTypeName) && fullTypeName.endsWith("Item")) { return Character.toLowerCase(fullTypeName.charAt(0)) + fullTypeName.substring(1, fullTypeName.length()-itemPostfix.length());
<<<<<<< public class ForClauseUDF implements UDF1<WrappedArray, List<byte[]>> { /** * */ private static final long serialVersionUID = 1L; private RuntimeIterator _expression; private StructType _inputSchema; ======= public class ForClauseUDF implements UDF1<WrappedArray, List> { private RuntimeIterator _expression; >>>>>>> public class ForClauseUDF implements UDF1<WrappedArray, List> { /** * */ private static final long serialVersionUID = 1L; private RuntimeIterator _expression;
<<<<<<< } else if (ex instanceof RumbleException) { System.err.println("⚠️ ️" + ex.getMessage()); ======= } else if (ex instanceof SparksoniqRuntimeException) { System.err.println("⚠️ ️" + ANSIColor.RED + ex.getMessage() + ANSIColor.RESET); >>>>>>> } else if (ex instanceof RumbleException) { System.err.println("⚠️ ️" + ANSIColor.RED + ex.getMessage() + ANSIColor.RESET);
<<<<<<< import sparksoniq.jsoniq.runtime.iterator.functions.io.JsonDocFunctionIterator; ======= import sparksoniq.jsoniq.runtime.iterator.functions.durations.DayTimeDurationFunctionIterator; import sparksoniq.jsoniq.runtime.iterator.functions.durations.DurationFunctionIterator; import sparksoniq.jsoniq.runtime.iterator.functions.durations.YearMonthDurationFunctionIterator; >>>>>>> import sparksoniq.jsoniq.runtime.iterator.functions.io.JsonDocFunctionIterator; import sparksoniq.jsoniq.runtime.iterator.functions.durations.DayTimeDurationFunctionIterator; import sparksoniq.jsoniq.runtime.iterator.functions.durations.DurationFunctionIterator; import sparksoniq.jsoniq.runtime.iterator.functions.durations.YearMonthDurationFunctionIterator;
<<<<<<< import sparksoniq.jsoniq.compiler.translator.expr.operational.base.OperationalExpressionBase; import org.rumbledb.exceptions.ExceptionMetadata; ======= import org.rumbledb.expressions.operational.base.OperationalExpressionBase; import sparksoniq.jsoniq.runtime.metadata.IteratorMetadata; >>>>>>> import org.rumbledb.exceptions.ExceptionMetadata; import org.rumbledb.expressions.operational.base.OperationalExpressionBase;
<<<<<<< import sparksoniq.jsoniq.compiler.translator.metadata.ExpressionMetadata; import sparksoniq.semantics.visitor.AbstractNodeVisitor; ======= import sparksoniq.semantics.visitor.AbstractExpressionOrClauseVisitor; >>>>>>> import sparksoniq.semantics.visitor.AbstractNodeVisitor;
<<<<<<< import org.rumbledb.shell.RumbleJLineShell; import sparksoniq.exceptions.OurBadException; import sparksoniq.exceptions.SparksoniqRuntimeException; ======= import org.rumbledb.exceptions.OurBadException; import org.rumbledb.exceptions.SparksoniqRuntimeException; import sparksoniq.io.shell.JiqsJLineShell; >>>>>>> import org.rumbledb.shell.RumbleJLineShell; import org.rumbledb.exceptions.OurBadException; import org.rumbledb.exceptions.SparksoniqRuntimeException;
<<<<<<< ======= import java.io.IOException; import java.math.BigDecimal; >>>>>>> import java.io.IOException;
<<<<<<< ======= >>>>>>> <<<<<<< ======= public void loadScenarioFromXml(String scenario) { String xmlFileName = "/sim/" + scenario + ".xml"; inputData.setProjectName(xmlFileName); initializeModel(); } public void resetWthParams() { } >>>>>>> public void loadScenarioFromXml(String scenario) { String xmlFileName = "/sim/" + scenario + ".xml"; inputData.setProjectName(xmlFileName); initializeModel(); } <<<<<<< // public double getMainroadInflow() { // // TODO Auto-generated method stub // return 0; // } // // // public double getRampInflow() { // // TODO Auto-generated method stub // return 0; // } ======= >>>>>>> // public double getMainroadInflow() { // // TODO Auto-generated method stub // return 0; // } // // // public double getRampInflow() { // // TODO Auto-generated method stub // return 0; // }
<<<<<<< import org.movsim.scenario.boundary.autogen.BoundaryConditionsType; ======= import org.movsim.shutdown.ShutdownHooks; import org.movsim.simulator.observer.ServiceProviders; import org.movsim.simulator.roadnetwork.InitialConditionsMacro; import org.movsim.simulator.roadnetwork.LaneSegment; import org.movsim.simulator.roadnetwork.Lanes; >>>>>>> import org.movsim.shutdown.ShutdownHooks; import org.movsim.simulator.observer.ServiceProviders; import org.movsim.simulator.roadnetwork.LaneSegment; import org.movsim.simulator.roadnetwork.Lanes; <<<<<<< import org.movsim.xml.InputLoader; ======= import org.movsim.utilities.Units; >>>>>>> import org.movsim.xml.InputLoader; <<<<<<< private final ProjectMetaData projectMetaData; ======= // private final ProjectMetaData.getInstance() ProjectMetaData.getInstance(); >>>>>>> private final ProjectMetaData projectMetaData; <<<<<<< private Movsim movsimInput; ======= private final Movsim inputData; >>>>>>> private Movsim movsimInput; <<<<<<< projectName = projectMetaData.getProjectName(); // TODO temporary handling of Variable Message Sign until added to XML roadNetwork.setHasVariableMessageSign(projectName.startsWith("routing")); movsimInput = InputLoader.unmarshallMovsim(projectMetaData.getInputFile()); ======= projectName = ProjectMetaData.getInstance().getProjectName(); >>>>>>> projectName = projectMetaData.getProjectName(); movsimInput = InputLoader.unmarshallMovsim(projectMetaData.getInputFile()); <<<<<<< projectMetaData.setXodrNetworkFilename(movsimInput.getScenario().getNetworkFilename()); // TODO ======= ProjectMetaData.getInstance().setXodrNetworkFilename(inputData.getScenario().getNetworkFilename()); // TODO >>>>>>> projectMetaData.setXodrNetworkFilename(movsimInput.getScenario().getNetworkFilename()); // TODO <<<<<<< File networkFile = projectMetaData.getFile(projectMetaData.getXodrNetworkFilename()); LOG.info("try to load {}", networkFile); final boolean loaded = OpenDriveReader.loadRoadNetwork(roadNetwork, networkFile); LOG.info("done with parsing road network {}. Success: {}", networkFile, loaded); ======= final String xodrFileName = ProjectMetaData.getInstance().getXodrNetworkFilename(); final String xodrPath = ProjectMetaData.getInstance().getPathToProjectFile(); final String fullXodrFileName = xodrPath + xodrFileName; LOG.info("try to load {}", fullXodrFileName); final boolean loaded = OpenDriveReader.loadRoadNetwork(roadNetwork, fullXodrFileName); LOG.info("done with parsing road network {}. Success: {}", fullXodrFileName, loaded); >>>>>>> File networkFile = projectMetaData.getFile(projectMetaData.getXodrNetworkFilename()); LOG.info("try to load {}", networkFile); final boolean loaded = OpenDriveReader.loadRoadNetwork(roadNetwork, networkFile); LOG.info("done with parsing road network {}. Success: {}", networkFile, loaded); <<<<<<< if (movsimInput.getScenario().isSetOutputConfiguration()) { simOutput = new SimulationOutput(simulationRunnable.timeStep(), projectMetaData.isInstantaneousFileOutput(), movsimInput.getScenario().getOutputConfiguration(), roadNetwork, routing, vehicleFactory); ======= if (inputData.getScenario().isSetOutputConfiguration()) { simOutput = new SimulationOutput(simulationRunnable.timeStep(), ProjectMetaData.getInstance() .isInstantaneousFileOutput(), inputData.getScenario().getOutputConfiguration(), roadNetwork, routing, vehicleFactory, serviceProviders); >>>>>>> if (movsimInput.getScenario().isSetOutputConfiguration()) { simOutput = new SimulationOutput(simulationRunnable.timeStep(), projectMetaData.isInstantaneousFileOutput(), movsimInput.getScenario().getOutputConfiguration(), roadNetwork, routing, vehicleFactory, serviceProviders); <<<<<<< ======= >>>>>>>
<<<<<<< * Returns the instantaneous travel time defined by the road element length and current mean speed of all vehicles. An adhoc * free speed is assumed in case of an empty road. * @return instantantaneous travel time with adhoc assumed travel time if road is empty ======= * Returns the instantaneous travel time defined by the road element length * and current mean speed of all vehicles. An adhoc free speed is assumed in * case of an empty road. An adhoc minimum speed is assumed in case of a * standstill to avoid a diverging traveltime. * * @return instantantaneous travel time with assumed travel time if road is * empty and with assumed maximum travel time in standstill >>>>>>> * Returns the instantaneous travel time defined by the road element length and current mean speed of all vehicles. An adhoc * free speed is assumed in case of an empty road. * * @return instantaneous travel time with adhoc assumed travel time if road is empty <<<<<<< public void setTrafficComposition(TrafficCompositionGenerator composition) { this.trafficComposition = composition; } public TrafficCompositionGenerator getTrafficComposition() { return trafficComposition; } public boolean hasTrafficComposition() { return trafficComposition != null; } ======= public double getFreeFlowSpeed() { return freeFlowSpeed; } public void setFreeFlowSpeed(double freeFlowSpeed) { this.freeFlowSpeed = freeFlowSpeed; } >>>>>>> public void setTrafficComposition(TrafficCompositionGenerator composition) { this.trafficComposition = composition; } public TrafficCompositionGenerator getTrafficComposition() { return trafficComposition; } public boolean hasTrafficComposition() { return trafficComposition != null; } public double getFreeFlowSpeed() { return freeFlowSpeed; } public void setFreeFlowSpeed(double freeFlowSpeed) { this.freeFlowSpeed = freeFlowSpeed; }
<<<<<<< import org.movsim.simulator.roadnetwork.Route; ======= import org.movsim.simulator.roadnetwork.routing.Route; import org.movsim.simulator.trafficlights.TrafficLightLocation; >>>>>>> import org.movsim.simulator.roadnetwork.routing.Route;
<<<<<<< /** * Calc acceleration balance in new lane symmetric. * * @param ownLane the own lane * @param newLane the new lane * @return the double */ public double calcAccelerationBalanceInNewLaneSymmetric(final VehicleContainer ownLane, final VehicleContainer newLane) { ======= private boolean safetyCheckGaps(double gapFront, double gapBack) { return ((gapFront < gapMin) || (gapBack < gapMin)); } >>>>>>> private boolean safetyCheckGaps(double gapFront, double gapBack) { return ((gapFront < gapMin) || (gapBack < gapMin)); } <<<<<<< /** * Gets the minimum gap. * * @return the minimum gap */ ======= >>>>>>> <<<<<<< /** * Gets the safe deceleration. * * @return the safe deceleration */ ======= >>>>>>>
<<<<<<< final void setSourceLaneSegmentForLane(LaneSegment sourceLaneSegment, int lane) { Preconditions.checkArgument(lane >= Lanes.LANE1 && lane <= laneCount, "lane=" + lane); ======= public final void setSourceLaneSegmentForLane(LaneSegment sourceLaneSegment, int lane) { Preconditions.checkArgument(lane >= Lanes.LANE1 && lane <= laneCount); >>>>>>> final void setSourceLaneSegmentForLane(LaneSegment sourceLaneSegment, int lane) { Preconditions.checkArgument(lane >= Lanes.LANE1 && lane <= laneCount, "lane=" + lane); <<<<<<< sb.append("internal id=").append(id); sb.append(", roadId=").append(roadId); ======= sb.append("roadID=").append(id); sb.append(", user roadID=").append(userId); >>>>>>> sb.append("internal id=").append(id); sb.append(", roadId=").append(userId); <<<<<<< @Override public String toString() { return "RoadSegment [id=" + id + ", roadId=" + roadId + ", roadLength=" + roadLength + ", laneCount=" + laneCount + ", vehicleCount=" + getVehicleCount() + "]"; } ======= >>>>>>>
<<<<<<< private static final Set<String> BASIC_TYPE_NAMES = new HashSet<String>(); private static final Set<String> INTEGER_TYPE_NAMES = new HashSet<String>(Arrays.asList("int", "long", "short", "byte")); static { for (Class<?> clazz : Primitives.allWrapperTypes()) { BASIC_TYPE_NAMES.add(clazz.getName()); } BASIC_TYPE_NAMES.add(String.class.getName()); } ======= >>>>>>> <<<<<<< /** * @return true if the type does not have a super class (or that the super class is java.lang.Object). It returns * true also for null types */ public static boolean isRootType(TypeWrapper type) { if (type == null) { return true; } TypeWrapper superClass = type.getSuperClass(); return superClass == null || superClass.equals(TypeWrappers.wrap(Object.class)); } /** * @param type * @return true if the given type is defined within another type */ public static boolean isInnerType(TypeWrapper type) { if (!(type instanceof ClassWrapper)) { return false; } ClassWrapper classWrapper = (ClassWrapper) type; return classWrapper.getDeclaringClass().isDefined(); } public static boolean isSyntheticType(TypeWrapper clazz) { if (!(clazz instanceof ClassWrapper)) { return false; } return isSyntheticType(((ClassWrapper) clazz).getClazz()); } @SuppressWarnings("deprecation") public static boolean isSyntheticType(Class<?> clazz) { return hasAnnotation(clazz, org.stjs.javascript.annotation.DataType.class) || hasAnnotation(clazz, SyntheticType.class); } public static boolean hasAnnotation(ClassWrapper clazz, Class<? extends Annotation> annotation) { if (clazz == null) { return false; } return hasAnnotation(clazz.getClazz(), annotation); } ======= >>>>>>> <<<<<<< /** * the namespace is taken from the outermost declaring class * * @param type * @return */ public static String getNamespace(TypeWrapper type) { if (!(type instanceof ClassWrapper)) { return null; } ClassWrapper outermost = (ClassWrapper) type; while (outermost.getDeclaringClass().isDefined()) { outermost = outermost.getDeclaringClass().getOrNull(); } Namespace n = getAnnotation(outermost, Namespace.class); if (n != null && !Strings.isNullOrEmpty(n.value())) { return n.value(); } return null; } public static <T extends Annotation> T getAnnotation(TypeWrapper clazz, Class<T> annotationClass) { if (!(clazz instanceof ClassWrapper)) { return null; } return getAnnotation(((ClassWrapper) clazz).getClazz(), annotationClass); } ======= >>>>>>> <<<<<<< public static boolean isAdapter(TypeWrapper clazz) { if (clazz == null) { return false; } return clazz.hasAnnotation(Adapter.class); } public static boolean isAdapter(Class<?> clazz) { if (clazz == null) { return false; } return hasAnnotation(clazz, Adapter.class); } public static boolean isJavascriptFunction(TypeWrapper clazz) { if (clazz == null) { return false; } return clazz.hasAnnotation(JavascriptFunction.class); } /** * @param resolvedType * @param arrayCount * @return the ClassWrapper representing an array of the given type with the given number of dimensions */ public static TypeWrapper arrayOf(TypeWrapper resolvedType, int arrayCount) { if (arrayCount == 0) { return resolvedType; } if (resolvedType.getClass() == ClassWrapper.class) { return new ClassWrapper(Array.newInstance((Class<?>) resolvedType.getType(), new int[arrayCount]).getClass()); } TypeWrapper returnType = resolvedType; for (int i = 0; i < arrayCount; ++i) { returnType = new GenericArrayTypeWrapper(new GenericArrayTypeImpl(returnType.getType())); } return returnType; } public static Method findDeclaredMethod(Class<?> clazz, String name) { for (Method m : clazz.getDeclaredMethods()) { if (m.getName().equals(name)) { return m; } } return null; } public static Constructor<?> findConstructor(Class<?> clazz) { if (clazz.getDeclaredConstructors().length != 0) { return clazz.getDeclaredConstructors()[0]; } return null; } public static boolean isAssignableFromType(final Class<?> cls, final java.lang.reflect.Type type) { if (type instanceof Class<?>) { return isAssignableFromClass(cls, (Class<?>) type); } if (type instanceof GenericArrayType) { return isAssignableFromGenericArrayType(cls, (GenericArrayType) type); } if (type instanceof ParameterizedType) { return isAssignableFromParameterizedType(cls, (ParameterizedType) type); } if (type instanceof TypeVariable<?>) { return isAssignableFromTypeVariable(cls, (TypeVariable<?>) type); } if (type instanceof WildcardType) { return isAssignableFromWildcardType(cls, (WildcardType) type); } throw new IllegalArgumentException("Unsupported type: " + type); } private static boolean isAssignableFromClass(final Class<?> cls, final Class<?> otherClass) { if (cls.isAssignableFrom(otherClass)) { return true; } // try primitives if (Primitives.wrap(cls).isAssignableFrom(Primitives.wrap(otherClass))) { return true; } // go on with primitive rules double/float -> accept long/int -> accept byte/char (but this only if there is // none more specific!) if (PrimitiveTypes.isAssignableFrom(cls, otherClass)) { return true; } return false; } private static boolean isAssignableFromGenericArrayType(final Class<?> cls, final GenericArrayType genericArrayType) { if (!cls.isArray()) { return false; } final java.lang.reflect.Type componentType = genericArrayType.getGenericComponentType(); return isAssignableFromType(cls.getComponentType(), componentType); } private static boolean isAssignableFromParameterizedType(final Class<?> cls, final ParameterizedType parameterizedType) { return isAssignableFromType(cls, parameterizedType.getRawType()); } private static boolean isAssignableFromTypeVariable(final Class<?> cls, final TypeVariable<?> typeVariable) { if (cls.equals(Object.class)) { return true; } return isAssignableFromUpperBounds(cls, typeVariable.getBounds()); } private static boolean isAssignableFromWildcardType(final Class<?> cls, final WildcardType wildcardType) { return isAssignableFromUpperBounds(cls, wildcardType.getUpperBounds()); } private static boolean isAssignableFromUpperBounds(final Class<?> cls, final java.lang.reflect.Type[] bounds) { for (java.lang.reflect.Type bound : bounds) { if (isAssignableFromType(cls, bound)) { return true; } } return false; } public static Class<?> getRawClazz(java.lang.reflect.Type type) { if (type instanceof Class<?>) { return (Class<?>) type; } if (type instanceof ParameterizedType) { return getRawClazz(((ParameterizedType) type).getRawType()); } if (type instanceof GenericArrayType) { return Object[].class; } // TODO what to do exacly here !? return Object.class; } ======= >>>>>>>
<<<<<<< import org.stjs.javascript.annotation.BrowserCompatibility; ======= import org.stjs.javascript.annotation.ServerSide; >>>>>>> import org.stjs.javascript.annotation.BrowserCompatibility; <<<<<<< * array.$set(key, value) => array[key]=value * * <p> * The documentation of this class is mostly adapted from the ECMAScript 5.1 Specification: * http://www.ecma-international.org/ecma-262/5.1/ * <p> * Browser compatibility information comes from: http://kangax.github.io/es5-compat-table * * @author acraciun, npiguet ======= * array.$set(key, value) => array[key]=value It is generally a bad idea for code written in ST-JS to create subclasses of Array, as that will * not be translated properly. However, it may be useful for some bridges. * @author acraciun >>>>>>> * array.$set(key, value) => array[key]=value It is generally a bad idea for code written in ST-JS to create subclasses of Array, as that will * not be translated properly. However, it may be useful for some bridges. * <p> * The documentation of this class is mostly adapted from the ECMAScript 5.1 Specification: * http://www.ecma-international.org/ecma-262/5.1/ * <p> * Browser compatibility information comes from: http://kangax.github.io/es5-compat-table * @author acraciun, npiguet <<<<<<< ======= private final List<V> array; >>>>>>> <<<<<<< if (index < 0) { // index is not an array index, so we'll look into the non-array element values return this.nonArrayElements.get(Integer.toString(index)); ======= if (index < 0 || index >= array.size()) { return null; >>>>>>> if (index < 0) { // index is not an array index, so we'll look into the non-array element values return this.nonArrayElements.get(Integer.toString(index)); <<<<<<< /** * Searches this <tt>Array</tt> for the specified item, and returns its position. Items are compared for equality * using the === operator. * * <p> * The search will start at the specified position and end the search at the end of the <tt>Array</tt>. * * <p> * Returns -1 if the item is not found. * * <p> * If the specified position is greater than or equal to the length of this <tt>array</tt>, this <tt>Array</tt> is * not searched and -1 is returned. If <tt>start</tt> is negative, it will be treated as <tt>length+start</tt>. If * the computed starting element is less than 0, this whole <tt>Array</tt> will be searched. * * <p> * If the item is present more than once, <tt>indexOf</tt> method returns the position of the first occurrence. * * @param element * the item to search for * @param start * where to start the search. Negative values will start at the given position counting from the end * @return the index at which the element was found, -1 if not found */ @BrowserCompatibility("IE:9+") public int indexOf(V element, int start) { long actualStart; if (start < 0) { actualStart = (long) Math.max(0, this.$length() + start); } else { actualStart = (long) Math.min(this.$length(), start); ======= public int indexOf(V element, int aStart) { int start = aStart >= 0 ? aStart : array.size() + aStart; if (start >= array.size()) { return -1; } int pos = array.subList(start, array.size()).indexOf(element); if (pos < 0) { return pos; >>>>>>> /** * Searches this <tt>Array</tt> for the specified item, and returns its position. Items are compared for equality * using the === operator. * * <p> * The search will start at the specified position and end the search at the end of the <tt>Array</tt>. * * <p> * Returns -1 if the item is not found. * * <p> * If the specified position is greater than or equal to the length of this <tt>array</tt>, this <tt>Array</tt> is * not searched and -1 is returned. If <tt>start</tt> is negative, it will be treated as <tt>length+start</tt>. If * the computed starting element is less than 0, this whole <tt>Array</tt> will be searched. * * <p> * If the item is present more than once, <tt>indexOf</tt> method returns the position of the first occurrence. * * @param element * the item to search for * @param start * where to start the search. Negative values will start at the given position counting from the end * @return the index at which the element was found, -1 if not found */ @BrowserCompatibility("IE:9+") long actualStart; if (start < 0) { actualStart = (long) Math.max(0, this.$length() + start); } else { actualStart = (long) Math.min(this.$length(), start); <<<<<<< /** * The elements of this <tt>Array</tt> are rearranged so as to reverse their order, and this <tt>Array</tt> is * returned. * * @return this <tt>Array</tt> */ public Array<V> reverse() { // Collections.reverse(array); // return this; return this; ======= public Array<V> reverse() { Collections.reverse(array); return this; >>>>>>> /** * The elements of this <tt>Array</tt> are rearranged so as to reverse their order, and this <tt>Array</tt> is * returned. * * @return this <tt>Array</tt> */ public Array<V> reverse() { // Collections.reverse(array); // return this; return this; <<<<<<< private final class PackedArrayStore<E> extends ArrayStore<E> { /** * We can't use <E> instead of <Object> here, because we must be able to make a difference between elements set * to null, and unset elements (represented by UNSET). */ private ArrayList<Object> elements = new ArrayList<Object>(); @Override boolean isEfficientStoreFor(long newLength, long newElementCount) { if (newLength > Integer.MAX_VALUE) { // PackedArrayStore cannot store values with index > Integer.MAX_VALUE return false; } if (newLength < 120) { // for small arrays, PackedArrayStore is always better // note that the threshold (120) intentionally doesn't match with the threshold defined in // SparseArrayStore.isEfficientStoreFor(), to make sure that we don't convert back and forth // between both types of ArrayStore return true; } if (newElementCount == 0 || (newLength / newElementCount) >= 6) { // if we have more than 5/6 unset elements, we're better off with SparseArrayStore // thresholds between the two ArrayStore types don't match: see length condition return false; } // we're good enough with the current store return true; } @Override void set(long index, E value) { this.elements.set((int) index, value); } @Override public void padTo(long newLength) { while (this.elements.size() < newLength) { this.elements.add(UNSET); } } @SuppressWarnings("unchecked") @Override E get(long index) { if (index > Integer.MAX_VALUE || index >= elements.size()) { return null; } Object value = this.elements.get((int) index); if (value == UNSET) { return null; } return (E) value; } @SuppressWarnings("unchecked") @Override Array<E> slice(long fromIncluded, long toExcluded) { Array<E> result = new Array<E>(); for (int i = (int) fromIncluded, n = 0; i < toExcluded && i < this.elements.size(); i++, n++) { Object value = this.elements.get(i); if (value != UNSET) { result.$set(n, (E) this.elements.get(i)); } } return result; } @Override boolean isSet(long index) { return index < this.elements.size() && this.elements.get((int) index) != UNSET; } @Override Iterator<Entry<E>> entryIterator(final long actualStart, final boolean isForward) { return new Iterator<Entry<E>>() { private int nextIndex = (int) actualStart; @Override public boolean hasNext() { skipToNext(); if (isForward) { return nextIndex < elements.size(); } else { return nextIndex >= 0; } } @Override public Entry<E> next() { skipToNext(); Entry<E> entry = new Entry<E>(); entry.key = nextIndex; entry.value = get(nextIndex); if (isForward) { nextIndex++; } else { nextIndex--; } return entry; } private void skipToNext() { if (isForward) { while (nextIndex < elements.size() && !isSet(nextIndex)) { nextIndex++; } } else { while (nextIndex >= 0 && !isSet(nextIndex)) { nextIndex--; } } } @Override public void remove() { throw new UnsupportedOperationException(); } }; } @Override long getSetElements(long firstIncluded, long lastExcluded) { int setElements = 0; for (int i = (int) firstIncluded; i < this.elements.size() && i < lastExcluded; i++) { if (this.elements.get(i) != UNSET) { setElements++; } } return setElements; } @Override void splice(long actualStart, long actualDeleteCount, E[] values) { // we must try to avoid splicing in 0(n^2) if possible // let's compute the cost of two different methods of splicing in number of moves long trailingElements = this.elements.size() - actualStart - actualDeleteCount; long inplaceCost = (long) Math.abs(actualDeleteCount - values.length) * trailingElements; long rebuildCost = this.elements.size() + values.length - actualDeleteCount; // execute the cheapest strategy. We give an unfair advantage to inplace, because rebuild has // uses more memory (2n), so we only want to pick it when it's really worth it if (inplaceCost > 2 * rebuildCost) { // Rebuild the underlying ArrayList from scratch. // add the head untouched elements ArrayList<Object> newElements = new ArrayList<Object>((int) rebuildCost); newElements.addAll(this.elements.subList(0, (int) actualStart)); // add the inserted elements newElements.addAll(Arrays.asList(values)); // add the trailing untouched elements newElements .addAll(this.elements.subList((int) (actualStart + actualDeleteCount), this.elements.size())); this.elements = newElements; ======= /** * this method does exactly as {@link #forEach(Callback1)}, but allows in java 8 the usage of lambda easily as the forEach method overloads * the method from the new Iterable interface. The generated code is, as expected, forEach * @param callback */ @Template("prefix") public void $forEach(Callback1<V> callback) { forEach(callback); } @Override public String toString() { // ArrayList.toString() look like this "[1, 2, 3, 4, 5]" (with spaces // between elements and enclosed in [] // but in Array.toString() must actually look like "1,2,3,4,5" (no spaces, // no []) StringBuilder builder = new StringBuilder(); boolean first = true; for (V item : array) { if (!first) { builder.append(","); >>>>>>> private final class PackedArrayStore<E> extends ArrayStore<E> { /** * We can't use <E> instead of <Object> here, because we must be able to make a difference between elements set * to null, and unset elements (represented by UNSET). */ private ArrayList<Object> elements = new ArrayList<Object>(); @Override boolean isEfficientStoreFor(long newLength, long newElementCount) { if (newLength > Integer.MAX_VALUE) { // PackedArrayStore cannot store values with index > Integer.MAX_VALUE return false; } if (newLength < 120) { // for small arrays, PackedArrayStore is always better // note that the threshold (120) intentionally doesn't match with the threshold defined in // SparseArrayStore.isEfficientStoreFor(), to make sure that we don't convert back and forth // between both types of ArrayStore return true; } if (newElementCount == 0 || (newLength / newElementCount) >= 6) { // if we have more than 5/6 unset elements, we're better off with SparseArrayStore // thresholds between the two ArrayStore types don't match: see length condition return false; } // we're good enough with the current store return true; } @Override void set(long index, E value) { this.elements.set((int) index, value); } @Override public void padTo(long newLength) { while (this.elements.size() < newLength) { this.elements.add(UNSET); } } @SuppressWarnings("unchecked") @Override E get(long index) { if (index > Integer.MAX_VALUE || index >= elements.size()) { return null; } Object value = this.elements.get((int) index); if (value == UNSET) { return null; } return (E) value; } @SuppressWarnings("unchecked") @Override Array<E> slice(long fromIncluded, long toExcluded) { Array<E> result = new Array<E>(); for (int i = (int) fromIncluded, n = 0; i < toExcluded && i < this.elements.size(); i++, n++) { Object value = this.elements.get(i); if (value != UNSET) { result.$set(n, (E) this.elements.get(i)); } } return result; } @Override boolean isSet(long index) { return index < this.elements.size() && this.elements.get((int) index) != UNSET; } @Override Iterator<Entry<E>> entryIterator(final long actualStart, final boolean isForward) { return new Iterator<Entry<E>>() { private int nextIndex = (int) actualStart; @Override public boolean hasNext() { skipToNext(); if (isForward) { return nextIndex < elements.size(); } else { return nextIndex >= 0; } } @Override public Entry<E> next() { skipToNext(); Entry<E> entry = new Entry<E>(); entry.key = nextIndex; entry.value = get(nextIndex); if (isForward) { nextIndex++; } else { nextIndex--; } return entry; } private void skipToNext() { if (isForward) { while (nextIndex < elements.size() && !isSet(nextIndex)) { nextIndex++; } } else { while (nextIndex >= 0 && !isSet(nextIndex)) { nextIndex--; } } } @Override public void remove() { throw new UnsupportedOperationException(); } }; } @Override long getSetElements(long firstIncluded, long lastExcluded) { int setElements = 0; for (int i = (int) firstIncluded; i < this.elements.size() && i < lastExcluded; i++) { if (this.elements.get(i) != UNSET) { setElements++; } } return setElements; } @Override void splice(long actualStart, long actualDeleteCount, E[] values) { // we must try to avoid splicing in 0(n^2) if possible // let's compute the cost of two different methods of splicing in number of moves long trailingElements = this.elements.size() - actualStart - actualDeleteCount; long inplaceCost = (long) Math.abs(actualDeleteCount - values.length) * trailingElements; long rebuildCost = this.elements.size() + values.length - actualDeleteCount; // execute the cheapest strategy. We give an unfair advantage to inplace, because rebuild has // uses more memory (2n), so we only want to pick it when it's really worth it if (inplaceCost > 2 * rebuildCost) { // Rebuild the underlying ArrayList from scratch. // add the head untouched elements ArrayList<Object> newElements = new ArrayList<Object>((int) rebuildCost); newElements.addAll(this.elements.subList(0, (int) actualStart)); // add the inserted elements newElements.addAll(Arrays.asList(values)); // add the trailing untouched elements newElements .addAll(this.elements.subList((int) (actualStart + actualDeleteCount), this.elements.size())); this.elements = newElements;
<<<<<<< import org.mockito.Mock; import org.mockito.Mockito; ======= import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; >>>>>>> import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import org.mockito.Mock; import org.mockito.Mockito; <<<<<<< private Account2FAHelper account2FAHelper = mock(Account2FAHelper.class); @Mock private AccountStatisticsService accountStatisticsService = Mockito.mock(AccountStatisticsService.class); ======= @Mock private Account2FAHelper account2FAHelper; private FirstLastIndexParser indexParser = new FirstLastIndexParser(100); >>>>>>> @Mock private Account2FAHelper account2FAHelper; private FirstLastIndexParser indexParser = new FirstLastIndexParser(100); @Mock private AccountStatisticsService accountStatisticsService = Mockito.mock(AccountStatisticsService.class); <<<<<<< orderService, restParametersParser, accountStatisticsService ======= orderService, indexParser >>>>>>> orderService, indexParser, accountStatisticsService
<<<<<<< .addBeans(MockBean.of(mock(TransactionVersionValidator.class), TransactionVersionValidator.class)) ======= .addBeans(MockBean.of(generatorService, GeneratorService.class)) >>>>>>> .addBeans(MockBean.of(generatorService, GeneratorService.class)) .addBeans(MockBean.of(mock(TransactionVersionValidator.class), TransactionVersionValidator.class))
<<<<<<< import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfigUpdater; import com.apollocurrency.aplwallet.apl.core.chainid.ChainsConfigHolder; ======= >>>>>>> import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfigUpdater; import com.apollocurrency.aplwallet.apl.core.chainid.ChainsConfigHolder; <<<<<<< import com.apollocurrency.aplwallet.apl.core.migrator.MigratorUtil; ======= import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfigUpdater; import com.apollocurrency.aplwallet.apl.core.chainid.ChainsConfigHolder; import com.apollocurrency.aplwallet.apl.core.migrator.MigratorUtil; import com.apollocurrency.aplwallet.apl.core.rest.endpoint.ServerInfoController; >>>>>>> import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfigUpdater; import com.apollocurrency.aplwallet.apl.core.chainid.ChainsConfigHolder; import com.apollocurrency.aplwallet.apl.core.migrator.MigratorUtil; import com.apollocurrency.aplwallet.apl.core.rest.endpoint.ServerInfoController; import com.apollocurrency.aplwallet.apl.core.migrator.MigratorUtil;
<<<<<<< import com.apollocurrency.aplwallet.apl.core.app.DatabaseManager; ======= import com.apollocurrency.aplwallet.apl.core.app.Db; import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextConfig; import com.apollocurrency.aplwallet.apl.util.StringValidator; >>>>>>> import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextConfig; import com.apollocurrency.aplwallet.apl.util.StringValidator; import com.apollocurrency.aplwallet.apl.core.app.DatabaseManager; <<<<<<< protected static DatabaseManager databaseManager; ======= // We should find better place for table init >>>>>>> protected static DatabaseManager databaseManager; // We should find better place for table init <<<<<<< if (databaseManager == null) databaseManager = CDI.current().select(DatabaseManager.class).get(); ======= FullTextConfig.getInstance().registerTable(table); >>>>>>> FullTextConfig.getInstance().registerTable(table); if (databaseManager == null) { databaseManager = CDI.current().select(DatabaseManager.class).get(); }
<<<<<<< databaseManager.getDataSource(); // retrieve again after migration to have it fresh for everyone ======= BlockchainConfigUpdater blockchainConfigUpdater = CDI.current().select(BlockchainConfigUpdater.class).get(); blockchainConfigUpdater.updateToLatestConfig(); // update config for migrated db dataSource = databaseManager.getDataSource(); // retrieve again after migration to have it fresh for everyone >>>>>>> BlockchainConfigUpdater blockchainConfigUpdater = CDI.current().select(BlockchainConfigUpdater.class).get(); blockchainConfigUpdater.updateToLatestConfig(); // update config for migrated db databaseManager.getDataSource(); // retrieve again after migration to have it fresh for everyone
<<<<<<< import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; ======= import com.apollocurrency.aplwallet.apl.core.db.TransactionalDb; import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextSearchService; >>>>>>> import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextSearchService; <<<<<<< public WeldInitiator weld = WeldInitiator.from(DbProperties.class, NtpTime.class, PropertiesHolder.class, BlockchainConfig.class, BlockchainImpl.class, DbConfig.class, Time.EpochTime.class, BlockDaoImpl.class, TransactionDaoImpl.class, TransactionalDataSource.class, DatabaseManager.class) ======= public WeldInitiator weld = WeldInitiator.from(Db.class, DbProperties.class, ConnectionProviderImpl.class, NtpTime.class, PropertiesHolder.class, BlockchainConfig.class, BlockchainImpl.class, Time.EpochTime.class, BlockDaoImpl.class, TransactionDaoImpl.class) .addBeans(MockBean.of(fullTextSearchService, FullTextSearchService.class)) >>>>>>> public WeldInitiator weld = WeldInitiator.from(DbProperties.class, NtpTime.class, PropertiesHolder.class, BlockchainConfig.class, BlockchainImpl.class, DbConfig.class, Time.EpochTime.class, BlockDaoImpl.class, TransactionDaoImpl.class, TransactionalDataSource.class, DatabaseManager.class) <<<<<<< databaseManager = new DatabaseManager(baseDbProperties, propertiesHolder); assertNotNull(databaseManager); TransactionalDataSource dataSource = databaseManager.getDataSource(); assertNotNull(dataSource); // databaseManager.shutdown(); ======= Db.init(baseDbProperties, fullTextSearchService); Db.shutdown(); >>>>>>> databaseManager = new DatabaseManager(baseDbProperties, propertiesHolder); assertNotNull(databaseManager); TransactionalDataSource dataSource = databaseManager.getDataSource(); assertNotNull(dataSource); // databaseManager.shutdown(); <<<<<<< databaseManager = new DatabaseManager(baseDbProperties, propertiesHolder); assertNotNull(databaseManager); TransactionalDataSource dataSource = databaseManager.getDataSource(); assertNotNull(dataSource); TransactionalDataSource newShardDb = databaseManager.createAndAddShard("apl-shard-000001"); ======= db.init(baseDbProperties, fullTextSearchService); TransactionalDb newShardDb = db.createAndAddShard("apl-shard-000001"); >>>>>>> databaseManager = new DatabaseManager(baseDbProperties, propertiesHolder); assertNotNull(databaseManager); TransactionalDataSource dataSource = databaseManager.getDataSource(); assertNotNull(dataSource); TransactionalDataSource newShardDb = databaseManager.createAndAddShard("apl-shard-000001");
<<<<<<< import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyMintService; ======= import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyExchangeOfferFacade; import com.apollocurrency.aplwallet.apl.core.service.state.echange.ExchangeService; import com.apollocurrency.aplwallet.apl.core.service.state.exchange.ExchangeRequestService; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyTransferService; >>>>>>> import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyExchangeOfferFacade; import com.apollocurrency.aplwallet.apl.core.service.state.echange.ExchangeService; import com.apollocurrency.aplwallet.apl.core.service.state.exchange.ExchangeRequestService; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyTransferService; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyMintService; <<<<<<< private CurrencyMintService currencyMintService; ======= private AssetTransferService assetTransferService; private CurrencyExchangeOfferFacade currencyExchangeOfferFacade; private ExchangeRequestService exchangeRequestService; private CurrencyTransferService currencyTransferService; >>>>>>> private AssetTransferService assetTransferService; private CurrencyExchangeOfferFacade currencyExchangeOfferFacade; private ExchangeRequestService exchangeRequestService; private CurrencyTransferService currencyTransferService; private CurrencyMintService currencyMintService; <<<<<<< public CurrencyMintService lookupCurrencyMintService() { if (currencyMintService == null) { currencyMintService = CDI.current().select(CurrencyMintService.class).get(); } return currencyMintService; } ======= public AssetTransferService lookupAssetTransferService() { if (assetTransferService == null) { assetTransferService = CDI.current().select(AssetTransferService.class).get(); } return assetTransferService; } public ExchangeRequestService lookupExchangeRequestService() { if (exchangeRequestService == null) { exchangeRequestService = CDI.current().select(ExchangeRequestService.class).get(); } return exchangeRequestService; } public CurrencyTransferService lookupCurrencyTransferService() { if (currencyTransferService == null) { currencyTransferService = CDI.current().select(CurrencyTransferService.class).get(); } return currencyTransferService; } >>>>>>> public AssetTransferService lookupAssetTransferService() { if (assetTransferService == null) { assetTransferService = CDI.current().select(AssetTransferService.class).get(); } return assetTransferService; } public ExchangeRequestService lookupExchangeRequestService() { if (exchangeRequestService == null) { exchangeRequestService = CDI.current().select(ExchangeRequestService.class).get(); } return exchangeRequestService; } public CurrencyTransferService lookupCurrencyTransferService() { if (currencyTransferService == null) { currencyTransferService = CDI.current().select(CurrencyTransferService.class).get(); } return currencyTransferService; } public CurrencyMintService lookupCurrencyMintService() { if (currencyMintService == null) { currencyMintService = CDI.current().select(CurrencyMintService.class).get(); } return currencyMintService; }
<<<<<<< ======= import com.apollocurrency.aplwallet.api.dto.account.AccountDTO; >>>>>>> import com.apollocurrency.aplwallet.api.dto.account.AccountDTO;
<<<<<<< import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly; ======= import static com.google.common.base.Preconditions.checkArgument; >>>>>>> import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
<<<<<<< import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; import com.apollocurrency.aplwallet.apl.util.Constants; ======= import static org.slf4j.LoggerFactory.getLogger; >>>>>>> import static org.slf4j.LoggerFactory.getLogger; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; import com.apollocurrency.aplwallet.apl.util.Constants; <<<<<<< log.debug("Dropping all full text search indexes"); FullTextTrigger.dropAll(con); ======= LOG.debug("Dropping all full text search indexes"); lookupFullTextSearchProvider().dropAll(con); >>>>>>> log.debug("Dropping all full text search indexes"); lookupFullTextSearchProvider().dropAll(con);
<<<<<<< FileSKVWriter writer = FileOperations.getInstance().newWriterBuilder().forFile(files.toString() + "/bulk_" + i + "." + RFile.EXTENSION, fs, fs.getConf()) .withTableConfiguration(DefaultConfiguration.getInstance()).build(); ======= FileSKVWriter writer = FileOperations.getInstance().newWriterBuilder() .forFile(files.toString() + "/bulk_" + i + "." + RFile.EXTENSION, fs, fs.getConf()) .withTableConfiguration(AccumuloConfiguration.getDefaultConfiguration()).build(); >>>>>>> FileSKVWriter writer = FileOperations.getInstance().newWriterBuilder() .forFile(files.toString() + "/bulk_" + i + "." + RFile.EXTENSION, fs, fs.getConf()) .withTableConfiguration(DefaultConfiguration.getInstance()).build();
<<<<<<< import javax.enterprise.context.ApplicationScoped; ======= import javax.enterprise.inject.spi.CDI; >>>>>>> import javax.enterprise.inject.spi.CDI; import javax.enterprise.context.ApplicationScoped; <<<<<<< public DbIterator<Block> getBlocks(Connection con, PreparedStatement pstmt) { return new DbIterator<>(con, pstmt, BlockDb::loadBlock); ======= public DbIterator<BlockImpl> getBlocks(Connection con, PreparedStatement pstmt) { return new DbIterator<>(con, pstmt, blockDb::loadBlock); >>>>>>> public DbIterator<Block> getBlocks(Connection con, PreparedStatement pstmt) { return new DbIterator<>(con, pstmt, blockDb::loadBlock); <<<<<<< List<Block> result = new ArrayList<>(AplGlobalObjects.getBlockDb().getBlockCacheSize()); synchronized(AplGlobalObjects.getBlockDb().getBlockCache()) { BlockImpl block = AplGlobalObjects.getBlockDb().getBlockCache().get(blockId); ======= List<BlockImpl> result = new ArrayList<>(blockDb.getBlockCacheSize()); synchronized(blockDb.getBlockCache()) { BlockImpl block = blockDb.getBlockCache().get(blockId); >>>>>>> List<Block> result = new ArrayList<>(blockDb.getBlockCacheSize()); synchronized(blockDb.getBlockCache()) { BlockImpl block = blockDb.getBlockCache().get(blockId); <<<<<<< List<Block> result = new ArrayList<>(AplGlobalObjects.getBlockDb().getBlockCacheSize()); synchronized(AplGlobalObjects.getBlockDb().getBlockCache()) { BlockImpl block = AplGlobalObjects.getBlockDb().getBlockCache().get(blockId); ======= List<BlockImpl> result = new ArrayList<>(blockDb.getBlockCacheSize()); synchronized(blockDb.getBlockCache()) { BlockImpl block = blockDb.getBlockCache().get(blockId); >>>>>>> List<Block> result = new ArrayList<>(blockDb.getBlockCacheSize()); synchronized(blockDb.getBlockCache()) { BlockImpl block = blockDb.getBlockCache().get(blockId); <<<<<<< public DbIterator<Transaction> getTransactions(Connection con, PreparedStatement pstmt) { return new DbIterator<>(con, pstmt, TransactionDb::loadTransaction); ======= public DbIterator<TransactionImpl> getTransactions(Connection con, PreparedStatement pstmt) { return new DbIterator<>(con, pstmt, transactionDb::loadTransaction); >>>>>>> public DbIterator<Transaction> getTransactions(Connection con, PreparedStatement pstmt) { return new DbIterator<>(con, pstmt, transactionDb::loadTransaction);
<<<<<<< ======= import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; >>>>>>> <<<<<<< import javax.inject.Inject; import java.io.IOException; import java.nio.file.Path; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.UUID; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; ======= import java.io.IOException; import java.nio.file.Path; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.UUID; import javax.inject.Inject; >>>>>>> import javax.inject.Inject; import java.io.IOException; import java.nio.file.Path; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.UUID; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; <<<<<<< JdbiHandleFactory.class, BlockDaoImpl.class, TransactionIndexDao.class, DaoConfig.class, GlobalSyncImpl.class, PublicKeyTable.class, AccountGuaranteedBalanceTable.class, AccountServiceImpl.class, AccountPublicKeyServiceImpl.class ) ======= BlockDaoImpl.class, TransactionIndexDao.class, DaoConfig.class) >>>>>>> BlockDaoImpl.class, TransactionIndexDao.class, DaoConfig.class)
<<<<<<< import com.apollocurrency.aplwallet.apl.core.transaction.TransactionBuilder; ======= import com.apollocurrency.aplwallet.apl.core.transaction.TransactionSigner; >>>>>>> import com.apollocurrency.aplwallet.apl.core.transaction.TransactionSigner; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionBuilder; <<<<<<< private static TransactionBuilder transactionBuilder; ======= private static TransactionSigner transactionSigner; >>>>>>> private static TransactionSigner transactionSigner; private static TransactionBuilder transactionBuilder; <<<<<<< feeCalculator = CDI.current().select(FeeCalculator.class).get(); transactionBuilder = CDI.current().select(TransactionBuilder.class).get(); ======= feeCalculator = CDI.current().select(FeeCalculator.class).get(); transactionSigner = CDI.current().select(TransactionSigner.class).get(); >>>>>>> feeCalculator = CDI.current().select(FeeCalculator.class).get(); transactionBuilder = CDI.current().select(TransactionBuilder.class).get(); feeCalculator = CDI.current().select(FeeCalculator.class).get(); transactionSigner = CDI.current().select(TransactionSigner.class).get(); <<<<<<< Transaction.Builder builder = transactionBuilder.newTransactionBuilder(monitor.publicKey, monitoredAccount.amount, 0, (short) 1440, Attachment.ORDINARY_PAYMENT, blockchain.getLastBlockTimestamp()); ======= //TODO Use TransactionVersionValidator#getActualVersion() int version = 1; Transaction.Builder builder = TransactionBuilder.newTransactionBuilder(version, monitor.publicKey, monitoredAccount.amount, 0, (short) 1440, Attachment.ORDINARY_PAYMENT, blockchain.getLastBlockTimestamp()); >>>>>>> //TODO Use TransactionVersionValidator#getActualVersion() int version = 1; Transaction.Builder builder = TransactionBuilder.newTransactionBuilder(version, monitor.publicKey, monitoredAccount.amount, 0, (short) 1440, Attachment.ORDINARY_PAYMENT, blockchain.getLastBlockTimestamp()); Transaction.Builder builder = transactionBuilder.newTransactionBuilder(monitor.publicKey, monitoredAccount.amount, 0, (short) 1440, Attachment.ORDINARY_PAYMENT, blockchain.getLastBlockTimestamp()); <<<<<<< Transaction.Builder builder = transactionBuilder.newTransactionBuilder(monitor.publicKey, ======= Transaction.Builder builder = TransactionBuilder.newTransactionBuilder(version, monitor.publicKey, >>>>>>> Transaction.Builder builder = TransactionBuilder.newTransactionBuilder(version, monitor.publicKey, Transaction.Builder builder = transactionBuilder.newTransactionBuilder(monitor.publicKey, <<<<<<< Transaction.Builder builder = transactionBuilder.newTransactionBuilder(monitor.publicKey, ======= Transaction.Builder builder = TransactionBuilder.newTransactionBuilder(version, monitor.publicKey, >>>>>>> Transaction.Builder builder = TransactionBuilder.newTransactionBuilder(version, monitor.publicKey, Transaction.Builder builder = transactionBuilder.newTransactionBuilder(monitor.publicKey,
<<<<<<< ======= import com.apollocurrency.aplwallet.apl.TemporaryFolderExtension; >>>>>>> import com.apollocurrency.aplwallet.apl.TemporaryFolderExtension; <<<<<<< ======= @Inject private BlockIndexDao blockIndexDao; @Inject private TransactionIndexDao transactionIndexDao; >>>>>>> @Inject private BlockIndexDao blockIndexDao; @Inject private TransactionIndexDao transactionIndexDao; <<<<<<< ======= >>>>>>>
<<<<<<< import com.apollocurrency.aplwallet.apl.core.db.dao.ShardDao; import com.apollocurrency.aplwallet.apl.core.db.dao.ShardRecoveryDao; import com.apollocurrency.aplwallet.apl.core.db.dao.model.Shard; import com.apollocurrency.aplwallet.apl.core.db.dao.model.ShardRecovery; ======= import com.apollocurrency.aplwallet.apl.core.db.dao.ShardRecoveryDao; import com.apollocurrency.aplwallet.apl.core.db.dao.model.ShardRecovery; >>>>>>> import com.apollocurrency.aplwallet.apl.core.db.dao.ShardRecoveryDao; import com.apollocurrency.aplwallet.apl.core.db.dao.model.ShardRecovery; import com.apollocurrency.aplwallet.apl.core.db.dao.ShardDao; import com.apollocurrency.aplwallet.apl.core.db.dao.ShardRecoveryDao; import com.apollocurrency.aplwallet.apl.core.db.dao.model.Shard; import com.apollocurrency.aplwallet.apl.core.db.dao.model.ShardRecovery; <<<<<<< private ShardDao shardDao; private ShardRecoveryDao recoveryDao; private volatile boolean isSharding = false; ======= private ShardRecoveryDao shardRecoveryDao; >>>>>>> private ShardRecoveryDao shardRecoveryDao; private ShardDao shardDao; <<<<<<< public ShardObserver(BlockchainProcessor blockchainProcessor, BlockchainConfig blockchainConfig, DatabaseManager databaseManager, ShardMigrationExecutor shardMigrationExecutor, ShardDao shardDao, ShardRecoveryDao recoveryDao) { ======= public ShardObserver(BlockchainProcessor blockchainProcessor, BlockchainConfig blockchainConfig, ShardMigrationExecutor shardMigrationExecutor, ShardRecoveryDao shardRecoveryDao) { >>>>>>> public ShardObserver(BlockchainProcessor blockchainProcessor, BlockchainConfig blockchainConfig, ShardMigrationExecutor shardMigrationExecutor, ShardDao shardDao, ShardRecoveryDao recoveryDao) { <<<<<<< this.shardDao = Objects.requireNonNull(shardDao, "shardDao is NULL"); this.recoveryDao = Objects.requireNonNull(recoveryDao, "recoveryDao is NULL"); ======= this.shardRecoveryDao = Objects.requireNonNull(shardRecoveryDao, "shard recovery dao cannot be null"); >>>>>>> this.shardRecoveryDao = Objects.requireNonNull(recoveryDao, "shard recovery dao cannot be null"); this.shardDao = Objects.requireNonNull(shardDao, "shardDao is NULL"); <<<<<<< if (isSharding) { log.warn("Previous shard was no finished! Will skip next shard at height: " + minRollbackHeight); log.error("!!! --- SHARD SKIPPING CASE, IT SHOULD NEVER HAPPEN ON PRODUCTION --- !!! You can skip it at YOUR OWN RISK !!!"); } else { isSharding = true; MigrateState state = MigrateState.INIT; long start = System.currentTimeMillis(); log.info("Start sharding...."); // quick create records for new Shard and Recovery process for later use ShardRecovery recovery = new ShardRecovery(MigrateState.INIT); Shard newShard = new Shard((long)minRollbackHeight); shardDao.saveShard(newShard); // store shard with HEIGHT ONLY recoveryDao.saveShardRecovery(recovery); // store Recovery with INIT state try { log.debug("Clean commands...."); shardMigrationExecutor.cleanCommands(); log.debug("Create all commands...."); shardMigrationExecutor.createAllCommands(minRollbackHeight); log.debug("Start all commands...."); state = shardMigrationExecutor.executeAllOperations(); } catch (Throwable t) { log.error("Error occurred while trying create shard at height " + minRollbackHeight, t); res = false; } if (state != MigrateState.FAILED && state != MigrateState.INIT ) { log.info("Finished sharding successfully in {} secs", (System.currentTimeMillis() - start) / 1000); res = true; } else { log.info("FAILED sharding in {} secs", (System.currentTimeMillis() - start) / 1000); res = false; } isSharding = false; } ======= shardRecoveryDao.saveShardRecovery(new ShardRecovery(MigrateState.INIT)); res = CompletableFuture.supplyAsync(() -> performSharding(minRollbackHeight)); >>>>>>> // quick create records for new Shard and Recovery process for later use shardRecoveryDao.saveShardRecovery(new ShardRecovery(MigrateState.INIT)); shardDao.saveShard(new Shard((long)minRollbackHeight)); // store shard with HEIGHT ONLY res = CompletableFuture.supplyAsync(() -> performSharding(minRollbackHeight));
<<<<<<< import com.apollocurrency.aplwallet.apl.core.app.messages.Attachment; import com.apollocurrency.aplwallet.apl.core.app.messages.Phasing; import com.apollocurrency.aplwallet.apl.util.AplException; ======= >>>>>>> import com.apollocurrency.aplwallet.apl.core.app.messages.Attachment; import com.apollocurrency.aplwallet.apl.core.app.messages.Phasing; import com.apollocurrency.aplwallet.apl.util.AplException;
<<<<<<< import com.apollocurrency.aplwallet.apl.util.*; ======= import com.apollocurrency.aplwallet.apl.util.Constants; import com.apollocurrency.aplwallet.apl.util.Filter; import com.apollocurrency.aplwallet.apl.util.JSON; import com.apollocurrency.aplwallet.apl.util.Listener; import com.apollocurrency.aplwallet.apl.util.Listeners; import com.apollocurrency.aplwallet.apl.util.QueuedThreadPool; import com.apollocurrency.aplwallet.apl.util.StringUtils; import com.apollocurrency.aplwallet.apl.util.Version; >>>>>>> import com.apollocurrency.aplwallet.apl.util.Constants; import com.apollocurrency.aplwallet.apl.util.Filter; import com.apollocurrency.aplwallet.apl.util.JSON; import com.apollocurrency.aplwallet.apl.util.Listener; import com.apollocurrency.aplwallet.apl.util.Listeners; import com.apollocurrency.aplwallet.apl.util.QueuedThreadPool; import com.apollocurrency.aplwallet.apl.util.StringUtils; import com.apollocurrency.aplwallet.apl.util.Version; <<<<<<< import javax.enterprise.event.Observes; import javax.enterprise.inject.spi.CDI; import javax.inject.Singleton; import java.net.InetAddress; import java.net.MalformedURLException; import java.net.UnknownHostException; import java.util.*; import java.util.concurrent.*; ======= import javax.enterprise.inject.spi.CDI; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.EnumSet; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ThreadLocalRandom; >>>>>>> import javax.enterprise.inject.spi.CDI; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.EnumSet; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ThreadLocalRandom; <<<<<<< // moved to Weld Event /*AccountService.addListener(account -> peers.values().forEach(peer -> { ======= Account.addListener(account -> connectablePeers.values().forEach(peer -> { >>>>>>> // moved to Weld Event /* Account.addListener(account -> connectablePeers.values().forEach(peer -> { <<<<<<< peer = new PeerImpl(host, announcedAddress, blockchainConfig, blockchain, timeService, propertiesHolder, accountService); ======= >>>>>>>
<<<<<<< trimEvent.select(new AnnotationLiteral<Async>() {}).fire(new TrimData(100, 100)); ======= Mockito.doReturn(4072*1024*1024L).when(mock(Runtime.class)).totalMemory(); // give it more then 3 GB trimEvent.select(new AnnotationLiteral<Async>() {}).fire(new TrimData(100, 100, 0)); >>>>>>> Mockito.doReturn(4072*1024*1024L).when(mock(Runtime.class)).totalMemory(); // give it more then 3 GB trimEvent.select(new AnnotationLiteral<Async>() {}).fire(new TrimData(100, 100, 0)); <<<<<<< trimEvent.select(new AnnotationLiteral<Sync>() {}).fire(new TrimData(100, 100)); ======= Mockito.doReturn(4072*1024*1024L).when(mock(Runtime.class)).totalMemory(); // give it more then 3 GB trimEvent.select(new AnnotationLiteral<Async>() {}).fire(new TrimData(100, 100, 0)); >>>>>>> Mockito.doReturn(4072*1024*1024L).when(mock(Runtime.class)).totalMemory(); // give it more then 3 GB trimEvent.select(new AnnotationLiteral<Sync>() {}).fire(new TrimData(100, 100, 0));
<<<<<<< ======= import com.apollocurrency.aplwallet.apl.core.account.Account; import com.apollocurrency.aplwallet.apl.core.account.AccountTable; import com.apollocurrency.aplwallet.apl.core.account.PublicKey; import com.apollocurrency.aplwallet.apl.core.account.PublicKeyService; import com.apollocurrency.aplwallet.apl.core.account.PublicKeyServiceImpl; import com.apollocurrency.aplwallet.apl.core.account.dao.AccountGuaranteedBalance; >>>>>>> <<<<<<< @Inject PublicKeyTable publicKeyTable; @Inject GenesisPublicKeyTable genesisPublicKeyTable; @Inject AccountService accountService; @Inject AccountPublicKeyService accountPublicKeyService; @Inject ======= @Inject PublicKeyService publicKeyService; @Inject AccountTable accountTable; @Inject >>>>>>> @Inject PublicKeyService publicKeyService; @Inject AccountService accountService; @Inject AccountPublicKeyService accountPublicKeyService; @Inject <<<<<<< AccountTable.class, AccountGuaranteedBalanceTable.class, PublicKeyTable.class, AccountServiceImpl.class, AccountPublicKeyServiceImpl.class, FullTextConfigImpl.class, DerivedDbTablesRegistryImpl.class, PropertiesHolder.class, ShardRecoveryDaoJdbcImpl.class, GenesisImporter.class, GenesisPublicKeyTable.class, ======= AccountTable.class, AccountGuaranteedBalanceTable.class, FullTextConfigImpl.class, DerivedDbTablesRegistryImpl.class, PropertiesHolder.class, ShardRecoveryDaoJdbcImpl.class, GenesisImporter.class, PublicKeyServiceImpl.class, PublicKeyTableProducer.class, >>>>>>> AccountTable.class, AccountGuaranteedBalanceTable.class, PublicKeyServiceImpl.class, PublicKeyTableProducer.class, AccountServiceImpl.class, AccountPublicKeyServiceImpl.class, FullTextConfigImpl.class, DerivedDbTablesRegistryImpl.class, PropertiesHolder.class, ShardRecoveryDaoJdbcImpl.class, GenesisImporter.class, <<<<<<< genesisPublicKeyTable = new GenesisPublicKeyTable(blockchain); //TODO: propertiesHolder is empty, default values will be used accountGuaranteedBalanceTable = new AccountGuaranteedBalanceTable(blockchainConfig, propertiesHolder); accountGuaranteedBalanceTable.init(); ======= //TODO: propertiesHolder is never used in Account.init() Account.init(extension.getDatabaseManager(), null, null, blockchain, null, accountTable, accountGuaranteedBalanceTable, publicKeyService); >>>>>>> genesisPublicKeyTable = new GenesisPublicKeyTable(blockchain); //TODO: propertiesHolder is empty, default values will be used accountGuaranteedBalanceTable = new AccountGuaranteedBalanceTable(blockchainConfig, propertiesHolder); accountGuaranteedBalanceTable.init();
<<<<<<< import com.apollocurrency.aplwallet.apl.core.account.model.Account; import com.apollocurrency.aplwallet.apl.core.account.service.AccountService; import com.apollocurrency.aplwallet.apl.core.app.EpochTime; ======= import com.apollocurrency.aplwallet.apl.core.app.TimeService; >>>>>>> import com.apollocurrency.aplwallet.apl.core.account.model.Account; import com.apollocurrency.aplwallet.apl.core.account.service.AccountService; import com.apollocurrency.aplwallet.apl.core.app.TimeService; <<<<<<< private EpochTime timeService; private AccountService accountService; ======= private TimeService timeService; >>>>>>> private TimeService timeService; private AccountService accountService; <<<<<<< DexOfferTransactionCreator dexOfferTransactionCreator, EpochTime timeService, AccountService accountService) { ======= DexOfferTransactionCreator dexOfferTransactionCreator, TimeService timeService) { >>>>>>> DexOfferTransactionCreator dexOfferTransactionCreator, TimeService timeService, AccountService accountService) {
<<<<<<< import java.awt.*; import com.apollocurrency.aplwallet.apl.core.app.DatabaseManager; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; import com.apollocurrency.aplwallet.apl.util.Constants; ======= import com.apollocurrency.aplwallet.apl.core.app.BlockchainProcessor; import com.apollocurrency.aplwallet.apl.core.app.BlockchainProcessorImpl; import com.apollocurrency.aplwallet.apl.core.app.Db; >>>>>>> import com.apollocurrency.aplwallet.apl.core.app.BlockchainProcessor; import com.apollocurrency.aplwallet.apl.core.app.BlockchainProcessorImpl; import java.awt.*; import com.apollocurrency.aplwallet.apl.core.app.DatabaseManager; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; import com.apollocurrency.aplwallet.apl.util.Constants; <<<<<<< TransactionalDataSource dataSource = databaseManager.getDataSource(); FullTextTrigger.reindex(dataSource.getConnection()); ======= CDI.current().select(FullTextSearchService.class).get().reindexAll(Db.getDb().getConnection()); >>>>>>> FullTextSearchService searchService = CDI.current().select(FullTextSearchService.class).get(); TransactionalDataSource dataSource = databaseManager.getDataSource(); searchService.reindexAll(dataSource.getConnection());
<<<<<<< import com.apollocurrency.aplwallet.apl.core.app.Transaction; ======= import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; >>>>>>> import com.apollocurrency.aplwallet.apl.core.app.Transaction; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction;
<<<<<<< /* * Copyright (C) 2012-2019 52°North Initiative for Geospatial Open Source ======= /** * Copyright (C) 2012-2020 52°North Initiative for Geospatial Open Source >>>>>>> /* * Copyright (C) 2012-2020 52°North Initiative for Geospatial Open Source
<<<<<<< ======= import com.apollocurrency.aplwallet.api.dto.DexTradeInfoDto; import com.apollocurrency.aplwallet.api.dto.ExchangeContractDTO; >>>>>>> import com.apollocurrency.aplwallet.api.dto.ExchangeContractDTO; <<<<<<< ======= import com.apollocurrency.aplwallet.apl.core.rest.converter.DexTradeEntryMinToDtoConverter; import com.apollocurrency.aplwallet.apl.core.rest.converter.DexTradeEntryToDtoConverter; import com.apollocurrency.aplwallet.apl.core.rest.converter.ExchangeContractToDTOConverter; >>>>>>> <<<<<<< log.debug("getHistohour1: fsym: {}, tsym: {}, toTs: {}, limit: {}", fsym, tsym, toTs, limit); TradingDataOutput tradingDataOutput = getDataForInterval( fsym, tsym, toTs, limit, 60*60, service); return Response.ok( new TradingDataOutputToDtoConverter().apply(tradingDataOutput) ) .build(); } @GET @Path("/histoday1") @Produces(MediaType.APPLICATION_JSON) @Operation(tags = {"dex"}, summary = "Get histoday", description = "getting histoday") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Exchange offers"), @ApiResponse(responseCode = "200", description = "Unexpected error") }) public Response getHistoday1( @Parameter(description = "Type of exchange (coinbase)") @QueryParam("e") String e, @Parameter(description = "fsym") @QueryParam("fsym") String fsym, @Parameter(description = "tsym") @QueryParam("tsym") String tsym, @Parameter(description = "toTs") @QueryParam("toTs") Integer toTs, @Parameter(description = "limit") @QueryParam("limit") Integer limit, @Context HttpServletRequest req) throws NotFoundException { log.debug("getHistoday1: fsym: {}, tsym: {}, toTs: {}, limit: {}", fsym, tsym, toTs, limit); TradingDataOutput tradingDataOutput = getDataForInterval( fsym, tsym, toTs, limit, 60*60*24, service); return Response.ok( new TradingDataOutputToDtoConverter().apply(tradingDataOutput) ) .build(); } ======= @GET @Path("/all-contracts") @Produces(MediaType.APPLICATION_JSON) @Operation(tags = {"dex"}, summary = "Retrieve all versioned dex contracts for order", description = "Get all versions of dex contracts related to the specified order (including all contracts with STEP1 status and previous versions of processable contract) ", responses = @ApiResponse(description = "List of versioned contracts", responseCode = "200", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExchangeContractDTO.class)))) public Response getAllVersionedContractsForOrder(@Parameter(description = "APL account id (RS, singed or unsigned int64/long) ") @QueryParam("accountId") String account, @Parameter(description = "Order id (signed/unsigned int64/long) ") @QueryParam("orderId") String order) { long accountId = Convert.parseAccountId(account); long orderId = Convert.parseLong(order); List<ExchangeContract> contracts = service.getVersionedContractsByAccountOrder(accountId, orderId); return Response.ok(contractConverter.convert(contracts)).build(); } >>>>>>> log.debug("getHistohour1: fsym: {}, tsym: {}, toTs: {}, limit: {}", fsym, tsym, toTs, limit); TradingDataOutput tradingDataOutput = getDataForInterval( fsym, tsym, toTs, limit, 60*60, service); return Response.ok( new TradingDataOutputToDtoConverter().apply(tradingDataOutput) ) .build(); } @GET @Path("/histoday1") @Produces(MediaType.APPLICATION_JSON) @Operation(tags = {"dex"}, summary = "Get histoday", description = "getting histoday") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Exchange offers"), @ApiResponse(responseCode = "200", description = "Unexpected error") }) public Response getHistoday1( @Parameter(description = "Type of exchange (coinbase)") @QueryParam("e") String e, @Parameter(description = "fsym") @QueryParam("fsym") String fsym, @Parameter(description = "tsym") @QueryParam("tsym") String tsym, @Parameter(description = "toTs") @QueryParam("toTs") Integer toTs, @Parameter(description = "limit") @QueryParam("limit") Integer limit, @Context HttpServletRequest req) throws NotFoundException { log.debug("getHistoday1: fsym: {}, tsym: {}, toTs: {}, limit: {}", fsym, tsym, toTs, limit); TradingDataOutput tradingDataOutput = getDataForInterval( fsym, tsym, toTs, limit, 60*60*24, service); return Response.ok( new TradingDataOutputToDtoConverter().apply(tradingDataOutput) ) .build(); } @GET @Path("/all-contracts") @Produces(MediaType.APPLICATION_JSON) @Operation(tags = {"dex"}, summary = "Retrieve all versioned dex contracts for order", description = "Get all versions of dex contracts related to the specified order (including all contracts with STEP1 status and previous versions of processable contract) ", responses = @ApiResponse(description = "List of versioned contracts", responseCode = "200", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ExchangeContractDTO.class)))) public Response getAllVersionedContractsForOrder(@Parameter(description = "APL account id (RS, singed or unsigned int64/long) ") @QueryParam("accountId") String account, @Parameter(description = "Order id (signed/unsigned int64/long) ") @QueryParam("orderId") String order) { long accountId = Convert.parseAccountId(account); long orderId = Convert.parseLong(order); List<ExchangeContract> contracts = service.getVersionedContractsByAccountOrder(accountId, orderId); return Response.ok(contractConverter.convert(contracts)).build(); }
<<<<<<< import com.apollocurrency.aplwallet.apl.core.app.messages.Attachment; import com.apollocurrency.aplwallet.apl.core.app.messages.PublicKeyAnnouncement; ======= import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfig; >>>>>>> import com.apollocurrency.aplwallet.apl.core.app.messages.Attachment; import com.apollocurrency.aplwallet.apl.core.app.messages.PublicKeyAnnouncement; import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfig;
<<<<<<< @Mock AccountService accountService; ======= @Mock BlockchainConfig blockchainConfig; @Mock LoadingCache<Long, OrderFreezing> cache; >>>>>>> @Mock BlockchainConfig blockchainConfig; @Mock LoadingCache<Long, OrderFreezing> cache; @Mock AccountService accountService; <<<<<<< dexService = new DexService(ethWalletService, dexOrderDao, dexOrderTable, transactionProcessor, dexSmartContractService, secureStorageService, dexContractTable, dexOrderTransactionCreator, timeService, dexContractDao, blockchain, phasingPollService, dexMatcherService, dexTradeDao, approvedResultTable, mandatoryTransactionDao, accountService); ======= dexService = new DexService(ethWalletService, dexOrderDao, dexOrderTable, transactionProcessor, dexSmartContractService, secureStorageService, dexContractTable, dexOrderTransactionCreator, timeService, dexContractDao, blockchain, phasingPollService, dexMatcherService, approvedResultTable, mandatoryTransactionDao, blockchainConfig, cache); >>>>>>> dexService = new DexService(ethWalletService, dexOrderDao, dexOrderTable, transactionProcessor, dexSmartContractService, secureStorageService, dexContractTable, dexOrderTransactionCreator, timeService, dexContractDao, blockchain, phasingPollService, dexMatcherService, approvedResultTable, mandatoryTransactionDao, accountService, blockchainConfig, cache);
<<<<<<< private JdbiHandleFactory jdbiHandleFactory; @Inject private ShardEngine shardEngine; ======= private DataTransferManagementReceiver managementReceiver; >>>>>>> private ShardEngine shardEngine;
<<<<<<< import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfig; import com.apollocurrency.aplwallet.apl.core.chainid.ChainIdServiceImpl; ======= import com.apollocurrency.aplwallet.apl.exec.webui.WebUiExtractor; >>>>>>> import com.apollocurrency.aplwallet.apl.exec.webui.WebUiExtractor; import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfig; import com.apollocurrency.aplwallet.apl.core.chainid.ChainIdServiceImpl; <<<<<<< ======= import javax.enterprise.inject.spi.CDI; import java.util.Arrays; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; >>>>>>> import javax.enterprise.inject.spi.CDI; import java.util.Arrays; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; <<<<<<< System.setProperty("apl.runtime.mode", args.serviceMode ? "service" : "user"); ======= RuntimeEnvironment.getInstance().setMain(Apollo.class); dirProvider = RuntimeEnvironment.getInstance().getDirProvider(); >>>>>>> System.setProperty("apl.runtime.mode", args.serviceMode ? "service" : "user"); RuntimeEnvironment.getInstance().setMain(Apollo.class);
<<<<<<< import com.apollocurrency.aplwallet.apl.core.db.LinkKeyFactory; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; import com.apollocurrency.aplwallet.apl.core.db.derived.EntityDbTable; ======= import com.apollocurrency.aplwallet.apl.core.dao.state.keyfactory.LinkKeyFactory; import com.apollocurrency.aplwallet.apl.core.dao.TransactionalDataSource; import com.apollocurrency.aplwallet.apl.core.dao.state.derived.EntityDbTable; >>>>>>> import com.apollocurrency.aplwallet.apl.core.db.LinkKeyFactory; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; import com.apollocurrency.aplwallet.apl.core.db.derived.EntityDbTable; import com.apollocurrency.aplwallet.apl.core.dao.state.keyfactory.LinkKeyFactory; import com.apollocurrency.aplwallet.apl.core.dao.TransactionalDataSource; import com.apollocurrency.aplwallet.apl.core.dao.state.derived.EntityDbTable;
<<<<<<< import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.entity.state.account.Account; import com.apollocurrency.aplwallet.apl.core.entity.state.currency.Currency; ======= import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.TransactionBuilder; import com.apollocurrency.aplwallet.apl.core.entity.state.account.Account; import com.apollocurrency.aplwallet.apl.core.entity.state.currency.Currency; >>>>>>> import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.entity.state.account.Account; import com.apollocurrency.aplwallet.apl.core.entity.state.currency.Currency; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.TransactionBuilder; import com.apollocurrency.aplwallet.apl.core.entity.state.account.Account; import com.apollocurrency.aplwallet.apl.core.entity.state.currency.Currency; <<<<<<< import com.apollocurrency.aplwallet.apl.core.service.appdata.TransactionSchedulerService; import com.apollocurrency.aplwallet.apl.core.service.blockchain.GlobalSync; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyExchangeOfferFacade; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionBuilder; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes; ======= import com.apollocurrency.aplwallet.apl.core.monetary.MonetarySystem; import com.apollocurrency.aplwallet.apl.core.service.appdata.TransactionSchedulerService; import com.apollocurrency.aplwallet.apl.core.service.blockchain.GlobalSync; >>>>>>> import com.apollocurrency.aplwallet.apl.core.service.appdata.TransactionSchedulerService; import com.apollocurrency.aplwallet.apl.core.service.blockchain.GlobalSync; import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyExchangeOfferFacade; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionBuilder; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes; import com.apollocurrency.aplwallet.apl.core.monetary.MonetarySystem; import com.apollocurrency.aplwallet.apl.core.service.appdata.TransactionSchedulerService; import com.apollocurrency.aplwallet.apl.core.service.blockchain.GlobalSync; <<<<<<< transaction = transactionBuilder.newTransactionBuilder((JSONObject) response.get("transactionJSON")).build(); ======= transaction = TransactionBuilder.newTransactionBuilder((JSONObject) response.get("transactionJSON")).build(); >>>>>>> transaction = transactionBuilder.newTransactionBuilder((JSONObject) response.get("transactionJSON")).build();
<<<<<<< checkArgument(config != null, "config is null"); ======= this(config, new ZooCacheFactory()); } ZooKeeperInstance(Configuration config, ZooCacheFactory zcf) { ArgumentChecker.notNull(config); >>>>>>> this(config, new ZooCacheFactory()); } ZooKeeperInstance(Configuration config, ZooCacheFactory zcf) { checkArgument(config != null, "config is null");
<<<<<<< import com.apollocurrency.aplwallet.apl.core.app.Order; import com.apollocurrency.aplwallet.apl.core.app.Transaction; import com.apollocurrency.aplwallet.apl.core.db.DbIterator; ======= >>>>>>> import com.apollocurrency.aplwallet.apl.core.app.Order; import com.apollocurrency.aplwallet.apl.core.app.Transaction; import com.apollocurrency.aplwallet.apl.core.db.DbIterator; <<<<<<< import javax.servlet.http.HttpServletRequest; ======= import javax.enterprise.inject.Vetoed; >>>>>>> import javax.servlet.http.HttpServletRequest; import javax.enterprise.inject.Vetoed;
<<<<<<< private static PhasingPollService phasingPollService; private static volatile AliasService ALIAS_SERVICE; ======= protected static Blockchain blockchain; >>>>>>> protected static Blockchain blockchain; private static PhasingPollService phasingPollService; private static volatile AliasService ALIAS_SERVICE; <<<<<<< public static synchronized AccountService lookupAccountService(){ if ( accountService == null) { ======= public TransactionType() { } public static AccountService lookupAccountService() { if (accountService == null) { >>>>>>> public TransactionType() { } public static synchronized AccountService lookupAccountService() { if (accountService == null) { <<<<<<< public static synchronized AccountCurrencyService lookupAccountCurrencyService(){ if ( accountCurrencyService == null) { ======= public static AccountCurrencyService lookupAccountCurrencyService() { if (accountCurrencyService == null) { >>>>>>> public static synchronized AccountCurrencyService lookupAccountCurrencyService() { if (accountCurrencyService == null) { <<<<<<< public static synchronized AccountLeaseService lookupAccountLeaseService(){ if ( accountLeaseService == null) { ======= public static AccountLeaseService lookupAccountLeaseService() { if (accountLeaseService == null) { >>>>>>> public static synchronized AccountLeaseService lookupAccountLeaseService() { if (accountLeaseService == null) { <<<<<<< public static synchronized AccountAssetService lookupAccountAssetService(){ if ( accountAssetService == null) { ======= public static AccountAssetService lookupAccountAssetService() { if (accountAssetService == null) { >>>>>>> public static synchronized AccountAssetService lookupAccountAssetService() { if (accountAssetService == null) { <<<<<<< public static synchronized AccountPropertyService lookupAccountPropertyService(){ if ( accountPropertyService == null) { ======= public static AccountPropertyService lookupAccountPropertyService() { if (accountPropertyService == null) { >>>>>>> public static synchronized AccountPropertyService lookupAccountPropertyService() { if (accountPropertyService == null) { <<<<<<< public static synchronized AccountInfoService lookupAccountInfoService(){ if ( accountInfoService == null) { ======= public static AccountInfoService lookupAccountInfoService() { if (accountInfoService == null) { >>>>>>> public static synchronized AccountInfoService lookupAccountInfoService() { if (accountInfoService == null) {
<<<<<<< import com.apollocurrency.aplwallet.apl.core.transaction.TransactionBuilder; import com.apollocurrency.aplwallet.apl.core.utils.Convert2; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; ======= import com.apollocurrency.aplwallet.apl.core.app.AplException; >>>>>>> import com.apollocurrency.aplwallet.apl.core.transaction.TransactionBuilder; import com.apollocurrency.aplwallet.apl.core.utils.Convert2; import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.app.AplException; <<<<<<< this.transactionBuilder = transactionBuilder; ======= this.transactionSigner = transactionSigner; >>>>>>> this.transactionSigner = transactionSigner; this.transactionBuilder = transactionBuilder; <<<<<<< Transaction.Builder builder = transactionBuilder.newTransactionBuilder(Crypto.getPublicKey(keySeed), 0, Constants.ONE_APL, ======= Transaction.Builder builder = TransactionBuilder.newTransactionBuilder(Crypto.getPublicKey(keySeed), 0, Constants.ONE_APL, >>>>>>> Transaction.Builder builder = transactionBuilder.newTransactionBuilder(Crypto.getPublicKey(keySeed), 0, Constants.ONE_APL,
<<<<<<< import com.apollocurrency.aplwallet.apl.core.account.AccountLedger; import com.apollocurrency.aplwallet.apl.core.app.transaction.Messaging; import com.apollocurrency.aplwallet.apl.core.app.transaction.TransactionType; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; ======= import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfigUpdater; >>>>>>> import com.apollocurrency.aplwallet.apl.core.account.AccountLedger; import com.apollocurrency.aplwallet.apl.core.app.transaction.Messaging; import com.apollocurrency.aplwallet.apl.core.app.transaction.TransactionType; import com.apollocurrency.aplwallet.apl.core.db.TransactionalDataSource; import com.apollocurrency.aplwallet.apl.core.chainid.BlockchainConfigUpdater; <<<<<<< private static PropertiesHolder propertiesHolder = CDI.current().select(PropertiesHolder.class).get(); private static BlockchainConfig blockchainConfig = CDI.current().select(BlockchainConfig.class).get(); ======= private static PropertiesHolder propertiesHolder = CDI.current().select(PropertiesHolder.class).get(); private static BlockchainConfig blockchainConfig = CDI.current().select(BlockchainConfig.class).get(); private BlockchainConfigUpdater blockchainConfigUpdater; >>>>>>> private static final PropertiesHolder propertiesHolder = CDI.current().select(PropertiesHolder.class).get(); private static final BlockchainConfig blockchainConfig = CDI.current().select(BlockchainConfig.class).get(); private BlockchainConfigUpdater blockchainConfigUpdater; <<<<<<< private static TransactionalDataSource lookupDataSource() { if (databaseManager == null) databaseManager = CDI.current().select(DatabaseManager.class).get(); return databaseManager.getDataSource(); } ======= private BlockchainConfigUpdater lookupBlockhainConfigUpdater() { if (blockchainConfigUpdater == null) blockchainConfigUpdater = CDI.current().select(BlockchainConfigUpdater.class).get(); return blockchainConfigUpdater; } >>>>>>> private static TransactionalDataSource lookupDataSource() { if (databaseManager == null) databaseManager = CDI.current().select(DatabaseManager.class).get(); return databaseManager.getDataSource(); } private BlockchainConfigUpdater lookupBlockhainConfigUpdater() { if (blockchainConfigUpdater == null) blockchainConfigUpdater = CDI.current().select(BlockchainConfigUpdater.class).get(); return blockchainConfigUpdater; } <<<<<<< blockchainConfig.rollback(lastBLock.getHeight()); log.debug("Deleted blocks starting from height %s", height); ======= lookupBlockhainConfigUpdater().rollback(lastBLock.getHeight()); LOG.debug("Deleted blocks starting from height %s", height); >>>>>>> lookupBlockhainConfigUpdater().rollback(lastBLock.getHeight()); log.debug("Deleted blocks starting from height %s", height);
<<<<<<< import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.slf4j.LoggerFactory.getLogger; ======= import javax.inject.Inject; >>>>>>> import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.slf4j.LoggerFactory.getLogger; import javax.inject.Inject;
<<<<<<< import com.apollocurrency.aplwallet.apl.core.db.DatabaseManager; import com.apollocurrency.aplwallet.apl.core.db.cdi.transaction.JdbiHandleFactory; import com.apollocurrency.aplwallet.apl.core.db.cdi.transaction.JdbiTransactionalInterceptor; import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextConfig; import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextTrigger; ======= import com.apollocurrency.aplwallet.apl.core.db.DatabaseManager; import com.apollocurrency.aplwallet.apl.core.db.DerivedTablesRegistry; import com.apollocurrency.aplwallet.apl.core.db.cdi.transaction.JdbiHandleFactory; import com.apollocurrency.aplwallet.apl.core.db.cdi.transaction.JdbiTransactionalInterceptor; import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextConfig; import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextTrigger; >>>>>>> import com.apollocurrency.aplwallet.apl.core.db.DatabaseManager; import com.apollocurrency.aplwallet.apl.core.db.cdi.transaction.JdbiHandleFactory; import com.apollocurrency.aplwallet.apl.core.db.cdi.transaction.JdbiTransactionalInterceptor; import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextConfig; import com.apollocurrency.aplwallet.apl.core.db.fulltext.FullTextTrigger; <<<<<<< .recursiveScanPackages(FullTextConfig.class) .interceptors(JdbiTransactionalInterceptor.class) .recursiveScanPackages(JdbiHandleFactory.class) .annotatedDiscoveryMode() //TODO: turn it on periodically in development process // to check CDI errors .devMode() .build(); ======= .recursiveScanPackages(DerivedTablesRegistry.class) .recursiveScanPackages(FullTextConfig.class) .annotatedDiscoveryMode() .interceptors(JdbiTransactionalInterceptor.class) .recursiveScanPackages(JdbiHandleFactory.class) .annotatedDiscoveryMode() //TODO: turn it on periodically in development processto check CDI errors // .devMode() // enable for dev only .build(); >>>>>>> .recursiveScanPackages(FullTextConfig.class) .interceptors(JdbiTransactionalInterceptor.class) .recursiveScanPackages(JdbiHandleFactory.class) .annotatedDiscoveryMode() //TODO: turn it on periodically in development processto check CDI errors // .devMode() // enable for dev only .build();
<<<<<<< return unconfirmedTransactionTable.getBroadcastedTransactions().toArray( new Transaction[unconfirmedTransactionTable.getBroadcastedTransactionsSize()]); ======= Set<Transaction> broadcastedTransactions = unconfirmedTransactionTable.getBroadcastedTransactions(); return broadcastedTransactions.toArray(new Transaction[0]); >>>>>>> Set<Transaction> broadcastedTransactions = unconfirmedTransactionTable.getBroadcastedTransactions(); return broadcastedTransactions.toArray(new Transaction[0]); <<<<<<< transactionValidator.validate(unconfirmedTransaction); ======= log.trace("Process waiting tx {}", unconfirmedTransaction.getId()); validator.validate(unconfirmedTransaction); >>>>>>> log.trace("Process waiting tx {}", unconfirmedTransaction.getId()); transactionValidator.validate(unconfirmedTransaction); <<<<<<< unconfirmedTransaction.setHeight(blockchain.getHeight()); ======= unconfirmedTransaction.setHeight(blockchain.getHeight()); >>>>>>> unconfirmedTransaction.setHeight(blockchain.getHeight());
<<<<<<< import com.apollocurrency.aplwallet.apl.core.http.HttpParameterParser; import com.apollocurrency.aplwallet.apl.core.rest.service.AccountBalanceService; ======= import com.apollocurrency.aplwallet.apl.core.http.ParameterParser; >>>>>>> import com.apollocurrency.aplwallet.apl.core.http.HttpParameterParser;
<<<<<<< if (myPeerServerPort == TESTNET_PEER_PORT && !blockchainConfig.isTestnet()) { throw new RuntimeException("Port " + TESTNET_PEER_PORT + " should only be used for testnet!!!"); } shareMyAddress = propertiesHolder.getBooleanProperty("apl.shareMyAddress") && ! propertiesHolder.isOffline(); ======= shareMyAddress = propertiesHolder.getBooleanProperty("apl.shareMyAddress") && ! Constants.isOffline; >>>>>>> shareMyAddress = propertiesHolder.getBooleanProperty("apl.shareMyAddress") && ! propertiesHolder.isOffline();
<<<<<<< import com.apollocurrency.aplwallet.apl.core.rest.service.AccountStatisticsService; ======= import com.apollocurrency.aplwallet.apl.core.rest.parameter.LongParameter; >>>>>>> import com.apollocurrency.aplwallet.apl.core.rest.service.AccountStatisticsService; import com.apollocurrency.aplwallet.apl.core.rest.parameter.LongParameter;
<<<<<<< public static final String DB_BACKUP_FORMAT = "BACKUP-BEFORE-%s.zip"; ======= public static final String TAGGED_DATA_TABLE_NAME = "tagged_data"; public static final String DATA_TAG_TABLE_NAME = "data_tag"; public static final String UNCONFIRMED_TX_TABLE_NAME = "unconfirmed_transaction"; public static final String GENESIS_PK_TABLE_NAME = "genesis_public_key"; >>>>>>> public static final String DB_BACKUP_FORMAT = "BACKUP-BEFORE-%s.zip"; public static final String TAGGED_DATA_TABLE_NAME = "tagged_data"; public static final String DATA_TAG_TABLE_NAME = "data_tag"; public static final String UNCONFIRMED_TX_TABLE_NAME = "unconfirmed_transaction"; public static final String GENESIS_PK_TABLE_NAME = "genesis_public_key";
<<<<<<< ======= setApiPort(response.get("apiPort")); setApiSSLPort(response.get("apiSSLPort")); >>>>>>> setApiPort(response.get("apiPort")); setApiSSLPort(response.get("apiSSLPort")); <<<<<<< setPlatform(pi.platform); analyzeHallmark(pi.hallmark); if (pi.chainId == null || !UUID.fromString(pi.chainId).equals(targetChainId)) { remove(); return; } chainId.set(UUID.fromString(pi.chainId)); ======= setPlatform((String) response.get("platform")); shareAddress = Boolean.TRUE.equals(response.get("shareAddress")); analyzeHallmark((String) response.get("hallmark")); >>>>>>> setPlatform(pi.platform); analyzeHallmark(pi.hallmark); if (pi.chainId == null || !UUID.fromString(pi.chainId).equals(targetChainId)) { remove(); return; } chainId.set(UUID.fromString(pi.chainId)); setPlatform((String) response.get("platform")); // shareAddress = Boolean.TRUE.equals(response.get("shareAddress")); analyzeHallmark((String) response.get("hallmark"));
<<<<<<< public void updateToLatestConfig() { Block lastBlock = lookupBlockDb().findLastBlock(); ======= public void updateToBlock() { Block lastBlock = lookupBlockDao().findLastBlock(); >>>>>>> public void updateToLatestConfig() { Block lastBlock = lookupBlockDao().findLastBlock();
<<<<<<< DerivedDbTablesRegistryImpl.class, BlockIndexDao.class, TransactionIndexDao.class, EpochTime.class, BlockDaoImpl.class, TransactionDaoImpl.class) ======= DerivedDbTablesRegistryImpl.class, JdbiHandleFactory.class, BlockIndexDao.class, TransactionIndexDao.class, TimeServiceImpl.class, BlockDaoImpl.class, TransactionDaoImpl.class) >>>>>>> DerivedDbTablesRegistryImpl.class, BlockIndexDao.class, TransactionIndexDao.class, TimeServiceImpl.class, BlockDaoImpl.class, TransactionDaoImpl.class)
<<<<<<< import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyService; ======= import com.apollocurrency.aplwallet.apl.core.monetary.MonetarySystem; import com.apollocurrency.aplwallet.apl.core.monetary.MonetarySystemExchange; >>>>>>> import com.apollocurrency.aplwallet.apl.core.service.state.currency.CurrencyService; <<<<<<< import static com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes.TransactionTypeSpec.MS_CURRENCY_ISSUANCE; import static com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes.TransactionTypeSpec.MS_CURRENCY_MINTING; import static com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes.TransactionTypeSpec.MS_RESERVE_CLAIM; import static com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes.TransactionTypeSpec.MS_RESERVE_INCREASE; import static com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes.TransactionTypeSpec.SHUFFLING_CREATION; @Slf4j ======= >>>>>>> import static com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes.TransactionTypeSpec.MS_CURRENCY_ISSUANCE; import static com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes.TransactionTypeSpec.MS_CURRENCY_MINTING; import static com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes.TransactionTypeSpec.MS_RESERVE_CLAIM; import static com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes.TransactionTypeSpec.MS_RESERVE_INCREASE; import static com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes.TransactionTypeSpec.SHUFFLING_CREATION; @Slf4j <<<<<<< public void validate(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.NotValidException { } @Override public void validateMissing(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.NotValidException { if (transaction.getType().getSpec() == MS_CURRENCY_ISSUANCE) { ======= public void validateMissing(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.NotValidException { log.trace("EXCHANGEABLE 2 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType() == MonetarySystem.CURRENCY_ISSUANCE) { >>>>>>> public void validateMissing(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.NotValidException { log.trace("EXCHANGEABLE 2 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType().getSpec() == MS_CURRENCY_ISSUANCE) { <<<<<<< public void validate(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.NotValidException { if (transaction.getType().getSpec() == TransactionTypes.TransactionTypeSpec.MS_CURRENCY_TRANSFER) { ======= public void validate(Currency currency, Transaction transaction, Set<CurrencyType> validators, long maxBalanceAtm, boolean isActiveCurrency) throws AplException.NotValidException { log.trace("CONTROLLABLE 1 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType() == MonetarySystem.CURRENCY_TRANSFER) { >>>>>>> public void validate(Currency currency, Transaction transaction, Set<CurrencyType> validators, long maxBalanceAtm, boolean isActiveCurrency) throws AplException.NotValidException { log.trace("CONTROLLABLE 1 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType().getSpec() == TransactionTypes.TransactionTypeSpec.MS_CURRENCY_TRANSFER) { <<<<<<< public void validate(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.ValidationException { if (transaction.getType().getSpec() == MS_CURRENCY_ISSUANCE) { ======= public void validate(Currency currency, Transaction transaction, Set<CurrencyType> validators, long maxBalanceAtm, boolean isActiveCurrency) throws AplException.ValidationException { log.trace("RESERVABLE 1 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType() == MonetarySystem.CURRENCY_ISSUANCE) { >>>>>>> public void validate(Currency currency, Transaction transaction, Set<CurrencyType> validators, long maxBalanceAtm, boolean isActiveCurrency) throws AplException.ValidationException { log.trace("RESERVABLE 1 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType().getSpec() == MS_CURRENCY_ISSUANCE) { <<<<<<< public void validateMissing(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.NotValidException { TransactionTypes.TransactionTypeSpec spec = transaction.getType().getSpec(); if (spec == MS_RESERVE_INCREASE) { ======= public void validateMissing(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.NotValidException { log.trace("RESERVABLE 2 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType() == MonetarySystem.RESERVE_INCREASE) { >>>>>>> public void validateMissing(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.NotValidException { log.trace("RESERVABLE 2 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType().getSpec() == MS_RESERVE_INCREASE) { <<<<<<< public void validate(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.ValidationException { if (transaction.getType().getSpec() == MS_CURRENCY_ISSUANCE) { ======= public void validate(Currency currency, Transaction transaction, Set<CurrencyType> validators, long maxBalanceAtm, boolean isActiveCurrency) throws AplException.ValidationException { log.trace("CLAIMABLE 1 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType() == MonetarySystem.CURRENCY_ISSUANCE) { >>>>>>> public void validate(Currency currency, Transaction transaction, Set<CurrencyType> validators, long maxBalanceAtm, boolean isActiveCurrency) throws AplException.ValidationException { log.trace("CLAIMABLE 1 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType().getSpec() == MS_CURRENCY_ISSUANCE) { <<<<<<< if (transaction.getType().getSpec() == MS_RESERVE_CLAIM) { // if (currency == null || !currency.isActive()) { if (currency == null || !lookupCurrencyService().isActive(currency)) { ======= if (transaction.getType() == MonetarySystem.RESERVE_CLAIM) { if (currency == null || !isActiveCurrency) { >>>>>>> if (transaction.getType().getSpec() == MS_RESERVE_CLAIM) { // if (currency == null || !currency.isActive()) { if (currency == null || !isActiveCurrency) { <<<<<<< public void validateMissing(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.NotValidException { if (transaction.getType().getSpec() == MS_RESERVE_CLAIM) { ======= public void validateMissing(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.NotValidException { log.trace("CLAIMABLE 2 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType() == MonetarySystem.RESERVE_CLAIM) { >>>>>>> public void validateMissing(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.NotValidException { log.trace("CLAIMABLE 2 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType().getSpec() == MS_RESERVE_CLAIM) { <<<<<<< public void validate(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.NotValidException { if (transaction.getType().getSpec() == MS_CURRENCY_ISSUANCE) { ======= public void validate(Currency currency, Transaction transaction, Set<CurrencyType> validators, long maxBalanceAtm, boolean isActiveCurrency) throws AplException.NotValidException { log.trace("MINTABLE 1 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType() == MonetarySystem.CURRENCY_ISSUANCE) { >>>>>>> public void validate(Currency currency, Transaction transaction, Set<CurrencyType> validators, long maxBalanceAtm, boolean isActiveCurrency) throws AplException.NotValidException { log.trace("MINTABLE 1 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType().getSpec() == MS_CURRENCY_ISSUANCE) { <<<<<<< public void validateMissing(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.NotValidException { if (transaction.getType().getSpec() == MS_CURRENCY_ISSUANCE) { ======= public void validateMissing(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.NotValidException { log.trace("MINTABLE 2 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType() == MonetarySystem.CURRENCY_ISSUANCE) { >>>>>>> public void validateMissing(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.NotValidException { log.trace("MINTABLE 2 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType().getSpec() == MS_CURRENCY_ISSUANCE) { <<<<<<< public void validate(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.ValidationException { if (transaction.getType().getSpec() == SHUFFLING_CREATION) { ======= public void validate(Currency currency, Transaction transaction, Set<CurrencyType> validators, long maxBalanceAtm, boolean isActiveCurrency) throws AplException.ValidationException { log.trace("NON_SHUFFLEABLE 1 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType() == ShufflingTransaction.SHUFFLING_CREATION) { >>>>>>> public void validate(Currency currency, Transaction transaction, Set<CurrencyType> validators, long maxBalanceAtm, boolean isActiveCurrency) throws AplException.ValidationException { log.trace("NON_SHUFFLEABLE 1 [{}]: \ncurrency={}, \n{}, \n{}", transaction.getECBlockHeight(), currency, transaction, validators); if (transaction.getType().getSpec() == SHUFFLING_CREATION) { <<<<<<< public abstract void validate(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.ValidationException; public abstract void validateMissing(Currency currency, Transaction transaction, Set<CurrencyType> validators) throws AplException.ValidationException; private static CurrencyService lookupCurrencyService() { if (currencyService == null) { currencyService = CDI.current().select(CurrencyService.class).get(); } return currencyService; } private static TransactionValidator transactionValidator() { if (transactionValidator == null) { transactionValidator = CDI.current().select(TransactionValidator.class).get(); } return transactionValidator; } private static TransactionValidator transactionValidator; ======= >>>>>>>
<<<<<<< import com.apollocurrency.aplwallet.apl.core.account.AccountControlType; ======= import com.apollocurrency.aplwallet.apl.core.account.Account; >>>>>>> import com.apollocurrency.aplwallet.apl.core.account.AccountControlType; <<<<<<< import com.apollocurrency.aplwallet.apl.core.account.model.Account; import com.apollocurrency.aplwallet.apl.core.app.Genesis; ======= import com.apollocurrency.aplwallet.apl.core.app.GenesisImporter; >>>>>>> import com.apollocurrency.aplwallet.apl.core.account.model.Account; import com.apollocurrency.aplwallet.apl.core.app.GenesisImporter;
<<<<<<< int maxThreads = conf.getSystemConfiguration().getCount(max); ThreadPoolExecutor tp = new ThreadPoolExecutor(maxThreads, maxThreads, 0L, TimeUnit.MILLISECONDS, queue, new NamingThreadFactory(name)); ======= int maxThreads = conf.getConfiguration().getCount(max); ThreadPoolExecutor tp = new ThreadPoolExecutor(maxThreads, maxThreads, 0L, TimeUnit.MILLISECONDS, queue, new NamingThreadFactory(name)); >>>>>>> int maxThreads = conf.getSystemConfiguration().getCount(max); ThreadPoolExecutor tp = new ThreadPoolExecutor(maxThreads, maxThreads, 0L, TimeUnit.MILLISECONDS, queue, new NamingThreadFactory(name)); <<<<<<< return addEs(name, new ThreadPoolExecutor(min, max, timeout, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new NamingThreadFactory(name))); ======= return addEs(name, new ThreadPoolExecutor(min, max, timeout, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new NamingThreadFactory(name))); >>>>>>> return addEs(name, new ThreadPoolExecutor(min, max, timeout, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new NamingThreadFactory(name))); <<<<<<< long maxMemory = acuConf.getAsBytes(Property.TSERV_MAXMEM); boolean usingNativeMap = acuConf.getBoolean(Property.TSERV_NATIVEMAP_ENABLED) && NativeMap.isLoaded(); ======= long maxMemory = acuConf.getMemoryInBytes(Property.TSERV_MAXMEM); boolean usingNativeMap = acuConf.getBoolean(Property.TSERV_NATIVEMAP_ENABLED) && NativeMap.isLoaded(); >>>>>>> long maxMemory = acuConf.getAsBytes(Property.TSERV_MAXMEM); boolean usingNativeMap = acuConf.getBoolean(Property.TSERV_NATIVEMAP_ENABLED) && NativeMap.isLoaded(); <<<<<<< if (dCacheSize + iCacheSize + sCacheSize + totalQueueSize > runtime.maxMemory()) { throw new IllegalArgumentException(String.format("Block cache sizes %,d and mutation queue size %,d is too large for this JVM configuration %,d", dCacheSize + iCacheSize + sCacheSize, totalQueueSize, runtime.maxMemory())); ======= if (dCacheSize + iCacheSize + totalQueueSize > runtime.maxMemory()) { throw new IllegalArgumentException(String.format( "Block cache sizes %,d and mutation queue size %,d is too large for this JVM configuration %,d", dCacheSize + iCacheSize, totalQueueSize, runtime.maxMemory())); >>>>>>> if (dCacheSize + iCacheSize + sCacheSize + totalQueueSize > runtime.maxMemory()) { throw new IllegalArgumentException(String.format( "Block cache sizes %,d and mutation queue size %,d is too large for this JVM configuration %,d", dCacheSize + iCacheSize + sCacheSize, totalQueueSize, runtime.maxMemory())); <<<<<<< "Maximum tablet server map memory %,d block cache sizes %,d and mutation queue size %,d is too large for this JVM configuration %,d", maxMemory, dCacheSize + iCacheSize + sCacheSize, totalQueueSize, runtime.maxMemory())); ======= "Maximum tablet server map memory %,d block cache sizes %,d and mutation queue size %,d is too large for this JVM configuration %,d", maxMemory, dCacheSize + iCacheSize, totalQueueSize, runtime.maxMemory())); >>>>>>> "Maximum tablet server map memory %,d block cache sizes %,d and mutation queue size %,d is too large for this JVM configuration %,d", maxMemory, dCacheSize + iCacheSize + sCacheSize, totalQueueSize, runtime.maxMemory())); <<<<<<< log.warn("Assignment for {} has been running for at least {}ms", extent, duration, runnable.getTask().getException()); ======= log.warn( "Assignment for " + extent + " has been running for at least " + duration + "ms", runnable.getTask().getException()); >>>>>>> log.warn("Assignment for {} has been running for at least {}ms", extent, duration, runnable.getTask().getException()); <<<<<<< ArrayList<TabletState> tabletStates = new ArrayList<>(tabletReportsCopy.values()); ======= ArrayList<TabletState> tabletStates = new ArrayList<TabletState>( tabletReportsCopy.values()); >>>>>>> ArrayList<TabletState> tabletStates = new ArrayList<>(tabletReportsCopy.values()); <<<<<<< log.warn("Memory manager asked to compact nonexistent tablet {}; manager implementation might be misbehaving", keyExtent); ======= log.warn("Memory manager asked to compact nonexistent tablet " + keyExtent + "; manager implementation might be misbehaving"); >>>>>>> log.warn( "Memory manager asked to compact nonexistent tablet {}; manager implementation might be misbehaving", keyExtent); <<<<<<< long timeout = System.currentTimeMillis() + conf.getSystemConfiguration().getTimeInMillis(Property.GENERAL_RPC_TIMEOUT); ======= long timeout = System.currentTimeMillis() + conf.getConfiguration().getTimeInMillis(Property.GENERAL_RPC_TIMEOUT); >>>>>>> long timeout = System.currentTimeMillis() + conf.getSystemConfiguration().getTimeInMillis(Property.GENERAL_RPC_TIMEOUT); <<<<<<< MajorCompactionRequest request = new MajorCompactionRequest(extent, reason, tableConf); ======= MajorCompactionRequest request = new MajorCompactionRequest(extent, reason, TabletServerResourceManager.this.fs, tableConf); >>>>>>> MajorCompactionRequest request = new MajorCompactionRequest(extent, reason, tableConf);
<<<<<<< @GET @Path("/history") @Produces(MediaType.APPLICATION_JSON) @Operation(tags = {"dex"}, summary = "Get trading history for certain account", description = "get trading history for certain account") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Wallets balances"), @ApiResponse(responseCode = "200", description = "Unexpected error") }) @PermitAll public Response getHistory( @NotNull @QueryParam("account") String account, @QueryParam("pair") String pair, @QueryParam("type") String type,@Context SecurityContext securityContext) throws NotFoundException { log.debug("getHistory: account: {}, pair: {}, type: {}", account, pair, type ); return Response.ok(service.getHistory(account,pair,type)).build(); } ======= >>>>>>> <<<<<<< @PermitAll public Response createOffer(@Parameter(description = "Type of the offer. (BUY/SELL) 0/1", required = true) @FormParam("offerType") Byte offerType, ======= public Response createOffer(@Parameter(description = "Type of the APL offer. (BUY APL / SELL APL) 0/1", required = true) @FormParam("offerType") Byte offerType, >>>>>>> @PermitAll public Response createOffer(@Parameter(description = "Type of the APL offer. (BUY APL / SELL APL) 0/1", required = true) @FormParam("offerType") Byte offerType, <<<<<<< @PermitAll public Response cancelOrderByOrderID(@Parameter(description = "Order id") @FormParam("orderId") String transactionIdStr, ======= public Response cancelOrderByOrderID(@Parameter(description = "Order id") @FormParam("orderId") String orderId, >>>>>>> @PermitAll public Response cancelOrderByOrderID(@Parameter(description = "Order id") @FormParam("orderId") String orderId, <<<<<<< @Operation(tags = {"dex"}, summary = "Eth gas info", description = "get gas prices for different tx speed.") @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Eth gas info")}) @PermitAll public Response dexEthInfo(@Context SecurityContext securityContext) throws NotFoundException, ExecutionException { ======= @Operation(tags = {"dex"}, summary = "Get history", description = "getting history") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Exchange offers"), @ApiResponse(responseCode = "200", description = "Unexpected error") }) public Response getSymbols( @Parameter(description = "Cryptocurrency identifier") @QueryParam("symbol") String symbol, @Context HttpServletRequest req) throws NotFoundException { >>>>>>> @Operation(tags = {"dex"}, summary = "Get history", description = "getting history") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Exchange offers"), @ApiResponse(responseCode = "200", description = "Unexpected error") }) @PermitAll public Response getSymbols( @Parameter(description = "Cryptocurrency identifier") @QueryParam("symbol") String symbol, @Context HttpServletRequest req) throws NotFoundException {
<<<<<<< Assert.assertNotNull("should have a table map.", stats.tableMap); Assert.assertTrue("root table should exist in " + stats.tableMap.keySet(), stats.tableMap.keySet().contains(RootTable.ID.canonicalID())); Assert.assertTrue("meta table should exist in " + stats.tableMap.keySet(), stats.tableMap.keySet().contains(MetadataTable.ID.canonicalID())); Assert.assertTrue("our test table should exist in " + stats.tableMap.keySet(), ======= assertNotNull("should have a table map.", stats.tableMap); assertTrue("root table should exist in " + stats.tableMap.keySet(), stats.tableMap.keySet().contains(RootTable.ID)); assertTrue("meta table should exist in " + stats.tableMap.keySet(), stats.tableMap.keySet().contains(MetadataTable.ID)); assertTrue("our test table should exist in " + stats.tableMap.keySet(), >>>>>>> assertNotNull("should have a table map.", stats.tableMap); assertTrue("root table should exist in " + stats.tableMap.keySet(), stats.tableMap.keySet().contains(RootTable.ID.canonicalID())); assertTrue("meta table should exist in " + stats.tableMap.keySet(), stats.tableMap.keySet().contains(MetadataTable.ID.canonicalID())); assertTrue("our test table should exist in " + stats.tableMap.keySet(),
<<<<<<< ======= import com.apollocurrency.aplwallet.apl.core.account.Account; import com.apollocurrency.aplwallet.apl.core.account.AccountTable; >>>>>>> <<<<<<< DerivedDbTablesRegistryImpl.class, BlockchainConfig.class, AccountServiceImpl.class, AccountTable.class ) ======= DerivedDbTablesRegistryImpl.class) >>>>>>> DerivedDbTablesRegistryImpl.class, BlockchainConfig.class, AccountServiceImpl.class, AccountTable.class) <<<<<<< AccountService accountService; ======= AccountTable accountTable; @Inject AccountGuaranteedBalanceTable accountGuaranteedBalanceTable; >>>>>>> AccountService accountService; @Inject AccountGuaranteedBalanceTable accountGuaranteedBalanceTable; <<<<<<< ======= Account.init(extension.getDatabaseManager(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, accountTable, accountGuaranteedBalanceTable,null); >>>>>>> <<<<<<< ======= Account.init(extension.getDatabaseManager(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, accountTable, accountGuaranteedBalanceTable,null); >>>>>>> <<<<<<< ======= Account.init(extension.getDatabaseManager(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, accountTable, accountGuaranteedBalanceTable,null); >>>>>>> <<<<<<< ======= Account.init(extension.getDatabaseManager(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, accountTable, accountGuaranteedBalanceTable,null); >>>>>>> <<<<<<< ======= Account.init(extension.getDatabaseManager(), mock(BlockchainProcessor.class), new BlockchainConfig(), blockchain, null, accountTable, accountGuaranteedBalanceTable,null); >>>>>>>
<<<<<<< import com.apollocurrency.aplwallet.apl.core.account.Account; ======= >>>>>>> import com.apollocurrency.aplwallet.apl.core.account.Account; <<<<<<< import com.apollocurrency.aplwallet.apl.core.dgs.dao.DGSPurchaseTable; ======= >>>>>>> import com.apollocurrency.aplwallet.apl.core.dgs.dao.DGSPurchaseTable; <<<<<<< import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; ======= >>>>>>> import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; <<<<<<< import java.io.IOException; import java.nio.file.Path; import java.sql.SQLException; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.UUID; import javax.inject.Inject; ======= import java.io.IOException; import java.nio.file.Path; import java.util.List; import java.util.Map; import java.util.UUID; import javax.inject.Inject; >>>>>>> import java.io.IOException; import java.nio.file.Path; import java.util.List; import java.util.Map; import java.util.UUID; import javax.inject.Inject; import java.io.IOException; import java.nio.file.Path; import java.sql.SQLException; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.UUID; import javax.inject.Inject;
<<<<<<< import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes; import com.apollocurrency.aplwallet.apl.core.transaction.types.update.UpdateTransactionType; import com.apollocurrency.aplwallet.apl.udpater.intfce.UpdaterMediatorImpl; ======= >>>>>>> import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.transaction.TransactionTypes; import com.apollocurrency.aplwallet.apl.core.transaction.types.update.UpdateTransactionType; import com.apollocurrency.aplwallet.apl.udpater.intfce.UpdaterMediatorImpl; <<<<<<< ======= import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.transaction.Update; >>>>>>> import com.apollocurrency.aplwallet.apl.core.entity.blockchain.Transaction; import com.apollocurrency.aplwallet.apl.core.transaction.Update;