Skip to content

Commit

Permalink
add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
akphi committed Nov 14, 2023
1 parent 0f5afed commit 431dede
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 49 deletions.
194 changes: 148 additions & 46 deletions docs/connection/new-connection-framework.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public Iterable<? extends Processor<?>> getExtraProcessors()
Connection.class,
(element, context) ->
{
// @HACKY: new-connection-framework
Root_meta_pure_metamodel_connection_Connection metamodel = new Root_meta_pure_metamodel_connection_Connection_Impl(element.name, null, context.pureModel.getClass("meta::pure::metamodel::connection::Connection"))._name(element.name);
connectionsIndex.put(context.pureModel.buildPackageString(element._package, element.name), metamodel);
metamodel._rawValue(element);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private static String renderElement(Connection element, PureGrammarComposerConte
String value;
try
{
// This is very super hacky!
// @HACKY: new-connection-framework
element.sourceInformation = null;
ObjectMapper objectMapper = PureProtocolObjectMapperFactory.getNewObjectMapper();
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@

Class meta::pure::metamodel::connection::Connection extends PackageableElement
{
// @HACKY: new-connection-framework
rawValue: Any[1];
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public Root_meta_pure_alloy_connections_alloy_authentication_AuthenticationStrat
Root_meta_pure_alloy_connections_alloy_authentication_AuthenticationConfigurationWrapper wrapper = new Root_meta_pure_alloy_connections_alloy_authentication_AuthenticationConfigurationWrapper_Impl("", null, context.pureModel.getClass("meta::pure::alloy::connections::alloy::authentication::AuthenticationConfigurationWrapper"));
try
{
// @HACKY: new-connection-framework
ObjectMapper objectMapper = PureProtocolObjectMapperFactory.getNewObjectMapper();
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public Root_meta_pure_alloy_connections_alloy_specification_DatasourceSpecificat
if (datasourceSpecification instanceof ConnectionSpecificationWrapper)
{
Root_meta_pure_alloy_connections_alloy_specification_ConnectionSpecificationWrapper wrapper = new Root_meta_pure_alloy_connections_alloy_specification_ConnectionSpecificationWrapper_Impl("", null, context.pureModel.getClass("meta::pure::alloy::connections::alloy::specification::ConnectionSpecificationWrapper"));
// @HACKY: new-connection-framework
try
{
ObjectMapper objectMapper = PureProtocolObjectMapperFactory.getNewObjectMapper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ public static String visitRelationalDatabaseConnectionDatasourceSpecification(Da
String value;
try
{
// This is very super hacky!
// @HACKY: new-connection-framework
_spec.sourceInformation = null;
ObjectMapper objectMapper = PureProtocolObjectMapperFactory.getNewObjectMapper();
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
Expand Down Expand Up @@ -713,7 +713,7 @@ public static String visitRelationalDatabaseConnectionAuthenticationStrategy(Aut
String value;
try
{
// This is very super hacky!
// @HACKY: new-connection-framework
_auth.sourceInformation = null;
ObjectMapper objectMapper = PureProtocolObjectMapperFactory.getNewObjectMapper();
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public AuthenticationConfigurationWrapper deserialize(JsonParser jsonParser, Des
AuthenticationConfigurationWrapper wrapper = new AuthenticationConfigurationWrapper();
JsonNode node = jsonParser.getCodec().readTree(jsonParser);
JsonNode valueNode = node.get("value");
// @HACKY: new-connection-framework
// NOTE: we do this so we can be lazy about compilation, Pure metamodel graph will treat the content as a string
if (valueNode.isTextual())
{
wrapper.value = PureProtocolObjectMapperFactory.getNewObjectMapper().readValue(valueNode.asText(), AuthenticationConfiguration.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public ConnectionSpecificationWrapper deserialize(JsonParser jsonParser, Deseria
ConnectionSpecificationWrapper wrapper = new ConnectionSpecificationWrapper();
JsonNode node = jsonParser.getCodec().readTree(jsonParser);
JsonNode valueNode = node.get("value");
// @HACKY: new-connection-framework
// NOTE: we do this so we can be lazy about compilation, Pure metamodel graph will treat the content as a string
if (valueNode.isTextual())
{
wrapper.value = PureProtocolObjectMapperFactory.getNewObjectMapper().readValue(valueNode.asText(), ConnectionSpecification.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Class meta::protocols::pure::vX_X_X::metamodel::store::relational::connection::a

Class meta::protocols::pure::vX_X_X::metamodel::store::relational::connection::alloy::authentication::AuthenticationConfigurationWrapper extends meta::protocols::pure::vX_X_X::metamodel::store::relational::connection::alloy::authentication::AuthenticationStrategy
{
// @HACKY: new-connection-framework
value : String[1];
}

Expand All @@ -84,6 +85,7 @@ Class meta::protocols::pure::vX_X_X::metamodel::store::relational::connection::a

Class meta::protocols::pure::vX_X_X::metamodel::store::relational::connection::alloy::specification::ConnectionSpecificationWrapper extends meta::protocols::pure::vX_X_X::metamodel::store::relational::connection::alloy::specification::DatasourceSpecification
{
// @HACKY: new-connection-framework
value : String[1];
}

Expand Down

0 comments on commit 431dede

Please sign in to comment.