Package org.apache.sling.ide.artifacts

Examples of org.apache.sling.ide.artifacts.EmbeddedArtifact


        String extension = "jar";

        URL jarUrl = loadResource(bundleContext, ARTIFACTS_LOCATION + "/sling-tooling-support-install/" + artifactId
                + "." + extension);

        return new EmbeddedArtifact(artifactId + "-" + version + "." + extension, version, jarUrl);
    }
View Full Code Here


       
        EmbeddedArchetypeInstaller archetypeInstaller = new EmbeddedArchetypeInstaller(archetypeGroupId,
                archetypeArtifactId, archetypeVersion);

        EmbeddedArtifact[] archetypeArtifacts = new EmbeddedArtifact[] {
                new EmbeddedArtifact("jar", archetypeVersion, getClass().getClassLoader().getResource(
                        "META-INF/MANIFEST.MF")),
                new EmbeddedArtifact("pom", archetypeVersion, getClass().getClassLoader().getResource(
                        "META-INF/MANIFEST.MF"))
        };

        archetypeInstaller.addResource("pom", archetypeArtifacts[0].openInputStream());
        archetypeInstaller.addResource("jar", archetypeArtifacts[1].openInputStream());
View Full Code Here

                    throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
                            "Failed reading the tooling support bundle version", e));
                }
                finalVersion = installedVersion;
                EmbeddedArtifactLocator artifactsLocator = Activator.getDefault().getArtifactLocator();
                EmbeddedArtifact toolingSupportBundle = artifactsLocator.loadToolingSupportBundle();
                Version ourVersion = new Version(toolingSupportBundle.getVersion());

                if (installedVersion == null || ourVersion.compareTo(installedVersion) > 0) {
          // then auto-install it if possible
          try {

                        InputStream contents = null;
                        try {
                            contents = toolingSupportBundle.openInputStream();
                            newOsgiClient().installBundle(contents, toolingSupportBundle.getName());
                        } finally {
                            IOUtils.closeQuietly(contents);
                        }
                        finalVersion = ourVersion;
          } catch (IOException e) {
View Full Code Here

    @Override
    protected void before() throws Throwable {

        EmbeddedArtifactLocator locator = Activator.getDefault().getArtifactLocator();
        EmbeddedArtifact toolingBundle = locator.loadToolingSupportBundle();

        OsgiClientFactory clientFactory = Activator.getDefault().getOsgiClientFactory();
        OsgiClient osgiClient = clientFactory.createOsgiClient(new RepositoryInfo(config.getUsername(), config
                .getPassword(), config.getUrl()));
        osgiClient.installBundle(toolingBundle.openInputStream(), toolingBundle.getName());
    }
View Full Code Here

                    EmbeddedArtifactLocator artifactLocator = Activator.getDefault().getArtifactLocator();
                    Version remoteVersion = client.getBundleVersion(EmbeddedArtifactLocator.SUPPORT_BUNDLE_SYMBOLIC_NAME);
                   
                    monitor.worked(1); // 4/5 done
                   
                    final EmbeddedArtifact supportBundle = artifactLocator.loadToolingSupportBundle();

                    final Version embeddedVersion = new Version(supportBundle.getVersion());
                   
                    ISlingLaunchpadServer launchpadServer = (ISlingLaunchpadServer) getServer().loadAdapter(SlingLaunchpadServer.class,
                            monitor);
                    if (remoteVersion == null || remoteVersion.compareTo(embeddedVersion) < 0) {
                        InputStream contents = null;
                        try {
                            contents = supportBundle.openInputStream();
                            client.installBundle(contents, supportBundle.getName());
                        } finally {
                            IOUtils.closeQuietly(contents);
                        }
                        remoteVersion = embeddedVersion;
View Full Code Here

        quickLocalInstallButton.addSelectionListener(listener);
        bundleLocalInstallButton.addSelectionListener(listener);

        Version serverVersion = launchpadServer.getBundleVersion(EmbeddedArtifactLocator.SUPPORT_BUNDLE_SYMBOLIC_NAME);
        final EmbeddedArtifact supportBundle = artifactLocator.loadToolingSupportBundle();

        final Version embeddedVersion = new Version(supportBundle.getVersion());

        updateActionArea(serverVersion, embeddedVersion);

        installOrUpdateSupportBundleLink.addHyperlinkListener(new HyperlinkAdapter() {

            @Override
            public void linkActivated(HyperlinkEvent e) {

                ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
                dialog.setCancelable(true);
                try {
                    dialog.run(true, false, new IRunnableWithProgress() {

                        @Override
                        public void run(IProgressMonitor monitor) throws InvocationTargetException,
                                InterruptedException {
                            final Version remoteVersion;
                            monitor.beginTask("Installing support bundle", 3);
                            // double-check, just in case
                            monitor.setTaskName("Getting remote bundle version");

                            Version deployedVersion;
                            final String message;
                            try {
                                RepositoryInfo repositoryInfo = ServerUtil.getRepositoryInfo(server.getOriginal(),
                                        monitor);
                                OsgiClient client = osgiClientFactory.createOsgiClient(repositoryInfo);
                                remoteVersion = client
                                        .getBundleVersion(EmbeddedArtifactLocator.SUPPORT_BUNDLE_SYMBOLIC_NAME);
                                deployedVersion = remoteVersion;

                                monitor.worked(1);

                                if (remoteVersion != null && remoteVersion.compareTo(embeddedVersion) >= 0) {
                                    // version already up-to-date, due to bundle version
                                    // changing between startup check and now
                                    message = "Bundle is already installed and up to date";
                                } else {
                                    monitor.setTaskName("Installing bundle");
                                    InputStream contents = null;
                                    try {
                                        contents = supportBundle.openInputStream();
                                        client.installBundle(contents, supportBundle.getName());
                                    } finally {
                                        IOUtils.closeQuietly(contents);
                                    }
                                    deployedVersion = embeddedVersion;
                                    message = "Bundle version " + embeddedVersion + " installed";
View Full Code Here

TOP

Related Classes of org.apache.sling.ide.artifacts.EmbeddedArtifact

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.