@Override
  public Object visit(ASTReturnStatement node, Object data) {
    LOGGER.entering(CLASS_NAME, "visit(ASTReturnStatement)");
    // return statements are valued at 1, or the value of the boolean
    // expression

    ASTExpression expr = node.getFirstChildOfType(ASTExpression.class);

    if (expr == null) {
      return NumericConstants.ONE;
    }

    int boolCompReturn = sumExpressionComplexity(expr);
    int conditionalExpressionComplexity = complexityMultipleOf(expr, 1, data);

    if (conditionalExpressionComplexity > 1) {
      boolCompReturn += conditionalExpressionComplexity;
    }

    if (boolCompReturn > 0) {
      return Integer.valueOf(boolCompReturn);
    }
    LOGGER.entering(CLASS_NAME, "visit(ASTReturnStatement)", NumericConstants.ONE);
    return NumericConstants.ONE;
  }
  /**
   * Check the schema exists and if not we will use the default schema
   *
   * @return
   * @throws SQLException
   */
  private boolean isOracleSchemaValid() throws SQLException {

    logger.entering(CLASSNAME, "isOracleSchemaValid");
    boolean result = false;
    Connection conn = null;
    DatabaseMetaData dbmd = null;
    ResultSet rs = null;

    try {
      conn = getConnectionToDefaultSchema();
      dbmd = conn.getMetaData();
      rs = dbmd.getSchemas();

      while (rs.next()) {

        String schemaname = rs.getString("TABLE_SCHEM");
        if (schema.equalsIgnoreCase(schemaname)) {
          logger.exiting(CLASSNAME, "isSchemaValid", true);
          return true;
        }
      }
    } catch (SQLException e) {
      logger.severe(e.getLocalizedMessage());
      throw e;
    } finally {
      cleanupConnection(conn, rs, null);
    }
    logger.exiting(CLASSNAME, "isOracleSchemaValid", false);

    return result;
  }
Esempio n. 3
0
  protected void handle(Message message) throws SequenceFault, RMException {
    LOG.entering(getClass().getName(), "handleMessage");
    // This message capturing mechanism will need to be changed at some point.
    // Until then, we keep this interceptor here and utilize the robust
    // option to avoid the unnecessary message capturing/caching.
    if (!MessageUtils.isTrue(message.getContextualProperty(Message.ROBUST_ONEWAY))) {
      InputStream is = message.getContent(InputStream.class);
      if (is != null) {
        CachedOutputStream saved = new CachedOutputStream();
        try {
          IOUtils.copy(is, saved);

          saved.flush();
          is.close();
          saved.lockOutputStream();

          LOG.fine("Capturing the original RM message");
          RewindableInputStream ris = RewindableInputStream.makeRewindable(saved.getInputStream());
          message.setContent(InputStream.class, ris);
          message.put(RMMessageConstants.SAVED_CONTENT, ris);
        } catch (Exception e) {
          throw new Fault(e);
        }
      }
    }
  }
Esempio n. 4
0
  public ImageViewerFrame() {
    logger.entering("ImageViewerFrame", "<init>");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    // set up menu bar
    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);
    JMenu menu = new JMenu("File");
    menuBar.add(menu);

    JMenuItem openItem = new JMenuItem("Open");
    menu.add(openItem);
    openItem.addActionListener(new FileOpenListener());
    JMenuItem exitItem = new JMenuItem("Exit");
    menu.add(exitItem);
    exitItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            logger.fine("Exiting.");
            System.exit(0);
          }
        });
    // use a label to display the images
    label = new JLabel();
    add(label);
    logger.exiting("ImageViewerFrame", "<init>");
  }
Esempio n. 5
0
  /**
   * 指定されたRequestProcessorがリクエスト処理を行なわないように登録を抹消する。
   *
   * @param processor リクエスト処理を停止するRequestProcessor
   */
  public synchronized void removeRequestProcessor(RequestProcessor processor) {
    logger.entering(className, "removeRequestProcessor", processor);

    processors.remove(processor);

    logger.exiting(className, "removeRequestProcessor");
  }
