Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Clean up classes in the queue recipe

  • Loading branch information...
commit bf6e63059e6d769251f61abbfaf77b32ee82cf55 1 parent f80db33
@thomas-kielbus thomas-kielbus authored
View
28 megadesk-recipes/src/main/java/com/liveramp/megadesk/recipes/queue/Append.java
@@ -1,3 +1,19 @@
+/**
+ * Copyright 2014 LiveRamp
+ *
+ * Licensed 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 com.liveramp.megadesk.recipes.queue;
import java.util.List;
@@ -5,26 +21,20 @@
import com.google.common.collect.ImmutableList;
import com.liveramp.megadesk.base.transaction.BaseDependency;
+import com.liveramp.megadesk.base.transaction.BaseTransaction;
import com.liveramp.megadesk.core.state.Variable;
import com.liveramp.megadesk.core.transaction.Context;
-import com.liveramp.megadesk.core.transaction.Dependency;
import com.liveramp.megadesk.core.transaction.Transaction;
-public class Append<V> implements Transaction<Void> {
+public class Append<V> extends BaseTransaction<Void> implements Transaction<Void> {
- private final Dependency dependency;
private final Variable<ImmutableList> list;
private final List<V> values;
public Append(Variable<ImmutableList> driver, List<V> values) {
+ super(BaseDependency.builder().writes(driver).build());
this.values = values;
this.list = driver;
- this.dependency = BaseDependency.builder().writes(list).build();
- }
-
- @Override
- public Dependency dependency() {
- return dependency;
}
@Override
View
1  megadesk-recipes/src/main/java/com/liveramp/megadesk/recipes/queue/BaseQueueExecutable.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.liveramp.megadesk.recipes.queue;
import java.util.List;
View
20 megadesk-recipes/src/main/java/com/liveramp/megadesk/recipes/queue/BatchExecutable.java
@@ -1,6 +1,23 @@
+/**
+ * Copyright 2014 LiveRamp
+ *
+ * Licensed 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 com.liveramp.megadesk.recipes.queue;
import com.google.common.collect.ImmutableList;
+
import com.liveramp.megadesk.base.state.Local;
import com.liveramp.megadesk.base.transaction.BaseTransactionExecutor;
import com.liveramp.megadesk.core.transaction.TransactionExecutor;
@@ -18,6 +35,7 @@ public BatchExecutable(Batch<VALUE> batch, TransactionExecutor executor) {
new Local<ImmutableList>(factory.<ImmutableList>get(name + "-input", ImmutableList.of())),
new Local<ImmutableList>(factory.<ImmutableList>get(name + "-output", ImmutableList.of())),
new Local<Boolean>(factory.get(name + "-frozen", false))),
- new BaseTransactionExecutor());
+ new BaseTransactionExecutor()
+ );
}
}
View
14 megadesk-recipes/src/main/java/com/liveramp/megadesk/recipes/queue/Erase.java
@@ -13,30 +13,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.liveramp.megadesk.recipes.queue;
import com.google.common.collect.ImmutableList;
+
import com.liveramp.megadesk.base.transaction.BaseDependency;
+import com.liveramp.megadesk.base.transaction.BaseTransaction;
import com.liveramp.megadesk.core.state.Variable;
import com.liveramp.megadesk.core.transaction.Context;
-import com.liveramp.megadesk.core.transaction.Dependency;
import com.liveramp.megadesk.core.transaction.Transaction;
-class Erase implements Transaction<Void> {
+class Erase extends BaseTransaction<Void> implements Transaction<Void> {
- private final Dependency dependency;
private final Variable<ImmutableList> list;
private final Variable<Boolean> frozen;
Erase(Variable<ImmutableList> list, Variable<Boolean> frozen) {
+ super(BaseDependency.builder().writes(list, frozen).build());
this.frozen = frozen;
this.list = list;
- this.dependency = BaseDependency.builder().writes(this.list, this.frozen).build();
- }
-
- @Override
- public Dependency dependency() {
- return dependency;
}
@Override
View
31 megadesk-recipes/src/main/java/com/liveramp/megadesk/recipes/queue/MegadeskPersistentBatch.java
@@ -1,21 +1,22 @@
+/**
+ * Copyright 2014 LiveRamp
+ *
+ * Licensed 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 com.liveramp.megadesk.recipes.queue;
import com.google.common.collect.ImmutableList;
-/**
- * Copyright 2014 LiveRamp
- * <p/>
- * Licensed 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.
- */
public interface MegadeskPersistentBatch<VALUE> extends MegadeskPersistentQueue<VALUE, ImmutableList<VALUE>> {
}
View
31 megadesk-recipes/src/main/java/com/liveramp/megadesk/recipes/queue/MegadeskPersistentQueue.java
@@ -1,22 +1,23 @@
+/**
+ * Copyright 2014 LiveRamp
+ *
+ * Licensed 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 com.liveramp.megadesk.recipes.queue;
import java.util.List;
-/**
- * Copyright 2014 LiveRamp
- * <p/>
- * Licensed 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.
- */
public interface MegadeskPersistentQueue<VALUE, OUTPUT> {
public void append(VALUE... values);
View
29 megadesk-recipes/src/main/java/com/liveramp/megadesk/recipes/queue/PopOne.java
@@ -1,27 +1,38 @@
+/**
+ * Copyright 2014 LiveRamp
+ *
+ * Licensed 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 com.liveramp.megadesk.recipes.queue;
import com.google.common.collect.ImmutableList;
+
import com.liveramp.megadesk.base.transaction.BaseDependency;
+import com.liveramp.megadesk.base.transaction.BaseTransaction;
import com.liveramp.megadesk.core.state.Variable;
import com.liveramp.megadesk.core.transaction.Context;
-import com.liveramp.megadesk.core.transaction.Dependency;
import com.liveramp.megadesk.core.transaction.Transaction;
-public class PopOne implements Transaction<Void> {
+public class PopOne extends BaseTransaction<Void> implements Transaction<Void> {
- private final Dependency dependency;
private final Variable<ImmutableList> list;
private final Variable<Boolean> frozen;
public PopOne(Variable<ImmutableList> list, Variable<Boolean> frozen) {
+ super(BaseDependency.builder().writes(list, frozen).build());
this.frozen = frozen;
this.list = list;
- this.dependency = BaseDependency.builder().writes(this.list, this.frozen).build();
- }
-
- @Override
- public Dependency dependency() {
- return dependency;
}
@Override
View
21 megadesk-recipes/src/main/java/com/liveramp/megadesk/recipes/queue/Queue.java
@@ -1,12 +1,29 @@
+/**
+ * Copyright 2014 LiveRamp
+ *
+ * Licensed 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 com.liveramp.megadesk.recipes.queue;
import com.google.common.collect.ImmutableList;
+
import com.liveramp.megadesk.core.state.Variable;
import com.liveramp.megadesk.core.transaction.Transaction;
-public class Queue<VALUE> extends BaseQueue<VALUE, VALUE>{
+public class Queue<VALUE> extends BaseQueue<VALUE, VALUE> {
- public Queue(Variable<ImmutableList> input,Variable<ImmutableList> output, Variable<Boolean> frozen) {
+ public Queue(Variable<ImmutableList> input, Variable<ImmutableList> output, Variable<Boolean> frozen) {
super(input, output, frozen);
}
View
22 megadesk-recipes/src/main/java/com/liveramp/megadesk/recipes/queue/QueueExecutable.java
@@ -1,6 +1,23 @@
+/**
+ * Copyright 2014 LiveRamp
+ *
+ * Licensed 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 com.liveramp.megadesk.recipes.queue;
import com.google.common.collect.ImmutableList;
+
import com.liveramp.megadesk.base.state.BaseVariable;
import com.liveramp.megadesk.base.state.Name;
import com.liveramp.megadesk.base.transaction.BaseTransactionExecutor;
@@ -19,10 +36,11 @@ public QueueExecutable(Queue<VALUE> queue, TransactionExecutor executor) {
new BaseVariable<ImmutableList>(new Name<ImmutableList>(name + "input"), factory.<ImmutableList>get(name + "-input", ImmutableList.of())),
new BaseVariable<ImmutableList>(new Name<ImmutableList>(name + "output"), factory.<ImmutableList>get(name + "-output", ImmutableList.of())),
new BaseVariable<Boolean>(new Name<Boolean>(name + "frozen"), (factory.get(name + "-frozen", false)))),
- new BaseTransactionExecutor());
+ new BaseTransactionExecutor()
+ );
}
public Queue<VALUE> getQueue() {
- return (Queue<VALUE>) super.getQueue();
+ return (Queue<VALUE>)super.getQueue();
}
}
View
13 megadesk-recipes/src/main/java/com/liveramp/megadesk/recipes/queue/TransferBatch.java
@@ -17,30 +17,25 @@
package com.liveramp.megadesk.recipes.queue;
import com.google.common.collect.ImmutableList;
+
import com.liveramp.megadesk.base.transaction.BaseDependency;
+import com.liveramp.megadesk.base.transaction.BaseTransaction;
import com.liveramp.megadesk.core.state.Variable;
import com.liveramp.megadesk.core.transaction.Accessor;
import com.liveramp.megadesk.core.transaction.Context;
-import com.liveramp.megadesk.core.transaction.Dependency;
import com.liveramp.megadesk.core.transaction.Transaction;
-public class TransferBatch implements Transaction<ImmutableList> {
+public class TransferBatch extends BaseTransaction<ImmutableList> implements Transaction<ImmutableList> {
- private final Dependency dependency;
private final Variable<ImmutableList> input;
private final Variable<ImmutableList> output;
private final Variable<Boolean> frozen;
public TransferBatch(Variable<ImmutableList> input, Variable<ImmutableList> output, Variable<Boolean> frozen) {
+ super(BaseDependency.builder().writes(input, output, frozen).build());
this.input = input;
this.output = output;
this.frozen = frozen;
- this.dependency = BaseDependency.builder().writes(this.input, this.output, this.frozen).build();
- }
-
- @Override
- public Dependency dependency() {
- return dependency;
}
@Override
Please sign in to comment.
Something went wrong with that request. Please try again.