Examples of Environment


Examples of org.apache.cocoon.environment.Environment

    public SitemapSource(ComponentManager manager,
                         String           uri,
                         Logger           logger)
    throws IOException, ProcessingException {

        Environment env = CocoonComponentManager.getCurrentEnvironment();
        if ( env == null ) {
            throw new MalformedURLException("The cocoon protocol can not be used outside an environment.");
        }

        this.manager = manager;
        this.enableLogging(logger);
        boolean rawMode = false;

        // remove the protocol
        int position = uri.indexOf(':') + 1;
        if (position != 0) {
            // check for subprotocol
            if (uri.startsWith("raw:", position)) {
                position += 4;
                rawMode = true;
            }
        }

        // does the uri point to this sitemap or to the root sitemap?
        if (uri.startsWith("//", position)) {
            position += 2;
            try {
                this.processor = (Processor)this.manager.lookup(Processor.ROLE);
            } catch (ComponentException e) {
                throw new ProcessingException("Cannot get Processor instance", e);
            }
            this.prefix = ""; // start at the root
        } else if (uri.startsWith("/", position)) {
            position ++;
            this.prefix = null;
            this.processor = CocoonComponentManager.getCurrentProcessor();
        } else {
            throw new ProcessingException("Malformed cocoon URI.");
        }

        // create the queryString (if available)
        String queryString = null;
        int queryStringPos = uri.indexOf('?', position);
        if (queryStringPos != -1) {
            queryString = uri.substring(queryStringPos + 1);
            uri = uri.substring(position, queryStringPos);
        } else if (position > 0) {
            uri = uri.substring(position);
        }

        // build the request uri which is relative to the context
        String requestURI = (this.prefix == null ? env.getURIPrefix() + uri : uri);

        // create system ID
        this.systemId = queryString == null ?
            "cocoon://" + requestURI :
            "cocoon://" + requestURI + "?" + queryString;
View Full Code Here

Examples of org.apache.flink.runtime.execution.Environment

   *
   * @param executionId the ID of the task to be unregistered
   * @param task the task to be unregistered
   */
  public void unregister(ExecutionAttemptID executionId, Task task) {
    final Environment environment = task.getEnvironment();
    if (environment == null) {
      return;
    }

    // destroy and remove OUTPUT channels from registered channels and cache
    for (ChannelID id : environment.getOutputChannelIDs()) {
      Channel channel = this.channels.remove(id);
      if (channel != null) {
        channel.destroy();
        this.receiverCache.remove(channel);
      }
    }

    // destroy and remove INPUT channels from registered channels and cache
    for (ChannelID id : environment.getInputChannelIDs()) {
      Channel channel = this.channels.remove(id);
      if (channel != null) {
        channel.destroy();
        this.receiverCache.remove(channel);
      }
    }

    // clear and remove INPUT side buffer pools
    for (GateID id : environment.getInputGateIDs()) {
      LocalBufferPoolOwner bufferPool = this.localBuffersPools.remove(id);
      if (bufferPool != null) {
        bufferPool.clearLocalBufferPool();
      }
    }
View Full Code Here

Examples of org.apache.geronimo.gshell.shell.Environment

      ctx.setBranding(branding);
      ctx.setLayoutManager(osgiLayoutManager.createLayoutManagerForShell(branding.getName()));
     
      // Would be nice to copy the env variables.. but can't cause it has imutable values
      // that the DefaultEnvironment tries to overwrite.
      Environment environment = new DefaultEnvironment(ctx.getIo(), new DefaultVariables());
      ctx.setEnvironment(environment);
          IOTargetSource.setIO(ctx.getIo());
          EnvironmentTargetSource.setEnvironment(environment);
      InteractiveShell interactiveShell = createInteractiveShell(ctx);
      if( args!=null && args.length>0 ) {
View Full Code Here

Examples of org.apache.geronimo.jee.deployment.Environment

            IModule[] module = (IModule[]) modules.get(ii);
            int moduleDeltaKind = ((Integer)deltaKind.get(ii)).intValue();
            if (moduleDeltaKind != ServerBehaviourDelegate.REMOVED) {
              //GERONIMODEVTOOLS-361
              for (IModule singleModule:module){
                Environment environment = getEnvironment(singleModule);
                  if (environment != null) {
                      Artifact child = environment.getModuleId();
                      Dependencies dependencies = environment.getDependencies();
                      if (dependencies != null) {
                          List<Dependency> depList = dependencies.getDependency();
                          for ( Dependency dep : depList) {
                              Artifact parent = deploymentFactory.createArtifact();
                              parent.setGroupId( dep.getGroupId() );
                              parent.setArtifactId( dep.getArtifactId() );
                              parent.setVersion( dep.getVersion() );
                              parent.setType( dep.getType() );
                             
                              StringBuilder configId = new StringBuilder();
                              if (dep.getGroupId()!=null)
                                configId.append(dep.getGroupId());
                              configId.append("/");
                              if (dep.getArtifactId()!=null)
                                configId.append(dep.getArtifactId());
                              configId.append("/");
                              if (dep.getVersion()!=null)
                                configId.append(dep.getVersion());
                              configId.append("/");
                              if (dep.getType()!=null)
                                configId.append(dep.getType());
                             
                              if (!DeploymentUtils.isInstalledModule(server,configId.toString()))
                                   dm.addDependency( child, parent );
                          }
                      }
                  }
              }
            }
        }

        //
        // Iterate through all the modules again and reorder as necessary
        //
        for (int ii=0; ii<modules.size(); ii++) {
            IModule[] module = (IModule[]) modules.get(ii);
            int moduleDeltaKind = ((Integer)deltaKind.get(ii)).intValue();
            if (module!=null && !reorderedModules.contains(module)) {
                // Not already moved
                if (moduleDeltaKind == ServerBehaviourDelegate.REMOVED) {
                    // Move module if going to be removed
                    reorderedModules.add(module);
                    reorderedKinds.add(moduleDeltaKind);
                }
                else {
                    Environment environment = getEnvironment(module[0]);
                    if (environment != null) {
                        Artifact artifact = environment.getModuleId();
                        if (artifact == null) {
                            // Move if null (nothing can be done)
                            if (!reorderedModules.contains(module)) {
                                reorderedModules.add(module);
                                reorderedKinds.add(moduleDeltaKind);
View Full Code Here

Examples of org.apache.geronimo.kernel.repository.Environment

        monitor.failed(configurationId, exception);
        throw exception;
    }

    private LinkedHashSet<Artifact> resolveParentIds(ConfigurationData configurationData) throws MissingDependencyException, InvalidConfigException {
        Environment environment = configurationData.getEnvironment();

        LinkedHashSet<Artifact> parentIds = new LinkedHashSet<Artifact>();
        List<Dependency> dependencies = new ArrayList<Dependency>(environment.getDependencies());
        for (ListIterator<Dependency> iterator = dependencies.listIterator(); iterator.hasNext();) {
            Dependency dependency = iterator.next();
            Artifact resolvedArtifact = artifactResolver.resolveInClassLoader(dependency.getArtifact());
            if (isConfiguration(resolvedArtifact)) {
                parentIds.add(resolvedArtifact);
View Full Code Here

Examples of org.apache.hadoop.streaming.Environment

    this.replace = replace;
  }

  void testParentJobConfToEnvVars() throws IOException
  {
    env = new Environment();
    // test that some JobConf properties are exposed as expected    
    // Note the dots translated to underscore:
    // property names have been escaped in PipeMapRed.safeEnvVarName()
    expect("mapred_input_format_class", "org.apache.hadoop.mapred.TextInputFormat");
    expect("mapred_job_tracker", "local");
View Full Code Here

Examples of org.apache.ibatis.mapping.Environment

      }
    }
  }

  private Executor newExecutor() throws SQLException {
    Environment environment = configuration.getEnvironment();
    if (environment == null) throw new ExecutorException("ResultLoader could not load lazily.  Environment was not configured.");
    TransactionFactory txFactory = environment.getTransactionFactory();
    if (txFactory == null) throw new ExecutorException("ResultLoader could not load lazily.  Transaction Factory was not configured.");
    DataSource ds = environment.getDataSource();
    if (ds == null) throw new ExecutorException("ResultLoader could not load lazily.  DataSource was not configured.");
    Connection conn = ds.getConnection();
    conn = wrapConnection(conn);
    Transaction tx = txFactory.newTransaction(conn, false);
    return configuration.newExecutor(tx, ExecutorType.SIMPLE);
View Full Code Here

Examples of org.apache.muse.core.Environment

        // pre-existing consumer is optional - other consumers can
        // still subscribe using WS-N
        //
        if (fileName != null)
        {
            Environment env = getResource().getEnvironment();
            Document eprDoc = env.getDocument(fileName);
            Element eprXML = XmlUtils.getFirstElement(eprDoc);
           
            EndpointReference epr = new EndpointReference(eprXML);
           
            NotificationProducer wsn =
View Full Code Here

Examples of org.apache.poi.hslf.record.Environment

     * Check we can read their attributes.
     */
    public void testSlideMaster() throws Exception {
        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));

        Environment env = ppt.getDocumentRecord().getEnvironment();

        SlideMaster[] master = ppt.getSlidesMasters();
        assertEquals(2, master.length);

        //character attributes
        assertEquals(40, master[0].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.size", true).getValue());
        assertEquals(48, master[1].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.size", true).getValue());

        int font1 = master[0].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.index", true).getValue();
        int font2 = master[1].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.index", true).getValue();
        assertEquals("Arial", env.getFontCollection().getFontWithId(font1));
        assertEquals("Georgia", env.getFontCollection().getFontWithId(font2));

        CharFlagsTextProp prop1 = (CharFlagsTextProp)master[0].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "char_flags", true);
        assertEquals(false, prop1.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(false, prop1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(true, prop1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        CharFlagsTextProp prop2 = (CharFlagsTextProp)master[1].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "char_flags", true);
        assertEquals(false, prop2.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(true, prop2.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(false, prop2.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        //now paragraph attributes
        assertEquals(0x266B, master[0].getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.char", false).getValue());
        assertEquals(0x2022, master[1].getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.char", false).getValue());

        int b1 = master[0].getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.font", false).getValue();
        int b2 = master[1].getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.font", false).getValue();
        assertEquals("Arial", env.getFontCollection().getFontWithId(b1));
        assertEquals("Georgia", env.getFontCollection().getFontWithId(b2));
    }
View Full Code Here

Examples of org.apache.shiro.env.Environment

            @Override
            protected void bindWebEnvironment(AnnotatedBindingBuilder<? super WebEnvironment> bind) {
                bind.to(MyWebEnvironment.class);
            }
        });
        Environment environment = injector.getInstance(Environment.class);
        assertNotNull(environment);
        assertTrue(environment instanceof MyWebEnvironment);
        WebEnvironment webEnvironment = injector.getInstance(WebEnvironment.class);
        assertNotNull(webEnvironment);
        assertTrue(webEnvironment instanceof MyWebEnvironment);
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.