Package net.sf.gluebooster.java.booster.essentials.meta

Examples of net.sf.gluebooster.java.booster.essentials.meta.ObjectDescription


      }
    };
   
    // Invoke the command line
    CommandLineApplication.invoke(businessLogicWorker,
        new ObjectDescription(options), new String[] { "aaa",
            CommandLineApplication.OPTION_PREFIX + OPTION_2,
        OPTION_2_VALUE });

    // [/gb:useInDocumentation]
  }
View Full Code Here


  @Test
  public void testXMLEncoder() throws Exception {
    String NAME = "my name";


    ObjectDescription objectDescription = new ObjectDescription();
    objectDescription.setName(NAME);

    ByteArrayOutputStream xml = new ByteArrayOutputStream();
    XmlBoostUtils.writeAsUtf8Xml(objectDescription, xml, true, 0);

    String xmlText = TextBoostUtils.toStringFromUtf8(xml.toByteArray());

    ObjectDescription description2 = XmlBoostUtils
        .readFromXml(new ByteArrayInputStream(
        xml.toByteArray()));
    Assert.assertEquals(objectDescription.getName(), description2.getName());

    ApplicationDescription app1 = new ApplicationDescription();
    app1.setName("Application 1");

    ApplicationDescription app2 = new ApplicationDescription();
View Full Code Here

    for (int i = parameters.length - 1; i > -1; i--) {
      if (parameters[i] == null)
        parameters[i] = "";
    }

    ObjectDescription configuration = getConfiguration();
    ValueDescription valueDescription = configuration.getValueDescription();

    GnuParser parser = new GnuParser();
    try {
      valueDescription.setValue(parser.parse(getCommandLineOptions(),
        parameters));
    } catch (ParseException ex) {
      throw new ParseException(ex.getLocalizedMessage()
          + "\nOptions were " + Arrays.asList(parameters) + "\n"
          + getOptionsHelp());
    }

    if (!configuration.checkValue()) {
      throw new ParseException(configuration.toString());
    }

    return configuration;
  }
View Full Code Here

   * @return if no own configuration is present and the executor is a
   *         configurable, its configuration is returned
   */
  @Override
  public ObjectDescription getConfiguration() {
    ObjectDescription result = super.getConfiguration();

    if (result == null && executor != null
        && executor instanceof Configurable)
      result = ((Configurable) executor).getConfigurationDescription();

View Full Code Here

        Arrays.asList(parameterArray));
    String[] parameters = (String[]) parameterArray;
    ObjectFactory exec = getExecutor();
    Object parameter;
    if (exec instanceof Configurable) {
      ObjectDescription optionDescription = getCommandFromParameters((String[]) parameters);
      if (!optionDescription.checkValue()) {
        throw new InvalidParameterException(
            optionDescription.toString());
      }
      parameter = optionDescription;

    } else {
      parameter = parameters;
View Full Code Here

   *            the description is created from the options.
   */
  public void setCommandLineOptions(Options commandLineOptions,
      ObjectFactory executor) {

    ObjectDescription commandConfigurationDescription = new ObjectDescription(
        commandLineOptions);

    BoostedObject commandConfiguration = new BoostedObject();
    commandConfiguration.setConfiguration(commandConfigurationDescription);

View Full Code Here

    this.encoding = encoding;
  }

  public SourcePreprocessor() {

    ObjectDescription configuration = new ObjectDescription(
        SourcePreprocessor.class.getSimpleName() + " configuration",
        "Configuration of the transform method of the "
            + SourcePreprocessor.class.getSimpleName());
    ValueDescription value = new ValueDescription(Map.class
    /*
     * Map.class has changed to commandline
     */);
    configuration.setValueDescription(value);
    value.addSubdescription(new ObjectDescription(
        IoBoostUtils.PARAMETERNAME_ENCODING,
        "Encoding of generated files", String.class, true));
    value.addSubdescription(new ObjectDescription(PARAMETERNAME_SRC_ROOT,
        "The root directory of the files to process", File.class, true));
    value.addSubdescription(new ObjectDescription(
        PARAMETERNAME_GENERATED_JAVA_ROOT,
        "The root directory of the generated java files", File.class,
        true));
    value.addSubdescription(new ObjectDescription(
        PARAMETERNAME_GENERATED_RESOURCES_ROOT,
        "The root directory of generated resource files", File.class,
        true));

    setConfiguration(configuration);
View Full Code Here

   */
  @Override
  public Object getObjectInstance(Object objectDescription, Name nameIgnored,
      Context nameCtxIgnored, Hashtable<?, ?> environmentIgnored)
      throws Exception {
    ObjectDescription configuration = (ObjectDescription) objectDescription;


    Map options = (Map) configuration.getValueDescription().getValue();
    // options should be ObjectDescription with values already set
    getConfigurationDescription().checkValue();

    new SourcePreprocessor(
        (String) options.get(IoBoostUtils.PARAMETERNAME_ENCODING))
View Full Code Here

    Option option = new Option(GENERATE_PROPERTIES_ID_CLASS_OPTION, true,
        "Creates a sourcefile with constants for a properties file.");
    option.setArgs(4);
    option.setRequired(true);
    ObjectDescription commandConfiguration = new ObjectDescription(option);

    CommandLineApplication.invoke(new ObjectAnalyzingCodeGenerator(),
        commandConfiguration, args);

    // ObjectAnalyzingCodeGenerator generator = new
View Full Code Here

  @Override
  public Object getObjectInstance(Object objectDescription, Name name,
      Context nameCtx,
      Hashtable<?, ?> environment) throws Exception {
    ObjectDescription description = (ObjectDescription) objectDescription;
    CommandLine command = (CommandLine) description.getValueDescription()
        .getValue();

    if (command.hasOption(GENERATE_PROPERTIES_ID_CLASS_OPTION)) {
      String[] parameters = command
          .getOptionValues(GENERATE_PROPERTIES_ID_CLASS_OPTION);
View Full Code Here

TOP

Related Classes of net.sf.gluebooster.java.booster.essentials.meta.ObjectDescription

Copyright © 2018 www.massapicom. 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.