Example usage for javax.management Attribute Attribute

List of usage examples for javax.management Attribute Attribute

Introduction

In this page you can find the example usage for javax.management Attribute Attribute.

Prototype

public Attribute(String name, Object value) 

Source Link

Document

Constructs an Attribute object which associates the given attribute name with the given value.

Usage

From source file:net.lightbody.bmp.proxy.jetty.util.jmx.ModelMBeanImpl.java

public AttributeList setAttributes(AttributeList attrs) {
    log.debug("setAttributes");

    AttributeList results = new AttributeList(attrs.size());
    Iterator iter = attrs.iterator();
    while (iter.hasNext()) {
        try {// w  ww . j  a v a  2  s  .com
            Attribute attr = (Attribute) iter.next();
            setAttribute(attr);
            results.add(new Attribute(attr.getName(), getAttribute(attr.getName())));
        } catch (Exception e) {
            log.warn(LogSupport.EXCEPTION, e);
        }
    }
    return results;
}

From source file:com.betfair.testing.utils.cougar.helpers.CougarHelpers.java

private void setJMXMBeanAttribute(String mBeanName, String attributeName, Object newMbeanValue) {

    try {//from w  ww.j  av  a  2  s . c  o  m
        MBeanServerConnection mBeanServerConnection = getJMXConnection();
        ObjectName mbeanName = new ObjectName(mBeanName);
        Object currentAttributeValue = mBeanServerConnection.getAttribute(mbeanName, attributeName);
        Object reflectedValue = reflect.getRealProperty(currentAttributeValue.getClass(), newMbeanValue);
        Attribute attribute = new Attribute(attributeName, reflectedValue);
        mBeanServerConnection.setAttribute(mbeanName, attribute);
    } catch (Exception e) {
        throw new RuntimeException(JMX_SETTING_ERROR + mBeanName + ": " + attributeName, e);
    }
}

From source file:org.rhq.enterprise.gui.startup.StartupServlet.java

/**
 * Starts the embedded agent, but only if the embedded agent is installed and it is enabled.
 *
 * @throws ServletException if the agent is installed and enabled but failed to start
 */// w ww  . j  a v a2s  .  c o  m
