private void writeState(final Element element) {
   JDOMExternalizerUtil.writeField(
       element, INSTRUMENTATION_TYPE_NAME, myInstrumentationType.toString());
   JDOMExternalizerUtil.writeField(element, LANGUAGE_ANNOTATION_NAME, myLanguageAnnotation);
   JDOMExternalizerUtil.writeField(element, PATTERN_ANNOTATION_NAME, myPatternAnnotation);
   JDOMExternalizerUtil.writeField(element, SUBST_ANNOTATION_NAME, mySubstAnnotation);
   if (myIncludeUncomputablesAsLiterals) {
     JDOMExternalizerUtil.writeField(element, INCLUDE_UNCOMPUTABLES_AS_LITERALS, "true");
   }
   if (mySourceModificationAllowed) {
     JDOMExternalizerUtil.writeField(element, SOURCE_MODIFICATION_ALLOWED, "true");
   }
   switch (myDfaOption) {
     case OFF:
       break;
     case RESOLVE:
       JDOMExternalizerUtil.writeField(element, RESOLVE_REFERENCES, Boolean.TRUE.toString());
       break;
     case ASSIGNMENTS:
       JDOMExternalizerUtil.writeField(
           element, LOOK_FOR_VAR_ASSIGNMENTS, Boolean.TRUE.toString());
       break;
     case DFA:
       JDOMExternalizerUtil.writeField(element, USE_DFA_IF_AVAILABLE, Boolean.TRUE.toString());
       break;
   }
 }
  private void _initSassCompiler(String sassCompilerClassName) throws Exception {

    if (Validator.isNull(sassCompilerClassName) || sassCompilerClassName.equals("jni")) {

      try {
        System.setProperty("jna.nosys", Boolean.TRUE.toString());

        _sassCompiler = new JniSassCompiler();

        System.out.println("Using native Sass compiler");
      } catch (Throwable t) {
        System.out.println("Unable to load native compiler, falling back to Ruby");

        _sassCompiler = new RubySassCompiler();
      }
    } else {
      try {
        _sassCompiler = new RubySassCompiler();

        System.out.println("Using ruby Sass compiler");
      } catch (Exception e) {
        System.out.println("Unable to load Ruby compiler, falling back to native");

        System.setProperty("jna.nosys", Boolean.TRUE.toString());

        _sassCompiler = new JniSassCompiler();
      }
    }
  }
  private void doLoad(Element element) {
    for (final FTManager manager : getAllManagers()) {
      final Element templatesGroup = element.getChild(getXmlElementGroupName(manager));
      if (templatesGroup == null) {
        continue;
      }
      final List children = templatesGroup.getChildren(ELEMENT_TEMPLATE);

      for (final Object elem : children) {
        final Element child = (Element) elem;
        final String qName = child.getAttributeValue(ATTRIBUTE_NAME);
        final FileTemplateBase template = manager.getTemplate(qName);
        if (template == null) {
          continue;
        }
        template.setReformatCode(
            Boolean.TRUE.toString().equals(child.getAttributeValue(ATTRIBUTE_REFORMAT)));
        template.setLiveTemplateEnabled(
            Boolean.TRUE.toString().equals(child.getAttributeValue(ATTRIBUTE_LIVE_TEMPLATE)));
        if (template instanceof BundledFileTemplate) {
          final boolean enabled =
              Boolean.parseBoolean(child.getAttributeValue(ATTRIBUTE_ENABLED, "true"));
          ((BundledFileTemplate) template).setEnabled(enabled);
        }
      }
    }
  }
