Index: Src/GoogleApis.Tools.CodeGen/Generator/ServiceClassGenerator.cs =================================================================== deleted file mode 100644 --- a/Src/GoogleApis.Tools.CodeGen/Generator/ServiceClassGenerator.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright 2010 Google Inc - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -using System.CodeDom; -using System.Collections.Generic; -using System.Linq; - -using Google.Apis.Discovery; -using Google.Apis.Logging; -using Google.Apis.Services; -using Google.Apis.Tools.CodeGen.Decorator.ServiceDecorator; - -namespace Google.Apis.Tools.CodeGen.Generator -{ - /// - /// Responsible for generating the Service class, this is handled primarly by calling - /// a secsesion of IServiceDecorator's - /// - /// - public class ServiceClassGenerator : BaseGenerator - { - public const string AuthenticatorName = "authenticator"; - public const string AuthenticatorPropertyName = "Authenticator"; - - private static readonly ILogger logger = ApplicationContext.Logger.ForType(); - - private readonly IEnumerable decorators; - private readonly ResourceContainerGenerator resourceContainerGenerator; - private readonly IService service; - - public ServiceClassGenerator(IService service, - IEnumerable decorators, - ResourceContainerGenerator resourceContainerGenerator) - { - this.decorators = decorators; - this.service = service; - this.resourceContainerGenerator = resourceContainerGenerator; - } - - /// - /// Creates a fully functional service class for the specified service - /// - public CodeTypeDeclaration CreateServiceClass() - { - var name = string.IsNullOrEmpty(service.CanonicalName) ? service.Name : service.CanonicalName; - string serviceClassName = GeneratorUtils.GetSafeMemberName( - Enumerable.Empty(), GeneratorUtils.TargetCase.ToUpper, name + "Service", - name + "Cls"); - logger.Debug("Starting Generation of Class {0}", serviceClassName); - var serviceClass = new CodeTypeDeclaration(serviceClassName); - serviceClass.IsPartial = true; - serviceClass.BaseTypes.Add(typeof(BaseClientService)); - - // Decorate the service class. - foreach (IServiceDecorator serviceDecorator in decorators) - { - logger.Debug("Decorating Class {0} with {1}", serviceClassName, serviceDecorator); - serviceDecorator.DecorateClass(service, serviceClass); - } - - return serviceClass; - } - - /// - /// Returns the field reference to the given resource - /// - public static CodeFieldReferenceExpression GetFieldReference(IResource resource, - IEnumerable otherResourceNames) - { - return new CodeFieldReferenceExpression( - new CodeThisReferenceExpression(), GeneratorUtils.GetFieldName(resource, otherResourceNames)); - } - } -} \ No newline at end of file