Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated all .bat scripts into .ps1 scripts #1557

Merged
merged 7 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ A versatile and lightweight **API Gateway** for **REST** and **legacy SOAP Web S
- Open a terminal in the extracted directory.
- Run the appropriate command for your operating system:
- **Linux/Mac:** `./service-proxy.sh`
- **Windows:** `service-proxy.bat`
- **Windows:** `service-proxy.ps1`

3. **Access the Gateway**
- Open your browser and navigate to [http://localhost:2000](http://localhost:2000).
Expand Down
2 changes: 1 addition & 1 deletion core/.factorypath
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><factorypath>
<factorypathentry enabled="true" id="M2_REPO/org/membrane-soa/service-proxy-annot/5.8.1-SNAPSHOT/service-proxy-annot-5.8.1-SNAPSHOT.jar" kind="VARJAR" runInBatchMode="false"/>
<factorypathentry enabled="true" id="M2_REPO/org/membrane-soa/service-proxy-annot/6.0.0-SNAPSHOT/service-proxy-annot-6.0.0-SNAPSHOT.jar" kind="VARJAR" runInBatchMode="false"/>
</factorypath>
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/* Copyright 2025 predic8 GmbH, www.predic8.com

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
package com.predic8.membrane.core.interceptor;

import java.util.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/* Copyright 2025 predic8 GmbH, www.predic8.com

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
package com.predic8.membrane.core.interceptor.lang;

import com.predic8.membrane.core.lang.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* </p>
* <p>
* Has undefined behavior when Membrane is <b>not</b> started from command line
* (=via the RouterCLI class, which <tt>service-proxy.bat</tt>/<tt>service-proxy.sh</tt>
* (=via the RouterCLI class, which <tt>service-proxy.ps1</tt>/<tt>service-proxy.sh</tt>
* do use).
* </p>
* <p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/* Copyright 2025 predic8 GmbH, www.predic8.com

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
package com.predic8.membrane.core.util;

public class ExceptionUtil {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
package com.predic8.membrane.core;
/* Copyright 2025 predic8 GmbH, www.predic8.com

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
package com.predic8.membrane.core.interceptor;

import com.tngtech.archunit.core.domain.*;
import com.tngtech.archunit.junit.AnalyzeClasses;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/* Copyright 2025 predic8 GmbH, www.predic8.com

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
package com.predic8.membrane.core.openapi.serviceproxy;

import com.predic8.membrane.core.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/* Copyright 2025 predic8 GmbH, www.predic8.com

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
package com.predic8.membrane.core.openapi.serviceproxy;

import org.junit.jupiter.api.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/* Copyright 2025 predic8 GmbH, www.predic8.com

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
package com.predic8.membrane.core.openapi.serviceproxy;

import com.predic8.membrane.core.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/* Copyright 2025 predic8 GmbH, www.predic8.com

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
package com.predic8.membrane.core.proxies;

import org.junit.jupiter.api.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/* Copyright 2025 predic8 GmbH, www.predic8.com

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
package com.predic8.membrane.core.util;

import org.junit.jupiter.api.Test;
Expand Down
2 changes: 1 addition & 1 deletion distribution/examples/acl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To run the example execute the following steps:

1. Go to the `examples/acl` directory.

2. Execute `service-proxy.bat`
2. Execute `service-proxy.ps1`

3. Open the URL http://localhost:2000/ in your browser.
The predic8.de website will be displayed in your browser.
Expand Down
18 changes: 0 additions & 18 deletions distribution/examples/acl/service-proxy.bat

This file was deleted.

69 changes: 69 additions & 0 deletions distribution/examples/acl/service-proxy.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
$required_version = "21"

function Start-MembraneService {
param([string]$membrane_home)

$env:MEMBRANE_HOME = $membrane_home
$CLASSPATH = "$membrane_home\conf;$membrane_home\lib\*"
Write-Host "Starting: $membrane_home CL: $CLASSPATH"
& java -cp "$CLASSPATH" com.predic8.membrane.core.cli.RouterCLI -c proxies.xml
}

function Find-MembraneDirectory {
param([string]$current)

while ($current -ne "") {
if ((Test-Path "$current\conf") -and (Test-Path "$current\lib")) {
return $current
}
$current = Split-Path -Parent $current
}
return $null
}

function Start-Membrane {
$membrane_home = Find-MembraneDirectory (Get-Location).Path
if ($membrane_home) {
Start-MembraneService $membrane_home
} else {
Write-Host "Could not start Membrane. Ensure the directory structure is correct."
}
}

try {
$null = Get-Command java -ErrorAction Stop
} catch {
Write-Host "Java is not installed. Membrane needs at least Java $required_version."
exit 1
}

try {
$version_output = & java -version 2>&1
$version_line = $version_output | Where-Object { $_ -match "version" } | Select-Object -First 1

if (-not $version_line) {
Write-Host "WARNING: Could not determine Java version. Make sure Java version is at least $required_version. Proceeding anyway..."
Start-Membrane
exit 0
}

$full_version = $version_line -replace '.*version "([^"]+)".*', '$1'
$current_version = $full_version -replace '\..*$', ''

if ($current_version -match '^\d+$') {
if ([int]$current_version -ge [int]$required_version) {
Start-Membrane
exit 0
} else {
Write-Host "Java version mismatch: Required=$required_version, Installed=$full_version"
exit 1
}
} else {
Write-Host "WARNING: Could not parse Java version. Make sure your Java version is at least $required_version. Proceeding anyway..."
Start-Membrane
exit 0
}
} catch {
Write-Host "Error checking Java version: $_"
exit 1
}
18 changes: 0 additions & 18 deletions distribution/examples/apikey/store/service-proxy.bat

This file was deleted.

69 changes: 69 additions & 0 deletions distribution/examples/apikey/store/service-proxy.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
$required_version = "21"

function Start-MembraneService {
param([string]$membrane_home)

$env:MEMBRANE_HOME = $membrane_home
$CLASSPATH = "$membrane_home\conf;$membrane_home\lib\*"
Write-Host "Starting: $membrane_home CL: $CLASSPATH"
& java -cp "$CLASSPATH" com.predic8.membrane.core.cli.RouterCLI -c proxies.xml
}

function Find-MembraneDirectory {
param([string]$current)

while ($current -ne "") {
if ((Test-Path "$current\conf") -and (Test-Path "$current\lib")) {
return $current
}
$current = Split-Path -Parent $current
}
return $null
}

function Start-Membrane {
$membrane_home = Find-MembraneDirectory (Get-Location).Path
if ($membrane_home) {
Start-MembraneService $membrane_home
} else {
Write-Host "Could not start Membrane. Ensure the directory structure is correct."
}
}

try {
$null = Get-Command java -ErrorAction Stop
} catch {
Write-Host "Java is not installed. Membrane needs at least Java $required_version."
exit 1
}

try {
$version_output = & java -version 2>&1
$version_line = $version_output | Where-Object { $_ -match "version" } | Select-Object -First 1

if (-not $version_line) {
Write-Host "WARNING: Could not determine Java version. Make sure Java version is at least $required_version. Proceeding anyway..."
Start-Membrane
exit 0
}

$full_version = $version_line -replace '.*version "([^"]+)".*', '$1'
$current_version = $full_version -replace '\..*$', ''

if ($current_version -match '^\d+$') {
if ([int]$current_version -ge [int]$required_version) {
Start-Membrane
exit 0
} else {
Write-Host "Java version mismatch: Required=$required_version, Installed=$full_version"
exit 1
}
} else {
Write-Host "WARNING: Could not parse Java version. Make sure your Java version is at least $required_version. Proceeding anyway..."
Start-Membrane
exit 0
}
} catch {
Write-Host "Error checking Java version: $_"
exit 1
}
2 changes: 1 addition & 1 deletion distribution/examples/basic-xml-interceptor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ To run the example execute the following steps:
mvn package
```

3. Execute service-proxy.bat or service-proxy.sh
3. Execute service-proxy.ps1 or service-proxy.sh
4. Open a second terminal
5. Run below command

Expand Down
2 changes: 1 addition & 1 deletion distribution/examples/basic-xml-interceptor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<dependency>
<groupId>org.membrane-soa</groupId>
<artifactId>service-proxy-core</artifactId>
<version>5.8.1-SNAPSHOT</version>
<version>6.0.0-SNAPSHOT</version>
</dependency>
</dependencies>

Expand Down
Loading