Esempio n. 6
0
  /** RequestDispatcherを生成する。 */
  public RequestDispatcher() {
    logger.entering(className, "RequestDispatcher");

    processors = new LinkedList<RequestProcessor>();

    logger.exiting(className, "RequestDispatcher");
  }
Esempio n. 7
0
 protected void popLocalMinima() {
   LOGGER.entering(ClipperBase.class.getName(), "popLocalMinima");
   if (currentLM == null) {
     return;
   }
   currentLM = currentLM.next;
 }
Esempio n. 8
0
  // se crea una nueva edicion para el formulario indicado.
  @Override
  public String edicionFormulario(Formulario formulario, String obsEdicion, Usuario usuarioSesion) {
    logger.setLevel(Level.ALL);
    logger.entering(this.getClass().getName(), "edicionFormulario");
    if (obsEdicion == null) {
      logger.exiting(this.getClass().getName(), "edicionFormulario", "falta observación.");
      return "Se requiere la observación.";
    }

    // verificando que el usuario que edita si haya participado en la cc.
    if (!esParticipanteCC(formulario, usuarioSesion)) {
      logger.exiting(
          this.getClass().getName(), "edicionFormulario", "usuario no ha participado en cc");
      return "Ud no ha participado en esta cadena de custodia.";
    }

    // Creando el objeto edicion
    EdicionFormulario edF = new EdicionFormulario();

    edF.setFormularioNUE(formulario);
    edF.setUsuarioidUsuario(usuarioSesion);
    edF.setObservaciones(obsEdicion);
    edF.setFechaEdicion(new Date(System.currentTimeMillis()));

    // Actualizando ultima edicion formulario
    formulario.setUltimaEdicion(edF.getFechaEdicion());

    edicionFormularioFacade.edit(edF);
    formularioFacade.edit(formulario);

    logger.exiting(this.getClass().getName(), "edicionFormulario", "Exito");
    return "Exito";
  }
Esempio n. 9
0
  /**
   * Wrapper method to update a User's profile
   *
   * @param Profile
   * @return returns true if profile is updated successfully
   * @throws ProfileServiceException
   */
  public boolean updateProfile(Profile profile) throws ProfileServiceException {
    if (logger.isLoggable(Level.FINEST)) {
      logger.entering(sourceClass, "update", profile);
    }
    if (profile == null) {
      throw new IllegalArgumentException(Messages.InvalidArgument_3);
    }
    boolean result = true;

    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put(ProfileRequestParams.OUTPUT, "vcard");
    parameters.put(ProfileRequestParams.FORMAT, "full");
    Map<String, String> headers = new HashMap<String, String>();
    headers.put(Headers.ContentType, Headers.ATOM);
    if (isEmail(profile.getReqId())) {
      parameters.put(ProfileRequestParams.EMAIL, profile.getReqId());
    } else {
      parameters.put(ProfileRequestParams.USERID, profile.getReqId());
    }
    Object updateProfilePayload = profile.constructUpdateRequestBody();
    String url =
        resolveProfileUrl(
            ProfileEntity.NONADMIN.getProfileEntityType(),
            ProfileType.UPDATEPROFILE.getProfileType());
    result = executePut(url, parameters, headers, updateProfilePayload, ClientService.FORMAT_NULL);
    profile.clearFieldsMap();
    removeProfileDataFromCache(profile.getReqId());

    if (logger.isLoggable(Level.FINEST)) {
      logger.exiting(sourceClass, "update");
    }

    return result;
  }
