1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.maven.plugin.eclipse.writers.wtp; 20 21 import org.codehaus.plexus.util.xml.XMLWriter; 22 23 /** 24 * Component writer for WTP 1.5. File name has changed in WTP 1.5rc2 and the <code>project-version</code> attribute has 25 * been added. These ones are the only differences 26 * 27 * @author Fabrizio Giustina 28 * @version $Id: EclipseWtpComponent15Writer.java 691404 2008-09-02 21:57:19Z aheritier $ 29 */ 30 public class EclipseWtpComponent15Writer 31 extends EclipseWtpComponentWriter 32 { 33 34 /** 35 * File name where the WTP component settings will be stored for our Eclipse Project. 36 * 37 * @return <code>org.eclipse.wst.common.component</code> 38 */ 39 protected String getComponentFileName() 40 { 41 return "org.eclipse.wst.common.component"; //$NON-NLS-1$ 42 } 43 44 /** 45 * Version number added to component configuration. 46 * 47 * @return <code>1.0</code> 48 */ 49 protected String getProjectVersion() 50 { 51 if ( this.config.getWtpVersion() < 2.0f ) 52 { 53 return "1.5.0"; //$NON-NLS-1$ 54 } 55 else 56 { 57 return "2.0"; //$NON-NLS-1$ 58 } 59 } 60 61 /** 62 * @param writer 63 */ 64 protected void writeContextRoot( XMLWriter writer ) 65 { 66 writer.startElement( ELT_PROPERTY ); 67 writer.addAttribute( ATTR_NAME, ATTR_CONTEXT_ROOT ); 68 writer.addAttribute( ATTR_VALUE, config.getContextName() ); 69 writer.endElement(); // property 70 } 71 72 }