4 the 3rd party libraries
TRANSCRIPT
![Page 1: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/1.jpg)
BEXIS Tech Talk Series
#4: The 3rd Party Libraries
Javad ChamanaraApril 2016
![Page 2: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/2.jpg)
2
Recall
BEXIS Tech Talk #4: The 3rd Party Libraries
DB2 PgS
Data Access
Core Functions
UI
UI Framework
...
Modularity
IntegrationSynthesis Work
Semantic Search
Analytics
User Defined
Spatial Querying
External Tools
Web Services
Archiving
Import/ Export
Publishing
![Page 3: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/3.jpg)
3
User Interface
• jQuery• jQuery UI
No need to explain them
BEXIS Tech Talk #4: The 3rd Party Libraries
![Page 4: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/4.jpg)
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
![Page 5: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/5.jpg)
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
![Page 6: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/6.jpg)
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
![Page 7: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/7.jpg)
7
User Interface->Telerik
BEXIS Tech Talk #4: The 3rd Party Libraries
![Page 8: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/8.jpg)
8
User Interface
• Bootstrap– A framework for• HTML• CSS• JS
– Responsive design– On client side
BEXIS Tech Talk #4: The 3rd Party Libraries
![Page 9: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/9.jpg)
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
![Page 10: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/10.jpg)
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
![Page 11: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/11.jpg)
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
![Page 12: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/12.jpg)
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
![Page 13: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/13.jpg)
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
![Page 14: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/14.jpg)
14
Framework
• NHibernate– Object Relational Mapping (ORM)– Configuration Based Mappings– …– Version 4– URL: http://nhibernate.info/
BEXIS Tech Talk #4: The 3rd Party Libraries
![Page 15: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/15.jpg)
15
Vaiona
• IoC• Logging• Entities• Persistence• Serialization• Web
BEXIS Tech Talk #4: The 3rd Party Libraries
https://github.com/javadch/VWF.Mvc
![Page 16: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/16.jpg)
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
![Page 17: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/17.jpg)
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
![Page 18: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/18.jpg)
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
![Page 19: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/19.jpg)
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
![Page 20: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/20.jpg)
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
![Page 21: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/21.jpg)
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
![Page 22: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/22.jpg)
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
![Page 23: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/23.jpg)
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
![Page 24: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/24.jpg)
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
![Page 25: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/25.jpg)
25
Vaiona -> Entities
public class Party : BaseEntity{}public class Dataset : BusinessEntity{}
BEXIS Tech Talk #4: The 3rd Party Libraries
![Page 26: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/26.jpg)
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
public virtual void Dematerialize(bool includeChildren = true); public virtual void Materialize(bool includeChildren = true);}
![Page 27: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/27.jpg)
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
![Page 28: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/28.jpg)
28
Vaiona -> Persistence
• Persistence Mgmt.– Schema Export– DB creation– DB activity logging– Caching– Configuration– Session Sharing
BEXIS Tech Talk #4: The 3rd Party Libraries
![Page 29: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/29.jpg)
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
![Page 30: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/30.jpg)
30
Vaiona -> Persistence-> Arrangement
BEXIS Tech Talk #4: The 3rd Party Libraries
![Page 31: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/31.jpg)
31
Vaiona -> Persistence->Setup
Starting up the IoCprotected void Application_Start(){
IoCFactory.StartContainer (Path.Combine(AppConfiguration.AppRo
ot, "IoC.config"), "DefaultContainer");
…
BEXIS Tech Talk #4: The 3rd Party Libraries
![Page 32: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/32.jpg)
32
Vaiona -> Persistence->Setup
Exporting the schemaprotected void Application_Start(){ IPersistenceManager pManager = PersistenceFactory.GetPersistenceManager(); pManager.Configure(AppConfiguration.DefaultApplicationConnection.ConnectionString, AppConfiguration.DatabaseDialect, "Default", AppConfiguration.ShowQueries); if (AppConfiguration.CreateDatabase)
pManager.ExportSchema(); pManager.Start();
BEXIS Tech Talk #4: The 3rd Party Libraries
![Page 33: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/33.jpg)
33
Vaiona -> Persistence->Setup
Registering the DB session manager for MVC actionspublic static void RegisterGlobalFilters (GlobalFilterCollection filters){ filters.Add(new PersistenceContextProviderFilterAttribute());
BEXIS Tech Talk #4: The 3rd Party Libraries
![Page 34: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/34.jpg)
34
Vaiona -> Persistence
• Unit of Work– Transaction Mgmt.– Bulk operations
using (IUnitOfWork uow = persistenceManager.GetUnitOfWork()){
IRepository<Unit> repo = uow.GetRepository<Unit>();
// more repos, more changesrepo.Put(u);
uow.Commit(); // applies all the changes}
BEXIS Tech Talk #4: The 3rd Party Libraries
![Page 35: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/35.jpg)
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
![Page 36: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/36.jpg)
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
![Page 37: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/37.jpg)
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
![Page 38: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/38.jpg)
38
Vaiona -> Serialization
[AutomaticMaterializationInfo("Amendments", typeof(List<Amendment>), "XmlAmendments", typeof(XmlDocument))]
public abstract class DataTuple : BaseEntity
BEXIS Tech Talk #4: The 3rd Party Libraries
public abstract class BaseEntity{ public virtual void Dematerialize(bool
includeChildren=true){…} public virtual void Materialize(bool
includeChildren=true){…}}
![Page 39: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/39.jpg)
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
![Page 40: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/40.jpg)
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
![Page 41: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/41.jpg)
41
Vaiona -> Web
Layout.cshtml<body> <div id="informationContainer"> @Html.RenderAuto("Menu") </div>…
BEXIS Tech Talk #4: The 3rd Party Libraries
![Page 42: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/42.jpg)
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
![Page 43: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/43.jpg)
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
![Page 44: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/44.jpg)
44
Outlook
Whats next in the talk series?
How to develop a module for BExIS
BEXIS Tech Talk #4: The 3rd Party Libraries
![Page 45: 4 the 3rd party libraries](https://reader036.vdocument.in/reader036/viewer/2022070517/58d0171e1a28ab97708b4957/html5/thumbnails/45.jpg)
BEXIS Tech Talk #4: The 3rd Party Libraries 4545
Thanks!Questions?
Contact:[email protected]://bexis2.uni-jena.de
Acknowledgment