Package org.apache.falcon.entity.v0

Examples of org.apache.falcon.entity.v0.EntityType


     */
    public APIResult delete(HttpServletRequest request, String type, String entity, String colo) {

        checkColo(colo);
        try {
            EntityType entityType = EntityType.valueOf(type.toUpperCase());
            audit(request, entity, type, "DELETE");
            String removedFromEngine = "";
            try {
                Entity entityObj = EntityUtil.getEntity(type, entity);

                canRemove(entityObj);
                if (entityType.isSchedulable() && !DeploymentUtil.isPrism()) {
                    getWorkflowEngine().delete(entityObj);
                    removedFromEngine = "(KILLED in ENGINE)";
                }

                configStore.remove(entityType, entity);
View Full Code Here


    // Parallel update can get very clumsy if two feeds are updated which
    // are referred by a single process. Sequencing them.
    public synchronized APIResult update(HttpServletRequest request, String type, String entityName, String colo) {
        checkColo(colo);
        try {
            EntityType entityType = EntityType.valueOf(type.toUpperCase());
            audit(request, entityName, type, "UPDATE");
            Entity oldEntity = EntityUtil.getEntity(type, entityName);
            Entity newEntity = deserializeEntity(request, entityType);
            validate(newEntity);
View Full Code Here

    }

    protected synchronized Entity submitInternal(HttpServletRequest request, String type)
        throws IOException, FalconException {

        EntityType entityType = EntityType.valueOf(type.toUpperCase());
        Entity entity = deserializeEntity(request, entityType);

        Entity existingEntity = configStore.get(entityType, entity.getName());
        if (existingEntity != null) {
            if (EntityUtil.equals(existingEntity, entity)) {
View Full Code Here

        checkColo(colo);
        Entity entityObj;
        try {
            entityObj = EntityUtil.getEntity(type, entity);
            EntityType entityType = EntityType.valueOf(type.toUpperCase());
            String status;

            if (entityType.isSchedulable()) {
                if (workflowEngine.isActive(entityObj)) {
                    if (workflowEngine.isSuspended(entityObj)) {
                        status = EntityStatus.SUSPENDED.name();
                    } else {
                        status = EntityStatus.RUNNING.name();
View Full Code Here

     * @param type entity type
     * @return String
     */
    public EntityList getDependencies(String type) {
        try {
            EntityType entityType = EntityType.valueOf(type.toUpperCase());
            Collection<String> entityNames = configStore.getEntities(entityType);
            if (entityNames == null || entityNames.isEmpty()) {
                return new EntityList(new Entity[]{});
            }
            Entity[] entities = new Entity[entityNames.size()];
View Full Code Here

     * @param entityName entity name
     * @return String
     */
    public String getEntityDefinition(String type, String entityName) {
        try {
            EntityType entityType = EntityType.valueOf(type.toUpperCase());
            Entity entity = configStore.get(entityType, entityName);
            if (entity == null) {
                throw new NoSuchElementException(entityName + " (" + type + ") not found");
            }
            return entity.toString();
View Full Code Here

        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);
View Full Code Here

            public long getDelay(Frequency delay, int eventNumber) throws FalconException {
                return 0;
            }
        };

        Frequency frequency = new Frequency("minutes(1)");
        Assert.assertEquals(policy.getDurationInMilliSec(frequency), 60000);
        frequency = new Frequency("minutes(15)");
        Assert.assertEquals(policy.getDurationInMilliSec(frequency), 900000);
        frequency = new Frequency("hours(2)");
        Assert.assertEquals(policy.getDurationInMilliSec(frequency), 7200000);
    }
View Full Code Here

    }

    @Test
    public void testExpBackoffPolicy() throws FalconException {
        AbstractRerunPolicy backoff = new ExpBackoffPolicy();
        long delay = backoff.getDelay(new Frequency("minutes(2)"), 2);
        Assert.assertEquals(delay, 480000);

        long currentTime = System.currentTimeMillis();
        delay = backoff.getDelay(new Frequency("minutes(2)"),
                new Date(currentTime - 1 * 4 * 60 * 1000),
                new Date(currentTime + 1 * 60 * 60 * 1000));
        Assert.assertEquals(delay, 1 * 6 * 60 * 1000);

        currentTime = System.currentTimeMillis();
        delay = backoff.getDelay(new Frequency("minutes(1)"),
                new Date(currentTime - 1 * 9 * 60 * 1000),
                new Date(currentTime + 1 * 60 * 60 * 1000));
        Assert.assertEquals(delay, 900000);
    }
View Full Code Here

    }

    @Test
    public void testPeriodicPolicy() throws FalconException, InterruptedException {
        AbstractRerunPolicy periodic = new PeriodicPolicy();
        long delay = periodic.getDelay(new Frequency("minutes(2)"), 2);
        Assert.assertEquals(delay, 120000);
        delay = periodic.getDelay(new Frequency("minutes(2)"), 5);
        Assert.assertEquals(delay, 120000);

        long currentTime = System.currentTimeMillis();
        //Thread.sleep(1000);
        delay = periodic.getDelay(new Frequency("minutes(3)"),
                new Date(currentTime),
                new Date(currentTime + 1 * 60 * 60 * 1000));
        Assert.assertEquals(delay, 180000);
    }
View Full Code Here

TOP

Related Classes of org.apache.falcon.entity.v0.EntityType

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.