viernes, 5 de marzo de 2021

40. Creating the Server Socket

1. Get an Ubuntu server image

2. Set the IP static address as mentioned in Informatica Dantesca

3. Verify that the keyboard is set to your locale. (settings)

4. Change the host name: 

  sudo hostnamectl set-hostname my-new-name

5. Remove unwanted programs (maybe tomcat or others)

6. As we are going to use Selenium, we need to install:

     6.1. Google Chrome from: https://www.google.com/chrome/

     6.2. Chromium driver from: https://chromedriver.chromium.org/downloads and unzip the zip file in a folder (for instance "MyPrograms").

7 install ghoscript 

7. Create folders:

   /home/USER_INF/MyJars (IF,JaviSelenium,)

   /home/USER_INF/MyShells

8. Create folder myPrograms/SOCKET_SERVER

9. Copy in this folder these files or folders:

      9.1 startup_SocketServer.sh (shell script that is called form the service)

      9.2 socketserver.jar       

      9.3 Folder properties (and app.properties in this folder)

      9.4 Folder lib (with the dependencies: lombok, jsch, commons-lang, commons-io and common-exec

10. Create the service of the Socket server as mentioned in informatica Dantesca.

11. Install LibreOffice (minimal) for converting documents to PDF (apt-get install libreoffice --no-install-recommends)


miércoles, 3 de marzo de 2021

39. After generating the war. What to do?

1. Introduction

Most of the methods and procedures are executed in the standalone application called IFXX. There is another application for sending and receiving messages called SocketServer that are executed in the same server that IFXX. The Vaadin project must know the IP from the message server and the socket port to send and listen.

2. Modifying IFXX

The steps to do in this application are :

  1. Copy the dao.properties file  from the Vaadin project
  2. The persistence.xml MUST NOT include any reference to a JNI TOMCAT so the persistence unit must be:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
     <persistence-unit name="control_post" transaction-type="RESOURCE_LOCAL">
          <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
          <!-- BEGIN: FOR Data Source in Tomcat -->
          <!-- 
          <jta-data-source>java:comp/env/control_post</jta-data-source>
          -->
          <!--????? OJO: Revisar el context.xml de webapp/META-INF que apunta al servidor 192.168.28.29 -->
            
          <!-- END:   FOR Data Source in Tomcat-->
          
          <!-- The mapped supper class must be included in a <class> tag 2020.09.16 
               @see: https://stackoverflow.com/questions/4433341/what-is-the-right-path-to-refer-a-jar-file-in-jpa-persistence-xml-in-a-web-app
           -->
          
          <!--Mapped superclass  -->
          <class>openadmin.model.base.AuditIdLong          </class>
          
          <class>openadmin.model.control.Access            </class>
          <class>openadmin.model.control.Action            </class>
          <class>openadmin.model.control.ActionViewRole    </class>
          <class>openadmin.model.control.ClassName         </class>
          <class>openadmin.model.control.Configuracio      </class>
          
          <class>openadmin.model.control.EntityAdm         </class>
          <class>openadmin.model.control.MenuItem          </class>
          <class>openadmin.model.control.Program           </class>
          <class>openadmin.model.control.RoleGroup         </class>
          <class>openadmin.model.control.Role              </class>
          <class>openadmin.model.control.RolePerGroup      </class>
          <!--<class>openadmin.model.control.SiNo              </class> -->
          
          <class>openadmin.model.control.User              </class>
          
          <!-- YAML VIEW Classes  -->
          <!-- 
          <class>openadmin.model.yamlform.YAction        </class>
          <class>openadmin.model.yamlform.YComponent     </class>
          <class>openadmin.model.yamlform.YEvent         </class>
          <class>openadmin.model.yamlform.YProperty      </class>
          -->
          
          <!-- DBAYTO Metadata Classes  -->
          
          <class>openadmin.model.dbayto.metadatos.MtdRLTOptScpEnt          </class>
          <class>openadmin.model.dbayto.metadatos.EntsPerMetadataType      </class>
          <class>openadmin.model.dbayto.metadatos.MetadataType             </class>
          
           
          
          <exclude-unlisted-classes>true</exclude-unlisted-classes>
          
          <properties>
          		<property name="hibernate.dialect"	value="org.hibernate.dialect.PostgreSQLDialect" />
    		<property name="hibernate.hbm2ddl.auto" value="update" />
    		<property name="hibernate.show_sql" value="true" />				  
           		<!-- BEGIN: DataSource By Hibernate (NO TOMCAT) -->
           		<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/> 
           		<!-- property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/openweb"/> -->
           		<property name="hibernate.connection.url" value="jdbc:postgresql://192.168.28.XX:5432/openweb" />   
    		<property name="hibernate.connection.driver_class" value="org.postgresql.Driver" />
    		<property name="hibernate.connection.username" value="USER" />
    		<property name="hibernate.connection.password" value="PASSWORD" /> 
    		<!--  END:   DataSource By Hibernate (NO TOMCAT)  -->
          </properties>
    </persistence-unit>
    

  3. Take care that the persistence.xml in the Vaadin project and IF project is different!
  4. Generate the executable file and copy it to the folder informatica/MyJars/IF
  5. Copy configuration properties to this folder.

3. Modifying SocketServer

Must be executed in a server whose IP is in the app.properties of Vaadin. 
The properties file of SocketServer should be similar to this one:

1
2
3
4
5
#---location of shells scripts and java programs to be executed as external options
socket.port = 6666
java.path = /home/USER/MyPrograms/jdk-15.0.1/bin/java
jars.folder = /home/informatica/MyJars
shells.folder = /home/informatica/MyShells


4. Modifying Vaadin

In app.properties review this properties

socket.ip = 192.168.XX.XX (points the socket message server that execut3es the SocketServer)
socket.port = 6666 (Must be the same port of the SocketServer