当前位置: 首页>>代码示例>>Java>>正文


Java Reference.add方法代码示例

本文整理汇总了Java中javax.naming.Reference.add方法的典型用法代码示例。如果您正苦于以下问题:Java Reference.add方法的具体用法?Java Reference.add怎么用?Java Reference.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.naming.Reference的用法示例。


在下文中一共展示了Reference.add方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addEjb

import javax.naming.Reference; //导入方法依赖的package包/类
/**
 * Set the specified EJBs in the naming context.
 */
public void addEjb(ContextEjb ejb) {

	// Create a reference to the EJB.
	Reference ref = new EjbRef(ejb.getType(), ejb.getHome(), ejb.getRemote(), ejb.getLink());
	// Adding the additional parameters, if any
	Iterator<String> params = ejb.listProperties();
	while (params.hasNext()) {
		String paramName = params.next();
		String paramValue = (String) ejb.getProperty(paramName);
		StringRefAddr refAddr = new StringRefAddr(paramName, paramValue);
		ref.add(refAddr);
	}
	try {
		createSubcontexts(envCtx, ejb.getName());
		envCtx.bind(ejb.getName(), ref);
	} catch (NamingException e) {
		logger.error(sm.getString("naming.bindFailed", e));
	}

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:24,代码来源:NamingContextListener.java

示例2: addEjb

import javax.naming.Reference; //导入方法依赖的package包/类
/**
 * Set the specified EJBs in the naming context.
 */
public void addEjb(ContextEjb ejb) {

    // Create a reference to the EJB.
    Reference ref = new EjbRef
        (ejb.getType(), ejb.getHome(), ejb.getRemote(), ejb.getLink());
    // Adding the additional parameters, if any
    Iterator<String> params = ejb.listProperties();
    while (params.hasNext()) {
        String paramName = params.next();
        String paramValue = (String) ejb.getProperty(paramName);
        StringRefAddr refAddr = new StringRefAddr(paramName, paramValue);
        ref.add(refAddr);
    }
    try {
        createSubcontexts(envCtx, ejb.getName());
        envCtx.bind(ejb.getName(), ref);
    } catch (NamingException e) {
        logger.error(sm.getString("naming.bindFailed", e));
    }

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:25,代码来源:NamingContextListener.java

示例3: addResourceEnvRef

import javax.naming.Reference; //导入方法依赖的package包/类
/**
 * Set the specified resources in the naming context.
 */
public void addResourceEnvRef(ContextResourceEnvRef resourceEnvRef) {

    // Create a reference to the resource env.
    Reference ref = new ResourceEnvRef(resourceEnvRef.getType());
    // Adding the additional parameters, if any
    Iterator<String> params = resourceEnvRef.listProperties();
    while (params.hasNext()) {
        String paramName = params.next();
        String paramValue = (String) resourceEnvRef.getProperty(paramName);
        StringRefAddr refAddr = new StringRefAddr(paramName, paramValue);
        ref.add(refAddr);
    }
    try {
        if (logger.isDebugEnabled())
            log.debug("  Adding resource env ref " + resourceEnvRef.getName());
        createSubcontexts(envCtx, resourceEnvRef.getName());
        envCtx.bind(resourceEnvRef.getName(), ref);
    } catch (NamingException e) {
        logger.error(sm.getString("naming.bindFailed", e));
    }

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:26,代码来源:NamingContextListener.java

示例4: addAdditionalParameters

import javax.naming.Reference; //导入方法依赖的package包/类
/**
 * Add additional parameters to the reference.
 */
private void addAdditionalParameters(NamingResources resources, 
                                     Reference ref, String name) {
    if (resources == null) {
        resources = namingResources;
    }
    ResourceParams resourceParameters = resources.findResourceParams(name);
    if (debug >= 2)
        log("  Resource parameters for " + name + " = " +
            resourceParameters);
    if (resourceParameters == null)
        return;
    Hashtable params = resourceParameters.getParameters();
    Enumeration _enum = params.keys();
    while (_enum.hasMoreElements()) {
        String paramName = (String) _enum.nextElement();
        String paramValue = (String) params.get(paramName);
        StringRefAddr refAddr = new StringRefAddr(paramName, paramValue);
        ref.add(refAddr);
    }
}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:24,代码来源:NamingContextListener.java

示例5: addResourceEnvRef

import javax.naming.Reference; //导入方法依赖的package包/类
/**
 * Set the specified resources in the naming context.
 */
public void addResourceEnvRef(ContextResourceEnvRef resourceEnvRef) {

	// Create a reference to the resource env.
	Reference ref = new ResourceEnvRef(resourceEnvRef.getType());
	// Adding the additional parameters, if any
	Iterator<String> params = resourceEnvRef.listProperties();
	while (params.hasNext()) {
		String paramName = params.next();
		String paramValue = (String) resourceEnvRef.getProperty(paramName);
		StringRefAddr refAddr = new StringRefAddr(paramName, paramValue);
		ref.add(refAddr);
	}
	try {
		if (logger.isDebugEnabled())
			log.debug("  Adding resource env ref " + resourceEnvRef.getName());
		createSubcontexts(envCtx, resourceEnvRef.getName());
		envCtx.bind(resourceEnvRef.getName(), ref);
	} catch (NamingException e) {
		logger.error(sm.getString("naming.bindFailed", e));
	}

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:26,代码来源:NamingContextListener.java

示例6: getReference

import javax.naming.Reference; //导入方法依赖的package包/类
/**
 * Required method to support this class as a <CODE>Referenceable</CODE>.
 * 
 * @return a Reference to this data source
 * 
 * @throws NamingException
 *             if a JNDI error occurs
 */
public Reference getReference() throws NamingException {
    String factoryName = "com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory";
    Reference ref = new Reference(getClass().getName(), factoryName, null);
    ref.add(new StringRefAddr(NonRegisteringDriver.USER_PROPERTY_KEY, getUser()));
    ref.add(new StringRefAddr(NonRegisteringDriver.PASSWORD_PROPERTY_KEY, this.password));
    ref.add(new StringRefAddr("serverName", getServerName()));
    ref.add(new StringRefAddr("port", "" + getPort()));
    ref.add(new StringRefAddr("databaseName", getDatabaseName()));
    ref.add(new StringRefAddr("url", getUrl()));
    ref.add(new StringRefAddr("explicitUrl", String.valueOf(this.explicitUrl)));

    //
    // Now store all of the 'non-standard' properties...
    //
    try {
        storeToRef(ref);
    } catch (SQLException sqlEx) {
        throw new NamingException(sqlEx.getMessage());
    }

    return ref;
}
 
开发者ID:rafallis,项目名称:BibliotecaPS,代码行数:31,代码来源:MysqlDataSource.java

示例7: getReference

import javax.naming.Reference; //导入方法依赖的package包/类
/**
 * Retrieves the Reference of this object.
 *
 * @return The non-null javax.naming.Reference of this object.
 * @exception NamingException If a naming exception was encountered
 *          while retrieving the reference.
 */
public Reference getReference() throws NamingException {

    String    cname = "org.hsqldb.jdbc.JDBCDataSourceFactory";
    Reference ref   = new Reference(getClass().getName(), cname, null);

    ref.add(new StringRefAddr("database", getDatabase()));
    ref.add(new StringRefAddr("user", getUser()));
    ref.add(new StringRefAddr("password", password));
    ref.add(new StringRefAddr("loginTimeout",
                              Integer.toString(loginTimeout)));

    return ref;
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:21,代码来源:JDBCPooledDataSource.java

示例8: getReference

import javax.naming.Reference; //导入方法依赖的package包/类
/**
 * Retrieves the Reference of this object.
 *
 * @return The non-null Reference of this object.
 * @exception NamingException If a naming exception was encountered
 *          while retrieving the reference.
 */
public Reference getReference() throws NamingException {
    String    cname = "org.hsqldb.jdbc.JDBCDataSourceFactory";
    Reference ref   = new Reference(getClass().getName(), cname, null);

    ref.add(new StringRefAddr("database", source.getDatabase()));
    ref.add(new StringRefAddr("user", source.getUser()));
    ref.add(new StringRefAddr("password", source.password));
    ref.add(new StringRefAddr("loginTimeout",
                              Integer.toString(source.loginTimeout)));
    ref.add(new StringRefAddr("poolSize", Integer.toString(connections.length)));

    return ref;
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:21,代码来源:JDBCPool.java

示例9: getReference

import javax.naming.Reference; //导入方法依赖的package包/类
public Reference getReference() throws NamingException {

        String    cname = "org.hsqldb.jdbc.jdbcDataSourceFactory";
        Reference ref   = new Reference(getClass().getName(), cname, null);

        ref.add(new StringRefAddr("database", getDatabase()));
        ref.add(new StringRefAddr("user", getUser()));
        ref.add(new StringRefAddr("password", password));

        return ref;
    }
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:jdbcDataSource.java

示例10: getReference

import javax.naming.Reference; //导入方法依赖的package包/类
public Reference getReference() throws NamingException {

        String    cname = "org.hsqldb.jdbc.JDBCDataSourceFactory";
        Reference ref   = new Reference(getClass().getName(), cname, null);

        ref.add(new StringRefAddr("database", getDatabase()));
        ref.add(new StringRefAddr("user", getUser()));
        ref.add(new StringRefAddr("password", password));

        return ref;
    }
 
开发者ID:s-store,项目名称:s-store,代码行数:12,代码来源:JDBCDataSource.java

示例11: getReference

import javax.naming.Reference; //导入方法依赖的package包/类
public Reference getReference() throws NamingException {
    final String className = getClass().getName();
    final String factoryName = className + "Factory"; // XXX: not robust
    Reference ref = new Reference(className, factoryName, null);
    ref.add(new StringRefAddr("instanceKey", instanceKey));
    ref.add(new StringRefAddr("url", this.getUrl()));
    ref.add(new StringRefAddr("username", this.getUsername()));
    ref.add(new StringRefAddr("password", this.getPassword()));
    // TODO ADD OTHER PROPERTIES
    return ref;
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:12,代码来源:ElasticSearchDruidDataSource.java

示例12: storeTo

import javax.naming.Reference; //导入方法依赖的package包/类
void storeTo(Reference ref) {
    if (getValueAsObject() != null) {
        ref.add(new StringRefAddr(getPropertyName(), getValueAsObject().toString()));
    }
}
 
开发者ID:rafallis,项目名称:BibliotecaPS,代码行数:6,代码来源:ConnectionPropertiesImpl.java


注:本文中的javax.naming.Reference.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。