Java 类javax.naming.RefAddr 实例源码

项目:tomcat7    文件:ResourceRef.java   
/**
 * 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());

}
项目:tomcat7    文件:HandlerRef.java   
/**
 * 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());

}
项目:tomcat7    文件:DataSourceLinkFactory.java   
/**
 * 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;
}
项目:tomcat7    文件:ServiceRef.java   
/**
 * 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());

}
项目:tomcat7    文件:GenericNamingResourcesFactory.java   
@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;
}
项目:lams    文件:ResourceRef.java   
/**
 * 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());

}
项目:lams    文件:HandlerRef.java   
/**
 * 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());

}
项目:lams    文件:ServiceRef.java   
/**
 * 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());

}
项目:jerrydog    文件:ResourceRef.java   
/**
 * 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());

}
项目:apache-tomcat-7.0.73-with-comment    文件:ResourceRef.java   
/**
 * 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());

}
项目:apache-tomcat-7.0.73-with-comment    文件:HandlerRef.java   
/**
 * 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());

}
项目:apache-tomcat-7.0.73-with-comment    文件:DataSourceLinkFactory.java   
/**
 * 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;
}
项目:apache-tomcat-7.0.73-with-comment    文件:ServiceRef.java   
/**
 * 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());

}
项目:apache-tomcat-7.0.73-with-comment    文件:GenericNamingResourcesFactory.java   
@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;
}
项目:lazycat    文件:ResourceRef.java   
/**
 * 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());

}
项目:lazycat    文件:HandlerRef.java   
/**
 * 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());

}
项目:lazycat    文件:DataSourceLinkFactory.java   
/**
 * 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;
}
项目:lazycat    文件:ServiceRef.java   
/**
 * 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());

}
项目:Telepathology    文件:CoreRouterFactory.java   
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();
}
项目:javamelody    文件:CachedObjectFactory.java   
/** {@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;
}
项目:activemq-artemis    文件:InVMNamingContext.java   
@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;
   }
}
项目:activemq-artemis    文件:InVMContext.java   
@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 InVMContext && i != -1) {
      return ((InVMContext) 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;
   }
}
项目:activemq-artemis    文件:InVMContext.java   
@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 InVMContext && i != -1) {
      return ((InVMContext) 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;
   }
}
项目:activemq-artemis    文件:InVMNamingContext.java   
@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;
   }
}
项目:vibur-dbcp    文件:ViburDBCPObjectFactory.java   
@Override
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment)
    throws ViburDBCPException {

    Reference reference = (Reference) obj;
    Enumeration<RefAddr> enumeration = reference.getAll();
    Properties props = new Properties();
    while (enumeration.hasMoreElements()) {
        RefAddr refAddr = enumeration.nextElement();
        String pName = refAddr.getType();
        String pValue = (String) refAddr.getContent();
        props.setProperty(pName, pValue);
    }

    ViburDBCPDataSource dataSource = new ViburDBCPDataSource(props);
    dataSource.start();
    return dataSource;
}
项目:jTDS    文件:JtdsObjectFactory.java   
private HashMap loadProps( Reference ref, String[] props )
{
   HashMap config = new HashMap();
   HashMap values = new HashMap();

   Enumeration c = ref.getAll();

   while( c.hasMoreElements() )
   {
      RefAddr ra = (RefAddr) c.nextElement();
      values.put( ra.getType().toLowerCase(), ra.getContent() );
   }

   for( int i = 0; i < props.length; i ++ )
   {
      String value = (String) values.get( props[i] );
      value = value == null && props[i] != JtdsDataSource.DESCRIPTION ? (String) values.get( Messages.get( props[i] ).toLowerCase() ) : value;

      if( value != null )
      {
         config.put( props[i], value );
      }
   }

   return config;
}
项目:class-guard    文件:ResourceRef.java   
/**
 * 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());

}
项目:class-guard    文件:HandlerRef.java   
/**
 * 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());

}
项目:class-guard    文件:DataSourceLinkFactory.java   
/**
 * 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;
}
项目:class-guard    文件:ServiceRef.java   
/**
 * 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());

}
项目:class-guard    文件:GenericNamingResourcesFactory.java   
@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;
}
项目:cn1    文件:ReferenceTest.java   
public void testConstructor_Full() {
    String className = "java.util.Hashtable";
    String factoryName = "factory name";
    String factoryLocation = "file:///home/";

    String type = "Binary";
    RefAddr refAddr = new BinaryRefAddr(type, buffer);

    Reference reference = new Reference(className, refAddr, factoryName,
            factoryLocation);

    assertEquals(className, reference.getClassName());
    assertEquals(factoryName, reference.getFactoryClassName());
    assertEquals(factoryLocation, reference.getFactoryClassLocation());
    assertEquals(1, reference.size());
    assertEquals(refAddr, reference.get(0));
}
项目:apache-tomcat-7.0.57    文件:ResourceRef.java   
/**
 * 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());

}
项目:apache-tomcat-7.0.57    文件:HandlerRef.java   
/**
 * 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());

}
项目:apache-tomcat-7.0.57    文件:DataSourceLinkFactory.java   
/**
 * 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;
}
项目:apache-tomcat-7.0.57    文件:ServiceRef.java   
/**
 * 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());

}
项目:apache-tomcat-7.0.57    文件:GenericNamingResourcesFactory.java   
@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;
}
项目:apache-tomcat-7.0.57    文件:ResourceRef.java   
/**
 * 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());

}
项目:apache-tomcat-7.0.57    文件:HandlerRef.java   
/**
 * 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());

}
项目:apache-tomcat-7.0.57    文件:DataSourceLinkFactory.java   
/**
 * 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;
}