/// <summary>
        /// Generates a single service
        /// </summary>
        /// <param name="service">The service that should be generated.</param>
        private void GenerateService( Service service )
        {
            ClassProxyGenerator classGenerator = new ClassProxyGenerator( GeneratorContext, Subject );
              ServiceNamingStrategy serviceNamingStrategy = new ServiceNamingStrategy();
              classGenerator.GenerateClassProxy( service, serviceNamingStrategy, "Classes/Service/", false );

              // Autoload services
              WriteVirtual(
            "ext_autoload.php",
            String.Format( "'{0}' => $extensionPath . 'Classes/Service/{1}',", serviceNamingStrategy.GetExtbaseClassName( Subject, service ).ToLower(), serviceNamingStrategy.GetExtbaseFileName( Subject, service ) ) );
        }
        /// <summary>
        /// Resolves all services defined in a given parsed fragment.
        /// </summary>
        /// <param name="parsedFragment"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException">Defining ExtBase SignalSlot listeners in service classes is unsupported at this time.</exception>
        /// <exception cref="ParserException">Service has no name!</exception>
        public static List<Service> Resolve( Fragment parsedFragment )
        {
            IEnumerable<Fragment> serviceFragments = parsedFragment.Fragments.Where( p => p.Keyword == Keywords.ExtensionDirectives.DeclareService );
              if( !serviceFragments.Any() ) return null;

              List<Service> services = new List<Service>();
              foreach( Fragment serviceFragment in serviceFragments ) {
            // Construct the plugin with the given name
            Service service = new Service {Name = serviceFragment.Parameters, SourceFragment = serviceFragment};

            // Resolve service
            foreach( Fragment serviceParameter in serviceFragment.Fragments ) {
              if( serviceParameter.Keyword == Keywords.PluginDirectives.Action ) {
            Typo3ExtensionGenerator.Model.Action action = ActionResolver.ResolveAction( serviceParameter );
            service.Actions.Add( action );

              } else if( serviceParameter.Keyword == Keywords.PluginDirectives.Listener ) {
            Listener listener = ListenerResolver.ResolveListener( serviceParameter );
            service.Actions.Add( listener.TargetAction );
            throw new NotImplementedException( "Defining ExtBase SignalSlot listeners in service classes is unsupported at this time." );
            //service.Listeners.Add( listener );

              } else if( serviceParameter.Keyword == Keywords.Implementation ) {
            service.Implementation = serviceParameter.Parameters;
              }
            }

            // If no name was defined, throw
            if( string.IsNullOrEmpty( service.Name ) ) {
              throw new ParserException( "Service has no name!", parsedFragment.SourceDocument );
            }

            services.Add( service );
              }

              return services;
        }
 /// <summary>
 /// Generates the ExtBase service file name that must be used for the implementation of a service.
 /// </summary>
 /// <param name="extension"></param>
 /// <param name="service"></param>
 /// <returns></returns>
 public static string GetExtbaseServiceImplementationFileName( Extension extension, Service service )
 {
     return String.Format( "{0}{1}ServiceImplementation.php", UpperCamelCase( extension.Key ), UpperCamelCase( service.Name ) );
 }
 /// <summary>
 /// Generates the Extbase service class name for a given service.
 /// </summary>
 /// <param name="extension"></param>
 /// <param name="service"></param>
 /// <returns></returns>
 public static string GetExtbaseServiceFileName( Extension extension, Service service )
 {
     return String.Format( "{0}Service.php", UpperCamelCase( service.Name ) );
 }
 /// <summary>
 /// Generates the ExtBase service class name for a given service.
 /// </summary>
 /// <param name="extension"></param>
 /// <param name="service"></param>
 /// <returns></returns>
 public static string GetExtbaseServiceClassName( Extension extension, Service service )
 {
     return String.Format( "Tx_{0}_Service_{1}Service", UpperCamelCase( extension.Key ), UpperCamelCase( service.Name ) );
 }