Created
February 28, 2017 20:46
-
-
Save cestella/7aea46f1a2031c11afc9f1eba9210c86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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>com.caseystella.stellar</groupId> | |
<artifactId>custom</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
<packaging>jar</packaging> | |
<name>custom</name> | |
<url>http://maven.apache.org</url> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
</properties> | |
<dependencies> | |
<dependency> | |
<groupId>org.apache.metron</groupId> | |
<artifactId>metron-common</artifactId> | |
<version>0.3.1</version> | |
<scope>provided</scope> | |
</dependency> | |
<dependency> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
<version>3.8.1</version> | |
<scope>test</scope> | |
</dependency> | |
</dependencies> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.notmetron.stellar; | |
import org.apache.metron.common.dsl.Context; | |
import org.apache.metron.common.dsl.ParseException; | |
import org.apache.metron.common.dsl.Stellar; | |
import org.apache.metron.common.dsl.StellarFunction; | |
import java.util.List; | |
public class TimeFunction { | |
@Stellar( | |
name="NOW", | |
description = "Right now!", | |
params = {}, | |
returns="Timestamp" | |
) | |
public static class Now implements StellarFunction { | |
public Object apply(List<Object> list, Context context) throws ParseException { | |
return System.currentTimeMillis(); | |
} | |
public void initialize(Context context) { | |
} | |
public boolean isInitialized() { | |
return true; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment