Package org.apache.tuscany.sca.contribution.java

Examples of org.apache.tuscany.sca.contribution.java.JavaExport


        import_ = javaImportExportFactory.createJavaImport();
        import_.setPackage("calculator");
        import_.setExportContributions(exportContribList);
        contribB.getImports().add(import_);
       
        JavaExport export = javaImportExportFactory.createJavaExport();
        export.setPackage(this.getClass().getPackage().getName());
        contribA.getExports().add(export);
        export = javaImportExportFactory.createJavaExport();
        export.setPackage("calculator");
        contribC.getExports().add(export);
       
        // Load class from parent, class is also present in imported contribution. Class should
        // be loaded from parent
        Class<?> testClassB = contribB.getClassLoader().loadClass(this.getClass().getName());       
View Full Code Here


        NamespaceImport import1_ = namespaceImportExportFactory.createNamespaceImport();
        import1_.setNamespace("calculator");
        import1_.setExportContributions(exportContribList);
        contribB.getImports().add(import1_);
       
        JavaExport export = javaImportExportFactory.createJavaExport();
        export.setPackage(this.getClass().getPackage().getName());
        contribA.getExports().add(export);
        NamespaceExport export1 = namespaceImportExportFactory.createNamespaceExport();
        export1.setNamespace("calculator");
        contribC.getExports().add(export1);
View Full Code Here

     *    location is not provided
     *    import and export packages match
     */
    public boolean match(Export export) {
        if(export instanceof JavaExport) {
            JavaExport javaExport = (JavaExport)export;
            String exportedPackage = javaExport.getPackage();
            if (packageName.equals(exportedPackage)) {
                return true;
            } else {
                if (packageName.endsWith(".*")) {
                    String prefix = packageName.substring(0, packageName.length() - 1);
View Full Code Here

   
    /**
     * Process <export package=""/>
     */
    public JavaExport read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException {
        JavaExport javaExport = this.factory.createJavaExport();
        QName element = null;
       
        try {
            while (reader.hasNext()) {
                int event = reader.getEventType();
                switch (event) {
                    case START_ELEMENT:
                        element = reader.getName();
                       
                        // Read <export.java>
                        if (EXPORT_JAVA.equals(element)) {
                            String packageName = reader.getAttributeValue(null, PACKAGE);
                            if (packageName == null) {
                              error(context.getMonitor(), "AttributePackageMissing", reader);
                                //throw new ContributionReadException("Attribute 'package' is missing");
                            } else                       
                                javaExport.setPackage(packageName);
                        }
                        break;
                    case XMLStreamConstants.END_ELEMENT:
                        if (EXPORT_JAVA.equals(reader.getName())) {
                            return javaExport;
View Full Code Here

                    if (targetContribution != null) {
                   
                        // Find a matching contribution export
                        for (Export export: targetContribution.getExports()) {
                            if (export instanceof JavaExport) {
                                JavaExport javaExport = (JavaExport)export;
                                if (javaImport.getPackage().equals(javaExport.getPackage())) {
                                    javaImport.setModelResolver(javaExport.getModelResolver());
                                   
                                    List<Contribution> exportingContributions = new ArrayList<Contribution>();
                                    exportingContributions.add(export.getContribution());
                                    import_.setExportContributions(exportingContributions);
                                   
View Full Code Here

     *    location is not provided
     *    import and export packages match
     */
    public boolean match(Export export) {
        if(export instanceof JavaExport) {
            JavaExport javaExport = (JavaExport)export;
            String exportedPackage = javaExport.getPackage();
            if (packageName.equals(exportedPackage)) {
                return true;
            } else {
                if (packageName.endsWith(".*")) {
                    String prefix = packageName.substring(0, packageName.length() - 1);
View Full Code Here

   
    /**
     * Process <export package=""/>
     */
    public JavaExport read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException {
        JavaExport javaExport = this.factory.createJavaExport();
        QName element = null;
       
        try {
            while (reader.hasNext()) {
                int event = reader.getEventType();
                switch (event) {
                    case START_ELEMENT:
                        element = reader.getName();
                       
                        // Read <export.java>
                        if (EXPORT_JAVA.equals(element)) {
                            String packageName = reader.getAttributeValue(null, PACKAGE);
                            if (packageName == null) {
                              error(context.getMonitor(), "AttributePackageMissing", reader);
                                //throw new ContributionReadException("Attribute 'package' is missing");
                            } else                       
                                javaExport.setPackage(packageName);
                        }
                        break;
                    case XMLStreamConstants.END_ELEMENT:
                        if (EXPORT_JAVA.equals(reader.getName())) {
                            return javaExport;
View Full Code Here

        import_ = javaImportExportFactory.createJavaImport();
        import_.setPackage("calculator");
        import_.setModelResolver(new JavaImportModelResolver(exportContribList, null));
        contribB.getImports().add(import_);
       
        JavaExport export = javaImportExportFactory.createJavaExport();
        export.setPackage(getPackageName(getClass()));
        contribA.getExports().add(export);
        export = javaImportExportFactory.createJavaExport();
        export.setPackage("calculator");
        contribC.getExports().add(export);       
       
        // Load class from parent, class is also present in imported contribution. Class should
        // be loaded from parent
        Class<?> testClassB = contribB.getClassLoader().loadClass(this.getClass().getName());       
View Full Code Here

        JavaImport import1_ = javaImportExportFactory.createJavaImport();
        import1_.setPackage("calculator");
        import1_.setModelResolver(new JavaImportModelResolver(exportContribList, null));
        contribB.getImports().add(import1_);
       
        JavaExport export = javaImportExportFactory.createJavaExport();
        export.setPackage(getPackageName(getClass()));
        contribA.getExports().add(export);
        JavaExport export1 = javaImportExportFactory.createJavaExport();
        export1.setPackage("calculator");
        contribC.getExports().add(export1);

       
        // Load resource from parent
        URL resB = contribB.getClassLoader().getResource("deployables/sample-calculator.jar");
View Full Code Here

     * @throws Exception
     */
    @Test
    public void testLoad() throws Exception {
        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
        JavaExport javaExport = (JavaExport)staxProcessor.read(reader, context);
        Assert.assertEquals("org.apache.tuscany.sca.contribution.java", javaExport.getPackage());
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.contribution.java.JavaExport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.