Examples of JoinAdmin


Examples of net.jini.admin.JoinAdmin

        logger.log(Level.FINE, "run()");
        if(discoverySrvc == null) {
            throw new TestException("could not successfully start service "
            +serviceName);
        }
  JoinAdmin joinAdmin = JoinAdminUtil.getJoinAdmin(discoverySrvc);
  Entry[] curAttributes = joinAdmin.getLookupAttributes();
  AttributesUtil.displayAttributeSet(curAttributes,
             "curAttributes",
             Level.FINE);
  if (!AttributesUtil.compareAttributeSets(expectedAttributes,
             curAttributes,
View Full Code Here

Examples of net.jini.admin.JoinAdmin

        logger.log(Level.FINE, "run()");
        if(discoverySrvc == null) {
            throw new TestException("could not successfully start service "
            +serviceName);
        }
  JoinAdmin joinAdmin = JoinAdminUtil.getJoinAdmin(discoverySrvc);
  String[] oldGroups = joinAdmin.getLookupGroups();
  GroupsUtil.displayGroupSet(oldGroups,"oldGroups", Level.FINE);
  GroupsUtil.displayGroupSet(newGroupSet,"addGroups", Level.FINE);
  joinAdmin.addLookupGroups(newGroupSet);
  String[] newGroups = joinAdmin.getLookupGroups();
  GroupsUtil.displayGroupSet(newGroups,"newGroups", Level.FINE);
  if (!GroupsUtil.compareGroupSets(expectedGroups, newGroups, Level.FINE))
  {
      throw new TestException("Group sets are not equivalent");
  }
View Full Code Here

Examples of net.jini.admin.JoinAdmin

        logger.log(Level.FINE, "run()");
        if(discoverySrvc == null) {
            throw new TestException("could not successfully start service "
          + serviceName);
        }
  JoinAdmin joinAdmin = JoinAdminUtil.getJoinAdmin(discoverySrvc);
  String[] oldGroups = joinAdmin.getLookupGroups();
  GroupsUtil.displayGroupSet(oldGroups, "oldGroups", Level.FINE);
  GroupsUtil.displayGroupSet(removeGroupSet, "removeGroups", Level.FINE);
  joinAdmin.removeLookupGroups(removeGroupSet);
  String[] newGroups = joinAdmin.getLookupGroups();
  GroupsUtil.displayGroupSet(newGroups, "newGroups", Level.FINE);
  if (!GroupsUtil.compareGroupSets(expectedGroups,newGroups,Level.FINE)) {
      throw new TestException("Group sets are not equivalent");
  }
    }
View Full Code Here

Examples of net.jini.admin.JoinAdmin

        logger.log(Level.FINE, "run()");
        if(discoverySrvc == null) {
            throw new TestException("could not successfully start service "
          + serviceName);
        }
  JoinAdmin joinAdmin = JoinAdminUtil.getJoinAdmin(discoverySrvc);
  LookupLocator[] oldLocators = joinAdmin.getLookupLocators();
  LocatorsUtil.displayLocatorSet(oldLocators, "oldLocators", Level.FINE);
  LocatorsUtil.displayLocatorSet(removeLocatorSet,
               "removeLocators",
               Level.FINE);
  joinAdmin.removeLookupLocators(removeLocatorSet);
  LookupLocator[] newLocators = joinAdmin.getLookupLocators();
  LocatorsUtil.displayLocatorSet(newLocators, "newLocators", Level.FINE);
  if (!LocatorsUtil.compareLocatorSets(expectedLocators,
               newLocators,
               Level.FINE))
  {
View Full Code Here

Examples of net.jini.admin.JoinAdmin

        logger.log(Level.FINE, "run()");
        if(discoverySrvc == null) {
            throw new TestException("could not successfully start service "
            +serviceName);
        }
  JoinAdmin joinAdmin = JoinAdminUtil.getJoinAdmin(discoverySrvc);
  Entry[] oldAttributes = joinAdmin.getLookupAttributes();
  AttributesUtil.displayAttributeSet(oldAttributes,
             "oldAttributes",
             Level.FINE);
  AttributesUtil.displayAttributeSet(newAttributeSet,
             "addAttributes",
             Level.FINE);
  joinAdmin.addLookupAttributes(newAttributeSet);
  Entry[] newAttributes = joinAdmin.getLookupAttributes();
  AttributesUtil.displayAttributeSet(newAttributes,
             "newAttributes",
             Level.FINE);
  if (!AttributesUtil.compareAttributeSets(expectedAttributes,
             newAttributes,
View Full Code Here

Examples of net.jini.admin.JoinAdmin

        logger.log(Level.FINE, "run()");
        if(discoverySrvc == null) {
            throw new TestException("could not successfully start service "
            +serviceName);
        }
  JoinAdmin joinAdmin = JoinAdminUtil.getJoinAdmin(discoverySrvc);
  LookupLocator[] oldLocators = joinAdmin.getLookupLocators();
  LocatorsUtil.displayLocatorSet(oldLocators,"oldLocators", Level.FINE);
  LocatorsUtil.displayLocatorSet(newLocatorSet,"addLocators", Level.FINE);
  joinAdmin.addLookupLocators(newLocatorSet);
  LookupLocator[] newLocators = joinAdmin.getLookupLocators();
  LocatorsUtil.displayLocatorSet(newLocators,"newLocators", Level.FINE);
  if (!LocatorsUtil.compareLocatorSets(expectedLocators,
               newLocators,
               Level.FINE))
  {
View Full Code Here

Examples of net.jini.admin.JoinAdmin

        logger.log(Level.FINE, "run()");
        if(discoverySrvc == null) {
            throw new TestException("could not successfully start service "
          + serviceName);
        }
  JoinAdmin joinAdmin = JoinAdminUtil.getJoinAdmin(discoverySrvc);
  LookupLocator[] curLocators = joinAdmin.getLookupLocators();
  LocatorsUtil.displayLocatorSet(curLocators,"curLocators",
               Level.FINE);
  if (!LocatorsUtil.compareLocatorSets(expectedLocators,
               curLocators,
               Level.FINE))
View Full Code Here

Examples of net.jini.admin.JoinAdmin

                } else if (adminObject instanceof JoinAdmin) {
                    Entry[] configuredAttributes = getConfiguredAttributes(componentName,
                                                                           config,
                                                                           serviceName,
                                                                           context.getExportCodebase());
                    JoinAdmin joinAdmin = (JoinAdmin) adminObject;
                    ArrayList<Entry> addList = new ArrayList<Entry>();
                    logger.trace("OperationalString {}", opStringName);
                    /* Try and add an OperationalStringEntry */
                    if (opStringName != null && opStringName.length() > 0) {
                        Entry opStringEntry = loadEntry("org.rioproject.entry.OperationalStringEntry",
                                                        joinAdmin, opStringName, proxyCL);
                        if (opStringEntry != null) {
                            addList.add(opStringEntry);
                            logger.debug("Added OperationalStringEntry [{}] for {}",
                                         ((OperationalStringEntry)opStringEntry).name, serviceName);
                        } else {
                            logger.warn("Unable to obtain the OperationalStringEntry for {}", serviceName);
                        }
                    } else {
                        logger.trace("OperationalString name is {}", (opStringName == null ? "[null]" : "[empty string]"));
                    }

                    /* Next, try and add the net.jini.lookup.entry.Host */
                    Entry hostEntry = loadEntry("net.jini.lookup.entry.Host", joinAdmin, hostAddress, proxyCL);
                    if (hostEntry != null) {
                        addList.add(hostEntry);
                        logger.debug("Added Host [{}] for {}", ((Host)hostEntry).hostName, serviceName);
                    } else {
                        logger.warn("Unable to obtain the Host entry for {}", serviceName);
                    }

                    /* Process the net.jini.lookup.entry.Name attribute */
                    try {
                        Class<?> nameClass = proxyCL.loadClass("net.jini.lookup.entry.Name");
                        Constructor cons = nameClass.getConstructor(String.class);
                        Entry name = (Entry) cons.newInstance(serviceName);
                        boolean add = true;
                        /* Check if the service already has a Name, if it does
                         * ensure it is not the same name as the one this
                         * utility is prepared to add */
                        Entry[] attributes = joinAdmin.getLookupAttributes();
                        for (Entry attribute : attributes) {
                            if (attribute.getClass().getName().equals(nameClass.getName())) {
                                Field n = attribute.getClass().getDeclaredField("name");
                                String value = (String) n.get(attribute);
                                if (value.equals(serviceName))
                                    add = false;
                                break;
                            }
                        }
                        if (add)
                            addList.add(name);

                    } catch (Exception e) {
                        logger.warn("Name not found, cannot add a Name Entry", e);
                    }

                    /* If running forked, add JMX connection entries */
                    if(logger.isTraceEnabled())
                        logger.trace("Service: {}, forked? {}", serviceName, forked);
                    if(forked) {
                        Collections.addAll(addList, JMXUtil.getJMXConnectionEntries());
                    }

                    addList.addAll(context.getServiceBeanConfig().getAdditionalEntries());

                    /* If any additional attributes (including the
                     * OperationalString and Name entry already processed) are
                     * passed in, include them as well */
                    addList.addAll(Arrays.asList(configuredAttributes));

                    /* If we have Entry objects to add, add them */
                    if (!addList.isEmpty()) {
                        Entry[] adds = addList.toArray(new Entry[addList.size()]);
                        addAttributes(adds, joinAdmin);
                    }
                    /* Apply groups to the JoinAdmin */
                    if (groups == null || groups.length == 0)
                        groups = LookupDiscovery.NO_GROUPS;
                    if (groups != null && groups.length > 0) {
                        if (groups.length == 1 && groups[0].equals("all")) {
                            groups = LookupDiscovery.ALL_GROUPS;
                        } else {
                            for (int i = 0; i < groups.length; i++) {
                                if (groups[i].equals("public"))
                                    groups[i] = "";
                            }
                        }
                    }
                    if (logger.isTraceEnabled()) {
                        StringBuilder buff = new StringBuilder();
                        if (groups == null || groups.length == 0) {
                            buff.append("LookupDiscovery.NO_GROUPS");
                        } else {
                            for (int i = 0; i < groups.length; i++) {
                                if (i > 0)
                                    buff.append(",");
                                buff.append(groups[i]);
                            }
                        }
                        logger.trace("Setting groups [{}] using JoinAdmin.setLookupGroups", buff.toString());
                    }
                    joinAdmin.setLookupGroups(groups);
                    if (!lookupLocators.isEmpty()) {
                        if (logger.isTraceEnabled()) {
                            StringBuilder buff = new StringBuilder();
                            for (LookupLocator lookupLocator : lookupLocators) {
                                if (buff.length()>0 )
                                    buff.append(",");
                                buff.append(lookupLocator.toString());
                            }
                            logger.trace("Setting locators [{}] using JoinAdmin.setLookupLocators", buff.toString());
                        }
                        joinAdmin.setLookupLocators(lookupLocators.toArray(new LookupLocator[lookupLocators.size()]));
                    }
                } else {
                    logger.error("Admin must implement JoinAdmin or ServiceBeanControl to be properly advertised");
                }

View Full Code Here

Examples of net.jini.admin.JoinAdmin

                    boolean hailMaryCheck = false;
                    if (service instanceof Administrable) {
                        Administrable admin = (Administrable) service;
                        Object adminObject = admin.getAdmin();
                        if (adminObject instanceof JoinAdmin) {
                            JoinAdmin joinAdmin = (JoinAdmin) adminObject;
                            Entry[] attrs = joinAdmin.getLookupAttributes();
                            boolean matched = false;
                            for (Entry attr : attrs) {
                                if (attr instanceof Name) {
                                    if (aDesc.getName().equals(((Name) attr).name)) {
                                        matched = true;
View Full Code Here

Examples of net.jini.admin.JoinAdmin

                try {
                    Administrable admin = (Administrable) serviceProxy;
                    Object adminObject;
                    adminObject = admin.getAdmin();
                    if (adminObject instanceof JoinAdmin) {
                        JoinAdmin joinAdmin = (JoinAdmin) adminObject;
                        /* Update groups if they have changed */
                        if (hasDifferentGroups) {
                            joinAdmin.setLookupGroups(postElem.getServiceBeanConfig().getGroups());
                        }
                        /* Update locators if they have changed */
                        if (hasDifferentLocators)
                            joinAdmin.setLookupLocators(postElem.getServiceBeanConfig().getLocators());
                    } else {
                        logger.debug("No JoinAdmin capabilities for {}", context.getServiceElement().getName());
                    }
                } catch (RemoteException e) {
                    logger.error("Modifying Discovery attributes", e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.