Package com.sun.enterprise.registration

Examples of com.sun.enterprise.registration.RegistrationService


    @Handler(id="showRegistration",
    output={
        @HandlerOutput(name="value", type=Boolean.class)})
    public static void showRegistration(HandlerContext handlerCtx) {

        RegistrationService regService = getRegistrationService();
        if (regService == null) {
            System.out.println("========== No RegistrationService available. ===========");
            handlerCtx.setOutputValue("value", false);
            return;
        }
        if (( getRegistrationStatus() == RegistrationStatus.NOT_REGISTERED) &&
                !regService.isRegistrationEnabled()){
            System.out.println("============ Product is not registered and registration is not Enabled ===========");
            handlerCtx.setOutputValue("value", false);
            return;
        }
        handlerCtx.setOutputValue("value", true);
View Full Code Here


    }

    private static RegistrationStatus getRegistrationStatus() {
        RegistrationStatus regStatus = RegistrationStatus.NOT_REGISTERED;
        try {
            RegistrationService regService = getRegistrationService();
            if (regService != null) {
                regStatus = regService.getRegistrationStatus();
//                System.out.println("======== DEBUG ==== getRegistrationStatus returns " + regStatus);
      }
        } catch(Exception ex) {
      // FIXME: Log trace instead
            ex.printStackTrace();
View Full Code Here

    }


    private static RegistrationReminder getRegistrationReminder() {
        try {
            RegistrationService regService = getRegistrationService();
            if ( regService.getRegistrationStatus() == RegistrationStatus.REGISTERED){
//                System.out.println("====== DEBUG ===== getRegistrationStatus() returns  REGISTERED");
                return RegistrationReminder.DONT_ASK_FOR_REGISTRATION;
            }
           
            if ( !regService.isRegistrationEnabled() ){   //user has not write permission, so don't remind them
//                System.out.println("====== DEBUG ======  isRegistrationEnabled() return false" );
                return RegistrationReminder.DONT_ASK_FOR_REGISTRATION;
            }
            RegistrationReminder  rem = regService.getRegistrationReminder();
//            System.out.println("======== DEBUG ====== getRegistrationReminder() returns " + rem );
            return rem;
        }catch(Exception ex){
      // FIXME: Log trace instead
            ex.printStackTrace();
View Full Code Here

       
    }
   
    private static void setRegistrationReminder(RegistrationReminder value) {
        try {
            RegistrationService regService = getRegistrationService();
            regService.setRegistrationReminder(value);
//            System.out.println("======== DEBUG ====== setRegistrationReminder " + value );
        }catch(Exception ex){
      // FIXME: Log trace instead
            ex.printStackTrace();
        }
View Full Code Here

    private static RegistrationService getRegistrationService() {
        try {
            File registryFile = RegistrationUtil.getServiceTagRegistry();
            Object params[] = new Object[] { registryFile, "glassfish:console"};
            RegistrationServiceConfig config = new RegistrationServiceConfig("com.sun.enterprise.registration.SysnetRegistrationService", params);
      RegistrationService registrationService = RegistrationServiceFactory.getInstance().getRegistrationService(config);
            return registrationService;
  } catch (Exception ex) {
      // FIXME: Log trace instead
      ex.printStackTrace();
            return null;
View Full Code Here

    private static RegistrationService getRegistrationService(String proxyHost, int proxyPort) {
        try {
            File registryFile = RegistrationUtil.getServiceTagRegistry();
            Object params[] = new Object[] { registryFile, proxyHost, proxyPort,  "glassfish:console"};
            RegistrationServiceConfig config = new RegistrationServiceConfig("com.sun.enterprise.registration.SysnetRegistrationService", params);
      RegistrationService registrationService = RegistrationServiceFactory.getInstance().getRegistrationService(config);
            return registrationService;
  } catch (Exception ex) {
      // FIXME: Log trace instead
      ex.printStackTrace();
            return null;
View Full Code Here

                RegistrationAccount account =
                    RegistrationAccountFactory.getInstance().getRegistrationAccount(accountConfig);

                String proxy = (String) handlerCtx.getInputValue("proxy");
                String port = (String) handlerCtx.getInputValue("port");
                RegistrationService regService = getRegServiceForRegister(proxy, port);
                if (regService == null){   // This shouldn't happen, error may occur only when we try to user this regService.
                    GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("reg.error.noRegService"));
                    return;
                }
                regService.register(account);
                setNodeText(handlerCtx, true);
            } catch (Exception ex) {
    // FIXME: Log trace instead
                ex.printStackTrace();
                GuiUtil.handleException(handlerCtx, ex);
                return;
            }
        } else {
            String emailAdr = (String) handlerCtx.getInputValue("emailAdr");
            String newPswd = (String) handlerCtx.getInputValue("newPswd");
            String screenName = (String) handlerCtx.getInputValue("screenName");
            String firstName = (String) handlerCtx.getInputValue("firstName");
            String lastName = (String) handlerCtx.getInputValue("lastName");
            String companyName = (String) handlerCtx.getInputValue("companyName");
            String country = (String) handlerCtx.getInputValue("country");

            Map map = new HashMap();
            map.put(RegistrationAccount.EMAIL, emailAdr);
            map.put(RegistrationAccount.PASSWORD, newPswd);
            map.put(RegistrationAccount.COUNTRY, country);
           
            if (GuiUtil.isEmpty(screenName)){
                screenName = emailAdr;
            }
            map.put(RegistrationAccount.USERID, screenName);
           
            if (GuiUtil.isEmpty(firstName)) {
                firstName=" ";
            }
            map.put(RegistrationAccount.FIRSTNAME, firstName);
           
            if (GuiUtil.isEmpty(lastName)) {
                lastName = " ";
            }
            map.put(RegistrationAccount.LASTNAME, lastName);
            if (! GuiUtil.isEmpty(companyName))
                map.put(RegistrationAccount.COMPANY,  companyName);

//System.out.println("====== DEBUG ====  Creating account with the following: " + map.toString());
            Object[] accountParams = { map };
            try {
                String proxy = (String) handlerCtx.getInputValue("newProxy");
                String port = (String) handlerCtx.getInputValue("newPort");
                RegistrationService regService = getRegServiceForRegister(proxy, port);
                if (regService == null){
                    GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("reg.error.noRegService"));
                    return;
                }
                RegistrationAccountConfig accountConfig =
                    new RegistrationAccountConfig("com.sun.enterprise.registration.SOAccount", accountParams);
                RegistrationAccount account =
                    RegistrationAccountFactory.getInstance().getRegistrationAccount(accountConfig);
                regService.createRegistrationAccount(account);
                regService.register(account);
                setNodeText(handlerCtx, true);
            } catch(Exception ex) {
    // FIXME: Log trace instead
                ex.printStackTrace();
                GuiUtil.handleException(handlerCtx, ex);
View Full Code Here

     })
    public static void getCountryListForRegistration(HandlerContext handlerCtx) {

        Locale locale = com.sun.jsftemplating.util.Util.getLocale(FacesContext.getCurrentInstance());
        //List countryList = getCountryList(locale);
        RegistrationService regService = getRegistrationService();
        List countryList = regService.getAvailableCountries(locale);
        handlerCtx.setOutputValue("labels", countryList.get(0) );
        handlerCtx.setOutputValue("values", countryList.get(1) );
    }
View Full Code Here

    @Handler(id="setRegistrationNodeText")
    public static void setRegistrationNodeText(HandlerContext handlerCtx) {

        try {
            RegistrationService regService = getRegistrationService();
            RegistrationStatus status = regService.getRegistrationStatus();
            setNodeText(handlerCtx, (status == RegistrationStatus.REGISTERED));
        } catch(Exception ex) {
      // FIXME: Log trace instead
            ex.printStackTrace();
            setNodeText(handlerCtx, false);
View Full Code Here

        String productInstanceURN = (String) sessionMap.get("productInstanceURN");
        if (!GuiUtil.isEmpty(productInstanceURN )){
            //System.out.println(" !!!!! productInstanceURN="+ productInstanceURN);
            return;
        }
        RegistrationService regService = getRegistrationService();
        if (regService == null) {
            System.out.println("WARNING: getRegistrationService returns NULL !!");
            sessionMap.put("productInstanceURN", "0000");
            return;
        }
        try{
            List<ServiceTag> tags = regService.getServiceTags(RegistrationUtil.getGFProductURN());
            ServiceTag firstTag = tags.get(0);
            if (firstTag != null){
                sessionMap.put("productInstanceURN", firstTag.getInstanceURN());
                //System.out.println( "!!!!!!!!! get productInstanceURN #" + firstTag.getInstanceURN());
                return;
View Full Code Here

TOP

Related Classes of com.sun.enterprise.registration.RegistrationService

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.