Package org.jmanage.core.data

Examples of org.jmanage.core.data.OperationResultData


            ObjectName objectName,
            String operationName,
            String[] params,
            String[] signature){

        OperationResultData resultData =
                new OperationResultData(appConfig.getName());
        ServerConnection serverConnection = null;
        try {
            serverConnection = ServerConnector.getServerConnection(appConfig);
            Object[] typedParams = getTypedArray(appConfig,
                    params, signature);
            final Object result = serverConnection.invoke(objectName, operationName,
                            typedParams, signature);

            resultData.setOutput(result);
            UserActivityLogger.getInstance().logActivity(
                    context.getUser().getUsername(),
                    "Performed "+operationName+" on "+objectName.getCanonicalName()
                    + " in application " + appConfig.getName());
        } catch (ConnectionFailedException e) {
            logger.log(Level.INFO, "Error executing operation " +
                    operationName + " on " + objectName, e);
            resultData.setResult(OperationResultData.RESULT_ERROR);
            resultData.setErrorString(ErrorCatalog.getMessage(ErrorCodes.CONNECTION_FAILED));
        } catch (RuntimeException e){
            logger.log(Level.SEVERE, "Error executing operation " +
                    operationName + " on " + objectName, e);
            resultData.setResult(OperationResultData.RESULT_ERROR);
            if(e.getCause() != null){
                if(e.getCause().getClass().getName().
                        equals("javax.management.RuntimeMBeanException") &&
                        e.getCause().getCause() != null){
                    resultData.setException(e.getCause().getCause());
                }else{
                    resultData.setException(e.getCause());
                }
            }else{
                resultData.setException(e);
            }
        } catch (Exception e){
            logger.log(Level.SEVERE, "Error executing operation " +
                    operationName + " on " + objectName, e);
            resultData.setResult(OperationResultData.RESULT_ERROR);
            resultData.setException(e);
        } finally {
            ServiceUtils.close(serverConnection);
        }
        return resultData;
    }
View Full Code Here

TOP

Related Classes of org.jmanage.core.data.OperationResultData

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.