javax.naming.Binding.getName()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中javax.naming.Binding.getName()方法的一些代码示例,展示了Binding.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Binding.getName()方法的具体详情如下:
包路径:javax.naming.Binding
类名称:Binding
方法名:getName

Binding.getName介绍

暂无

代码示例

代码示例来源:origin: javamelody/javamelody

private static String getBindingName(String path, Binding binding) {
  // nécessaire pour glassfish 3.0.1
  String result = binding.getName();
  if (result.startsWith(JNDI_PREFIX)) {
    result = result.substring(JNDI_PREFIX.length());
  }
  if (result.startsWith(path)) {
    result = result.substring(path.length());
  }
  if (!result.isEmpty() && result.charAt(0) == '/') {
    result = result.substring(1);
  }
  return result;
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void objectRenamed(NamingEvent evt) {
  final String oldJndiName = evt.getOldBinding().getName();
  final String newJndiName = evt.getNewBinding().getName();
  LOG.factoryJndiRename( oldJndiName, newJndiName );
  final String uuid = nameUuidXref.remove( oldJndiName );
  nameUuidXref.put( newJndiName, uuid );
}

代码示例来源:origin: apache/activemq

/**
 * invoked when an entry has been renamed during a persistent search
 */
@Override
public void objectRenamed(NamingEvent event) {
  LOG.debug("entry renamed");
  // XXX: getNameInNamespace method does not seem to work properly,
  // but getName seems to provide the result we want
  String uuidOld = event.getOldBinding().getName();
  String uuidNew = event.getNewBinding().getName();
  URI connectorURI = uuidMap.remove(uuidOld);
  uuidMap.put(uuidNew, connectorURI);
  LOG.debug("connector reference renamed for URI [{}], Old UUID [{}], New UUID [{}]", new Object[]{ connectorURI, uuidOld, uuidNew });
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void objectRemoved(NamingEvent evt) {
  final String jndiName = evt.getOldBinding().getName();
  LOG.factoryUnboundFromName( jndiName );
  final String uuid = nameUuidXref.remove( jndiName );
  if ( uuid == null ) {
    // serious problem... but not sure what to do yet
  }
  sessionFactoryMap.remove( uuid );
}

代码示例来源:origin: wildfly/wildfly

protected List<NameClassPair> found(final ContextNode contextNode) throws NamingException {
  final List<NameClassPair> nameClassPairs = new ArrayList<NameClassPair>();
  for (TreeNode childNode : contextNode.children.values()) {
    final Binding binding = childNode.binding;
    nameClassPairs.add(new NameClassPair(binding.getName(), binding.getClassName(), true));
  }
  return nameClassPairs;
}

代码示例来源:origin: wildfly/wildfly

public static void tearDownRecursively(final Context c) throws Exception {
 for (NamingEnumeration<Binding> ne = c.listBindings(""); ne.hasMore(); ) {
   Binding b = ne.next();
   String name = b.getName();
   Object object = b.getObject();
   if (object instanceof Context) {
    JNDIUtil.tearDownRecursively((Context) object);
   }
   c.unbind(name);
 }
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void objectAdded(NamingEvent evt) {
  LOG.debugf( "A factory was successfully bound to name: %s", evt.getNewBinding().getName() );
}

代码示例来源:origin: wildfly/wildfly

private void invokeCacheUpdateListener(NamingEvent evt) {
    Binding oldBinding = evt.getOldBinding();
    LdapName ldapName;
    try {
      ldapName = new LdapName(oldBinding.getName());
    } catch (InvalidNameException e) {
      throw log.ldapInvalidLdapName(oldBinding.getName(), e);
    }
    ldapName.getRdns().stream()
        .filter(rdn -> rdn.getType().equals(identityMapping.rdnIdentifier))
        .map(rdn -> new NamePrincipal(rdn.getValue().toString()))
        .findFirst()
        .ifPresent(listener::accept);
  }
}

代码示例来源:origin: apache/activemq

/**
 * Handler for removed policy entries in the directory.
 *
 * @param namingEvent
 *            the removed entry event that occurred
 * @param destinationType
 *            the type of the destination to which the event applies
 * @param permissionType
 *            the permission type to which the event applies
 */
public void objectRemoved(NamingEvent namingEvent, DestinationType destinationType, PermissionType permissionType) {
  LOG.debug("Removing object: {}", namingEvent.getOldBinding());
  Binding result = namingEvent.getOldBinding();
  try {
    DefaultAuthorizationMap map = this.map.get();
    LdapName name = new LdapName(result.getName());
    AuthorizationEntry entry = getEntry(map, name, destinationType);
    applyAcl(entry, permissionType, new HashSet<Object>());
  } catch (InvalidNameException e) {
    LOG.error("Policy not applied!  Error parsing DN for object removal for removal of {}", result.getName(), e);
  } catch (Exception e) {
    LOG.error("Policy not applied!  Error processing object removal for removal of {}", result.getName(), e);
  }
}

代码示例来源:origin: apache/geode

public static Map<String, String> getBindingNamesRecursively(Context ctx) throws Exception {
  Map<String, String> result = new HashMap<>();
  NamingEnumeration<Binding> enumeration = ctx.listBindings("");

  while (enumeration.hasMore()) {
   Binding binding = enumeration.next();
   String name = binding.getName();
   String separator = name.endsWith(":") ? "" : "/";
   Object o = binding.getObject();
   if (o instanceof Context) {
    Map<String, String> innerBindings = getBindingNamesRecursively((Context) o);
    innerBindings.forEach((k, v) -> result.put(name + separator + k, v));
   } else {
    result.put(name, binding.getClassName());
   }
  }

  return result;
 }
}

代码示例来源:origin: apache/activemq

LdapName oldName = new LdapName(oldBinding.getName());
  ActiveMQDestination oldDest = formatDestination(oldName, destinationType);
  LdapName newName = new LdapName(newBinding.getName());
  ActiveMQDestination newDest = formatDestination(newName, destinationType);
      LOG.error("Policy not applied!  Error processing object rename for rename of {} to {}. Could not determine permission type of new object.", oldBinding.getName(), newBinding.getName());
  LOG.error("Policy not applied!  Error parsing DN for object rename for rename of {} to {}", new Object[]{ oldBinding.getName(), newBinding.getName() }, e);
} catch (Exception e) {
  LOG.error("Policy not applied!  Error processing object rename for rename of {} to {}", new Object[]{ oldBinding.getName(), newBinding.getName() }, e);

代码示例来源:origin: spring-projects/spring-framework

while (bindingEnum.hasMoreElements()) {
  Binding binding = (Binding) bindingEnum.nextElement();
  bindingMap.put(binding.getName(), binding);
while (subBindingEnum.hasMoreElements()) {
  Binding binding = (Binding) subBindingEnum.nextElement();
  subBindingMap.put(binding.getName(), binding);

代码示例来源:origin: apache/geode

/**
 * Removes all entries from the specified context, including subcontexts.
 *
 * @param context context to clear
 */
private void clearContext(Context context) throws NamingException {
 for (NamingEnumeration e = context.listBindings(""); e.hasMoreElements();) {
  Binding binding = (Binding) e.nextElement();
  if (binding.getObject() instanceof Context) {
   clearContext((Context) binding.getObject());
  }
  context.unbind(binding.getName());
 }
}

代码示例来源:origin: apache/geode

if (b.getName().equals("datasource")) {
 assertEquals(b.getObject(), dataSourceContext);
 datasourceFoundFlg = true;
 for (NamingEnumeration en1 = nextCon.listBindings(""); en1.hasMore();) {
  Binding b1 = (Binding) en1.next();
  if (b1.getName().equals("sub41")) {
   assertEquals(b1.getObject(), obj1);
   datasourceO1FoundFlg = true;
  } else if (b1.getName().equals("sub43")) {
} else if (b.getName().equals("sub42")) {
 assertEquals(b.getObject(), obj2);
 o2FoundFlg = true;

代码示例来源:origin: wildfly/wildfly

if (binding.getObject() instanceof Context) {
  marshaller.writeByte(Protocol.P_CONTEXT);
  marshaller.writeUTF(binding.getName());
} else {
  marshaller.writeByte(Protocol.P_BINDING);

代码示例来源:origin: crashub/crash

Binding instance = e.next();
String fullName = path + instance.getName();

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

public NameClassPair next()
  throws NamingException
{
  Binding b = _delegate.next();
  return new NameClassPair(b.getName(),b.getClassName(),true);
}

代码示例来源:origin: org.mortbay.jetty/jetty-naming

public Object nextElement()
  {
    Binding b = (Binding)_delegate.nextElement();
    return new NameClassPair (b.getName(), b.getClassName(), true);
  }
}

代码示例来源:origin: apache/activemq-artemis

public static void tearDownRecursively(final Context c) throws Exception {
 for (NamingEnumeration<Binding> ne = c.listBindings(""); ne.hasMore(); ) {
   Binding b = ne.next();
   String name = b.getName();
   Object object = b.getObject();
   if (object instanceof Context) {
    JNDIUtil.tearDownRecursively((Context) object);
   }
   c.unbind(name);
 }
}

代码示例来源:origin: org.mortbay.jetty/jetty-naming

public Object nextElement()
  {
    Binding b = (Binding)_delegate.nextElement();
    return new Binding (b.getName(), b.getClassName(), b.getObject(),true);
  }
}

相关文章