Package org.apache.falcon.entity.v0.feed

Examples of org.apache.falcon.entity.v0.feed.Cluster


    }

    public static Storage.TYPE getStorageType(Feed feed,
                                              org.apache.falcon.entity.v0.cluster.Cluster clusterEntity)
        throws FalconException {
        Cluster feedCluster = getCluster(feed, clusterEntity.getName());
        return getStorageType(feed, feedCluster);
    }
View Full Code Here


        case CLUSTER:
            return entity;

        case FEED:
            Feed feed = (Feed) entity.copy();
            Cluster feedCluster = FeedHelper.getCluster(feed, clusterName);
            Iterator<Cluster> itr = feed.getClusters().getClusters().iterator();
            while (itr.hasNext()) {
                Cluster cluster = itr.next();
                //In addition to retaining the required clster, retain the sources clusters if this is the target
                // cluster
                //1. Retain cluster if cluster n
                if (!(cluster.getName().equals(clusterName)
                        || (feedCluster.getType() == ClusterType.TARGET
                        && cluster.getType() == ClusterType.SOURCE))) {
                    itr.remove();
                }
            }
            return (T) feed;

        case PROCESS:
            Process process = (Process) entity.copy();
            Iterator<org.apache.falcon.entity.v0.process.Cluster> procItr =
                process.getClusters().getClusters().iterator();
            while (procItr.hasNext()) {
                org.apache.falcon.entity.v0.process.Cluster cluster = procItr.next();
                if (!cluster.getName().equals(clusterName)) {
                    procItr.remove();
                }
            }
            return (T) process;
        default:
View Full Code Here

        case CLUSTER:
            return entity;

        case FEED:
            Feed feed = (Feed) entity.copy();
            Cluster feedCluster = FeedHelper.getCluster(feed, clusterName);
            Iterator<Cluster> itr = feed.getClusters().getClusters().iterator();
            while (itr.hasNext()) {
                Cluster cluster = itr.next();
                //In addition to retaining the required clster, retain the sources clusters if this is the target
                // cluster
                //1. Retain cluster if cluster n
                if (!(cluster.getName().equals(clusterName)
                        || (feedCluster.getType() == ClusterType.TARGET
                        && cluster.getType() == ClusterType.SOURCE))) {
                    itr.remove();
                }
            }
            return (T) feed;

        case PROCESS:
            Process process = (Process) entity.copy();
            Iterator<org.apache.falcon.entity.v0.process.Cluster> procItr =
                process.getClusters().getClusters().iterator();
            while (procItr.hasNext()) {
                org.apache.falcon.entity.v0.process.Cluster cluster = procItr.next();
                if (!cluster.getName().equals(clusterName)) {
                    procItr.remove();
                }
            }
            return (T) process;
        default:
View Full Code Here

        String tmpFileName = TestContext.overlayParametersOverTemplate(TestContext.FEED_TEMPLATE1, overlay);
        Feed feed = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(new File(tmpFileName));
        Location location = new Location();
        location.setPath("fsext://global:00/falcon/test/input/${YEAR}/${MONTH}/${DAY}/${HOUR}");
        location.setType(LocationType.DATA);
        Cluster cluster = feed.getClusters().getClusters().get(0);
        cluster.setLocations(new Locations());
        feed.getClusters().getClusters().get(0).getLocations().getLocations().add(location);

        File tmpFile = TestContext.getTempFile();
        EntityType.FEED.getMarshaller().marshal(feed, tmpFile);
        response = context.submitAndSchedule(tmpFileName, overlay, EntityType.FEED);
View Full Code Here

     * @return an implementation of Storage
     * @throws FalconException
     */
    public static Storage createReadOnlyStorage(org.apache.falcon.entity.v0.cluster.Cluster clusterEntity,
                                                Feed feed) throws FalconException {
        Cluster feedCluster = getCluster(feed, clusterEntity.getName());
        final List<Location> locations = getLocations(feedCluster, feed);
        if (locations != null) {
            return new FileSystemStorage(ClusterHelper.getReadOnlyStorageUrl(clusterEntity), locations);
        }

View Full Code Here

    }

    public static Storage.TYPE getStorageType(Feed feed,
                                              org.apache.falcon.entity.v0.cluster.Cluster clusterEntity)
        throws FalconException {
        Cluster feedCluster = getCluster(feed, clusterEntity.getName());
        return getStorageType(feed, feedCluster);
    }
View Full Code Here

        case CLUSTER:
            return entity;

        case FEED:
            Feed feed = (Feed) entity.copy();
            Cluster feedCluster = FeedHelper.getCluster(feed, clusterName);
            Iterator<Cluster> itr = feed.getClusters().getClusters().iterator();
            while (itr.hasNext()) {
                Cluster cluster = itr.next();
                //In addition to retaining the required clster, retain the sources clusters if this is the target
                // cluster
                //1. Retain cluster if cluster n
                if (!(cluster.getName().equals(clusterName)
                        || (feedCluster.getType() == ClusterType.TARGET
                        && cluster.getType() == ClusterType.SOURCE))) {
                    itr.remove();
                }
            }
            return (T) feed;

        case PROCESS:
            Process process = (Process) entity.copy();
            Iterator<org.apache.falcon.entity.v0.process.Cluster> procItr =
                process.getClusters().getClusters().iterator();
            while (procItr.hasNext()) {
                org.apache.falcon.entity.v0.process.Cluster cluster = procItr.next();
                if (!cluster.getName().equals(clusterName)) {
                    procItr.remove();
                }
            }
            return (T) process;
        default:
View Full Code Here

        overlay.put("tableUri", TABLE_URI);

        String filePath = context.overlayParametersOverTemplate("/hive-table-feed.xml", overlay);
        InputStream stream = new FileInputStream(filePath);
        FeedEntityParser parser = (FeedEntityParser) EntityParserFactory.getParser(EntityType.FEED);
        Feed feed = parser.parse(stream);
        Assert.assertNotNull(feed);

        final LateArrival lateArrival = new LateArrival();
        lateArrival.setCutOff(new Frequency("4", Frequency.TimeUnit.hours));
        feed.setLateArrival(lateArrival);

        StringWriter stringWriter = new StringWriter();
        Marshaller marshaller = EntityType.FEED.getMarshaller();
        marshaller.marshal(feed, stringWriter);
        System.out.println(stringWriter.toString());
View Full Code Here

            return null;
        }

        Cluster cluster = CONFIG_STORE.get(EntityType.CLUSTER, feedCluster.getName());
        Path bundlePath = new Path(ClusterHelper.getLocation(cluster, "staging"), EntityUtil.getStagingPath(feed));
        Feed feedClone = (Feed) feed.copy();
        EntityUtil.setStartDate(feedClone, clusterName, startDate);

        AbstractOozieEntityMapper<Feed> mapper = new OozieFeedMapper(feedClone);
        if (!mapper.map(cluster, bundlePath)) {
            return null;
View Full Code Here

    @Override
    public void onAdd(Entity entity, boolean ignoreFailure) throws FalconException {

        if (entity.getEntityType().equals(EntityType.FEED)) {
            Feed feed = (Feed) entity;
            if (feed.getGroups() == null || feed.getGroups().equals("")) {
                return;
            }
            Set<FeedGroup> groupSet = getGroups(feed);
            addGroups(feed.getName(), groupSet);
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.falcon.entity.v0.feed.Cluster

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.