Package org.jmanage.core.config

Examples of org.jmanage.core.config.ApplicationConfig


    public int doStartTag() throws JspException{
        HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
        WebContext context = null;
        try{
            context = WebContext.get(request);
            ApplicationConfig appConfig = context.getApplicationConfig();
           
            // Graphs at cluster level are not supported yet
            assert !appConfig.isCluster();
            String dashboardId = request.getParameter("dashBID");
            DashboardConfig currentDashboardConfig = DashboardRepository.getInstance().get(dashboardId);
           
            assert currentDashboardConfig != null : "Error retrieving dashboard details";
            DashboardComponent component =
View Full Code Here


            throws Exception {
        AccessController.checkAccess(context.getServiceContext(),
                ACL_EDIT_MBEAN_CONFIG);
        String logMsg = null;
        MBeanConfigForm mbeanConfigForm = (MBeanConfigForm)actionForm;
        ApplicationConfig applicationConfig = context.getApplicationConfig();
        if(applicationConfig.removeMBean(mbeanConfigForm.getObjectName())
                != null){
            ApplicationConfigManager.updateApplication(applicationConfig);
            logMsg = "Removed mbean " + mbeanConfigForm.getObjectName() +
                        " from application "+ applicationConfig.getName();
        }else{
            ApplicationConfig clusterConfig =
                    applicationConfig.getClusterConfig();
            if(clusterConfig != null){
                clusterConfig.removeMBean(mbeanConfigForm.getObjectName());
                ApplicationConfigManager.updateApplication(clusterConfig);
                logMsg = "Removed mbean " + mbeanConfigForm.getObjectName() +
                    " from application cluster "+ clusterConfig.getName();
            }
        }

        if(logMsg != null){
            UserActivityLogger.getInstance().logActivity(
View Full Code Here

            throws Exception {

        AccessController.checkAccess(context.getServiceContext(),
                ACL_EDIT_APPLICATIONS);
        ApplicationForm appForm = (ApplicationForm)actionForm;
        ApplicationConfig config =
                ApplicationConfigManager.getApplicationConfig(
                        appForm.getApplicationId());
        assert config != null;

        config.setName(appForm.getName());
        config.setHost(appForm.getHost());
        if(appForm.getPort() != null)
            config.setPort(new Integer(appForm.getPort()));
            config.setURL(appForm.getURL());
            config.setUsername(appForm.getUsername());

        final String password = appForm.getPassword();
        if(!ApplicationForm.FORM_PASSWORD.equals(password)){
            config.setPassword(password);
        }

        Map<String, String> paramValues = config.getParamValues();
        if(appForm.getJndiFactory() != null){
            paramValues.put(ApplicationConfig.JNDI_FACTORY, appForm.getJndiFactory());
        }else{
            paramValues.remove(ApplicationConfig.JNDI_FACTORY);
        }

        if(appForm.getJndiURL() != null){
            paramValues.put(ApplicationConfig.JNDI_URL, appForm.getJndiURL());
        }else{
            paramValues.remove(ApplicationConfig.JNDI_URL);
        }

        ApplicationConfigManager.updateApplication(config);
        // TODO: this should be moved down to ApplicationConfigManager -rk
        EventSystem.getInstance().fireEvent(new ApplicationChangedEvent(config));
    
        // TODO: Use the event above to do this update - rk
        /* update the AlertEngine */
        AlertEngine.getInstance().updateApplication(config);

        UserActivityLogger.getInstance().logActivity(
                context.getUser().getUsername(),
                "Updated application "+"\""+config.getName()+"\"");
        return mapping.findForward(Forwards.SUCCESS);
    }
View Full Code Here

                                 HttpServletResponse response)
            throws Exception {
        AccessController.checkAccess(Utils.getServiceContext(context),ACL_EDIT_GRAPH);
        GraphForm form = (GraphForm)actionForm;
        String graphId = form.getGraphId();
        ApplicationConfig appConfig = context.getApplicationConfig();
        GraphConfig graphConfig = appConfig.findGraph(graphId);
        if(graphConfig!=null){
            form.setGraphName(graphConfig.getName());
            form.setPollInterval(String.valueOf(graphConfig.getPollingInterval()));
            form.setYAxisLabel(graphConfig.getYAxisLabel());
            if(graphConfig.getScaleFactor() != null){
View Full Code Here

        throws Exception{

        // remove the query attribute as we are back to the AppView page
        request.getSession().removeAttribute(SessionAttributes.MBEAN_QUERY);
       
        ApplicationConfig appConfig = context.getApplicationConfig();
        AccessController.checkAccess(context.getServiceContext(),
                ACLConstants.ACL_VIEW_APPLICATIONS);
        if(appConfig.isCluster()){
            return mapping.findForward("cluster");
        }else{
            return mapping.findForward("application");
        }
    }
View Full Code Here

            throws Exception {

        makeResponseNotCacheable(response);

        final ObjectName objectName = context.getObjectName();
        final ApplicationConfig config = context.getApplicationConfig();
        AccessController.checkAccess(context.getServiceContext(),
                ACL_VIEW_APPLICATIONS);
        AccessController.checkAccess(context.getServiceContext(),
                ACL_VIEW_MBEANS);
        List<ApplicationConfig> applications = null;
        if(config.isCluster()){
            applications = config.getApplications();
        }else{
            applications = new ArrayList<ApplicationConfig>(1);
            applications.add(config);
        }

        /* the ObjectInfo for the mbean that is being viewed */
        ObjectInfo objInfo = null;
        /* array that will be initialized with all attribute names for this
            mbean */
        String[] attributeNames = null;
        /* a Map which constains list of attribute values for each application
            in the cluster.
            ApplicationConfig is the key and attribute List is the value*/
        final Map<ApplicationConfig, List> appConfigToAttrListMap =
          new HashMap<ApplicationConfig, List>(applications.size());
        for(Iterator it=applications.iterator(); it.hasNext(); ){
            ApplicationConfig childAppConfig = (ApplicationConfig)it.next();
            ServerConnection serverConnection = null;
            try {
                serverConnection =
                        ServerConnector.getServerConnection(childAppConfig);
                /* assuming that all servers in this cluster have exact same
                    object info, we will get the ObjectInfo from the first
                    server in the list (could be further down in the list,
                    if the first server(s) is down */
                if(objInfo == null){
                    objInfo = serverConnection.getObjectInfo(objectName);
                    assert objInfo != null;
                    ObjectAttributeInfo[] attributes = objInfo.getAttributes();
                    attributeNames = new String[attributes.length];
                    for (int i = 0; i < attributes.length; i++) {
                        // TODO: we should only add the readable attributes here
                        attributeNames[i] = attributes[i].getName();
                    }
                }
                /* add attribute values of this application to the map*/
                appConfigToAttrListMap.put(childAppConfig,
                        serverConnection.getAttributes(objectName, attributeNames));
            } catch (ConnectionFailedException e){
                logger.log(Level.FINE, "Error retrieving attributes for:" +
                        childAppConfig.getName(), e);
                /* add null, indicating that the server is down */
                appConfigToAttrListMap.put(childAppConfig, null);
            } finally{
                ServiceUtils.close(serverConnection);
            }
        }
        /* if objInfo is null, that means that we couldn't get connection to
            any server */
        if(objInfo == null){
            throw new ConnectionFailedException(null);
        }

        request.setAttribute("objInfo", objInfo);
        request.setAttribute("appConfigToAttrListMap", appConfigToAttrListMap);

        /* setup the form to be used in the html form */
        MBeanConfigForm mbeanConfigForm = (MBeanConfigForm)actionForm;
        mbeanConfigForm.setObjectName(objectName.getCanonicalName());

        ApplicationConfig appConfig = context.getApplicationConfig();
        MBeanConfig mbeanConfig =
                appConfig.findMBeanByObjectName(objectName.getCanonicalName());
        if(mbeanConfig != null){
            if(appConfig.isCluster()){
                request.setAttribute("mbeanIncludedIn", "cluster");
            }else{
                request.setAttribute("mbeanIncludedIn", "application");
            }
            request.setAttribute("mbeanConfig", mbeanConfig);
        }else{
            ApplicationConfig clusterConfig = appConfig.getClusterConfig();
            if(clusterConfig != null){
                mbeanConfig =
                    clusterConfig.findMBeanByObjectName(objectName.getCanonicalName());
            }
            if(mbeanConfig != null){
                request.setAttribute("mbeanIncludedIn", "cluster");
                request.setAttribute("mbeanConfig", mbeanConfig);
            }
View Full Code Here

                                 ActionForm actionForm,
                                 HttpServletRequest request,
                                 HttpServletResponse response)
        throws Exception{

        ApplicationConfig appConfig = context.getApplicationConfig();
        // graphs at cluster level are not yet supported
        assert !appConfig.isCluster();

        // todo: do we need access control for graphs? probably not.
        //AccessController.checkAccess(context.getServiceContext(),
        //        ACLConstants.ACL_VIEW_APPLICATIONS);

        /*set current page for navigation*/
        GraphConfig graphConfig =
                appConfig.findGraph(request.getParameter("graphId"));
        assert graphConfig != null;
        request.setAttribute(RequestAttributes.NAV_CURRENT_PAGE,
                graphConfig.getName());

        return mapping.findForward("success");
View Full Code Here

*/
public class MetaDataWriter {

    public static void main(String[] args) throws IOException{
       
        ApplicationConfig appConfig =
            ApplicationConfigFactory.create("1", "test", "local",
                                            null,
                                            null,
                                            null,
                                            null,
View Full Code Here

        assert history != null;
        return history;
    }

    private void addApplication(NewApplicationEvent event) {
        ApplicationConfig appConfig = event.getApplicationConfig();
        if(logger.isLoggable(Level.INFO)){
            logger.info("Added application " + appConfig.getName() + " to the downtimesMap.");
        }
        final long recordingSince = event.getTime();
        addApplicationToDB(appConfig.getApplicationId(), recordingSince);
        downtimesMap.put(appConfig, new ApplicationDowntimeHistory(recordingSince));
    }
View Full Code Here

                long recordingSince = rset.getTimestamp(2).getTime();
                if(logger.isLoggable(Level.FINE)){
                    logger.fine("ApplicationId: " + applicationId + ", recordingSince: " +
                            recordingSince);
                }
                ApplicationConfig appConfig =
                    ApplicationConfigManager.getApplicationConfig(applicationId);
                if(appConfig == null){
                    logger.log(Level.INFO, "Application with Id {0} no longer exists",  applicationId);
                    continue;
                }
View Full Code Here

TOP

Related Classes of org.jmanage.core.config.ApplicationConfig

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.