Skip to content

Instantly share code, notes, and snippets.

View gastaldi's full-sized avatar
🏠
Working from home

George Gastaldi gastaldi

🏠
Working from home
View GitHub Profile
/*
* Copyright 2017 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Eclipse Public License version 1.0, available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.jboss.forge.addon.swarm.config;
import java.io.IOException;
@gastaldi
gastaldi / VersionTest.java
Last active January 18, 2017 22:07
Fetch all fraction-list.json versions
/*
* Copyright 2017 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Eclipse Public License version 1.0, available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.jboss.forge.addon.swarm.config;
import java.util.List;
@gastaldi
gastaldi / Dockerfile
Last active November 3, 2016 19:21
Dockerfile to create a CentOS machine with the latest WildFly Swarm sources
# CentOS 7
# Maven 3.3.9
FROM jboss/base-jdk:8
MAINTAINER George Gastaldi (https://github.com/gastaldi)
# install wget and git
USER root
@gastaldi
gastaldi / HTTP2Customizer.java
Created August 23, 2016 17:10
HTTP/2 Customizer to WildFly Swarm
package org.wildfly.swarm.undertow.runtime;
import javax.enterprise.inject.Any;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import org.wildfly.swarm.config.undertow.Server;
import org.wildfly.swarm.config.undertow.server.HTTPListener;
import org.wildfly.swarm.config.undertow.server.HttpsListener;
@gastaldi
gastaldi / monitor.sh
Last active April 9, 2020 02:28
Monitors a Maven coordinate and displays a notification in the UI when it's available - Tested on Fedora only
#!/bin/bash
: ${1:?"groupId is required"}
: ${2:?"artifactId is required"}
: ${3:?"version is required"}
# eg. ~/monitor.sh org.wildfly.swarm spi 1.0.8.Final
GROUP_ID=${1//.//}
ARTIFACT_ID=$2
VERSION=$3
@gastaldi
gastaldi / App.java
Last active July 1, 2016 21:07
Changes in Swarm
// This is the class inside the application
public class App implements SwarmCallback {
public static void main(String[] args) {
// Swarm.run will do the dirty job of initializing a JBoss Modules module and callback the methods defined in App
Swarm.run(new App(),args);
}
@Override
public void deploy(Swarm swarm) {
package org.wildfly.swarm.management.console;
import org.wildfly.swarm.management.ManagementFraction;
import org.wildfly.swarm.spi.api.Fraction;
import org.wildfly.swarm.spi.api.annotations.Configuration;
/**
* Created by ggastald on 29/06/16.
*/
@Configuration
@gastaldi
gastaldi / KeycloakClientTest.java
Last active August 8, 2017 03:42
How to get the JSON file from a KeyCloak server
package org.keycloak.forge.addon;
import java.util.List;
import org.junit.Test;
import org.keycloak.admin.client.Keycloak;
import org.keycloak.admin.client.KeycloakBuilder;
import org.keycloak.admin.client.resource.ClientResource;
import org.keycloak.admin.client.resource.ClientsResource;
import org.keycloak.representations.idm.ClientRepresentation;
@gastaldi
gastaldi / microservice.fsh
Last active May 26, 2022 19:10
JBoss Forge Script to create a WildFly Swarm Microservice and configuring as a KeyCloak client
#Install the required plugins
addon-install-from-git --url https://github.com/forge/wildfly-swarm-addon.git
addon-install-from-git --url https://github.com/forge/keycloak-addon.git
# Create the project and configure the WildFly Swarm maven plugin
project-new --named demo --stack JAVA_EE_7 --type wildfly-swarm
# Create the JPA entity
jpa-new-entity --named Customer
/*
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Eclipse Public License version 1.0, available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.jboss.forge.addon.swarm.ui;
import java.util.stream.StreamSupport;