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


Java Container.getName方法代碼示例

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


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

示例1: logName

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * Return the abbreviated name of this container for logging messages
 */
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 = "/";
		} else if (name.startsWith("##")) {
			name = "/" + name;
		}
		loggerName = "[" + name + "]" + ((loggerName != null) ? ("." + loggerName) : "");
		current = current.getParent();
	}
	logName = ContainerBase.class.getName() + "." + loggerName;
	return logName;

}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:25,代碼來源:ContainerBase.java

示例2: getDomain

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * Determine the name of the domain to register MBeans for from a given
 * Service.
 * 
 * @param service 
 *
 * @deprecated  To be removed since to creates a circular dependency. Will
 *              be replaced in Tomcat 8 by a new method on {@link
 *              Service}.
 */
@Deprecated
public static String getDomain(Service service) {
    
    // Null service -> return null
    if (service == null) {
        return null;
    }
    
    String domain = null;
    
    Container engine = service.getContainer();
    
    // Use the engine name first
    if (engine != null) {
        domain = engine.getName();
    }
    
    // No engine or no engine name, use the service name 
    if (domain == null) {
        domain = service.getName();
    }
    
    // No service name, use null
    return domain;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:36,代碼來源:MBeanUtils.java

示例3: 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

示例4: setContainer

import org.apache.catalina.Container; //導入方法依賴的package包/類
@Override
public void setContainer(Container container) {
    super.setContainer(container);

    if( appName==null  ) {
        String name = container.getName();
        if (!name.startsWith("/")) {
            name = "/" + name;
        }
        name = makeLegalForJAAS(name);

        appName=name;

        log.info("Set JAAS app name " + appName);
    }
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:17,代碼來源:JAASRealm.java

示例5: logName

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * Return the abbreviated name of this container for logging messages
 */
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 = "/";
        } else if (name.startsWith("##")) {
            name = "/" + name;
        }
        loggerName = "[" + name + "]" 
            + ((loggerName != null) ? ("." + loggerName) : "");
        current = current.getParent();
    }
    logName = ContainerBase.class.getName() + "." + loggerName;
    return logName;
    
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:26,代碼來源:ContainerBase.java

示例6: 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();
        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:lamsfoundation,項目名稱:lams,代碼行數:22,代碼來源:JDBCStore.java

示例7: 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

示例8: setContainer

import org.apache.catalina.Container; //導入方法依賴的package包/類
@Override
public void setContainer(Container container) {
	super.setContainer(container);

	if (appName == null) {
		String name = container.getName();
		if (!name.startsWith("/")) {
			name = "/" + name;
		}
		name = makeLegalForJAAS(name);

		appName = name;

		log.info("Set JAAS app name " + appName);
	}
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:17,代碼來源:JAASRealm.java

示例9: log

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * Log a message on the Logger associated with our Container (if any).
 *
 * @param message Message to be logged
 */
protected void log(String message) {
    Logger logger = null;
    Container container = manager.getContainer();

    if (container != null)
        logger = container.getLogger();

    if (logger != null) {
        logger.log(getStoreName()+"[" + container.getName() + "]: "
                   + message);
    } else {
        String containerName = null;
        if (container != null)
            containerName = container.getName();
        System.out.println(getStoreName()+"[" + containerName
                           + "]: " + message);
    }
}
 
開發者ID:c-rainstorm,項目名稱:jerrydog,代碼行數:24,代碼來源:StoreBase.java

示例10: addChildInternal

import org.apache.catalina.Container; //導入方法依賴的package包/類
private void addChildInternal(Container child) {

        synchronized(children) {
            if (children.get(child.getName()) != null)
                throw new IllegalArgumentException("addChild:  Child name '" +
                                                   child.getName() +
                                                   "' is not unique");
            child.setParent((Container) this);  // May throw IAE
            if (started && (child instanceof Lifecycle)) {
                try {
                    ((Lifecycle) child).start();
                } catch (LifecycleException e) {
                    log("ContainerBase.addChild: start: ", e);
                    throw new IllegalStateException
                        ("ContainerBase.addChild: start: " + e);
                }
            }
            children.put(child.getName(), child);
            fireContainerEvent(ADD_CHILD_EVENT, child);
        }

    }
 
開發者ID:c-rainstorm,項目名稱:jerrydog,代碼行數:23,代碼來源:ContainerBase.java

示例11: 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

示例12: 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:how2j,項目名稱:lazycat,代碼行數:25,代碼來源:JDBCStore.java

示例13: getManagerName

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * @param name
 * @param manager
 * @return TODO
 */
@Override
public String getManagerName(String name, Manager manager) {
    String clusterName = name ;
    if (clusterName == null) clusterName = manager.getContainer().getName();
    if (getContainer() instanceof Engine) {
        Context context = (Context) manager.getContainer() ;
        Container host = context.getParent();
        if (host instanceof Host && clusterName != null && 
                !(clusterName.startsWith(host.getName() +"#"))) {
            clusterName = host.getName() +"#" + clusterName ;
        }
    }
    return clusterName;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:20,代碼來源:SimpleTcpCluster.java

示例14: getHostname

import org.apache.catalina.Container; //導入方法依賴的package包/類
/**
 * @deprecated  Unused. Will be removed in Tomcat 8.0.x.
 */
@Deprecated
public String getHostname() {
    Container parentHost = getParent();
    if (parentHost != null) {
        hostName = parentHost.getName();
    }
    if ((hostName == null) || (hostName.length() < 1))
        hostName = "_";
    return hostName;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:14,代碼來源:StandardContext.java

示例15: addChildInternal

import org.apache.catalina.Container; //導入方法依賴的package包/類
private void addChildInternal(Container child) {

        if( log.isDebugEnabled() )
            log.debug("Add child " + child + " " + this);
        synchronized(children) {
            if (children.get(child.getName()) != null)
                throw new IllegalArgumentException("addChild:  Child name '" +
                                                   child.getName() +
                                                   "' is not unique");
            child.setParent(this);  // May throw IAE
            children.put(child.getName(), child);
        }

        // Start child
        // Don't do this inside sync block - start can be a slow process and
        // locking the children object can cause problems elsewhere
        try {
            if ((getState().isAvailable() ||
                    LifecycleState.STARTING_PREP.equals(getState())) &&
                    startChildren) {
                child.start();
            }
        } catch (LifecycleException e) {
            log.error("ContainerBase.addChild: start: ", e);
            throw new IllegalStateException("ContainerBase.addChild: start: " + e);
        } finally {
            fireContainerEvent(ADD_CHILD_EVENT, child);
        }
    }
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:30,代碼來源:ContainerBase.java


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