org.apache.catalina.Container.setRealm()方法的使用及代码示例

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

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

Container.setRealm介绍

[英]Set the Realm with which this Container is associated.
[中]设置与此容器关联的领域。

代码示例

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Remove an existing Realm.
 *
 * @param name MBean Name of the component to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeRealm(String name) throws Exception {
  ObjectName oname = new ObjectName(name);
  // Acquire a reference to the component to be removed
  Container container = getParentContainerFromChild(oname);
  container.setRealm(null);
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Remove an existing Realm.
 *
 * @param name MBean Name of the component to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeRealm(String name) throws Exception {
  ObjectName oname = new ObjectName(name);
  // Acquire a reference to the component to be removed
  Container container = getParentContainerFromChild(oname);
  container.setRealm(null);
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Remove an existing Realm.
 *
 * @param name MBean Name of the component to remove
 *
 * @exception Exception if a component cannot be removed
 */
public void removeRealm(String name) throws Exception {
  ObjectName oname = new ObjectName(name);
  // Acquire a reference to the component to be removed
  Container container = getParentContainerFromChild(oname);
  container.setRealm(null);
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

private String addRealmToParent(String parent, Realm realm) throws Exception {
  ObjectName pname = new ObjectName(parent);
  Container container = getParentContainerFromParent(pname);
  // Add the new instance to its parent component
  container.setRealm(realm);
  // Return the corresponding MBean name
  ObjectName oname = null;
  if (realm instanceof JmxEnabled) {
    oname = ((JmxEnabled) realm).getObjectName();
  }
  if (oname != null) {
    return oname.toString();
  } else {
    return null;
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

private String addRealmToParent(String parent, Realm realm) throws Exception {
  ObjectName pname = new ObjectName(parent);
  Container container = getParentContainerFromParent(pname);
  // Add the new instance to its parent component
  container.setRealm(realm);
  // Return the corresponding MBean name
  ObjectName oname = null;
  if (realm instanceof JmxEnabled) {
    oname = ((JmxEnabled) realm).getObjectName();
  }
  if (oname != null) {
    return oname.toString();
  } else {
    return null;
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Create a new JNDI Realm.
 *
 * @param parent MBean Name of the associated parent component
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createJNDIRealm(String parent)
  throws Exception {
   // Create a new JNDIRealm instance
  JNDIRealm realm = new JNDIRealm();
  // Add the new instance to its parent component
  ObjectName pname = new ObjectName(parent);
  Container container = getParentContainerFromParent(pname);
  // Add the new instance to its parent component
  container.setRealm(realm);
  // Return the corresponding MBean name
  ObjectName oname = realm.getObjectName();
  if (oname != null) {
    return (oname.toString());
  } else {
    return null;
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Create a new Memory Realm.
 *
 * @param parent MBean Name of the associated parent component
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createMemoryRealm(String parent)
  throws Exception {
   // Create a new MemoryRealm instance
  MemoryRealm realm = new MemoryRealm();
  // Add the new instance to its parent component
  ObjectName pname = new ObjectName(parent);
  Container container = getParentContainerFromParent(pname);
  // Add the new instance to its parent component
  container.setRealm(realm);
  // Return the corresponding MBean name
  ObjectName oname = realm.getObjectName();
  if (oname != null) {
    return (oname.toString());
  } else {
    return null;
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Create a new  UserDatabaseRealm.
 *
 * @param parent MBean Name of the associated parent component
 * @param resourceName Global JNDI resource name of the associated
 *  UserDatabase
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createUserDatabaseRealm(String parent, String resourceName)
  throws Exception {
   // Create a new UserDatabaseRealm instance
  UserDatabaseRealm realm = new UserDatabaseRealm();
  realm.setResourceName(resourceName);
  // Add the new instance to its parent component
  ObjectName pname = new ObjectName(parent);
  Container container = getParentContainerFromParent(pname);
  // Add the new instance to its parent component
  container.setRealm(realm);
  // Return the corresponding MBean name
  ObjectName oname = realm.getObjectName();
  // FIXME getObjectName() returns null
  //ObjectName oname =
  //    MBeanUtils.createObjectName(pname.getDomain(), realm);
  if (oname != null) {
    return (oname.toString());
  } else {
    return null;
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Create a new JDBC Realm.
 *
 * @param parent MBean Name of the associated parent component
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createJDBCRealm(String parent, String driverName,
  String connectionName, String connectionPassword, String connectionURL)
  throws Exception {
  // Create a new JDBCRealm instance
  JDBCRealm realm = new JDBCRealm();
  realm.setDriverName(driverName);
  realm.setConnectionName(connectionName);
  realm.setConnectionPassword(connectionPassword);
  realm.setConnectionURL(connectionURL);
  // Add the new instance to its parent component
  ObjectName pname = new ObjectName(parent);
  Container container = getParentContainerFromParent(pname);
  // Add the new instance to its parent component
  container.setRealm(realm);
  // Return the corresponding MBean name
  ObjectName oname = realm.getObjectName();
  if (oname != null) {
    return (oname.toString());
  } else {
    return null;
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

Container container = getParentContainerFromParent(pname);
container.setRealm(realm);

相关文章

微信公众号

最新文章

更多