Package org.apache.felix.fileinstall

Examples of org.apache.felix.fileinstall.ArtifactListener


                fileSet.add(bundleFile);
                return fileSet;
            }
        };

        final ArtifactListener mockArtifactListener = EasyMock.createNiceMock(ArtifactListener.class);
        EasyMock.expect(mockArtifactListener.canHandle(bundleFile)).andReturn(Boolean.TRUE).anyTimes();
        final ServiceReference mockServiceReference = EasyMock.createNiceMock(ServiceReference.class);

        // simulate known/installed bundles
        mockBundleContext.addBundleListener((BundleListener) org.easymock.EasyMock.anyObject());
        EasyMock.expect(mockBundleContext.getBundles()).andReturn(new Bundle[]{mockBundle});
View Full Code Here


                    artifact.setChecksum(scanner.getChecksum(file));
                    // If there's no listener, this is because this artifact has been installed before
                    // fileinstall has been restarted.  In this case, try to find a listener.
                    if (artifact.getListener() == null)
                    {
                        ArtifactListener listener = findListener(jar, listeners);
                        // If no listener can handle this artifact, we need to defer the
                        // processing for this artifact until one is found
                        if (listener == null)
                        {
                            synchronized (processingFailures)
                            {
                                processingFailures.add(file);
                            }
                            continue;
                        }
                        artifact.setListener(listener);
                    }
                    // If the listener can not handle this file anymore,
                    // uninstall the artifact and try as if is was new
                    if (!listeners.contains(artifact.getListener()) || !artifact.getListener().canHandle(jar))
                    {
                        deleted.add(artifact);
                        artifact = null;
                    }
                    // The listener is still ok
                    else
                    {
                        deleteTransformedFile(artifact);
                        artifact.setJaredDirectory(jar);
                        artifact.setJaredUrl(jaredUrl);
                        if (transformArtifact(artifact))
                        {
                            modified.add(artifact);
                        }
                        else
                        {
                            deleteJaredDirectory(artifact);
                            deleted.add(artifact);
                        }
                        continue;
                    }
                }
                // File has been added
                else
                {
                    // Find the listener
                    ArtifactListener listener = findListener(jar, listeners);
                    // If no listener can handle this artifact, we need to defer the
                    // processing for this artifact until one is found
                    if (listener == null)
                    {
                        synchronized (processingFailures)
View Full Code Here

    ArtifactListener findListener(File artifact, List/* <ArtifactListener> */ listeners)
    {
        for (Iterator itL = listeners.iterator(); itL.hasNext();)
        {
            ArtifactListener listener = (ArtifactListener) itL.next();
            if (listener.canHandle(artifact))
            {
                return listener;
            }
        }
        return null;
View Full Code Here

        }
    }

    public Object addingService(ServiceReference serviceReference)
    {
        ArtifactListener listener = (ArtifactListener) context.getService(serviceReference);
        addListener(serviceReference, listener);
        return listener;
    }
View Full Code Here

                if (artifact != null) {
                    artifact.setChecksum(scanner.getChecksum(file));
                    // If there's no listener, this is because this artifact has been installed before
                    // fileinstall has been restarted.  In this case, try to find a listener.
                    if (artifact.getListener() == null) {
                        ArtifactListener listener = findListener(jar, listeners);
                        // If no listener can handle this artifact, we need to defer the
                        // processing for this artifact until one is found
                        if (listener == null) {
                            synchronized (processingFailures) {
                                processingFailures.add(file);
                            }
                            continue;
                        }
                        artifact.setListener(listener);
                    }
                    // If the listener can not handle this file anymore,
                    // uninstall the artifact and try as if is was new
                    if (!listeners.contains(artifact.getListener()) || !artifact.getListener().canHandle(jar)) {
                        deleted.add(artifact);
                    }
                    // The listener is still ok
                    else {
                        deleteTransformedFile(artifact);
                        artifact.setJaredDirectory(jar);
                        artifact.setJaredUrl(jaredUrl);
                        if (transformArtifact(artifact)) {
                            modified.add(artifact);
                        } else {
                            deleteJaredDirectory(artifact);
                            deleted.add(artifact);
                        }
                    }
                }
                // File has been added
                else {
                    // Find the listener
                    ArtifactListener listener = findListener(jar, listeners);
                    // If no listener can handle this artifact, we need to defer the
                    // processing for this artifact until one is found
                    if (listener == null) {
                        synchronized (processingFailures) {
                            processingFailures.add(file);
View Full Code Here

        }
    }

    public Object addingService(ServiceReference serviceReference)
    {
        ArtifactListener listener = (ArtifactListener) context.getService(serviceReference);
        addListener(serviceReference, listener);
        return listener;
    }
View Full Code Here

TOP

Related Classes of org.apache.felix.fileinstall.ArtifactListener

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.