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


Java RefAddr類代碼示例

本文整理匯總了Java中javax.naming.RefAddr的典型用法代碼示例。如果您正苦於以下問題:Java RefAddr類的具體用法?Java RefAddr怎麽用?Java RefAddr使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: toString

import javax.naming.RefAddr; //導入依賴的package包/類
/**
 * Return a String rendering of this object.
 */
@Override
public String toString() {

    StringBuilder sb = new StringBuilder("ResourceRef[");
    sb.append("className=");
    sb.append(getClassName());
    sb.append(",factoryClassLocation=");
    sb.append(getFactoryClassLocation());
    sb.append(",factoryClassName=");
    sb.append(getFactoryClassName());
    Enumeration<RefAddr> refAddrs = getAll();
    while (refAddrs.hasMoreElements()) {
        RefAddr refAddr = refAddrs.nextElement();
        sb.append(",{type=");
        sb.append(refAddr.getType());
        sb.append(",content=");
        sb.append(refAddr.getContent());
        sb.append("}");
    }
    sb.append("]");
    return (sb.toString());

}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:27,代碼來源:ResourceRef.java

示例2: toString

import javax.naming.RefAddr; //導入依賴的package包/類
/**
 * Return a String rendering of this object.
 */
@Override
public String toString() {

    StringBuilder sb = new StringBuilder("HandlerRef[");
    sb.append("className=");
    sb.append(getClassName());
    sb.append(",factoryClassLocation=");
    sb.append(getFactoryClassLocation());
    sb.append(",factoryClassName=");
    sb.append(getFactoryClassName());
    Enumeration<RefAddr> refAddrs = getAll();
    while (refAddrs.hasMoreElements()) {
        RefAddr refAddr = refAddrs.nextElement();
        sb.append(",{type=");
        sb.append(refAddr.getType());
        sb.append(",content=");
        sb.append(refAddr.getContent());
        sb.append("}");
    }
    sb.append("]");
    return (sb.toString());

}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:27,代碼來源:HandlerRef.java

示例3: getObjectInstance

import javax.naming.RefAddr; //導入依賴的package包/類
/**
 * Create a new DataSource instance.
 * 
 * @param obj The reference object describing the DataSource
 */