Esempio n. 10
0
 /**
  * Wrapper method to send Invite to a user to become colleague
  *
  * @param profile profile of the user to whom the invite is to be sent
  * @param inviteMsg Invite message to the other user
  * @return value is true if invite is sent successfully else value is false
  * @throws ProfileServiceException
  */
 public boolean sendInvite(Profile profile, String inviteMsg) throws ProfileServiceException {
   if (logger.isLoggable(Level.FINEST)) {
     logger.entering(sourceClass, "getColleagues", inviteMsg);
   }
   if (profile == null) {
     throw new IllegalArgumentException(StringUtil.format("A null profile was passed"));
   }
   Map<String, String> parameters = new HashMap<String, String>();
   String url =
       resolveProfileUrl(
           ProfileEntity.NONADMIN.getProfileEntityType(),
           ProfileType.CONNECTIONS.getProfileType());
   if (isEmail(profile.getReqId())) {
     parameters.put(ProfileRequestParams.EMAIL, profile.getReqId());
   } else {
     parameters.put(ProfileRequestParams.USERID, profile.getReqId());
   }
   parameters.put("connectionType", "colleague");
   XMLProfilesPayloadBuilder builder = XMLProfilesPayloadBuilder.INSTANCE;
   Object content = builder.generateInviteRequestPayload(inviteMsg);
   // getClientService().post(url, parameters, content);
   boolean result = executePost(url, parameters, null, content, null);
   if (logger.isLoggable(Level.FINEST)) {
     logger.exiting(sourceClass, "getColleagues");
   }
   return result;
 }
Esempio n. 11
0
  /**
   * Wrapper method to get a list of pending invites for a user
   *
   * @param parameters list of query string parameters to pass to API
   * @return Collection<ConnectionEntry>
   * @throws ProfileServiceException
   */
  private Collection<ConnectionEntry> getMyInvites(Map<String, String> parameters)
      throws ProfileServiceException {
    if (logger.isLoggable(Level.FINEST)) {
      logger.entering(sourceClass, "getMyInvites", parameters);
    }

    Document data = null;
    Collection<ConnectionEntry> invites = null;
    String url =
        resolveProfileUrl(
            ProfileEntity.NONADMIN.getProfileEntityType(),
            ProfileType.CONNECTIONS.getProfileType());
    data = executeGet(url, parameters, ClientService.FORMAT_XML);
    if (parameters.containsKey("outputType")) {
      if (parameters.get("outputType").equalsIgnoreCase("profile")) {
        invites = Converter.returnConnectionEntries(data, "profile");
      } else invites = Converter.returnConnectionEntries(data, "connection");
    } else {
      invites = Converter.returnConnectionEntries(data, "connection");
    }
    if (logger.isLoggable(Level.FINEST)) {
      logger.exiting(sourceClass, "getMyInvites");
    }
    return invites;
  }
Esempio n. 12
0
 /**
  * Wrapper method to search profiles based on different parameters
  *
  * @param parameters list of query string parameters to pass to API
  * @return Collection<Profile>
  */
 public Collection<Profile> searchProfiles(Map<String, String> parameters) {
   if (logger.isLoggable(Level.FINEST)) {
     logger.entering(sourceClass, "searchProfiles", parameters);
   }
   Document data = null;
   Collection<Profile> profiles = null;
   if (null == parameters) {
     parameters = new HashMap<String, String>();
   }
   try {
     String url =
         resolveProfileUrl(
             ProfileEntity.NONADMIN.getProfileEntityType(), ProfileType.SEARCH.getProfileType());
     data = (Document) getClientService().get(url, parameters);
     profiles = Converter.returnProfileEntries(this, data);
   } catch (ClientServicesException e) {
     if (logger.isLoggable(Level.SEVERE)) {
       logger.log(Level.SEVERE, Messages.ProfileServiceException_1 + "searchProfiles()", e);
     }
   }
   if (logger.isLoggable(Level.FINEST)) {
     logger.exiting(sourceClass, "getColleagues");
   }
   return profiles;
 }
Esempio n. 13
0
 /**
  * Returns profile's of multiple user's.
  *
  * @param userIds
  * @return Profile[]
  * @throws ProfileServiceException
  */
 private Profile[] getProfiles(String[] userIds) throws ProfileServiceException {
   if (logger.isLoggable(Level.FINEST)) {
     logger.entering(sourceClass, "getProfiles", userIds);
   }
   Profile[] profiles = new Profile[userIds.length];
   int i = 0;
   if (userIds != null) {
     for (String userId : userIds) {
       if (userId != null) {
         profiles[i] = getProfile(userId);
         i++;
       } else // elementary NP handling. Setting the profile null;
       {
         profiles[i] = null;
         i++;
       }
     }
   }
   if (logger.isLoggable(Level.FINEST)) {
     String log = "call to retrive profiles successful";
     if (profiles != null) {
       for (Profile profile : profiles) {
         if (null == profile) {
           log = "Empty response from server for one of the requested profiles";
           break;
         }
       }
       log = "";
     }
     logger.exiting(sourceClass, "getProfiles", log);
   }
   return profiles;
 }
