javax.jcr.Repository.getDescriptorValue()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(71)

本文整理了Java中javax.jcr.Repository.getDescriptorValue方法的一些代码示例,展示了Repository.getDescriptorValue的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.getDescriptorValue方法的具体详情如下:
包路径:javax.jcr.Repository
类名称:Repository
方法名:getDescriptorValue

Repository.getDescriptorValue介绍

[英]The value of a single-value descriptor is found by passing the key for that descriptor to this method. If key is the key of a multi-value descriptor or not a valid key this method returns null.
[中]通过将描述符的键传递给此方法,可以找到单个值描述符的值。如果key是多值描述符的键或不是有效键,则此方法返回null

代码示例

代码示例来源:origin: io.wcm/io.wcm.testing.sling-mock

@Override
public Value getDescriptorValue(final String key) {
 return this.delegate.getDescriptorValue(key);
}

代码示例来源:origin: apache/jackrabbit

/**
 * Tests that the required repository descriptors are available.
 */
public void testRequiredDescriptors() {
  Repository rep = session.getRepository();
  for (Iterator<String> it = requiredDescriptorKeys.iterator(); it.hasNext();) {
    String descName = it.next();
    assertTrue(descName + " is a standard descriptor", rep.isStandardDescriptor(descName));
    if (rep.isSingleValueDescriptor(descName)) {
      Value val = rep.getDescriptorValue(descName);
      assertNotNull("Required descriptor is missing: " + descName,
          val);
    } else {
      Value[] vals = rep.getDescriptorValues(descName);
      assertNotNull("Required descriptor is missing: " + descName,
          vals);
    }
  }
}

代码示例来源:origin: ModeShape/modeshape

@Override
public Value getDescriptorValue( String key ) {
  return repository.getDescriptorValue(key);
}

代码示例来源:origin: org.apache.sling/org.apache.sling.commons.testing

public Value getDescriptorValue(String key) {
  return wrapped.getDescriptorValue(key);
}

代码示例来源:origin: net.adamcin.oakpal/oakpal-core

@Override
public Value getDescriptorValue(String key) {
  return delegate.getDescriptorValue(key);
}

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-core

public Value getDescriptorValue(String key) {
  return delegatee.getDescriptorValue(key);
}

代码示例来源:origin: org.onehippo.cms7/hippo-repository-connector

