Package org.jboss.forge.env

Examples of org.jboss.forge.env.Configuration


            writer.print(ShellColor.BOLD, key.toString());
            writer.print("=");

            for (ConfigurationScope scope : ConfigurationScope.values())
            {
               Configuration scoped = config.getScopedConfiguration(scope);
               if (scoped != null)
               {
                  Object value = scoped.getProperty(key.toString());
                  writer.print(ShellColor.YELLOW, scope.name() + ": ");
                  if (value != null)
                  {
                     writer.print("[" + value.toString() + "] ");
                  }
View Full Code Here


   }

   @Override
   public Configuration getScopedConfiguration(final ConfigurationScope scope)
   {
      Configuration configuration = delegates.get(scope);
      if (configuration == null)
      {
         throw new IllegalArgumentException("No delegates were found in configuration - cannot retrieve scope");
      }
      return configuration;
View Full Code Here

   }

   @Override
   public Configuration getScopedConfiguration(final ConfigurationScope scope)
   {
      Configuration configuration = delegates.get(scope);
      if (configuration == null)
      {
         throw new IllegalStateException("No delegates were found in configuration - cannot retrieve scope");
      }
      return configuration;
View Full Code Here

   @Override
   public boolean install()
   {
      RestActivatorType activatorType = null;
      Configuration projectConfiguration = getProjectConfiguration();
      String activatorChoice = projectConfiguration.getString(RestFacet.ACTIVATOR_CHOICE);
      if (activatorChoice == null || activatorChoice.equals(""))
      {
         activatorType = prompt.promptEnum("How do you want to activate REST resources in your application ?",
                  RestActivatorType.class,
                  RestActivatorType.WEB_XML);
      }
      else
      {
         activatorType = RestActivatorType.valueOf(activatorChoice);
      }

      String rootpath = prompt.prompt("What root path do you want to use for your resources?", "/rest");
      projectConfiguration.setProperty(RestFacet.ROOTPATH, rootpath);

      if (activatorType == null || activatorType == RestActivatorType.WEB_XML
               && !project.hasFacet(RestWebXmlFacetImpl.class))
      {
         request.fire(new InstallFacets(RestWebXmlFacetImpl.class));
      }
      else if (activatorType == RestActivatorType.APP_CLASS && !project.hasFacet(RestApplicationFacet.class))
      {
         String pkg = prompt.promptCommon("In what package do you want to store the Application class?",
                  PromptType.JAVA_PACKAGE, project.getFacet(MetadataFacet.class).getTopLevelPackage() + ".rest");
         String restApplication = prompt.prompt("How do you want to name the Application class?", "RestApplication");
         projectConfiguration.setProperty(RestApplicationFacet.REST_APPLICATIONCLASS_PACKAGE, pkg);
         projectConfiguration.setProperty(RestApplicationFacet.REST_APPLICATIONCLASS_NAME, restApplication);
         request.fire(new InstallFacets(RestApplicationFacet.class));
      }
      return super.install();
   }
View Full Code Here

   @Override
   public boolean isInstalled()
   {
      JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);

      Configuration projectConfiguration = getProjectConfiguration();
      classPackage = projectConfiguration.getString(REST_APPLICATIONCLASS_PACKAGE);
      className = projectConfiguration.getString(REST_APPLICATIONCLASS_NAME);
      rootPath = projectConfiguration.getString(RestFacet.ROOTPATH);
     
      if ((classPackage == null || className == null) && !findApplicationClass())
      {
         return false;
      }
View Full Code Here

   private boolean findApplicationClass()
   {
      JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);

      Configuration projectConfiguration = getProjectConfiguration();
      projectConfiguration.clearProperty(REST_APPLICATIONCLASS_NAME);
      projectConfiguration.clearProperty(REST_APPLICATIONCLASS_PACKAGE);

      javaSourceFacet.visitJavaSources(new JavaResourceVisitor()
      {
         Configuration configuration = getProjectConfiguration();
         boolean found = false;

         @Override
         public void visit(JavaResource javaResource)
         {
            if (!found)
            {
               try
               {
                  if (javaResource.getJavaSource().getAnnotation("javax.ws.rs.ApplicationPath") != null)
                  {
                     configuration
                              .setProperty(REST_APPLICATIONCLASS_PACKAGE, javaResource.getJavaSource().getPackage());
                     configuration.setProperty(REST_APPLICATIONCLASS_NAME, javaResource.getJavaSource().getName());
                     configuration.setProperty(RestFacet.ROOTPATH,
                              javaResource.getJavaSource().getAnnotation("javax.ws.rs.ApplicationPath")
                                       .getStringValue());
                     found = true;
                  }
               }
               catch (FileNotFoundException e)
               {
                  throw new RuntimeException(e);
               }
            }
         }
      });

      return projectConfiguration.getString(REST_APPLICATIONCLASS_NAME) != null;
   }
View Full Code Here

TOP

Related Classes of org.jboss.forge.env.Configuration

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.