Package javax.naming

Examples of javax.naming.RefAddr


      Context ctx = getContainer().getInitialContext();
      String jndiName = this.getJndiName();
//      Name name = ctx.getNameParser("").parse(jndiName);
      //ctx = Util.createSubcontext(ctx, name.getPrefix(name.size() - 1));
      //String atom = name.get(name.size() - 1);
      RefAddr refAddr = new StringRefAddr(JndiSessionProxyObjectFactory.REF_ADDR_NAME_JNDI_BINDING_DELEGATE_PROXY_FACTORY, jndiName + PROXY_FACTORY_NAME);
      Reference ref = new Reference(Object.class.getName(), refAddr, JndiSessionProxyObjectFactory.class.getName(), null);
//      try
//      {
//         log.debug("Binding reference for " + getContainer().getEjbName() + " in JNDI at " + jndiName);
//         Util.rebind(ctx, atom, ref);
View Full Code Here


        assertThat(ref.getFactoryClassName(), is(SVNRepositorySource.class.getName()));

        Map<String, Object> refAttributes = new HashMap<String, Object>();
        Enumeration<RefAddr> enumeration = ref.getAll();
        while (enumeration.hasMoreElements()) {
            RefAddr addr = enumeration.nextElement();
            refAttributes.put(addr.getType(), addr.getContent());
        }

        assertThat((String)refAttributes.remove(SVNRepositorySource.SOURCE_NAME), is(source.getName()));
        assertThat((String)refAttributes.remove(SVNRepositorySource.SVN_REPOSITORY_ROOT_URL), is(source.getRepositoryRootURL()));
        assertThat((String)refAttributes.remove(SVNRepositorySource.SVN_USERNAME), is(source.getUsername()));
View Full Code Here

      log.debug("Cluster topology changed for family " + familyName + " new view id " + fci.getCurrentViewId()
            + " - Updating JNDI bindings for container " + beanClusteringInfo.getContainerName());

      for (JndiReferenceBinding binding : bindings.getDefaultRemoteBindings())
      {
         RefAddr refAddr = getFirstRefAddr(binding.getReference(),
               ClusteredProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_CLUSTER_FAMILY_NAME);
         if (refAddr != null && familyName.equals(refAddr.getContent()))
         {
            redecorateReferenceForClusteringTargets(binding.getReference(), fci);
            rebind(context, binding.getJndiName(), binding.getReference());
         }

         // The remote proxyfactory in JNDI too needs to be updated with the changes in the
         // clustering family. This involves unbinding the remote proxyfactory from JNDI,
         // creating a new proxy for the proxyfactory with this new FamilyCluster info
         // and finally binding this new proxy for the proxyfactory to the JNDI
         String proxyFactoryKey = this.getSingleRequiredRefAddr(binding.getReference(),
               ProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_PROXY_FACTORY_REGISTRY_KEY);
         // first create a new proxy. if we run into problems creating a new proxy,
         // let's NOT unbind the existing one since a change in topology should not
         // result in loss of proxy factory
         ProxyFactory existingProxyFactoryInJNDI = null;
         try
         {
            existingProxyFactoryInJNDI = (ProxyFactory) context.lookup(proxyFactoryKey);

         }
         catch (NamingException ne)
         {
            // ignore and skip. If there is not proxyfactory bound or if there is some other
            // issue related to naming, let's not try to "update" the proxy factory.
            log.debug("Could not update the cluster topology changes to proxyfactory at key " + proxyFactoryKey);
            continue;
         }
         // create a new proxy to proxyfactory with the available information in JNDI Reference,
         // the previously bound proxy to the proxyfactory and the beanClusteringInfo which has
         // contains the updated information of the cluster topology
         ProxyFactory updatedProxyToProxyFactory = this.updateProxyForRemoteProxyFactory(proxyFactoryKey, binding
               .getReference(), existingProxyFactoryInJNDI, beanClusteringInfo);
         try
         {
            Util.rebind(context, proxyFactoryKey, updatedProxyToProxyFactory);
            log.debug("Bound an updated proxyfactory at key " + proxyFactoryKey);
         }
         catch (NamingException ne)
         {
            // let's just log a WARN since we don't want the other operations to fail because of this
            log.warn("Exception while rebinding a new proxyfactory at key " + proxyFactoryKey
                  + " with updated clustered topology", ne);
         }

      }

      for (JndiReferenceBinding binding : bindings.getHomeRemoteBindings())
      {
         RefAddr refAddr = getFirstRefAddr(binding.getReference(),
               ClusteredProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_CLUSTER_FAMILY_NAME);
         if (refAddr != null && familyName.equals(refAddr.getContent()))
         {
            redecorateReferenceForClusteringTargets(binding.getReference(), fci);
            rebind(context, binding.getJndiName(), binding.getReference());
         }
      }

      for (Set<JndiReferenceBinding> businessBindings : bindings.getBusinessRemoteBindings().values())
      {
         for (JndiReferenceBinding binding : businessBindings)
         {
            RefAddr refAddr = getFirstRefAddr(binding.getReference(),
                  ClusteredProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_CLUSTER_FAMILY_NAME);
            if (refAddr != null && familyName.equals(refAddr.getContent()))
            {
               redecorateReferenceForClusteringTargets(binding.getReference(), fci);
               rebind(context, binding.getJndiName(), binding.getReference());
            }
         }
View Full Code Here

      {
         throw new IllegalStateException("Cannot find " + ProxyClusteringInfo.class.getSimpleName()
               + " for proxyFactoryKey " + proxyFactoryKey);
      }

      RefAddr partitionRef = new StringRefAddr(
            ClusteredProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_CLUSTER_PARTITION_NAME, bci.getPartitionName());
      addRefAddrToReference(ref, partitionRef);
      RefAddr lbpRef = new StringRefAddr(
            ClusteredProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_CLUSTER_PROXY_FACTORY_LOAD_BALANCE_POLICY, bci
                  .getHomeLoadBalancePolicy().getName());
      addRefAddrToReference(ref, lbpRef);
      FamilyClusterInfo fci = bci.getFamilyWrapper().get();
      RefAddr familyNameRef = new StringRefAddr(
            ClusteredProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_CLUSTER_FAMILY_NAME, fci.getFamilyName());
      addRefAddrToReference(ref, familyNameRef);

      decorateReferenceForClusteringTargets(ref, fci);
   }
