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


Java NodeId类代码示例

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


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

示例1: createParams

import org.apache.jackrabbit.core.id.NodeId; //导入依赖的package包/类
/**
 * Creates a parameter array for an SQL statement that needs
 * (i) a node identifier, and (2) another parameter.
 *
 * @param id the node id
 * @param p the other parameter
 * @param before whether the other parameter should be before the uuid parameter
 * @return an Object array that represents the parameters
 */
protected Object[] createParams(NodeId id, Object p, boolean before) {

    // Create the key
    List<Object> key = new ArrayList<Object>();
    if (getStorageModel() == SM_BINARY_KEYS) {
        key.add(id.getRawBytes());
    } else {
        key.add(id.getMostSignificantBits());
        key.add(id.getLeastSignificantBits());
    }

    // Create the parameters
    List<Object> params = new ArrayList<Object>();
    if (before) {
        params.add(p);
        params.addAll(key);
    } else {
        params.addAll(key);
        params.add(p);
    }

    return params.toArray();
}
 
开发者ID:youseries,项目名称:urule,代码行数:33,代码来源:DbPersistenceManager.java

示例2: loadBundle

import org.apache.jackrabbit.core.id.NodeId; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected NodePropBundle loadBundle(NodeId id) throws ItemStateException {
    try {
        ResultSet rs =
            conHelper.exec(bundleSelectSQL, getKey(id), false, 0);
        try {
            if (rs != null && rs.next()) {
                return readBundle(id, rs, 1);
            } else {
                return null;
            }
        } finally {
        	if (rs != null) {
        		rs.close();
        	}
        }
    } catch (SQLException e) {
    	String msg = "failed to read bundle (stacktrace on DEBUG log level): " + id + ": " + e; 
        log.error(msg);
        log.debug("failed to read bundle: " + id, e);
        throw new ItemStateException(msg, e);
    }
}
 
开发者ID:youseries,项目名称:urule,代码行数:27,代码来源:DbPersistenceManager.java

示例3: readBundle

import org.apache.jackrabbit.core.id.NodeId; //导入依赖的package包/类
/**
 * Reads and parses a bundle from the BLOB in the given column of the
 * current row of the given result set. This is a helper method to
 * circumvent issues JCR-1039 and JCR-1474.
 *
 * @param id bundle identifier
 * @param rs result set
 * @param column BLOB column
 * @return parsed bundle
 * @throws SQLException if the bundle can not be read or parsed
 */
private NodePropBundle readBundle(NodeId id, ResultSet rs, int column)
        throws SQLException {
    try {
        InputStream in;
        if (rs.getMetaData().getColumnType(column) == Types.BLOB) {
            in = rs.getBlob(column).getBinaryStream();
        } else {
            in = rs.getBinaryStream(column);
        }
        try {
            return binding.readBundle(in, id);
        } finally {
            in.close();
        }
    } catch (IOException e) {
        SQLException exception =
            new SQLException("Failed to parse bundle " + id);
        exception.initCause(e);
        throw exception;
    }
}
 
开发者ID:youseries,项目名称:urule,代码行数:33,代码来源:DbPersistenceManager.java

示例4: existsReferencesTo

import org.apache.jackrabbit.core.id.NodeId; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public synchronized boolean existsReferencesTo(NodeId targetId) throws ItemStateException {
    if (!initialized) {
        throw new IllegalStateException("not initialized");
    }

    ResultSet rs = null;
    try {
        rs = conHelper.exec(nodeReferenceSelectSQL, getKey(targetId), false, 0);

        // a reference exists if the result has at least one entry
        return rs.next();
    } catch (Exception e) {
        String msg = "failed to check existence of node references: "
            + targetId;
        log.error(msg, e);
        throw new ItemStateException(msg, e);
    } finally {
        DbUtility.close(rs);
    }
}
 
开发者ID:youseries,项目名称:urule,代码行数:24,代码来源:DbPersistenceManager.java

示例5: checkChildren

