cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1062654 - in /cxf/branches/2.3.x-fixes: ./ tools/corba/src/main/java/org/apache/cxf/tools/corba/idlpreprocessor/ tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ tools/corba/src/test/java/org/apache/cxf/tools/corba/proc...
Date Mon, 24 Jan 2011 05:41:56 GMT
Author: ffang
Date: Mon Jan 24 05:41:55 2011
New Revision: 1062654

URL: http://svn.apache.org/viewvc?rev=1062654&view=rev
Log:
Merged revisions 1062651 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1062651 | ffang | 2011-01-24 13:29:04 +0800 (δΈ€, 24  1 2011) | 1 line
  
  [CXF-3264]idl2wsdl tool should be able to honor #pragma directive
........

Added:
    cxf/branches/2.3.x-fixes/tools/corba/src/test/resources/idl/PragmaPrefix.idl
      - copied unchanged from r1062651, cxf/trunk/tools/corba/src/test/resources/idl/PragmaPrefix.idl
    cxf/branches/2.3.x-fixes/tools/corba/src/test/resources/idl/expected_PragmaPrefix.wsdl
      - copied unchanged from r1062651, cxf/trunk/tools/corba/src/test/resources/idl/expected_PragmaPrefix.wsdl
Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/idlpreprocessor/IdlPreprocessorReader.java
    cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLProcessor.java
    cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLToWSDLProcessor.java
    cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/PortTypeVisitor.java
    cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/WSDLASTVisitor.java
    cxf/branches/2.3.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/IDLToWSDLGenerationTest.java
    cxf/branches/2.3.x-fixes/tools/corba/src/test/resources/idlpreprocessor/C.idl

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/idlpreprocessor/IdlPreprocessorReader.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/idlpreprocessor/IdlPreprocessorReader.java?rev=1062654&r1=1062653&r2=1062654&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/idlpreprocessor/IdlPreprocessorReader.java
(original)
+++ cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/idlpreprocessor/IdlPreprocessorReader.java
Mon Jan 24 05:41:55 2011
@@ -79,6 +79,8 @@ public final class IdlPreprocessorReader
     private final StringBuilder buf = new StringBuilder();
 
     private int readPos;
