当前位置: 首页>>代码示例>>Java>>正文


Java Entity.getEntityType方法代码示例

本文整理汇总了Java中org.apache.falcon.entity.v0.Entity.getEntityType方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.getEntityType方法的具体用法?Java Entity.getEntityType怎么用?Java Entity.getEntityType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.falcon.entity.v0.Entity的用法示例。


在下文中一共展示了Entity.getEntityType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onAdd

import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
@Override
public void onAdd(Entity entity) throws FalconException {
    try {
        EntityType entityType = entity.getEntityType();
        switch (entityType) {
        case CLUSTER:
            addEntity(entity, FalconEvent.OPERATION.ADD_CLUSTER);
            break;

        case PROCESS:
            addEntity(entity, FalconEvent.OPERATION.ADD_PROCESS);
            break;

        case FEED:
            addEntity(entity, FalconEvent.OPERATION.ADD_FEED);
            break;

        default:
            LOG.debug("Entity type not processed {}", entityType);
        }
    } catch(Throwable t) {
        LOG.warn("Error handling entity {}", entity, t);
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:25,代码来源:AtlasService.java

示例2: loadEntity

import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
private <T extends Entity> T loadEntity(EntityType type, String resource, String name) throws JAXBException {
    Entity entity = (Entity) type.getUnmarshaller().unmarshal(this.getClass().getResourceAsStream(resource));
    switch (entity.getEntityType()) {
        case CLUSTER:
            ((Cluster) entity).setName(name);
            break;

        case FEED:
            ((Feed) entity).setName(name);
            break;

        case PROCESS:
            ((org.apache.falcon.entity.v0.process.Process) entity).setName(name);
            break;
    }
    return (T)entity;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:18,代码来源:FalconHookIT.java

示例3: validateUpdate

import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
private void validateUpdate(Entity oldEntity, Entity newEntity) throws FalconException {
    if (oldEntity.getEntityType() != newEntity.getEntityType() || !oldEntity.equals(newEntity)) {
        throw new FalconException(
                oldEntity.toShortString() + " can't be updated with " + newEntity.toShortString());
    }

    if (oldEntity.getEntityType() == EntityType.CLUSTER) {
        throw new FalconException("Update not supported for clusters");
    }

    String[] props = oldEntity.getEntityType().getImmutableProperties();
    for (String prop : props) {
        Object oldProp, newProp;
        try {
            oldProp = PropertyUtils.getProperty(oldEntity, prop);
            newProp = PropertyUtils.getProperty(newEntity, prop);
        } catch (Exception e) {
            throw new FalconException(e);
        }
        if (!ObjectUtils.equals(oldProp, newProp)) {
            throw new ValidationException(oldEntity.toShortString() + ": " + prop + " can't be changed");
        }
    }
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:25,代码来源:AbstractEntityManager.java

示例4: getRetry

import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
public static Retry getRetry(Entity entity) throws FalconException {
    switch (entity.getEntityType()) {
    case FEED:
        if (!RuntimeProperties.get()
                .getProperty("feed.retry.allowed", "true")
                .equalsIgnoreCase("true")) {
            return null;
        }
        Retry retry = new Retry();
        retry.setAttempts(Integer.parseInt(RuntimeProperties.get()
                .getProperty("feed.retry.attempts", "3")));
        retry.setDelay(new Frequency(RuntimeProperties.get().getProperty(
                "feed.retry.frequency", "minutes(5)")));
        retry.setPolicy(PolicyType.fromValue(RuntimeProperties.get()
                .getProperty("feed.retry.policy", "exp-backoff")));
        return retry;
    case PROCESS:
        Process process = (Process) entity;
        return process.getRetry();
    default:
        throw new FalconException("Cannot create Retry for entity:" + entity.getName());
    }
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:24,代码来源:EntityUtil.java

示例5: canRemove

import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
private void canRemove(Entity entity) throws FalconException {
    Pair<String, EntityType>[] referencedBy = EntityIntegrityChecker.referencedBy(entity);
    if (referencedBy != null && referencedBy.length > 0) {
        StringBuffer messages = new StringBuffer();
        for (Pair<String, EntityType> ref : referencedBy) {
            messages.append(ref).append("\n");
        }
        throw new FalconException(
                entity.getName() + "(" + entity.getEntityType() + ") cant " + "be removed as it is referred by "
                        + messages);
    }
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:13,代码来源:AbstractEntityManager.java

示例6: validateDateRangeFor

import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
private void validateDateRangeFor(Entity entity, Pair<Date, String> clusterMinStart,
                                  Pair<Date, String> clusterMaxEnd, String start, String end)
        throws FalconException {

    Date instStart = EntityUtil.parseDateUTC(start);
    if (instStart.before(clusterMinStart.first)) {
        throw new ValidationException("Start date " + start + " is before "
                + entity.getEntityType() + "'s  start "
                + SchemaHelper.formatDateUTC(clusterMinStart.first)
                + " for cluster " + clusterMinStart.second);
    }

    if (StringUtils.isNotEmpty(end)) {
        Date instEnd = EntityUtil.parseDateUTC(end);
        if (instStart.after(instEnd)) {
            throw new ValidationException("Start date " + start
                    + " is after end date " + end);
        }

        if (instEnd.after(clusterMaxEnd.first)) {
            throw new ValidationException("End date " + end + " is after "
                    + entity.getEntityType() + "'s end "
                    + SchemaHelper.formatDateUTC(clusterMaxEnd.first)
                    + " for cluster " + clusterMaxEnd.second);
        }
    } else if (instStart.after(clusterMaxEnd.first)) {
        throw new ValidationException("Start date " + start + " is after "
                + entity.getEntityType() + "'s end "
                + SchemaHelper.formatDateUTC(clusterMaxEnd.first)
                + " for cluster " + clusterMaxEnd.second);
    }
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:33,代码来源:AbstractInstanceManager.java

示例7: onAdd

import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
@Override
public void onAdd(Entity entity) throws FalconException {
    if (entity.getEntityType() != EntityType.CLUSTER) {
        return;
    }

    Cluster cluster = (Cluster) entity;
    String currentColo = DeploymentUtil.getCurrentColo();
    if (DeploymentUtil.isEmbeddedMode() || currentColo.equals(cluster.getColo())) {
        addLibsTo(cluster);
    }
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:13,代码来源:SharedLibraryHostingService.java

示例8: onChange

import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
@Override
public void onChange(Entity oldEntity, Entity newEntity) throws FalconException {
    if (oldEntity.getEntityType() != EntityType.CLUSTER) {
        return;
    }
    Cluster oldCluster = (Cluster) oldEntity;
    Cluster newCluster = (Cluster) newEntity;
    if (!ClusterHelper.getInterface(oldCluster, Interfacetype.WRITE).getEndpoint()
            .equals(ClusterHelper.getInterface(newCluster, Interfacetype.WRITE).getEndpoint())
            || !ClusterHelper.getInterface(oldCluster, Interfacetype.WORKFLOW).getEndpoint()
            .equals(ClusterHelper.getInterface(newCluster, Interfacetype.WORKFLOW).getEndpoint())) {
        addLibsTo(newCluster);
    }
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:15,代码来源:SharedLibraryHostingService.java

示例9: findProcesses

import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
private Set<Process> findProcesses(Set<Entity> referenced) {
    Set<Process> processes = new HashSet<Process>();
    for (Entity entity : referenced) {
        if (entity.getEntityType() == EntityType.PROCESS) {
            processes.add((Process) entity);
        }
    }
    return processes;
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:10,代码来源:FeedEntityParser.java

示例10: shouldUpdate

import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
public static boolean shouldUpdate(Entity oldEntity, Entity newEntity, Entity affectedEntity)
    throws FalconException {

    if (oldEntity.getEntityType() == EntityType.FEED && affectedEntity.getEntityType() == EntityType.PROCESS) {
        return shouldUpdate((Feed) oldEntity, (Feed) newEntity, (Process) affectedEntity);
    } else {
        LOG.debug(newEntity.toShortString());
        LOG.debug(affectedEntity.toShortString());
        throw new FalconException("Don't know what to do. Unexpected scenario");
    }
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:12,代码来源:UpdateHelper.java

示例11: onRemove

import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
@Override
public void onRemove(Entity entity) {
    if (entity.getEntityType() != EntityType.CLUSTER) {
        return;
    }

    Cluster cluster = (Cluster) entity;
    COLO_CLUSTER_MAP.get(cluster.getColo()).remove(cluster.getName());
    if (COLO_CLUSTER_MAP.get(cluster.getColo()).isEmpty()) {
        COLO_CLUSTER_MAP.remove(cluster.getColo());
    }
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:13,代码来源:ColoClusterRelation.java

示例12: onChange

import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
@Override
public void onChange(Entity oldEntity, Entity newEntity) throws FalconException {
    if (oldEntity.getEntityType() != EntityType.CLUSTER) {
        return;
    }
    throw new FalconException("change shouldn't be supported on cluster!");
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:8,代码来源:ColoClusterRelation.java

示例13: getEndTime

import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
public static Date getEndTime(Entity entity, String cluster) {
    if (entity.getEntityType() == EntityType.PROCESS) {
        return getEndTime((Process) entity, cluster);
    } else {
        return getEndTime((Feed) entity, cluster);
    }
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:8,代码来源:EntityUtil.java

示例14: getStartTime

import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
public static Date getStartTime(Entity entity, String cluster) {
    if (entity.getEntityType() == EntityType.PROCESS) {
        return getStartTime((Process) entity, cluster);
    } else {
        return getStartTime((Feed) entity, cluster);
    }
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:8,代码来源:EntityUtil.java

示例15: getParallel

import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
public static int getParallel(Entity entity) {
    if (entity.getEntityType() == EntityType.PROCESS) {
        return getParallel((Process) entity);
    } else {
        return getParallel((Feed) entity);
    }
}
 
开发者ID:shaikidris,项目名称:incubator-falcon,代码行数:8,代码来源:EntityUtil.java


注:本文中的org.apache.falcon.entity.v0.Entity.getEntityType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。