001/* An actor for the Map DDP pattern. 002 * 003 * Copyright (c) 2011-2012 The Regents of the University of California. 004 * All rights reserved. 005 * 006 * '$Author: jianwu $' 007 * '$Date: 2013-02-15 21:11:35 +0000 (Fri, 15 Feb 2013) $' 008 * '$Revision: 31450 $' 009 * 010 * Permission is hereby granted, without written agreement and without 011 * license or royalty fees, to use, copy, modify, and distribute this 012 * software and its documentation for any purpose, provided that the above 013 * copyright notice and the following two paragraphs appear in all copies 014 * of this software. 015 * 016 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY 017 * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 018 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 019 * THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF 020 * SUCH DAMAGE. 021 * 022 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 023 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 024 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE 025 * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF 026 * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, 027 * ENHANCEMENTS, OR MODIFICATIONS. 028 * 029 */ 030package org.kepler.ddp.actor.pattern; 031 032import ptolemy.data.expr.StringParameter; 033import ptolemy.kernel.CompositeEntity; 034import ptolemy.kernel.util.IllegalActionException; 035import ptolemy.kernel.util.NameDuplicationException; 036import ptolemy.kernel.util.Workspace; 037 038/** An actor for the Map DDP pattern. This actor reads one 039 * input data set of key-value pairs. The sub-workflow in 040 * this actor needs to be completed by reading data 041 * from the output ports of the MapInput actor and sending key- 042 * value pairs (an array of <key, value> records) to the 043 * MapOutput actor. For each key-value pair that is 044 * present in the input data set, the sub-workflow is executed 045 * once with that key and value. 046 * 047 * @author Daniel Crawl 048 * @version $Id: Map.java 31450 2013-02-15 21:11:35Z jianwu $ 049 */ 050public class Map extends SingleInputPatternActor { 051 052 /** Construct a new Map in a container with a given name. */ 053 public Map(CompositeEntity container, String name) 054 throws IllegalActionException, NameDuplicationException { 055 super(container, name); 056 partitionerClass = new StringParameter(this, "partitionerClass"); 057 } 058 059 /** Construct a new Map in a workspace. */ 060 public Map(Workspace workspace) { 061 super(workspace); 062 } 063 064 /** The name of the PartitionerClass, used only in hadoop for partioning map outputs. */ 065 public StringParameter partitionerClass; 066}