Package org.jmanage.core.config

Examples of org.jmanage.core.config.ApplicationConfig


    public AttributeListData[] getAttributes(ServiceContext context,
                                             String[] attributes,
                                             boolean handleCluster)
            throws ServiceException {
        canAccessThisMBean(context);
        ApplicationConfig appConfig = context.getApplicationConfig();
        ObjectName objectName = context.getObjectName();

        AttributeListData[] resultData = null;
        if(appConfig.isCluster()){
            if(!handleCluster){
                throw new ServiceException(ErrorCodes.OPERATION_NOT_SUPPORTED_FOR_CLUSTER);
            }
            /* we need to perform this operation for all servers
                in this cluster */
            resultData = new AttributeListData[appConfig.getApplications().size()];
            int index = 0;
            for(Iterator it=appConfig.getApplications().iterator(); it.hasNext(); index++){
                ApplicationConfig childAppConfig = (ApplicationConfig)it.next();
                try {
                    resultData[index] =
                            getAttributes(context,
                                    childAppConfig, objectName, attributes);
                } catch (ConnectionFailedException e) {
                    resultData[index] =
                            new AttributeListData(childAppConfig.getName());
                }
            }
        }else{
            resultData = new AttributeListData[1];
            resultData[0] =
View Full Code Here


       
        canAccessThisMBean(context, objectName);
        AccessController.checkAccess(context,
                ACLConstants.ACL_EXECUTE_MBEAN_OPERATIONS, operationName);

        ApplicationConfig appConfig = context.getApplicationConfig();
        OperationResultData[] resultData = null;
        if(appConfig.isCluster()){
            /* we need to perform this operation for all servers
                in this cluster */
            resultData = new OperationResultData[appConfig.getApplications().size()];
            int index = 0;
            for(Iterator it=appConfig.getApplications().iterator(); it.hasNext(); index++){
                ApplicationConfig childAppConfig = (ApplicationConfig)it.next();
                resultData[index] =
                        executeMBeanOperation(context, childAppConfig, objectName,
                                operationName, params, signature);
            }
        }else{
View Full Code Here

        List attributeList = buildAttributeList(context, attributes);
        AttributeListData[] attrListData =
                new AttributeListData[applications.size()];
        int index = 0;
        for(Iterator it=applications.iterator(); it.hasNext(); index++){
            final ApplicationConfig childAppConfig =
                        (ApplicationConfig)it.next();
            attrListData[index] = updateAttributes(context, childAppConfig,
                    objectName, attributeList);
        }
        return attrListData;
View Full Code Here

                ServiceUtils.getServerConnectionEvenIfCluster(
                        context.getApplicationConfig());
        try {
            ObjectInfo objInfo = connection.getObjectInfo(objectName);
            for(Iterator it=applications.iterator(); it.hasNext(); index++){
                final ApplicationConfig childAppConfig =
                            (ApplicationConfig)it.next();
                List attributeList = buildAttributeList(attributes,
                        childAppConfig, objInfo.getAttributes(), connection,
                        objectName);
                attrListData[index] = updateAttributes(context, childAppConfig,
View Full Code Here

    private void canAccessThisMBean(ServiceContext context){
        canAccessThisMBean(context, context.getObjectName());
    }
   
    private void canAccessThisMBean(ServiceContext context, ObjectName objectName){
        final ApplicationConfig config = context.getApplicationConfig();
        final MBeanConfig configuredMBean =
                config.findMBeanByObjectName(objectName.getCanonicalName());
        AccessController.checkAccess(context,
                ACLConstants.ACL_VIEW_APPLICATIONS);
        if(configuredMBean != null)
            AccessController.checkAccess(context,
                    ACLConstants.ACL_VIEW_MBEANS);
View Full Code Here

    public void setAlertConfig(AlertConfig alertConfig) {
        this.alertConfigId = alertConfig.getAlertId();
        this.alertName = alertConfig.getAlertName();
        this.emailAddress = alertConfig.getEmailAddress();
        setObjectName(alertConfig.getAlertSourceConfig().getObjectName());
        ApplicationConfig appConfig =
                alertConfig.getAlertSourceConfig().getApplicationConfig();
        this.setApplicationId(appConfig.getApplicationId());
        this.setApplicationName(appConfig.getName());
    }
View Full Code Here

        }else{
            if(appConfig.getApplications().size() == 0){
                throw new ServiceException(ErrorCodes.CLUSTER_NO_APPLICATIONS);
            }
            for(Iterator it=appConfig.getApplications().iterator(); it.hasNext();){
                ApplicationConfig childAppConfig = (ApplicationConfig)it.next();
                try {
                    return ServerConnector.getServerConnection(childAppConfig);
                } catch (ConnectionFailedException e) {
                    logger.info("Couldn't connect to childApp=" +
                            childAppConfig);
View Full Code Here

    }

    public static ApplicationConfig getApplicationConfigByName(String appName)
        throws ServiceException {

        ApplicationConfig appConfig =
                ApplicationConfigManager.getApplicationConfigByName(appName);
        if(appConfig == null){
            throw new ServiceException(
                    ErrorCodes.INVALID_APPLICATION_NAME, appName);
        }
View Full Code Here

                        this.mbeanName);
        return new ObjectName(mbeanName);
    }

    public ServerConnection getServerConnection() {
        ApplicationConfig appConfig = getApplicationConfig();
        assert appConfig != null;
        assert !appConfig.isCluster():"not supported for cluster";
        if (serverConnection == null) {
            serverConnection =
                    ServerConnector.getServerConnection(appConfig);
        }
        return serverConnection;
View Full Code Here

            clusterConfig.setName(clusterForm.getName());
            final List oldChildApplications = clusterConfig.getApplications();
            /* add applications outside the cluster
            (applications that are no longer in the cluster) */
            for(Iterator it=oldChildApplications.iterator();it.hasNext();){
                ApplicationConfig appConfig = (ApplicationConfig)it.next();
                if(!newChildApplications.contains(appConfig)){
                    ApplicationConfigManager.addApplication(appConfig);
                    appConfig.setClusterConfig(null);
                }
            }
            /* remove applications outside the cluster
            (applications that are now part of cluster) */
            for(Iterator it=newChildApplications.iterator();it.hasNext();){
                ApplicationConfig appConfig = (ApplicationConfig)it.next();
                if(!oldChildApplications.contains(appConfig)){
                    ApplicationConfigManager.deleteApplication(appConfig);
                    appConfig.setClusterConfig(clusterConfig);
                }
            }
            clusterConfig.setApplications(newChildApplications);
            ApplicationConfigManager.updateApplication(clusterConfig);

            UserActivityLogger.getInstance().logActivity(
                context.getUser().getUsername(),
                "Updated application cluster "+ "\""+clusterConfig.getName()+"\"");

        }else{
            /* add new application cluster */
            ApplicationClusterConfig clusterConfig =
                    new ApplicationClusterConfig(
                            ApplicationConfig.getNextApplicationId(),
                            clusterForm.getName());
            for(Iterator it=newChildApplications.iterator();it.hasNext();){
                ApplicationConfig appConfig = (ApplicationConfig)it.next();
                appConfig.setClusterConfig(clusterConfig);
                ApplicationConfigManager.deleteApplication(appConfig, true);
            }
            clusterConfig.setApplications(newChildApplications);
            /* remove from stand-alone list */

 
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.