Skip to content

Instantly share code, notes, and snippets.

View rafaeltuelho's full-sized avatar
🎯
Focusing

Rafael T. C. Soares (A.K.A Tuelho) rafaeltuelho

🎯
Focusing
  • Red Hat Inc.
  • Frisco, TX, USA
  • 11:42 (UTC -05:00)
View GitHub Profile
@rafaeltuelho
rafaeltuelho / MainActivation.java
Created November 7, 2014 19:58
OSGI Bundle Activator class to activate a Bundle inside a OSGI Container (eg: Apache Karaf)
package com.redhat.camel.java;
import org.apache.camel.impl.DefaultCamelContext;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
/**
* A Camel Application
*/
public class MainActivation implements BundleActivator{
@rafaeltuelho
rafaeltuelho / jboss-fuse-camel-osgi-pom.xml
Created November 7, 2014 20:02
Maven POM to package camel routes (Java DSL) projects to deploy in a OSGI Containers like JBoss Fuse (Apache Karaf) without Blueprint or Spring Beans XML descriptors.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.redhat.workshop.fuse</groupId>
<artifactId>camel-java</artifactId>
<packaging>bundle</packaging>
<version>1.0.0-SNAPSHOT</version>
@rafaeltuelho
rafaeltuelho / jboss-eap-offical-repos-pom.xml
Created November 10, 2014 19:33
JBoss EAP Official Maven Repo conf... Ref:
<repositories>
<repository>
<id>jboss-eap-repository</id>
<url>http://maven.repository.redhat.com/techpreview/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
@rafaeltuelho
rafaeltuelho / jboss-as-maven-plugin-pom.xml
Created November 10, 2014 19:53
jboss-as-maven-plugin example
<build>
<!-- Maven will append the version to the finalName (which is the name
given to the generated war, and hence the context root) -->
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>${version.war.plugin}</version>
<configuration>
<!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! -->
@rafaeltuelho
rafaeltuelho / openshift-profile-pom.xml
Created November 10, 2014 20:01
Openshift maven plugin profile example
<profile>
<!-- When built in OpenShift the 'openshift' profile will be used when
invoking mvn. -->
<!-- Use this profile for any OpenShift specific customization your app
will need. -->
<!-- By default that is to put the resulting archive into the 'deployments'
folder. -->
<!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
<id>openshift</id>
<build>
@rafaeltuelho
rafaeltuelho / snoop.jsp
Created November 13, 2014 02:14
JBoss EAP 6.0 JSP snoop page (from Openshift sample JBoss app)
<HTML>
<HEAD>
<TITLE>JBossEAP6.0 JSP snoop page</TITLE>
<%@ page import="javax.servlet.http.HttpUtils,java.util.Enumeration" %>
<%@ page import="java.lang.management.*" %>
<%@ page import="java.util.*" %>
</HEAD>
<BODY>
<H1>WebApp JSP Snoop page</H1>
@rafaeltuelho
rafaeltuelho / maven-settings-brms.xml
Created November 19, 2014 14:10
Maven settings.xml sample to use JBoss BRMS Maven Repo
<!-- It is either needed to turn on pre-emptive authentication for the repository server by -->
<server>
<id>guvnor-m2-repo</id>
<username>admin</username>
<password>admin</password>
<configuration>
<wagonProvider>httpclient</wagonProvider>
<httpConfiguration>
<all>
<usePreemptive>true</usePreemptive>
@rafaeltuelho
rafaeltuelho / doDocker.sh
Created December 3, 2014 02:24
Issue a Docker command to all active containers
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage: $0 start|stop|pause|unpause|<any valid docker cmd>"
exit 1
fi
for c in $(sudo docker ps -a | awk '{print $1}' | sed "1 d")
do
sudo docker $1 $c
@rafaeltuelho
rafaeltuelho / jgroups_jvm_startup_params.sh
Last active August 29, 2015 14:12
JGroups app startup params to avoid issues in a host with multiples network ifcs
java -cp . com.your.project.MainClass -Djgroups.bind_addr=127.0.0.1 -Djava.net.preferIPv4Stack=true
@rafaeltuelho
rafaeltuelho / infinispan7-repl-cache.xml
Created December 29, 2014 21:16
Infinispan 7.x clustered replicated cache simple conf
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:7.0 http://www.infinispan.org/schemas/infinispan-config-7.0.xsd"
xmlns="urn:infinispan:config:7.0">
<jgroups>
<stack-file name="udp" path="default-configs/default-jgroups-udp.xml"/>
<stack-file name="tcp" path="default-configs/default-jgroups-tcp.xml"/>
</jgroups>