private void startEmbeddedAgent() throws ServletException {
    // we can't use EmbeddedAgentBootstrapServiceMBean because if the embedded agent
    // isn't installed, that class will not be available; we must use JMX API
    final ObjectName agentBootstrapMBean = ObjectNameFactory.create("rhq:service=EmbeddedAgentBootstrap");
    final String agentEnabledAttribute = "AgentEnabled";
    final String startAgentMethod = "startAgent";
    final String configurationOverridesAttribute = "ConfigurationOverrides";
    final MBeanServer mbs = MBeanServerLocator.locateJBoss();

    try {
        // this will fail if the embedded agent isn't installed
        String enabled = (String) mbs.getAttribute(agentBootstrapMBean, agentEnabledAttribute);

        // if we got this far, the embedded agent is at least installed
        // now check to see if its enabled - if so start it; any startup exceptions now are thrown
        try {
            if (Boolean.valueOf(enabled)) {
                log.info("The embedded Agent is installed and enabled - it will now be started...");

                // NOTE: we cannot directly import AgentConfigurationConstants, so we hardcode the
                // actual constant values here - need to keep an eye on these in the unlikely event
                // the constant values change.
                String AgentConfigurationConstants_SERVER_TRANSPORT = "rhq.agent.server.transport";
                String AgentConfigurationConstants_SERVER_BIND_ADDRESS = "rhq.agent.server.bind-address";
                String AgentConfigurationConstants_SERVER_BIND_PORT = "rhq.agent.server.bind-port";

                // Get the configuration overrides as set in the configuration file.
                // If the agent's bind address isn't overridden with a non-empty value,
                // then we need to get the Server bind address and use it for the agent's bind address.
                // If the agent's server endpoint address/port are empty, we again use the values
                // appropriate for the Server this agent is embedded in.
                // Note that we don't look for the values in persisted preferences - we assume they
                // are always present in the configuration overrides (which they should always be);
                Properties overrides;
                String serverTransport;
                String serverAddress;
                String serverPort;
                String agentAddress;

                overrides = (Properties) mbs.getAttribute(agentBootstrapMBean, configurationOverridesAttribute);

                serverTransport = overrides.getProperty(AgentConfigurationConstants_SERVER_TRANSPORT);
                serverAddress = overrides.getProperty(AgentConfigurationConstants_SERVER_BIND_ADDRESS);
                serverPort = overrides.getProperty(AgentConfigurationConstants_SERVER_BIND_PORT);
                agentAddress = overrides
                        .getProperty(ServiceContainerConfigurationConstants.CONNECTOR_BIND_ADDRESS);

                Server server = LookupUtil.getServerManager().getServer();

                if (agentAddress == null || agentAddress.trim().equals("")) {
                    overrides.setProperty(ServiceContainerConfigurationConstants.CONNECTOR_BIND_ADDRESS,
                            server.getAddress());
                }
                if (serverAddress == null || serverAddress.trim().equals("")) {
                    overrides.setProperty(AgentConfigurationConstants_SERVER_BIND_ADDRESS, server.getAddress());
                }
                if (serverPort == null || serverPort.trim().equals("")) {
                    if (SecurityUtil.isTransportSecure(serverTransport)) {
                        overrides.setProperty(AgentConfigurationConstants_SERVER_BIND_PORT,
                                Integer.toString(server.getSecurePort()));
                    } else {
                        overrides.setProperty(AgentConfigurationConstants_SERVER_BIND_PORT,
                                Integer.toString(server.getPort()));
                    }
                }

                mbs.setAttribute(agentBootstrapMBean,
                        new Attribute(configurationOverridesAttribute, overrides));

                // We need to do the agent startup in a separate thread so we do not hang
                // this startup servlet.  JBossAS 4.2 will not begin accepting HTTP requests
                // until this startup servlet has finished (this is different from JBossAS 4.0).
                // The agent needs to submit an HTTP request in order to complete its startup
                // (it needs to register with the server).
                // The side effect of this is the RHQ Server will still start even if the embedded
                // agent fails to start - this may not be a bad thing.  We probably do not want
                // the entire RHQ Server to go down if its agent fails to start.
                Runnable agentStartRunnable = new Runnable() {
                    public void run() {
                        // this returns only when the agent has started and is registered (sends HTTP request)
                        try {
                            mbs.invoke(agentBootstrapMBean, startAgentMethod, new Object[0], new String[0]);
                        } catch (Throwable t) {
                            log.error("Failed to start the embedded Agent - it will not be available!", t);
                        }
                    }
                };

                Thread agentStartThread = new Thread(agentStartRunnable, "Embedded Agent Startup");
                agentStartThread.setDaemon(true);
                agentStartThread.start();
            } else {
                log.debug("The embedded Agent is not enabled, so it will not be started.");
            }
        } catch (Throwable t) {
            throw new ServletException("Failed to start the embedded Agent.", t);
        }
    } catch (ServletException se) {
        throw se;
    } catch (Throwable t) {
        log.info("The embedded Agent is not installed, so it will not be started (" + t + ").");
    }

    return;
}

From source file:org.archive.crawler.admin.CrawlJobHandler.java

/**
 * Creates a new settings handler based on an existing job. Basically all
 * the settings file for the 'based on' will be copied to the specified
 * directory./*from www. j a  va 2  s.  c  om*/
 *
 * @param orderFile Order file to base new order file on.  Cannot be null.
 * @param name Name for the new settings
 * @param description Description of the new settings.
 * @param seeds The contents of the new settings' seed file.
 * @param newSettingsDir
 * @param errorHandler
 * @param filename Name of new order file.
 * @param seedfile Name of new seeds file.
 *
 * @return The new settings handler.
 * @throws FatalConfigurationException
 *             If there are problems with reading the 'base on'
 *             configuration, with writing the new configuration or it's
 *             seed file.
 */
