/** INTERNAL: Return if the expression is for a direct mapped attribute. */
 public boolean isAttribute() {
   if (isAttributeExpression == null) {
     if (getSession() == null) {
       // We can't tell, so say no.
       return false;
     }
     QueryKey queryKey = getQueryKeyOrNull();
     if (queryKey != null) {
       isAttributeExpression = Boolean.valueOf(queryKey.isDirectQueryKey());
     } else {
       DatabaseMapping mapping = getMapping();
       if (mapping != null) {
         if (mapping.isVariableOneToOneMapping()) {
           throw QueryException.cannotQueryAcrossAVariableOneToOneMapping(
               mapping, mapping.getDescriptor());
         } else {
           isAttributeExpression = Boolean.valueOf(mapping.isDirectToFieldMapping());
         }
       } else {
         isAttributeExpression = Boolean.FALSE;
       }
     }
   }
   return isAttributeExpression.booleanValue();
 }
Ejemplo n.º 2
0
 private static GeometricObject recreateObject(String data) {
   GeometricObject result = null;
   String[] token = data.split(",");
   if (token[0].equals("Circle")) { // find what constructor to use
     String color = token[1];
     boolean filled = Boolean.valueOf(token[2]); // find data in the line
     double radius = Double.valueOf(token[3]);
     try {
       return new Circle(color, filled, radius); // attempt to make a circle
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
   if (token[0].equals("Rectangle")) {
     String color = token[1];
     boolean filled = Boolean.valueOf(token[2]); // find data
     double height = Double.valueOf(token[3]);
     double width = Double.valueOf(token[4]);
     try {
       return new Rectangle(color, filled, height, width); // attempt to make a rectangle
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
   return result; // default return null GeometricObject
 } // end method
Ejemplo n.º 3
0
  /** Synchronizes the state of the actions to the current state of this host. */
  private void updateActions() {
    final DeviceController currentDeviceController = getDeviceController();

    final boolean deviceControllerSet = currentDeviceController != null;
    final boolean deviceCapturing = deviceControllerSet && currentDeviceController.isCapturing();
    final boolean deviceSetup =
        deviceControllerSet && !deviceCapturing && currentDeviceController.isSetup();

    getAction(CaptureAction.ID).setEnabled(deviceControllerSet);
    getAction(CancelCaptureAction.ID).setEnabled(deviceCapturing);
    getAction(RepeatCaptureAction.ID).setEnabled(deviceSetup);

    final boolean projectChanged = this.projectManager.getCurrentProject().isChanged();
    final boolean projectSavedBefore =
        this.projectManager.getCurrentProject().getFilename() != null;
    final boolean dataAvailable = this.dataContainer.hasCapturedData();

    getAction(SaveProjectAction.ID).setEnabled(projectChanged);
    getAction(SaveProjectAsAction.ID).setEnabled(projectSavedBefore && projectChanged);
    getAction(SaveDataFileAction.ID).setEnabled(dataAvailable);

    getAction(ZoomInAction.ID).setEnabled(dataAvailable);
    getAction(ZoomOutAction.ID).setEnabled(dataAvailable);
    getAction(ZoomDefaultAction.ID).setEnabled(dataAvailable);
    getAction(ZoomFitAction.ID).setEnabled(dataAvailable);

    final boolean triggerEnable = dataAvailable && this.dataContainer.hasTriggerData();
    getAction(GotoTriggerAction.ID).setEnabled(triggerEnable);

    // Update the cursor actions accordingly...
    final boolean enableCursors = dataAvailable && this.dataContainer.isCursorsEnabled();

    for (int c = 0; c < CapturedData.MAX_CURSORS; c++) {
      final boolean enabled = enableCursors && this.dataContainer.isCursorPositionSet(c);
      getAction(GotoNthCursorAction.getID(c)).setEnabled(enabled);
    }

    getAction(GotoFirstCursorAction.ID).setEnabled(enableCursors);
    getAction(GotoLastCursorAction.ID).setEnabled(enableCursors);

    getAction(SetCursorModeAction.ID).setEnabled(dataAvailable);
    getAction(SetCursorModeAction.ID)
        .putValue(Action.SELECTED_KEY, Boolean.valueOf(this.dataContainer.isCursorsEnabled()));

    boolean anyCursorSet = false;
    for (int c = 0; c < CapturedData.MAX_CURSORS; c++) {
      final boolean cursorPositionSet = this.dataContainer.isCursorPositionSet(c);
      anyCursorSet |= cursorPositionSet;

      final Action action = getAction(SetCursorAction.getCursorId(c));
      action.setEnabled(dataAvailable);
      action.putValue(Action.SELECTED_KEY, Boolean.valueOf(cursorPositionSet));
    }

    getAction(ClearCursors.ID).setEnabled(enableCursors && anyCursorSet);
  }
Ejemplo n.º 4
0
 /**
  * @attribute syn
  * @aspect GenericsSubtype
  * @declaredat
  *     /Users/eric/Documents/workspaces/clara-soot/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:212
  */
 @SuppressWarnings({"unchecked", "cast"})
 public boolean sameStructure(TypeDecl t) {
   Object _parameters = t;
   if (sameStructure_TypeDecl_values == null)
     sameStructure_TypeDecl_values = new java.util.HashMap(4);
   ASTNode$State.CircularValue _value;
   if (sameStructure_TypeDecl_values.containsKey(_parameters)) {
     Object _o = sameStructure_TypeDecl_values.get(_parameters);
     if (!(_o instanceof ASTNode$State.CircularValue)) {
       return ((Boolean) _o).booleanValue();
     } else _value = (ASTNode$State.CircularValue) _o;
   } else {
     _value = new ASTNode$State.CircularValue();
     sameStructure_TypeDecl_values.put(_parameters, _value);
     _value.value = Boolean.valueOf(true);
   }
   ASTNode$State state = state();
   if (!state.IN_CIRCLE) {
     state.IN_CIRCLE = true;
     int num = state.boundariesCrossed;
     boolean isFinal = this.is$Final();
     boolean new_sameStructure_TypeDecl_value;
     do {
       _value.visited = new Integer(state.CIRCLE_INDEX);
       state.CHANGE = false;
       new_sameStructure_TypeDecl_value = sameStructure_compute(t);
       if (new_sameStructure_TypeDecl_value != ((Boolean) _value.value).booleanValue()) {
         state.CHANGE = true;
         _value.value = Boolean.valueOf(new_sameStructure_TypeDecl_value);
       }
       state.CIRCLE_INDEX++;
     } while (state.CHANGE);
     if (isFinal && num == state().boundariesCrossed) {
       sameStructure_TypeDecl_values.put(_parameters, new_sameStructure_TypeDecl_value);
     } else {
       sameStructure_TypeDecl_values.remove(_parameters);
       state.RESET_CYCLE = true;
       sameStructure_compute(t);
       state.RESET_CYCLE = false;
     }
     state.IN_CIRCLE = false;
     return new_sameStructure_TypeDecl_value;
   }
   if (!new Integer(state.CIRCLE_INDEX).equals(_value.visited)) {
     _value.visited = new Integer(state.CIRCLE_INDEX);
     boolean new_sameStructure_TypeDecl_value = sameStructure_compute(t);
     if (state.RESET_CYCLE) {
       sameStructure_TypeDecl_values.remove(_parameters);
     } else if (new_sameStructure_TypeDecl_value != ((Boolean) _value.value).booleanValue()) {
       state.CHANGE = true;
       _value.value = new_sameStructure_TypeDecl_value;
     }
     return new_sameStructure_TypeDecl_value;
   }
   return ((Boolean) _value.value).booleanValue();
 }
Ejemplo n.º 5
0
  public RegionFile(File file) {
    lastModified = 0L;
    fileName = file;
    debugln((new StringBuilder()).append("REGION LOAD ").append(fileName).toString());
    sizeDelta = 0;
    try {
      if (file.exists()) {
        lastModified = file.lastModified();
      }
      dataFile = new RandomAccessFile(file, "rw");
      if (dataFile.length() < 4096L) {
        for (int i = 0; i < 1024; i++) {
          dataFile.writeInt(0);
        }

        for (int j = 0; j < 1024; j++) {
          dataFile.writeInt(0);
        }

        sizeDelta += 8192;
      }
      if ((dataFile.length() & 4095L) != 0L) {
        for (int k = 0; (long) k < (dataFile.length() & 4095L); k++) {
          dataFile.write(0);
        }
      }
      int l = (int) dataFile.length() / 4096;
      sectorFree = new ArrayList(l);
      for (int i1 = 0; i1 < l; i1++) {
        sectorFree.add(Boolean.valueOf(true));
      }

      sectorFree.set(0, Boolean.valueOf(false));
      sectorFree.set(1, Boolean.valueOf(false));
      dataFile.seek(0L);
      for (int j1 = 0; j1 < 1024; j1++) {
        int l1 = dataFile.readInt();
        offsets[j1] = l1;
        if (l1 == 0 || (l1 >> 8) + (l1 & 0xff) > sectorFree.size()) {
          continue;
        }
        for (int j2 = 0; j2 < (l1 & 0xff); j2++) {
          sectorFree.set((l1 >> 8) + j2, Boolean.valueOf(false));
        }
      }

      for (int k1 = 0; k1 < 1024; k1++) {
        int i2 = dataFile.readInt();
        chunkTimestamps[k1] = i2;
      }

    } catch (IOException ioexception) {
      ioexception.printStackTrace();
    }
  }
Ejemplo n.º 6
0
 @Override
 public SCM newInstance(StaplerRequest req, JSONObject formData) throws FormException {
   String path = req.getParameter("fs_scm.path");
   String[] filters = req.getParameterValues("fs_scm.filters");
   Boolean filterEnabled =
       Boolean.valueOf("on".equalsIgnoreCase(req.getParameter("fs_scm.filterEnabled")));
   Boolean includeFilter = Boolean.valueOf(req.getParameter("fs_scm.includeFilter"));
   Boolean clearWorkspace =
       Boolean.valueOf("on".equalsIgnoreCase(req.getParameter("fs_scm.clearWorkspace")));
   return new FSSCM(path, clearWorkspace, filterEnabled, includeFilter, filters);
 }
Ejemplo n.º 7
0
 @SuppressWarnings({"unchecked", "cast"})
 public boolean subtype(TypeDecl type) {
   Object _parameters = type;
   if (subtype_TypeDecl_visited == null) subtype_TypeDecl_visited = new java.util.HashMap(4);
   if (subtype_TypeDecl_values == null) subtype_TypeDecl_values = new java.util.HashMap(4);
   if (subtype_TypeDecl_computed.contains(_parameters))
     return ((Boolean) subtype_TypeDecl_values.get(_parameters)).booleanValue();
   if (!subtype_TypeDecl_initialized.contains(_parameters)) {
     subtype_TypeDecl_initialized.add(_parameters);
     subtype_TypeDecl_values.put(_parameters, Boolean.valueOf(true));
   }
   if (!IN_CIRCLE) {
     IN_CIRCLE = true;
     int num = boundariesCrossed;
     boolean isFinal = this.is$Final();
     CIRCLE_INDEX = 1;
     boolean new_subtype_TypeDecl_value;
     do {
       subtype_TypeDecl_visited.put(_parameters, new Integer(CIRCLE_INDEX));
       CHANGE = false;
       new_subtype_TypeDecl_value = subtype_compute(type);
       if (new_subtype_TypeDecl_value
           != ((Boolean) subtype_TypeDecl_values.get(_parameters)).booleanValue()) CHANGE = true;
       subtype_TypeDecl_values.put(_parameters, Boolean.valueOf(new_subtype_TypeDecl_value));
       CIRCLE_INDEX++;
     } while (CHANGE);
     if (isFinal && num == boundariesCrossed) {
       subtype_TypeDecl_computed.add(_parameters);
     } else {
       RESET_CYCLE = true;
       subtype_compute(type);
       RESET_CYCLE = false;
       subtype_TypeDecl_computed.remove(_parameters);
       subtype_TypeDecl_initialized.remove(_parameters);
     }
     IN_CIRCLE = false;
     return new_subtype_TypeDecl_value;
   }
   if (!new Integer(CIRCLE_INDEX).equals(subtype_TypeDecl_visited.get(_parameters))) {
     subtype_TypeDecl_visited.put(_parameters, new Integer(CIRCLE_INDEX));
     if (RESET_CYCLE) {
       subtype_TypeDecl_computed.remove(_parameters);
       subtype_TypeDecl_initialized.remove(_parameters);
       return ((Boolean) subtype_TypeDecl_values.get(_parameters)).booleanValue();
     }
     boolean new_subtype_TypeDecl_value = subtype_compute(type);
     if (new_subtype_TypeDecl_value
         != ((Boolean) subtype_TypeDecl_values.get(_parameters)).booleanValue()) CHANGE = true;
     subtype_TypeDecl_values.put(_parameters, Boolean.valueOf(new_subtype_TypeDecl_value));
     return new_subtype_TypeDecl_value;
   }
   return ((Boolean) subtype_TypeDecl_values.get(_parameters)).booleanValue();
 }
Ejemplo n.º 8
0
 // get licensing features, with appropriate defaults
 @SuppressWarnings("unchecked")
 private void loadLicensingFeatures(Element licensingElt) {
   List<LicensingFeature> licensingFeats = new ArrayList<LicensingFeature>();
   boolean containsLexFeat = false;
   if (licensingElt != null) {
     for (Iterator<Element> it = licensingElt.getChildren("feat").iterator(); it.hasNext(); ) {
       Element featElt = it.next();
       String attr = featElt.getAttributeValue("attr");
       if (attr.equals("lex")) containsLexFeat = true;
       String val = featElt.getAttributeValue("val");
       List<String> alsoLicensedBy = null;
       String alsoVals = featElt.getAttributeValue("also-licensed-by");
       if (alsoVals != null) {
         alsoLicensedBy = Arrays.asList(alsoVals.split("\\s+"));
       }
       boolean licenseEmptyCats = true;
       boolean licenseMarkedCats = false;
       boolean instantiate = true;
       byte loc = LicensingFeature.BOTH;
       String lmc = featElt.getAttributeValue("license-marked-cats");
       if (lmc != null) {
         licenseMarkedCats = Boolean.valueOf(lmc).booleanValue();
         // change defaults
         licenseEmptyCats = false;
         loc = LicensingFeature.TARGET_ONLY;
         instantiate = false;
       }
       String lec = featElt.getAttributeValue("license-empty-cats");
       if (lec != null) {
         licenseEmptyCats = Boolean.valueOf(lec).booleanValue();
       }
       String inst = featElt.getAttributeValue("instantiate");
       if (inst != null) {
         instantiate = Boolean.valueOf(inst).booleanValue();
       }
       String locStr = featElt.getAttributeValue("location");
       if (locStr != null) {
         if (locStr.equals("target-only")) loc = LicensingFeature.TARGET_ONLY;
         if (locStr.equals("args-only")) loc = LicensingFeature.ARGS_ONLY;
         if (locStr.equals("both")) loc = LicensingFeature.BOTH;
       }
       licensingFeats.add(
           new LicensingFeature(
               attr, val, alsoLicensedBy, licenseEmptyCats, licenseMarkedCats, instantiate, loc));
     }
   }
   if (!containsLexFeat) {
     licensingFeats.add(LicensingFeature.defaultLexFeature);
   }
   _licensingFeatures = new LicensingFeature[licensingFeats.size()];
   licensingFeats.toArray(_licensingFeatures);
 }
Ejemplo n.º 9
0
  /**
   * Initialize the backend systems, the log handler and the restrictor. A subclass can tune this
   * step by overriding {@link #createRestrictor(String)} and {@link
   * #createLogHandler(ServletConfig, boolean)}
   *
   * @param pServletConfig servlet configuration
   */
  @Override
  public void init(ServletConfig pServletConfig) throws ServletException {
    super.init(pServletConfig);

    Configuration config = initConfig(pServletConfig);

    // Create a log handler early in the lifecycle, but not too early
    String logHandlerClass = config.get(ConfigKey.LOGHANDLER_CLASS);
    logHandler =
        logHandlerClass != null
            ? (LogHandler) ClassUtil.newInstance(logHandlerClass)
            : createLogHandler(pServletConfig, Boolean.valueOf(config.get(ConfigKey.DEBUG)));

    // Different HTTP request handlers
    httpGetHandler = newGetHttpRequestHandler();
    httpPostHandler = newPostHttpRequestHandler();

    if (restrictor == null) {
      restrictor =
          createRestrictor(NetworkUtil.replaceExpression(config.get(ConfigKey.POLICY_LOCATION)));
    } else {
      logHandler.info("Using custom access restriction provided by " + restrictor);
    }
    configMimeType = config.get(ConfigKey.MIME_TYPE);
    backendManager = new BackendManager(config, logHandler, restrictor);
    requestHandler = new HttpRequestHandler(config, backendManager, logHandler);

    initDiscoveryMulticast(config);
  }
Ejemplo n.º 10
0
    /**
     * This method will parse the input stream and set the XMLStreamReader object for latter use.
     *
     * @param input InputStream
     * @exception XMLStreamException;
     */
    @Override
    protected void read(InputStream input) throws XMLStreamException {
      parser = getXMLInputFactory().createXMLStreamReader(input);

      int event = 0;
      while (parser.hasNext() && (event = parser.next()) != END_DOCUMENT) {
        if (event == START_ELEMENT) {
          String name = parser.getLocalName();
          if ("Context".equals(name)) {
            String path = null;
            Boolean crs = null;
            int count = parser.getAttributeCount();
            for (int i = 0; i < count; i++) {
              String attrName = parser.getAttributeName(i).getLocalPart();
              if ("clearReferencesStatic".equals(attrName)) {
                crs = Boolean.valueOf(parser.getAttributeValue(i));
              } else if ("path".equals(attrName)) {
                path = parser.getAttributeValue(i);
              }
            }
            if (path == null) { // make sure no path associated to it
              clearReferencesStatic = crs;
              break;
            }
          } else {
            skipSubTree(name);
          }
        }
      }
    }
Ejemplo n.º 11
0
  public static void invokeSetMethod(Object obj, String prop, String value)
      throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
    Class cl = obj.getClass();
    // change first letter to uppercase
    String setMeth = "set" + prop.substring(0, 1).toUpperCase() + prop.substring(1);

    // try string method
    try {
      Class[] cldef = {String.class};
      Method meth = cl.getMethod(setMeth, cldef);
      Object[] params = {value};
      meth.invoke(obj, params);
      return;
    } catch (NoSuchMethodException ex) {
      try {
        // try int method
        Class[] cldef = {Integer.TYPE};
        Method meth = cl.getMethod(setMeth, cldef);
        Object[] params = {Integer.valueOf(value)};
        meth.invoke(obj, params);
        return;
      } catch (NoSuchMethodException nsmex) {
        // try boolean method
        Class[] cldef = {Boolean.TYPE};
        Method meth = cl.getMethod(setMeth, cldef);
        Object[] params = {Boolean.valueOf(value)};
        meth.invoke(obj, params);
        return;
      }
    }
  }
Ejemplo n.º 12
0
 private static Object parseValue(String value, Prop p, Class type) {
   Object v = value;
   if (type.isArray()) {
     StringTokenizer st = new StringTokenizer(value, ",");
     Class ctype = type.getComponentType();
     v = Array.newInstance(ctype, st.countTokens());
     for (int i = 0; st.hasMoreTokens(); i++)
       Array.set(v, i, parseValue(st.nextToken(), p, ctype));
   } else if (type == boolean.class) {
     v = Boolean.valueOf(value);
   } else if (type == double.class) {
     v = Double.valueOf(value);
   } else if (type == int.class) {
     v = Integer.valueOf(value);
   } else if (p.field.isAnnotationPresent(TimeIntervalProp.class)) {
     if (value.endsWith("s")) {
       v = (long) (Double.parseDouble(value.substring(0, value.length() - 1)) * SEC);
     } else if (value.endsWith("m")) {
       v = (long) (Double.parseDouble(value.substring(0, value.length() - 1)) * MIN);
     } else {
       v = Long.valueOf(value);
     }
   }
   return v;
 }
Ejemplo n.º 13
0
 public boolean hasBooleanParam(String key) {
   if (this.hasParam(key)) {
     Boolean val = Boolean.valueOf(this.params.get(key));
     if (val != null) return (true);
   }
   return (false);
 }
Ejemplo n.º 14
0
  public void build(ExtFile appDir, File outFile) throws BrutException {
    LOGGER.info("Using Apktool " + Androlib.getVersion());

    Map<String, Object> meta = readMetaFile(appDir);
    Object t1 = meta.get("isFrameworkApk");
    apkOptions.isFramework = (t1 == null ? false : (Boolean) t1);
    apkOptions.resourcesAreCompressed =
        meta.get("compressionType") == null
            ? false
            : Boolean.valueOf(meta.get("compressionType").toString());

    mAndRes.setSdkInfo((Map<String, String>) meta.get("sdkInfo"));
    mAndRes.setPackageId((Map<String, String>) meta.get("packageInfo"));
    mAndRes.setPackageInfo((Map<String, String>) meta.get("packageInfo"));
    mAndRes.setVersionInfo((Map<String, String>) meta.get("versionInfo"));

    if (outFile == null) {
      String outFileName = (String) meta.get("apkFileName");
      outFile =
          new File(
              appDir, "dist" + File.separator + (outFileName == null ? "out.apk" : outFileName));
    }

    new File(appDir, APK_DIRNAME).mkdirs();
    buildSources(appDir);
    buildNonDefaultSources(appDir);
    buildResources(appDir, (Map<String, Object>) meta.get("usesFramework"));
    buildLib(appDir);
    buildCopyOriginalFiles(appDir);
    buildApk(appDir, outFile);

    // we must go after the Apk is built, and copy the files in via Zip
    // this is because Aapt won't add files it doesn't know (ex unknown files)
    buildUnknownFiles(appDir, outFile, meta);
  }
Ejemplo n.º 15
0
 public void load(InputStream inputStream) throws Exception {
   BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
   ArrayList<String> us = new ArrayList<>();
   while (bufferedReader.ready()) {
     us.add(bufferedReader.readLine());
   }
   for (int i = 0; i < us.size(); i += 5) {
     User user = new User();
     user.setFirstName(us.get(i));
     user.setLastName(us.get(i + 1));
     user.setBirthDate(new Date(Long.parseLong(us.get(i + 2))));
     user.setMale(Boolean.valueOf(us.get(i + 3)));
     String country = us.get(i + 4);
     User.Country country1 = null;
     if (country.equals("UKRAINE")) {
       country1 = User.Country.UKRAINE;
     } else if (country.equals("RUSSIA")) {
       country1 = User.Country.RUSSIA;
     } else if (country.equals("OTHER")) {
       country1 = User.Country.OTHER;
     }
     user.setCountry(country1);
     users.add(user);
   }
   bufferedReader.close();
 }
Ejemplo n.º 16
0
  public void init() throws ServletException {
    if (!inited) {
      secureDirPath = getServletContext().getRealPath(SECURE_CONTEXT_PATH);
      strongProtection = Boolean.valueOf(getInitParameter("strongProtection")).booleanValue();
      File secureDir = new File(secureDirPath);
      if (secureDirPath != null && secureDir.isDirectory()) {
        inited = true;

        if (DEBUG)
          log(
              "Initialization OK (Strong protection "
                  + (strongProtection ? "enabled" : "DISABLED (better enable it check web.xml) !!!")
                  + "). Setting secureDirPath to "
                  + secureDirPath);
      } else {
        if (DEBUG)
          log(
              "Initialization problem, please check if "
                  + getServletContext().getRealPath(SECURE_CONTEXT_PATH)
                  + " exists and if it is directory !!!");
      }
    }
    dateFormat = DateFormat.getDateInstance();
    dateFormat.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
  }
Ejemplo n.º 17
0
  public PacksModel(InstallData idata) {
    this.installData = idata;
    this.rules = idata.getRules();
    try {
      this.messages = idata.getMessages().newMessages(PackHelper.LANG_FILE_NAME);
    } catch (com.izforge.izpack.api.exception.ResourceNotFoundException ex) {
      this.messages = idata.getMessages();
    }
    this.variables = idata.getVariables();
    this.packsToInstall = idata.getSelectedPacks();

    this.modifyInstallation = Boolean.valueOf(idata.getVariable(InstallData.MODIFY_INSTALLATION));
    this.installedPacks = loadInstallationInformation(modifyInstallation);

    this.packs = getVisiblePacks();
    this.hiddenPacks = getHiddenPacks();
    this.allPacks = idata.getAvailablePacks();
    this.nameToRow = getNametoRowMapping(packs);
    this.nameToPack = getNametoPackMapping(allPacks);

    this.packs = setPackProperties(packs, nameToPack);
    this.checkValues = initCheckValues(packs, packsToInstall);

    updateConditions(true);
    updatePacksToInstall();
  }
Ejemplo n.º 18
0
  static {
    String tmp;

    int max_elements = 500;
    long max_age = 5000L;

    try {
      tmp =
          Util.getProperty(new String[] {Global.UUID_CACHE_MAX_ELEMENTS}, null, null, false, "500");
      if (tmp != null) max_elements = Integer.valueOf(tmp);
    } catch (Throwable t) {
    }

    try {
      tmp = Util.getProperty(new String[] {Global.UUID_CACHE_MAX_AGE}, null, null, false, "5000");
      if (tmp != null) max_age = Long.valueOf(tmp);
    } catch (Throwable t) {
    }

    cache = new LazyRemovalCache<Address, String>(max_elements, max_age);

    /* Trying to get value of jgroups.print_uuids. PropertyPermission not granted if
     * running in an untrusted environment with JNLP */
    try {
      tmp = Util.getProperty(new String[] {Global.PRINT_UUIDS}, null, null, false, "false");
      print_uuids = Boolean.valueOf(tmp).booleanValue();
    } catch (SecurityException ex) {
    }
  }
Ejemplo n.º 19
0
 public static ControlledBufferWriter getNewWriter(String fileName) throws FileNotFoundException {
   if (simulationConfiguration == null) {
     throw new NullPointerException("got writer before loading configuration");
   }
   String noFile = simulationConfiguration.get("NoFile");
   boolean dummy = Boolean.valueOf(noFile);
   return getNewWriter(fileName, dummy);
 }
Ejemplo n.º 20
0
 /**
  * Determines if the line numbers array should be added to the generated Groovy class.
  *
  * @return true if they should
  */
 private boolean shouldAddLineNumbers() {
   try {
     // for now, we support this through a system property.
     return Boolean.valueOf(System.getenv("GROOVY_PAGE_ADD_LINE_NUMBERS"));
   } catch (Exception e) {
     // something wild happened
     return false;
   }
 }
  // START SJSAS 6439313
  public void init() throws IOException {
    // END SJSAS 6439313
    try {

      String clientAuthStr = (String) attributes.get("clientauth");
      if (clientAuthStr != null) {
        clientAuth = Boolean.valueOf(clientAuthStr).booleanValue();
      }

      // SSL protocol variant (e.g., TLS, SSL v3, etc.)
      String protocol = (String) attributes.get("protocol");
      if (protocol == null) {
        protocol = defaultProtocol;
      }

      // Certificate encoding algorithm (e.g., SunX509)
      String algorithm = (String) attributes.get("algorithm");
      if (algorithm == null) {
        algorithm = defaultAlgorithm;
      }

      // Create and init SSLContext
      /* SJSAS 6439313
      SSLContext context = SSLContext.getInstance(protocol);
       */

      // START SJSAS 6439313
      context = SSLContext.getInstance(protocol);
      // END SJSAS 6439313

      // Configure SSL session timeout and cache size
      configureSSLSessionContext(context.getServerSessionContext());

      String trustAlgorithm = (String) attributes.get("truststoreAlgorithm");
      if (trustAlgorithm == null) {
        trustAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
      }

      context.init(
          getKeyManagers(algorithm, (String) attributes.get("keyAlias")),
          getTrustManagers(trustAlgorithm),
          new SecureRandom());

      // create proxy
      sslProxy = context.getServerSocketFactory();

      // Determine which cipher suites to enable
      String requestedCiphers = (String) attributes.get("ciphers");
      if (requestedCiphers != null) {
        enabledCiphers = getEnabledCiphers(requestedCiphers, sslProxy.getSupportedCipherSuites());
      }

    } catch (Exception e) {
      if (e instanceof IOException) throw (IOException) e;
      throw new IOException(e.getMessage());
    }
  }
Ejemplo n.º 22
0
 protected static boolean setSupportDTD(XMLInputFactory f, boolean state)
     throws XMLStreamException {
   try {
     f.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.valueOf(state));
     return (willSupportDTD(f) == state);
   } catch (IllegalArgumentException e) {
     // Let's assume that the property (or specific value) is NOT supported...
     return false;
   }
 }
Ejemplo n.º 23
0
 /**
  * Return true if the jar attributes declare it should load local dependency classes first.
  *
  * @param file plugin file
  * @return true if plugin libs load first is set
  */
 static boolean getLoadLocalLibsFirstForFile(final File file) {
   Attributes attributes = loadMainAttributes(file);
   if (null == attributes) {
     return false;
   }
   boolean loadFirstDefault = true;
   String loadFirst = attributes.getValue(RUNDECK_PLUGIN_LIBS_LOAD_FIRST);
   if (null != loadFirst) {
     return Boolean.valueOf(loadFirst);
   }
   return loadFirstDefault;
 }
    public void init(String name, Attributes atts) {
      logger.log(LogService.LOG_DEBUG, "Here is DesignateHandler():init()"); // $NON-NLS-1$
      super.init(name, atts);
      _pid_val = atts.getValue(PID);
      _factory_val = atts.getValue(FACTORY);
      if (_pid_val == null && _factory_val == null) {
        _isParsedDataValid = false;
        logger.log(
            LogService.LOG_ERROR,
            NLS.bind(
                MetaTypeMsg.MISSING_DESIGNATE_PID_AND_FACTORYPID,
                new Object[] {
                  elementId, _dp_url, _dp_bundle.getBundleId(), _dp_bundle.getSymbolicName()
                }));
        return;
      }

      _bundle_val = atts.getValue(BUNDLE);
      if (_bundle_val == null) {
        // Not a problem because BUNDLE is an optional attribute.
      }

      String optional_str = atts.getValue(OPTIONAL);
      if (optional_str == null) {
        // Not a problem, because OPTIONAL is an optional attribute.
        // The default value is "false".
        _optional_val = false;
      } else {
        _optional_val = Boolean.valueOf(optional_str).booleanValue();
      }

      String merge_str = atts.getValue(MERGE);
      if (merge_str == null) {
        // Not a problem, because MERGE is an optional attribute.
        // The default value is "false".
        _merge_val = false;
      } else {
        _merge_val = Boolean.valueOf(merge_str).booleanValue();
      }
    }
Ejemplo n.º 25
0
 // Declared in DefiniteAssignment.jrag at line 998
 @SuppressWarnings({"unchecked", "cast"})
 public boolean isDUafter(Variable v) {
   Object _parameters = v;
   if (isDUafter_Variable_values == null) isDUafter_Variable_values = new java.util.HashMap(4);
   if (isDUafter_Variable_values.containsKey(_parameters))
     return ((Boolean) isDUafter_Variable_values.get(_parameters)).booleanValue();
   int num = boundariesCrossed;
   boolean isFinal = this.is$Final();
   boolean isDUafter_Variable_value = isDUafter_compute(v);
   if (isFinal && num == boundariesCrossed)
     isDUafter_Variable_values.put(_parameters, Boolean.valueOf(isDUafter_Variable_value));
   return isDUafter_Variable_value;
 }
Ejemplo n.º 26
0
  public static void main(String[] args) throws Exception {
    final File testFile = new File(args[0]);
    final int iterations = Integer.valueOf(args[1]);
    final boolean includeInputStream = Boolean.valueOf(args[2]);
    final boolean doReadFileInChunks = Boolean.valueOf(args[3]);

    System.out.printf("Testing %s%n", args[0]);
    for (int i = 0; i < iterations; i++) {
      if (includeInputStream) {
        final InputStream is = new FileInputStream(testFile);
        if (doReadFileInChunks) readFileInChunks("InputStream", is);
        else readFileByLine("InputStream", is);
        is.close();
      }

      final PositionalBufferedStream pbs =
          new PositionalBufferedStream(new FileInputStream(testFile));
      if (doReadFileInChunks) readFileInChunks("PositionalBufferedStream", pbs);
      else readFileByLine("PositionalBufferedStream", pbs);
      pbs.close();
    }
  }
Ejemplo n.º 27
0
Archivo: Macro.java Proyecto: bramk/bnd
  public String _toclasspath(String args[]) {
    verifyCommand(args, _toclasspathHelp, null, 2, 3);
    boolean cl = true;
    if (args.length > 2) cl = Boolean.valueOf(args[2]);

    Collection<String> names = Processor.split(args[1]);
    Collection<String> paths = new ArrayList<String>(names.size());
    for (String name : names) {
      String path = name.replace('.', '/') + (cl ? ".class" : "");
      paths.add(path);
    }
    return Processor.join(paths, ",");
  }
Ejemplo n.º 28
0
 // Declared in GenericsSubtype.jrag at line 397
 @SuppressWarnings({"unchecked", "cast"})
 public boolean instanceOf(TypeDecl type) {
   Object _parameters = type;
   if (instanceOf_TypeDecl_values == null) instanceOf_TypeDecl_values = new java.util.HashMap(4);
   if (instanceOf_TypeDecl_values.containsKey(_parameters))
     return ((Boolean) instanceOf_TypeDecl_values.get(_parameters)).booleanValue();
   int num = boundariesCrossed;
   boolean isFinal = this.is$Final();
   boolean instanceOf_TypeDecl_value = instanceOf_compute(type);
   if (isFinal && num == boundariesCrossed)
     instanceOf_TypeDecl_values.put(_parameters, Boolean.valueOf(instanceOf_TypeDecl_value));
   return instanceOf_TypeDecl_value;
 }
Ejemplo n.º 29
0
 /**
  * @attribute inh
  * @aspect DU
  * @declaredat /home/uoji/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:695
  */
 @SuppressWarnings({"unchecked", "cast"})
 public boolean isDUbefore(Variable v) {
   Object _parameters = v;
   if (isDUbefore_Variable_values == null) isDUbefore_Variable_values = new java.util.HashMap(4);
   if (isDUbefore_Variable_values.containsKey(_parameters)) {
     return ((Boolean) isDUbefore_Variable_values.get(_parameters)).booleanValue();
   }
   ASTNode$State state = state();
   int num = state.boundariesCrossed;
   boolean isFinal = this.is$Final();
   boolean isDUbefore_Variable_value = getParent().Define_boolean_isDUbefore(this, null, v);
   if (isFinal && num == state().boundariesCrossed)
     isDUbefore_Variable_values.put(_parameters, Boolean.valueOf(isDUbefore_Variable_value));
   return isDUbefore_Variable_value;
 }
Ejemplo n.º 30
0
  @SuppressWarnings("OverridableMethodCallInConstructor")
  Notepad() {
    super(true);

    // Trying to set Nimbus look and feel
    try {
      for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (Exception ignored) {
    }

    setBorder(BorderFactory.createEtchedBorder());
    setLayout(new BorderLayout());

    // create the embedded JTextComponent
    editor = createEditor();
    // Add this as a listener for undoable edits.
    editor.getDocument().addUndoableEditListener(undoHandler);

    // install the command table
    commands = new HashMap<Object, Action>();
    Action[] actions = getActions();
    for (Action a : actions) {
      commands.put(a.getValue(Action.NAME), a);
    }

    JScrollPane scroller = new JScrollPane();
    JViewport port = scroller.getViewport();
    port.add(editor);

    String vpFlag = getProperty("ViewportBackingStore");
    if (vpFlag != null) {
      Boolean bs = Boolean.valueOf(vpFlag);
      port.setScrollMode(bs ? JViewport.BACKINGSTORE_SCROLL_MODE : JViewport.BLIT_SCROLL_MODE);
    }

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add("North", createToolbar());
    panel.add("Center", scroller);
    add("Center", panel);
    add("South", createStatusbar());
  }