import org.apache.jackrabbit.core.id.NodeId; //导入依赖的package包/类
private void checkChildren(PersistenceManager pm, NodeState parentState, ChangeLog changeLog, Set<NodeId> allNodeIds, int nodeCount) throws ItemStateException {
    if (!parentState.isNode()) {
        return;
    }
    final String path = getPath(pm, parentState);
    final long nodesProcessed = processedNodeCounter.getAndIncrement();
    if (nodesProcessed % 10000 == 0 && nodesProcessed != 0) {
        long timeTaken = System.currentTimeMillis() - startTime;
        final long perNode = timeTaken / (nodesProcessed / 1000);
        LOG.info("processed {} nodes {} ({}) ({}ms/1k nodes, {}%)", nodesProcessed, path, parentState.getNodeId(), perNode, 100 * nodesProcessed / nodeCount);
    }

    allNodeIds.remove(parentState.getNodeId());

    for (final NodeState childNodeState : getChildNodeStates(pm, parentState)) {
        final String childPath = getPath(pm, childNodeState);
        assertParent(pm, parentState, childNodeState, changeLog, childPath);
        checkChildren(pm, childNodeState, changeLog, allNodeIds, nodeCount);
    }
}
 
开发者ID:code-distillery,项目名称:jackrabbit-pm-tools,代码行数:21,代码来源:ConsistencyCheck.java

示例6: getRwRoIdsFromPermissions

import org.apache.jackrabbit.core.id.NodeId; //导入依赖的package包/类
private List<NodeId> getRwRoIdsFromPermissions() {
    List<NodeId> result = Lists.newArrayList();
    Subject subject = ctx.getSubject();
    Set<Principal> p = subject.getPrincipals();
    for(Principal principal : p) {
        for(Map.Entry<PermissionKey, Permission> me : PermissionStore.getInstance().getPermissions().entrySet()) {
            PermissionKey key = me.getKey();
            if(!key.getWorkspace().equals(ctx.getWorkspaceName())) {
                continue;
            }
            if(!key.getPrincipal().equals(principal.getName())) {
                continue;
            }
            Permission permission = me.getValue();
            if(!(Permission.RO.equals(permission) || Permission.RW.equals(permission))) {
                continue;
            }
            NodeId id = new NodeId(key.getId());
            if(nodeExists(id)) {
                result.add(id);
            }
        }
    }
    return result;
}
 
开发者ID:uq-eresearch,项目名称:aorra,代码行数:26,代码来源:AorraAccessManager.java

示例7: getWatchUsers

import org.apache.jackrabbit.core.id.NodeId; //导入依赖的package包/类
private Iterable<User> getWatchUsers(Session session, String nodeId, Event event) {
  final Set<User> users = Sets.newHashSet();
  FlagStore.Manager manager = flagStore.getManager(session);
  for (Flag flag : manager.getFlags(FlagStore.FlagType.WATCH)) {
    // filter out user who triggered the event,  issue #144
    if(isEventOwner(flag.getUser(), event)) {
      continue;
    }
    if (flag.getTargetId().equals(nodeId)) {
      users.add(flag.getUser());
    } else {
      try {
        if (((SessionImpl) session).getHierarchyManager().isAncestor(
            new NodeId(flag.getTargetId()), new NodeId(nodeId))) {
          users.add(flag.getUser());
        }
      } catch (RepositoryException e) {
        // Dump trace and ignore
        Logger.trace(String.format("couldn't determine if %s is ancestor of %s",
            flag.getTargetId(), nodeId), e);
      }
    }
  }
  return users;
}
 
开发者ID:uq-eresearch,项目名称:aorra,代码行数:26,代码来源:NotifierImpl.java

示例8: getKey

import org.apache.jackrabbit.core.id.NodeId; //导入依赖的package包/类
/**
 * Constructs a parameter list for a PreparedStatement
 * for the given node identifier.
 *
 * @param id the node id
 * @return a list of Objects
 */
protected Object[] getKey(NodeId id) {
    if (getStorageModel() == SM_BINARY_KEYS) {
        return new Object[] { id.getRawBytes() };
    } else {
        return new Object[] {
                id.getMostSignificantBits(), id.getLeastSignificantBits() };
    }
}
 
开发者ID:youseries,项目名称:urule,代码行数:16,代码来源:DbPersistenceManager.java

示例9: loadReferencesTo

