Package com.puppetlabs.geppetto.pp.pptp

Examples of com.puppetlabs.geppetto.pp.pptp.MetaType


          break;

        case META: {
          PPTypeInfo info = helper.getMetaTypeInfo(uri.path(), new InputStreamReader(inputStream));

          MetaType type = PPTPFactory.eINSTANCE.createMetaType();
          type.setName(info.getTypeName());
          type.setDocumentation(info.getDocumentation());
          for(Map.Entry<String, PPTypeInfo.Entry> entry : info.getParameters().entrySet()) {
            Parameter parameter = PPTPFactory.eINSTANCE.createParameter();
            parameter.setName(entry.getKey());
            parameter.setDocumentation(entry.getValue().documentation);
            parameter.setRequired(entry.getValue().isRequired());
            type.getParameters().add(parameter);
          }
          // TODO: Scan the puppet source for providers for the type
          // This is a CHEAT -
          // https://github.com/puppetlabs/geppetto/issues/37
          Parameter p = PPTPFactory.eINSTANCE.createParameter();
          p.setName("provider");
          p.setDocumentation("");
          p.setRequired(false);
          type.getParameters().add(p);

          getContents().add(type);
          break;
        }

        case TYPEFRAGMENT: {
          for(PPTypeInfo type : helper.getTypeFragments(uri.path(), new InputStreamReader(inputStream))) {
            TypeFragment fragment = PPTPFactory.eINSTANCE.createTypeFragment();
            fragment.setName(type.getTypeName());

            // add the properties (will typically load just one).
            for(Map.Entry<String, PPTypeInfo.Entry> entry : type.getProperties().entrySet()) {
              Property property = PPTPFactory.eINSTANCE.createProperty();
              property.setName(entry.getKey());
              property.setDocumentation(entry.getValue().documentation);
              property.setRequired(entry.getValue().isRequired());
              fragment.getProperties().add(property);
            }

            // add the parameters (will typically load just one).
            for(Map.Entry<String, PPTypeInfo.Entry> entry : type.getParameters().entrySet()) {
              Parameter parameter = PPTPFactory.eINSTANCE.createParameter();
              parameter.setName(entry.getKey());
              parameter.setDocumentation(entry.getValue().documentation);
              parameter.setRequired(entry.getValue().isRequired());
              fragment.getParameters().add(parameter);
View Full Code Here


   * <!-- end-user-doc -->
   *
   * @generated
   */
  public NotificationChain basicSetMetaType(MetaType newMetaType, NotificationChain msgs) {
    MetaType oldMetaType = metaType;
    metaType = newMetaType;
    if(eNotificationRequired()) {
      ENotificationImpl notification = new ENotificationImpl(
        this, Notification.SET, PPTPPackage.TARGET_ENTRY__META_TYPE, oldMetaType, newMetaType);
      if(msgs == null)
View Full Code Here

    return functionInfoToFunction(rubyProvider.getLogFunctions(rbFile));
  }

  private void loadMetaType(TargetEntry target, File rbFile) throws IOException, RubySyntaxException {
    PPTypeInfo info = getMetaTypeInfo(rbFile);
    MetaType type = PPTPFactory.eINSTANCE.createMetaType();
    type.setName(info.getTypeName());
    type.setDocumentation(info.getDocumentation());
    for(Map.Entry<String, PPTypeInfo.Entry> entry : info.getParameters().entrySet()) {
      Parameter parameter = PPTPFactory.eINSTANCE.createParameter();
      parameter.setName(entry.getKey());
      parameter.setDocumentation(entry.getValue().documentation);
      parameter.setRequired(entry.getValue().isRequired());
      type.getParameters().add(parameter);
    }
    // TODO: Scan the puppet source for providers for the type
    // This is a CHEAT - https://github.com/puppetlabs/geppetto/issues/37
    Parameter p = PPTPFactory.eINSTANCE.createParameter();
    p.setName("provider");
    p.setDocumentation("");
    p.setRequired(false);
    type.getParameters().add(p);

    // TODO: there are more interesting things to pick up (like valid
    // values)
    target.setMetaType(type);
View Full Code Here

TOP

Related Classes of com.puppetlabs.geppetto.pp.pptp.MetaType

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.