Examples of Context


Examples of org.jclouds.Context

      overrides.setProperty(NodePoolProperties.MIN_SIZE, "0");
      overrides.setProperty(NodePoolProperties.BASEDIR, baseDir);
      overrides.setProperty(POOL_ADMIN_ACCESS, "adminUsername=pooluser,adminPassword=poolpass");
      // note no ssh module since we are stub and not trying ssh, yet
      overrides.setProperty(NodePoolProperties.BACKEND_MODULES, SLF4JLoggingModule.class.getName());
      Context nodePoolCtx = ContextBuilder.newBuilder("nodepool").credentials("foo", "bar").overrides(overrides)
               .build();
      return nodePoolCtx.utils().getInjector();
   }
View Full Code Here

Examples of org.jclouds.representations.Context

   @Test
   void testConversion() {
      assertNull(ToContext.INSTANCE.apply(null));
      org.jclouds.Context context = ContextBuilder.newBuilder("stub").name("test-stub").credentials("user", "pass").build();
      Context representation = ToContext.INSTANCE.apply(context);
      assertNotNull(representation);
      assertEquals("test-stub", representation.getName());
   }
View Full Code Here

Examples of org.jeromq.ZMQ.Context

  @Override
  public void activateOptions() {
        LogLog.debug("Configuring appender...");
    super.activateOptions();

    final Context context = ZMQ.context(threads);
    Socket sender;

    if (PUBSUB.equals(socketType)) {
      LogLog.debug("Setting socket type to PUB");
      sender = context.socket(ZMQ.PUB);
    }
    else if (PUSHPULL.equals(socketType))
    {
      LogLog.debug("Setting socket type to PUSH");
      sender = context.socket(ZMQ.PUSH);
    }
    else
    {
      LogLog.debug("Setting socket type to default PUB");
      sender = context.socket(ZMQ.PUB);
    }
    sender.setLinger(1);
   
    final Socket socket = sender;
   
View Full Code Here

Examples of org.jibeframework.core.Context

   * @param actualArguments
   * @return
   */
  @SuppressWarnings("unchecked")
  public Object[] resolveArguments(Method method, Object[] actualArguments) {
    Context context = Context.getCurrentContext();
    Map<String, Object> data = (Map<String, Object>) context.getParams().get("data");
    Class<?>[] parameterTypes = method.getParameterTypes();
    MethodParameter[] parameters = new MethodParameter[parameterTypes.length];
    for (int i = 0; i < parameterTypes.length; i++) {
      parameters[i] = new MethodParameter(method, i);
      parameters[i].initParameterNameDiscovery(parameterNameDiscoverer);
    }
    Object[] args = new Object[parameters.length];
    for (int i = 0; i < parameters.length; i++) {
      String name = parameters[i].getParameterName();
      if (data != null && data.containsKey(name)) {
        Object val = data.get(name);
        if (conversionService.canConvert(val.getClass(), parameters[i].getParameterType())) {
          args[i] = conversionService.convert(val, parameters[i].getParameterType());
        } else {
          args[i] = val;
        }
      }
      if (args[i] == null) {
        for (Annotation paramAnn : parameters[i].getParameterAnnotations()) {
          if (data != null && RequestParam.class.isInstance(paramAnn)) {
            RequestParam requestParam = (RequestParam) paramAnn;
            String paramName = requestParam.value();
            boolean required = requestParam.required();
            String defaultValue = requestParam.defaultValue();

            Object val = data.get(paramName);
            if (val == null) {
              if (defaultValue != null) {
                val = defaultValue;
              } else if (required) {
                throw new JibeRuntimeException(paramName
                    + " parameter has to be present in the request");
              }
            }
            if (conversionService.canConvert(val.getClass(), parameters[i].getParameterType())) {
              args[i] = conversionService.convert(val, parameters[i].getParameterType());
            } else {
              args[i] = val;
            }
            break;
          } else if (ConversationAttribute.class.isInstance(paramAnn)) {
            ConversationAttribute convAttrAnn = (ConversationAttribute) paramAnn;
            if (StringUtils.isEmpty(convAttrAnn.value())) {
              for (Object attr : context.getConversation().getAttributes().values()) {
                if (attr != null && parameters[i].getParameterType().isAssignableFrom(attr.getClass())) {
                  args[i] = attr;
                }
              }
            } else {
              args[i] = context.getConversation().getAttribute(convAttrAnn.value());
            }
          }
        }
      }
      Class<?> parameterType = parameters[i].getParameterType();
View Full Code Here

Examples of org.jnode.shell.syntax.CommandSyntaxException.Context

                                    arg.complete(completions, "", flags);
                                }
                                backtrack = true;
                            }
                        } catch (CommandSyntaxException ex) {
                            argFailures.add(new Context(token, syntax, source.tell(), ex));
                            if (DEBUG) {
                                log.debug("accept for arg " + argName + " threw SyntaxErrorException('" +
                                        ex.getMessage() + "'");
                            }
                            backtrack = true;
                        }
                        break;
                    case PRESET:
                        MuPreset muPreset = (MuPreset) syntax;
                        arg = bundle.getArgument(muPreset.getArgName());
                        flags = muPreset.getFlags();
                        try {
                            arg.accept(new CommandLine.Token(muPreset.getPreset()), flags);
                            if (!backtrackStack.isEmpty()) {
                                backtrackStack.getFirst().argsModified.add(arg);
                                if (DEBUG) {
                                    log.debug("recording undo for preset arg " + arg.getLabel());
                                }
                            }
                        } catch (CommandSyntaxException ex) {
                            argFailures.add(new Context(null, syntax, source.tell(), ex));
                            backtrack = true;
                        }
                        break;
                    case SEQUENCE:
                        MuSyntax[] elements = ((MuSequence) syntax).getElements();
