Skip to content

Instantly share code, notes, and snippets.

View tsegismont's full-sized avatar

Thomas Segismont tsegismont

View GitHub Profile
@tsegismont
tsegismont / gist:2960038
Created June 20, 2012 14:01
Default Transaction Interception for spring @service objects
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
<property name="dataSource" ref="myDS" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<aop:config>
<aop:pointcut id="defaultServiceMethodTxPointcut"
expression="execution(!@org.springframework.transaction.annotation.Transactional * *(..))
@tsegismont
tsegismont / gist:2960922
Created June 20, 2012 16:56
Spring XML tx advice
<tx:advice id="defaultServiceMethodTxAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" propagation="SUPPORTS" read-only="true" />
<tx:method name="is*" propagation="SUPPORTS" read-only="true" />
<tx:method name="find*" propagation="SUPPORTS" read-only="true" />
<tx:method name="load*" propagation="SUPPORTS" read-only="true" />
<tx:method name="*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
@tsegismont
tsegismont / createPackageBackedResourceViaContentHandle.js
Last active December 25, 2015 04:29
createPackageBackedResourceViaContentHandle
var contentHandle = scriptUtil.uploadContent(pathName);
ResourceFactoryManager.createPackageBackedResourceViaContentHandle(
parentResourceId,
applicationTypeId,
packageName,
pluginConfiguration,
packageName,
version,
null, // architectureId
@tsegismont
tsegismont / ContentManagerRemote.java
Created October 10, 2013 13:11
ContentManagerRemote
/**
* Creates a temporary file for fragmented content upload.
*
* @return a temporary file handle
*/
String createTemporaryContentHandle();
/**
* Saves the fragment in the temporary file denoted by <code>temporaryContentHandle</code>.
*
@tsegismont
tsegismont / ScriptUtil.java
Created October 10, 2013 13:18
org.rhq.bindings.util.ScriptUtil#uploadContent
public String uploadContent(String filename) {
if (remoteClient == null) {
throw new IllegalStateException("The uploadContent method requires a connection to the RHQ server.");
}
ContentUploader contentUploader = new ContentUploader(remoteClient.getProxy(ContentManagerRemote.class));
return contentUploader.upload(filename);
}
@tsegismont
tsegismont / bundles.js
Last active December 25, 2015 04:38
createBundleVersion
/**
* A simple function to create a new bundle version from a zip file containing
* the bundle.
*
* @param pathToBundleZipFile the path to the bundle on the local file system
*
* @return an instance of BundleVersion class describing what's been created on
* the RHQ server.
*/
function createBundleVersion(pathToBundleZipFile) {
@tsegismont
tsegismont / rhq-plugin.xml
Created March 18, 2014 10:26
Depend on and use classes of AS7Plugin
<depends plugin="JBossAS7" useClasses="true"/>
@tsegismont
tsegismont / pom.xml
Last active August 29, 2015 13:57
mbeans-on-as7-plugin sample POM
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mbeans-on-as7-plugin</groupId>
<artifactId>mbeans-on-as7-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>rhq-agent-plugin</packaging>
@tsegismont
tsegismont / rhq-plugin.xml
Created March 18, 2014 13:49
mbeans-on-as7-plugin sample plugin descriptor
<plugin
name="MyappMBeansPlugin"
displayName="Myapp MBeans Plugin"
package="com.myapp.services.plugin"
xmlns="urn:xmlns:rhq-plugin"
xmlns:c="urn:xmlns:rhq-configuration">
<depends plugin="JBossAS7" useClasses="true"/>
<service name="Myapp Services"
@tsegismont
tsegismont / pom.xml
Created November 4, 2014 22:02
netty-collectd dependency
<dependency>
<groupId>org.rhq.metrics.netty</groupId>
<artifactId>netty-collectd</artifactId>
<version>0.1-SNAPSHOT</version>
</dependency>