import simple hello.war results xml-fragment tag in geronimo-web.xml
--------------------------------------------------------------------

                 Key: GERONIMODEVTOOLS-119
                 URL: http://issues.apache.org/jira/browse/GERONIMODEVTOOLS-119
             Project: Geronimo-Devtools
          Issue Type: Bug
          Components: eclipse-plugin
    Affects Versions: 1.2.0
         Environment: patched created with latest trunk 480183
            Reporter: Lin Sun


Tried to import a simple hello war file however after import the 
geronimo-web.xml file contains xml-fragment tag which prevents the hello 
project from being deployed to server. tried to print out the following var 
plan in ImportDeploymentPlanOperation.java

plan = runtime.fixGeronimoWebSchema(planFile);
System.out.println("plan 1: " + plan.toString());

Here's the printout:
plan 1: <xml-fragment xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"; 
xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"; 
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1"; 
xmlns:web="http://geronimo.apache.org/xml/ns/j2ee/web-1.1";>
  <sys:environment>
    <sys:moduleId>
      <sys:groupId>samples</sys:groupId>
      <sys:artifactId>cviewer</sys:artifactId>
      <sys:version>1.1</sys:version>
      <sys:type>war</sys:type>
    </sys:moduleId>
    <sys:dependencies/>
    <sys:hidden-classes/>
    <sys:non-overridable-classes/>
  </sys:environment>
  <web:context-root>/cviewer</web:context-root>
</xml-fragment>

Note this is not a valid plan.

I updated the following method in 
org.apache.geronimo.st.v11.core.GeronimoRuntime and it is working now (for war 
file).

public XmlObject fixGeronimoWebSchema(IFile plan) throws XmlException {
        XmlObject xmlplan = getXmlObject(plan);
        if (plan != null) {
            SchemaConversionUtils.fixGeronimoSchema(xmlplan, 
GerWebAppDocument.type.getDocumentElementName(),
                    GerWebAppType.type);
            save(xmlplan, plan);
            return xmlplan;
        }
        return null;
//return SchemaConversionUtils.fixGeronimoSchema(getXmlObject(plan), 
GerWebAppDocument.type.getDocumentElementName(), GerWebAppType.type);
}

Also added the save method back from 1.0 to 
org.apache.geronimo.st.v11.core.GeronimoRuntime:

private void save(XmlObject object, IFile file) {
try {
object.save(file.getLocation().toFile());
file.refreshLocal(IFile.DEPTH_ONE, null);
} catch (IOException e) {
e.printStackTrace();
} catch (CoreException e) {
e.printStackTrace();
}
} 

Patch has been tested on importing war projects and worked well.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to