Package org.jmanage.core.services

Examples of org.jmanage.core.services.ServiceContextImpl


                                          Class[] parameterTypes,
                                          Object[] args)
        throws Exception {

        /* take the service context */
        ServiceContextImpl serviceContext = (ServiceContextImpl)args[0];
        try {
            /* authenticate the request */
            authenticate((ServiceContextImpl)args[0], className, methodName);
            /* invoke the method */
            Class serviceClass = Class.forName(className);
            Method method = serviceClass.getMethod(methodName, parameterTypes);
            Object serviceObject = ServiceFactory.getService(serviceClass);
            /* invoke the method */
            return method.invoke(serviceObject, args);
        } finally {
            serviceContext.releaseResources();
        }
    }
View Full Code Here


        System.out.println("Username:" + configData.getUsername());
        System.out.println("Password:" + configData.getPassword());
    }

    private static ServiceContext getServiceContext(){
        ServiceContextImpl context = new ServiceContextImpl();
        User user = new User("admin", null, null, null, 0);
        context.setUser(user);
        return context;
    }
View Full Code Here

            }

            /* authenticate with the server */
            AuthService authService = ServiceFactory.getAuthService();
            try {
                authService.login(new ServiceContextImpl(), username, password);
                break;
            } catch (ServiceException e){
                Out.println(e.getMessage());
                username = null;
                password = null;
View Full Code Here

        return webContext.getServiceContext();
    }

    public static ServiceContext getServiceContext(WebContext context,
                                             Expression expression){
        ServiceContextImpl srvcContext = new ServiceContextImpl();
        srvcContext.setUser(context.getUser());
        if(expression.getAppName().equals(Expression.WILDCARD)){
            srvcContext.setApplicationName((
                    context.getApplicationConfig().getName()));
        }else{
            srvcContext.setApplicationName(expression.getAppName());
        }
        srvcContext.setMBeanName(expression.getMBeanName());
        return srvcContext;
    }
View Full Code Here

        return serviceContext;
    }

    public ServiceContext getServiceContext(String appName){
        assert appName != null;
        ServiceContextImpl serviceContext = getServiceContext(command, true);
        serviceContext.setApplicationName(appName);
        return serviceContext;
    }
View Full Code Here

        return serviceContext;
    }

    public ServiceContext getServiceContext(String appName, String mbeanName) {
        assert mbeanName != null;
        ServiceContextImpl serviceContext =
                (ServiceContextImpl)getServiceContext(appName);
        serviceContext.setMBeanName(mbeanName);
        return serviceContext;
    }
View Full Code Here

        return serviceContext;
    }

    private static ServiceContextImpl getServiceContext(Command command,
                                                        boolean isAuthRequired){
        ServiceContextImpl context = new ServiceContextImpl();
        if(isAuthRequired){
            assert command.getUsername() != null;
            assert command.getPassword() != null;
            User user = new User(command.getUsername(),
                    null, null, null, 0);
            user.setPlaintextPassword(command.getPassword());
            context.setUser(user);
        }
        return context;
    }
View Full Code Here

TOP

Related Classes of org.jmanage.core.services.ServiceContextImpl

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.