Examples of ValueGenerator


Examples of com.caucho.config.program.ValueGenerator

   
    if (Object.class.equals(bindType))
      throw new ConfigException(L.l("{0}: @Resource beanInterface() attribute is required for @Resource on a class.",
                                    location));
   
    ValueGenerator gen = generateContext(location, bindType, null, resource);

    if (name != null && ! "".equals(name)) {
      bindJndi(name, gen, name);
    }
  }
View Full Code Here

Examples of com.caucho.config.program.ValueGenerator

    if (! resource.type().equals(Object.class)
        && ! resource.type().equals(void.class)) {
      bindType = resource.type();
    }

    ValueGenerator gen = null;

    if (lookupName != null && ! "".equals(lookupName))
      gen = new JndiValueGenerator(loc, bindType, lookupName);
    else
      gen = lookupJndi(loc, bindType, name);
View Full Code Here

Examples of com.caucho.config.program.ValueGenerator

  private void introspectClass(String location, DataSourceDefinition def)
  {
    String name = def.name();
   
    ValueGenerator gen = bindGenerator(location, def);
    if (name != null && ! "".equals(name)) {
      bindJndi(name, gen, name);
    }
  }
View Full Code Here

Examples of com.caucho.config.program.ValueGenerator

   
    String location = getLocation(javaField);

    Class<?> bindType = javaField.getType();
   
    ValueGenerator gen = bindGenerator(location, def);

    if (name != null && ! "".equals(name))
      bindJndi(name, gen, name);
   
    bindJndi(javaField, gen);
View Full Code Here

Examples of com.caucho.config.program.ValueGenerator

    Method javaMethod = method.getJavaMember();
   
    String location = getLocation(javaMethod);

    ValueGenerator gen = bindGenerator(location, def);

    if (name != null && ! "".equals(name))
      bindJndi(name, gen, name);
   
    bindJndi(javaMethod, gen);
View Full Code Here

Examples of org.apache.amber.oauth2.as.issuer.ValueGenerator

*
*/
public class MD5GeneratorTest extends Assert {
    @Test
    public void testGenerateValue() throws Exception {
        ValueGenerator g = new MD5Generator();
        Assert.assertNotNull(g.generateValue());

        Assert.assertNotNull(g.generateValue("test"));

        try {
            g.generateValue(null);
            fail("Exception not thrown");
        } catch (OAuthSystemException e) {
            //ok
        }
    }
View Full Code Here

Examples of org.apache.oltu.oauth2.as.issuer.ValueGenerator

*
*/
public class MD5GeneratorTest extends Assert {
    @Test
    public void testGenerateValue() throws Exception {
        ValueGenerator g = new MD5Generator();
        Assert.assertNotNull(g.generateValue());

        Assert.assertNotNull(g.generateValue("test"));

        try {
            g.generateValue(null);
            fail("Exception not thrown");
        } catch (OAuthSystemException e) {
            //ok
        }
    }
View Full Code Here

Examples of org.camunda.bpm.engine.rest.helper.ValueGenerator

  @Test
  public void testQueryWithExpressions() {
    String testExpression = "${'test-%s'}";

    ValueGenerator generator = new ValueGenerator(testExpression);

    Map<String, String> params = new HashMap<String, String>();
    params.put("assigneeExpression", generator.getValue("assigneeExpression"));
    params.put("assigneeLikeExpression", generator.getValue("assigneeLikeExpression"));
    params.put("ownerExpression", generator.getValue("ownerExpression"));
    params.put("involvedUserExpression", generator.getValue("involvedUserExpression"));
    params.put("candidateUserExpression", generator.getValue("candidateUserExpression"));
    params.put("candidateGroupExpression", generator.getValue("candidateGroupExpression"));
    params.put("candidateGroupsExpression", generator.getValue("candidateGroupsExpression"));
    params.put("createdBeforeExpression", generator.getValue("createdBeforeExpression"));
    params.put("createdOnExpression", generator.getValue("createdOnExpression"));
    params.put("createdAfterExpression", generator.getValue("createdAfterExpression"));
    params.put("dueBeforeExpression", generator.getValue("dueBeforeExpression"));
    params.put("dueDateExpression", generator.getValue("dueDateExpression"));
    params.put("dueAfterExpression", generator.getValue("dueAfterExpression"));
    params.put("followUpBeforeExpression", generator.getValue("followUpBeforeExpression"));
    params.put("followUpDateExpression", generator.getValue("followUpDateExpression"));
    params.put("followUpAfterExpression", generator.getValue("followUpAfterExpression"));

    // get
    given()
      .header(ACCEPT_JSON_HEADER)
      .queryParams(params)
View Full Code Here

Examples of org.datanucleus.store.valuegenerator.ValueGenerator

                generatorNameKeyInManager = cmd.getBaseAbstractClassMetaData().getFullClassName();
            }
        }

