Examples of Environment


Examples of org.elasticsearch.env.Environment

    private AnalysisService testSimpleConfiguration(Settings settings) {
        Index index = new Index("test");

        Injector parentInjector = new ModulesBuilder().add(new SettingsModule(settings),
                new EnvironmentModule(new Environment(settings)),
                new IndicesAnalysisModule()).createInjector();
        Injector injector = new ModulesBuilder().add(
                new IndexSettingsModule(index, settings),
                new IndexNameModule(index),
                new AnalysisModule(settings, parentInjector.getInstance(IndicesAnalysisService.class)).addProcessor(new HunspellAnalysisBinderProcessor())).createChildInjector(parentInjector);
View Full Code Here

Examples of org.fakereplace.api.environment.Environment

    }

    @Override
    public byte[] transform(final ClassLoader loader, final String className, final Class<?> classBeingRedefined, final ProtectionDomain protectionDomain, final byte[] classfileBuffer) throws IllegalClassFormatException {

        final Environment environment = CurrentEnvironment.getEnvironment();
        if (integrationClassTriggers.containsKey(className)) {
            integrationClassloader.add(loader);
            // we need to load the class in another thread
            // otherwise it will not go through the javaagent
            final Extension extension = integrationClassTriggers.get(className);
            if (!loadedClassChangeAwares.contains(extension.getClassChangeAwareName())) {
                loadedClassChangeAwares.add(extension.getClassChangeAwareName());
                try {
                    Class<?> clazz = Class.forName(extension.getClassChangeAwareName(), true, loader);
                    final Object intance = clazz.newInstance();
                    if (intance instanceof ClassChangeAware) {
                        ClassChangeNotifier.instance().add((ClassChangeAware) intance);
                    }
                    final String newEnv = extension.getEnvironment();
                    if (newEnv != null) {
                        final Class<?> envClass = Class.forName(newEnv, true, loader);
                        final Environment newEnvironment = (Environment) envClass.newInstance();
                        if (environment instanceof DefaultEnvironment) {
                            CurrentEnvironment.setEnvironment(newEnvironment);
                        } else {
                            Logger.getLogger(MainTransformer.class).error("Could not set environment to " + newEnvironment + " it has already been changed to " + environment);
                        }
View Full Code Here

Examples of org.focusns.model.env.Environment

    @Autowired
    private EnvironmentService environmentService;

    @RequestMapping("/db-view")
    public String db(Model model) {
        Environment envDB = environmentService.lookupEnvironment(Environment.Type.DB);
        model.addAttribute("envDB", envDB);
        return "console/env/db-view";
    }
View Full Code Here

Examples of org.formulacompiler.runtime.internal.Environment

  private ComputationModel buildNewModel() throws CompilerException
  {
    assert null == this.computationModel;

    final SectionBinding rootDef = this.binding.getRoot();
    final Environment env = this.binding.getEnvironment();
    this.computationModel = new ComputationModel( rootDef.getInputClass(), rootDef.getOutputClass(), getComputationMode(), env );
    new SectionModelCompiler( this, null, rootDef, this.computationModel.getRoot() );

    buildModel();
View Full Code Here

Examples of org.graphstream.util.Environment

  }
 
  protected void
  secondTest()
  {
    Environment env2 = new Environment();
   
    env2.setParameter( "param1", "val1" );
    env2.setParameter( "param2", "value2" );
    env2.setParameter( "param3", "value3" );
    env2.lockEnvironment( true );
    env2.setParameter( "param1", "value1" );
    env2.setParameter( "param4", "value4" );
   
    if( ! env2.getParameter( "param1" ).equals( "value1" ) ) System.err.printf( "test2: error 1%n" );
    if( ! env2.getParameter( "param2" ).equals( "value2" ) ) System.err.printf( "test2: error 2%n" );
    if( ! env2.getParameter( "param3" ).equals( "value3" ) ) System.err.printf( "test2: error 3%n" );
    if( ! env2.getParameter( "param4" ).equals( "" ) )       System.err.printf( "test2: error 4%n" );
   
    System.out.printf( "Test2: env = %s%n", env2.toString() );
   
    try
    {
      env2.writeParameterFile( "TOTO" );
    }
    catch( Exception e )
    {
      e.printStackTrace();
    }
View Full Code Here

Examples of org.jab.docsearch.Environment

    public static void doLogAnalysis(DocSearch ds, String logFile)
         throws IOException {

        // Environment
        Environment env = Environment.getInstance();

        // make sure the file exists
        //
        // things to summarize include:
        //
        // period covered
        String startTime = "";
        String endTime = "";

        //
        // total number of searches,
        int totalNumSearches = 0;

        //
        // total search users
        int numSearchUsers = 0;

        //
        // total search sessions
        // int numSearchSessions = 0;

        //
        // number poor results (below 0.30)
        ArrayList<LogSearch> poorResultsSearches = new ArrayList<LogSearch>(); // logSearch
                                                            // arraylist
        int numBadResults = 0;

        //
        // FREQUENT SEARCHED WORDS
        ArrayList<SearchedWord> searchedWords = new ArrayList<SearchedWord>(); // searchedWord arraylist
        ArrayList<String> usersList = new ArrayList<String>();
        ArrayList<LogSearch> loggedSearches = new ArrayList<LogSearch>(); // logSearch arraylist

        LogSearch tempLogSearch;
        SearchedWord tempSearchedWord;
        double tempScoreD = 0.0;
        String tempTime = "";
        String tempIp = "";
        String tempHits = "";
        int tempHitsInt = 0;
        String tempScore = "";
        String tempSearchText = "";
        int totalUsers = 0;

        //
        StringBuffer readBuf = new StringBuffer(); // for reading in the chars
        //
        StringBuffer badSearchBuf = new StringBuffer();
        File oldLogFile = new File(logFile);
        if (oldLogFile.exists()) {
            badSearchBuf.append('\n');
            // TODO close FileReader save
            FileReader fr = new FileReader(oldLogFile);
            int i;
            String c = "";
            int curItemNo = 0;
            boolean inItem = false;
            String lastIP = "";
            String tempWord = "";
            StringBuffer outputBuf = new StringBuffer();
            while ((i = fr.read()) != -1) {
                if (i == -1) {
                    // handle end of line
                    break;
                }
                else {
                    c = "" + (char) i;
                    if ((c.equals("\n")) || (c.equals("\r"))) {
                        tempSearchText = readBuf.toString();

                        // add out search to the arraylist
                        if (!tempScore.equals("")) {
                            try {
                                tempScoreD = Double.parseDouble(tempScore);
                                tempHitsInt = Integer.parseInt(tempHits);
                                tempLogSearch = new LogSearch(tempTime, tempIp, tempHitsInt, tempScoreD, tempSearchText);
                                loggedSearches.add(tempLogSearch);

                                // parse the words from the searchText
                                int numSearchChars = tempSearchText.length();
                                tempWord = "";
                                StringBuffer tempWB = new StringBuffer();
                                char tempC = ' ';
                                boolean isLet = false;
                                boolean inWord = false;
                                for (int y = 0; y < numSearchChars; y++) {
                                    tempC = tempSearchText.charAt(y);
                                    isLet = (Character.isLetter(tempC));
                                    if (isLet) {
                                        inWord = true;
                                    }
                                    else {
                                        if (inWord) {
                                            tempWord = tempWB.toString();
                                            if (tempWord.length() > 3) {
                                                // add the word to our list
                                                tempSearchedWord = new SearchedWord(tempWord);
                                                int numWords = searchedWords.size();
                                                boolean addedWord = false;
                                                if (numWords > 0) {
                                                    Iterator<SearchedWord> wi = searchedWords.iterator();
                                                    SearchedWord sw;
                                                    String lowerWord = tempWord.toLowerCase();
                                                    while (wi.hasNext()) {
                                                        sw = wi.next();
                                                        if (sw.lowerName.equals(lowerWord)) {
                                                            addedWord = true;
                                                            sw.hit(); // increments
                                                                        // num
                                                                        // searches
                                                        }
                                                    }
                                                }
                                                // end for checking if word is
                                                // in there already
                                                else {
                                                    addedWord = true;
                                                    searchedWords.add(tempSearchedWord);
                                                }
                                                // end for adding the word

                                                if (!addedWord) {
                                                    searchedWords.add(tempSearchedWord);
                                                }
                                            }

                                            tempWB = new StringBuffer();
                                        }

                                        inWord = false;
                                    }
                                    if ((inWord) && (isLet)) {
                                        tempWB.append(tempC);
                                    }
                                }

                                // record the poor hits
                                if ((tempHitsInt == 0) || (tempScoreD < 0.30)) {
                                    poorResultsSearches.add(tempLogSearch);
                                    numBadResults++;
                                }

                                if (! lastIP.equals(tempIp)) {
                                    numSearchUsers++;
                                }

                                lastIP = tempIp;
                                totalNumSearches++;
                            }
                            catch (Exception eN) {
                                ds.setStatus("Error parsing log file:" + eN.toString());
                            }
                        }

                        // reset the line
                        readBuf = new StringBuffer();
                        tempTime = "";
                        tempIp = "";
                        tempHits = "";
                        tempScore = "";
                        curItemNo = 0;
                        tempHitsInt = 0;
                    }
                    else if ((c.equals("[")) || (c.equals("#"))) {
                        inItem = true;
                    }
                    else if (c.equals("]")) {
                        inItem = true;
                        switch (curItemNo) {
                            case 0: // time
                                tempTime = readBuf.toString();
                                break;

                            case 1: // ip
                                tempIp = readBuf.toString();
                                if (! Utils.hasUser(tempIp, usersList)) {
                                    usersList.add(tempIp);
                                }
                                break;

                            case 2: // hits
                                tempHits = readBuf.toString();
                                break;

                            case 3: // score
                                tempScore = readBuf.toString();
                                break;
                        }

                        curItemNo++;
                        readBuf = new StringBuffer();
                        inItem = false;
                    }
                    else {
                        if (inItem) {
                            readBuf.append(c);
                        }
                    }
                }
            }
            // end while reading

            fr.close();
            // load the start and endTimes
            LogSearch ttl;
            int totalSes = loggedSearches.size();
            if (totalSes > 0) {
                ttl = loggedSearches.get(0);
                endTime = ttl.time;
                ttl = loggedSearches.get(totalSes - 1);
                startTime = ttl.time;
            }

            // now show our results
            totalUsers = usersList.size();
            outputBuf.append("There were " + totalNumSearches + " searches performed from " + startTime + " to " + endTime + " from " + totalUsers + " individual users.");
            outputBuf.append("\n\n" + numBadResults + " searches produced unsatisfactory results.");
            double avScore = Utils.getAverageSearchScore(loggedSearches);
            if (avScore > 0.3) {
                outputBuf.append("\n\nAverage search score was Good at " + avScore);
            }
            else {
                outputBuf.append("\n\nAverage search score was Poor at " + avScore);
            }
            outputBuf.append('\n');
            // poor results
            int numPoor = poorResultsSearches.size();
            if (numPoor > 0) {
                badSearchBuf.append("\n\nSearches that produced poor results:\n\n");
                Iterator<LogSearch> pi = poorResultsSearches.iterator();
                LogSearch tl;
                int maxPoor = 200;
                int curP = 0;
                while (pi.hasNext()) {
                    tl = pi.next();
                    curP++;
                    if (tl.searchText.indexOf("\"") == 0) {
                        badSearchBuf.append("\n * Search for \"" + tl.searchText + "\" produced " + tl.numResults + " hits, with a highest score of " + tl.score);
                    }
                    else {
                        badSearchBuf.append("\n * Search for " + tl.searchText + " produced " + tl.numResults + " hits, with a highest score of " + tl.score);
                    }
                    if (curP > maxPoor) {
                        break;
                    }
                }
            }
            // end if numpoor

            // now add our most searched for items
            int numWordsSearched = searchedWords.size();
            if (numWordsSearched > 0) {
                Iterator<SearchedWord> swi = searchedWords.iterator();
                SearchedWord tw;
                ArrayList<SearchedWord> highestSWs = new ArrayList<SearchedWord>();
                int lastHighest = 1;
                while (swi.hasNext()) {
                    tw = swi.next();
                    if (tw.numTimeSearched > 1) {
                        if (tw.numTimeSearched > lastHighest) {
                            lastHighest = tw.numTimeSearched;
                            highestSWs.add(0, tw);
                        }
                    }
                }

                int numHighs = highestSWs.size();
                if (numHighs > 0) {
                    outputBuf.append("\n\n Fequent Search Words:\n");
                    Iterator<SearchedWord> hi = highestSWs.iterator();
                    while (hi.hasNext()) {
                        tw = hi.next();
                        outputBuf.append("\n * Word \"");
                        outputBuf.append(tw.name);
                        outputBuf.append("\" was searched ");
                        outputBuf.append(tw.numTimeSearched);
                        outputBuf.append(" times.");
                    }
                }
            }
            // end if there were words found
            outputBuf.append(badSearchBuf.toString());
            //
            if (! env.isGUIMode()) {
                System.out.println(outputBuf.toString());
            }
            else {
                // show the results
                String analysisFile = FileUtils.addFolder(fEnv.getWorkingDirectory(), "search_log_analysis.txt");
View Full Code Here

Examples of org.jboss.gravia.provision.Environment

        LOGGER.debug("START findResources: {}", reqs);

        // Install the unresolved resources into the cloned environment
        List<Resource> unresolved = new ArrayList<Resource>();
        Environment envclone = cloneEnvironment(env);
        for (Requirement req : reqs) {
            Resource res = req.getResource();
            if (env.getResource(res.getIdentity()) == null) {
                envclone.addResource(res);
                unresolved.add(res);
            }
        }

        // Find the resources in the cloned environment
View Full Code Here

Examples of org.jboss.gravia.resolver.Environment

        Set<ResourceHandle> result = provisioner.provisionResources(Collections.singleton(req));

        List<ResourceHandle> handles = new ArrayList<>(result);
        try {
            // Verify the wiring
            Environment environment = provisioner.getEnvironment();
            Map<Resource, Wiring> wirings = environment.getWirings();
            ResourceIdentity residA = ResourceIdentity.create("org.apache.camel.core", "2.11.0");
            Resource resA = environment.getResource(residA);
            Assert.assertNotNull("Resource in environment", resA);
            Wiring wiringA = wirings.get(resA);
            Assert.assertNotNull("Wiring in environment", wiringA);
            Assert.assertEquals("Two required wires", 2, wiringA.getRequiredResourceWires(null).size());

            // Build a resource that has a class loading dependency
            DefaultResourceBuilder builderD = new DefaultResourceBuilder();
            ResourceIdentity residD = ResourceIdentity.create(RESOURCE_D, Version.emptyVersion);
            Map<String, Object> attsD = builderD.addIdentityCapability(residD).getAttributes();
            attsD.put(ContentNamespace.CAPABILITY_RUNTIME_NAME_ATTRIBUTE, RESOURCE_D + ".war");
            builderD.addContentCapability(deployer.getDeployment(RESOURCE_D));
            Resource resD = builderD.getResource();

            // Deploy a resource through the {@link ResourceInstaller}
            handles.add(provisioner.installResource(resD));
            Assert.assertTrue("At least one resource", handles.size() > 0);

            // Make a call to the HttpService endpoint that goes through a Camel route
            String reqspec = "/service?test=Kermit";
            String context = RuntimeType.getRuntimeType() == RuntimeType.KARAF ? "" : "/" + RESOURCE_D;
            Assert.assertEquals("Hello Kermit", performCall(context, reqspec));

            // Verify module available
            Runtime runtime = RuntimeLocator.getRequiredRuntime();
            Assert.assertNotNull("Module available", runtime.getModule(residA));
            Assert.assertNotNull("Module available", runtime.getModule(residD));

            // Verify the wiring
            wirings = environment.getWirings();
            resA = environment.getResource(residA);
            Assert.assertNotNull("Resource in environment", resA);
            wiringA = wirings.get(resA);
            Assert.assertEquals("Two required wires", 2, wiringA.getRequiredResourceWires(null).size());

            // Deployment did not go through the {@link Provisioner} service
            // There is no wiring
            resD = environment.getResource(residD);
            Assert.assertNotNull("Resource in environment", resD);
            Wiring wiringB = wirings.get(resD);
            Assert.assertNull("Wiring not in environment", wiringB);
        } finally {
            for (ResourceHandle handle : handles) {
View Full Code Here

Examples of org.jboss.metadata.javaee.spec.Environment

         // Find the container dependency metadata
         String ejbCompID = "ejb/" + vfsPath + "#" + bean.getEjbName();
         ContainerDependencyMetaData cdmd = endpointMap.get(ejbCompID);
         if(cdmd == null)
            throw new IllegalStateException("Failed to find ContainerDependencyMetaData for: "+ejbCompID);
         Environment env = bean.getJndiEnvironmentRefsGroup();
         resolve(cdmd, unit, endpointMap, env, resolver,  unresolvedPaths);
      }
   }
View Full Code Here

Examples of org.jbpm.env.Environment

  }

  // asynchronous continuations //////////////////////////////////////////////// 

  public void sendContinuationMessage(AtomicOperation operation) {
    Environment environment = Environment.getCurrent();
    MessageSession messageSession = environment.get(MessageSession.class);
    Message asyncMessage = operation.createAsyncMessage(this);
    lock("async continuation message "+asyncMessage);
    messageSession.send(asyncMessage);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.