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

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


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


   
    /**
     * Process <export package=""/>
     */
    public JavaExport read(XMLStreamReader reader) 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("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 (packageName.equals(javaExport.getPackage())) {

                                    if (osgiRuntime.findBundle(targetContribution.getLocation()) == null)
                                        bundlesToInstall.add(targetContribution);

                                    initialized = true;
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

     *    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) 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("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

     * Test loading a valid export element from a contribution metadata stream
     * @throws Exception
     */
    public void testLoad() throws Exception {
        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
        JavaExport javaExport = (JavaExport)staxProcessor.read(reader);
        assertEquals("org.apache.tuscany.sca.contribution.java", javaExport.getPackage());
    }
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 (packageName.equals(javaExport.getPackage())) {

                                    if (osgiRuntime.findBundle(targetContribution.getLocation()) == null)
                                        bundlesToInstall.add(targetContribution);

                                    initialized = true;
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

     * @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.