Esempio n. 14
0
 public void setInitializationData(
     IConfigurationElement config, String propertyName, Object ignore) throws CoreException {
   final String METHOD_NAME = "setInitializationData";
   boolean isTraceEnabled = LOGGER.isLoggable(Level.FINER);
   boolean isDebugEnabled = LOGGER.isLoggable(Level.FINEST);
   boolean isErrorEnabled = LOGGER.isLoggable(Level.SEVERE);
   if (isTraceEnabled) {
     LOGGER.entering(CLASS_NAME, METHOD_NAME);
   }
   this.templateId = config.getAttribute("wcmTemplateId");
   String subTitle = config.getAttribute("requiresSubtitle");
   if (subTitle != null) {
     this.requiresSubtitle = Boolean.valueOf(subTitle).booleanValue();
   }
   if (config.getChildren("style").length > 0) {
     this.hasStyles = true;
   }
   if (isDebugEnabled) {
     LOGGER.finest(
         METHOD_NAME
             + " Builder initialized with template ID "
             + this.templateId
             + ", requiresSubtitle="
             + this.requiresSubtitle
             + ", hasStyles="
             + this.hasStyles
             + "...");
   }
   if (isTraceEnabled) {
     LOGGER.exiting(CLASS_NAME, METHOD_NAME);
   }
 }
  /**
   * Check indexes exist for the jbatch tables
   *
   * @param indexname
   * @return
   * @throws SQLException
   */
  public boolean checkOracleIndexExists(String indexname) throws SQLException {
    logger.entering(CLASSNAME, "createOracleIndexNotExists");
    Connection conn = null;
    boolean indexexists = false;
    ResultSet results = null;
    try {
      conn = getConnection();
      Statement stmt = conn.createStatement();

      results =
          stmt.executeQuery(
              "select lower(index_name) from user_indexes where lower(index_name)="
                  + "\'"
                  + indexname.toLowerCase()
                  + "\'");

      while (results.next()) {

        indexexists = true;
        break;
      }
    } catch (SQLException e) {

      e.printStackTrace();
      throw e;
    } finally {
      cleanupConnection(conn, results, null);
    }
    logger.exiting(CLASSNAME, "createOracleIndexNotExists");
    return indexexists;
  }
  public Date getTriggerTimeForPhase(WorkflowTransactionPhase phase) throws ApplicationException {
    if (LOG.isLoggable(Level.FINER)) {
      LOG.entering(
          AutoRejectNewItemTransition.class.getName(),
          "#AutoReject: getTriggerTimeForPhase",
          new Object[] {phase});
    }

    NewItemPlacementBean nipb =
        NewItemServicesUtils.getNewItemPlacementCommand()
            ._getActivePlacementByTransactionId(phase.getTransactionId());
    if (nipb == null) {
      LOG.log(
          Level.SEVERE,
          "Error invoking AutoKillNewItemTransition timer for New Item Workflow on transaction ID: "
              + phase.getId());
      throw new ApplicationException(
          "Error invoking AutoKillNewItemTransition timer for New Item Workflow on transaction ID: "
              + phase.getId());
    }

    Calendar triggerDate = nipb.getReviewStartDate();

    triggerDate.set(Calendar.HOUR_OF_DAY, 0);
    triggerDate.set(Calendar.MINUTE, 0);
    triggerDate.set(Calendar.SECOND, 0);
    triggerDate.set(Calendar.MILLISECOND, 0);

    if (LOG.isLoggable(Level.FINER)) {
      LOG.exiting(
          AutoRejectNewItemTransition.class.getName(), "#AutoReject: getTriggerTimeForPhase");
    }
    return triggerDate.getTime();
  }