View Full Code Here

Examples of org.jpos.transaction.Context

        assertEquals ("ZERO", sp.rdp ("PUT"));
        assertEquals ("ZERO", sp.inp ("PUT"));
        assertNull (sp.rdp ("PUT"));
    }
    public void testPersistentContext() throws Exception {
        Context ctx = new Context();
        ctx.put("P", "ABC", true);
        ISOMsg m = new ISOMsg("0800");
        m.set(11, "000001");
        ctx.put("ISOMSG", m, true);
        sp.out("CTX", ctx);
        assertNotNull("entry should not be null", sp.in("CTX"));
    }
View Full Code Here

Examples of org.jrack.Context

   *
   * @throws Exception
   */
  @Test
  public void testBSFEngineIntegration() throws Exception {
    Context context = new MicroContext();


    BSFEngine engine = micro.getSite().getBSFEngine("beanshell",
        (MicroContext) context.with("unu", 1),
        Collections.singletonMap("foo", "bar"));

    engine.exec("complexCalculus", 0, 0,
        "context.with(\"one\", context.get(\"unu\") * 1);" +
            "log.info(\"One is: \" + context.get(\"one\"));"); // :P
    Assert.assertEquals("BSFEngine failure", 1, context.get("one"));
  }
View Full Code Here

Examples of org.jwall.web.policy.Context

            setIcon( AbstractPolicyTreeRenderer.SESSION_TYPE_ICON );
            return this;
        }
       
        if( arg1.getType() == TreeNode.CONTEXT_NODE ){
          Context ctx = (Context) arg1;
         
          String path = ctx.getBase();
          if( path == null || path.equals( "" ) )
            path = "/";
         
          setText("<html><b>" + path + "</b>");
          setIcon( WebPolicyEditor.getIcon( ctx ) );
View Full Code Here

Examples of org.kie.api.marshalling.ObjectMarshallingStrategy.Context

                                             ProtobufMessages.Header.Builder _header) throws IOException {
        for( Entry<ObjectMarshallingStrategy,Integer> entry : context.usedStrategies.entrySet() ) {
            Builder _strat = ProtobufMessages.Header.StrategyIndex.newBuilder()
                                     .setId( entry.getValue().intValue() )
                                     .setName( entry.getKey().getClass().getName() );
            Context ctx = context.strategyContext.get( entry.getKey() );
            if( ctx != null ) {
                Output os = ByteString.newOutput();
                ctx.write( new DroolsObjectOutputStream( os ) );
                _strat.setData( os.toByteString() );
                os.close();
            }
            _header.addStrategy( _strat.build() );
        }
View Full Code Here

Examples of org.kie.command.Context

        this.identifier = identifier;
        this.contextName = contextName;
    }

    public Object execute(Context ctx) {       
        Context targetCtx;
        if ( this.contextName == null ) {
            targetCtx = ctx;
        } else {
            targetCtx = ctx.getContextManager().getContext( this.contextName );
        }
       
        return targetCtx.get( identifier);       
    }
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.