protected XMLSettingsHandler createSettingsHandler(final File orderFile, final String name,
        final String description, final String seeds, final File newSettingsDir,
        final CrawlJobErrorHandler errorHandler, final String filename, final String seedfile)
        throws FatalConfigurationException {
    XMLSettingsHandler newHandler = null;
    try {
        newHandler = new XMLSettingsHandler(orderFile);
        if (errorHandler != null) {
            newHandler.registerValueErrorHandler(errorHandler);
        }
        newHandler.setErrorReportingLevel(errorHandler.getLevel());
        newHandler.initialize();
    } catch (InvalidAttributeValueException e2) {
        throw new FatalConfigurationException("InvalidAttributeValueException occured while creating"
                + " new settings handler for new job/profile\n" + e2.getMessage());
    }

    // Make sure the directory exists.
    newSettingsDir.mkdirs();

    try {
        // Set the seed file
        ((ComplexType) newHandler.getOrder().getAttribute("scope"))
                .setAttribute(new Attribute("seedsfile", seedfile));
    } catch (AttributeNotFoundException e1) {
        throw new FatalConfigurationException(
                "AttributeNotFoundException occured while setting up" + "new job/profile\n" + e1.getMessage());
    } catch (InvalidAttributeValueException e1) {
        throw new FatalConfigurationException("InvalidAttributeValueException occured while setting"
                + "up new job/profile\n" + e1.getMessage());
    } catch (MBeanException e1) {
        throw new FatalConfigurationException(
                "MBeanException occured while setting up new" + " job/profile\n" + e1.getMessage());
    } catch (ReflectionException e1) {
        throw new FatalConfigurationException(
                "ReflectionException occured while setting up" + " new job/profile\n" + e1.getMessage());
    }

    File newFile = new File(newSettingsDir.getAbsolutePath(), filename);

    try {
        newHandler.copySettings(newFile,
                (String) newHandler.getOrder().getAttribute(CrawlOrder.ATTR_SETTINGS_DIRECTORY));
    } catch (IOException e3) {
        // Print stack trace to help debug issue where cannot create
        // new job from an old that has overrides.
        e3.printStackTrace();
        throw new FatalConfigurationException("IOException occured while writing new settings files"
                + " for new job/profile\n" + e3.getMessage());
    } catch (AttributeNotFoundException e) {
        throw new FatalConfigurationException("AttributeNotFoundException occured while writing new"
                + " settings files for new job/profile\n" + e.getMessage());
    } catch (MBeanException e) {
        throw new FatalConfigurationException("MBeanException occured while writing new settings files"
                + " for new job/profile\n" + e.getMessage());
    } catch (ReflectionException e) {
        throw new FatalConfigurationException("ReflectionException occured while writing new settings"
                + " files for new job/profile\n" + e.getMessage());
    }
    CrawlerSettings orderfile = newHandler.getSettingsObject(null);

    orderfile.setName(name);
    orderfile.setDescription(description);

    if (seeds != null) {
        BufferedWriter writer = null;
        try {
            writer = new BufferedWriter(new OutputStreamWriter(
                    new FileOutputStream(newHandler.getPathRelativeToWorkingDirectory(seedfile)), "UTF-8"));
            try {
                writer.write(seeds);
            } finally {
                writer.close();
            }
        } catch (IOException e) {
            throw new FatalConfigurationException(
                    "IOException occured while writing seed file for new" + " job/profile\n" + e.getMessage());
        }
    }
    return newHandler;
}

From source file:com.cyberway.issue.crawler.admin.CrawlJobHandler.java

/**
 * Creates a new settings handler based on an existing job. Basically all
 * the settings file for the 'based on' will be copied to the specified
 * directory./*w  w w .j  a  v  a 2 s  .  c o  m*/
 *
 * @param orderFile Order file to base new order file on.  Cannot be null.
 * @param name Name for the new settings
 * @param description Description of the new settings.
 * @param seeds The contents of the new settings' seed file.
 * @param newSettingsDir
 * @param errorHandler
 * @param filename Name of new order file.
 * @param seedfile Name of new seeds file.
 *
 * @return The new settings handler.
 * @throws FatalConfigurationException
 *             If there are problems with reading the 'base on'
 *             configuration, with writing the new configuration or it's
 *             seed file.
 */