View Full Code Here

    */
   private void redecorateReferenceForClusteringTargets(Reference ref, FamilyClusterInfo fci)
   {
      for (int i = 0; i < ref.size(); i++)
      {
         RefAddr refAddr = ref.get(i);
         if (ClusteredProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_CLUSTER_TARGET_INVOKER_LOCATOR_URL.equals(refAddr
               .getType()))
         {
            ref.remove(i);
            i--;
         }
View Full Code Here

         assert correctType : target + " is not an instance of InvokerLocator";
         if (!correctType)
            throw new IllegalStateException(target + " is not an instance of InvokerLocator");

         String url = ((InvokerLocator) target).getOriginalURI();
         RefAddr targetRef = new StringRefAddr(
               ClusteredProxyFactoryReferenceAddressTypes.REF_ADDR_TYPE_CLUSTER_TARGET_INVOKER_LOCATOR_URL, url);
         addRefAddrToReference(ref, targetRef);
      }
   }
View Full Code Here

      ref.add(refAddr);
   }

   private String getSingleRequiredRefAddr(Reference ref, String refAddrType)
   {
      RefAddr result = null;
      for (int i = 0; i < ref.size(); i++)
      {
         RefAddr refAddr = ref.get(i);
         if (refAddr.getType().equals(refAddrType))
         {
            if (result == null)
            {
               result = refAddr;
            }
View Full Code Here

   private RefAddr getFirstRefAddr(Reference ref, String refAddrType)
   {
      for (int i = 0; i < ref.size(); i++)
      {
         RefAddr refAddr = ref.get(i);
         if (refAddr.getType().equals(refAddrType))
         {
            return refAddr;
         }
      }
      return null;
View Full Code Here

   {
      if ( parameters != null )
      {
         Set      names         = parameters.getParameterNames(  );
         Iterator nameIterator  = names.iterator(  );
         RefAddr  parameter;
         String   parameterName;
         while ( nameIterator.hasNext(  ) )
         {
            parameterName    = (String) nameIterator.next(  );
            parameter        = new StringRefAddr( parameterName,
View Full Code Here

   {
      if ( parameters != null )
      {
         Set      names         = parameters.getParameterNames(  );
         Iterator nameIterator  = names.iterator(  );
         RefAddr  parameter;
         String   parameterName;
         while ( nameIterator.hasNext(  ) )
         {
            parameterName    = (String) nameIterator.next(  );
            parameter        = new StringRefAddr( parameterName,
View Full Code Here

TOP

Related Classes of javax.naming.RefAddr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.