Beispiel #4
0
  protected static Map<String, String[]> addDefaultPublishingParameters(
      Map<String, String[]> parameterMap) {

    parameterMap.put(PortletDataHandlerKeys.DELETIONS, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(
        PortletDataHandlerKeys.IGNORE_LAST_PUBLISH_DATE, new String[] {Boolean.FALSE.toString()});
    parameterMap.put(
        PortletDataHandlerKeys.LAYOUT_SET_SETTINGS, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(PortletDataHandlerKeys.LOGO, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(PortletDataHandlerKeys.PERMISSIONS, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(
        PortletDataHandlerKeys.PORTLET_CONFIGURATION, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(
        PortletDataHandlerKeys.PORTLET_CONFIGURATION_ALL, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(PortletDataHandlerKeys.PORTLET_DATA, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(
        PortletDataHandlerKeys.PORTLET_DATA_ALL, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(
        PortletDataHandlerKeys.PORTLET_SETUP_ALL, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(
        ExportImportDateUtil.RANGE,
        new String[] {ExportImportDateUtil.RANGE_FROM_LAST_PUBLISH_DATE});
    parameterMap.put(
        PortletDataHandlerKeys.THEME_REFERENCE, new String[] {Boolean.TRUE.toString()});

    return parameterMap;
  }
Beispiel #5
0
  @Override
  public boolean load15Data(String data) {
    String[] items = data.split(IConnectionPoint15Constants.DELIMITER);

    if (items.length < 7) {
      return false;
    }

    setName(items[0]);
    setHost(items[1]);
    if (items[2] == null || "".equals(items[2])) { // $NON-NLS-1$
      setPath(Path.ROOT);
    } else {
      setPath(new Path(items[2]));
    }
    setLogin(items[3]);
    setPassword(items[4].toCharArray());
    setPassiveMode(items[5].equals(Boolean.TRUE.toString()));
    setId(items[6]);

    if (items.length >= 10) {
      setPort(Integer.parseInt(items[9]));
    }
    if (items.length >= 12) {
      setExplicit(items[11].equals(Boolean.TRUE.toString()));
    }
    return true;
  }
  /** {@inheritDoc} */
  public TreeNode wrap(final Group theObjectSource) throws ESCOWrapperException {

    TreeNode treeGroup = new TreeNode();
    Attributes attributes = new Attributes();

    attributes.setId(theObjectSource.getIdGroup());
    attributes.setName(theObjectSource.getName());
    attributes.setDisplayName(theObjectSource.getDisplayName());
    attributes.setType(TreeGroupWrapper.GROUP);
    attributes.setRight(theObjectSource.getUserRight().getName());
    if (theObjectSource.isCanOptin()) {
      attributes.setOptin(Boolean.TRUE.toString());
    } else {
      attributes.setOptin(Boolean.FALSE.toString());
    }
    if (theObjectSource.isCanOptout()) {
      attributes.setOptout(Boolean.TRUE.toString());
    } else {
      attributes.setOptout(Boolean.FALSE.toString());
    }

    treeGroup.setAttributes(attributes);
    treeGroup.setData(this.getViewDataFormatted(theObjectSource));
    treeGroup.setState("");

    return treeGroup;
  }
  public void testExecuteSubmitTrue() throws Exception {

    addRequestParameter(RhnAction.SUBMITTED, Boolean.TRUE.toString());
    addRequestParameter(RestartAction.RESTART, Boolean.TRUE.toString());
    actionPerform();
    verifyActionMessages(new String[] {"restart.config.success"});
    assertTrue((request.getParameter(RestartAction.RESTART).equals(Boolean.TRUE.toString())));
  }
 @Override
 @SuppressWarnings("unchecked")
 protected void addConfigOptions(Map options) {
   options.put(AvailableSettings.USE_SECOND_LEVEL_CACHE, Boolean.TRUE.toString());
   options.put(AvailableSettings.CACHE_REGION_FACTORY, EhCacheRegionFactory.class.getName());
   options.put(AvailableSettings.USE_QUERY_CACHE, Boolean.TRUE.toString());
   options.put(AvailableSettings.GENERATE_STATISTICS, Boolean.TRUE.toString());
   options.put(AvailableSettings.CACHE_REGION_PREFIX, "");
 }
Beispiel #9
0
 public MemoryProfile() {
   setParameter(Profile.IMTP, MemoryIMTPManager.class.getName());
   setParameter(Profile.NO_MTP, Boolean.TRUE.toString());
   setParameter(Profile.DETECT_MAIN, Boolean.FALSE.toString());
   setParameter(Profile.LOCAL_SERVICE_MANAGER, Boolean.FALSE.toString());
   setParameter(Profile.NO_DISPLAY, Boolean.TRUE.toString());
   setSpecifiers(Profile.MTPS, new ArrayList(0));
   setParameter(Profile.MTPS, null);
 }
Beispiel #10
0
 public final Session getSession() throws IOException {
   final Properties propertiesSession = new Properties();
   // properties.setProperty("mail.debug", "true");
   if ("starttls".equals(cursorSMTP.getProtocol())) { // i18n revisit
     propertiesSession.setProperty("mail.smtp.starttls.enable", Boolean.TRUE.toString());
   } else if ("smtps".equals(cursorSMTP.getProtocol())) { // i18n revisit
     propertiesSession.setProperty("mail.smtp.ssl.enable", Boolean.TRUE.toString());
   }
   setCustomSocketFactory(cursorSMTP.getCertificate(), propertiesSession);
   return Session.getInstance(propertiesSession);
 }
Beispiel #11
0
  /**
   * Test.
   *
   * @throws Exception e
   */
  @Test
  public void testOtherWrites() throws Exception { // NOPMD
    final HtmlReport htmlReport =
        new HtmlReport(collector, null, javaInformationsList, Period.SEMAINE, writer);

    htmlReport.writeAllCurrentRequestsAsPart();
    assertNotEmptyAndClear(writer);
    htmlReport.writeAllThreadsAsPart();
    assertNotEmptyAndClear(writer);

    htmlReport.writeSessionDetail("", null);
    assertNotEmptyAndClear(writer);
    htmlReport.writeSessions(
        Collections.<SessionInformations>emptyList(), "message", SESSIONS_PART);
    assertNotEmptyAndClear(writer);
    htmlReport.writeSessions(Collections.<SessionInformations>emptyList(), null, SESSIONS_PART);
    assertNotEmptyAndClear(writer);
    htmlReport.writeMBeans(MBeans.getAllMBeanNodes());
    assertNotEmptyAndClear(writer);
    htmlReport.writeProcesses(
        ProcessInformations.buildProcessInformations(
            getClass().getResourceAsStream("/tasklist.txt"), true, false));
    assertNotEmptyAndClear(writer);
    htmlReport.writeProcesses(
        ProcessInformations.buildProcessInformations(
            getClass().getResourceAsStream("/ps.txt"), false, false));
    assertNotEmptyAndClear(writer);
    HtmlReport.writeAddAndRemoveApplicationLinks(null, writer);
    assertNotEmptyAndClear(writer);
    HtmlReport.writeAddAndRemoveApplicationLinks("test", writer);
    assertNotEmptyAndClear(writer);
    final Connection connection = TestDatabaseInformations.initH2();
    try {
      htmlReport.writeDatabase(new DatabaseInformations(0)); // h2.memory
      assertNotEmptyAndClear(writer);
      htmlReport.writeDatabase(new DatabaseInformations(3)); // h2.settings avec nbColumns==2
      assertNotEmptyAndClear(writer);
      JavaInformations.setWebXmlExistsAndPomXmlExists(true, true);
      htmlReport.toHtml(null, null); // pom.xml dans HtmlJavaInformationsReport.writeDependencies
      assertNotEmptyAndClear(writer);
      setProperty(Parameter.SYSTEM_ACTIONS_ENABLED, Boolean.TRUE.toString());
      htmlReport.toHtml(null, null); // writeSystemActionsLinks
      assertNotEmptyAndClear(writer);
      setProperty(Parameter.NO_DATABASE, Boolean.TRUE.toString());
      htmlReport.toHtml(null, null); // writeSystemActionsLinks
      assertNotEmptyAndClear(writer);
      setProperty(Parameter.CUSTOM_REPORTS, "custom,dummy");
      System.setProperty(Parameters.PARAMETER_SYSTEM_PREFIX + "custom", "custom.jsp");
      htmlReport.toHtml(null, null); // writeMenu
      assertNotEmptyAndClear(writer);
    } finally {
      connection.close();
    }
  }
Beispiel #12
0
 public boolean getCreateProject() {
   if (isRunningTests()) {
     return false;
   }
   // check standard Debrief preference
   String createProject =
       CorePlugin.getDefault()
           .getPreferenceStore()
           .getString(PrefsPage.PreferenceConstants.ASK_ABOUT_PROJECT);
   if (createProject == null || createProject.isEmpty()) {
     createProject = Boolean.TRUE.toString();
   }
   return (Boolean.TRUE.toString().equals(createProject));
 }
  protected Map<String, String[]> getExportParameterMap() throws Exception {
    Map<String, String[]> parameterMap = new LinkedHashMap<String, String[]>();

    parameterMap.put(
        PortletDataHandlerKeys.PORTLET_CONFIGURATION, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(
        PortletDataHandlerKeys.PORTLET_CONFIGURATION_ALL, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(PortletDataHandlerKeys.PORTLET_DATA, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(
        PortletDataHandlerKeys.PORTLET_DATA_ALL, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(
        PortletDataHandlerKeys.PORTLET_SETUP_ALL, new String[] {Boolean.TRUE.toString()});

    return parameterMap;
  }
Beispiel #14
0
  /**
   * If authorization mode is v2, then pass it through authorizer so that it can apply any security
   * configuration changes.
   */
  public void applyAuthorizationPolicy() throws HiveException {
    if (!isAuthorizationModeV2()) {
      // auth v1 interface does not have this functionality
      return;
    }

    // avoid processing the same config multiple times, check marker
    if (conf.get(CONFIG_AUTHZ_SETTINGS_APPLIED_MARKER, "").equals(Boolean.TRUE.toString())) {
      return;
    }

    authorizerV2.applyAuthorizationConfigPolicy(conf);
    // set a marker that this conf has been processed.
    conf.set(CONFIG_AUTHZ_SETTINGS_APPLIED_MARKER, Boolean.TRUE.toString());
  }
 /**
  * Update the SLO policy Name for VMAX3 volumes.
  *
  * @param poolSupportedSLONames - Pool Supported SLO Names
  * @param unManagedVolumeInformation - UnManaged Volume Information
  * @param unManagedVolumeCharacteristics - UnManaged Volume characteristics.
  * @param sgSLOName - Volume supported SLO Name.
  */
 private void updateSLOPolicies(
     Set<String> poolSupportedSLONames,
     Map<String, StringSet> unManagedVolumeInformation,
     Map<String, String> unManagedVolumeCharacteristics,
     String sgSLOName) {
   if (null != poolSupportedSLONames && !poolSupportedSLONames.isEmpty()) {
     StringSet sloNamesSet = new StringSet();
     for (String poolSLOName : poolSupportedSLONames) {
       if (null != sgSLOName && poolSLOName.contains(sgSLOName)) {
         // This condition will filter out the pool SLO's which
         // contains Workload when sgSLOName contains
         // just SLO.
         if (!sgSLOName.contains(Constants.WORKLOAD) && poolSLOName.contains(Constants.WORKLOAD)) {
           continue;
         }
         sloNamesSet.add(poolSLOName);
         _logger.info("found a matching slo: {}", poolSLOName);
         break;
       }
     }
     if (!sloNamesSet.isEmpty()) {
       unManagedVolumeInformation.put(
           SupportedVolumeInformation.AUTO_TIERING_POLICIES.toString(), sloNamesSet);
       unManagedVolumeCharacteristics.put(
           SupportedVolumeCharacterstics.IS_AUTO_TIERING_ENABLED.toString(),
           Boolean.TRUE.toString());
     } else {
       _logger.warn("StorageGroup SLOName is not found in Pool settings.");
       unManagedVolumeCharacteristics.put(
           SupportedVolumeCharacterstics.IS_AUTO_TIERING_ENABLED.toString(),
           Boolean.FALSE.toString());
     }
   }
 }
Beispiel #16
0
 private String getValueFromEditor() {
   if (jcbEditor != null) {
     if (parameter.getParameterClass() == boolean.class
         || parameter.getParameterClass() == Boolean.class) {
       switch (jcbEditor.getSelectedIndex()) {
         case 1:
           return Boolean.TRUE.toString();
         case 2:
           return Boolean.FALSE.toString();
         default:
           return null;
       }
     } else {
       int index = jcbEditor.getSelectedIndex();
       if (index == 0) {
         return null;
       } else {
         return parameter.getFixedValueList()[index - 1].toString();
       }
     }
   } else {
     String result = jtfEditor.getText();
     return "".equals(result) ? null : result;
   }
 }
 /**
  * Deletes all resources created by tests, after all tests have been run.
  *
  * <p>This cleanup method will always be run, even if one or more tests fail. For this reason, it
  * attempts to remove all resources created at any point during testing, even if some of those
  * resources may be expected to be deleted by certain tests.
  */
 @AfterClass(alwaysRun = true)
 public void cleanUp() {
   String noTest = System.getProperty("noTestCleanup");
   if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
     if (logger.isDebugEnabled()) {
       logger.debug("Skipping Cleanup phase ...");
     }
     return;
   }
   if (logger.isDebugEnabled()) {
     logger.debug("Cleaning up temporary resources created for testing ...");
   }
   IntakeClient intakeClient = new IntakeClient();
   // Note: Any non-success responses are ignored and not reported.
   for (String resourceId : intakeIdsCreated) {
     ClientResponse<Response> res = intakeClient.delete(resourceId);
     res.releaseConnection();
   }
   // Delete persons before PersonAuth
   OrgAuthorityClient personAuthClient = new OrgAuthorityClient();
   for (String resourceId : orgIdsCreated) {
     ClientResponse<Response> res = personAuthClient.deleteItem(orgAuthCSID, resourceId);
     res.releaseConnection();
   }
   if (orgAuthCSID != null) {
     personAuthClient.delete(orgAuthCSID).releaseConnection();
   }
 }
 void onPreStart() {
   if (!Boolean.parseBoolean(config.getConfig(Constants.STARTUPMODE_RESTORE_REINIT))) {
     config.setConfig(Constants.STARTUPMODE_RESTORE_REINIT, Boolean.TRUE.toString());
     coordinator.persistServiceConfiguration(config);
   }
   super.onPreStart();
 }
  /**
   * Deletes all resources created by tests, after all tests have been run.
   *
   * <p>This cleanup method will always be run, even if one or more tests fail. For this reason, it
   * attempts to remove all resources created at any point during testing, even if some of those
   * resources may be expected to be deleted by certain tests.
   *
   * @throws Exception
   */
  @AfterClass(alwaysRun = true)
  public void cleanUp() throws Exception {
    String noTest = System.getProperty("noTestCleanup");
    if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
      if (logger.isDebugEnabled()) {
        logger.debug("Skipping Cleanup phase ...");
      }
      return;
    }
    if (logger.isDebugEnabled()) {
      logger.debug("Cleaning up temporary resources created for testing ...");
    }
    PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
    // Delete Person resource(s) (before PersonAuthority resources).

    for (String resourceId : personIdsCreated) {
      // Note: Any non-success responses are ignored and not reported.
      personAuthClient.deleteItem(personAuthCSID, resourceId).close();
    }

    // Delete PersonAuthority resource(s).
    // Note: Any non-success response is ignored and not reported.
    if (personAuthCSID != null) {
      personAuthClient.delete(personAuthCSID);
      // Delete Condition Checks resource(s).
      ConditioncheckClient conditioncheckClient = new ConditioncheckClient();
      for (String resourceId : conditioncheckIdsCreated) {
        // Note: Any non-success responses are ignored and not reported.
        conditioncheckClient.delete(resourceId).close();
      }
    }
  }
  public String retrieveRequestToken(OAuthConsumer consumer, String callbackUrl)
      throws OAuthMessageSignerException, OAuthNotAuthorizedException,
          OAuthExpectationFailedException, OAuthCommunicationException {

    // invalidate current credentials, if any
    consumer.setTokenWithSecret(null, null);

    // 1.0a expects the callback to be sent while getting the request token.
    // 1.0 service providers would simply ignore this parameter.
    retrieveToken(consumer, this.requestTokenEndpointUrl, OAuth.OAUTH_CALLBACK, callbackUrl);

    String callbackConfirmed = this.responseParameters.getFirst(OAuth.OAUTH_CALLBACK_CONFIRMED);
    this.responseParameters.remove(OAuth.OAUTH_CALLBACK_CONFIRMED);
    this.isOAuth10a = Boolean.TRUE.toString().equals(callbackConfirmed);

    // 1.0 service providers expect the callback as part of the auth URL,
    // Do not send when 1.0a.
    if (this.isOAuth10a) {
      return OAuth.addQueryParameters(
          this.authorizationWebsiteUrl, OAuth.OAUTH_TOKEN, consumer.getToken());
    } else {
      return OAuth.addQueryParameters(
          this.authorizationWebsiteUrl,
          OAuth.OAUTH_TOKEN,
          consumer.getToken(),
          OAuth.OAUTH_CALLBACK,
          callbackUrl);
    }
  }
  private static synchronized void initMQConnectionFactory() {

    pool_conn_factory = new PooledConnectionFactory();

    MQConfig config = new MQConfig();

    String url = config.getProperty(MQConfig.ACTIVEMQ_CONN_URL, DEFAULT_URL);

    String user = config.getProperty(MQConfig.ACTIVEMQ_CONN_USER, DEFAULT_USER);

    String passwd = config.getProperty(MQConfig.ACTIVEMQ_CONN_PASSWD, DEFAULT_PASSWORD);

    ActiveMQConnectionFactory activeMQConnFactory =
        new ActiveMQConnectionFactory(user, passwd, url);

    if (Boolean.TRUE
        .toString()
        .equalsIgnoreCase(config.getProperty(MQConfig.ACTIVEMQ_POOL_USE_ASYNCSEND, "false"))) {
      activeMQConnFactory.setUseAsyncSend(true);
    }

    pool_conn_factory.setConnectionFactory(activeMQConnFactory);

    pool_conn_factory.setMaxConnections(
        config.getIntProperty(MQConfig.ACTIVEMQ_POOL_CONN_MAX, "10"));

    // Sets the maximum number of active sessions per connection
    pool_conn_factory.setMaximumActive(
        config.getIntProperty(MQConfig.ACTIVEMQ_POOL_ACTIVE_SESSION_MAX, "200"));

    pool_conn_factory.setIdleTimeout(
        config.getIntProperty(MQConfig.ACTIVEMQ_POOL_IDLETIMEOUT, "30000"));
  }
 /** get announcement group information */
 private static String getAnnouncementGroup(AnnouncementMessage a) {
   if (a.getProperties().getProperty(ResourceProperties.PROP_PUBVIEW) != null
       && a.getProperties()
           .getProperty(ResourceProperties.PROP_PUBVIEW)
           .equals(Boolean.TRUE.toString())) {
     return rb.getString("Public");
   } else if (a.getAnnouncementHeader().getAccess().equals(MessageHeader.MessageAccess.CHANNEL)) {
     return rb.getString("Allgroups");
   } else {
     int count = 0;
     String allGroupString = "";
     try {
       Site site = SiteService.getSite(EntityManager.newReference(a.getReference()).getContext());
       for (Iterator i = a.getAnnouncementHeader().getGroups().iterator(); i.hasNext(); ) {
         Group aGroup = site.getGroup((String) i.next());
         if (aGroup != null) {
           count++;
           if (count > 1) {
             allGroupString = allGroupString.concat(", ").concat(aGroup.getTitle());
           } else {
             allGroupString = aGroup.getTitle();
           }
         }
       }
     } catch (IdUnusedException e) {
       // No site available.
     }
     return allGroupString;
   }
 }
Beispiel #23
0
 private void configureSslClientAuth(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl) {
   if (ssl.getClientAuth() == ClientAuth.NEED) {
     protocol.setClientAuth(Boolean.TRUE.toString());
   } else if (ssl.getClientAuth() == ClientAuth.WANT) {
     protocol.setClientAuth("want");
   }
 }
  @Test
  public void one() {
    String val = sut.aBoolean(true);

    assertNotNull(val);
    assertEquals(val, Boolean.TRUE.toString());
  }
Beispiel #25
0
 private ImmutableMap<ConfigurationKeys, String> getPushParameters() {
   ImmutableMap<Factory.ConfigurationKeys, String> response = null;
   if (Push.PUSH_SANDBOX_ENABLE.getValueAsBoolean()) {
     response =
         ImmutableMap.of(
             ConfigurationKeys.ANDROID_API_KEY,
                 "" + Push.SANDBOX_ANDROID_API_KEY.getValueAsString(),
             ConfigurationKeys.APPLE_TIMEOUT, "" + Push.PUSH_APPLE_TIMEOUT.getValueAsString(),
             ConfigurationKeys.IOS_CERTIFICATE,
                 "" + Push.SANDBOX_IOS_CERTIFICATE.getValueAsString(),
             ConfigurationKeys.IOS_CERTIFICATE_PASSWORD,
                 "" + Push.SANDBOX_IOS_CERTIFICATE_PASSWORD.getValueAsString(),
             ConfigurationKeys.IOS_SANDBOX, "" + Boolean.TRUE.toString());
   } else {
     response =
         ImmutableMap.of(
             ConfigurationKeys.ANDROID_API_KEY,
                 "" + Push.PRODUCTION_ANDROID_API_KEY.getValueAsString(),
             ConfigurationKeys.APPLE_TIMEOUT, "" + Push.PUSH_APPLE_TIMEOUT.getValueAsString(),
             ConfigurationKeys.IOS_CERTIFICATE,
                 "" + Push.PRODUCTION_IOS_CERTIFICATE.getValueAsString(),
             ConfigurationKeys.IOS_CERTIFICATE_PASSWORD,
                 "" + Push.PRODUCTION_IOS_CERTIFICATE_PASSWORD.getValueAsString(),
             ConfigurationKeys.IOS_SANDBOX, "" + Boolean.FALSE.toString());
   }
   return response;
 }
  public static void importConfigsTo(@NotNull String newConfigPath) {
    ConfigImportSettings settings = getConfigImportSettings();

    File newConfigDir = new File(newConfigPath);
    File oldConfigDir = findOldConfigDir(newConfigDir, settings.getCustomPathsSelector());
    do {
      ImportOldConfigsPanel dialog = new ImportOldConfigsPanel(oldConfigDir, settings);
      dialog.setModalityType(Dialog.ModalityType.TOOLKIT_MODAL);
      AppUIUtil.updateWindowIcon(dialog);
      dialog.setVisible(true);
      if (dialog.isImportEnabled()) {
        File installationHome = dialog.getSelectedFile();
        oldConfigDir = getOldConfigDir(installationHome, settings);
        if (!validateOldConfigDir(installationHome, oldConfigDir, settings)) {
          continue;
        }

        assert oldConfigDir != null;
        doImport(newConfigDir, oldConfigDir, settings, installationHome);
        settings.importFinished(newConfigPath);
        System.setProperty(CONFIG_IMPORTED_IN_CURRENT_SESSION_KEY, Boolean.TRUE.toString());
      }

      break;
    } while (true);
  }
Beispiel #27
0
 private static Object parseValue(CharacterIterator it) {
   switch (it.current()) {
     case '{':
       return parseObject(it);
     case '[':
       return parseArray(it);
     case '"':
       return parseString(it);
     case '-':
     case '0':
     case '1':
     case '2':
     case '3':
     case '4':
     case '5':
     case '6':
     case '7':
     case '8':
     case '9':
       return parseNumber(it);
     case 't':
       parseText(Boolean.TRUE.toString(), it);
       return Boolean.TRUE;
     case 'f':
       parseText(Boolean.FALSE.toString(), it);
       return Boolean.FALSE;
     case 'n':
       parseText(NULL, it);
       return null;
   }
   throw error(
       "Bad JSON starting character '" + it.current() + "'", it); // $NON-NLS-1$ //$NON-NLS-2$;
 }
  protected String addJournalContentPortletToLayout(
      long userId, Layout layout, JournalArticle journalArticle, String columnId) throws Exception {

    LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) layout.getLayoutType();

    String journalPortletId =
        layoutTypePortlet.addPortletId(userId, PortletKeys.JOURNAL_CONTENT, columnId, -1);

    LayoutLocalServiceUtil.updateLayout(
        layout.getGroupId(),
        layout.isPrivateLayout(),
        layout.getLayoutId(),
        layout.getTypeSettings());

    javax.portlet.PortletPreferences prefs =
        getPortletPreferences(layout.getCompanyId(), layout.getPlid(), journalPortletId);

    prefs.setValue("articleId", journalArticle.getArticleId());
    prefs.setValue("groupId", String.valueOf(journalArticle.getGroupId()));
    prefs.setValue("showAvailableLocales", Boolean.TRUE.toString());

    updatePortletPreferences(layout.getPlid(), journalPortletId, prefs);

    return journalPortletId;
  }
  private static void ambiguousPUError(
      DeploymentUnit unit, String persistenceUnitName, PersistenceUnitMetadataHolder holder) {
    if (holder.getPersistenceUnits().size() > 1
        && (persistenceUnitName == null || persistenceUnitName.length() == 0)) {
      int numberOfDefaultPersistenceUnits = 0;

      // get number of persistence units that are marked as default
      for (PersistenceUnitMetadata persistenceUnit : holder.getPersistenceUnits()) {
        String defaultPU =
            persistenceUnit.getProperties().getProperty(Configuration.JPA_DEFAULT_PERSISTENCE_UNIT);
        if (Boolean.TRUE.toString().equals(defaultPU)) {
          numberOfDefaultPersistenceUnits++;
        }
      }
      ROOT_LOGGER.tracef(
          "checking for ambiguous persistence unit injection error, "
              + "number of persistence units marked default (%s) = %d",
          Configuration.JPA_DEFAULT_PERSISTENCE_UNIT, numberOfDefaultPersistenceUnits);
      // don't throw an error if there is exactly one default persistence unit
      if (numberOfDefaultPersistenceUnits != 1) {
        // AS7-2275 no unitName and there is more than one persistence unit;
        throw MESSAGES.noPUnitNameSpecifiedAndMultiplePersistenceUnits(
            holder.getPersistenceUnits().size(), unit);
      }
    }
  }
 /** This method is not adapted used in SAML_SP case. */
 void reLogginUserIfRequired(
     HttpServletRequest httpRequest,
     HttpServletResponse httpResponse,
     AuthorizationRequestData rdo,
     StringBuffer url) {
   final String userId = httpRequest.getParameter(PARAM_LOGIN_USER_ID);
   if (!ADMStringUtils.isBlank(userId)) {
     // user login data was just provided by the login dialog
     try {
       ServiceAccess serviceAccess = ServiceAccess.getServiceAcccessFor(httpRequest.getSession());
       IdentityService identityService = serviceAccess.getService(IdentityService.class);
       rdo.setUserId(userId);
       rdo.setPassword(httpRequest.getParameter(PARAM_LOGIN_PASSWORD));
       VOUser voUser = readTechnicalUserFromDb(identityService, rdo);
       serviceAccess.login(voUser, rdo.getPassword(), httpRequest, httpResponse);
       httpRequest
           .getSession()
           .setAttribute(Constants.SESS_ATTR_USER, identityService.getCurrentUserDetails());
     } catch (Exception e2) {
       httpRequest.setAttribute(Constants.REQ_ATTR_ERROR_KEY, BaseBean.ERROR_LOGIN);
       // open marketplace login dialog again and fill in
       // userId
       appendParam(
           url,
           Constants.REQ_PARAM_AUTO_OPEN_MP_LOGIN_DIALOG,
           Boolean.TRUE.toString(),
           httpRequest.getCharacterEncoding());
       appendParam(url, Constants.REQ_PARAM_USER_ID, userId, httpRequest.getCharacterEncoding());
     }
   }
 }