Esempio n. 17
0
  private Usuario crearExterno(Usuario usuario, String cargo) {
    logger.setLevel(Level.ALL);
    logger.entering(this.getClass().getName(), "crearExterno");

    if (usuario != null) {
      Usuario nuevoExterno = usuario;
      Area areaExterno = areaFacade.findByArea("Otro");
      TipoUsuario tue = tipoUsuarioFacade.findByTipo("Externo");
      Cargo cargoExterno = cargoFacade.findByCargo(cargo);
      if (cargoExterno == null) {
        Cargo nuevo = new Cargo();
        nuevo.setNombreCargo(cargo);
        cargoFacade.create(nuevo);
        cargoExterno = cargoFacade.findByCargo(cargo);
      }

      nuevoExterno.setAreaidArea(areaExterno);
      nuevoExterno.setCargoidCargo(cargoExterno);
      nuevoExterno.setTipoUsuarioidTipoUsuario(tue);
      nuevoExterno.setEstadoUsuario(Boolean.TRUE);
      nuevoExterno.setMailUsuario("na");
      nuevoExterno.setPassUsuario("na");
      logger.finest("se inicia la persistencia del nuevo usuario externo");
      usuarioFacade.create(nuevoExterno);
      logger.finest("se finaliza la persistencia del nuevo usuario externo");

      nuevoExterno = usuarioFacade.findByRUN(usuario.getRutUsuario());
      if (nuevoExterno != null) {
        logger.exiting(this.getClass().getName(), "crearExterno", nuevoExterno.toString());
        return nuevoExterno;
      }
    }
    logger.exiting(this.getClass().getName(), "crearExterno", null);
    return null;
  }
Esempio n. 18
0
  /**
   * Method to remove the user profile from cache.
   *
   * @param userId
   */
  protected void removeProfileDataFromCache(String userId) throws ProfileServiceException {
    if (logger.isLoggable(Level.FINEST)) {
      logger.entering(sourceClass, "removeProfileDataFromCache", userId);
    }
    if (isEmail(userId)) {
      String key;
      Set<String> keys = lruCache.getKeySet();
      Iterator<String> itr = keys.iterator();
      while (itr.hasNext()) {
        key = itr.next();
        Document data = lruCache.get(key);
        // check if email in profile object is same as input userId
        String email = "";
        try {
          email = DOMUtil.value(data, Profile.xpathMap.get("email"));
        } catch (XMLException e) {
          continue;
        }

        // cache hit
        if (StringUtil.equalsIgnoreCase(email, userId)) {
          lruCache.remove(key);
        }
      }
      // Cache miss

    } else {
      lruCache.remove(userId);
    }
    if (logger.isLoggable(Level.FINEST)) {
      logger.exiting(sourceClass, "removeProfileDataFromCache");
    }
  }
Esempio n. 19
0
  // retorna true cuando el usuario si ha particiado en la cc.
  private boolean esParticipanteCC(Formulario formulario, Usuario usuario) {
    logger.setLevel(Level.ALL);
    logger.entering(this.getClass().getName(), "obtenerParticipantesCC");
    if (usuario.equals(formulario.getUsuarioidUsuario1())) {
      logger.exiting(this.getClass().getName(), "obtenerParticipantesCC", true);
      return true;
    }
    List<Traslado> traslados = trasladoFacade.findByNue(formulario);

    if (traslados
        .get(0)
        .getUsuarioidUsuario()
        .equals(usuario)) { // valida 1er traslado, útil para digitador.
      logger.exiting(this.getClass().getName(), "obtenerParticipantesCC", true);
      return true;
    }

    for (int i = 0; i < traslados.size(); i++) {
      if (traslados.get(i).getUsuarioidUsuario1().equals(usuario)) {
        logger.exiting(this.getClass().getName(), "obtenerParticipantesCC", true);
        return true;
      }
    }
    logger.exiting(this.getClass().getName(), "obtenerParticipantesCC", false);
    return false;
  }
