Repository: samza Updated Branches: refs/heads/master 1d420e750 -> 42bac30ad
http://git-wip-us.apache.org/repos/asf/samza/blob/42bac30a/samza-tools/src/main/java/org/apache/samza/tools/schemas/ProfileChangeEvent.avsc ---------------------------------------------------------------------- diff --git a/samza-tools/src/main/java/org/apache/samza/tools/schemas/ProfileChangeEvent.avsc b/samza-tools/src/main/java/org/apache/samza/tools/schemas/ProfileChangeEvent.avsc new file mode 100644 index 0000000..5c1e49d --- /dev/null +++ b/samza-tools/src/main/java/org/apache/samza/tools/schemas/ProfileChangeEvent.avsc @@ -0,0 +1,51 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +{ + "name": "ProfileChangeEvent", + "version" : 1, + "namespace": "com.linkedin.samza.tools.avro", + "type": "record", + "fields": [ + { + "name": "Name", + "doc": "Name of the profile.", + "type": ["null", "string"], + "default":null + }, + { + "name": "NewCompany", + "doc": "Name of the new company the person joined.", + "type": ["null", "string"], + "default":null + }, + { + "name": "OldCompany", + "doc": "Name of the old company the person was working.", + "type": ["null", "string"], + "default":null + }, + { + "name": "ProfileChangeTimestamp", + "doc": "Time at which the profile was changed.", + "type": ["null", "long"], + "default":null + } + ] +} http://git-wip-us.apache.org/repos/asf/samza/blob/42bac30a/samza-tools/src/main/java/org/apache/samza/tools/schemas/ProfileChangeEvent.java ---------------------------------------------------------------------- diff --git a/samza-tools/src/main/java/org/apache/samza/tools/schemas/ProfileChangeEvent.java b/samza-tools/src/main/java/org/apache/samza/tools/schemas/ProfileChangeEvent.java new file mode 100644 index 0000000..c8e951c --- /dev/null +++ b/samza-tools/src/main/java/org/apache/samza/tools/schemas/ProfileChangeEvent.java @@ -0,0 +1,60 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +/** + * Autogenerated by Avro + * + * DO NOT EDIT DIRECTLY + */ +package org.apache.samza.tools.schemas; + +@SuppressWarnings("all") +public class ProfileChangeEvent extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { + public static final org.apache.avro.Schema SCHEMA$ = org.apache.avro.Schema.parse("{\"type\":\"record\",\"name\":\"ProfileChangeEvent\",\"namespace\":\"com.linkedin.samza.tools.avro\",\"fields\":[{\"name\":\"Name\",\"type\":[\"null\",\"string\"],\"doc\":\"Name of the profile.\",\"default\":null},{\"name\":\"NewCompany\",\"type\":[\"null\",\"string\"],\"doc\":\"Name of the new company the person joined.\",\"default\":null},{\"name\":\"OldCompany\",\"type\":[\"null\",\"string\"],\"doc\":\"Name of the old company the person was working.\",\"default\":null},{\"name\":\"ProfileChangeTimestamp\",\"type\":[\"null\",\"long\"],\"doc\":\"Time at which the profile was changed.\",\"default\":null}]}"); + /** Name of the profile. */ + public java.lang.CharSequence Name; + /** Name of the new company the person joined. */ + public java.lang.CharSequence NewCompany; + /** Name of the old company the person was working. */ + public java.lang.CharSequence OldCompany; + /** Time at which the profile was changed. */ + public java.lang.Long ProfileChangeTimestamp; + public org.apache.avro.Schema getSchema() { return SCHEMA$; } + // Used by DatumWriter. Applications should not call. + public java.lang.Object get(int field$) { + switch (field$) { + case 0: return Name; + case 1: return NewCompany; + case 2: return OldCompany; + case 3: return ProfileChangeTimestamp; + default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + } + } + // Used by DatumReader. Applications should not call. + @SuppressWarnings(value="unchecked") + public void put(int field$, java.lang.Object value$) { + switch (field$) { + case 0: Name = (java.lang.CharSequence)value$; break; + case 1: NewCompany = (java.lang.CharSequence)value$; break; + case 2: OldCompany = (java.lang.CharSequence)value$; break; + case 3: ProfileChangeTimestamp = (java.lang.Long)value$; break; + default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + } + } +} http://git-wip-us.apache.org/repos/asf/samza/blob/42bac30a/samza-tools/src/main/java/org/apache/samza/tools/udf/RegexMatchUdf.java ---------------------------------------------------------------------- diff --git a/samza-tools/src/main/java/org/apache/samza/tools/udf/RegexMatchUdf.java b/samza-tools/src/main/java/org/apache/samza/tools/udf/RegexMatchUdf.java new file mode 100644 index 0000000..42e9f04 --- /dev/null +++ b/samza-tools/src/main/java/org/apache/samza/tools/udf/RegexMatchUdf.java @@ -0,0 +1,40 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.apache.samza.tools.udf; + +import java.util.regex.Pattern; +import org.apache.samza.config.Config; +import org.apache.samza.sql.udfs.ScalarUdf; + + +/** + * Simple RegexMatch Udf. + */ +public class RegexMatchUdf implements ScalarUdf { + @Override + public void init(Config config) { + + } + + @Override + public Object execute(Object... args) { + return Pattern.matches((String) args[0], (String) args[1]); + } +} http://git-wip-us.apache.org/repos/asf/samza/blob/42bac30a/samza-tools/src/main/resources/log4j.xml ---------------------------------------------------------------------- diff --git a/samza-tools/src/main/resources/log4j.xml b/samza-tools/src/main/resources/log4j.xml new file mode 100644 index 0000000..15aad1c --- /dev/null +++ b/samza-tools/src/main/resources/log4j.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor + license agreements. See the NOTICE file distributed with this work for additional + information regarding copyright ownership. The ASF licenses this file to + you under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of + the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. --> +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> + +<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> + + @log4j.appenders.webapp@ + + @log4j.appenders.public_access@ + + <appender name="console" class="org.apache.log4j.ConsoleAppender"> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" + value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" /> + </layout> + </appender> + + @log4j.loggers.spring@ + + @log4j.loggers.public_access@ + <logger name="org.apache" additivity="false"> + <level value="DEBUG"/> + <appender-ref ref="console"/> + </logger> + + @log4j.loggers.root@ + <root> + <priority value ="info" /> + <appender-ref ref="console"/> + </root> + + +</log4j:configuration> + http://git-wip-us.apache.org/repos/asf/samza/blob/42bac30a/settings.gradle ---------------------------------------------------------------------- diff --git a/settings.gradle b/settings.gradle index e50e816..06141ac 100644 --- a/settings.gradle +++ b/settings.gradle @@ -25,7 +25,8 @@ include \ 'samza-shell', 'samza-azure', 'samza-sql', - 'samza-aws' + 'samza-aws', + 'samza-tools' def scalaModules = [ 'samza-core',