+    
+    private String pragmaPrefix;
 
     /**
      * Creates a new IncludeReader.
@@ -184,6 +186,8 @@ public final class IdlPreprocessorReader
                 handleElse(lineNo, ise);
             } else if (line.startsWith("#define")) {
                 handleDefine(line);
+            } else if (line.startsWith("#pragma")) {
+                handlePragma(line);
             } else {
                 throw new PreprocessingException("unknown preprocessor instruction", ise.getURL(),
lineNo);
             }
@@ -272,6 +276,18 @@ public final class IdlPreprocessorReader
         buf.append(LF);
     }
 
+    private void handlePragma(String line) {
+        String symbol = line.substring(line.indexOf("prefix") + "prefix".length()).trim();
+        if (symbol.startsWith("\"")) {
+            symbol = symbol.substring(1);
+        }
+        if (symbol.endsWith("\"")) {
+            symbol = symbol.substring(0, symbol.length() - 1);
+        }
+        setPragmaPrefix(symbol);
+        buf.append(LF);     
+    }
+    
     private void handleIfndef(String line) {
         String symbol = line.substring("#ifndef".length()).trim();
         boolean isDefined = defineState.isDefined(symbol);
@@ -358,4 +374,12 @@ public final class IdlPreprocessorReader
         buf.append("# ").append(lineNumber).append(' ').append(location).append(' ').append(flag).append(LF);
     }
 
+    public void setPragmaPrefix(String pragmaPrefix) {
+        this.pragmaPrefix = pragmaPrefix;
+    }
+
+    public String getPragmaPrefix() {
+        return pragmaPrefix;
+    }
+
 }

Modified: cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLProcessor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLProcessor.java?rev=1062654&r1=1062653&r2=1062654&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLProcessor.java
(original)
+++ cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLProcessor.java
Mon Jan 24 05:41:55 2011
@@ -38,8 +38,10 @@ public class IDLProcessor implements Pro
 
     protected ProcessorEnvironment env;
 
+    protected IdlPreprocessorReader preprocessor;
+    
     private IDLParser parser;
-
+    
     public void setEnvironment(ProcessorEnvironment penv) {
         env = penv;
     }
@@ -54,7 +56,7 @@ public class IDLProcessor implements Pro
             URL orig = file.toURI().toURL();
             DefaultIncludeResolver includeResolver = getDefaultIncludeResolver(file.getParentFile());
             DefineState defineState = new DefineState(new HashMap<String, String>());
-            IdlPreprocessorReader preprocessor = new IdlPreprocessorReader(orig,
+            preprocessor = new IdlPreprocessorReader(orig,
                                                                            location,
                                                                            includeResolver,
                                                                            defineState);

Modified: cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLToWSDLProcessor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLToWSDLProcessor.java?rev=1062654&r1=1062653&r2=1062654&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLToWSDLProcessor.java
(original)
+++ cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/IDLToWSDLProcessor.java
Mon Jan 24 05:41:55 2011
@@ -160,7 +160,8 @@ public class IDLToWSDLProcessor extends 
         outputDir = ".";
 
         try {
-            WSDLASTVisitor visitor = new WSDLASTVisitor(tns, schemans, corbatypemaptns);
+            WSDLASTVisitor visitor = new WSDLASTVisitor(tns, schemans, corbatypemaptns, 
+                                                        preprocessor.getPragmaPrefix());
             visitor.getManager().setIgnoreImports(ignoreImports);
             if (env.optionSet(ToolConstants.CFG_OUTPUTDIR)) {
                 outputDir =  (String) env.get(ToolConstants.CFG_OUTPUTDIR);

Modified: cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/PortTypeVisitor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/PortTypeVisitor.java?rev=1062654&r1=1062653&r2=1062654&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/PortTypeVisitor.java
(original)
+++ cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/PortTypeVisitor.java
Mon Jan 24 05:41:55 2011
@@ -247,7 +247,11 @@ public class PortTypeVisitor extends Vis
         try {
             BindingType bindingType = (BindingType)
                 extReg.createExtension(Binding.class, CorbaConstants.NE_CORBA_BINDING);
+            String pragmaPrefix = (this.getWsdlVisitor().getPragmaPrefix() != null 
+                                        && this.getWsdlVisitor().getPragmaPrefix().length()
> 0) 
+                ? this.getWsdlVisitor().getPragmaPrefix() + "/" : ""; 
             bindingType.setRepositoryID(CorbaConstants.REPO_STRING
+                                        + pragmaPrefix
                                         + scopedPortTypeName.replace('.', '/')
                                         + CorbaConstants.IDL_VERSION);
             binding.addExtensibilityElement(bindingType);

Modified: cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/WSDLASTVisitor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/WSDLASTVisitor.java?rev=1062654&r1=1062653&r2=1062654&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/WSDLASTVisitor.java
(original)
+++ cxf/branches/2.3.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/WSDLASTVisitor.java
Mon Jan 24 05:41:55 2011
@@ -74,8 +74,9 @@ public final class WSDLASTVisitor implem
     private ModuleToNSMapper moduleToNSMapper;    
     private WSDLSchemaManager manager;
     private Map<Scope, List<Scope>> inheritScopeMap;
+    private String pragmaPrefix;
 
-    public WSDLASTVisitor(String tns, String schemans, String corbatypemaptns)
+    public WSDLASTVisitor(String tns, String schemans, String corbatypemaptns, String pragmaPrefix)
         throws WSDLException, JAXBException {
         
         manager = new WSDLSchemaManager();
@@ -106,8 +107,14 @@ public final class WSDLASTVisitor implem
         setBoundedStringOverride(false);
 
         moduleToNSMapper = new ModuleToNSMapper();
+        this.setPragmaPrefix(pragmaPrefix);
     }
 
+    public WSDLASTVisitor(String tns, String schemans, String corbatypemaptns)
+        throws WSDLException, JAXBException {
+        this(tns, schemans, corbatypemaptns, null);
+    }
+    
     public void visit(AST node) {
         // <specification> ::= <definition>+
 
@@ -478,4 +485,12 @@ public final class WSDLASTVisitor implem
         moduleToNSMapper.setExcludedModuleMap(modules);
     }
 
+    public void setPragmaPrefix(String pragmaPrefix) {
+        this.pragmaPrefix = pragmaPrefix;
+    }
+
+    public String getPragmaPrefix() {
+        return pragmaPrefix;
+    }
+
 }

Modified: cxf/branches/2.3.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/IDLToWSDLGenerationTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/IDLToWSDLGenerationTest.java?rev=1062654&r1=1062653&r2=1062654&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/IDLToWSDLGenerationTest.java
(original)
+++ cxf/branches/2.3.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/processors/IDLToWSDLGenerationTest.java
Mon Jan 24 05:41:55 2011
@@ -303,6 +303,12 @@ public class IDLToWSDLGenerationTest ext
         // This tests for recursive unions
         testWSDLGeneration("/idl/RecursiveUnion.idl", "/idl/expected_RecursiveUnion.wsdl");
     }
+    
+    @Test
+    public void testPragmaPrefix() throws Exception {
+        // This tests for how pragma prefix directive affect the corba binding repositoryID
+        testWSDLGeneration("/idl/PragmaPrefix.idl", "/idl/expected_PragmaPrefix.wsdl");
+    }
 
     public void testLogicalPhysicalSchemaGeneration(String idlFilename, 
                                              String logicalName,

Modified: cxf/branches/2.3.x-fixes/tools/corba/src/test/resources/idlpreprocessor/C.idl
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/tools/corba/src/test/resources/idlpreprocessor/C.idl?rev=1062654&r1=1062653&r2=1062654&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/tools/corba/src/test/resources/idlpreprocessor/C.idl (original)
+++ cxf/branches/2.3.x-fixes/tools/corba/src/test/resources/idlpreprocessor/C.idl Mon Jan
24 05:41:55 2011
@@ -5,7 +5,7 @@
 #else
  #define _c
 #endif
-
+#pragma prefix "org.apache.cxf"
 module c
 {
   interface C {



Mime
View raw message