Esempio n. 20
0
 @Override
 public Object visit(PLSQLNode node, Object data) {
   LOGGER.entering(CLASS_NAME, "visit(SimpleNode)");
   int npath = complexityMultipleOf(node, 1, data);
   LOGGER.exiting(CLASS_NAME, "visit(SimpleNode)", npath);
   return Integer.valueOf(npath);
 }
Esempio n. 21
0
 @Override
 public final void run() {
   final Locus locus = context.getLocus();
   final Bundle bundle = context.getBundle();
   final Alerts alerts = context.getAlerts();
   final File file = context.getFile();
   final String href = context.getHref();
   try {
     logger.entering(getClass().getName(), Runnable.class.getName());
     script.start();
     runInner();
   } catch (IOException e) {
     alerts.add(new Alert(Alert.Severity.ERR, e.getMessage(), e.getClass().getSimpleName()));
   } finally {
     script.finish();
   }
   try {
     new ScriptWriter(script, locus).writeTo(file);
     new AlertWriter(bundle, alerts).write("command.finished", "results.view", href);
   } catch (IOException e) {
     alerts.add(new Alert(Alert.Severity.ERR, e.getMessage()));
   } finally {
     logger.exiting(getClass().getName(), Runnable.class.getName());
   }
 }
Esempio n. 22
0
  @Override
  public Object visit(ASTElseClause node, Object data) {
    LOGGER.entering(CLASS_NAME, "visit(ASTElseClause)");
    // (npath of if + npath of else (or 1) + bool_comp of if) * npath of
    // next

    int complexity = 0;

    List<PLSQLNode> statementChildren = new ArrayList<PLSQLNode>();
    for (int i = 0; i < node.jjtGetNumChildren(); i++) {
      if (node.jjtGetChild(i).getClass() == ASTStatement.class) {
        statementChildren.add((PLSQLNode) node.jjtGetChild(i));
      }
    }
    if (LOGGER.isLoggable(Level.FINEST)) {
      LOGGER.finest(
          statementChildren.size()
              + " statementChildren found for ELSE clause statement "
              + node.getBeginLine()
              + ", column "
              + node.getBeginColumn());
    }

    for (PLSQLNode element : statementChildren) {
      complexity += (Integer) element.jjtAccept(this, data);
    }

    LOGGER.exiting(CLASS_NAME, "visit(ASTElseClause)", complexity);
    return Integer.valueOf(complexity);
  }
Esempio n. 23
0
  /**
   * 指定されたRequestProcessorがリクエスト処理を行なうように登録する。
   *
   * @param processor リクエスト処理を実行するRequestProcessor
   */
  public synchronized void addRequestProcessor(RequestProcessor processor) {
    logger.entering(className, "addRequestProcessor", processor);

    processors.add(processor);

    logger.exiting(className, "addRequestProcessor");
  }
Esempio n. 24
0
  /**
   * Calculate the boolean complexity of the given expression. NPath boolean complexity is the sum
   * of && and || tokens. This is calculated by summing the number of children of the &&'s (minus
   * one) and the children of the ||'s (minus one).
   *
   * <p>Note that this calculation applies to Cyclomatic Complexity as well.
   *
   * @param expr control structure expression
   * @return complexity of the boolean expression
   */
  public static int sumExpressionComplexity(ASTExpression expr) {
    LOGGER.entering(CLASS_NAME, "visit(ASTExpression)");
    if (expr == null) {
      LOGGER.exiting(CLASS_NAME, "visit(ASTExpression)", 0);
      return 0;
    }

    List<ASTConditionalAndExpression> andNodes =
        expr.findDescendantsOfType(ASTConditionalAndExpression.class);
    List<ASTConditionalOrExpression> orNodes =
        expr.findDescendantsOfType(ASTConditionalOrExpression.class);

    int children = 0;

    for (ASTConditionalOrExpression element : orNodes) {
      children += element.jjtGetNumChildren();
      children--;
    }

    for (ASTConditionalAndExpression element : andNodes) {
      children += element.jjtGetNumChildren();
      children--;
    }

    LOGGER.exiting(CLASS_NAME, "visit(ASTExpression)", children);
    return children;
  }
