本文整理了Java中org.apache.geronimo.kernel.Naming.toOsgiJndiName()
方法的一些代码示例,展示了Naming.toOsgiJndiName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Naming.toOsgiJndiName()
方法的具体详情如下:
包路径:org.apache.geronimo.kernel.Naming
类名称:Naming
方法名:toOsgiJndiName
暂无
代码示例来源:origin: org.apache.geronimo.framework/geronimo-naming
/**
* Preprocess the value before it is bound. This is usefult for wrapping values with reference objects.
* By default, this method simply return the value.
*
* @param abstractName the abstract name of the gbean to bind
* @param value the gbean instance
* @return the value to bind or null if there was a problem
*/
@Override
protected Object preprocessVaue(AbstractName abstractName, Name name, Object value) {
if (!(value instanceof ResourceSource)) {
log.info("value at " + abstractName + " is not a ResourceSource: " + value.getClass().getName());
return null;
}
try {
if (value.getClass().getAnnotation(OsgiService.class) != null) {
String osgiJndiName = kernel.getNaming().toOsgiJndiName(abstractName);
String query = "(osgi.jndi.service.name=" + osgiJndiName + ')';
ResourceReference reference = new ResourceReference(query, value.getClass().getName());
reference.setBundle(bundleContext.getBundle());
reference.setKernel(kernel);
return reference;
}
return ((ResourceSource) value).$getResource();
} catch (Throwable throwable) {
log.info("Could not get resource from gbean at " + abstractName,throwable);
return null;
}
}
代码示例来源:origin: org.apache.geronimo.framework/geronimo-naming
@Override
public void setKernel(Kernel kernel) {
if(jndiName == null) {
try {
ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
AbstractName mappedAbstractName = new AbstractName(configurationManager.getArtifactResolver().resolveInClassLoader(gbeanName.getArtifact()), gbeanName.getName());
String osgiJndiName = kernel.getNaming().toOsgiJndiName(mappedAbstractName);
jndiName = prefix + osgiJndiName;
} catch (GBeanNotFoundException e) {
logger.error("Fail to build the jndi name for " + gbeanName, e);
} catch (MissingDependencyException e) {
logger.error("Fail to build the jndi name for " + gbeanName, e);
}
}
}
}
代码示例来源:origin: org.apache.geronimo.framework/geronimo-naming
@Override
public void setKernel(Kernel kernel) {
if(query == null) {
try {
ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
AbstractName mappedAbstractName = new AbstractName(configurationManager.getArtifactResolver().resolveInClassLoader(gbeanName.getArtifact()), gbeanName.getName());
String osgiJndiName = kernel.getNaming().toOsgiJndiName(mappedAbstractName);
query = "(osgi.jndi.service.name=" + osgiJndiName + ')';
} catch (GBeanNotFoundException e) {
logger.error("Fail to build the jndi name for " + gbeanName, e);
} catch (MissingDependencyException e) {
logger.error("Fail to build the jndi name for " + gbeanName, e);
}
}
}
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-connector-builder-1_6
private void addAdminObjectGBeans(List<GBeanData> raBeans, Naming naming, AbstractName jcaResourceName, GBeanData resourceAdapterModuleData, Bundle bundle, AbstractName resourceAdapterAbstractName, GerAdminobjectType[] adminObjects) throws DeploymentException {
for (GerAdminobjectType gerAdminObject : adminObjects) {
String adminObjectInterface = gerAdminObject.getAdminobjectInterface().trim();
GBeanData adminObjectGBeanData = locateAdminObjectInfo(resourceAdapterModuleData, adminObjectInterface);
if (adminObjectGBeanData == null) {
throw new DeploymentException("No admin object declared for interface: " + adminObjectInterface);
}
for (GerAdminobjectInstanceType gerAdminObjectInstance : gerAdminObject.getAdminobjectInstanceArray()) {
GBeanData adminObjectInstanceGBeanData = new GBeanData(adminObjectGBeanData);
setDynamicGBeanDataAttributes(adminObjectInstanceGBeanData, gerAdminObjectInstance.getConfigPropertySettingArray(), bundle);
// add it
AbstractName adminObjectAbstractName = naming.createChildName(jcaResourceName, gerAdminObjectInstance.getMessageDestinationName().trim(), NameFactory.JCA_ADMIN_OBJECT);
adminObjectInstanceGBeanData.setAbstractName(adminObjectAbstractName);
if (resourceAdapterAbstractName != null) {
adminObjectInstanceGBeanData.setReferencePattern("ResourceAdapterWrapper", resourceAdapterAbstractName);
}
Set<String> implementedInterfaces = new HashSet<String>();
implementedInterfaces.add(checkClass(bundle, (String) adminObjectInstanceGBeanData.getAttribute("adminObjectInterface")));
implementedInterfaces.add(checkClass(bundle, (String) adminObjectInstanceGBeanData.getAttribute("adminObjectClass")));
adminObjectInstanceGBeanData.setServiceInterfaces(implementedInterfaces.toArray(new String[implementedInterfaces.size()]));
String jndiName = naming.toOsgiJndiName(adminObjectAbstractName);
//TODO allow specifying osig jndi name directly, like for connection factories
adminObjectInstanceGBeanData.getServiceProperties().put(OSGI_JNDI_SERVICE_NAME, jndiName);
raBeans.add(adminObjectInstanceGBeanData);
}
}
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-connector-builder-1_6
String jndiName = connectiondefinitionInstance.getJndiName();
if (jndiName == null) {
jndiName = naming.toOsgiJndiName(connectionFactoryAbstractName);
} else {
jndiName = jndiName.trim();
代码示例来源:origin: org.apache.geronimo.modules/geronimo-connector-builder-1_6
String osgiJndiName = module.getEarContext().getNaming().toOsgiJndiName(abstractName);
String filter = "(osgi.jndi.service.name=" + osgiJndiName + ')';
代码示例来源:origin: org.apache.geronimo.modules/geronimo-connector-builder-1_6
private void addDataSourceGBean(Module module, Map<EARContext.Key, Object> sharedContext, DataSource ds)
throws DeploymentException {
String jndiName = ds.getKey();
if (lookupJndiContextMap(module, jndiName) != null) {
return;
}
String name = jndiName;
if (name.startsWith("java:")) {
name = name.substring(5);
}
EARContext earContext = module.getEarContext();
AbstractName dataSourceAbstractName = earContext.getNaming().createChildName(module.getModuleName(), name, "GBean");
DataSourceDescription dsDescription = createDataSourceDescription(ds);
String osgiJndiName = null;
if (dsDescription.getProperties() != null) {
osgiJndiName = dsDescription.getProperties().get(ConnectorModuleBuilder.OSGI_JNDI_SERVICE_NAME);
}
if (osgiJndiName == null) {
osgiJndiName = module.getEarContext().getNaming().toOsgiJndiName(dataSourceAbstractName);
}
dsDescription.setOsgiServiceName(osgiJndiName);
try {
Object ref = DataSourceService.buildReference(dsDescription);
put(jndiName, ref, ReferenceType.DATA_SOURCE, module.getJndiContext(), Collections.<InjectionTarget>emptySet(), sharedContext);
} catch (IOException e) {
throw new DeploymentException("Could not construct Reference for datasource " + dsDescription, e);
}
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-connector-builder-1_6
String jndiName = naming.toOsgiJndiName(connectionManagerAbstractName);
connectionManagerGBean.getServiceProperties().put(OSGI_JNDI_SERVICE_NAME, jndiName);
connectionManagerGBean.setAttribute("transactionSupport", transactionSupport);
内容来源于网络,如有侵权,请联系作者删除!