當前位置: 首頁>>代碼示例>>Java>>正文


Java Container.getParent方法代碼示例

本文整理匯總了Java中org.apache.catalina.Container.getParent方法的典型用法代碼示例。如果您正苦於以下問題:Java Container.getParent方法的具體用法?Java Container.getParent怎麽用?Java Container.getParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.catalina.Container的用法示例。


在下文中一共展示了Container.getParent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getName

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * @return the name for this instance (built from container name)
 */
public String getName() {
    if (name == null) {
        Container container = manager.getContainer();
        String contextName = container.getName();
        if (!contextName.startsWith("/")) {
            contextName = "/" + contextName;
        }
        String hostName = "";
        String engineName = "";

        if (container.getParent() != null) {
            Container host = container.getParent();
            hostName = host.getName();
            if (host.getParent() != null) {
                engineName = host.getParent().getName();
            }
        }
        name = "/" + engineName + "/" + hostName + contextName;
    }
    return name;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:25,代碼來源:JDBCStore.java

示例2: getDomain

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * Determine the name of the domain to register MBeans for from a given
 * Container.
 * 
 * @param container
 *
 * @deprecated  To be removed since to creates a circular dependency. Will
 *              be replaced in Tomcat 8 by a new method on {@link
 *              Container}.
 */
@Deprecated
public static String getDomain(Container container) {
    
    String domain = null;
    
    Container c = container;
    
    while (!(c instanceof Engine) && c != null) {
        c = c.getParent();
    }
    
    if (c != null) {
        domain = c.getName();
    }
    
    return domain;
}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:28,代碼來源:MBeanUtils.java

示例3: getServer

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * Return the Server object that is the ultimate parent for the container
 * with which this Realm is associated. If the server cannot be found (eg
 * because the container hierarchy is not complete), <code>null</code> is
 * returned.
 */
protected Server getServer() {
    Container c = container;
    if (c instanceof Context) {
        c = c.getParent();
    }
    if (c instanceof Host) {
        c = c.getParent();
    }
    if (c instanceof Engine) {
        Service s = ((Engine)c).getService();
        if (s != null) {
            return s.getServer();
        }
    }
    return null;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:23,代碼來源:RealmBase.java

示例4: getDomain

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * Determine the name of the domain to register MBeans for from a given
 * Container.
 * 
 * @param container
 *
 * @deprecated To be removed since to creates a circular dependency. Will be
 *             replaced in Tomcat 8 by a new method on {@link Container}.
 */
@Deprecated
public static String getDomain(Container container) {

	String domain = null;

	Container c = container;

	while (!(c instanceof Engine) && c != null) {
		c = c.getParent();
	}

	if (c != null) {
		domain = c.getName();
	}

	return domain;
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:27,代碼來源:MBeanUtils.java

示例5: startInternal

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {
    
    // Look up the SingleSignOn implementation in our request processing
    // path, if there is one
    Container parent = context.getParent();
    while ((sso == null) && (parent != null)) {
        Valve valves[] = parent.getPipeline().getValves();
        for (int i = 0; i < valves.length; i++) {
            if (valves[i] instanceof SingleSignOn) {
                sso = (SingleSignOn) valves[i];
                break;
            }
        }
        if (sso == null)
            parent = parent.getParent();
    }
    if (log.isDebugEnabled()) {
        if (sso != null)
            log.debug("Found SingleSignOn Valve at " + sso);
        else
            log.debug("No SingleSignOn Valve is present");
    }

    sessionIdGenerator = new StandardSessionIdGenerator();
    sessionIdGenerator.setSecureRandomAlgorithm(getSecureRandomAlgorithm());
    sessionIdGenerator.setSecureRandomClass(getSecureRandomClass());
    sessionIdGenerator.setSecureRandomProvider(getSecureRandomProvider());

    super.startInternal();
}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:39,代碼來源:AuthenticatorBase.java

示例6: getHostConfigPath

import org.apache.catalina.Container; //導入方法依賴的package包/類
protected String getHostConfigPath(String resourceName) {
    StringBuffer result = new StringBuffer();
    Container container = context;
    Container host = null;
    Container engine = null;
    while (container != null) {
        if (container instanceof Host)
            host = container;
        if (container instanceof Engine)
            engine = container;
        container = container.getParent();
    }
    if (engine != null) {
        result.append(engine.getName()).append('/');
    }
    if (host != null) {
        result.append(host.getName()).append('/');
    }
    result.append(resourceName);
    return result.toString();
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:22,代碼來源:ContextConfig.java

示例7: getNamingContextName

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * Get naming context full name.
 */
private String getNamingContextName() {
	if (namingContextName == null) {
		Container parent = getParent();
		if (parent == null) {
			namingContextName = getName();
		} else {
			Stack<String> stk = new Stack<String>();
			StringBuilder buff = new StringBuilder();
			while (parent != null) {
				stk.push(parent.getName());
				parent = parent.getParent();
			}
			while (!stk.empty()) {
				buff.append("/" + stk.pop());
			}
			buff.append(getName());
			namingContextName = buff.toString();
		}
	}
	return namingContextName;
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:25,代碼來源:StandardContext.java

示例8: getNamingContextName

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * Get naming context full name.
 */
private String getNamingContextName() {
if (namingContextName == null) {
    Container parent = getParent();
    if (parent == null) {
    namingContextName = getName();
    } else {
    Stack stk = new Stack();
    StringBuffer buff = new StringBuffer();
    while (parent != null) {
        stk.push(parent.getName());
        parent = parent.getParent();
    }
    while (!stk.empty()) {
        buff.append("/" + stk.pop());
    }
    buff.append(getName());
    namingContextName = buff.toString();
    }
}
return namingContextName;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:25,代碼來源:StandardContext.java

示例9: logName

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * Return the abbreviated name of this container for logging messsages
 */
protected String logName() {

    if (logName != null) {
        return logName;
    }
    String loggerName = null;
    Container current = this;
    while (current != null) {
        String name = current.getName();
        if ((name == null) || (name.equals(""))) {
            name = "/";
        }
        loggerName = "[" + name + "]" 
            + ((loggerName != null) ? ("." + loggerName) : "");
        current = current.getParent();
    }
    logName = ContainerBase.class.getName() + "." + loggerName;
    return logName;
    
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:24,代碼來源:ContainerBase.java

示例10: getContainerKeyProperties

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * Calculate the key properties string to be added to an object's
 * {@link ObjectName} to indicate that it is associated with that container.
 * 
 * @param container
 *            The container the object is associated with
 * @return A string suitable for appending to the ObjectName
 * @deprecated To be removed since to creates a circular dependency. Will be
 *             replaced in Tomcat 8 by a new method on {@link Container}.
 */
@Deprecated
public static String getContainerKeyProperties(Container container) {

	Container c = container;
	StringBuilder keyProperties = new StringBuilder();
	int containerCount = 0;

	// Work up container hierarchy, add a component to the name for
	// each container
	while (!(c instanceof Engine)) {
		if (c instanceof Wrapper) {
			keyProperties.append(",servlet=");
			keyProperties.append(c.getName());
		} else if (c instanceof Context) {
			keyProperties.append(",context=");
			ContextName cn = new ContextName(c.getName(), false);
			keyProperties.append(cn.getDisplayName());
		} else if (c instanceof Host) {
			keyProperties.append(",host=");
			keyProperties.append(c.getName());
		} else if (c == null) {
			// May happen in unit testing and/or some embedding scenarios
			keyProperties.append(",container");
			keyProperties.append(containerCount++);
			keyProperties.append("=null");
			break;
		} else {
			// Should never happen...
			keyProperties.append(",container");
			keyProperties.append(containerCount++);
			keyProperties.append('=');
			keyProperties.append(c.getName());
		}
		c = c.getParent();
	}

	return keyProperties.toString();
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:49,代碼來源:MBeanUtils.java

示例11: getContainerKeyProperties

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * Calculate the key properties string to be added to an object's
 * {@link ObjectName} to indicate that it is associated with that container.
 * 
 * @param container The container the object is associated with 
 * @return          A string suitable for appending to the ObjectName
 * @deprecated  To be removed since to creates a circular dependency. Will
 *              be replaced in Tomcat 8 by a new method on {@link
 *              Container}.
 */
@Deprecated
public static String getContainerKeyProperties(Container container) {
    
    Container c = container;
    StringBuilder keyProperties = new StringBuilder();
    int containerCount = 0;
    
    // Work up container hierarchy, add a component to the name for
    // each container
    while (!(c instanceof Engine)) {
        if (c instanceof Wrapper) {
            keyProperties.append(",servlet=");
            keyProperties.append(c.getName());
        } else if (c instanceof Context) {
            keyProperties.append(",context=");
            ContextName cn = new ContextName(c.getName(), false);
            keyProperties.append(cn.getDisplayName());
        } else if (c instanceof Host) {
            keyProperties.append(",host=");
            keyProperties.append(c.getName());
        } else if (c == null) {
            // May happen in unit testing and/or some embedding scenarios
            keyProperties.append(",container");
            keyProperties.append(containerCount++);
            keyProperties.append("=null");
            break;
        } else {
            // Should never happen...
            keyProperties.append(",container");
            keyProperties.append(containerCount++);
            keyProperties.append('=');
            keyProperties.append(c.getName());
        }
        c = c.getParent();
    }

    return keyProperties.toString();
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:49,代碼來源:MBeanUtils.java

示例12: startInternal

import org.apache.catalina.Container; //導入方法依賴的package包/類
@Override
protected synchronized void startInternal() throws LifecycleException {
    Container c = getContainer();
    while (c != null && !(c instanceof Engine)) {
        c = c.getParent();
    }
    if (c instanceof Engine) {
        engine = (Engine) c;
    }
    super.startInternal();
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:12,代碼來源:SingleSignOn.java

示例13: startInternal

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * Start this component and implement the requirements of
 * {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException
 *                if this component detects a fatal error that prevents this
 *                component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {

	// Look up the SingleSignOn implementation in our request processing
	// path, if there is one
	Container parent = context.getParent();
	while ((sso == null) && (parent != null)) {
		Valve valves[] = parent.getPipeline().getValves();
		for (int i = 0; i < valves.length; i++) {
			if (valves[i] instanceof SingleSignOn) {
				sso = (SingleSignOn) valves[i];
				break;
			}
		}
		if (sso == null)
			parent = parent.getParent();
	}
	if (log.isDebugEnabled()) {
		if (sso != null)
			log.debug("Found SingleSignOn Valve at " + sso);
		else
			log.debug("No SingleSignOn Valve is present");
	}

	sessionIdGenerator = new StandardSessionIdGenerator();
	sessionIdGenerator.setSecureRandomAlgorithm(getSecureRandomAlgorithm());
	sessionIdGenerator.setSecureRandomClass(getSecureRandomClass());
	sessionIdGenerator.setSecureRandomProvider(getSecureRandomProvider());

	super.startInternal();
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:40,代碼來源:AuthenticatorBase.java

示例14: getAppBase

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * Get app base.
 */
protected String getAppBase() {
	String appBase = null;
	Container container = this;
	while (container != null) {
		if (container instanceof Host)
			break;
		container = container.getParent();
	}
	if (container != null) {
		appBase = ((Host) container).getAppBase();
	}
	return appBase;
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:17,代碼來源:StandardContext.java

示例15: start

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * Prepare for the beginning of active use of the public methods of this
 * component.  This method should be called after <code>configure()</code>,
 * and before any of the public methods of the component are utilized.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
public void start() throws LifecycleException {

    // Validate and update our current component state
    if (started)
        throw new LifecycleException
            (sm.getString("authenticator.alreadyStarted"));
    lifecycle.fireLifecycleEvent(START_EVENT, null);
    started = true;

    // Look up the SingleSignOn implementation in our request processing
    // path, if there is one
    Container parent = context.getParent();
    while ((sso == null) && (parent != null)) {
        if (!(parent instanceof Pipeline)) {
            parent = parent.getParent();
            continue;
        }
        Valve valves[] = ((Pipeline) parent).getValves();
        for (int i = 0; i < valves.length; i++) {
            if (valves[i] instanceof SingleSignOn) {
                sso = (SingleSignOn) valves[i];
                break;
            }
        }
        if (sso == null)
            parent = parent.getParent();
    }
    if (log.isDebugEnabled()) {
        if (sso != null)
            log.debug("Found SingleSignOn Valve at " + sso);
        else
            log.debug("No SingleSignOn Valve is present");
    }

}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:44,代碼來源:AuthenticatorBase.java


注:本文中的org.apache.catalina.Container.getParent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。