Esempio n. 25
0
  void start() throws KeyStoreException, CertificateEncodingException, IOException {
    if (Configuration.DEBUG) log.entering(this.getClass().getName(), "start"); // $NON-NLS-1$
    ensureStoreContainsAlias();
    Certificate certificate;
    if (store.isCertificateEntry(alias)) {
      if (Configuration.DEBUG)
        log.fine("Alias [" + alias + "] is a trusted certificate"); // $NON-NLS-1$ //$NON-NLS-2$
      certificate = store.getCertificate(alias);
    } else {
      if (Configuration.DEBUG)
        log.fine("Alias [" + alias + "] is a key entry"); // $NON-NLS-1$ //$NON-NLS-2$
      Certificate[] chain = store.getCertificateChain(alias);
      certificate = chain[0];
    }

    byte[] derBytes = certificate.getEncoded();
    if (rfc) {
      String encoded = Base64.encode(derBytes, 72);
      PrintWriter pw = new PrintWriter(outStream, true);
      pw.println("-----BEGIN CERTIFICATE-----"); // $NON-NLS-1$
      pw.println(encoded);
      pw.println("-----END CERTIFICATE-----"); // $NON-NLS-1$
    } else outStream.write(derBytes);

    // stream is closed in Command.teardown()
    if (Configuration.DEBUG) log.exiting(this.getClass().getName(), "start"); // $NON-NLS-1$
  }
Esempio n. 26
0
 /*
  * Checks that all the provided <code>URL</code> s have permission to use
  * the given policy.
  */
 private static void checkPolicyPermission(String policy, URL[] urls) {
   logger.entering(
       ActivateWrapper.class.getName(),
       "checkPolicyPermission",
       new Object[] {policy, urlsToPath(urls)});
   // Create desired permission object
   Permission perm = new SharedActivationPolicyPermission(policy);
   Certificate[] certs = null;
   CodeSource cs;
   ProtectionDomain pd;
   // Loop over all codebases
   for (URL url : urls) {
     // Create ProtectionDomain for given codesource
     cs = new CodeSource(url, certs);
     pd = new ProtectionDomain(cs, null, null, null);
     logger.log(Level.FINEST, "Checking protection domain: {0}", pd);
     // Check if current domain allows desired permission
     if (!pd.implies(perm)) {
       SecurityException se =
           new SecurityException(
               "ProtectionDomain " + pd + " does not have required permission: " + perm);
       logger.throwing(ActivateWrapper.class.getName(), "checkPolicyPermission", se);
       throw se;
     }
   }
   logger.exiting(ActivateWrapper.class.getName(), "checkPolicyPermission");
 }
