本文整理汇总了Java中org.apache.falcon.entity.v0.Entity.toShortString方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.toShortString方法的具体用法?Java Entity.toShortString怎么用?Java Entity.toShortString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.falcon.entity.v0.Entity
的用法示例。
在下文中一共展示了Entity.toShortString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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");
}
}
}
示例2: submitInternal
import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
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)) {
return existingEntity;
}
throw new EntityAlreadyExistsException(
entity.toShortString() + " already registered with configuration store. "
+ "Can't be submitted again. Try removing before submitting.");
}
validate(entity);
configStore.publish(entityType, entity);
LOG.info("Submit successful: (" + type + ")" + entity.getName());
return entity;
}
示例3: afterDelete
import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
@Override
public void afterDelete(Entity entity, String clusterName) throws FalconException {
try {
Cluster cluster = EntityUtil.getEntity(EntityType.CLUSTER, clusterName);
Path entityPath = new Path(ClusterHelper.getLocation(cluster, "staging"),
EntityUtil.getStagingPath(entity)).getParent();
LOG.info("Deleting entity path " + entityPath + " on cluster " + clusterName);
Configuration conf = ClusterHelper.getConfiguration(cluster);
FileSystem fs = FileSystem.get(conf);
if (fs.exists(entityPath) && !fs.delete(entityPath, true)) {
throw new FalconException("Unable to cleanup entity path: " + entityPath);
}
} catch (Exception e) {
throw new FalconException(
"Failed to cleanup entity path for " + entity.toShortString() + " on cluster " + clusterName, e);
}
}
示例4: publish
import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
/**
* @param type - EntityType that need to be published
* @param entity - Reference to the Entity Object
* @throws FalconException
*/
public synchronized void publish(EntityType type, Entity entity) throws FalconException {
try {
if (get(type, entity.getName()) == null) {
persist(type, entity);
dictionary.get(type).put(entity.getName(), entity);
onAdd(entity);
} else {
throw new EntityAlreadyExistsException(
entity.toShortString() + " already registered with configuration store. "
+ "Can't be submitted again. Try removing before submitting.");
}
} catch (IOException e) {
throw new StoreAccessException(e);
}
AUDIT.info(type + "/" + entity.getName() + " is published into config store");
}
示例5: updateInternal
import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
private synchronized void updateInternal(EntityType type, Entity entity) throws FalconException {
try {
if (get(type, entity.getName()) != null) {
persist(type, entity);
Entity oldEntity = dictionary.get(type).put(entity.getName(), entity);
onChange(oldEntity, entity);
} else {
throw new FalconException(entity.toShortString() + " doesn't exist");
}
} catch (IOException e) {
throw new StoreAccessException(e);
}
AUDIT.info(type + "/" + entity.getName() + " is replaced into config store");
}
示例6: update
import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
public synchronized void update(EntityType type, Entity entity) throws FalconException {
if (updatesInProgress.get() == entity) {
updateInternal(type, entity);
} else {
throw new FalconException(entity.toShortString() + " is not initialized for update");
}
}
示例7: initiateUpdate
import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
public synchronized void initiateUpdate(Entity entity) throws FalconException {
if (get(entity.getEntityType(), entity.getName()) == null || updatesInProgress.get() != null) {
throw new FalconException(
"An update for " + entity.toShortString() + " is already in progress or doesn't exist");
}
updatesInProgress.set(entity);
}
示例8: getKey
import org.apache.falcon.entity.v0.Entity; //导入方法依赖的package包/类
private String getKey(Entity entity, String cluster) {
return entity.toShortString() + "/" + cluster;
}