Skip to content

Instantly share code, notes, and snippets.

View dfilppi's full-sized avatar

DeWayne Filppi dfilppi

View GitHub Profile
@dfilppi
dfilppi / WanTimestamp.java
Created February 22, 2012 23:18
WAN Timestamp object
@SpaceClass
public class WanTimeStamp implements Serializable{
private Long time;
private String location;
public TimeStamp(){
}
public TimeStamp(String loc){
this.location=loc;
@dfilppi
dfilppi / TimeWatcherSnippet.java
Created February 22, 2012 23:59
TimeWatcher polling container config
....
SimplePollingEventContainerListener pec=new
SimplePollingContainerConfigurer(space)
.template(query)
.transactionManager(tm)
.eventListenerAnnotation(new Object(){
@SpaceDataEvent
public TimeStamp eventListener(TimeStamp event){
TimeRecord lt=getSpace().readById(TimeRecord.class,
@dfilppi
dfilppi / TimeRecord.java
Created February 23, 2012 00:05
TimeRecord class
@SpaceClass
public class TimeRecord implements Serializable{
private static Logger log=Logger.
getLogger(TimeRecord.class.getName());
private String location=null;
private List<TimeEntry> timelog=null;
private final int logsize=10; //arbitrary
//Only to be used for constructing templates
public TimeRecord(){}
@dfilppi
dfilppi / persistent annotation.java
Created June 26, 2012 15:53
The Persistent annotation definition
@Component
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Inherited
public @interface Persistent {
Class<? extends BulkDataPersister>[] persistTo() default {NullBulkDataPersister.class};
Class<? extends ManagedDataSource<?>> loadFrom() default NullManagedDataSource.class;
}
class NullBulkDataPersister implements BulkDataPersister{
@dfilppi
dfilppi / multi-eds config.xml
Created June 26, 2012 16:16
Configuring the multi-EDS
<bean id="multiEDS" class="org.openspaces.eds.support.MultiEDS">
<property name="persisters">
<list>
<ref local="hdfsEDS"/>
<ref local="cassandraEDS"/>
</list>
</property>
</bean>
@dfilppi
dfilppi / space document def.xml
Created June 26, 2012 16:29
old school space document type definition
<os-core:space id="space" url="/./space" >
<os-core:space-type type-name="Product" >
<os-core:id property="CatalogNumber"/>
<os-core:routing property="Category"/>
<os-core:basic-index path="Name"/>
<os-core:extended-index path="Price"/>
</os-core:space-type>
</os-core:space>
@dfilppi
dfilppi / annotation driven document def.java
Created June 26, 2012 16:37
annotation driven document def
@SpaceDocument(name="Product")
@Persistent(persistTo={CassandraEDS.class,HdfsPersisterEDS.class}, loadFrom=CassandraEDS.class)
public class Product {
@DocumentId
Integer catalogNumber;
@DocumentRouting
String category;
@dfilppi
dfilppi / spacetypemaker_config.xml
Created June 26, 2012 16:54
spacetypemaker config
<!-- annotation driven document definition -->
<bean id="defmaker" class="org.openspaces.eds.support.SpaceTypeMaker"/>
<bean id="deffactory" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject"><ref local="defmaker"/></property>
<property name="targetMethod"><value>getSpaceTypes</value></property>
</bean>
<bean id="space" class="org.openspaces.core.space.UrlSpaceFactoryBean">
.....
<property name="spaceTypes"><ref bean="deffactory"/></property>
@dfilppi
dfilppi / templating1
Created March 7, 2013 21:54
A Groovy templating example
def binding=["hosts":ips,"clientPort":"${config.clientPort}"]
def zoo = new File('templates/zoo.cfg')
engine = new SimpleTemplateEngine()
template = engine.createTemplate(zoo).make(binding)
@dfilppi
dfilppi / gist:5112305
Created March 7, 2013 22:11
nimbus monitor snippet
echo stat |nc 127.0.0.1 $PORT |awk -F : '{gsub(/ */,"");if ($1 == "Received" || $1 == "Sent" || $1 == "Outstanding") print $2}'