Esempio n. 27
0
  private void initParam() {
    lg.entering(TyPun.class.getName(), "initParam");

    /* keep track of parameter’s values that will be used */
    lg.config(
        String.format("Use typographic punctuation : %s", tc.do_UsePunctuation() ? "YES" : "NO"));
    lg.config(String.format("Use ligatures : %s", tc.do_UseLigatures() ? "YES" : "NO"));
    lg.config(String.format("Use old ligatures : %s", tc.do_UseOldLigatures() ? "YES" : "NO"));
    lg.config(String.format("Use French quotes : %s", tc.do_UseFrenchQuotes() ? "YES" : "NO"));
    lg.config(String.format("Use old style numbers : %s", tc.do_UseOldStyleNums() ? "YES" : "NO"));
    lg.config(String.format("Use French spacing : %s", tc.do_UseFrenchSpacing() ? "YES" : "NO"));
    lg.config(String.format("Use typographic dashes : %s", tc.do_UseTypoDash() ? "YES" : "NO"));

    /* left and right double quotes are currently defined at compile-time
     * but the code needs very few changes to make it dynamic. That way we
     * may use English or French quotes running the exact same code */
    // ldquo = bUseFrenchQuotes ? "\u00ab" : "\u201c"; /* U+00ab « U+201c “ */
    // rdquo = bUseFrenchQuotes ? "\u00bb" : "\u201d"; /* U+00bb » U+201d ” */
    ldquo = tc.do_UseFrenchQuotes() ? "\u00ab" : "\u201c"; /* U+00ab « U+201c “ */
    rdquo = tc.do_UseFrenchQuotes() ? "\u00bb" : "\u201d"; /* U+00bb » U+201d ” */

    tydash = "\u2013";
    /* tydash = "\u2014"; */

    lg.exiting(TyPun.class.getName(), "initParam");
  }
  protected boolean process(WorkflowTransactionPhase phase) throws WorkflowException {
    if (LOG.isLoggable(Level.FINER)) {
      LOG.entering(AutoRejectNewItemTransition.class.getName(), "process", new Object[] {phase});
    }
    boolean success = false;
    boolean processed = false;
    try {
      DBHelper.startTransaction();

      NewItemPlacementBean nipb =
          NewItemServicesUtils.getNewItemPlacementCommand()
              ._getActivePlacementByTransactionId(phase.getTransactionId());
      long offset = Long.parseLong(DEFAULT_MAX_LENGTH_DAYS_OPEN);
      if (nipb != null) {
        if (handlesRegMbr(nipb.getRegionMemberId())) {
          DataItemBean dib =
              NewItemServicesUtils.getExpireDaysByRegionAlias(
                  NewItemServicesUtils.getPlacementRegionMemberAliasById(nipb.getRegionMemberId()));
          if (dib != null) offset = Long.parseLong(dib.getValue());

          this.triggerWhenBeforeOffset = new Long((-1) * offset * 24 * 60 * 60 * 1000);

          processed = super.process(phase);

          if (processed) {
            updateNewItemData(nipb);
          }
        }
        success = true;
      } else
        throw new WorkflowException(
            "Unable to locate placement data for AutoRejectNewItemTransition call on Transaction_ID ["
                + phase.getTransactionId()
                + "].");
    } catch (WorkflowException we) {
      LOG.log(
          Level.SEVERE, "Error invoking AutoRejectNewItemTransition for New Item Workflow!", we);
      throw new WorkflowException(
          "Error invoking AutoRejectNewItemTransition for New Item Workflow!  " + we.getMessage());
    } catch (Throwable th) {
      LOG.log(
          Level.SEVERE,
          "Error invoking AutoRejectNewItemTransition for New Item Workflow for phase ["
              + phase.getId()
              + "]!",
          th);
    } finally {
      try {
        DBHelper.finalizeActiveTransaction(null, success);
      } catch (Throwable th) {
        LOG.log(Level.SEVERE, "Error finalizing transaction for AutoRejectNewItemTransition time!");
        th.printStackTrace();
      }
    }

    if (LOG.isLoggable(Level.FINER)) {
      LOG.exiting(AutoRejectNewItemTransition.class.getName(), "process");
    }
    return processed;
  }
  @Override
  public boolean onOptionsItemSelected(final MenuItem item) {
    mLogger.entering(getClass().getName(), "onOptionsItemSelected", item);

    boolean result;
    if (super.onOptionsItemSelected(item)) {
      result = true;
    } else {
      switch (item.getItemId()) {
        case R.id.action_refresh:
          getSupportFragmentManager().popBackStack();
          (new ServiceDiscoveryTask()).execute();
          result = true;
          break;
        case R.id.action_access_token:
          authrize();
          result = true;
          break;
        case R.id.action_open_websocket:
          openWebsocket();
          result = true;
          break;
        case R.id.action_plugins:
          openPluginList();
          result = true;
          break;
        default:
          result = super.onOptionsItemSelected(item);
          break;
      }
    }

    mLogger.exiting(getClass().getName(), "onOptionsItemSelected", result);
    return result;
  }
Esempio n. 30
0
  /** Main method of the task */
  @Override
  public void run() {
    /*
     * Get the Logger
     */
    Logger logger = MyLogger.getLogger(this.getClass().getName());

    /*
     * Write a message indicating the start of the task
     */
    logger.entering(Thread.currentThread().getName(), "run()");

    /*
     * Sleep the task for two seconds
     */
    try {
      TimeUnit.SECONDS.sleep(2);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }

    /*
     * Write a message indicating the end of the task
     */
    logger.exiting(Thread.currentThread().getName(), "run()", Thread.currentThread());
  }