@Override
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment)
    throws NamingException {
    Object result = super.getObjectInstance(obj, name, nameCtx, environment);
    // Can we process this request?
    if (result!=null) {
        Reference ref = (Reference) obj;
        RefAddr userAttr = ref.get("username");
        RefAddr passAttr = ref.get("password");
        if (userAttr.getContent()!=null && passAttr.getContent()!=null) {
            result = wrapDataSource(result,userAttr.getContent().toString(), passAttr.getContent().toString());
        }
    }
    return result;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:21,代碼來源:DataSourceLinkFactory.java

示例4: toString

import javax.naming.RefAddr; //導入依賴的package包/類
/**
 * Return a String rendering of this object.
 */
@Override
public String toString() {

    StringBuilder sb = new StringBuilder("ServiceRef[");
    sb.append("className=");
    sb.append(getClassName());
    sb.append(",factoryClassLocation=");
    sb.append(getFactoryClassLocation());
    sb.append(",factoryClassName=");
    sb.append(getFactoryClassName());
    Enumeration<RefAddr> refAddrs = getAll();
    while (refAddrs.hasMoreElements()) {
        RefAddr refAddr = refAddrs.nextElement();
        sb.append(",{type=");
        sb.append(refAddr.getType());
        sb.append(",content=");
        sb.append(refAddr.getContent());
        sb.append("}");
    }
    sb.append("]");
    return (sb.toString());

}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:27,代碼來源:ServiceRef.java

示例5: getObjectInstance

import javax.naming.RefAddr; //導入依賴的package包/類
@Override
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception {
    if ((obj == null) || !(obj instanceof Reference)) {
        return null;
    }
    Reference ref = (Reference) obj;
    Enumeration<RefAddr> refs = ref.getAll();

    String type = ref.getClassName();
    Object o = Class.forName(type).newInstance();

    while (refs.hasMoreElements()) {
        RefAddr addr = refs.nextElement();
        String param = addr.getType();
        String value = null;
        if (addr.getContent()!=null) {
            value = addr.getContent().toString();
        }
        if (setProperty(o, param, value,false)) {

        } else {
            log.debug("Property not configured["+param+"]. No setter found on["+o+"].");
        }
    }
    return o;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:27,代碼來源:GenericNamingResourcesFactory.java

示例6: toString

import javax.naming.RefAddr; //導入依賴的package包/類
/**
 * Return a String rendering of this object.
 */
public String toString() {

    StringBuffer sb = new StringBuffer("ResourceRef[");
    sb.append("className=");
    sb.append(getClassName());
    sb.append(",factoryClassLocation=");
    sb.append(getFactoryClassLocation());
    sb.append(",factoryClassName=");
    sb.append(getFactoryClassName());
    Enumeration refAddrs = getAll();
    while (refAddrs.hasMoreElements()) {
        RefAddr refAddr = (RefAddr) refAddrs.nextElement();
        sb.append(",{type=");
        sb.append(refAddr.getType());
        sb.append(",content=");
        sb.append(refAddr.getContent());
        sb.append("}");
    }
    sb.append("]");
    return (sb.toString());

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

示例7: toString

import javax.naming.RefAddr; //導入依賴的package包/類
/**
 * Return a String rendering of this object.
 */
public String toString() {

    StringBuffer sb = new StringBuffer("HandlerRef[");
    sb.append("className=");
    sb.append(getClassName());
    sb.append(",factoryClassLocation=");
    sb.append(getFactoryClassLocation());
    sb.append(",factoryClassName=");
    sb.append(getFactoryClassName());
    Enumeration refAddrs = getAll();
    while (refAddrs.hasMoreElements()) {
        RefAddr refAddr = (RefAddr) refAddrs.nextElement();
        sb.append(",{type=");
        sb.append(refAddr.getType());
        sb.append(",content=");
        sb.append(refAddr.getContent());
        sb.append("}");
    }
    sb.append("]");
    return (sb.toString());

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

示例8: toString

import javax.naming.RefAddr; //導入依賴的package包/類
/**
 * Return a String rendering of this object.
 */
public String toString() {

    StringBuffer sb = new StringBuffer("ServiceRef[");
    sb.append("className=");
    sb.append(getClassName());
    sb.append(",factoryClassLocation=");
    sb.append(getFactoryClassLocation());
    sb.append(",factoryClassName=");
    sb.append(getFactoryClassName());
    Enumeration refAddrs = getAll();
    while (refAddrs.hasMoreElements()) {
        RefAddr refAddr = (RefAddr) refAddrs.nextElement();
        sb.append(",{type=");
        sb.append(refAddr.getType());
        sb.append(",content=");
        sb.append(refAddr.getContent());
        sb.append("}");
    }
    sb.append("]");
    return (sb.toString());

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

示例9: toString

import javax.naming.RefAddr; //導入依賴的package包/類
/**
 * Return a String rendering of this object.
 */
@Override
public String toString() {

	StringBuilder sb = new StringBuilder("ResourceRef[");
	sb.append("className=");
	sb.append(getClassName());
	sb.append(",factoryClassLocation=");
	sb.append(getFactoryClassLocation());
	sb.append(",factoryClassName=");
	sb.append(getFactoryClassName());
	Enumeration<RefAddr> refAddrs = getAll();
	while (refAddrs.hasMoreElements()) {
		RefAddr refAddr = refAddrs.nextElement();
		sb.append(",{type=");
		sb.append(refAddr.getType());
		sb.append(",content=");
		sb.append(refAddr.getContent());
		sb.append("}");
	}
	sb.append("]");
	return (sb.toString());

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

示例10: toString

import javax.naming.RefAddr; //導入依賴的package包/類
/**
 * Return a String rendering of this object.
 */
@Override
public String toString() {

	StringBuilder sb = new StringBuilder("HandlerRef[");
	sb.append("className=");
	sb.append(getClassName());
	sb.append(",factoryClassLocation=");
	sb.append(getFactoryClassLocation());
	sb.append(",factoryClassName=");
	sb.append(getFactoryClassName());
	Enumeration<RefAddr> refAddrs = getAll();
	while (refAddrs.hasMoreElements()) {
		RefAddr refAddr = refAddrs.nextElement();
		sb.append(",{type=");
		sb.append(refAddr.getType());
		sb.append(",content=");
		sb.append(refAddr.getContent());
		sb.append("}");
	}
	sb.append("]");
	return (sb.toString());

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

示例11: getObjectInstance

import javax.naming.RefAddr; //導入依賴的package包/類
/**
 * Create a new DataSource instance.
 * 
 * @param obj
 *            The reference object describing the DataSource
 */
@Override
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment)
		throws NamingException {
	Object result = super.getObjectInstance(obj, name, nameCtx, environment);
	// Can we process this request?
	if (result != null) {
		Reference ref = (Reference) obj;
		RefAddr userAttr = ref.get("username");
		RefAddr passAttr = ref.get("password");
		if (userAttr.getContent() != null && passAttr.getContent() != null) {
			result = wrapDataSource(result, userAttr.getContent().toString(), passAttr.getContent().toString());
		}
	}
	return result;
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:22,代碼來源:DataSourceLinkFactory.java

示例12: toString

import javax.naming.RefAddr; //導入依賴的package包/類
/**
 * Return a String rendering of this object.
 */
@Override
public String toString() {

	StringBuilder sb = new StringBuilder("ServiceRef[");
	sb.append("className=");
	sb.append(getClassName());
	sb.append(",factoryClassLocation=");
	sb.append(getFactoryClassLocation());
	sb.append(",factoryClassName=");
	sb.append(getFactoryClassName());
	Enumeration<RefAddr> refAddrs = getAll();
	while (refAddrs.hasMoreElements()) {
		RefAddr refAddr = refAddrs.nextElement();
		sb.append(",{type=");
		sb.append(refAddr.getType());
		sb.append(",content=");
		sb.append(refAddr.getContent());
		sb.append("}");
	}
	sb.append("]");
	return (sb.toString());

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

示例13: dumpReferenceContents

import javax.naming.RefAddr; //導入依賴的package包/類
public String dumpReferenceContents(Reference ref)
{
	StringBuilder sb = new StringBuilder();

	sb.append("Reference classname[" + ref.getClassName() + "]\n");
	sb.append("Reference factory classname[" + ref.getFactoryClassName() + 
			"],  factory class location [" + ref.getFactoryClassLocation() + "]\n");
	
	for( Enumeration<RefAddr> enumRefAddr = ref.getAll(); enumRefAddr.hasMoreElements(); )
	{
		RefAddr refAddr = enumRefAddr.nextElement();
		sb.append("  RefAddr type [" + refAddr.getType() + "] = [" + refAddr.getContent().toString() + "]\n");
	}
	
	return sb.toString();
}
 
開發者ID:VHAINNOVATIONS,項目名稱:Telepathology,代碼行數:17,代碼來源:CoreRouterFactory.java

示例14: getObjectInstance

import javax.naming.RefAddr; //導入依賴的package包/類
/** {@inheritDoc} */
@Override
// CHECKSTYLE:OFF
public synchronized Object getObjectInstance(Object obj, Name name, Context nameCtx, // NOPMD
		Hashtable<?, ?> environment) throws NamingException { // NOPMD
	// CHECKSTYLE:ON
	final Reference reference = (Reference) obj;
	final RefAddr jndiRefAddr = reference.get("jndi-ref");
	if (jndiRefAddr == null) {
		throw new NamingException("You must specify a 'jndi-ref' in the <Resource> tag");
	}
	final String jndiRef = (String) jndiRefAddr.getContent();
	Object cachedObject = CACHED_OBJECTS.get(jndiRef);
	if (cachedObject == null) {
		final InitialContext context = new InitialContext();
		cachedObject = context.lookup(jndiRef);
		if (cachedObject == null) {
			throw new NamingException("No jndi object found for the 'jndi-ref': " + jndiRef);
		}
		CACHED_OBJECTS.put(jndiRef, cachedObject);
	}
	return cachedObject;
}
 
開發者ID:javamelody,項目名稱:javamelody,代碼行數:24,代碼來源:CachedObjectFactory.java

示例15: lookup

import javax.naming.RefAddr; //導入依賴的package包/類
@Override
public Object lookup(String name) throws NamingException {
   name = trimSlashes(name);
   int i = name.indexOf("/");
   String tok = i == -1 ? name : name.substring(0, i);
   Object value = map.get(tok);
   if (value == null) {
      throw new NameNotFoundException("Name not found: " + tok);
   }
   if (value instanceof InVMNamingContext && i != -1) {
      return ((InVMNamingContext) value).lookup(name.substring(i));
   }
   if (value instanceof Reference) {
      Reference ref = (Reference) value;
      RefAddr refAddr = ref.get("nns");

      // we only deal with references create by NonSerializableFactory
      String key = (String) refAddr.getContent();
      return NonSerializableFactory.lookup(key);
   } else {
      return value;
   }
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:24,代碼來源:InVMNamingContext.java


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