• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ExceptionFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.tinkerpop.blueprints.util.ExceptionFactory的典型用法代码示例。如果您正苦于以下问题:Java ExceptionFactory类的具体用法?Java ExceptionFactory怎么用?Java ExceptionFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ExceptionFactory类属于com.tinkerpop.blueprints.util包,在下文中一共展示了ExceptionFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getVertex

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
@Override
public TitanVertex getVertex(final Object id) {
    if (null == id)
        throw ExceptionFactory.vertexIdCanNotBeNull();
    if (id instanceof Vertex) //allows vertices to be "re-attached" to the current transaction
        return getVertex(((Vertex) id).getId());

    final long longId;
    if (id instanceof Long) {
        longId = (Long) id;
    } else if (id instanceof Number) {
        longId = ((Number) id).longValue();
    } else {
        try {
            longId = Long.valueOf(id.toString()).longValue();
        } catch (NumberFormatException e) {
            return null;
        }
    }
    return getVertex(longId);
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:22,代码来源:TitanBlueprintsTransaction.java


示例2: addEdge

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
public CachedChronoEdge addEdge(final Long outVertexIdx, final Long inVertexIdx, final Long labelIdx) {
	if (labelIdx == null)
		throw ExceptionFactory.edgeLabelCanNotBeNull();

	CachedEdgeID edgeID = new CachedEdgeID(outVertexIdx, labelIdx, inVertexIdx);
	CachedChronoEdge edge = this.edges.get(edgeID);
	if (edge == null) {
		CachedChronoVertex out = getChronoVertex(outVertexIdx);
		CachedChronoVertex in = getChronoVertex(inVertexIdx);
		edge = new CachedChronoEdge(out, in, labelIdx, this);
		this.edges.put(edgeID, edge);
		out.addOutEdge(labelIdx, in);
		in.addInEdge(labelIdx, out);
	}
	return edge;
}
 
开发者ID:JaewookByun,项目名称:epcis,代码行数:17,代码来源:CachedChronoGraph.java


示例3: addVertex

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
@Override
public Vertex addVertex(Object id) {
  if (id == null) {
    id = AccumuloGraphUtils.generateId();
  }

  String idStr = id.toString();

  Vertex vert = null;
  if (!globals.getConfig().getSkipExistenceChecks()) {
    vert = getVertex(idStr);
    if (vert != null) {
      throw ExceptionFactory.vertexWithIdAlreadyExists(idStr);
    }
  }

  vert = new AccumuloVertex(globals, idStr);

  globals.getVertexWrapper().writeVertex(vert);
  globals.checkedFlush();

  globals.getCaches().cache(vert, Vertex.class);

  return vert;
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:26,代码来源:AccumuloGraph.java


示例4: createIndex

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public <T extends Element> Index<T> createIndex(String indexName,
    Class<T> indexClass, Parameter... indexParameters) {
  if (indexClass == null) {
    throw ExceptionFactory.classForElementCannotBeNull();
  }
  else if (globals.getConfig().getIndexableGraphDisabled()) {
    throw new UnsupportedOperationException("IndexableGraph is disabled via the configuration");
  }

  for (Index<?> index : globals.getIndexMetadataWrapper().getIndices()) {
    if (index.getIndexName().equals(indexName)) {
      throw ExceptionFactory.indexAlreadyExists(indexName);
    }
  }

  return globals.getIndexMetadataWrapper().createIndex(indexName, indexClass);
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:20,代码来源:AccumuloGraph.java


示例5: createKeyIndex

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public <T extends Element> void createKeyIndex(String key,
    Class<T> elementClass, Parameter... indexParameters) {
  // TODO Move below to somewhere appropriate.
  if (elementClass == null) {
    throw ExceptionFactory.classForElementCannotBeNull();
  }

  // Add key to indexed keys list.
  globals.getIndexMetadataWrapper().writeKeyMetadataEntry(key, elementClass);
  globals.checkedFlush();

  // Reindex graph.
  globals.getKeyIndexTableWrapper(elementClass).rebuildIndex(key, elementClass);
  globals.getVertexKeyIndexWrapper().dump();
  globals.checkedFlush();
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:19,代码来源:AccumuloGraph.java


示例6: addEdge

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
/**
 * Add an edge as with {@link #addEdge(String, Vertex)},
 * but with a specified edge id.
 * @param id
 * @param label
 * @param inVertex
 * @return
 */
public Edge addEdge(Object id, String label, Vertex inVertex) {
  if (label == null) {
    throw ExceptionFactory.edgeLabelCanNotBeNull();
  }
  if (id == null) {
    id = AccumuloGraphUtils.generateId();
  }

  String myID = id.toString();

  AccumuloEdge edge = new AccumuloEdge(globals, myID, inVertex, this, label);

  // TODO we arent suppose to make sure the given edge ID doesn't already
  // exist?

  globals.getEdgeWrapper().writeEdge(edge);
  globals.getVertexWrapper().writeEdgeEndpoints(edge);

  globals.checkedFlush();

  globals.getCaches().cache(edge, Edge.class);

  return edge;
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:33,代码来源:AccumuloVertex.java


示例7: getIndexedKeys

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
public <T extends Element> Set<String> getIndexedKeys(Class<T> elementClass) {
  if (elementClass == null) {
    throw ExceptionFactory.classForElementCannotBeNull();
  }

  IndexedItemsListParser parser = new IndexedItemsListParser(elementClass);

  Scanner scan = null;
  try {
    scan = getScanner();
    scan.fetchColumnFamily(new Text(IndexMetadataEntryType.__INDEX_KEY__.name()));

    Set<String> keys = new HashSet<String>();
    for (IndexedItem item : parser.parse(scan)) {
      keys.add(item.getKey());
    }

    return keys;

  } finally {
    if (scan != null) {
      scan.close();
    }
  }
}
 
开发者ID:JHUAPL,项目名称:AccumuloGraph,代码行数:26,代码来源:IndexMetadataTableWrapper.java


示例8: addVertex

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
public Vertex addVertex(final Object id, String type, final Object... properties) {
    if (id == null) throw ExceptionFactory.vertexIdCanNotBeNull();
    if (retrieveFromCache(id) != null) throw ExceptionFactory.vertexWithIdAlreadyExists(id);
    nextElement();

    Vertex v = baseGraph.addVertexWithLabel(type);
    if (vertexIdKey != null) {
        v.setProperty(vertexIdKey, id);
    }
    cache.set(v, id);
    final BatchVertex newVertex = new BatchVertex(id);

    setProperties(newVertex, properties);

    return newVertex;
}
 
开发者ID:ldbc,项目名称:ldbc_snb_implementations,代码行数:17,代码来源:TypedBatchGraph.java


示例9: addEdge

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
@Override
public Edge addEdge(Object id, Vertex outVertex, Vertex inVertex, String label) {
    if (label == null)
        throw ExceptionFactory.edgeLabelCanNotBeNull();

    TitanikVertex titanikOutVertex = (TitanikVertex) outVertex;
    TitanikVertex titanikInVertex = (TitanikVertex) inVertex;

    TitanikEdge outEdge = titanikOutVertex.getOutEdge(label, titanikInVertex.getId());
    if (outEdge == null) {
        NewTitanikEdge edge = new NewTitanikEdge(this, titanikOutVertex, titanikInVertex, label);
        titanikOutVertex.addOutEdge(edge);
        titanikInVertex.addInEdge(edge);
        return edge;
    } else {
        return outEdge;
    }
}
 
开发者ID:dsiegel,项目名称:BlueprintsExperiment,代码行数:19,代码来源:TitanikTransactionalGraph.java


示例10: getIndexedKeys

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
public <T extends Element> Set<String> getIndexedKeys(final Class<T> elementClass) {
    if (elementClass == null)
        throw ExceptionFactory.classForElementCannotBeNull();

    boolean v = isVertexClass(elementClass);
    boolean supported = ((v && supportVertexIds) || (!v && supportEdgeIds));

    if (supported) {
        Set<String> keys = new HashSet<String>();
        keys.addAll(baseGraph.getIndexedKeys(elementClass));
        keys.remove(ID);
        return keys;
    } else {
        return baseGraph.getIndexedKeys(elementClass);
    }
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:17,代码来源:IdGraph.java


示例11: create

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
static ArangoDBEdge create(ArangoDBGraph graph, Object id, Vertex outVertex, Vertex inVertex, String label) {
	String key = (id != null) ? id.toString() : null;

	if (outVertex instanceof ArangoDBVertex && inVertex instanceof ArangoDBVertex) {
		ArangoDBVertex from = (ArangoDBVertex) outVertex;
		ArangoDBVertex to = (ArangoDBVertex) inVertex;

		try {
			ArangoDBSimpleEdge v = graph.getClient().createEdge(graph.getRawGraph(), key, label,
				from.getRawVertex(), to.getRawVertex(), null);
			return build(graph, v, outVertex, inVertex);
		} catch (ArangoDBException e) {
			if (e.errorNumber() == 1210) {
				throw ExceptionFactory.vertexWithIdAlreadyExists(id);
			}

			logger.debug("error while creating an edge", e);

			throw new IllegalArgumentException(e.getMessage());
		}
	}
	throw new IllegalArgumentException("Wrong vertex class.");

}
 
开发者ID:arangodb,项目名称:blueprints-arangodb-graph,代码行数:25,代码来源:ArangoDBEdge.java


示例12: load

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
static ArangoDBEdge load(ArangoDBGraph graph, Object id) {
	if (id == null) {
		throw ExceptionFactory.edgeIdCanNotBeNull();
	}

	String key = id.toString();

	try {
		ArangoDBSimpleEdge v = graph.getClient().getEdge(graph.getRawGraph(), key);
		return build(graph, v, null, null);
	} catch (ArangoDBException e) {
		// do nothing
		logger.debug("error while reading an edge", e);

		return null;
	}
}
 
开发者ID:arangodb,项目名称:blueprints-arangodb-graph,代码行数:18,代码来源:ArangoDBEdge.java


示例13: create

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
/**
 * Creates a vertex
 * 
 * @param graph
 *            a ArangoDBGraph
 * @param id
 *            the id (key) of the vertex (can be null)
 * 
 * @throws IllegalArgumentException
 */

static ArangoDBVertex create(ArangoDBGraph graph, Object id) {
	String key = (id != null) ? id.toString() : null;

	try {
		ArangoDBSimpleVertex v = graph.getClient().createVertex(graph.getRawGraph(), key, null);
		return build(graph, v);
	} catch (ArangoDBException e) {
		if (e.errorNumber() == 1210) {
			throw ExceptionFactory.vertexWithIdAlreadyExists(id);
		}
		logger.debug("could not create vertex", e);
		throw new IllegalArgumentException(e.getMessage());
	}
}
 
开发者ID:arangodb,项目名称:blueprints-arangodb-graph,代码行数:26,代码来源:ArangoDBVertex.java


示例14: load

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
/**
 * Creates a vertex by loading it
 * 
 * @param graph
 *            a ArangoDBGraph
 * @param id
 *            the id (key) of the vertex (can be null)
 * 
 * @throws IllegalArgumentException
 */

static ArangoDBVertex load(ArangoDBGraph graph, Object id) {
	if (id == null) {
		throw ExceptionFactory.vertexIdCanNotBeNull();
	}

	String key = id.toString();

	try {
		ArangoDBSimpleVertex v = graph.getClient().getVertex(graph.getRawGraph(), key);
		return build(graph, v);
	} catch (ArangoDBException e) {
		// nothing found
		logger.debug("graph not found", e);
		return null;
	}
}
 
开发者ID:arangodb,项目名称:blueprints-arangodb-graph,代码行数:28,代码来源:ArangoDBVertex.java


示例15: setProperty

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
@Override
public void setProperty(String key, Object value) {
	if (created) {
		throw new UnsupportedOperationException();
	}

	if (isEmptyString(key))
		throw ExceptionFactory.propertyKeyCanNotBeEmpty();
	if (key.equals(StringFactory.ID))
		throw ExceptionFactory.propertyKeyIdIsReserved();

	try {
		document.setProperty(ArangoDBUtil.normalizeKey(key), value);
	} catch (ArangoDBException e) {
		logger.warn("could not set property", e);
		throw new IllegalArgumentException(e.getMessage());
	}
}
 
开发者ID:arangodb,项目名称:blueprints-arangodb-graph,代码行数:19,代码来源:ArangoDBBatchElement.java


示例16: load

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
/**
 * Creates a vertex by loading it
 * 
 * @param graph
 *            a ArangoDBGraph
 * @param id
 *            the id (key) of the vertex (can be null)
 */

static ArangoDBBatchVertex load(ArangoDBBatchGraph graph, Object id) {
	if (id == null) {
		throw ExceptionFactory.vertexIdCanNotBeNull();
	}

	String key = id.toString();

	ArangoDBBatchVertex vert = graph.vertexCache.get(key);
	if (vert != null) {
		return vert;
	}

	try {
		ArangoDBSimpleVertex v = graph.client.getVertex(graph.getRawGraph(), key);
		return build(graph, v);
	} catch (ArangoDBException e) {
		logger.warn("could read batch vertex", e);
		return null;
	}
}
 
开发者ID:arangodb,项目名称:blueprints-arangodb-graph,代码行数:30,代码来源:ArangoDBBatchVertex.java


示例17: load

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
public static ArangoDBBatchEdge load(ArangoDBBatchGraph graph, Object id) {
	if (id == null) {
		throw ExceptionFactory.edgeIdCanNotBeNull();
	}

	String key = id.toString();

	ArangoDBBatchEdge edge = graph.edgeCache.get(key);
	if (edge != null) {
		return edge;
	}

	try {
		ArangoDBSimpleEdge v = graph.client.getEdge(graph.getRawGraph(), key);
		return build(graph, v, null, null);
	} catch (ArangoDBException e) {
		// do nothing
		logger.warn("could not load batch edge", e);
		return null;
	}
}
 
开发者ID:arangodb,项目名称:blueprints-arangodb-graph,代码行数:22,代码来源:ArangoDBBatchEdge.java


示例18: setProperty

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
@Override
public void setProperty(String key, Object value) {

	if (StringFactory.ID.equals(key)) {
		throw ExceptionFactory.propertyKeyIdIsReserved();
	}

	if (StringFactory.LABEL.equals(key) && this instanceof Edge) {
		throw ExceptionFactory.propertyKeyLabelIsReservedForEdges();
	}

	if (StringUtils.isBlank(key)) {
		throw ExceptionFactory.propertyKeyCanNotBeEmpty();
	}

	try {
		document.setProperty(ArangoDBUtil.normalizeKey(key), value);
		save();
	} catch (ArangoDBException e) {
		logger.debug("error while setting a property", e);
		throw new IllegalArgumentException(e.getMessage());
	}
}
 
开发者ID:arangodb,项目名称:blueprints-arangodb-graph,代码行数:24,代码来源:ArangoDBElement.java


示例19: removeProperty

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public <T> T removeProperty(String key) {

	if (StringUtils.isBlank(key)) {
		throw ExceptionFactory.propertyKeyCanNotBeEmpty();
	}

	if (key.equals(StringFactory.LABEL) && this instanceof Edge) {
		throw ExceptionFactory.propertyKeyLabelIsReservedForEdges();
	}

	T o = null;
	try {
		o = (T) document.removeProperty(ArangoDBUtil.normalizeKey(key));
		save();

	} catch (ArangoDBException e) {
		logger.debug("error while removing a property", e);
		throw new IllegalArgumentException(e.getMessage());
	}
	return o;
}
 
开发者ID:arangodb,项目名称:blueprints-arangodb-graph,代码行数:24,代码来源:ArangoDBElement.java


示例20: setup

import com.tinkerpop.blueprints.util.ExceptionFactory; //导入依赖的package包/类
@Override
public void setup(final Mapper.Context context) throws IOException, InterruptedException {
    faunusConf = ModifiableHadoopConfiguration.of(DEFAULT_COMPAT.getContextConfiguration(context));
    direction = faunusConf.getEdgeCopyDirection();
    if (direction.equals(Direction.BOTH))
        throw new InterruptedException(ExceptionFactory.bothIsNotSupported().getMessage());
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:8,代码来源:EdgeCopyMapReduce.java



注:本文中的com.tinkerpop.blueprints.util.ExceptionFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EmptyIteration类代码示例发布时间:2022-05-23
下一篇:
Java BasicGraphUI类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap