本文整理了Java中org.apache.geronimo.kernel.Naming.createChildName()
方法的一些代码示例,展示了Naming.createChildName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Naming.createChildName()
方法的具体详情如下:
包路径:org.apache.geronimo.kernel.Naming
类名称:Naming
方法名:createChildName
暂无
代码示例来源:origin: org.apache.geronimo.modules/geronimo-openejb-clustering-builder-wadi
protected AbstractName newGBeanName(DeploymentContext moduleContext, String name) {
return moduleContext.getNaming().createChildName(moduleContext.getModuleName(),
name,
GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-openejb-builder
public AbstractName createEjbName(EARContext earContext, EjbModule ejbModule, EnterpriseBean enterpriseBean) {
String ejbName = enterpriseBean.getEjbName();
String type = null;
if (enterpriseBean instanceof SessionBean) {
SessionBean sessionBean = (SessionBean) enterpriseBean;
switch (sessionBean.getSessionType()) {
case STATELESS:
type = NameFactory.STATELESS_SESSION_BEAN;
break;
case STATEFUL:
type = NameFactory.STATEFUL_SESSION_BEAN;
break;
case SINGLETON:
type = NameFactory.SINGLETON_BEAN;
break;
case MANAGED:
type = NameFactory.MANAGED_BEAN;
break;
}
} else if (enterpriseBean instanceof EntityBean) {
type = NameFactory.ENTITY_BEAN;
} else if (enterpriseBean instanceof MessageDrivenBean) {
type = NameFactory.MESSAGE_DRIVEN_BEAN;
}
if (type == null) {
throw new IllegalArgumentException("Unknown enterprise bean type XXX " + enterpriseBean.getClass().getName());
}
return earContext.getNaming().createChildName(ejbModule.getModuleName(), ejbName, type);
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-jetty6-builder
private GBeanData configureDefaultServlet(Object defaultServlet, EARContext earContext, AbstractName moduleName, Set knownServletMappings, EARContext moduleContext) throws GBeanNotFoundException, GBeanAlreadyExistsException {
GBeanData servletGBeanData = getGBeanData(kernel, defaultServlet);
AbstractName defaultServletObjectName = earContext.getNaming().createChildName(moduleName, (String) servletGBeanData.getAttribute("servletName"), NameFactory.SERVLET);
servletGBeanData.setAbstractName(defaultServletObjectName);
servletGBeanData.setReferencePattern("JettyServletRegistration", moduleName);
Set<String> defaultServletMappings = new HashSet<String>((Collection<String>) servletGBeanData.getAttribute("servletMappings"));
defaultServletMappings.removeAll(knownServletMappings);
servletGBeanData.setAttribute("servletMappings", defaultServletMappings);
moduleContext.addGBean(servletGBeanData);
return servletGBeanData;
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-corba-builder
switch (bean.type) {
case EnterpriseBeanInfo.STATELESS: {
return earContext.getNaming().createChildName(ejbModule.getModuleName(), name, NameFactory.STATELESS_SESSION_BEAN);
return earContext.getNaming().createChildName(ejbModule.getModuleName(), name, NameFactory.STATEFUL_SESSION_BEAN);
return earContext.getNaming().createChildName(ejbModule.getModuleName(), name, NameFactory.ENTITY_BEAN);
return earContext.getNaming().createChildName(ejbModule.getModuleName(), name, NameFactory.MESSAGE_DRIVEN_BEAN);
代码示例来源:origin: org.apache.geronimo.modules/geronimo-persistence-jpa20-builder
LinkedHashSet<GBeanData> gbeans = new LinkedHashSet<GBeanData>();
do {
AbstractName childName = module.getEarContext().getNaming().createChildName(module.getModuleName(), "", NameFactory.PERSISTENCE_UNIT);
Map<String, String> name = new HashMap<String, String>(childName.getName());
name.remove(NameFactory.J2EE_NAME);
代码示例来源: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-jetty8-clustering-builder-wadi
protected AbstractName addPreHandlerFactory(DeploymentContext moduleContext,
GBeanData webModuleData, AbstractName sessionManagerName) throws GBeanAlreadyExistsException {
AbstractName name = moduleContext.getNaming().createChildName(moduleContext.getModuleName(),
"WADIClusteredPreHandlerFactory", GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
GBeanData beanData = new GBeanData(name, WADIClusteredPreHandlerFactory.class);
beanData.setReferencePattern(WADIClusteredPreHandlerFactory.GBEAN_REF_WADI_SESSION_MANAGER, sessionManagerName);
webModuleData.setReferencePattern(WebAppContextWrapper.GBEAN_REF_PRE_HANDLER_FACTORY, name);
moduleContext.addGBean(beanData);
return name;
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-jetty8-clustering-builder-wadi
protected AbstractName addSessionHandlerFactory(DeploymentContext moduleContext,
GBeanData webModuleData, AbstractName sessionManagerName) throws GBeanAlreadyExistsException {
AbstractName name = moduleContext.getNaming().createChildName(moduleContext.getModuleName(),
"ClusteredSessionHandlerFactory", GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
GBeanData beanData = new GBeanData(name, ClusteredSessionHandlerFactory.class);
beanData.setReferencePattern(ClusteredSessionHandlerFactory.GBEAN_REF_SESSION_MANAGER, sessionManagerName);
webModuleData.setReferencePattern(WebAppContextWrapper.GBEAN_REF_SESSION_HANDLER_FACTORY, name);
moduleContext.addGBean(beanData);
return name;
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-persistence-jpa20-builder
AbstractName childName = module.getEarContext().getNaming().createChildName(module.getModuleName(), persistenceUnitName, NameFactory.PERSISTENCE_UNIT);
persistenceUnitNameQuery = new AbstractNameQuery(null, childName.getName(), PERSISTENCE_UNIT_INTERFACE_TYPES);
try {
代码示例来源:origin: org.apache.geronimo.modules/geronimo-jetty6-builder
private void configureHosts(EARContext earContext, JettyWebAppType jettyWebApp, GBeanData webModuleData) throws GBeanAlreadyExistsException {
String[] hosts = jettyWebApp.getHostArray();
for (int i = 0; i < hosts.length; i++) {
hosts[i] = hosts[i].trim();
}
String[] virtualHosts = jettyWebApp.getVirtualHostArray();
for (int i = 0; i < virtualHosts.length; i++) {
virtualHosts[i] = virtualHosts[i].trim();
}
if (hosts.length > 0 || virtualHosts.length > 0) {
//use name same as module
AbstractName hostName = earContext.getNaming().createChildName(webModuleData.getAbstractName(), "Host", "Host");
GBeanData hostData = new GBeanData(hostName, Host.GBEAN_INFO);
hostData.setAttribute("hosts", hosts);
hostData.setAttribute("virtualHosts", virtualHosts);
earContext.addGBean(hostData);
webModuleData.setReferencePattern("Host", hostName);
}
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-jetty6-builder
private void addFiltersGBeans(EARContext earContext, EARContext moduleContext, AbstractName moduleName, WebAppType webApp) throws GBeanAlreadyExistsException {
FilterType[] filterArray = webApp.getFilterArray();
for (FilterType filterType : filterArray) {
String filterName = filterType.getFilterName().getStringValue().trim();
AbstractName filterAbstractName = earContext.getNaming().createChildName(moduleName, filterName, NameFactory.WEB_FILTER);
GBeanData filterData = new GBeanData(filterAbstractName, JettyFilterHolder.GBEAN_INFO);
filterData.setAttribute("filterName", filterName);
filterData.setAttribute("filterClass", filterType.getFilterClass().getStringValue().trim());
Map<String, String> initParams = new HashMap<String, String>();
ParamValueType[] initParamArray = filterType.getInitParamArray();
for (ParamValueType paramValueType : initParamArray) {
initParams.put(paramValueType.getParamName().getStringValue().trim(), paramValueType.getParamValue().getStringValue().trim());
}
filterData.setAttribute("initParams", initParams);
filterData.setReferencePattern("JettyServletRegistration", moduleName);
moduleContext.addGBean(filterData);
}
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-clustering-builder-wadi
private AbstractName addHandlerFactory(DeploymentContext moduleContext,
GBeanData webModuleData, AbstractName sessionManagerName) throws GBeanAlreadyExistsException {
AbstractName name = moduleContext.getNaming().createChildName(moduleContext.getModuleName(),
"ClusteredWebApplicationHandlerFactory", NameFactory.GERONIMO_SERVICE);
GBeanData beanData = new GBeanData(name, ClusteredWebApplicationHandlerFactory.GBEAN_INFO);
beanData.setReferencePattern(ClusteredWebApplicationHandlerFactory.GBEAN_REF_SESSION_MANAGER, sessionManagerName);
webModuleData.setReferencePattern(JettyWebAppContext.GBEAN_REF_WEB_APPLICATION_HANDLER_FACTORY, name);
moduleContext.addGBean(beanData);
return name;
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-clustering-builder-wadi
private AbstractName addInterceptor(DeploymentContext moduleContext,
GBeanData webModuleData, AbstractName sessionManagerName) throws GBeanAlreadyExistsException {
AbstractName name = moduleContext.getNaming().createChildName(moduleContext.getModuleName(),
"WADIClusteredHandleInterceptor", NameFactory.GERONIMO_SERVICE);
GBeanData beanData = new GBeanData(name, WADIClusteredHandleInterceptor.GBEAN_INFO);
beanData.setReferencePattern(WADIClusteredHandleInterceptor.GBEAN_REF_WADI_SESSION_MANAGER, sessionManagerName);
webModuleData.setReferencePattern(JettyWebAppContext.GBEAN_REF_HANDLE_INTERCEPTOR, name);
moduleContext.addGBean(beanData);
return name;
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-jetty8-clustering-builder-wadi
protected AbstractName addSessionManager(GerClusteringWadiType clustering,
GBeanData webModuleData,
DeploymentContext moduleContext) throws GBeanAlreadyExistsException {
AbstractName name = moduleContext.getNaming().createChildName(moduleContext.getModuleName(),
"WADISessionManager", GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
GBeanData beanData = new GBeanData(name, BasicWADISessionManager.class);
setConfigInfo(clustering, webModuleData, beanData);
setCluster(clustering, beanData);
setBackingStrategyFactory(clustering, beanData);
moduleContext.addGBean(beanData);
return name;
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-activemq-gbean
/**
* Returns a new JMSConnector. Note that
* the connector may well require further customization before being fully
* functional (e.g. SSL settings for a secure connector).
*/
public JMSConnector addConnector(JMSBroker broker, String uniqueName, String protocol, String host, int port) {
AbstractName brokerAbstractName = kernel.getAbstractNameFor(broker);
AbstractName name = kernel.getNaming().createChildName(brokerAbstractName, uniqueName, NameFactory.GERONIMO_SERVICE);
GBeanData connector = new GBeanData(name, TransportConnectorGBeanImpl.GBEAN_INFO);
//todo: if SSL is supported, need to add more properties or use a different GBean?
connector.setAttribute("protocol", protocol);
connector.setAttribute("host", host);
connector.setAttribute("port", new Integer(port));
connector.setReferencePattern("brokerService", brokerAbstractName);
EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
if(mgr != null) {
try {
mgr.addGBeanToConfiguration(brokerAbstractName.getArtifact(), connector, false);
return (JMSConnector) kernel.getProxyManager().createProxy(name, ActiveMQConnector.class.getClassLoader());
} catch (InvalidConfigException e) {
log.error("Unable to add GBean", e);
return null;
} finally {
ConfigurationUtil.releaseConfigurationManager(kernel, mgr);
}
} else {
log.warn("The ConfigurationManager in the kernel does not allow editing");
return null;
}
}
代码示例来源: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-clustering-builder-wadi
private AbstractName addSessionManager(GerClusteringWadiType clustering, GBeanData webModuleData,
DeploymentContext moduleContext) throws GBeanAlreadyExistsException {
AbstractName name = moduleContext.getNaming().createChildName(moduleContext.getModuleName(),
"WADISessionManager", NameFactory.GERONIMO_SERVICE);
GBeanData beanData = new GBeanData(name, BasicWADISessionManager.GBEAN_INFO);
setConfigInfo(clustering, webModuleData, beanData);
setReplicationManagerFactory(clustering, beanData);
setReplicaStorageFactory(clustering, beanData);
setBackingStrategyFactory(clustering, beanData);
setDispatcher(clustering, beanData);
moduleContext.addGBean(beanData);
return name;
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-connector-builder
private void addAdminObjectGBeans(EARContext earContext, AbstractName jcaResourceName, GBeanData resourceAdapterModuleData, ClassLoader cl, 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(), cl);
// add it
AbstractName adminObjectAbstractName = earContext.getNaming().createChildName(jcaResourceName, gerAdminObjectInstance.getMessageDestinationName().trim(), NameFactory.JCA_ADMIN_OBJECT);
adminObjectInstanceGBeanData.setAbstractName(adminObjectAbstractName);
if (resourceAdapterAbstractName != null) {
adminObjectInstanceGBeanData.setReferencePattern("ResourceAdapterWrapper", resourceAdapterAbstractName);
}
try {
earContext.addGBean(adminObjectInstanceGBeanData);
} catch (GBeanAlreadyExistsException e) {
throw new DeploymentException("Could not add admin object gbean to context", e);
}
}
}
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-security-builder
private void buildJaccManager(EARContext earContext) throws DeploymentException {
if (earContext.isHasSecurity()) {
//Be sure to only set once per app
earContext.setHasSecurity(false);
AbstractName applicationPolicyManagerName = earContext.getNaming().createChildName(earContext.getModuleName(), SecurityNames.JACC_MANAGER, SecurityNames.JACC_MANAGER);
//TODO A better way to avoid the multiple invocation on securityBuilder.addGBeans ?
try {
if (earContext.getGBeanInstance(applicationPolicyManagerName) != null) {
return;
}
} catch (GBeanNotFoundException e1) {
}
AbstractNameQuery roleMapperDataName = (AbstractNameQuery)earContext.getGeneralData().get(ROLE_MAPPER_DATA_NAME);
if (roleMapperDataName == null) {
roleMapperDataName = defaultRoleMappingName;
EnvironmentBuilder.mergeEnvironments(earContext.getConfiguration().getEnvironment(), defaultEnvironment);
}
GBeanData jaccBeanData = configureApplicationPolicyManager(applicationPolicyManagerName, earContext.getContextIDToPermissionsMap());
jaccBeanData.setReferencePattern("PrincipalRoleMapper", roleMapperDataName);
try {
earContext.addGBean(jaccBeanData);
earContext.getGeneralData().put(EARContext.JACC_MANAGER_NAME_KEY, jaccBeanData.getAbstractName());
} catch (GBeanAlreadyExistsException e) {
throw new DeploymentException("JACC manager gbean already present", e);
}
}
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-jetty6-builder
private AbstractName addDefaultFiltersGBeans(EARContext earContext, EARContext moduleContext, AbstractName moduleName, AbstractName previous) throws GBeanNotFoundException, GBeanAlreadyExistsException {
for (Object defaultFilter : defaultFilters) {
GBeanData filterGBeanData = getGBeanData(kernel, defaultFilter);
String filterName = (String) filterGBeanData.getAttribute("filterName");
AbstractName defaultFilterAbstractName = earContext.getNaming().createChildName(moduleName, filterName, NameFactory.WEB_FILTER);
filterGBeanData.setAbstractName(defaultFilterAbstractName);
filterGBeanData.setReferencePattern("JettyServletRegistration", moduleName);
moduleContext.addGBean(filterGBeanData);
//add a mapping to /*
GBeanData filterMappingGBeanData = new GBeanData(JettyFilterMapping.GBEAN_INFO);
if (previous != null) {
filterMappingGBeanData.addDependency(previous);
}
filterMappingGBeanData.setReferencePattern("JettyServletRegistration", moduleName);
String urlPattern = "/*";
filterMappingGBeanData.setAttribute("urlPattern", urlPattern);
AbstractName filterMappingName = earContext.getNaming().createChildName(defaultFilterAbstractName, urlPattern, NameFactory.URL_WEB_FILTER_MAPPING);
filterMappingGBeanData.setAbstractName(filterMappingName);
previous = filterMappingName;
filterMappingGBeanData.setAttribute("requestDispatch", TRUE);
filterMappingGBeanData.setAttribute("forwardDispatch", TRUE);
filterMappingGBeanData.setAttribute("includeDispatch", TRUE);
filterMappingGBeanData.setAttribute("errorDispatch", FALSE);
filterMappingGBeanData.setReferencePattern("Filter", defaultFilterAbstractName);
moduleContext.addGBean(filterMappingGBeanData);
}
return previous;
}
内容来源于网络,如有侵权,请联系作者删除!