import org.apache.jackrabbit.core.id.NodeId; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public synchronized NodeReferences loadReferencesTo(NodeId targetId)
        throws NoSuchItemStateException, ItemStateException {
    if (!initialized) {
        throw new IllegalStateException("not initialized");
    }

    ResultSet rs = null;
    InputStream in = null;
    try {
        rs = conHelper.exec(nodeReferenceSelectSQL, getKey(targetId), false, 0);
        if (!rs.next()) {
            throw new NoSuchItemStateException(targetId.toString());
        }

        in = rs.getBinaryStream(1);
        NodeReferences refs = new NodeReferences(targetId);
        Serializer.deserialize(refs, in);

        return refs;
    } catch (Exception e) {
        if (e instanceof NoSuchItemStateException) {
            throw (NoSuchItemStateException) e;
        }
        String msg = "failed to read references: " + targetId;
        log.error(msg, e);
        throw new ItemStateException(msg, e);
    } finally {
        IOUtils.closeQuietly(in);
        DbUtility.close(rs);
    }
}
 
开发者ID:youseries,项目名称:urule,代码行数:35,代码来源:DbPersistenceManager.java

示例10: loadNodeState

import org.apache.jackrabbit.core.id.NodeId; //导入依赖的package包/类
protected static NodeState loadNodeState(PersistenceManager pm, NodeId nodeId) {
    if (nodeId == null) {
        return null;
    }

    try {
        return pm.load(nodeId);
    } catch (ItemStateException e) {
        LOG.warn("error loading node ID {}", nodeId);
    }
    return null;
}
 
开发者ID:code-distillery,项目名称:jackrabbit-pm-tools,代码行数:13,代码来源:AbstractCommand.java

示例11: getAllNodeIds

import org.apache.jackrabbit.core.id.NodeId; //导入依赖的package包/类
private Set<NodeId> getAllNodeIds(PersistenceManager pm) throws RepositoryException, ItemStateException {
    if (pm instanceof IterablePersistenceManager) {
        final IterablePersistenceManager ipm = (IterablePersistenceManager) pm;
        return Sets.newHashSet(ipm.getAllNodeIds(null, 0));
    }
    return Sets.newHashSet();
}
 
开发者ID:code-distillery,项目名称:jackrabbit-pm-tools,代码行数:8,代码来源:ConsistencyCheck.java

示例12: getPMContext

import org.apache.jackrabbit.core.id.NodeId; //导入依赖的package包/类
private static PMContext getPMContext(PersistenceManager pm, File home, FileSystem fs, NamespaceRegistry nr, NodeId rootId)
        throws RepositoryException {
    if (pm instanceof TarPersistenceManager) {
        return new CRXPMContext(home, fs, rootId, nr, null, null, null, true, false, false);
    } else {
        return new PMContext(home, fs, rootId, nr, null, null);
    }
}
 
开发者ID:code-distillery,项目名称:jackrabbit-pm-tools,代码行数:9,代码来源:PMExecutionContext.java

示例13: load

import org.apache.jackrabbit.core.id.NodeId; //导入依赖的package包/类
@Override
public NodeState load(NodeId id) throws NoSuchItemStateException, ItemStateException {
    final int a = accesses.incrementAndGet();
    if (!cache.containsKey(id)) {
        misses.incrementAndGet();
        cache.put(id, persistenceManager.load(id));
    }
    if (a % 10000000 == 0) {
        LOG.info(getHitMissRatio());
    }
    return cache.get(id);
}
 
开发者ID:code-distillery,项目名称:jackrabbit-pm-tools,代码行数:13,代码来源:CachingPersistenceManager.java

示例14: getParentId

import org.apache.jackrabbit.core.id.NodeId; //导入依赖的package包/类
private ItemId getParentId(ItemId id) throws RepositoryException {
    try {
        Path path = ctx.getHierarchyManager().getPath(id);
        Path parent = path.getAncestor(1);
        NodeId parentId = ctx.getHierarchyManager().resolveNodePath(parent);
        return parentId;
    } catch(PathNotFoundException e) {
        return null;
    }
}
 
开发者ID:uq-eresearch,项目名称:aorra,代码行数:11,代码来源:AorraAccessManager.java

示例15: nodeExists

import org.apache.jackrabbit.core.id.NodeId; //导入依赖的package包/类
private boolean nodeExists(NodeId id) {
    try {
        return ctx.getHierarchyManager().getPath(id) != null;
    } catch(Exception e) {
        return false;
    }
}
 
开发者ID:uq-eresearch,项目名称:aorra,代码行数:8,代码来源:AorraAccessManager.java


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