info.magnolia.objectfactory.Components.getComponent()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(133)

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

Components.getComponent介绍

[英]Returns a component from the currently set ComponentProvider. Consider using IoC to inject the component instead.
[中]从当前设置的ComponentProvider返回组件。考虑使用IOC来注入组件。

代码示例

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * Gets the current singleton instance.
 */
public static LinkTransformerManager getInstance() {
  return Components.getComponent(LinkTransformerManager.class);
}

代码示例来源:origin: info.magnolia/magnolia-core

@Override
  protected ServerConfiguration transformNode(Node node) throws Node2BeanException, RepositoryException {
    return (ServerConfiguration) Components.getComponent(Node2BeanProcessor.class).toBean(node, false, new Node2BeanTransformerImpl() {
      @Override
      public Object newBeanInstance(TransformationState state, Map properties, ComponentProvider componentProvider) {
        return new ServerConfiguration();
      }
    }, Components.getComponentProvider());
  }
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * @deprecated since 5.5.5, use {@link #AggregatorFilter(Provider, VersionManager, NodeNameHelper)} instead.
 */
@Deprecated
public AggregatorFilter() {
  this(() -> Components.getComponent(WebContext.class), Components.getComponent(VersionManager.class), Components.getComponent(NodeNameHelper.class));
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * @deprecated since 5.5.1 - use {@link #DefaultMessagesManager(info.magnolia.jcr.node2bean.Node2BeanProcessor, info.magnolia.context.SystemContext)} instead.
 */
@Deprecated
public DefaultMessagesManager() {
  this(Components.getComponent(Node2BeanProcessor.class), Components.getComponent(SystemContext.class));
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * @deprecated since 5.5.1 - use {@link #DefaultMessagesManager(info.magnolia.jcr.node2bean.Node2BeanProcessor, info.magnolia.context.SystemContext)} instead.
 */
@Deprecated
public DefaultMessagesManager(Node2BeanProcessor nodeToBean) {
  this(nodeToBean, Components.getComponent(SystemContext.class));
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * @deprecated since 5.5.3, use {@link #RepositoryBackedSecurityManager(NodeNameHelper)} instead.
 */
@Deprecated
public RepositoryBackedSecurityManager() {
  this(Components.getComponent(NodeNameHelper.class));
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * @deprecated since 5.6, use {@link #CoreModuleVersionHandler(RepositoryManager, NodeNameHelper)} instead.
 */
@Deprecated
public CoreModuleVersionHandler(RepositoryManager repositoryManager) {
  this(repositoryManager, Components.getComponent(NodeNameHelper.class));
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * @deprecated since 5.5.3, use {@link #MultipartRequestFilter(FileSystemHelper)} instead.
 */
@Deprecated
public MultipartRequestFilter() {
  this(Components.getComponent(FileSystemHelper.class));
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * @deprecated since 5.4.4, use {@link #VersionCommand(VersionManager)}.
 */
@Deprecated
public VersionCommand() {
  this.versionManager = Components.getComponent(VersionManager.class);
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * @return singleton instance of the <code>SystemContext</code>.
 * @deprecated since 4.5, use IoC, i.e., declare a dependency on SystemContext in your component.
 */
@Deprecated
public SystemContext getSystemContext() {
  return Components.getComponent(SystemContext.class);
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * Checks if a workspace has been initialized.
 *
 * @throws RuntimeException if the workspace doesn't exist or has not yet been loaded
 * @deprecated since 4.5 - use {@link info.magnolia.repository.RepositoryManager#checkIfInitialized(String)} directly.
 */
public static boolean checkIfInitialized(String logicalWorkspaceName) throws RepositoryException, AccessDeniedException {
  return Components.getComponent(RepositoryManager.class).checkIfInitialized(logicalWorkspaceName);
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * @deprecated since 5.5.3, use {@link NodeNameHelper#getValidatedName(String, String)}
 */
public static String getValidatedLabel(String label, String charset) {
  return Components.getComponent(NodeNameHelper.class).getValidatedName(label, charset);
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * @deprecated since 5.5.3, use {@link FileSystemHelper#getTempDirectory()} and {@link java.io.File#getAbsolutePath()} instead.
 */
public static String getTempDirectoryPath() {
  return Components.getComponent(FileSystemHelper.class).getTempDirectory().getAbsolutePath();
}

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * Returns the name of the repository for a logical workspace name.
 *
 * @returns the repository name or if the logical name doesn't exist it is returned
 * @deprecated since 4.5 - use {@link info.magnolia.repository.RepositoryManager#getWorkspaceMapping(String)}.
 */
public static String getMappedRepositoryName(String logicalWorkspaceName) {
  RepositoryManager repositoryManager = Components.getComponent(RepositoryManager.class);
  WorkspaceMappingDefinition mapping = repositoryManager.getWorkspaceMapping(logicalWorkspaceName);
  return mapping != null ? mapping.getRepositoryName() : logicalWorkspaceName;
}

代码示例来源:origin: info.magnolia/magnolia-core

@SuppressWarnings("unchecked")
  protected T transformNode(Node node) throws Node2BeanException, RepositoryException {
    return (T) Components.getComponent(Node2BeanProcessor.class).toBean(node, true, new Node2BeanTransformerImpl(), componentProvider);
  }
}

代码示例来源:origin: info.magnolia/magnolia-core

@Override
  protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException {
    if (!Components.getComponent(RepositoryManager.class).checkIfInitialized(workspace)) {
      final String[] bootstrapDirs = Bootstrapper.getBootstrapDirs();
      Bootstrapper.bootstrapRepository(bootstrapDirs, workspace, filename -> filename.startsWith(workspace + "."));
    }
  }
}

代码示例来源:origin: info.magnolia/magnolia-core

@Test
public void testCreatedVersionIsWrapped() throws Exception {
  // GIVEN
  Session session = MgnlContext.getJCRSession(RepositoryConstants.WEBSITE);
  VersionManager versionMan = Components.getComponent(VersionManager.class);
  Node node = session.getRootNode().addNode( "page", NodeTypes.Page.NAME);
  session.save();
  // WHEN
  Version version = versionMan.addVersion(node);
  // THEN
  assertTrue(version instanceof ContentDecoratorVersionWrapper);
}

代码示例来源:origin: info.magnolia/magnolia-core

@Override
@Before
public void setUp() throws Exception {
  super.setUp();
  UserContext ctx = mock(UserContext.class);
  RepositoryManager repositoryManager = Components.getComponent(RepositoryManager.class);
  strategy = new DefaultRepositoryStrategy(repositoryManager, ctx);
}

代码示例来源:origin: info.magnolia/magnolia-core

@Override
@Before
public void setUp() throws Exception {
  // We require an instance of DefaultRepositoryManager with custom magnolia configuration properties
  setRepositoryConfigFileName("/test-cluster-repositories.xml");
  super.setUp();
  defaultRepositoryManager = (DefaultRepositoryManager) Components.getComponent(RepositoryManager.class);
}

代码示例来源:origin: info.magnolia/magnolia-core

@Test
public void testConfiguredImplementation() {
  ComponentsTestUtil.setImplementation(TestInterface.class, TestImplementation.class);
  Object obj = Components.getComponent(TestInterface.class);
  assertTrue(obj instanceof TestImplementation);
}

相关文章