Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
core.pure.extensions.extension.pure Maven / Gradle / Ivy
// Copyright 2020 Goldman Sachs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import meta::java::metamodel::*;
import meta::pure::graphFetch::executionPlan::*;
import meta::pure::graphFetch::routing::*;
import meta::pure::graphFetch::*;
import meta::pure::tds::schema::*;
import meta::pure::executionPlan::*;
import meta::pure::router::routing::*;
import meta::pure::router::clustering::*;
import meta::pure::mapping::*;
import meta::core::runtime::*;
import meta::pure::store::*;
import meta::pure::extension::*;
import meta::external::format::shared::*;
Class meta::pure::extension::Extension
{
type : String[1];
// Store Extension --------------------------------------------------------------------------
availableStores : StoreContract[*];
// -------------------------------------------------------------------------- Store Extension
// External Format Extension ----------------------------------------------------------------
// TODO: We should change this package to better align with our strategy to have binding as core feature
availableExternalFormats : meta::external::format::shared::ExternalFormatContract[*];
// ---------------------------------------------------------------- External Format Extension
// Feature Extension ------------------------------------------------------------------------
availableFeatures : FeatureExtension[*];
// ------------------------------------------------------------------------ Feature Extension
routerExtensions()
{
$this.availableStores->concatenate($this.availableFeatures)->cast(@meta::pure::router::extension::RouterExtension)
} : meta::pure::router::extension::RouterExtension[*];
executionPlanExtensions()
{
$this.availableStores->concatenate($this.availableFeatures)->cast(@meta::pure::executionPlan::extension::ExecutionPlanExtension)
} : meta::pure::executionPlan::extension::ExecutionPlanExtension[*];
// Platform binding -------------------------------------------------------------------------
availablePlatformBindings : meta::pure::executionPlan::platformBinding::PlatformBinding[*];
// ------------------------------------------------------------------------- Platform binding
// ExecutePlan
executionPlan_execution_processNode : Function<{Mapping[1], Runtime[1], Pair[*], meta::pure::extension::Extension[*] -> Function<{Nil[1] -> Result[1]}>[*]}>[0..1];
executionPlan_execution_allNodes : Function<{meta::pure::extension::Extension[*] -> Function<{Nil[1] -> ExecutionNode[*]}>[*]}>[0..1];
executionPlan_execution_buildVariableTemplateString : Function<{String[1], Any[1], meta::pure::metamodel::type::Type[1] -> Function<{Nil[1] -> String[1]}>[*]}>[0..1];
// M2M concern that leaks to CSV and Flatdata. Remove when CSV and Flatdata are absorbed by ExternalFormat ------------------------------
graphExtension_calculateSourceTree : Function<{RootGraphFetchTree[1] -> Function<{Nil[1]->RootGraphFetchTree[1]}>[1]}>[0..1];
// --------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------
// meta::pure::tds::join is WRONGLY in Relational because it uses JoinType
// meta::pure::tds::extensions::columnValueDifference is WRONGLY in Relational because it uses Join
// meta::pure::tds::project(tds:meta::relational::mapping::TableTDS[1], columnFunctions:ColumnSpecification[*]) is in relational because of TableTDS but it should be deleted as TableTDS is a TabularDataSet
tdsSchema_resolveSchemaImpl : Function<{FunctionExpression[1], Map>[1], Extension[*] -> Pair, Function<{->SchemaState[1]}>>[*]}>[0..1];
//---------------------------------------------------------------------------------------------------------------------------------------
// testedBy navigates the Database structure. Should probably delete --------------------------------------------------------------------
testExtension_testedBy : Function<{ReferenceUsage[1], Extension[*] -> Function<{TestedByResult[1]->TestedByResult[1]}>[*]}>[0..1];
//---------------------------------------------------------------------------------------------------------------------------------------
// logActivities implementation is in Relationl because it casts Activity to RelationalActivity -----------------------------------------
logActivities : Function<{meta::pure::mapping::Activity[*] -> Nil[0]}>[0..1];
//---------------------------------------------------------------------------------------------------------------------------------------
// Used by the graph serializer to ensure we push serialize Test models stored in the system area ---------------------------------------
validTestPackages : String[*];
//---------------------------------------------------------------------------------------------------------------------------------------
// Serializer Extension ---------------------------------------------------------------------
serializerExtension : Function<{String[1]->String[1]}>[0..1];
serializerExtensionByProtocolVersion : Pair[*];
serializerExtension(version : String[1])
{
let ext = $this;
$this.serializerExtensionByProtocolVersion->filter(p|$p.first == $version)->match([
{ found : Pair [1] | $found.second; },
{ missing : Pair [0] |
let serializer = $this.fetchSerializerExtension($version);
if($serializer->isEmpty(),
| $serializer,
| $ext->mutateAdd('serializerExtensionByProtocolVersion', pair($version, $serializer->toOne()));
$serializer->toOne();
);
}]);
} : SerializerExtension[0..1];
fetchSerializerExtension(version : String[1])
{
if ($this.serializerExtension->isEmpty(),
|[],
|let funcString = $this.serializerExtension->toOne()->eval($version);
let func = $funcString->forgivingPathToElement()->cast(@Function<{String[1]->SerializerExtension[1]}>);
if($func->isEmpty(),
|[],
|$func->toOne()->eval($this.type)
);
)
} : SerializerExtension[0..1];
// --------------------------------------------------------------------- Serializer Extension
// Module Extension ---------------------------------------------------------------------
moduleExtensions : ModuleExtension[*];
moduleExtension(module:String[1])
{
$this.moduleExtensions->filter(f|$f.module == $module)->first()
} : ModuleExtension[0..1];
// --------------------------------------------------------------------- Module Extension
}
Class meta::pure::extension::SerializerExtension
{
}
Class meta::pure::extension::FeatureExtension extends meta::pure::router::extension::RouterExtension, meta::pure::executionPlan::extension::ExecutionPlanExtension
{
id : String[1];
}
Class meta::pure::extension::ModuleExtension
{
module : String[1];
}
// Extension printing ------------------------------------------------------------------------------
###Pure
import meta::pure::extension::*;
import meta::pure::extension::print::*;
import meta::pure::store::*;
import meta::external::format::shared::*;
import meta::pure::executionPlan::platformBinding::*;
function meta::pure::extension::print::printExtensions(extensions: Extension[*]): String[1]
{
$extensions->sortBy(x | $x.type->toLower())->map(ext | $ext->printExtension(1))->joinStrings('[\n', ',\n\n', '\n]')
}
function meta::pure::extension::print::printExtension(extension: Extension[1], depth: Integer[1]): String[1]
{
let indent = indent($depth);
let storeDetails =
if ($extension.availableStores->isEmpty(),
| '',
| $extension.availableStores
->map(s | $s->printStoreContract($depth + 2))
->joinStrings(indent($depth + 1) + 'Store Contracts: [\n', ',\n', '\n' + indent($depth + 1) + ']\n')
);
let externalFormatDetails =
if ($extension.availableExternalFormats->isEmpty(),
| '',
| $extension.availableExternalFormats
->map(c | $c->printExternalFormatContract($depth + 2))
->joinStrings(indent($depth + 1) + 'External Format Contracts: [\n', ',\n', '\n' + indent($depth + 1) + ']\n')
);
let featureDetails =
if ($extension.availableFeatures->isEmpty(),
| '',
| $extension.availableFeatures
->map(f | $f->printFeatureExtension($depth + 2))
->joinStrings(indent($depth + 1) + 'Feature Extensions: [\n', ',\n', '\n' + indent($depth + 1) + ']\n')
);
let platformBindingDetails =
if ($extension.availablePlatformBindings->isEmpty(),
| '',
| $extension.availablePlatformBindings
->map(p | $p->printPlatformBinding($depth + 2))
->joinStrings(indent($depth + 1) + 'Platform Bindings: [\n', ',\n', '\n' + indent($depth + 1) + ']\n')
);
$indent + $extension.type + '\n' +
$indent + '(\n' +
$storeDetails +
$externalFormatDetails +
$featureDetails +
$platformBindingDetails +
$indent + ')';
}
function <> meta::pure::extension::print::printStoreContract(contract: StoreContract[1], depth: Integer[1]): String[1]
{
indent($depth) + $contract.id
}
function <> meta::pure::extension::print::printExternalFormatContract(contract: ExternalFormatContract[1], depth: Integer[1]): String[1]
{
let indent = indent($depth);
$indent + $contract.id + '\n' +
$indent + '(\n' +
$contract.contentTypes
->map(t | indent($depth + 2) + $t)
->joinStrings(indent($depth + 1) + 'ContentTypes: [\n', ',\n', '\n' + indent($depth + 1) + ']\n') +
$indent + ')';
}
function <> meta::pure::extension::print::printFeatureExtension(feature: FeatureExtension[1], depth: Integer[1]): String[1]
{
indent($depth) + $feature.id
}
function <> meta::pure::extension::print::printPlatformBinding(platformBinding: PlatformBinding[1], depth: Integer[1]): String[1]
{
let indent = indent($depth);
$indent + $platformBinding.platformId + '\n' +
$indent + '(\n' +
$platformBinding.platformBindingExtensions
->map(e | indent($depth + 2) + $e.id)
->joinStrings(indent($depth + 1) + 'Extensions: [\n', ',\n', '\n' + indent($depth + 1) + ']\n') +
$indent + ')';
}
function <> meta::pure::extension::print::space(): String[1]
{
' '
}
function <> meta::pure::extension::print::indent(depth: Integer[1]): String[1]
{
range($depth)->map(x | space())->joinStrings()
}