public Value getDescriptorValue(String key) {
  return repository.getDescriptorValue(key);
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

public Value getDescriptorValue(String key) {
  return repository.getDescriptorValue(key);
}

代码示例来源:origin: org.apache.sling/org.apache.sling.jcr.base

@Override
public Value getDescriptorValue(String key) {
  Repository repo = getRepository();
  if (repo != null) {
    return repo.getDescriptorValue(key);
  }
  logger.error("getDescriptorValue: Repository not available");
  return null;
}

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-session-pool

public Value getDescriptorValue(String key) {
  Repository curRepository = getCurrentThreadRepository();
  if (curRepository != null) {
    return curRepository.getDescriptorValue(key);
  }
  return null;
}

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-session-pool

public Value getDescriptorValue(String key) {
  try {
    return getRepository().getDescriptorValue(key);
  } catch (RepositoryException e) {
    log.error("RepositoryException: ",e);
  }
  return null;
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * Returns the value of the descriptor with the given key from the proxied
 * repository. Returns <code>null</code> if the descriptor does not exist
 * or if the proxied repository can not be accessed.
 *
 * @param key descriptor key
 * @return descriptor value, or <code>null</code>
 */
public Value getDescriptorValue(String key) {
  try {
    return getRepository().getDescriptorValue(key);
  } catch (RepositoryException e) {
    return null;
  }
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr-commons

/**
 * Returns the value of the descriptor with the given key from the proxied
 * repository. Returns <code>null</code> if the descriptor does not exist
 * or if the proxied repository can not be accessed.
 *
 * @param key descriptor key
 * @return descriptor value, or <code>null</code>
 */
public Value getDescriptorValue(String key) {
  try {
    return getRepository().getDescriptorValue(key);
  } catch (RepositoryException e) {
    return null;
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * Returns the value of the descriptor with the given key from the proxied
 * repository. Returns <code>null</code> if the descriptor does not exist
 * or if the proxied repository can not be accessed.
 *
 * @param key descriptor key
 * @return descriptor value, or <code>null</code>
 */
public Value getDescriptorValue(String key) {
  try {
    return getRepository().getDescriptorValue(key);
  } catch (RepositoryException e) {
    return null;
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * Returns the value of the descriptor with the given key from the proxied
 * repository. Returns <code>null</code> if the descriptor does not exist
 * or if the proxied repository can not be accessed.
 *
 * @param key descriptor key
 * @return descriptor value, or <code>null</code>
 */
public Value getDescriptorValue(String key) {
  try {
    return factory.getRepository().getDescriptorValue(key);
  } catch (RepositoryException e) {
    return null;
  }
}

代码示例来源:origin: org.onehippo.cms7.hst.components/hst-session-pool

public Value getDescriptorValue(String key) {
  if (jcrDelegateeRepository != null) {
    return jcrDelegateeRepository.getDescriptorValue(key);
  }
  if (hippoRepository != null) {
    ClassLoader currentClassloader = switchToRepositoryClassloader();
    try {
      return hippoRepository.getRepository().getDescriptorValue(key);
    } finally {
      if (currentClassloader != null) {
        Thread.currentThread().setContextClassLoader(currentClassloader);
      }
    }
  }
  return null;
}

代码示例来源:origin: apache/jackrabbit

/** {@inheritDoc} */
public Value getDescriptorValue(String key) throws RemoteException {
  try {
    return SerialValueFactory.makeSerialValue(repository.getDescriptorValue(key));
  } catch (RepositoryException ex) {
     throw new RemoteException(ex.getMessage(), ex);    		
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
protected void setUp() throws Exception {
  super.setUp();
  if (!getHelper().getRepository().getDescriptorValue(Repository.OPTION_NODE_AND_PROPERTY_WITH_SAME_NAME_SUPPORTED).getBoolean()) {
    throw new NotExecutableException("node and property with same name is not supported");
  }
  n = testRootNode.addNode(sameName);
  p = testRootNode.setProperty(sameName, "value");
  superuser.save();
}

代码示例来源:origin: ModeShape/modeshape

@Override
public ContentHandler getImportContentHandler( String parentAbsPath,
                        int uuidBehavior )
  throws PathNotFoundException, ConstraintViolationException, VersionException, LockException, AccessDeniedException,
  RepositoryException {
  CheckArg.isNotNull(parentAbsPath, "parentAbsPath");
  session.checkLive();
  // Create a new session, since we don't want to mess with the current session and because we'll save right
  // when finished reading the document ...
  JcrSession session = this.session.spawnSession(false);
  boolean saveWhenFinished = true;
  // Find the parent path ...
  AbstractJcrNode parent = session.getNode(parentAbsPath);
  if (!parent.isCheckedOut()) {
    throw new VersionException(JcrI18n.nodeIsCheckedIn.text(parent.getPath()));
  }
  Repository repo = getSession().getRepository();
  boolean retainLifecycleInfo = repo.getDescriptorValue(Repository.OPTION_LIFECYCLE_SUPPORTED).getBoolean();
  boolean retainRetentionInfo = repo.getDescriptorValue(Repository.OPTION_RETENTION_SUPPORTED).getBoolean();
  return new JcrContentHandler(session, parent, uuidBehavior, saveWhenFinished, retainRetentionInfo, retainLifecycleInfo, null);
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
  public void testCopyLockedNode() throws Exception {

    assumeTrue(getRepository().getDescriptorValue(Repository.OPTION_LOCKING_SUPPORTED).getBoolean());

    Session session = getAdminSession();
    Node toCopy = session.getNode(TEST_PATH + "/source/node");
    toCopy.addMixin(JcrConstants.MIX_LOCKABLE);
    session.save();

    session.getWorkspace().getLockManager().lock(toCopy.getPath(), true, true, Long.MAX_VALUE, "my");
    assertTrue(toCopy.isLocked());
    assertTrue(toCopy.hasProperty(JcrConstants.JCR_LOCKISDEEP));
    assertTrue(toCopy.hasProperty(JcrConstants.JCR_LOCKOWNER));

    session.getWorkspace().copy(TEST_PATH + "/source/node", TEST_PATH + "/target/copied");
    assertTrue(testNode.hasNode("source/node"));
    assertTrue(testNode.hasNode("target/copied"));

    Node copy = testNode.getNode("target/copied");
    assertTrue(copy.isNodeType(JcrConstants.MIX_LOCKABLE));
    assertFalse(copy.isLocked());
    assertFalse(copy.hasProperty(JcrConstants.JCR_LOCKISDEEP));
    assertFalse(copy.hasProperty(JcrConstants.JCR_LOCKOWNER));
  }
}

相关文章