~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to rpmstubby/org.eclipse.linuxtools.rpmstubby/src/org/eclipse/linuxtools/rpmstubby/Generator.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2012-06-29 12:07:30 UTC
  • Revision ID: package-import@ubuntu.com-20120629120730-bfri1xys1i71dpn6
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
 * Copyright (c) 2011 Red Hat Inc. and others.
 
3
 * All rights reserved. This program and the accompanying materials
 
4
 * are made available under the terms of the Eclipse Public License v1.0
 
5
 * which accompanies this distribution, and is available at
 
6
 * http://www.eclipse.org/legal/epl-v10.html
 
7
 *
 
8
 * Contributors:
 
9
 *     Alexander Kurtakov - initial API and implementation
 
10
 *******************************************************************************/
 
11
 
 
12
package org.eclipse.linuxtools.rpmstubby;
 
13
 
 
14
import org.eclipse.core.resources.IFile;
 
15
import org.eclipse.linuxtools.internal.rpmstubby.StubbyGenerator;
 
16
import org.eclipse.linuxtools.internal.rpmstubby.StubbyPomGenerator;
 
17
 
 
18
/**
 
19
 * Utility API for stubifying spec files for different input types.
 
20
 * 
 
21
 */
 
22
public class Generator {
 
23
 
 
24
        private InputType type;
 
25
 
 
26
        /**
 
27
         * Creates the generator for the given input type.
 
28
         * 
 
29
         * @param type
 
30
         *            The input type for this generator.
 
31
         */
 
32
        public Generator(InputType type) {
 
33
                this.type = type;
 
34
        }
 
35
 
 
36
        /**
 
37
         * Generate the spec file for the given input file.
 
38
         * 
 
39
         * @param file
 
40
         *            The input file.
 
41
         */
 
42
        public void generate(IFile file) {
 
43
                switch (type) {
 
44
                case ECLIPSE_FEATURE:
 
45
                        new StubbyGenerator(file).writeContent();
 
46
                        break;
 
47
                case MAVEN_POM:
 
48
                        new StubbyPomGenerator(file).writeContent();
 
49
                        break;
 
50
                default:
 
51
                        break;
 
52
                }
 
53
        }
 
54
 
 
55
}