Uweheuer: Difference between revisions

From Wiki RB4
Line 92: Line 92:
Bookmarks Rest services are implemented in class <code>BookmarkTreeService</code>.
Bookmarks Rest services are implemented in class <code>BookmarkTreeService</code>.


==Initial Installation==
==Installation==
Create and fill database mysql505 per mysql tools. Copy war-file or directory tree to the webapp directory of the application server. Adjust Apache or Tomcat for proxying to JBoss ([[HomePCNew#Apache]])
Create and fill database mysql505 per mysql tools. Copy war-file or directory tree to the webapp directory of the application server. Adjust Apache or Tomcat for proxying to JBoss.
 
===[[HomePCNew#Apache|HomePC]]


==Persistence==
==Persistence==

Revision as of 19:26, 18 June 2017

Concept

Encryption

Notes are encrypted (and decrypted) by own algorithm implemented in Present.js and Present.java. Encryption and decryption (wrap(), unwrap()) works by a logical OR of a single character with a token (indiscernible) and represent the result as a 3 letter block consisting of a the character code with base 25 and filling the rest up randomly with a character of a list of p-z.

To check if the service callers are authorized, the actual timestamp is send uncrypted (haze) and encrypted (camouflage). On the server it is checked that the decrypted camouflage is equal to haze.

Bookmark comments are encrypted by AES. Client-side decryption is done by CryptoJS (in detail aes.js and mode-ecb-min.js are used from the downloaded zip-file).

  1. fool = user
  2. indiscernible = (unsichtbar) private token to hash a note
  3. camouflage = (Tarnung); hashed string; consists of chunks of 3 chars, the last chars are the XOR of string to hash and key converted to base 25 filled up to 3 with random letters not used in base.
  4. haze = (Nebel) actual timestamp
  5. bft = (AES) private token to hash bookmark comments (JS: amFrb2J0aGltbzEyMzQ1Ng==, Java on server and client (Crypt.java): jakobthimo123456)
  6. notepresent = package of present and camouflaged note
  7. present = package of fool, haze, camouflage of haze; used to verify if the notepresent sent was camouflaged correctly and valid, by checking if the unwrapped camouflage is equal to haze

Bookmarks

  • root node identified by name = 'My Bookmarks' or id = 1

Tree Versioning

  1. bookmark tree version is set to latest update or create action and stored at the root tree element

Tooltip

Online Bookmarks

  • see sequence diagram BookmarksApp

Offline Bookmarks

  • see sequence diagram CachedBookmarks

Notes

JavaScript application design is based on C:\Uwes\Documents\Software_Development\Programming\Languages\JavaScript\JQuery\How to Build a jQuery Mobile Application v1.1.pdf. See sequence diagram NotesApp.

Note Categories

  • add column to note table:
ALTER TABLE `note` ADD `category_id` BIGINT(20) NOT NULL DEFAULT '0' ;
  • add table 'notecategory' by importing
\src\notecategory.sql
  • categories can be selected for a note in the note editor, the id of the category is saved as attribute of a note
  • after creation a new category gets a random negative id which is updated with the server id in the local storage after the successful Ajax save call
  • see also Object Diagramm Notes JavaScript Objects

Backup Notes

  • notes are copied from the Server to Laptop by SynchronizeHostsTask->backupNotesFromVServer4You() which calls
c:\Uwes\Batches\CopyServer4YouNotesToLocalhost.bat

Saving a note

  • see sequence diagram onSaveNoteButtonTapped()

Management

DisAndEnable Application Service

  • see /server/rest/ManagementService.java restartApp() method
  • executes AppConfiguration.getRestartAppCommand() with is stored and encrypted in <JBOSS_DIR>/standalone/data/uweheuer/Configuration.properties
    • on Laptop:
cmd /c c:\\Uwes\\Batches\\DisAndEnableUweHeuerLaptop.bat
    • on HomePC:
/myprogs/DisAndEnableUweHeuer.bat

Reboot Service

Runtime Configuration

  • managed by class AppConfiguration
  • some parameters are read from the configuration file Configuration.properties in <JBOSS_DIR>\standalone\data\uweheuer directory, data stored AES encrypted Crypt and decrypted by /clientserver/Crypt.java, encryption of entries can be created by Eclipse project CryptTest
  • some parameters are set by string replacement in AppConfiguration.java during ant build before compilation
    • SAFE_MODE // which controls the Present.check(), in case it its true, the method does not perform any check

Libraries

JavaScript

Documentation

  1. s. <PROJECT_DIR>/doc/uweheuer.vsd
  2. s. <PROJECT_DIR>/vpproject/uweheuer.vpp (from eclipse Right Click -> 'Open with' -> 'System Editor'

Interfaces

Web Services

Web Services are implemented with Axis. The source files for the classes are in package server.webservices. Callbacks and stubs have been generated long time ago (see automatic comment in generated files) and needed for client implementations. The application acts as a web service client while doing synchronization. WSDL files are generated by target gen_wsdl but are not used. The mechanism used (Axis Servlet) is described here.

Rest Services

Rest services are implemented in package server.rest. The call path to the services is set in class JAXRSActivator.

Bookmarks Rest Services

Bookmarks Rest services are implemented in class BookmarkTreeService.

Installation

Create and fill database mysql505 per mysql tools. Copy war-file or directory tree to the webapp directory of the application server. Adjust Apache or Tomcat for proxying to JBoss.

===HomePC

Persistence

  • DB configuration see <PROJECT_DIR>\src\WEB-INF\classes\META-INF\persistence.xml and JBoss configuration, which defines the driver and the database connection string, which includes the DB name
  • EntityManagementUtil creates two EntityManagerFactories, one for bookmarks (definition see persistence.xml) and one for uweswiki (definition see persistence.xml)

Synchronization

Releases

  • Migration from Axis 1 to Axis 2
  • Migration from Hibernate to JPA implemented by Hibernate
  • Migration from Runtime JBoss 4.2 to JBoss 7.1

Operation

Generierung and Deployment

Die Generierung erfolgt über Ant (s. build.xml and Documentation->Build Process).

Shell

ant [deploy_laptop_jboss7|deploy_home|deploy_vserverjboss7]

Eclipse

Project -> Build Project ruft das target deploy_laptop auf.

Update Applet

  • press x (clear class loader cache) in java console
  • press 'Bookmark Applets' in menu

Crypt Data Handling

Die Generierung eines leeren Data-Files namens 'data.crypt' erfolgt über das Kommando:

C:\Uwes\eclipse\workspace\uweheuer\build\class>java server.CreateCryptDataFile.

Die Datei muss in das Verzeichnis <TOMCAT_HOME>/webapps/uweheuer/data kopiert werden z.B. mit

C:\Uwes\eclipse\workspace\uweheuer\build\class>copy data.crypt \Uwes\xampp\tomcat\webapps\uweheuer\data

Contacts

Update Contacts on Local Laptop

  • open C:\Uwes\WinScripts\ExportOutlookContactsbyVBA4Excel.xlsm
  • open Entwicklertools->Visual Basic and start Makro OutlookContactsToExcelWorksheet2 per Icon in top menu bar or
  • Ansicht -> Makros

=> this will create the file C:\Uwes\Programme\Java\JBoss\standalone\data\uweheuer\OutlookContactExportbyVBA4Excel.csv

Logging and Debuging

Logging

Server-side logging configuration is done via configuration in JBoss. The configuration is:

  • Configuration->Core->Logging->Log category 'uweheuer', Log Level 'INFO', handler 'uweheuer_periodic_file_handler'
  • Configuration->Core->Logging->Periodic handler 'uweheuer_periodic_file_handler', log level 'INFO', formatter '%d{HH:mm:ss,SSS} %-5p [%c] %C.%M() %s%E%n', ...

The coding uses LogUtil.java an the static method. It creates a logger named uweheuer which is used through out the code and which has the same name as the log category.

Logging on the client side is done via the printDebug() method, which goes at least to the java console.

Eclipse Debugging

  • debug server by JBoss
  • debug applet by Run -> Debug configurations -> Java Applet -> Debug TunnelAppletx