Package org.apache.sling.ide.osgi

Examples of org.apache.sling.ide.osgi.OsgiClient


                monitor.worked(1); // 3/5 done
               
                RepositoryInfo repositoryInfo;
                try {
                    repositoryInfo = ServerUtil.getRepositoryInfo(getServer(), monitor);
                    OsgiClient client = Activator.getDefault().getOsgiClientFactory().createOsgiClient(repositoryInfo);
                    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


    final IProject project = module[0].getProject();
        boolean installLocally = getServer().getAttribute(ISlingLaunchpadServer.PROP_INSTALL_LOCALLY, true);
    monitor.beginTask("deploying via local install", 5);

        try {
            OsgiClient osgiClient = Activator.getDefault().getOsgiClientFactory()
                    .createOsgiClient(ServerUtil.getRepositoryInfo(getServer(), monitor));

            Version supportBundleVersion = osgiClient
                    .getBundleVersion(EmbeddedArtifactLocator.SUPPORT_BUNDLE_SYMBOLIC_NAME);
            monitor.worked(1);
            if (supportBundleVersion == null) {
                throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID,
                        "The support bundle was not found, please install it via the server properties page."));
            }

            IJavaProject javaProject = ProjectHelper.asJavaProject(project);

            IFolder outputFolder = (IFolder) project.getWorkspace().getRoot().findMember(javaProject.getOutputLocation());
            IPath outputLocation = outputFolder.getLocation();
            //ensure the MANIFEST.MF exists - if it doesn't then let the publish fail with a warn (instead of an error)
            IResource manifest = outputFolder.findMember("META-INF/MANIFEST.MF");
            if (manifest==null) {
                Activator.getDefault().getPluginLogger().warn("Project "+project+" does not have a META-INF/MANIFEST.MF (yet) - not publishing this time");
                Activator.getDefault().issueConsoleLog("InstallBundle", outputFolder.getLocation().toOSString(), "Project "+project+" does not have a META-INF/MANIFEST.MF (yet) - not publishing this time");
                monitor.done();
                setModulePublishState(module, IServer.PUBLISH_STATE_FULL);
                return;
            }
           
            monitor.worked(1);

            //TODO SLING-3767:
            //osgiClient must have a timeout!!!
            if ( installLocally ) {
                osgiClient.installLocalBundle(outputLocation.toOSString());
                monitor.worked(3);
            } else {

                JarBuilder builder = new JarBuilder();
                InputStream bundle = builder.buildJar(outputFolder);
                monitor.worked(1);
               
                osgiClient.installLocalBundle(bundle, outputFolder.getLocation().toOSString());
                monitor.worked(2);
            }

            setModulePublishState(module, IServer.PUBLISH_STATE_NONE);
View Full Code Here

        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

                            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.osgi.OsgiClient

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.