protected XMLSettingsHandler createSettingsHandler(final File orderFile, final String name,
        final String description, final String seeds, final File newSettingsDir,
        final CrawlJobErrorHandler errorHandler, final String filename, final String seedfile)
        throws FatalConfigurationException {
    XMLSettingsHandler newHandler = null;
    try {
        newHandler = new XMLSettingsHandler(orderFile);
        if (errorHandler != null) {
            newHandler.registerValueErrorHandler(errorHandler);
        }
        newHandler.setErrorReportingLevel(errorHandler.getLevel());
        newHandler.initialize();
    } catch (InvalidAttributeValueException e2) {
        throw new FatalConfigurationException("InvalidAttributeValueException occured while creating"
                + " new settings handler for new job/profile\n" + e2.getMessage());
    }

    // Make sure the directory exists.
    newSettingsDir.mkdirs();

    try {
        // Set the seed file
        ((ComplexType) newHandler.getOrder().getAttribute("scope"))
                .setAttribute(new Attribute("seedsfile", seedfile));
    } catch (AttributeNotFoundException e1) {
        throw new FatalConfigurationException(
                "AttributeNotFoundException occured while setting up" + "new job/profile\n" + e1.getMessage());
    } catch (InvalidAttributeValueException e1) {
        throw new FatalConfigurationException("InvalidAttributeValueException occured while setting"
                + "up new job/profile\n" + e1.getMessage());
    } catch (MBeanException e1) {
        throw new FatalConfigurationException(
                "MBeanException occured while setting up new" + " job/profile\n" + e1.getMessage());
    } catch (ReflectionException e1) {
        throw new FatalConfigurationException(
                "ReflectionException occured while setting up" + " new job/profile\n" + e1.getMessage());
    }

    File newFile = new File(newSettingsDir.getAbsolutePath(), filename);

    try {
        newHandler.copySettings(newFile,
                (String) newHandler.getOrder().getAttribute(CrawlOrder.ATTR_SETTINGS_DIRECTORY));
    } catch (IOException e3) {
        // Print stack trace to help debug issue where cannot create
        // new job from an old that has overrides.
        e3.printStackTrace();
        throw new FatalConfigurationException("IOException occured while writing new settings files"
                + " for new job/profile\n" + e3.getMessage());
    } catch (AttributeNotFoundException e) {
        throw new FatalConfigurationException("AttributeNotFoundException occured while writing new"
                + " settings files for new job/profile\n" + e.getMessage());
    } catch (MBeanException e) {
        throw new FatalConfigurationException("MBeanException occured while writing new settings files"
                + " for new job/profile\n" + e.getMessage());
    } catch (ReflectionException e) {
        throw new FatalConfigurationException("ReflectionException occured while writing new settings"
                + " files for new job/profile\n" + e.getMessage());
    }
    CrawlerSettings orderfile = newHandler.getSettingsObject(null);

    orderfile.setName(name);
    orderfile.setDescription(description);

    if (seeds != null) {
        BufferedWriter writer = null;
        try {
            writer = new BufferedWriter(new FileWriter(newHandler.getPathRelativeToWorkingDirectory(seedfile)));
            try {
                writer.write(seeds);
            } finally {
                writer.close();
            }
        } catch (IOException e) {
            throw new FatalConfigurationException(
                    "IOException occured while writing seed file for new" + " job/profile\n" + e.getMessage());
        }
    }
    return newHandler;
}

From source file:com.betfair.testing.utils.cougar.helpers.CougarHelpers.java

public void setJMXMBeanAttributeValue(String mBeanName, String attributeName, Object value) {

    try {/*w w w.  ja v  a2 s .  com*/
        MBeanServerConnection mBeanServerConnection = getJMXConnection();
        ObjectName mbeanName = new ObjectName(mBeanName);
        Attribute attr = new Attribute(attributeName, value);
        mBeanServerConnection.setAttribute(mbeanName, attr);

    } catch (Exception e) {
        throw new RuntimeException(JMX_RETRIEVAL_ERROR + mBeanName + ": " + attributeName, e);
    }
}

From source file:org.rhq.enterprise.server.core.StartupBean.java

/**
 * Starts the embedded agent, but only if the embedded agent is installed and it is enabled.
 *
 * @throws RuntimeException if the agent is installed and enabled but failed to start
 *
 * @deprecated we don't have an embedded agent anymore, leaving this in case we resurrect it
 *///  w  w w. j a v  a2s.c  o m