        // Try to find the generator from the ValueGenerationManager if we already have it managed
        ValueGenerator generator = null;
        synchronized (this)
        {
            // This block is synchronised since we don't want to let any other thread through until
            // the generator is created, in case it is the same as the next request
            generator = getValueGenerationManager().getValueGenerator(generatorNameKeyInManager);
            if (generator == null)
            {
                if (generatorName == null)
                {
                    // No available value-generator for the specified strategy for this datastore
                    throw new NucleusUserException(LOCALISER.msg("038004", strategy));
                }

                // Set up the default properties available for all value generators
                Properties props = getPropertiesForGenerator(cmd, absoluteFieldNumber, ec, sequenceMetaData,
                    tableGeneratorMetaData);

                Class cls = null;
                if (elem != null)
                {
                    cls = nucleusContext.getPluginManager().loadClass(elem.getExtension().getPlugin().getSymbolicName(),
                        elem.getAttribute("class-name"));
                }
                if (cls == null)
                {
                    throw new NucleusException("Cannot create Value Generator for strategy " + generatorName);
                }

                // Create the new ValueGenerator since the first time required (registers it with
                // the ValueGenerationManager too)
                generator = getValueGenerationManager().createValueGenerator(generatorNameKeyInManager, cls, props, this, null);
            }
        }

        // Get the next value from the generator
        Object oid = getStrategyValueForGenerator(generator, ec);

        if (mmd != null)
        {
            // replace the value of the id, but before convert the value to the field type if needed
            try
            {
                Object convertedValue = TypeConversionHelper.convertTo(oid, mmd.getType());
                if (convertedValue == null)
                {
                    throw new NucleusException(LOCALISER.msg("038003", mmd.getFullFieldName(), oid)).setFatal();
                }
                oid = convertedValue;
            }
            catch (NumberFormatException nfe)
            {
                throw new NucleusUserException("Value strategy created value="+oid+" type="+oid.getClass().getName() +
                        " but field is of type "+mmd.getTypeName() + ". Use a different strategy or change the type of the field " + mmd.getFullFieldName());
            }
        }

        if (NucleusLogger.VALUEGENERATION.isDebugEnabled())
        {
            NucleusLogger.VALUEGENERATION.debug(LOCALISER.msg("038002", fieldName, strategy, generator.getClass().getName(), oid));
        }

        return oid;
    }
View Full Code Here

Examples of org.datanucleus.store.valuegenerator.ValueGenerator

                generatorNameKeyInManager = cmd.getBaseAbstractClassMetaData().getFullClassName();
            }
        }

        // Try to find the generator from the ValueGenerationManager if we already have it managed
        ValueGenerator generator = null;
        synchronized (this)
        {
            // This block is synchronised since we don't want to let any other thread through until
            // the generator is created, in case it is the same as the next request
            generator = valueGenerationMgr.getValueGenerator(generatorNameKeyInManager);
            if (generator == null)
            {
                if (generatorName == null)
                {
                    // No available value-generator for the specified strategy for this datastore
                    throw new NucleusUserException(LOCALISER.msg("038004", strategy));
                }

                // Set up the default properties available for all value generators
                Properties props = getPropertiesForGenerator(cmd, absoluteFieldNumber, om, sequenceMetaData,
                    tableGeneratorMetaData);

                Class cls = null;
                if (elem != null)
                {
                    cls = omfContext.getPluginManager().loadClass(elem.getExtension().getPlugin().getSymbolicName(),
                        elem.getAttribute("class-name"));
                }
                if (cls == null)
                {
                    throw new NucleusException("Cannot create Value Generator for strategy " + generatorName);
                }

                // Create the new ValueGenerator since the first time required (registers it with
                // the ValueGenerationManager too)
                generator = valueGenerationMgr.createValueGenerator(generatorNameKeyInManager, cls, props, this, null);
            }
        }

        // Get the next value from the generator
        Object oid = getStrategyValueForGenerator(generator, om);

        if (mmd != null)
        {
            // replace the value of the id, but before convert the value to the field type if needed
            Object convertedValue = TypeConversionHelper.convertTo(oid, mmd.getType());
            if (convertedValue == null)
            {
                throw new NucleusException(LOCALISER.msg("038003", mmd.getFullFieldName(), oid)).setFatal();
            }
            oid = convertedValue;
        }

        if (NucleusLogger.VALUEGENERATION.isDebugEnabled())
        {
            NucleusLogger.VALUEGENERATION.debug(LOCALISER.msg("038002", fieldName, strategy, generator.getClass().getName(), oid));
        }

        return oid;
    }
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.