Versione prod di advc con i moduli

This commit is contained in:
Gaetano Savo 2025-08-06 10:13:36 +02:00
parent 693b2de71f
commit f708ca0990
11 changed files with 1133 additions and 173 deletions

7
.gitignore vendored
View File

@ -2,8 +2,5 @@
*.log *.log
# Project directories # Project directories
arm_am-pom/ workspace/
asset-gui/
CustomLogFormatter/build.properties
CustomLogFormatter/custom-formatter.jar
CustomLogFormatter/build

View File

@ -1,3 +1,6 @@
{ {
"svn.delete.ignoredRulesForDeletedFiles": [
"target"
],
"java.configuration.updateBuildConfiguration": "interactive" "java.configuration.updateBuildConfiguration": "interactive"
} }

View File

@ -2,33 +2,20 @@
## Richieste ## Richieste
- voglio scaricare il progetto su <https://svn.armundia.com/svn/PRJarm_am/branches/ISPBEstero/ADV360-IOR-DEMO-JB74_B2025_VUB/arm_am-pom> - voglio scaricare il progetto su <https://svn.armundia.com/svn/PRJarm_am/branches/ISPBEstero/ADV360-BES-JB74/arm_am-pom>
- scarica anche <https://svn.armundia.com/svn/PRJarm_am/branches/ISPBEstero/ADV360-IOR-DEMO-JB74_B2025_VUB/asset-gui> - scarica anche <https://svn.armundia.com/svn/PRJarm_am/branches/ISPBEstero/ADV360-BES-JB74/asset-gui>
- crea un readme con le richieste che ho fatto - crea un readme con le richieste che ho fatto
- crea uno script powershell che fa il build ed il deploy di arm_am-pom su C:\Dev2012\BUILDERS\jboss-eap-7.4 - crea uno script powershell che fa il build ed il deploy di arm_am-pom su C:\Dev2012\BUILDERS\jboss-eap-7.4
- il pom è nel folder arm_am-pom - il pom è nel folder arm_am-pom
- java 8 è su C:\Dev2012\BUILDERS\java\jdk1.8.0_291 - java 8 è su C:\Dev2012\BUILDERS\java\jdk1.8.0_291
- aggiorna il readme - aggiorna il readme
- deve usare standalone-IOR-full.xml - deve usare standalone-ADVC-full.xml
- voglio compilare e lanciare il progetto asset-gui - voglio compilare e lanciare il progetto asset-gui
- jboss deve usare le opzioni "-DIDServer=GS -Dbtf.PathToParse=C:\Dev2012\advc0\in -Djava.awt.headless=true -DFilOptimize=true -DMTH_VALID_JB=internal -DskQueueElab=GS -DskQueueWrite=GS -DmtSession=GS" - jboss deve usare le opzioni "-DIDServer=GS -Dbtf.PathToParse=C:\Dev2012\advc0\in -Djava.awt.headless=true -DFilOptimize=true -DMTH_VALID_JB=internal -DskQueueElab=GS -DskQueueWrite=GS -DmtSession=GS"
- C:\Dev2012\BUILDERS\jboss-eap-7.4\bin\add-user.bat -u admin -p admin.123 -g SuperUser --silent
- dir $env:USERPROFILE\.m2\repository\com\armundia -Recurse | Where-Object { $_.Name -like "*.pom" }
## Projects Downloaded ## Projects Downloaded (Sync-Projects.ps1)
1. ARM AM POM Project
```bash
svn checkout https://svn.armundia.com/svn/PRJarm_am/branches/ISPBEstero/ADV360-IOR-DEMO-JB74_B2025_VUB/arm_am-pom
```
2. Asset GUI Project
```bash
svn checkout https://svn.armundia.com/svn/PRJarm_am/branches/ISPBEstero/ADV360-IOR-DEMO-JB74_B2025_VUB/asset-gui
```
Both projects were checked out at revision 132783.
## Project Structure ## Project Structure
@ -37,32 +24,37 @@ Both projects were checked out at revision 132783.
- Java/JEE project containing: - Java/JEE project containing:
- arm_am-ejb: EJB modules and web services - arm_am-ejb: EJB modules and web services
- arm_am-jUnit: Test files - arm_am-jUnit: Test files
- Various resources and configuration files - arm_am-web: Web application components
### asset-gui ### asset-gui
- Web application frontend project containing: - Web application frontend project containing:
- Frontend source code in `source` directory - Frontend source code in `source` directory
- UI libraries (Font Awesome, Bootstrap, amCharts, Roboto fonts) - UI libraries (Font Awesome, Bootstrap, amCharts, Roboto fonts)
- Environment configurations (LOCAL, VUB, CIB, PBZ, KOPER)
- Build configuration files (gulpfile.js, package.json, babel.config.js) - Build configuration files (gulpfile.js, package.json, babel.config.js)
## Build and Deployment Scripts ## Build and Deployment Scripts
### Sync-Projects.ps1
PowerShell script to sync projects:
- Scarica usando svn i progetti arm_am-pom, asset-gui e tutti i moduli utilizzati.
- Esegue il build dei jar dei moduli utilizzati e li aggiunge al repository mvn locale
### start-jboss.ps1 ### start-jboss.ps1
PowerShell script to start JBoss EAP 7.4 server: PowerShell script to start JBoss EAP 8.0 server:
- Uses Java 8 from `C:\Dev2012\BUILDERS\java\jdk1.8.0_291` - Uses Java 17 from `C:\Dev2012\BUILDERS\java\jdk-17.0.9`
- Uses `standalone-IOR-full.xml` configuration - Uses `standalone-full-ADV360-BES-EAP_8_POSTGRES.xml` configuration
- Starts JBoss in standalone mode with debug enabled - Sets required system properties
- Binds to all interfaces (0.0.0.0) - Admin console available at <http://localhost:9990>
- Management console available at <http://localhost:9990> - JBoss logs location: `C:\Dev2012\BUILDERS\jboss-eap-8.0\standalone\log\server-info.log`
- JBoss logs location: `C:\Dev2012\BUILDERS\jboss-eap-7.4\standalone\log\server.log`
### stop-jboss.ps1 ### stop-jboss.ps1
PowerShell script to stop JBoss EAP 7.4 server: PowerShell script to stop JBoss EAP 8.0 server:
- Finds and stops the JBoss process safely - Finds and stops the JBoss process safely
- Waits to ensure process is fully stopped - Waits to ensure process is fully stopped
@ -71,13 +63,9 @@ PowerShell script to stop JBoss EAP 7.4 server:
PowerShell script to build and deploy the arm_am-pom project: PowerShell script to build and deploy the arm_am-pom project:
- Uses Java 8 for building - Uses Java 17 for building
- Uses Maven profile `adv360-DEV` - Uses Maven profile `adv360-DEV`
- Builds modules in correct order: - Builds the EAR file
1. Parent POM
2. EJB module
3. WAR module
4. EAR module
- Deploys the EAR file to JBoss deployment directory - Deploys the EAR file to JBoss deployment directory
### build-and-run-asset-gui.ps1 ### build-and-run-asset-gui.ps1
@ -86,7 +74,7 @@ PowerShell script to build and run the asset-gui project:
- Installs Node.js dependencies (npm install) - Installs Node.js dependencies (npm install)
- Builds the project with minification (gulp build --minified) - Builds the project with minification (gulp build --minified)
- Starts the development server (gulp serve) - Starts development server
- Development server will be available at <http://localhost:3000> - Development server will be available at <http://localhost:3000>
## Build and Deploy Workflow ## Build and Deploy Workflow
@ -109,12 +97,11 @@ PowerShell script to build and run the asset-gui project:
.\build-and-run-asset-gui.ps1 .\build-and-run-asset-gui.ps1
``` ```
4. Monitor deployment:
- Check JBoss logs at `C:\Dev2012\BUILDERS\jboss-eap-7.4\standalone\log\server.log`
- Access JBoss admin console at <http://localhost:9990> - Access JBoss admin console at <http://localhost:9990>
- Access asset-gui frontend at <http://localhost:3000> - Access asset-gui frontend at <http://localhost:3000>
## Required Configuration ## Required Configuration
- JBoss configuration file: `standalone-IOR-full.xml` must be present in `C:\Dev2012\BUILDERS\jboss-eap-7.4\standalone\configuration\` - JBoss configuration file: `standalone-full-ADV360-BES-EAP_8_POSTGRES.xml` must be present in
`C:\Dev2012\BUILDERS\jboss-eap-8.0\standalone\configuration\`
- Node.js must be installed to build and run asset-gui - Node.js must be installed to build and run asset-gui

124
Sync-Projects.ps1 Normal file
View File

@ -0,0 +1,124 @@
# PowerShell script to checkout arm_am-pom, asset-gui and used modules and to build modules
# Configuration
$SVN_BASE_URL = "https://svn.armundia.com/svn/PRJarm_am/branches/ISPBEstero/ADV360-BES-JB74"
$SVN_BASE_URL_BW2_LIB = "https://svn.armundia.com/svn/PRJbw2"
$SVN_BASE_URL_ARM_LIB = "https://svn.armundia.com/svn/PRJarm_am"
$WORKSPACE_DIR = Join-Path $PSScriptRoot "workspace"
# Project paths
$PROJECTS = @{
# "arm_am-pom" = "$SVN_BASE_URL/arm_am-pom"
# "asset-gui" = "$SVN_BASE_URL/asset-gui"
# "AmazonAWS.S3" = "$SVN_BASE_URL_BW2_LIB/AmazonAWS.S3"
"arm-core-batch" = "$SVN_BASE_URL/batch_module"
"arm-core-document" = "$SVN_BASE_URL_BW2_LIB/branches/arm-core-document/arm-core-document-ispb"
"arm-core-event" = "$SVN_BASE_URL_BW2_LIB/trunk/arm-core-event"
"arm-core-perfo" = "$SVN_BASE_URL/arm-perfo"
"arm-core-print" = "$SVN_BASE_URL/arm-core-print/arm-core-print"
"arm-core-querybuilder" = "$SVN_BASE_URL_ARM_LIB/trunk/arm-core-querybuilder"
"arm-core-quest" = "$SVN_BASE_URL/arm-core-quest"
"arm-core-users" = "$SVN_BASE_URL_ARM_LIB/trunk/arm-core-users/arm-core-users"
"arm-core-utility" = "$SVN_BASE_URL_ARM_LIB/trunk/arm-core-utility"
"arm-core-utility-extra" = "$SVN_BASE_URL_ARM_LIB/trunk/arm-core-utility-extra"
"arm-core-var" = "$SVN_BASE_URL/arm-calcolo-VaR"
"arm-fileExporter" = "$SVN_BASE_URL_ARM_LIB/trunk/arm-fileExporter"
"arm-limiti" = "$SVN_BASE_URL/arm-limiti"
"arm-quadratore-portafogli" = "$SVN_BASE_URL/arm-quadratore-portafogli"
"arm-util" = "$SVN_BASE_URL_ARM_LIB/trunk/arm-util"
"aspose-manager" = "$SVN_BASE_URL/arm-core-print/aspose-manager"
"data-quality" = "$SVN_BASE_URL_ARM_LIB/trunk/data-quality/data-quality-default"
"shared-javaEE" = "$SVN_BASE_URL_BW2_LIB/trunk/Shared-JavaEE"
}
# Create workspace directory if it doesn't exist
if (-not (Test-Path $WORKSPACE_DIR)) {
New-Item -ItemType Directory -Path $WORKSPACE_DIR -Force
}
# Function to checkout or update a project
function Sync-Project {
param (
[string]$projectName,
[string]$svnUrl,
[string]$targetDir
)
$projectPath = Join-Path $targetDir $projectName
if (Test-Path $projectPath) {
Write-Host "Updating $projectName..." -ForegroundColor Yellow
Set-Location $projectPath
svn update
} else {
Write-Host "Checking out $projectName..." -ForegroundColor Yellow
Set-Location $targetDir
svn checkout $svnUrl $projectName
}
if ($LASTEXITCODE -eq 0) {
Write-Host "$projectName successfully checked out/updated" -ForegroundColor Green
} else {
Write-Host "Error checking out/updating $projectName" -ForegroundColor Red
}
}
# Store the original directory
$originalDirectory = Get-Location
try {
# Checkout/update each project
foreach ($project in $PROJECTS.GetEnumerator()) {
Sync-Project -projectName $project.Key -svnUrl $project.Value -targetDir $WORKSPACE_DIR
}
# Array of projects to build in order
$BUILD_ORDER = @(
# Base libraries
"shared-javaEE", # Base Java EE utilities
"arm-core-utility", # core utilities
"arm-core-utility-extra", # additional utilities
"arm-util", # general utilities
# Core functionality
"arm-core-document", # Document handling
"arm-core-event", # Event system
"arm-core-users", # User management
"arm-core-querybuilder", # Query building
"arm-core-print", # Printing system
# Business modules
"arm-core-quest", # Questionnaires
"arm-core-batch", # Batch processing
"arm-core-perfo", # Performance
"arm-core-var", # Risk calculation
"arm-fileExporter", # File export
"arm-limiti", # Limits management
"arm-quadratore-portafogli", # Portfolio management
# Additional components
"data-quality", # Data quality
"AmazonAWS.S3", # AWS S3 integration
"aspose-manager" # Document processing
)
# Build each project in order
foreach ($project in $BUILD_ORDER) {
Write-Host "Building $project..." -ForegroundColor Yellow
Set-Location (Join-Path $WORKSPACE_DIR $project)
mvn clean install -DskipTests
if ($LASTEXITCODE -eq 0) {
Write-Host "$project successfully built and installed" -ForegroundColor Green
} else {
Write-Host "Error building $project" -ForegroundColor Red
exit 1
}
}
} catch {
Write-Host "An error occurred: $_" -ForegroundColor Red
} finally {
# Restore original directory
Set-Location $originalDirectory
}

View File

@ -1,14 +1,22 @@
# PowerShell script for building and deploying arm_am-pom to JBoss EAP 7.4 # PowerShell script for building and deploying arm_am-pom to JBoss EAP 8.0
# Load configuration from JSON file # Read configuration from config.json
$config = Get-Content -Raw -Path "$PSScriptRoot\config.json" | ConvertFrom-Json $configPath = Join-Path $PSScriptRoot "config.json"
if (-not (Test-Path $configPath)) {
Write-Host "Error: config.json not found at $configPath" -ForegroundColor Red
exit 1
}
# Configuration variables from JSON $config = Get-Content $configPath -Raw | ConvertFrom-Json
$JBOSS_HOME = $config.jbossHome
# Configuration from config.json
$JBOSS_HOME = $config.jboss.jbossHome
$DEPLOYMENT_DIR = $config.jboss.deploymentDir
$PROJECT_DIR = $config.ear.projectDir $PROJECT_DIR = $config.ear.projectDir
$DEPLOYMENT_DIR = $config.deploymentDir
$MAVEN_PROFILE = $config.ear.mavenProfile $MAVEN_PROFILE = $config.ear.mavenProfile
$JAVA_HOME = $config.javaHome $JAVA_HOME = $config.jboss.javaHome
$ASSET_GUI_DIR = $config.assetGui.projectDir
$ASSET_GUI_TARGET = $config.assetGui.targetDir
# Store the original directory # Store the original directory
$originalDirectory = Get-Location $originalDirectory = Get-Location
@ -21,76 +29,123 @@ function Test-JBossRunning {
} }
Write-Host "Starting build and deploy process..." -ForegroundColor Green Write-Host "Starting build and deploy process..." -ForegroundColor Green
Write-Host "Using configuration:" -ForegroundColor Yellow
Write-Host " Java Home: $JAVA_HOME" -ForegroundColor Yellow
Write-Host " JBoss Home: $JBOSS_HOME" -ForegroundColor Yellow
Write-Host " Project Directory: $PROJECT_DIR" -ForegroundColor Yellow
Write-Host " Maven Profile: $MAVEN_PROFILE" -ForegroundColor Yellow
Write-Host " Asset GUI Directory: $ASSET_GUI_DIR" -ForegroundColor Yellow
# Check if Java exists # Check if Java exists
if (-not (Test-Path $JAVA_HOME)) { if (-not (Test-Path $JAVA_HOME)) {
Write-Host "Error: Java 8 not found at $JAVA_HOME" -ForegroundColor Red Write-Host "Error: Java not found at $JAVA_HOME" -ForegroundColor Red
Set-Location $originalDirectory # Restore original directory Set-Location $originalDirectory
exit 1 exit 1
} }
# Set JAVA_HOME for the build # Set JAVA_HOME for the build
$env:JAVA_HOME = $JAVA_HOME $env:JAVA_HOME = $JAVA_HOME
Write-Host "Using Java from: $JAVA_HOME" -ForegroundColor Yellow
# Check if JBoss directory exists # Check if JBoss directory exists
if (-not (Test-Path $JBOSS_HOME)) { if (-not (Test-Path $JBOSS_HOME)) {
Write-Host "Error: JBoss directory not found at $JBOSS_HOME" -ForegroundColor Red Write-Host "Error: JBoss directory not found at $JBOSS_HOME" -ForegroundColor Red
Set-Location $originalDirectory # Restore original directory Set-Location $originalDirectory
exit 1 exit 1
} }
# Check if project directory exists # Check if project directories exist
if (-not (Test-Path $PROJECT_DIR)) { if (-not (Test-Path $PROJECT_DIR)) {
Write-Host "Error: Project directory not found at $PROJECT_DIR" -ForegroundColor Red Write-Host "Error: Project directory not found at $PROJECT_DIR" -ForegroundColor Red
Set-Location $originalDirectory # Restore original directory Set-Location $originalDirectory
exit 1 exit 1
} }
# Navigate to project directory # Check Asset GUI directory and package.json
$skipAssetGui = $false
if (-not (Test-Path $ASSET_GUI_DIR)) {
Write-Host "Warning: Asset GUI directory not found at $ASSET_GUI_DIR" -ForegroundColor Yellow
Write-Host "Skipping Asset GUI build..." -ForegroundColor Yellow
$skipAssetGui = $true
}
elseif (-not (Test-Path (Join-Path $ASSET_GUI_DIR "package.json"))) {
Write-Host "Warning: package.json not found in Asset GUI directory" -ForegroundColor Yellow
Write-Host "Skipping Asset GUI build..." -ForegroundColor Yellow
$skipAssetGui = $true
}
if (-not $skipAssetGui) {
# Build and deploy Asset GUI
Write-Host "Building Asset GUI..." -ForegroundColor Yellow
Set-Location $ASSET_GUI_DIR
# Run npm install and build for Asset GUI
Write-Host "Installing Asset GUI dependencies..." -ForegroundColor Yellow
npm install
if ($LASTEXITCODE -ne 0) {
Write-Host "Warning: npm install failed! Skipping Asset GUI build..." -ForegroundColor Yellow
$skipAssetGui = $true
}
if (-not $skipAssetGui) {
Write-Host "Building Asset GUI..." -ForegroundColor Yellow
npm run build
if ($LASTEXITCODE -ne 0) {
Write-Host "Warning: Asset GUI build failed! Continuing with EAR build..." -ForegroundColor Yellow
$skipAssetGui = $true
}
else {
# Create Asset GUI target directory if it doesn't exist
if (-not (Test-Path $ASSET_GUI_TARGET)) {
New-Item -ItemType Directory -Path $ASSET_GUI_TARGET -Force
}
# Copy Asset GUI build to target directory
Write-Host "Copying Asset GUI build to target directory..." -ForegroundColor Yellow
Copy-Item -Path "$ASSET_GUI_DIR\dist\*" -Destination $ASSET_GUI_TARGET -Recurse -Force
}
}
}
# Build EAR project
Write-Host "Building EAR project..." -ForegroundColor Yellow
Set-Location $PROJECT_DIR Set-Location $PROJECT_DIR
# Clean and build the project with Maven # Build parent
Write-Host "Building project with Maven using profile $MAVEN_PROFILE..." -ForegroundColor Yellow Write-Host "Building parent project..." -ForegroundColor Yellow
Write-Host "Current directory: $(Get-Location)" -ForegroundColor Yellow mvn clean install -N "-P$MAVEN_PROFILE"
# First build the parent and modules with debug output
Write-Host "Building parent POM..." -ForegroundColor Yellow
& "$env:JAVA_HOME\bin\java" -version
mvn clean install -N -P$MAVEN_PROFILE
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
Write-Host "Maven parent build failed!" -ForegroundColor Red Write-Host "Maven parent build failed!" -ForegroundColor Red
Set-Location $originalDirectory # Restore original directory Set-Location $originalDirectory
exit 1 exit 1
} }
# Build the EJB module first with debug output # Build EJB module
Write-Host "Building EJB module..." -ForegroundColor Yellow Write-Host "Building EJB module..." -ForegroundColor Yellow
Set-Location "$PROJECT_DIR\arm_am-ejb" Set-Location "$PROJECT_DIR\arm_am-ejb"
mvn clean install -DskipTests -P$MAVEN_PROFILE mvn clean install -DskipTests "-P$MAVEN_PROFILE"
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
Write-Host "Maven EJB module build failed!" -ForegroundColor Red Write-Host "Maven EJB module build failed!" -ForegroundColor Red
Set-Location $originalDirectory # Restore original directory Set-Location $originalDirectory
exit 1 exit 1
} }
# Build the WAR module with debug output # Build WAR module
Write-Host "Building WAR module..." -ForegroundColor Yellow Write-Host "Building WAR module..." -ForegroundColor Yellow
Set-Location "$PROJECT_DIR\arm_am" Set-Location "$PROJECT_DIR\arm_am"
mvn clean install -DskipTests -P$MAVEN_PROFILE mvn clean install -DskipTests "-P$MAVEN_PROFILE"
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
Write-Host "Maven WAR module build failed!" -ForegroundColor Red Write-Host "Maven WAR module build failed!" -ForegroundColor Red
Set-Location $originalDirectory # Restore original directory Set-Location $originalDirectory
exit 1 exit 1
} }
# Finally build the EAR module with debug output # Build EAR module
Write-Host "Building EAR module..." -ForegroundColor Yellow Write-Host "Building EAR module..." -ForegroundColor Yellow
Set-Location "$PROJECT_DIR\arm_am-ear" Set-Location "$PROJECT_DIR\arm_am-ear"
mvn clean package -DskipTests -P$MAVEN_PROFILE mvn clean package -DskipTests "-P$MAVEN_PROFILE"
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
Write-Host "Maven EAR module build failed!" -ForegroundColor Red Write-Host "Maven EAR module build failed!" -ForegroundColor Red
Set-Location $originalDirectory # Restore original directory Set-Location $originalDirectory
exit 1 exit 1
} }
@ -100,20 +155,66 @@ $earFile = Get-ChildItem -Path "$PROJECT_DIR\arm_am-ear\target\*.ear" -ErrorActi
if (-not $earFile) { if (-not $earFile) {
Write-Host "Error: EAR file not found after build" -ForegroundColor Red Write-Host "Error: EAR file not found after build" -ForegroundColor Red
Write-Host "Searching in: $PROJECT_DIR\arm_am-ear\target\" -ForegroundColor Yellow Write-Host "Searching in: $PROJECT_DIR\arm_am-ear\target\" -ForegroundColor Yellow
Set-Location $originalDirectory # Restore original directory Set-Location $originalDirectory
exit 1 exit 1
} }
# Create deployments directory if it doesn't exist # Create deployments directory if it doesn't exist
if (-not (Test-Path $DEPLOYMENT_DIR)) { if (-not (Test-Path $DEPLOYMENT_DIR)) {
New-Item -ItemType Directory -Path $DEPLOYMENT_DIR New-Item -ItemType Directory -Path $DEPLOYMENT_DIR -Force
} }
# Copy EAR file to JBoss deployments directory # Copy EAR file to JBoss deployments directory
Write-Host "Deploying EAR to JBoss..." -ForegroundColor Yellow Write-Host "Deploying EAR to JBoss..." -ForegroundColor Yellow
Write-Host "Copying from: $($earFile.FullName)" -ForegroundColor Yellow Write-Host "Copying from: $($earFile.FullName)" -ForegroundColor Yellow
Write-Host "Copying to: $DEPLOYMENT_DIR" -ForegroundColor Yellow Write-Host "Copying to: $DEPLOYMENT_DIR" -ForegroundColor Yellow
Copy-Item $earFile.FullName $DEPLOYMENT_DIR
# Remove existing deployment if present
$deployedEarPath = Join-Path $DEPLOYMENT_DIR $config.ear.deployedFile
if (Test-Path $deployedEarPath) {
Write-Host "Removing existing deployment..." -ForegroundColor Yellow
Remove-Item $deployedEarPath -Force
}
# Copy new EAR file with the configured name
Copy-Item $earFile.FullName $deployedEarPath
# Unpack EAR if configured
if ($config.ear.unpackDir) {
Write-Host "Unpacking EAR to: $($config.ear.unpackDir)" -ForegroundColor Yellow
# Create unpack directory if it doesn't exist
if (-not (Test-Path $config.ear.unpackDir)) {
New-Item -ItemType Directory -Path $config.ear.unpackDir -Force
}
# Clean existing content
Remove-Item "$($config.ear.unpackDir)\*" -Recurse -Force -ErrorAction SilentlyContinue
# Use 7-Zip to unpack the EAR (Java JAR files are ZIP format)
try {
$7zPath = "C:\Program Files\7-Zip\7z.exe"
if (Test-Path $7zPath) {
# Use 7-Zip
Start-Process -FilePath $7zPath -ArgumentList "x", "`"$deployedEarPath`"", "-o`"$($config.ear.unpackDir)`"", "-y" -Wait -NoNewWindow
} else {
# Fallback to jar command from Java
$jarPath = Join-Path $JAVA_HOME "bin\jar.exe"
if (Test-Path $jarPath) {
Set-Location $config.ear.unpackDir
Start-Process -FilePath $jarPath -ArgumentList "xf", "`"$deployedEarPath`"" -Wait -NoNewWindow
} else {
Write-Host "Warning: Could not unpack EAR - neither 7-Zip nor jar command found" -ForegroundColor Yellow
}
}
}
catch {
Write-Host "Warning: Failed to unpack EAR: $_" -ForegroundColor Yellow
}
finally {
Set-Location $originalDirectory
}
}
# Check if JBoss is running # Check if JBoss is running
if (Test-JBossRunning) { if (Test-JBossRunning) {
@ -122,7 +223,14 @@ if (Test-JBossRunning) {
Write-Host "Note: JBoss is not running. Start JBoss to complete deployment" -ForegroundColor Yellow Write-Host "Note: JBoss is not running. Start JBoss to complete deployment" -ForegroundColor Yellow
} }
Write-Host "Build and deploy process completed!" -ForegroundColor Green Write-Host "Build and deploy process completed successfully!" -ForegroundColor Green
if (-not $skipAssetGui) {
Write-Host " - Asset GUI deployed to: $ASSET_GUI_TARGET" -ForegroundColor Green
}
Write-Host " - EAR deployed to: $deployedEarPath" -ForegroundColor Green
if ($config.ear.unpackDir) {
Write-Host " - EAR unpacked to: $($config.ear.unpackDir)" -ForegroundColor Green
}
# Restore the original directory # Restore the original directory
Set-Location $originalDirectory Set-Location $originalDirectory

View File

@ -1,10 +1,7 @@
# PowerShell script to build and run asset-gui # PowerShell script to build and run asset-gui
# Load configuration from JSON file $projectDir = ".\workspace\asset-gui"
$config = Get-Content -Raw -Path "$PSScriptRoot\config.json" | ConvertFrom-Json $targetDir = ".\workspace\arm_am-pom\arm_am\WebContent\adv"
$projectDir = $config.assetGui.projectDir
$targetDir = $config.assetGui.targetDir
Write-Host "Building asset-gui project..." -ForegroundColor Green Write-Host "Building asset-gui project..." -ForegroundColor Green
@ -14,9 +11,8 @@ if (-not (Test-Path $targetDir)) {
New-Item -ItemType Directory -Path $targetDir -Force New-Item -ItemType Directory -Path $targetDir -Force
} }
# Convert to absolute path and change to project directory # Change to project directory
$absoluteProjectDir = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot $projectDir)) Push-Location $projectDir
Push-Location $absoluteProjectDir
try { try {
# Install dependencies # Install dependencies
@ -30,19 +26,23 @@ try {
# Copy release folder to target directory # Copy release folder to target directory
Write-Host "Copying release folder to $targetDir..." -ForegroundColor Yellow Write-Host "Copying release folder to $targetDir..." -ForegroundColor Yellow
Pop-Location # Return to original directory to use relative paths correctly Pop-Location # Return to original directory to use relative paths correctly
$releaseDir = Join-Path $absoluteProjectDir "release" if (Test-Path ".\workspace\asset-gui\release") {
if (Test-Path $releaseDir) { # Remove existing content in target directory
$absoluteTargetDir = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot $targetDir)) if (Test-Path $targetDir) {
Copy-Item -Path "$releaseDir\*" -Destination $absoluteTargetDir -Recurse -Force Remove-Item -Path "$targetDir\*" -Recurse -Force
}
# Copy new content
Copy-Item -Path ".\workspace\asset-gui\release\*" -Destination $targetDir -Recurse -Force
Write-Host "Release folder copied successfully!" -ForegroundColor Green
} else { } else {
Write-Host "Error: Release folder not found at $releaseDir" -ForegroundColor Red Write-Host "Error: Release folder not found at .\workspace\asset-gui\release" -ForegroundColor Red
} }
# Change back to project directory for serving # Change back to project directory for serving
Push-Location $projectDir Push-Location $projectDir
# Start development server # Start the development server
Write-Host "Starting development server..." -ForegroundColor Green Write-Host "Starting development server..." -ForegroundColor Yellow
gulp watch gulp watch
} finally { } finally {
# Return to original directory # Return to original directory

View File

@ -1,9 +1,9 @@
{ {
"jboss": {
"configFile": "standalone-ADVK-full.xml",
"jbossHome": "C:\\Dev2012\\BUILDERS\\jboss-eap-7.4", "jbossHome": "C:\\Dev2012\\BUILDERS\\jboss-eap-7.4",
"deploymentDir": "C:\\Dev2012\\BUILDERS\\jboss-eap-7.4\\standalone\\deployments", "deploymentDir": "C:\\Dev2012\\BUILDERS\\jboss-eap-7.4\\standalone\\deployments",
"javaHome": "C:\\Dev2012\\BUILDERS\\java\\jdk1.8.0_291", "javaHome": "C:\\Dev2012\\BUILDERS\\java\\jdk1.8.0_291"
"jboss": {
"configFile": "standalone-IOR-full.xml"
}, },
"customFormatter": { "customFormatter": {
"src": "src", "src": "src",
@ -12,13 +12,13 @@
"jar": "custom-formatter.jar" "jar": "custom-formatter.jar"
}, },
"ear": { "ear": {
"projectDir": "C:\\Dev2012\\source\\WindSurf\\adv\\arm_am-pom", "projectDir": "C:\\Dev2012\\source\\WindSurf\\adv7\\workspace\\arm_am-pom",
"mavenProfile": "adv360-DEV", "mavenProfile": "adv360-DEV",
"deployedFile": "adv360-ear.ear", "deployedFile": "adv360-ear.ear",
"unpackDir": ".\\arm_am-unpacked" "unpackDir": "C:\\Dev2012\\source\\WindSurf\\adv7\\workspace\\arm_am-unpacked"
}, },
"assetGui": { "assetGui": {
"projectDir": ".\\asset-gui", "projectDir": "C:\\Dev2012\\source\\WindSurf\\adv7\\workspace\\asset-gui",
"targetDir": ".\\arm_am-pom\\arm_am\\WebContent\\adv" "targetDir": "C:\\Dev2012\\source\\WindSurf\\adv7\\workspace\\arm_am-pom\\arm_am\\WebContent\\adv"
} }
} }

View File

@ -0,0 +1,637 @@
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns="urn:jboss:domain:16.0">
<extensions>
<extension module="org.jboss.as.clustering.infinispan"/>
<extension module="org.jboss.as.connector"/>
<extension module="org.jboss.as.deployment-scanner"/>
<extension module="org.jboss.as.ee"/>
<extension module="org.jboss.as.ejb3"/>
<extension module="org.jboss.as.jaxrs"/>
<extension module="org.jboss.as.jdr"/>
<extension module="org.jboss.as.jmx"/>
<extension module="org.jboss.as.jpa"/>
<extension module="org.jboss.as.jsf"/>
<extension module="org.jboss.as.jsr77"/>
<extension module="org.jboss.as.logging"/>
<extension module="org.jboss.as.mail"/>
<extension module="org.jboss.as.naming"/>
<extension module="org.jboss.as.pojo"/>
<extension module="org.jboss.as.remoting"/>
<extension module="org.jboss.as.sar"/>
<extension module="org.jboss.as.security"/>
<extension module="org.jboss.as.transactions"/>
<extension module="org.jboss.as.webservices"/>
<extension module="org.jboss.as.weld"/>
<extension module="org.wildfly.extension.batch.jberet"/>
<extension module="org.wildfly.extension.bean-validation"/>
<extension module="org.wildfly.extension.clustering.web"/>
<extension module="org.wildfly.extension.core-management"/>
<extension module="org.wildfly.extension.discovery"/>
<extension module="org.wildfly.extension.ee-security"/>
<extension module="org.wildfly.extension.elytron"/>
<extension module="org.wildfly.extension.health"/>
<extension module="org.wildfly.extension.io"/>
<extension module="org.wildfly.extension.messaging-activemq"/>
<extension module="org.wildfly.extension.metrics"/>
<extension module="org.wildfly.extension.request-controller"/>
<extension module="org.wildfly.extension.security.manager"/>
<extension module="org.wildfly.extension.undertow"/>
<extension module="org.wildfly.iiop-openjdk"/>
</extensions>
<system-properties>
<property name="ID.SERVER" value="BES_LOCAL"/>
<property name="OUTPUT.FOLDER" value="../standalone/adv360/output"/>
<property name="PUBLIC.ADDRESS" value="https://armint07.armundia.com/f2f/"/>
<property name="AUTHENTICATION_SERVICE" value="http://localhost:8080/arm_am/rest/"/>
</system-properties>
<management>
<security-realms>
<security-realm name="ManagementRealm">
<authentication>
<local default-user="$local" skip-group-loading="true"/>
<properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
<authorization map-groups-to-roles="false">
<properties path="mgmt-groups.properties" relative-to="jboss.server.config.dir"/>
</authorization>
</security-realm>
<security-realm name="ApplicationRealm">
<server-identities>
<ssl>
<keystore path="application.keystore" relative-to="jboss.server.config.dir" keystore-password="password" alias="server" key-password="password" generate-self-signed-certificate-host="localhost"/>
</ssl>
</server-identities>
<authentication>
<local default-user="$local" allowed-users="*" skip-group-loading="true"/>
<properties path="application-users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
<authorization>
<properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>
</authorization>
</security-realm>
</security-realms>
<audit-log>
<formatters>
<json-formatter name="json-formatter"/>
</formatters>
<handlers>
<file-handler name="file" formatter="json-formatter" path="audit-log.log" relative-to="jboss.server.data.dir"/>
</handlers>
<logger log-boot="true" log-read-only="false" enabled="false">
<handlers>
<handler name="file"/>
</handlers>
</logger>
</audit-log>
<management-interfaces>
<http-interface security-realm="ManagementRealm">
<http-upgrade enabled="true"/>
<socket-binding http="management-http"/>
</http-interface>
</management-interfaces>
<access-control provider="simple">
<role-mapping>
<role name="SuperUser">
<include>
<user name="$local"/>
</include>
</role>
</role-mapping>
</access-control>
</management>
<profile>
<subsystem xmlns="urn:jboss:domain:logging:8.0">
<console-handler name="CONSOLE">
<level name="DEBUG"/>
<formatter>
<named-formatter name="COLOR-PATTERN"/>
</formatter>
</console-handler>
<periodic-rotating-file-handler name="FILE" autoflush="true">
<formatter>
<named-formatter name="PATTERN"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<suffix value=".dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
<periodic-size-rotating-file-handler name="PERIODIC_SIZE_TRACE" autoflush="true">
<level name="INFO"/>
<formatter>
<named-formatter name="PATTERN"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server-trace.log"/>
<rotate-size value="10M"/>
<max-backup-index value="10"/>
<suffix value=".dd"/>
<append value="true"/>
</periodic-size-rotating-file-handler>
<periodic-size-rotating-file-handler name="PERIODIC_SIZE" autoflush="true">
<level name="INFO"/>
<formatter>
<named-formatter name="PATTERN"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server-info.log"/>
<rotate-size value="20M"/>
<max-backup-index value="20"/>
<suffix value=".dd"/>
<append value="false"/>
</periodic-size-rotating-file-handler>
<logger category="org.apache.activemq.artemis.ra.inflow.ActiveMQActivation">
<level name="TRACE"/>
</logger>
<logger category="com.arjuna">
<level name="WARN"/>
</logger>
<logger category="io.jaegertracing.Configuration">
<level name="WARN"/>
</logger>
<logger category="org.jboss.as.config">
<level name="DEBUG"/>
</logger>
<logger category="sun.rmi">
<level name="WARN"/>
</logger>
<logger category="com.armundia">
<level name="INFO"/>
</logger>
<root-logger>
<level name="INFO"/>
<handlers>
<handler name="CONSOLE"/>
<handler name="PERIODIC_SIZE"/>
</handlers>
</root-logger>
<formatter name="PATTERN">
<pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
</formatter>
<formatter name="COLOR-PATTERN">
<pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
</formatter>
</subsystem>
<subsystem xmlns="urn:jboss:domain:batch-jberet:2.0">
<default-job-repository name="in-memory"/>
<default-thread-pool name="batch"/>
<job-repository name="in-memory">
<in-memory/>
</job-repository>
<thread-pool name="batch">
<max-threads count="10"/>
<keepalive-time time="30" unit="seconds"/>
</thread-pool>
</subsystem>
<subsystem xmlns="urn:jboss:domain:bean-validation:1.0"/>
<subsystem xmlns="urn:jboss:domain:core-management:1.0"/>
<subsystem xmlns="urn:jboss:domain:datasources:6.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jndi-name="java:jboss/datasources/arm_amDatasource" pool-name="arm_amDatasource" enabled="true">
<connection-url>jdbc:postgresql://localhost:5432/advk?currentSchema=advk_own</connection-url>
<driver>postgresql</driver>
<security>
<user-name>postgres</user-name>
<password>Enea4010</password>
</security>
<validation>
<check-valid-connection-sql>select 1</check-valid-connection-sql>
<background-validation>true</background-validation>
<background-validation-millis>300000</background-validation-millis>
</validation>
<timeout>
<idle-timeout-minutes>5</idle-timeout-minutes>
</timeout>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="postgresql" module="org.postgresql">
<driver-class>org.postgresql.Driver</driver-class>
</driver>
</drivers>
</datasources>
</subsystem>
<subsystem xmlns="urn:jboss:domain:deployment-scanner:2.0">
<deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000" runtime-failure-causes-rollback="${jboss.deployment.scanner.rollback.on.failure:false}"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:discovery:1.0"/>
<subsystem xmlns="urn:jboss:domain:distributable-web:2.0" default-session-management="default" default-single-sign-on-management="default">
<infinispan-session-management name="default" cache-container="web" granularity="SESSION">
<local-affinity/>
</infinispan-session-management>
<infinispan-single-sign-on-management name="default" cache-container="web" cache="sso"/>
<local-routing/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:ee:6.0">
<spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>
<concurrent>
<context-services>
<context-service name="default" jndi-name="java:jboss/ee/concurrency/context/default" use-transaction-setup-provider="true"/>
</context-services>
<managed-thread-factories>
<managed-thread-factory name="default" jndi-name="java:jboss/ee/concurrency/factory/default" context-service="default"/>
</managed-thread-factories>
<managed-executor-services>
<managed-executor-service name="default" jndi-name="java:jboss/ee/concurrency/executor/default" context-service="default" hung-task-termination-period="0" hung-task-threshold="60000" keepalive-time="5000"/>
</managed-executor-services>
<managed-scheduled-executor-services>
<managed-scheduled-executor-service name="default" jndi-name="java:jboss/ee/concurrency/scheduler/default" context-service="default" hung-task-termination-period="0" hung-task-threshold="60000" keepalive-time="3000"/>
</managed-scheduled-executor-services>
</concurrent>
<default-bindings context-service="java:jboss/ee/concurrency/context/default" datasource="java:jboss/datasources/ExampleDS" jms-connection-factory="java:jboss/DefaultJMSConnectionFactory" managed-executor-service="java:jboss/ee/concurrency/executor/default" managed-scheduled-executor-service="java:jboss/ee/concurrency/scheduler/default" managed-thread-factory="java:jboss/ee/concurrency/factory/default"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:ee-security:1.0"/>
<subsystem xmlns="urn:jboss:domain:ejb3:9.0">
<session-bean>
<stateless>
<bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
</stateless>
<stateful default-access-timeout="5000" cache-ref="simple" passivation-disabled-cache-ref="simple"/>
<singleton default-access-timeout="5000"/>
</session-bean>
<mdb>
<resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:activemq-ra.rar}"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
<pools>
<bean-instance-pools>
<strict-max-pool name="mdb-strict-max-pool" derive-size="from-cpu-count" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
<strict-max-pool name="slsb-strict-max-pool" derive-size="from-worker-pools" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
</bean-instance-pools>
</pools>
<caches>
<cache name="simple"/>
<cache name="distributable" passivation-store-ref="infinispan" aliases="passivating clustered"/>
</caches>
<passivation-stores>
<passivation-store name="infinispan" cache-container="ejb" max-size="10000"/>
</passivation-stores>
<async thread-pool-name="default"/>
<timer-service thread-pool-name="default" default-data-store="default-file-store">
<data-stores>
<file-data-store name="default-file-store" path="timer-service-data" relative-to="jboss.server.data.dir"/>
</data-stores>
</timer-service>
<remote cluster="ejb" connectors="http-remoting-connector" thread-pool-name="default">
<channel-creation-options>
<option name="MAX_OUTBOUND_MESSAGES" value="1234" type="remoting"/>
</channel-creation-options>
</remote>
<thread-pools>
<thread-pool name="default">
<max-threads count="10"/>
<keepalive-time time="60" unit="seconds"/>
</thread-pool>
</thread-pools>
<iiop enable-by-default="false" use-qualified-name="false"/>
<default-security-domain value="other"/>
<default-missing-method-permissions-deny-access value="true"/>
<statistics enabled="${wildfly.ejb3.statistics-enabled:${wildfly.statistics-enabled:false}}"/>
<log-system-exceptions value="true"/>
</subsystem>
<subsystem xmlns="urn:wildfly:elytron:13.0" final-providers="combined-providers" disallowed-providers="OracleUcrypto">
<providers>
<aggregate-providers name="combined-providers">
<providers name="elytron"/>
<providers name="openssl"/>
</aggregate-providers>
<provider-loader name="elytron" module="org.wildfly.security.elytron"/>
<provider-loader name="openssl" module="org.wildfly.openssl"/>
</providers>
<audit-logging>
<file-audit-log name="local-audit" path="audit.log" relative-to="jboss.server.log.dir" format="JSON"/>
</audit-logging>
<security-domains>
<security-domain name="ApplicationDomain" default-realm="ApplicationRealm" permission-mapper="default-permission-mapper">
<realm name="ApplicationRealm" role-decoder="groups-to-roles"/>
<realm name="local"/>
</security-domain>
<security-domain name="ManagementDomain" default-realm="ManagementRealm" permission-mapper="default-permission-mapper">
<realm name="ManagementRealm" role-decoder="groups-to-roles"/>
<realm name="local" role-mapper="super-user-mapper"/>
</security-domain>
</security-domains>
<security-realms>
<identity-realm name="local" identity="$local"/>
<properties-realm name="ApplicationRealm">
<users-properties path="application-users.properties" relative-to="jboss.server.config.dir" digest-realm-name="ApplicationRealm"/>
<groups-properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>
</properties-realm>
<properties-realm name="ManagementRealm">
<users-properties path="mgmt-users.properties" relative-to="jboss.server.config.dir" digest-realm-name="ManagementRealm"/>
<groups-properties path="mgmt-groups.properties" relative-to="jboss.server.config.dir"/>
</properties-realm>
</security-realms>
<mappers>
<simple-permission-mapper name="default-permission-mapper" mapping-mode="first">
<permission-mapping>
<principal name="anonymous"/>
<permission-set name="default-permissions"/>
</permission-mapping>
<permission-mapping match-all="true">
<permission-set name="login-permission"/>
<permission-set name="default-permissions"/>
</permission-mapping>
</simple-permission-mapper>
<constant-realm-mapper name="local" realm-name="local"/>
<simple-role-decoder name="groups-to-roles" attribute="groups"/>
<constant-role-mapper name="super-user-mapper">
<role name="SuperUser"/>
</constant-role-mapper>
</mappers>
<permission-sets>
<permission-set name="login-permission">
<permission class-name="org.wildfly.security.auth.permission.LoginPermission"/>
</permission-set>
<permission-set name="default-permissions">
<permission class-name="org.wildfly.extension.batch.jberet.deployment.BatchPermission" module="org.wildfly.extension.batch.jberet" target-name="*"/>
<permission class-name="org.wildfly.transaction.client.RemoteTransactionPermission" module="org.wildfly.transaction.client"/>
<permission class-name="org.jboss.ejb.client.RemoteEJBPermission" module="org.jboss.ejb-client"/>
</permission-set>
</permission-sets>
<http>
<http-authentication-factory name="management-http-authentication" security-domain="ManagementDomain" http-server-mechanism-factory="global">
<mechanism-configuration>
<mechanism mechanism-name="DIGEST">
<mechanism-realm realm-name="ManagementRealm"/>
</mechanism>
</mechanism-configuration>
</http-authentication-factory>
<provider-http-server-mechanism-factory name="global"/>
</http>
<sasl>
<sasl-authentication-factory name="application-sasl-authentication" sasl-server-factory="configured" security-domain="ApplicationDomain">
<mechanism-configuration>
<mechanism mechanism-name="JBOSS-LOCAL-USER" realm-mapper="local"/>
<mechanism mechanism-name="DIGEST-MD5">
<mechanism-realm realm-name="ApplicationRealm"/>
</mechanism>
</mechanism-configuration>
</sasl-authentication-factory>
<sasl-authentication-factory name="management-sasl-authentication" sasl-server-factory="configured" security-domain="ManagementDomain">
<mechanism-configuration>
<mechanism mechanism-name="JBOSS-LOCAL-USER" realm-mapper="local"/>
<mechanism mechanism-name="DIGEST-MD5">
<mechanism-realm realm-name="ManagementRealm"/>
</mechanism>
</mechanism-configuration>
</sasl-authentication-factory>
<configurable-sasl-server-factory name="configured" sasl-server-factory="elytron">
<properties>
<property name="wildfly.sasl.local-user.default-user" value="$local"/>
</properties>
</configurable-sasl-server-factory>
<mechanism-provider-filtering-sasl-server-factory name="elytron" sasl-server-factory="global">
<filters>
<filter provider-name="WildFlyElytron"/>
</filters>
</mechanism-provider-filtering-sasl-server-factory>
<provider-sasl-server-factory name="global"/>
</sasl>
<tls>
<key-stores>
<key-store name="applicationKS">
<credential-reference clear-text="password"/>
<implementation type="JKS"/>
<file path="application.keystore" relative-to="jboss.server.config.dir"/>
</key-store>
</key-stores>
<key-managers>
<key-manager name="applicationKM" key-store="applicationKS" generate-self-signed-certificate-host="localhost">
<credential-reference clear-text="password"/>
</key-manager>
</key-managers>
<server-ssl-contexts>
<server-ssl-context name="applicationSSC" key-manager="applicationKM"/>
</server-ssl-contexts>
</tls>
</subsystem>
<subsystem xmlns="urn:wildfly:health:1.0" security-enabled="false"/>
<subsystem xmlns="urn:jboss:domain:iiop-openjdk:2.1">
<orb socket-binding="iiop"/>
<initializers security="identity" transactions="spec"/>
<security server-requires-ssl="false" client-requires-ssl="false"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:infinispan:12.0">
<cache-container name="ejb" default-cache="passivation" aliases="sfsb" modules="org.wildfly.clustering.ejb.infinispan">
<local-cache name="passivation">
<file-store passivation="true" purge="false"/>
</local-cache>
</cache-container>
<cache-container name="web" default-cache="passivation" modules="org.wildfly.clustering.web.infinispan">
<local-cache name="passivation">
<file-store passivation="true" purge="false"/>
</local-cache>
<local-cache name="sso"/>
</cache-container>
<cache-container name="server" default-cache="default" modules="org.wildfly.clustering.server">
<local-cache name="default"/>
</cache-container>
<cache-container name="hibernate" modules="org.infinispan.hibernate-cache">
<local-cache name="entity">
<heap-memory size="10000"/>
<expiration max-idle="100000"/>
</local-cache>
<local-cache name="local-query">
<heap-memory size="10000"/>
<expiration max-idle="100000"/>
</local-cache>
<local-cache name="timestamps"/>
<local-cache name="pending-puts">
<expiration max-idle="60000"/>
</local-cache>
</cache-container>
</subsystem>
<subsystem xmlns="urn:jboss:domain:io:3.0">
<worker name="default"/>
<buffer-pool name="default"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jaxrs:2.0"/>
<subsystem xmlns="urn:jboss:domain:jca:5.0">
<archive-validation enabled="true" fail-on-error="true" fail-on-warn="false"/>
<bean-validation enabled="true"/>
<default-workmanager>
<short-running-threads>
<core-threads count="50"/>
<queue-length count="50"/>
<max-threads count="50"/>
<keepalive-time time="10" unit="seconds"/>
</short-running-threads>
<long-running-threads>
<core-threads count="50"/>
<queue-length count="50"/>
<max-threads count="50"/>
<keepalive-time time="10" unit="seconds"/>
</long-running-threads>
</default-workmanager>
<cached-connection-manager/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jdr:1.0"/>
<subsystem xmlns="urn:jboss:domain:jmx:1.3">
<expose-resolved-model/>
<expose-expression-model/>
<remoting-connector/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jpa:1.1">
<jpa default-extended-persistence-inheritance="DEEP"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jsf:1.1"/>
<subsystem xmlns="urn:jboss:domain:jsr77:1.0"/>
<subsystem xmlns="urn:jboss:domain:mail:4.0">
<mail-session name="default" jndi-name="java:jboss/mail/Default">
<smtp-server outbound-socket-binding-ref="mail-smtp"/>
</mail-session>
</subsystem>
<subsystem xmlns="urn:jboss:domain:messaging-activemq:13.0">
<server name="default">
<statistics enabled="${wildfly.messaging-activemq.statistics-enabled:${wildfly.statistics-enabled:false}}"/>
<security-setting name="#">
<role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
</security-setting>
<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/>
<http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
<http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
<param name="batch-delay" value="50"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-connector>
<http-acceptor name="http-acceptor" http-listener="default"/>
<http-acceptor name="http-acceptor-throughput" http-listener="default">
<param name="batch-delay" value="50"/>
<param name="direct-deliver" value="false"/>
</http-acceptor>
<in-vm-acceptor name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-acceptor>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
</server>
</subsystem>
<subsystem xmlns="urn:wildfly:metrics:1.0" security-enabled="false" exposed-subsystems="*" prefix="${wildfly.metrics.prefix:jboss}"/>
<subsystem xmlns="urn:jboss:domain:naming:2.0">
<remote-naming/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:pojo:1.0"/>
<subsystem xmlns="urn:jboss:domain:remoting:4.0">
<http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:request-controller:1.0"/>
<subsystem xmlns="urn:jboss:domain:resource-adapters:6.0"/>
<subsystem xmlns="urn:jboss:domain:sar:1.0"/>
<subsystem xmlns="urn:jboss:domain:security:2.0">
<security-domains>
<security-domain name="other" cache-type="default">
<authentication>
<login-module code="Remoting" flag="optional">
<module-option name="password-stacking" value="useFirstPass"/>
</login-module>
<login-module code="RealmDirect" flag="required">
<module-option name="password-stacking" value="useFirstPass"/>
</login-module>
</authentication>
</security-domain>
<security-domain name="jboss-web-policy" cache-type="default">
<authorization>
<policy-module code="Delegating" flag="required"/>
</authorization>
</security-domain>
<security-domain name="jaspitest" cache-type="default">
<authentication-jaspi>
<login-module-stack name="dummy">
<login-module code="Dummy" flag="optional"/>
</login-module-stack>
<auth-module code="Dummy"/>
</authentication-jaspi>
</security-domain>
<security-domain name="jboss-ejb-policy" cache-type="default">
<authorization>
<policy-module code="Delegating" flag="required"/>
</authorization>
</security-domain>
</security-domains>
</subsystem>
<subsystem xmlns="urn:jboss:domain:security-manager:1.0">
<deployment-permissions>
<maximum-set>
<permission class="java.security.AllPermission"/>
</maximum-set>
</deployment-permissions>
</subsystem>
<subsystem xmlns="urn:jboss:domain:transactions:6.0">
<core-environment node-identifier="${jboss.tx.node.id:1}">
<process-id>
<uuid/>
</process-id>
</core-environment>
<recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
<coordinator-environment statistics-enabled="${wildfly.transactions.statistics-enabled:${wildfly.statistics-enabled:false}}"/>
<object-store path="tx-object-store" relative-to="jboss.server.data.dir"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:undertow:12.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other" statistics-enabled="${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}}">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
<https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<http-invoker security-realm="ApplicationRealm"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
</handlers>
</subsystem>
<subsystem xmlns="urn:jboss:domain:webservices:2.0" statistics-enabled="${wildfly.webservices.statistics-enabled:${wildfly.statistics-enabled:false}}">
<wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
<endpoint-config name="Standard-Endpoint-Config"/>
<endpoint-config name="Recording-Endpoint-Config">
<pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
<handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
</pre-handler-chain>
</endpoint-config>
<client-config name="Standard-Client-Config"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:weld:4.0"/>
</profile>
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
<interface name="unsecure">
<inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
</interfaces>
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0000}">
<socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
<socket-binding name="http" port="${jboss.http.port:8080}"/>
<socket-binding name="https" port="${jboss.https.port:8443}"/>
<socket-binding name="iiop" interface="unsecure" port="3528"/>
<socket-binding name="iiop-ssl" interface="unsecure" port="3529"/>
<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
<socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
<socket-binding name="txn-recovery-environment" port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="${jboss.mail.server.host:localhost}" port="${jboss.mail.server.port:25}"/>
</outbound-socket-binding>
</socket-binding-group>
</server>

View File

@ -1,13 +1,20 @@
# PowerShell script to start JBoss EAP 7.4 # PowerShell script to start JBoss EAP 8.0
# Load configuration from JSON file # Read configuration from config.json
$config = Get-Content -Raw -Path "$PSScriptRoot\config.json" | ConvertFrom-Json $configPath = Join-Path $PSScriptRoot "config.json"
if (-not (Test-Path $configPath)) {
Write-Host "Error: config.json not found at $configPath" -ForegroundColor Red
exit 1
}
# Configuration variables from JSON $config = Get-Content $configPath -Raw | ConvertFrom-Json
$JBOSS_HOME = $config.jbossHome
$JAVA_HOME = $config.javaHome
# Function to check if JBoss is already running # Configuration from config.json
$JBOSS_HOME = $config.jboss.jbossHome
$JAVA_HOME = $config.jboss.javaHome
$CONFIG_FILE = $config.jboss.configFile
# Function to check if JBoss is running
function Test-JBossRunning { function Test-JBossRunning {
$jbossProcess = Get-CimInstance Win32_Process -Filter "Name = 'java.exe'" | $jbossProcess = Get-CimInstance Win32_Process -Filter "Name = 'java.exe'" |
Where-Object { $_.CommandLine -like "*jboss.home.dir=$JBOSS_HOME*" } Where-Object { $_.CommandLine -like "*jboss.home.dir=$JBOSS_HOME*" }
@ -16,7 +23,7 @@ function Test-JBossRunning {
# Check if Java exists # Check if Java exists
if (-not (Test-Path $JAVA_HOME)) { if (-not (Test-Path $JAVA_HOME)) {
Write-Host "Error: Java 8 not found at $JAVA_HOME" -ForegroundColor Red Write-Host "Error: Java not found at $JAVA_HOME" -ForegroundColor Red
exit 1 exit 1
} }
@ -26,6 +33,38 @@ if (-not (Test-Path $JBOSS_HOME)) {
exit 1 exit 1
} }
# Copy configuration file from local config directory
$localConfigDir = Join-Path $PSScriptRoot "config"
$localConfigFile = Join-Path $localConfigDir (Split-Path $CONFIG_FILE -Leaf)
$jbossConfigDir = Join-Path $JBOSS_HOME "standalone\configuration"
if (Test-Path $localConfigFile) {
Write-Host "Copying configuration file from local config directory..." -ForegroundColor Yellow
Write-Host "From: $localConfigFile" -ForegroundColor Yellow
Write-Host "To: $jbossConfigDir" -ForegroundColor Yellow
# Create backup of existing config if it exists
$targetConfigFile = Join-Path $jbossConfigDir (Split-Path $CONFIG_FILE -Leaf)
if (Test-Path $targetConfigFile) {
$backupFile = "$targetConfigFile.backup"
Write-Host "Creating backup of existing config: $backupFile" -ForegroundColor Yellow
Copy-Item $targetConfigFile $backupFile -Force
}
# Copy the new config file
Copy-Item $localConfigFile $jbossConfigDir -Force
} else {
Write-Host "Warning: Local config file not found at $localConfigFile" -ForegroundColor Yellow
Write-Host "Using existing JBoss configuration" -ForegroundColor Yellow
}
# Check if configuration file exists in JBoss
$configFile = Join-Path $jbossConfigDir (Split-Path $CONFIG_FILE -Leaf)
if (-not (Test-Path $configFile)) {
Write-Host "Error: Configuration file not found at $configFile" -ForegroundColor Red
exit 1
}
# Set environment variables # Set environment variables
$env:JAVA_HOME = $JAVA_HOME $env:JAVA_HOME = $JAVA_HOME
$env:JBOSS_HOME = $JBOSS_HOME $env:JBOSS_HOME = $JBOSS_HOME
@ -34,31 +73,20 @@ $env:NOPAUSE = "true"
# Remove this as it might affect logging # Remove this as it might affect logging
# $env:LAUNCH_JBOSS_IN_BACKGROUND = "true" # $env:LAUNCH_JBOSS_IN_BACKGROUND = "true"
# Get configuration file from config.json
$configFile = $config.jboss.configFile
Write-Host "Configuration file path: $configFile" -ForegroundColor Cyan
# Copy configuration file from local config directory
$sourceConfig = "$PSScriptRoot\config\$configFile"
$targetConfig = "$JBOSS_HOME\standalone\configuration\$configFile"
if (Test-Path $sourceConfig) {
Write-Host "Copying configuration file from $sourceConfig to $targetConfig" -ForegroundColor Yellow
Copy-Item -Path $sourceConfig -Destination $targetConfig -Force
}
# Check if JBoss is already running # Check if JBoss is already running
if (Test-JBossRunning) { if (Test-JBossRunning) {
Write-Host "JBoss is already running!" -ForegroundColor Yellow Write-Host "JBoss is already running!" -ForegroundColor Yellow
exit 0 exit 0
} }
Write-Host "Starting JBoss EAP 7.4..." -ForegroundColor Green Write-Host "Starting JBoss EAP 8.0..." -ForegroundColor Green
Write-Host "Using Java from: $JAVA_HOME" -ForegroundColor Yellow Write-Host "Using Java from: $JAVA_HOME" -ForegroundColor Yellow
Write-Host "JBoss Home: $JBOSS_HOME" -ForegroundColor Yellow Write-Host "JBoss Home: $JBOSS_HOME" -ForegroundColor Yellow
Write-Host "Using configuration: $configFile" -ForegroundColor Yellow Write-Host "Using configuration: $CONFIG_FILE" -ForegroundColor Yellow
# Set JVM options # Start JBoss in standalone mode
$jvmOpts = @( $startScript = Join-Path $JBOSS_HOME "bin\standalone.bat"
$jvmOptions = @(
"-DIDServer=GS", "-DIDServer=GS",
"-Dbtf.PathToParse=C:\Dev2012\advc0\in", "-Dbtf.PathToParse=C:\Dev2012\advc0\in",
"-Djava.awt.headless=true", "-Djava.awt.headless=true",
@ -70,18 +98,20 @@ $jvmOpts = @(
"-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n" "-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n"
) )
Write-Host "Starting JBoss with custom JVM options..." -ForegroundColor Yellow # Add JVM options to JAVA_OPTS
Write-Host "JVM Options: $($jvmOpts -join ' ')" -ForegroundColor Gray $env:JAVA_OPTS = "$($jvmOptions -join ' ')"
Write-Host "Starting JBoss with custom JVM options..." -ForegroundColor Green
Write-Host "JVM Options: $env:JAVA_OPTS" -ForegroundColor Yellow
Write-Host "Remote debugging enabled on port 8787" -ForegroundColor Cyan
# Create the command line arguments # Create the command line arguments
$jvmOptsString = $jvmOpts -join ' ' $cmdArgs = "-c $CONFIG_FILE --debug -b 0.0.0.0 -bmanagement 0.0.0.0"
$env:JAVA_OPTS = $jvmOptsString
$cmdArgs = "-c $configFile --debug -b 0.0.0.0 -bmanagement 0.0.0.0"
# Start JBoss - Modified to use Start-Process with RedirectStandardOutput # Start JBoss - Modified to use Start-Process with RedirectStandardOutput
$logFile = Join-Path $JBOSS_HOME "standalone\log\server.log" $logFile = Join-Path $JBOSS_HOME "standalone\log\server-info.log"
$processStartInfo = @{ $processStartInfo = @{
FilePath = Join-Path $JBOSS_HOME "bin\standalone.bat" FilePath = $startScript
ArgumentList = $cmdArgs ArgumentList = $cmdArgs
RedirectStandardOutput = $logFile RedirectStandardOutput = $logFile
RedirectStandardError = Join-Path $JBOSS_HOME "standalone\log\server_error.log" RedirectStandardError = Join-Path $JBOSS_HOME "standalone\log\server_error.log"
@ -90,7 +120,6 @@ $processStartInfo = @{
PassThru = $true PassThru = $true
} }
Write-Host "Remote debugging enabled on port 8787" -ForegroundColor Yellow
Write-Host "Starting JBoss and redirecting output to $logFile" -ForegroundColor Yellow Write-Host "Starting JBoss and redirecting output to $logFile" -ForegroundColor Yellow
$jbossProcess = Start-Process @processStartInfo $jbossProcess = Start-Process @processStartInfo

View File

@ -1,12 +1,19 @@
# PowerShell script to stop JBoss EAP 7.4 # PowerShell script to stop JBoss EAP 8.0
# Load configuration from JSON file # Read configuration from config.json
$config = Get-Content -Raw -Path "$PSScriptRoot\config.json" | ConvertFrom-Json $configPath = Join-Path $PSScriptRoot "config.json"
if (-not (Test-Path $configPath)) {
Write-Host "Error: config.json not found at $configPath" -ForegroundColor Red
exit 1
}
# Configuration variables from JSON $config = Get-Content $configPath -Raw | ConvertFrom-Json
$JBOSS_HOME = $config.jbossHome
Write-Host "Stopping JBoss EAP 7.4..." -ForegroundColor Yellow # Configuration from config.json
$JBOSS_HOME = $config.jboss.jbossHome
Write-Host "Stopping JBoss EAP 8.0..." -ForegroundColor Yellow
Write-Host "JBoss Home: $JBOSS_HOME" -ForegroundColor Yellow
# Find and stop JBoss process # Find and stop JBoss process
$jbossProcess = Get-CimInstance Win32_Process -Filter "Name = 'java.exe'" | $jbossProcess = Get-CimInstance Win32_Process -Filter "Name = 'java.exe'" |
@ -14,7 +21,29 @@ $jbossProcess = Get-CimInstance Win32_Process -Filter "Name = 'java.exe'" |
if ($jbossProcess) { if ($jbossProcess) {
Write-Host "Found JBoss process (PID: $($jbossProcess.ProcessId))" -ForegroundColor Yellow Write-Host "Found JBoss process (PID: $($jbossProcess.ProcessId))" -ForegroundColor Yellow
# Try graceful shutdown first
Write-Host "Attempting graceful shutdown..." -ForegroundColor Yellow
$jbossCli = Join-Path $JBOSS_HOME "bin\jboss-cli.bat"
$cliCommand = "--connect --command=:shutdown"
try {
Start-Process -FilePath $jbossCli -ArgumentList $cliCommand -Wait -NoNewWindow
Start-Sleep -Seconds 5 # Give it time for graceful shutdown
# Check if process is still running
$processStillRunning = Get-Process -Id $jbossProcess.ProcessId -ErrorAction SilentlyContinue
if ($processStillRunning) {
Write-Host "Graceful shutdown failed, forcing process termination..." -ForegroundColor Yellow
Stop-Process -Id $jbossProcess.ProcessId -Force Stop-Process -Id $jbossProcess.ProcessId -Force
}
}
catch {
Write-Host "Graceful shutdown failed, forcing process termination..." -ForegroundColor Yellow
Stop-Process -Id $jbossProcess.ProcessId -Force
}
Write-Host "JBoss process stopped" -ForegroundColor Green Write-Host "JBoss process stopped" -ForegroundColor Green
} else { } else {
Write-Host "No JBoss process found running" -ForegroundColor Yellow Write-Host "No JBoss process found running" -ForegroundColor Yellow
@ -22,3 +51,13 @@ if ($jbossProcess) {
# Wait a moment to ensure process is fully stopped # Wait a moment to ensure process is fully stopped
Start-Sleep -Seconds 2 Start-Sleep -Seconds 2
# Verify JBoss is stopped
$jbossStillRunning = Get-CimInstance Win32_Process -Filter "Name = 'java.exe'" |
Where-Object { $_.CommandLine -like "*jboss.home.dir=$JBOSS_HOME*" }
if ($jbossStillRunning) {
Write-Host "Warning: JBoss process is still running!" -ForegroundColor Red
} else {
Write-Host "Confirmed: JBoss is fully stopped" -ForegroundColor Green
}

View File

@ -1,21 +1,47 @@
# Load configuration from JSON file # PowerShell script to unpack EAR file
$config = Get-Content -Raw -Path "$PSScriptRoot\config.json" | ConvertFrom-Json
# Set paths from configuration # Read configuration from config.json
$sourceFile = Join-Path $config.deploymentDir $config.ear.deployedFile $configPath = Join-Path $PSScriptRoot "config.json"
if (-not (Test-Path $configPath)) {
Write-Host "Error: config.json not found at $configPath" -ForegroundColor Red
exit 1
}
$config = Get-Content $configPath -Raw | ConvertFrom-Json
# Get paths from config
$sourceFile = Join-Path $config.jboss.jbossHome "standalone\deployments\adv360-ear.ear"
$destinationPath = $config.ear.unpackDir $destinationPath = $config.ear.unpackDir
Write-Host "Using configuration:" -ForegroundColor Yellow
Write-Host " Source EAR: $sourceFile" -ForegroundColor Yellow
Write-Host " Destination: $destinationPath" -ForegroundColor Yellow
# Verify source file exists
if (-not (Test-Path -Path $sourceFile)) {
Write-Host "Error: Source EAR file not found at $sourceFile" -ForegroundColor Red
exit 1
}
# Remove destination directory if it exists # Remove destination directory if it exists
if (Test-Path -Path $destinationPath) { if (Test-Path -Path $destinationPath) {
Remove-Item -Path $destinationPath -Recurse -Force Remove-Item -Path $destinationPath -Recurse -Force
Write-Host "Removed existing directory: $destinationPath" Write-Host "Removed existing directory: $destinationPath" -ForegroundColor Yellow
} }
# Create destination directory # Create destination directory
if (-not (Test-Path -Path $destinationPath)) { if (-not (Test-Path -Path $destinationPath)) {
New-Item -ItemType Directory -Path $destinationPath -Force New-Item -ItemType Directory -Path $destinationPath -Force | Out-Null
Write-Host "Created destination directory: $destinationPath" -ForegroundColor Yellow
} }
# Try using 7-Zip first, fall back to zip method if not available
$7zPath = "C:\Program Files\7-Zip\7z.exe"
if (Test-Path $7zPath) {
Write-Host "Using 7-Zip to extract EAR..." -ForegroundColor Yellow
Start-Process -FilePath $7zPath -ArgumentList "x", "`"$sourceFile`"", "-o`"$destinationPath`"", "-y" -Wait -NoNewWindow
} else {
Write-Host "7-Zip not found, using PowerShell Expand-Archive..." -ForegroundColor Yellow
# Rename .ear to .zip temporarily to use Expand-Archive # Rename .ear to .zip temporarily to use Expand-Archive
$tempZipPath = $sourceFile -replace '\.ear$', '.zip' $tempZipPath = $sourceFile -replace '\.ear$', '.zip'
Copy-Item -Path $sourceFile -Destination $tempZipPath Copy-Item -Path $sourceFile -Destination $tempZipPath
@ -25,8 +51,9 @@ Expand-Archive -Path $tempZipPath -DestinationPath $destinationPath -Force
# Clean up temporary zip file # Clean up temporary zip file
Remove-Item -Path $tempZipPath Remove-Item -Path $tempZipPath
}
Write-Host "EAR file extracted to $destinationPath" Write-Host "EAR file extracted to $destinationPath" -ForegroundColor Green
# Function to unpack archive files (war/ejb) # Function to unpack archive files (war/ejb)
function Expand-JavaArchive { function Expand-JavaArchive {
@ -43,10 +70,19 @@ function Expand-JavaArchive {
New-Item -ItemType Directory -Path $destinationPath -Force New-Item -ItemType Directory -Path $destinationPath -Force
} }
# Try using 7-Zip first, fall back to zip method if not available
if (Test-Path $7zPath) {
Write-Host "Using 7-Zip to extract $archivePath..." -ForegroundColor Yellow
Start-Process -FilePath $7zPath -ArgumentList "x", "`"$tempZipPath`"", "-o`"$destinationPath`"", "-y" -Wait -NoNewWindow
} else {
Write-Host "7-Zip not found, using PowerShell Expand-Archive..." -ForegroundColor Yellow
# Extract contents # Extract contents
Expand-Archive -Path $tempZipPath -DestinationPath $destinationPath -Force Expand-Archive -Path $tempZipPath -DestinationPath $destinationPath -Force
}
# Clean up temporary zip file
Remove-Item -Path $tempZipPath Remove-Item -Path $tempZipPath
Write-Host "Extracted $archivePath to $destinationPath" Write-Host "Extracted $archivePath to $destinationPath" -ForegroundColor Green
} }
# Find and extract WAR and EJB files # Find and extract WAR and EJB files