@Deprecated
private void startEmbeddedAgent() throws RuntimeException {
    // we can't use EmbeddedAgentBootstrapServiceMBean because if the embedded agent
    // isn't installed, that class will not be available; we must use JMX API
    final ObjectName agentBootstrapMBean = ObjectNameFactory.create("rhq:service=EmbeddedAgentBootstrap");
    final String agentEnabledAttribute = "AgentEnabled";
    final String startAgentMethod = "startAgent";
    final String configurationOverridesAttribute = "ConfigurationOverrides";
    final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();

    try {
        // this will fail if the embedded agent isn't installed
        String enabled = (String) mbs.getAttribute(agentBootstrapMBean, agentEnabledAttribute);

        // if we got this far, the embedded agent is at least installed
        // now check to see if its enabled - if so start it; any startup exceptions now are thrown
        try {
            if (Boolean.valueOf(enabled)) {
                log.info("The embedded Agent is installed and enabled - it will now be started...");

                // NOTE: we cannot directly import AgentConfigurationConstants, so we hardcode the
                // actual constant values here - need to keep an eye on these in the unlikely event
                // the constant values change.
                String AgentConfigurationConstants_SERVER_TRANSPORT = "rhq.agent.server.transport";
                String AgentConfigurationConstants_SERVER_BIND_ADDRESS = "rhq.agent.server.bind-address";
                String AgentConfigurationConstants_SERVER_BIND_PORT = "rhq.agent.server.bind-port";

                // Get the configuration overrides as set in the configuration file.
                // If the agent's bind address isn't overridden with a non-empty value,
                // then we need to get the Server bind address and use it for the agent's bind address.
                // If the agent's server endpoint address/port are empty, we again use the values
                // appropriate for the Server this agent is embedded in.
                // Note that we don't look for the values in persisted preferences - we assume they
                // are always present in the configuration overrides (which they should always be);
                Properties overrides;
                String serverTransport;
                String serverAddress;
                String serverPort;
                String agentAddress;

                overrides = (Properties) mbs.getAttribute(agentBootstrapMBean, configurationOverridesAttribute);

                serverTransport = overrides.getProperty(AgentConfigurationConstants_SERVER_TRANSPORT);
                serverAddress = overrides.getProperty(AgentConfigurationConstants_SERVER_BIND_ADDRESS);
                serverPort = overrides.getProperty(AgentConfigurationConstants_SERVER_BIND_PORT);
                agentAddress = overrides
                        .getProperty(ServiceContainerConfigurationConstants.CONNECTOR_BIND_ADDRESS);

                Server server = serverManager.getServer();

                if (agentAddress == null || agentAddress.trim().equals("")) {
                    overrides.setProperty(ServiceContainerConfigurationConstants.CONNECTOR_BIND_ADDRESS,
                            server.getAddress());
                }
                if (serverAddress == null || serverAddress.trim().equals("")) {
                    overrides.setProperty(AgentConfigurationConstants_SERVER_BIND_ADDRESS, server.getAddress());
                }
                if (serverPort == null || serverPort.trim().equals("")) {
                    if (SecurityUtil.isTransportSecure(serverTransport)) {
                        overrides.setProperty(AgentConfigurationConstants_SERVER_BIND_PORT,
                                Integer.toString(server.getSecurePort()));
                    } else {
                        overrides.setProperty(AgentConfigurationConstants_SERVER_BIND_PORT,
                                Integer.toString(server.getPort()));
                    }
                }

                mbs.setAttribute(agentBootstrapMBean,
                        new Attribute(configurationOverridesAttribute, overrides));

                // We need to do the agent startup in a separate thread so we do not hang
                // this startup servlet.  JBossAS 4.2 will not begin accepting HTTP requests
                // until this startup servlet has finished (this is different from JBossAS 4.0).
                // The agent needs to submit an HTTP request in order to complete its startup
                // (it needs to register with the server).
                // The side effect of this is the RHQ Server will still start even if the embedded
                // agent fails to start - this may not be a bad thing.  We probably do not want
                // the entire RHQ Server to go down if its agent fails to start.
                Runnable agentStartRunnable = new Runnable() {
                    public void run() {
                        // this returns only when the agent has started and is registered (sends HTTP request)
                        try {
                            mbs.invoke(agentBootstrapMBean, startAgentMethod, new Object[0], new String[0]);
                        } catch (Throwable t) {
                            log.error("Failed to start the embedded Agent - it will not be available!", t);
                        }
                    }
                };

                Thread agentStartThread = new Thread(agentStartRunnable, "Embedded Agent Startup");
                agentStartThread.setDaemon(true);
                agentStartThread.start();
            } else {
                log.debug("The embedded Agent is not enabled, so it will not be started.");
            }
        } catch (Throwable t) {
            throw new RuntimeException("Failed to start the embedded Agent.", t);
        }
    } catch (RuntimeException se) {
        throw se;
    } catch (Throwable t) {
        log.info("The embedded Agent is not installed, so it will not be started (" + t + ").");
    }

    return;
}

From source file:com.cyberway.issue.crawler.admin.CrawlJobHandler.java

