Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
BEXIS Tech Talk Series
#4: The 3rd Party Libraries
Javad Chamanara
April 2016
Recall
BEXIS Tech Talk #4: The 3rd Party Libraries 2
DB2 PgS
Data Access
Core Functions
UI
UI Framework
...
Modularity
Int...
User Interface
• jQuery
• jQuery UI
No need to explain them 
BEXIS Tech Talk #4: The 3rd Party Libraries 3
User Interface
• Telerik Extensions for ASP.NET MVC
– Set of UI controls
– Server and Client side computation/binding
– Ba...
User Interface->Telerik
• Telerik Extensions for ASP.NET MVC
– Set of UI controls
– Server and Client side computation/bin...
User Interface->Telerik
@(Html.Telerik().Grid(Model.Data).Name("PrimaryDataResultGrid")
.DataBinding(dataBinding => dataBi...
User Interface->Telerik
BEXIS Tech Talk #4: The 3rd Party Libraries 7
User Interface
• Bootstrap
– A framework for
• HTML
• CSS
• JS
– Responsive design
– On client side
BEXIS Tech Talk #4: Th...
User Interface->Bootstrap
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li>@Html...
Framework
• Unity IoC
– Inversion of Control
– Dependency Injection
• Factory Pattern
– Service Locator
• Object life cycl...
Framework -> Unity
<alias alias="Logger" type="Vaiona.Logging.ILogger, Vaiona.Logging" />
<alias alias="DatabaseLogger"
ty...
Framework
• PostSharp
– Post Compilation Code Weaving
– Used in:
• Logging
• MVC Action handling
• Authorization
– Version...
Framework->PostSharp
public class DiagnoseAttribute : OnMethodBoundaryAspect
{
public override void OnEntry(MethodExecutio...
Framework
• NHibernate
– Object Relational Mapping (ORM)
– Configuration Based Mappings
– …
– Version 4
– URL: http://nhib...
Vaiona
• IoC
• Logging
• Entities
• Persistence
• Serialization
• Web
BEXIS Tech Talk #4: The 3rd Party Libraries 15
https...
Vaiona -> IoC
• Provides IoC services
• Decouples the clients from any concrete IoC
provider
• Used in Logging, Persistenc...
Vaiona -> Logging
• AOP, cross-cutting functionality
• Uses code interception and weaving techniques
(PostSharp)
• Aspects...
Vaiona -> Logging
//[RecordCall]
//[LogExceptions]
[Diagnose]
[MeasurePerformance]
public ActionResult Index(Int64 id=0)
{...
Vaiona -> Logging
• Entity Logging
– What happened to an entity
– What happened to the relation between 2 entities
• Custo...
Vaiona -> Logging
• Log records capture information about the:
– Web request (URL, agent, etc.)
– User information (userna...
Vaiona -> Logging
• Log management
– Web.config switches
<appSettings>
<add key="IsLoggingEnable" value="false" />
<add ke...
Vaiona -> Logging
• Usage scenarios
– System behavior monitoring
– Bottleneck detection
– Logical bug detection
– User stu...
Vaiona -> Logging
• Limitations
– Not possible to turn it on/off on individual
functions
– Exceptions on the logging itsel...
Vaiona -> Entities
• Base classes for:
– Persisting Data Entities
– Data Modification Auditing
– Versioning and Concurrenc...
Vaiona -> Entities
public class Party : BaseEntity
{
}
public class Dataset : BusinessEntity
{
}
BEXIS Tech Talk #4: The 3...
Vaiona -> Entities
public abstract class BaseEntity :
ISystemVersionedEntity
{
public virtual XmlNode Extra { get; set; }
...
Vaiona -> Entities
public abstract class BusinessEntity :
BaseEntity, IStatefullEntity,
IAuditableEntity
{
public virtual ...
Vaiona -> Persistence
• Persistence Mgmt.
– Schema Export
– DB creation
– DB activity logging
– Caching
– Configuration
– ...
Vaiona -> Persistence->Mappings
(NHibernate)
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="BExIS.Dlm.Ent...
Vaiona -> Persistence->
Arrangement
BEXIS Tech Talk #4: The 3rd Party Libraries 30
Vaiona -> Persistence->Setup
Starting up the IoC
protected void Application_Start()
{
IoCFactory.StartContainer
(Path.Comb...
Vaiona -> Persistence->Setup
Exporting the schema
protected void Application_Start()
{
IPersistenceManager pManager =
Pers...
Vaiona -> Persistence->Setup
Registering the DB session manager for MVC
actions
public static void RegisterGlobalFilters
(...
Vaiona -> Persistence
• Unit of Work
– Transaction Mgmt.
– Bulk operations
using (IUnitOfWork uow =
persistenceManager.Get...
Vaiona -> Persistence
• Repository
– CRUD operations on data entities
– Keeps track of changes
– Can return IQueryable for...
Vaiona -> Persistence
using (IUnitOfWork uow =
persistenceManager.GetUnitOfWork())
{
var x = new Unit();
IRepository<Unit>...
Vaiona -> Serialization
• Entities need to be de/serialized in XML
• Entities have attributes and relationships
• Object g...
Vaiona -> Serialization
[AutomaticMaterializationInfo(
"Amendments", typeof(List<Amendment>),
"XmlAmendments", typeof(XmlD...
Vaiona -> Web
• Web Request Interception
• MVC Action Interception
–Authorization
–Ambient Transaction Mgmt.
• Web Session...
Vaiona -> Web
• Layout Mgmt.
– Pages inherit layout from masters
– Masters separate between arrangement and
content
– Arra...
Vaiona -> Web
Layout.cshtml
<body>
<div id="informationContainer">
@Html.RenderAuto("Menu")
</div>
…
BEXIS Tech Talk #4: T...
Vaiona -> Web
Layout.xml
<MapItem ContentKey="Menu">
<ContentProviders>
<ContentProvider Area="Site" Controller="Nav"
Acti...
Lucene
• Apache Lucene.Net
• Search on
– Metadata
• Datasets created between 2010 and 2015
• Datasets in project sWEEP
– P...
Outlook
Whats next in the talk series?
How to develop a module for BExIS
BEXIS Tech Talk #4: The 3rd Party Libraries 44
4545
Thanks!
Questions?
Contact:
javad.chamanara@uni-jena.de
http://bexis2.uni-jena.de
BEXIS Tech Talk #4: The 3rd Party L...
Nächste SlideShare
Wird geladen in …5
×

4 the 3rd party libraries

211 Aufrufe

Veröffentlicht am

An introduction to the 3rd party libraries used in BExIS. Usage scenarios and exemplary codes are discussed.

Veröffentlicht in: Software
  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

4 the 3rd party libraries

  1. 1. BEXIS Tech Talk Series #4: The 3rd Party Libraries Javad Chamanara April 2016
  2. 2. Recall BEXIS Tech Talk #4: The 3rd Party Libraries 2 DB2 PgS Data Access Core Functions UI UI Framework ... Modularity Integration Synthesis Work Semantic Search Analytics User Defined Spatial Querying External Tools Web Services Archiving Import/ Export Publishing
  3. 3. User Interface • jQuery • jQuery UI No need to explain them  BEXIS Tech Talk #4: The 3rd Party Libraries 3
  4. 4. User Interface • Telerik Extensions for ASP.NET MVC – Set of UI controls – Server and Client side computation/binding – Based on jQuery – Extends the MVC’s HTML Helper • Grid • Chart • Splitter & Slider • TreeView • … BEXIS Tech Talk #4: The 3rd Party Libraries 4
  5. 5. User Interface->Telerik • Telerik Extensions for ASP.NET MVC – Set of UI controls – Server and Client side computation/binding – Based on jQuery – Extends the MVC’s HTML Helper • Grid • Chart • Splitter & Slider • TreeView • … BEXIS Tech Talk #4: The 3rd Party Libraries 5
  6. 6. User Interface->Telerik @(Html.Telerik().Grid(Model.Data).Name("PrimaryDataResultGrid") .DataBinding(dataBinding => dataBinding .Ajax() .Select("_CustomPrimaryDataBinding", "Data", new RouteValueDictionary { { "area", “ddm" }, { "datasetID", id } }) .OperationMode(GridOperationMode.Server) ) .EnableCustomBinding(true) .HtmlAttributes(new {@class = "primaryDataResultGrid" }) .ClientEvents(events => events .OnLoad("PrimaryDataResultGrid_OnLoad") .OnDataBound("PrimaryData_OnCommand") .OnColumnHide("PrimaryData_OnCommand") .OnColumnShow("PrimaryData_OnCommand") ) BEXIS Tech Talk #4: The 3rd Party Libraries 6
  7. 7. User Interface->Telerik BEXIS Tech Talk #4: The 3rd Party Libraries 7
  8. 8. User Interface • Bootstrap – A framework for • HTML • CSS • JS – Responsive design – On client side BEXIS Tech Talk #4: The 3rd Party Libraries 8
  9. 9. User Interface->Bootstrap <div id="navbarCollapse" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li>@Html.ActionLink("Dashboard", "Index", "Home", new {area = "" }, null)</li> <li>@Html.ActionLink("Search", "Index", "Home", new {area = "ddm" }, null)</li> </ul> … BEXIS Tech Talk #4: The 3rd Party Libraries 9
  10. 10. Framework • Unity IoC – Inversion of Control – Dependency Injection • Factory Pattern – Service Locator • Object life cycle mgmt. – Configuration Based – Version 2 – URL: https://github.com/unitycontainer/unity BEXIS Tech Talk #4: The 3rd Party Libraries 10
  11. 11. Framework -> Unity <alias alias="Logger" type="Vaiona.Logging.ILogger, Vaiona.Logging" /> <alias alias="DatabaseLogger" type="Vaiona.Logging.Loggers.DatabaseLogger, Vaiona.Logging" /> <register type="Logger" mapTo="DatabaseLogger" name="Diagnostics.Logging"> <lifetime type="singleton" /> </register> <register type="Logger" mapTo="DatabaseLogger" name="General.Logging"> <lifetime type="singleton" /> </register> return IoC.IoCFactory.Container.Resolve<ILogger>(); return IoC.IoCFactory.Container.Resolve<ILogger>("General.Logging"); BEXIS Tech Talk #4: The 3rd Party Libraries 11
  12. 12. Framework • PostSharp – Post Compilation Code Weaving – Used in: • Logging • MVC Action handling • Authorization – Version: 2.x (community) – URL: https://www.postsharp.net/ BEXIS Tech Talk #4: The 3rd Party Libraries 12
  13. 13. Framework->PostSharp public class DiagnoseAttribute : OnMethodBoundaryAspect { public override void OnEntry(MethodExecutionArgs args) { var sw = new Stopwatch(); sw.Start(); args.MethodExecutionTag = sw; } … BEXIS Tech Talk #4: The 3rd Party Libraries 13
  14. 14. Framework • NHibernate – Object Relational Mapping (ORM) – Configuration Based Mappings – … – Version 4 – URL: http://nhibernate.info/ BEXIS Tech Talk #4: The 3rd Party Libraries 14
  15. 15. Vaiona • IoC • Logging • Entities • Persistence • Serialization • Web BEXIS Tech Talk #4: The 3rd Party Libraries 15 https://github.com/javadch/VWF.Mvc
  16. 16. Vaiona -> IoC • Provides IoC services • Decouples the clients from any concrete IoC provider • Used in Logging, Persistence, Search • Configuration based for easy alteration • Multiple Mappings for each interface/implementation pair, suing namespaces BEXIS Tech Talk #4: The 3rd Party Libraries 16
  17. 17. Vaiona -> Logging • AOP, cross-cutting functionality • Uses code interception and weaving techniques (PostSharp) • Aspects (intercept functions’ execution) – Trace: records call to methods – Performance: records methods’ execution time – Diagnose: records methods’ arguments & return values – Exception: records not caught exceptions • And log to a DB table using the loggers BEXIS Tech Talk #4: The 3rd Party Libraries 17
  18. 18. Vaiona -> Logging //[RecordCall] //[LogExceptions] [Diagnose] [MeasurePerformance] public ActionResult Index(Int64 id=0) { LoggerFactory.LogCustom("Hi, I am a custom message!"); return View(); } BEXIS Tech Talk #4: The 3rd Party Libraries 18
  19. 19. Vaiona -> Logging • Entity Logging – What happened to an entity – What happened to the relation between 2 entities • Custom Logging – Free style programmer friendly logging BEXIS Tech Talk #4: The 3rd Party Libraries 19
  20. 20. Vaiona -> Logging • Log records capture information about the: – Web request (URL, agent, etc.) – User information (username) – Action performed (CRUD) – Call context (assembly, class, method) – Entity affected (id, type, relations affected) – Performance (execution time) – Diagnostics (parameters, arguments, return values) – General (date, time) BEXIS Tech Talk #4: The 3rd Party Libraries 20
  21. 21. Vaiona -> Logging • Log management – Web.config switches <appSettings> <add key="IsLoggingEnable" value="false" /> <add key="IsCallLoggingEnable" value="true" /> <add key="IsPerformanceLoggingEnable" value="true" /> <add key="IsDiagnosticLoggingEnable" value="true" /> <add key="IsExceptionLoggingEnable" value="true" /> </appSettings> Custom logs are always written! BEXIS Tech Talk #4: The 3rd Party Libraries 21
  22. 22. Vaiona -> Logging • Usage scenarios – System behavior monitoring – Bottleneck detection – Logical bug detection – User studies – Software improvement planning – Auditing – … BEXIS Tech Talk #4: The 3rd Party Libraries 22
  23. 23. Vaiona -> Logging • Limitations – Not possible to turn it on/off on individual functions – Exceptions on the logging itself are not caught – Log records are persisted async; no guarantee on writing BEXIS Tech Talk #4: The 3rd Party Libraries 23
  24. 24. Vaiona -> Entities • Base classes for: – Persisting Data Entities – Data Modification Auditing – Versioning and Concurrency Control – State Mgmt. BEXIS Tech Talk #4: The 3rd Party Libraries 24
  25. 25. Vaiona -> Entities public class Party : BaseEntity { } public class Dataset : BusinessEntity { } BEXIS Tech Talk #4: The 3rd Party Libraries 25
  26. 26. Vaiona -> Entities public abstract class BaseEntity : ISystemVersionedEntity { public virtual XmlNode Extra { get; set; } public virtual long Id { get; set; } public virtual int VersionNo { get; set; } BEXIS Tech Talk #4: The 3rd Party Libraries 26 public virtual void Dematerialize(bool includeChildren = true); public virtual void Materialize(bool includeChildren = true); }
  27. 27. Vaiona -> Entities public abstract class BusinessEntity : BaseEntity, IStatefullEntity, IAuditableEntity { public virtual EntityAuditInfo CreationInfo { get; set; } public virtual EntityAuditInfo ModificationInfo { get; set; } public virtual EntityStateInfo StateInfo { get; set; } } BEXIS Tech Talk #4: The 3rd Party Libraries 27
  28. 28. Vaiona -> Persistence • Persistence Mgmt. – Schema Export – DB creation – DB activity logging – Caching – Configuration – Session Sharing BEXIS Tech Talk #4: The 3rd Party Libraries 28
  29. 29. Vaiona -> Persistence->Mappings (NHibernate) <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="BExIS.Dlm.Entities" namespace="BExIS.Dlm.Entities.DataStructure"> <class xmlns="urn:nhibernate-mapping-2.2" name="Unit" table="Units" dynamic-update="true" select-before-update="true"> <id name="Id" type="Int64"> <column name="Id" /> <generator class="native" /> </id> <version name="VersionNo" type="Int32"> <column name="VersionNo" /> </version> <property name="Name" type="String"> <column name="Name" /> </property> <property name="Abbreviation" type="String"> <column name="Abbreviation" /> </property> <property name="Description" type="String"> <column name="Description" /> </property> … BEXIS Tech Talk #4: The 3rd Party Libraries 29
  30. 30. Vaiona -> Persistence-> Arrangement BEXIS Tech Talk #4: The 3rd Party Libraries 30
  31. 31. Vaiona -> Persistence->Setup Starting up the IoC protected void Application_Start() { IoCFactory.StartContainer (Path.Combine(AppConfiguration.AppRo ot, "IoC.config") , "DefaultContainer"); … BEXIS Tech Talk #4: The 3rd Party Libraries 31
  32. 32. Vaiona -> Persistence->Setup Exporting the schema protected void Application_Start() { IPersistenceManager pManager = PersistenceFactory.GetPersistenceManager(); pManager.Configure(AppConfiguration.DefaultApp licationConnection.ConnectionString, AppConfiguration.DatabaseDialect, "Default", AppConfiguration.ShowQueries); if (AppConfiguration.CreateDatabase) pManager.ExportSchema(); pManager.Start(); BEXIS Tech Talk #4: The 3rd Party Libraries 32
  33. 33. Vaiona -> Persistence->Setup Registering the DB session manager for MVC actions public static void RegisterGlobalFilters (GlobalFilterCollection filters) { filters.Add(new PersistenceContextProviderFilterAttribute()); BEXIS Tech Talk #4: The 3rd Party Libraries 33
  34. 34. Vaiona -> Persistence • Unit of Work – Transaction Mgmt. – Bulk operations using (IUnitOfWork uow = persistenceManager.GetUnitOfWork()) { IRepository<Unit> repo = uow.GetRepository<Unit>(); // more repos, more changes repo.Put(u); uow.Commit(); // applies all the changes } BEXIS Tech Talk #4: The 3rd Party Libraries 34
  35. 35. Vaiona -> Persistence • Repository – CRUD operations on data entities – Keeps track of changes – Can return IQueryable for: • further querying • Dynamic querying – Accepts: • LINQ expressions • named queries • native queries BEXIS Tech Talk #4: The 3rd Party Libraries 35
  36. 36. Vaiona -> Persistence using (IUnitOfWork uow = persistenceManager.GetUnitOfWork()) { var x = new Unit(); IRepository<Unit> repo = uow.GetRepository<Unit>(); repo.Get(p => p.Id == 21).First() .ConversionsIamTheSource.ToList() .ForEach(c => c.Source = x); var q = repo.Query(p => p.Abbreviation.StartsWith("m")); var w = from a in q where a.Dimension.Equals("Length") select (a); } BEXIS Tech Talk #4: The 3rd Party Libraries 36
  37. 37. Vaiona -> Serialization • Entities need to be de/serialized in XML • Entities have attributes and relationships • Object graphs may create cycles BEXIS Tech Talk #4: The 3rd Party Libraries 37
  38. 38. Vaiona -> Serialization [AutomaticMaterializationInfo( "Amendments", typeof(List<Amendment>), "XmlAmendments", typeof(XmlDocument))] public abstract class DataTuple : BaseEntity BEXIS Tech Talk #4: The 3rd Party Libraries 38 public abstract class BaseEntity { public virtual void Dematerialize(bool includeChildren=true){…} public virtual void Materialize(bool includeChildren=true){…} }
  39. 39. Vaiona -> Web • Web Request Interception • MVC Action Interception –Authorization –Ambient Transaction Mgmt. • Web Session Mgmt. –Per session culture settings –Multi tenancy BEXIS Tech Talk #4: The 3rd Party Libraries 39
  40. 40. Vaiona -> Web • Layout Mgmt. – Pages inherit layout from masters – Masters separate between arrangement and content – Arrangement in layout.cshtml file • HTML + placeholders – Content from services • Registered in layout.xml BEXIS Tech Talk #4: The 3rd Party Libraries 40
  41. 41. Vaiona -> Web Layout.cshtml <body> <div id="informationContainer"> @Html.RenderAuto("Menu") </div> … BEXIS Tech Talk #4: The 3rd Party Libraries 41
  42. 42. Vaiona -> Web Layout.xml <MapItem ContentKey="Menu"> <ContentProviders> <ContentProvider Area="Site" Controller="Nav" Action="Menu" Type="Action" Enabled="true"> <Parameters> <Parameter Name="oreintation" Value="1"/> </Parameters> </ContentProvider> </ContentProviders> </MapItem> BEXIS Tech Talk #4: The 3rd Party Libraries 42
  43. 43. Lucene • Apache Lucene.Net • Search on – Metadata • Datasets created between 2010 and 2015 • Datasets in project sWEEP – Primary data • Datasets that contain value 22 • Datasets that contain information about “temperature” • Datasets that have a “temperature” column and that column contains values >= 22 BEXIS Tech Talk #4: The 3rd Party Libraries 43
  44. 44. Outlook Whats next in the talk series? How to develop a module for BExIS BEXIS Tech Talk #4: The 3rd Party Libraries 44
  45. 45. 4545 Thanks! Questions? Contact: javad.chamanara@uni-jena.de http://bexis2.uni-jena.de BEXIS Tech Talk #4: The 3rd Party Libraries Acknowledgment

×