Ticket #933 (closed Enhancement: fixed)

Opened 9 years ago

Last modified 9 years ago

Core API: introduce Model Factory

Reported by: jri Owned by: jri
Priority: Major Milestone: Release 4.8
Component: DeepaMehta Standard Distribution Version: 4.7
Keywords: Cc: dgf, Malte, JuergeN
Complexity: 8 Area: Application Framework / API
Module: deepamehta-core

Description (last modified by jri) (diff)

From an architectural viewpoint the various Core responsibilities -- DB access, DM object instantiation, Access Control, creating directives, firing events -- are partly still too intertwined. The current layering approach is not stringent and thus makes the DM Core more and more difficult to maintain. This became evident in the face of the required refactoring of the Delete operation (see #833).

Internally the Core's model classes needs direct read access to the DB resp. to the type model cache. On the other hand the direct DB access must not be available to Core API users (and furthermore the Core API users should not be supposed to pass the dms object when creating model instances). This can be realized by specifying public interfaces for the model classes too. The Core API user would instantiate model objects through a public Model Factory then.

Change History

comment:1 Changed 9 years ago by jri

  • Status changed from new to accepted

comment:2 Changed 9 years ago by jri

  • Description modified (diff)

comment:3 Changed 9 years ago by Jörg Richter <jri@…>

In 2fb56437c1c1124c1660683c3920743a65ca353a/deepamehta:

Core API: introduce Model Factory, pt.1 (#933).

See #933

comment:4 Changed 9 years ago by Jörg Richter <jri@…>

In 0cc296ca870635ce5150cf51c404f8bfe9475d5e/deepamehta:

Core API: introduce Model Factory, pt.2 (#933).

See #933

comment:5 Changed 9 years ago by Jörg Richter <jri@…>

In a87134a37bb837ecd9f67ff760b982b6083e7c39/deepamehta:

Core API: introduce Model Factory, pt.3 (#933).

See #933

comment:6 Changed 9 years ago by Jörg Richter <jri@…>

In b29390a0ae317635cb516f4d4f567ad5099a0dc0/deepamehta:

Core API: introduce Model Factory, pt.4 (#933).

See #933

comment:7 Changed 9 years ago by Jörg Richter <jri@…>

In c22c5e4752fda18c6dc6f964d300e80ed5039111/deepamehta:

Core API: introduce Model Factory, pt.5 (#933).

See #933

comment:8 Changed 9 years ago by Jörg Richter <jri@…>

In 8de2b9aed47416cf6bb8176bbf2aade36c2f4ad2/deepamehta:

Core API: introduce Model Factory, pt.6 (#933).

See #933

comment:9 Changed 9 years ago by Jörg Richter <jri@…>

In 98716498b65122414c4c6424c625b61c3e5adbf0/deepamehta:

Core API: introduce Model Factory, pt.7 (#933).

See #933

comment:10 Changed 9 years ago by Jörg Richter <jri@…>

In 1bd981180d4efb45e5a0c5b141974168a0acd759/deepamehta:

Core API: introduce Model Factory, pt.8 (#933).

The ModelFactory? is available in migrations as mf.

Core API

1 new method in DeepaMehtaService:

ModelFactory getModelFactory()

See #933

comment:11 Changed 9 years ago by Jörg Richter <jri@…>

In ead1be73805f74446304703b3dce0932e129471a/deepamehta:

Core API: introduce Model Factory, pt.9 (#933).

HUURRRRAAYY!! Core refactoring proceeds.

After 4 days of hard work the Core does compile again!

Now lets do the other 24 modules :-)

See #933

comment:12 Changed 9 years ago by Jörg Richter <jri@…>

comment:13 Changed 9 years ago by Jörg Richter <jri@…>

In 650d1700abf9a41a83336ed5647f36c568ba4a6f/deepamehta:

Provide ModelFactory? as OSGi service (#933).

Consumed by Neo4j Storage Service.

See #933

comment:14 Changed 9 years ago by Jörg Richter <jri@…>

In 8a3d0efa92f4153d8d631e4c712bf0194b4fb3cd/deepamehta:

Inject ModelFactory? into plugins (#933).

The ModelFactory? is available in a plugin main file as mf.

BREAKING CHANGE

Plugin developers can't create model objects with the new operator anymore.
Instead they must use the ModelFactory, that is the mf object. Example:

Old code:

new TopicModel(...)

Since DM 4.8:

mf.newTopicModel(...)

The mf object is available in the plugin main file and in imperative migrations (just as the dms object is).

The mf object adheres to the de.deepamehta.core.service.ModelFactory interface.

Note: all items in the de.deepamehta.core.model package that end with Model are interfaces now.
SimpleValue on the other hand remains a class and can still be instantiated with new (and IndexMode remains an enum).

See #933

comment:15 Changed 9 years ago by Jörg Richter <jri@…>

In 7cc316c89747c8fe1dec10d7d6f6d6128b82eba6/deepamehta:

Adapt Facets plugin (#933).

1 class renamed:

FacetValue -> FacetValueModel

It's just an interface now.

2 new factory methods:

FacetValueModel newFacetValueModel(String childTypeUri);

FacetValueModel newFacetValueModel(JSONObject facetValue);

Packaging remains to be revised.

See #933

comment:16 Changed 9 years ago by Jörg Richter <jri@…>

In e0b1a429dd7552236291d9f4703825789f95446e/deepamehta:

Adapt Topicmaps plugin (#933).

BREAKING CHANGES

3 classes moved:

de.deepamehta.plugins.topicmaps.model.TopicViewmodel       -> de.deepamehta.core.model.topicmaps.TopicViewModel
de.deepamehta.plugins.topicmaps.model.AssociationViewmodel -> de.deepamehta.core.model.topicmaps.AssociationViewModel

de.deepamehta.plugins.topicmaps.model.ViewProperties       -> de.deepamehta.core.model.topicmaps.ViewProperties

The former 2 are interfaces now. Note the uppercase M in Model.

2 new methods in ModelFactory:

TopicViewModel newTopicViewModel(TopicModel topic, ViewProperties viewProps);

AssociationViewModel newAssociationViewModel(AssociationModel assoc);

See #933

comment:17 Changed 9 years ago by Jörg Richter <jri@…>

In c0caf1a943c0bea301eeff2370cee1fdac4a0f82/deepamehta:

ModelFactory? refactoring: HHUURRRRAAYY!! (#933).

For the first time since 11 days the entire standard distro compiles again!

See #933

comment:18 Changed 9 years ago by Jörg Richter <jri@…>

In 66b58763fc36425f99c86bdaa8a1816c4a9d8943/deepamehta:

Repackage Facets Service (#933).

BREAKING CHANGES

1 class moved:

de.deepamehta.plugins.facets.model.FacetValue -> de.deepamehta.core.model.facets.FacetValueModel

Note that FacetValue is renamed and is a interface now.

2 new methods in ModelFactory:

FacetValueModel newFacetValueModel(String childTypeUri);

FacetValueModel newFacetValueModel(JSONObject facetValue);

See #933

comment:19 Changed 9 years ago by Jörg Richter <jri@…>

In a3c0850f95eed63217fa3ee7b38ed82e80679ce4/deepamehta:

Webservice: adapt JSON Object Provider (#933).

1 new static method in de.deepamehta.core.osgi.CoreActivator:

ModelFactory CoreActivator.getModelFactory();

See #933

comment:20 Changed 9 years ago by Jörg Richter <jri@…>

comment:21 Changed 9 years ago by jri

The "model-factory" work of the recent 2 weeks is now merged into master.

Please test!

comment:22 Changed 9 years ago by Jörg Richter <jri@…>

comment:23 Changed 9 years ago by Jörg Richter <jri@…>

comment:24 Changed 9 years ago by Jörg Richter <jri@…>

comment:25 Changed 9 years ago by Jörg Richter <jri@…>

In c7e77d0274262ea535ed83fa6bec39dafb48e222/deepamehta:

Fix assoc def creation (#933).

Thank you JuergeN for reporting!

See #933.

comment:26 Changed 9 years ago by jri

  • Status changed from accepted to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.