/**
 * @param recover//from w  ww  .  ja v  a2 s.  c  o  m
 *            Source to use recovering. Can be full path to a recovery log
 *            or full path to a checkpoint src dir.
 * @param newHandler
 * @throws ReflectionException
 * @throws MBeanException
 * @throws InvalidAttributeValueException
 * @throws AttributeNotFoundException
 * @throws IOException
 */
private void updateRecoveryPaths(final File recover, SettingsHandler newHandler)
        throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException,
        IOException {
    if (recover == null || !recover.exists()) {
        throw new IOException("Recovery src does not exist: " + recover);
    }
    newHandler.getOrder().setAttribute(new Attribute(CrawlOrder.ATTR_RECOVER_PATH, recover.getAbsolutePath()));

    // Now, ensure that 'logs' and 'state' don't overlap with
    // previous job's files (ok for 'arcs' and 'scratch' to overlap)
    File newLogsDisk = null;
    final String RECOVERY_SUFFIX = "-R";
    while (true) {
        try {
            newLogsDisk = newHandler.getOrder().getSettingsDir(CrawlOrder.ATTR_LOGS_PATH);
        } catch (AttributeNotFoundException e) {
            logger.log(Level.SEVERE, "Failed to get logs directory", e);
        }
        if (newLogsDisk.list().length > 0) {
            // 'new' directory is nonempty; rename with trailing '-R'
            String logsPath = (String) newHandler.getOrder().getAttribute(CrawlOrder.ATTR_LOGS_PATH);
            if (logsPath.endsWith("/")) {
                logsPath = logsPath.substring(0, logsPath.length() - 1);
            }
            newHandler.getOrder()
                    .setAttribute(new Attribute(CrawlOrder.ATTR_LOGS_PATH, logsPath + RECOVERY_SUFFIX));
        } else {
            // directory is suitably empty; exit loop
            break;
        }
    }
    File newStateDisk = null;
    while (true) {
        try {
            newStateDisk = newHandler.getOrder().getSettingsDir(CrawlOrder.ATTR_STATE_PATH);
        } catch (AttributeNotFoundException e) {
            logger.log(Level.SEVERE, "Failed to get state directory", e);
        }
        if (newStateDisk.list().length > 0) {
            // 'new' directory is nonempty; rename with trailing '-R'
            String statePath = (String) newHandler.getOrder().getAttribute(CrawlOrder.ATTR_STATE_PATH);
            if (statePath.endsWith("/")) {
                statePath = statePath.substring(0, statePath.length() - 1);
            }
            newHandler.getOrder()
                    .setAttribute(new Attribute(CrawlOrder.ATTR_STATE_PATH, statePath + RECOVERY_SUFFIX));
        } else {
            // directory is suitably empty; exit loop
            break;
        }
    }
}

From source file:com.cyberway.issue.crawler.admin.CrawlJob.java

public AttributeList getAttributes(String[] attributeNames) {
    if (attributeNames == null) {
        throw new RuntimeOperationsException(
                new IllegalArgumentException("attributeNames[] cannot be " + "null"),
                "Cannot call getAttributes with null attribute " + "names");
    }/*from   w  ww . ja  va2 s . com*/

    // If no controller, we can't do any work in here.
    if (this.controller == null) {
        throw new RuntimeOperationsException(new NullPointerException("Controller is null"),
                "Controller is null");
    }

    AttributeList resultList = new AttributeList();
    if (attributeNames.length == 0) {
        return resultList;
    }
    for (int i = 0; i < attributeNames.length; i++) {
        try {
            Object value = getAttribute(attributeNames[i]);
            resultList.add(new Attribute(attributeNames[i], value));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return (resultList);
}

From source file:com.cyberway.issue.crawler.admin.CrawlJob.java

protected void setCrawlOrderAttribute(final String attribute_name, final ComplexType ct,
        final Attribute attribute)
        throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
    String subName = attribute_name.startsWith("/") ? attribute_name.substring(1) : attribute_name;
    int index = subName.indexOf("/");
    if (index <= 0) {
        ct.setAttribute(new Attribute(subName, attribute.getValue()));
        return;//from w  ww. j  a v a 2s.c  om
    }
    setCrawlOrderAttribute(subName.substring(index + 1),
            (ComplexType) ct.getAttribute(subName.substring(0, index)), attribute);
}