Struttura e Coding Standards
Pacchetti
Backend
DB
Frontend
Fronted Legacy (vecchio Tomcat)
Configurazioni
Installazione tipica su sistema con interfaccia MitoCube (modern)
> rpm -vhi ivsbe-0.73.1-1.i686.rpm \
ivsdb-0.73.1-1.i686.rpm \
ivscfg-0.73.1-1.i686.rpm \
ivsfe-0.73.1-1.i686.rpmInstallazione tipica su sistema con interfaccia IVSViewer (mixed)
> rpm -vhi ivsbe-0.73.1-1.i686.rpm \
ivsdb-0.73.1-1.i686.rpm \
ivscfg-0.73.1-1.i686.rpm \
ivsfel-0.73.1-1.i686.rpmTrova la differenza....
Vengono distribuiti dei jar/war
ivs-archiver-rpm.jar
ivs-batch-rpm.jar
ivs-cronivs-rpm.jar
ivs-exporter-rpm.jar
ivs-index-rpm.jar
ivs-ipomelo-rpm.jar
ivs-ivsff-rpm.jar
ivs-repo-rpm.jar
ivs.warModern
Mixed
Italia ... coming soon
src/components/$ tree -L 1
.
├── deploy_to.sh
├── ivs-annotation
├── ivs-annotation_processor
├── ivs-archiver
├── ivs-batch
├── ivs-cerberus
├── ivs-commons
├── ivs-commons_core
├── ivs-cronivs
├── ivs-exporter
├── ivs-export_reader
├── ivs-index
├── ivs-ivsff
├── ivs-persistence
├── ivs-pomelo
├── ivs-repo
├── ivs-repository
├── ivs-views
├── ivs-webapp
├── pom.xml
└── script
19 directories, 2 filessrc/components/ivs-commons$ tree -L 3
.
├── pom.xml
└── src
├── main
│ ├── java
│ └── resources
└── test
├── java
├── kotlin
└── resources
8 directories, 1 file
> mvn compile<settings>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus_IVSPublic</id>
<mirrorOf>*</mirrorOf>
<url>https://nexus.rcslab.it/repository/IVS_public</url>
</mirror>
</mirrors>
</settings>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.10.3</version>
</dependency>pom padre
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
</dependency>ivs-view
Regole generali
Lasciamo il codice meglio di come lo troviamo
Farlo funzionare è solo l'inizio
In particolare
Evitiamo copia e incolla: cerchiamo un fattore comune
errorGobbler.start();
outputGobbler.start();
Worker worker = new Worker(proc);
worker.start();
// errorGobbler.join();
// outputGobbler.join();
try {
worker.join(timeout);
if (worker.exit != null){
retValue = worker.exit;
Log.log(Log.INF, "Executed ["+command+"]");
return retValue;
}
else
throw new TimeoutException();
} catch(InterruptedException ex) {
errorGobbler.interrupt();
outputGobbler.interrupt();
worker.interrupt();
Thread.currentThread().interrupt();
throw ex;
} finally {
proc.destroy();
}
public List<ConfiguredCdmModule> getConfiguredModules(int targetId)
throws IvsException {
try {
Map<String, CdmConfigure> configs = cdmDBAccess.getConfigurations(targetId);
Map<Integer, CdmModule> modules = moduleH.getAllModules();
return combine(modules, configs);
} catch (IvsPersistenceException | IOException e) {
throw new IvsException(e);
}
}
if(!archivedItems.contains(item))archivedItems.add(item);configs = configs.entrySet().stream().collect(
Collectors.toMap(
e -> e.getKey().toLowerCase(),
Entry::getValue
)
);
private String resolveModule(int modId) throws IvsException {
try {
return moduleH.getName(modId)
.orElseThrow(() -> new IvsException("module_id '" + modId + "' doesn't exist"));
} catch (IOException e) {
throw new IvsException(e);
}
}
Usare costrutti Java8 ove ha senso
Andiamo sul codice
FINE