You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by bj...@apache.org on 2008/12/05 22:30:39 UTC

svn commit: r723875 [3/4] - in /geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins: org.apache.geronimo.jee.v21.jaxbmodel/META-INF/ org.apache.geronimo.jee.v21.jaxbmodel/src/main/java/org/apache/geronimo/jee/plugin/ org.apache.geronimo.st.core/src...

Added: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/GeronimoServerPluginManager.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/GeronimoServerPluginManager.java?rev=723875&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/GeronimoServerPluginManager.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/GeronimoServerPluginManager.java Fri Dec  5 13:30:38 2008
@@ -0,0 +1,895 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core.operations;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import javax.management.MBeanServerConnection;
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.deployment.plugin.jmx.RemoteDeploymentManager;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.ConfigurationInfo;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Dependency;
+import org.apache.geronimo.kernel.repository.ImportType;
+import org.apache.geronimo.kernel.repository.Version;
+import org.apache.geronimo.st.core.CommonMessages;
+import org.apache.geronimo.st.core.GeronimoConnectionFactory;
+import org.apache.geronimo.st.core.GeronimoRuntimeDelegate;
+import org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate;
+import org.apache.geronimo.st.core.jaxb.JAXBUtils;
+import org.apache.geronimo.st.v21.core.internal.Trace;
+import org.apache.geronimo.system.jmx.KernelDelegate;
+import org.apache.geronimo.system.plugin.SourceRepository;
+import org.apache.geronimo.system.plugin.SourceRepositoryFactory;
+import org.apache.geronimo.system.plugin.model.ArtifactType;
+import org.apache.geronimo.system.plugin.model.DependencyType;
+import org.apache.geronimo.system.plugin.model.ObjectFactory;
+import org.apache.geronimo.system.plugin.model.PluginArtifactType;
+import org.apache.geronimo.system.plugin.model.PluginListType;
+import org.apache.geronimo.system.plugin.model.PluginType;
+import org.apache.geronimo.system.plugin.model.PrerequisiteType;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.wst.server.core.IServer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GeronimoServerPluginManager {
+
+    private IServer server;
+    private RemoteDeploymentManager remoteDM;
+    private PluginListType data;
+    private List<String> pluginList;
+    private Kernel kernel;
+    
+    public GeronimoServerPluginManager () {
+        kernel = null;
+        Trace.tracePoint("Constructor", "GeronimoServerPluginManager");
+    }
+    
+    public boolean serverChanged (Object aServer, String serverPrefix) {
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.serverChanged", aServer, serverPrefix);
+        server = (IServer)aServer;
+
+        boolean enabled = server != null && 
+                server.getServerType().getId().startsWith(serverPrefix) &&
+                server.getServerState() == IServer.STATE_STARTED;
+
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.serverChanged", enabled);
+        return enabled;
+    }
+
+    // mimics org.apache.geronimo.console.car.AssemblyListHandler.renderView
+    public List<String> getPluginList () {
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.getPluginList");
+
+        String name;
+        boolean added;
+        try {
+            GeronimoConnectionFactory gcFactory = GeronimoConnectionFactory.getInstance();
+            remoteDM = (RemoteDeploymentManager)gcFactory.getDeploymentManager(server);
+            data = remoteDM.createPluginListForRepositories(null);
+            List<PluginType> aList = data.getPlugin();
+            pluginList = new ArrayList<String>(aList.size());
+            for (int i = 0; i < aList.size(); i++) {
+                name = aList.get(i).getName();
+                added = false;
+                for (int j = 0; j < pluginList.size() && added == false; j++) {
+                    if (name.compareTo(pluginList.get(j)) < 0) {
+                        pluginList.add(j, name);
+                        added = true;
+                    }
+                }
+                if (added == false) {
+                    pluginList.add(name);
+                }
+            }
+        } catch (Throwable e) {
+            e.printStackTrace();
+        }
+
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.getPluginList", pluginList);
+        return pluginList;
+    }
+
+    // mimics org.apache.geronimo.console.car.AssemblyViewHandler.actionAfterView
+    public void assembleServer (String group, String artifact, String version,
+                        String format, String relativeServerPath, int[] selected) {
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.assembleServer",
+                group, artifact, version, format);
+
+        PluginListType selectedPlugins = new PluginListType();
+        String name;
+        boolean found;
+        
+        for (int i = 0; i < selected.length; i++) {
+            name = pluginList.get(selected[i]);
+            found = false;
+            for (int j = 0 ; j < data.getPlugin().size() && found == false; j++) {
+                if (name.equals(data.getPlugin().get(j).getName())) {
+                    selectedPlugins.getPlugin().add(data.getPlugin().get(j));
+                    found = true;
+                }
+            }
+        }
+        
+        try {
+            remoteDM.installPluginList("repository", relativeServerPath, selectedPlugins);
+            remoteDM.archive(relativeServerPath, "var/temp", new Artifact(group, artifact, (String)version, format));
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.assembleServer");
+    }
+
+    // mimics org.apache.geronimo.console.util.KernelManagementHelper.getConfigurations()
+    public List<String> getConfigurationList () {
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.getConfigurationList");
+
+        ConfigurationManager mgr = getConfigurationManager();
+        List<AbstractName> stores = mgr.listStores();
+        List<String> results = new ArrayList<String>();
+        for (AbstractName storeName : stores) {
+            try {
+                List<ConfigurationInfo> infos = mgr.listConfigurations(storeName);
+                for (ConfigurationInfo info : infos) {
+                    results.add(info.getConfigID().toString());
+                }
+            } catch (Exception e) {
+                throw new RuntimeException(CommonMessages.badConfigId, e);
+            }
+        }
+        Collections.sort(results);
+
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.getConfigurationList", results);
+        return results;
+    }
+
+    public PluginType getPluginMetadata (String configId) {
+        Artifact artifact = Artifact.create(configId);
+        File dir = new File (addFilename(getArtifactLocation(artifact), artifact));
+        PluginType metadata = extractPluginMetadata (dir);
+        if (metadata == null) {
+            metadata = createDefaultMetadata (artifact);
+        }
+        return metadata;
+    }
+    
+    // mimics org.apache.geronimo.system.plugin.PluginInstallerGBean.updatePluginMetadata
+    public void savePluginXML (String configId, PluginType metadata) {
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.savePluginXML", configId, metadata);
+
+        Artifact artifact = Artifact.create(configId);
+        File dir = new File (getArtifactLocation(artifact));
+        
+        if (!dir.isDirectory()) { // must be a packed (JAR-formatted) plugin
+            try {
+                File temp = new File(dir.getParentFile(), dir.getName() + ".temp");
+                JarFile input = new JarFile(dir);
+                Manifest manifest = input.getManifest();
+                JarOutputStream out = manifest == null ? new JarOutputStream(
+                        new BufferedOutputStream(new FileOutputStream(temp)))
+                        : new JarOutputStream(new BufferedOutputStream(new FileOutputStream(temp)), manifest);
+                Enumeration en = input.entries();
+                byte[] buf = new byte[4096];
+                int count;
+                while (en.hasMoreElements()) {
+                    JarEntry entry = (JarEntry) en.nextElement();
+                    if (entry.getName().equals("META-INF/geronimo-plugin.xml")) {
+                        entry = new JarEntry(entry.getName());
+                        out.putNextEntry(entry);
+                        writePluginMetadata(metadata, out);
+                    } else if (entry.getName().equals("META-INF/MANIFEST.MF")) {
+                        // do nothing, already passed in a manifest
+                    } else {
+                        out.putNextEntry(entry);
+                        InputStream in = input.getInputStream(entry);
+                        while ((count = in.read(buf)) > -1) {
+                            out.write(buf, 0, count);
+                        }
+                        in.close();
+                        out.closeEntry();
+                    }
+                }
+                out.flush();
+                out.close();
+                input.close();
+                if (!dir.delete()) {
+                    String message = CommonMessages.bind(CommonMessages.errorDeletePlugin, dir.getAbsolutePath());
+                    Trace.tracePoint("Throw", "GeronimoServerPluginManager.savePluginXML", message);
+                    throw new Exception(message);
+                }
+                if (!temp.renameTo(dir)) {
+                    String message = CommonMessages.bind(CommonMessages.errorMovePlugin, temp.getAbsolutePath(), dir.getAbsolutePath());
+                    Trace.tracePoint("Throw", "GeronimoServerPluginManager.savePluginXML", message);
+                    throw new Exception(message);
+                }
+            } catch (Exception e) {
+                throw new RuntimeException(CommonMessages.errorUpdateMetadata, e);
+            }
+        } else {
+            File meta = new File(addFilename(dir.getAbsolutePath(), artifact), "META-INF");
+            if (!meta.isDirectory() || !meta.canRead()) {
+                String message = CommonMessages.bind(CommonMessages.badPlugin, artifact);
+                Trace.tracePoint("Throw", "GeronimoServerPluginManager.savePluginXML", message);
+                throw new IllegalArgumentException(message);
+            }
+            File xml = new File(meta, "geronimo-plugin.xml");
+            FileOutputStream fos = null;
+            try {
+                if (!xml.isFile()) {
+                    if (!xml.createNewFile()) {
+                        String message = CommonMessages.bind(CommonMessages.errorCreateMetadata, artifact);
+                        Trace.tracePoint("Throw", "GeronimoServerPluginManager.savePluginXML", message);
+                        throw new RuntimeException(message);
+                    }
+                }
+                fos = new FileOutputStream(xml);
+                writePluginMetadata(metadata, fos);
+            } catch (Exception e) {
+                e.printStackTrace();
+            } finally {
+                if (fos != null) {
+                    try {
+                        fos.close();
+                    } catch (Exception ignored) {
+                        ignored.printStackTrace();
+                    }
+                }
+            }
+        }
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.savePluginXML");
+    }
+
+    // mimics org.apache.geronimo.system.configuration.RepositoryConfigurationStore.exportConfiguration
+    public void exportCAR (String localRepoDir, String configId) throws Exception {
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.exportCAR", localRepoDir, configId);
+
+        Artifact artifact = Artifact.create(configId);
+        String filename = createDirectoryStructure (localRepoDir, artifact);
+        filename = addFilename (filename, artifact);
+
+        ConfigurationManager mgr = getConfigurationManager();
+        FileOutputStream outputStream = new FileOutputStream(filename);
+        File serverArtifact = new File(getArtifactLocation (artifact));
+        ZipOutputStream out = new ZipOutputStream(outputStream);
+        byte[] buf = new byte[10240];
+        writeToZip(serverArtifact, out, "", buf);
+        out.closeEntry();
+        out.finish();
+        out.flush();
+
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.exportCAR");
+    }
+
+    public void updatePluginList (String localRepoDir, PluginType metadata) throws Exception {
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.updatePluginList", localRepoDir, metadata);
+
+        PluginListType pluginList = readPluginList(localRepoDir);
+        File listFile = new File (localRepoDir, "geronimo-plugins.xml");
+
+        // if this plugin exists, remove it from the list
+        PluginType plugin;
+        for (int i = 0; i < pluginList.getPlugin().size(); i++) {
+            plugin = pluginList.getPlugin().get(i);
+            if (metadata.getName().equals(plugin.getName()) &&
+                metadata.getCategory().equals(plugin.getCategory())) {
+                pluginList.getPlugin().remove(i);
+                break;
+            }
+        }
+
+        // add the current plugin to the list
+        pluginList.getPlugin().add(metadata);
+
+        // write the file
+        FileOutputStream fos = null;
+        try {
+            fos = new FileOutputStream(listFile);
+            writePluginList(pluginList, fos);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (fos != null) {
+                try {
+                    fos.close();
+                } catch (Exception ignored) {
+                    ignored.printStackTrace();
+                }
+            }
+        }
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.updatePluginList");
+    }
+
+    public PluginListType readPluginList (String localRepoDir) {
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.readPluginList", localRepoDir);
+
+        PluginListType pluginList = null;
+        File listFile = new File (localRepoDir, "geronimo-plugins.xml");
+        if (listFile.exists() && listFile.exists()) {
+            InputStream in = null;
+            try {
+                in = new FileInputStream(listFile);
+                pluginList = loadPluginList(in);
+            } catch (Exception e) {
+                e.printStackTrace();
+            } finally {
+                if (in != null) {
+                    try {
+                        in.close();
+                    } catch (Exception e) {}
+                }
+            }   
+        }
+        if (pluginList == null) {
+            ObjectFactory factory = new ObjectFactory();
+            pluginList = factory.createPluginListType();
+        }
+
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.readPluginList", pluginList);
+        return pluginList;
+    }
+    
+    // mimics org.apache.geronimo.system.plugin.GeronimoSourceRepository.extractPluginMetadata
+    private PluginType extractPluginMetadata (File dir) {
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.extractPluginMetadata", dir);
+
+        try {
+            if (dir.isDirectory()) {
+                File meta = new File(dir, "META-INF");
+                if (!meta.isDirectory() || !meta.canRead()) {
+                    return null;
+                }
+                File xml = new File(meta, "geronimo-plugin.xml");
+                if (!xml.isFile() || !xml.canRead() || xml.length() == 0) {
+                    return null;
+                }
+                InputStream in = new FileInputStream(xml);
+                try {
+                    return loadPluginMetadata(in);
+                } finally {
+                    in.close();
+                }
+            } else {
+                if (!dir.isFile() || !dir.canRead()) {
+                    throw new IllegalStateException(CommonMessages.bind(CommonMessages.errorReadConfig, dir.getAbsolutePath()));
+                }
+                JarFile jar = new JarFile(dir);
+                try {
+                    ZipEntry entry = jar.getEntry("META-INF/geronimo-plugin.xml");
+                    if (entry == null) {
+                        return null;
+                    }
+                    InputStream in = jar.getInputStream(entry);
+                    try {
+                        return loadPluginMetadata(in);
+                    } finally {
+                        in.close();
+                    }
+                } finally {
+                    jar.close();
+                }
+            }
+        } catch (Exception e) {
+            //ignore
+        }
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.extractPluginMetadata", dir);
+        return null;
+    }
+
+    // mimics org.apache.geronimo.system.plugin.PluginInstallerGBean.createDefaultMetadata
+    private PluginType createDefaultMetadata (Artifact moduleId) {
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.createDefaultMetadata", moduleId);
+
+        ConfigurationData data = null;
+        try {
+            data = this.loadConfiguration(moduleId);
+        }
+        catch (Exception e) {
+        }
+        
+        PluginType metadata = new PluginType();
+        PluginArtifactType instance = new PluginArtifactType();
+        metadata.getPluginArtifact().add(instance);
+        metadata.setName(toArtifactType(moduleId).getArtifactId());
+        instance.setModuleId(toArtifactType(moduleId));
+        metadata.setCategory("Unknown");
+        GeronimoRuntimeDelegate rd = (GeronimoRuntimeDelegate)server.getRuntime().getAdapter(GeronimoRuntimeDelegate.class);
+        if (rd == null)
+            rd = (GeronimoRuntimeDelegate) server.getRuntime().loadAdapter(GeronimoRuntimeDelegate.class, new NullProgressMonitor());
+        if (rd != null) {
+            instance.getGeronimoVersion().add(rd.detectVersion());
+        }
+        instance.getObsoletes().add(toArtifactType(new Artifact(moduleId.getGroupId(),
+                moduleId.getArtifactId(),
+                (Version) null,
+                moduleId.getType())));
+        List<DependencyType> deps = instance.getDependency();
+        addGeronimoDependencies(data, deps, true);
+
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.createDefaultMetadata", metadata);
+        return metadata;
+    }
+
+    // mimics org.apache.geronimo.system.configuration.RepositoryConfigurationStore.loadConfiguration
+    private ConfigurationData loadConfiguration (Artifact artifact) throws Exception {
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.loadConfiguration", artifact);
+
+        String temp = getArtifactLocation(artifact);
+        File location = new File (this.addFilename(temp, artifact));
+
+        ConfigurationData configurationData;
+        try {
+            if (location.isDirectory()) {
+                File serFile = new File(location, "META-INF");
+                serFile = new File(serFile, "config.ser");
+
+                if (!serFile.exists()) {
+                    throw new Exception(CommonMessages.bind(CommonMessages.errorNoSerFile, serFile));
+                } else if (!serFile.canRead()) {
+                    throw new Exception(CommonMessages.bind(CommonMessages.errorReadSerFile, serFile));
+                }
+
+                //ConfigurationStoreUtil.verifyChecksum(serFile);
+
+                InputStream in = new FileInputStream(serFile);
+                try {
+                    configurationData = ConfigurationUtil.readConfigurationData(in);
+                } finally {
+                    in.close();
+                }
+            } else {
+                JarFile jarFile = new JarFile(location);
+                InputStream in = null;
+                try {
+                    ZipEntry entry = jarFile.getEntry("META-INF/config.ser");
+                    in = jarFile.getInputStream(entry);
+                    configurationData = ConfigurationUtil.readConfigurationData(in);
+                } finally {
+                    in.close();
+                    jarFile.close();
+                }
+            }
+        } catch (ClassNotFoundException e) {
+            String message = CommonMessages.bind(CommonMessages.errorLoadClass, artifact);
+            Trace.tracePoint("Throw", "GeronimoServerPluginManager.loadConfiguration", message);
+            throw new Exception(message, e);
+        }
+
+        configurationData.setConfigurationDir(location);
+//        if (kernel != null) {
+//            configurationData.setNaming(kernel.getNaming());
+//        }
+
+
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.loadConfiguration", configurationData);
+        return configurationData;
+    }
+
+    public PluginListType loadPluginList (InputStream in) {
+        try {
+            JAXBElement pluginListElement = JAXBUtils.unmarshalPlugin(in);
+            org.apache.geronimo.jee.plugin.PluginListType pl = (org.apache.geronimo.jee.plugin.PluginListType)pluginListElement.getValue();
+            return PluginConverter.jeeToModelPluginListType(pl);
+        }
+        catch (Throwable e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    private void writePluginList (PluginListType pluginList, OutputStream out) {
+        try {
+            JAXBElement element = PluginConverter.pluginListTypeToJAXB(PluginConverter.modelToJeePluginListType (pluginList));
+            JAXBUtils.marshalPlugin(element, out);
+        }
+        catch (Throwable e) {
+            e.printStackTrace();
+        }
+    }
+    
+    //mimic org.apache.geronimo.system.plugin.PluginXmlUtil.loadPluginMetadata(in);
+    private PluginType loadPluginMetadata (InputStream in) {
+        try {
+            JAXBElement pluginElement = JAXBUtils.unmarshalPlugin(in);
+            org.apache.geronimo.jee.plugin.PluginType pt = (org.apache.geronimo.jee.plugin.PluginType)pluginElement.getValue();
+            return PluginConverter.jeeToModelPluginType(pt);
+        }
+        catch (Throwable e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    private void writePluginMetadata (PluginType metadata, OutputStream out) {
+        try {
+            JAXBElement element = PluginConverter.pluginTypeToJAXB(PluginConverter.modelToJeePluginType (metadata));
+            JAXBUtils.marshalPlugin(element, out);
+        }
+        catch (Throwable e) {
+            e.printStackTrace();
+        }
+    }
+
+    private String getArtifactLocation (Artifact artifact) {
+        String temp = server.getRuntime().getLocation().toOSString() + "/repository/";
+        temp += artifact.getGroupId().replaceAll("[.]", "/") + "/" + artifact.getArtifactId() + "/" + artifact.getVersion() + "/";
+        return temp;
+    }
+    
+    private String addFilename (String path, Artifact artifact) {
+        if (!path.endsWith("/") && !path.endsWith("\\")) {
+            path += "/";
+        }
+        return path + artifact.getArtifactId() + "-" + artifact.getVersion() + "." + artifact.getType();
+    }
+
+    private String createDirectoryStructure (String rootPath, Artifact artifact) {
+        String fileName = rootPath;
+        if (!fileName.endsWith("/") && !fileName.endsWith("\\")) {
+            fileName += "/";
+        }
+
+        fileName += artifact.getGroupId().replaceAll("[.]", "/") + "/" + artifact.getArtifactId() + "/" + artifact.getVersion() + "/";
+        File temp = new File (fileName);
+        if (!temp.exists()) {
+            temp.mkdirs();
+        }
+
+        return fileName;
+    }
+
+    private void writeToZip(File dir, ZipOutputStream out, String prefix, byte[] buf) throws Exception {
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.writeToZip", dir);
+
+        File[] all = dir.listFiles();
+        for (File file : all) {
+            if (file.isDirectory()) {
+                writeToZip(file, out, prefix + file.getName() + "/", buf);
+            } else {
+                ZipEntry entry = new ZipEntry(prefix + file.getName());
+                out.putNextEntry(entry);
+                writeToZipStream(file, out, buf);
+            }
+        }
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.writeToZip");
+    }
+
+    private void writeToZipStream(File file, OutputStream out, byte[] buf) throws Exception {
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.writeToZipStream", file);
+
+        FileInputStream in = new FileInputStream(file);
+        int count;
+        try {
+            while ((count = in.read(buf, 0, buf.length)) > -1) {
+                out.write(buf, 0, count);
+            }
+        } finally {
+            in.close();
+        }
+
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.writeToZipStream", file);
+    }
+    
+    private ConfigurationManager getConfigurationManager () {
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.getConfigurationManager");
+
+        if (kernel == null) {
+            try {
+                GeronimoServerBehaviourDelegate delegate = (GeronimoServerBehaviourDelegate) server
+                    .getAdapter(GeronimoServerBehaviourDelegate.class);
+                if (delegate != null) {
+                    MBeanServerConnection connection = delegate
+                        .getServerConnection();
+                    if (connection != null) {
+                        kernel = new KernelDelegate(connection);
+                    }
+                }
+            } catch (Exception e) {
+                Trace.trace(Trace.WARNING, "Kernel connection failed. "
+                    + e.getMessage());
+            }
+        }
+        if (kernel != null) {
+            Trace.tracePoint("Exit", "GeronimoServerPluginManager.getConfigurationManager");
+            return ConfigurationUtil.getConfigurationManager(kernel);
+        }
+
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.getConfigurationManager");
+        return null;
+    }
+    
+    public ArtifactType toArtifactType(String configId) {
+        return toArtifactType (Artifact.create(configId));
+    }
+    
+    public ArtifactType toArtifactType(Artifact id) {
+        ArtifactType artifact = new ArtifactType();
+        artifact.setGroupId(id.getGroupId());
+        artifact.setArtifactId(id.getArtifactId());
+        artifact.setVersion(id.getVersion() == null ? null : id.getVersion().toString());
+        artifact.setType(id.getType());
+        return artifact;
+    }
+    
+    public Artifact toArtifact(ArtifactType id) {
+        return new Artifact (id.getGroupId(), id.getArtifactId(), id.getVersion(), id.getType());
+    }
+    
+    public void addGeronimoDependencies(ConfigurationData data, List<DependencyType> deps, boolean includeVersion) {
+        processDependencyList(data.getEnvironment().getDependencies(), deps, includeVersion);
+        Map<String, ConfigurationData> children = data.getChildConfigurations();
+        for (ConfigurationData child : children.values()) {
+            processDependencyList(child.getEnvironment().getDependencies(), deps, includeVersion);
+        }
+    }
+
+    private void processDependencyList(List<Dependency> real, List<DependencyType> deps, boolean includeVersion) {
+        for (Dependency dep : real) {
+            DependencyType dependency = toDependencyType(dep, includeVersion);
+            if (!deps.contains(dependency)) {
+                deps.add(dependency);
+            }
+        }
+    }
+
+    public DependencyType toDependencyType(String configId) {
+        return toDependencyType(new Dependency(Artifact.create(configId), ImportType.ALL), true);
+    }
+    
+    public DependencyType toDependencyType(Dependency dep, boolean includeVersion) {
+        Artifact id = dep.getArtifact();
+        DependencyType dependency = new DependencyType();
+        dependency.setGroupId(id.getGroupId());
+        dependency.setArtifactId(id.getArtifactId());
+        if (includeVersion) {
+            dependency.setVersion(id.getVersion() == null ? null : id.getVersion().toString());
+        }
+        dependency.setType(id.getType());
+        return dependency;
+    }
+
+    // mimics org.apache.geronimo.system.plugin.PluginInstallerGbean.validatePlugin
+    public boolean validatePlugin (PluginType plugin) {
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.validatePlugin", plugin);
+
+        boolean valid = false;
+        String serverVersion = null;
+        GeronimoRuntimeDelegate rd = (GeronimoRuntimeDelegate)server.getRuntime().getAdapter(GeronimoRuntimeDelegate.class);
+        if (rd == null)
+            rd = (GeronimoRuntimeDelegate) server.getRuntime().loadAdapter(GeronimoRuntimeDelegate.class, new NullProgressMonitor());
+        if (rd != null) {
+            serverVersion = rd.detectVersion();
+        }
+
+        // check the Geronimo and JVM versions for validity
+        PluginArtifactType metadata = plugin.getPluginArtifact().get(0);
+        if (metadata.getGeronimoVersion().size() > 0) {
+            for (String gerVersion : metadata.getGeronimoVersion()) {
+                valid = gerVersion.equals(serverVersion);
+                if (valid) {
+                    break;
+                }
+            }
+        }
+        if (valid == false) {
+            Trace.tracePoint("Exit", "GeronimoServerPluginManager.validatePlugin", valid);
+            return valid;
+        }
+        valid = false;
+        String jvmSystem = System.getProperty("java.version");
+        if (metadata.getJvmVersion().size() > 0) {
+            for (String jvmVersion : metadata.getJvmVersion()) {
+                valid = jvmSystem.startsWith(jvmVersion);
+                if (valid) {
+                    break;
+                }
+            }
+        }
+        if (valid == false) {
+            Trace.tracePoint("Exit", "GeronimoServerPluginManager.validatePlugin", valid);
+            return valid;
+        }
+
+        // check that it's not already installed
+        if (metadata.getModuleId() != null) {
+            Artifact artifact = toArtifact (metadata.getModuleId());
+            if (getConfigurationManager().isInstalled(artifact)) {
+                valid = false;
+                for (ArtifactType obsolete : metadata.getObsoletes()) {
+                    Artifact test = toArtifact(obsolete);
+                    if (test.matches(artifact)) {
+                        valid = true;
+                        break;
+                    }
+                }
+            }
+        }
+
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.validatePlugin", valid);
+        return valid;
+    }
+
+    // mimics org.apache.geronimo.system.plugin.PluginInstallerGbean.install
+    public void installPlugins (String localRepoDir, List<PluginType> pluginList) {
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.installPlugins", localRepoDir, pluginList);
+
+        //List<Artifact> downloadedArtifacts = new ArrayList<Artifact>();
+        try {
+            ConfigurationManager configManager = getConfigurationManager();
+            Map<Artifact, PluginType> metaMap = new HashMap<Artifact, PluginType>();
+            // Step 1: validate everything
+            List<PluginType> toInstall = new ArrayList<PluginType>();
+            for (PluginType metadata : pluginList) {
+                try {
+                    validatePlugin(metadata);
+                    verifyPrerequisites(metadata);
+
+                    PluginArtifactType instance = metadata.getPluginArtifact().get(0);
+
+                    if (instance.getModuleId() != null) {
+                        metaMap.put(toArtifact(instance.getModuleId()), metadata);
+                    }
+                    toInstall.add(metadata);
+                } catch (Exception e) {
+                }
+            }
+
+            // Step 2: everything is valid, do the installation
+            for (PluginType metadata : toInstall) {
+                // 2. Unload obsoleted configurations
+                PluginArtifactType instance = metadata.getPluginArtifact().get(0);
+                List<Artifact> obsoletes = new ArrayList<Artifact>();
+                for (ArtifactType obs : instance.getObsoletes()) {
+                    Artifact obsolete = toArtifact(obs);
+                    if (configManager.isLoaded(obsolete)) {
+                        if (configManager.isRunning(obsolete)) {
+                            configManager.stopConfiguration(obsolete);
+                        }
+                        configManager.unloadConfiguration(obsolete);
+                        obsoletes.add(obsolete);
+                    }
+                }
+
+                // 4. Uninstall obsolete configurations
+                for (Artifact artifact : obsoletes) {
+                    configManager.uninstallConfiguration(artifact);
+                }
+            }
+
+            // Step 3: Start anything that's marked accordingly
+            if (configManager.isOnline()) {
+                for (int i = 0; i < toInstall.size(); i++) {
+                    Artifact artifact = toArtifact(toInstall.get(i).getPluginArtifact().get(0).getModuleId());
+                    //for (Artifact artifact : artifacts) {
+                        if (!configManager.isRunning(artifact)) {
+                            if (!configManager.isLoaded(artifact)) {
+                                configManager.loadConfiguration(artifact);
+                            }
+                            configManager.startConfiguration(artifact);
+                        }
+                    //}
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.installPlugins");
+    }
+
+    // mimics org.apache.geronimo.system.plugin.PluginInstallerGbean.verifyPrerequisistes
+    private void verifyPrerequisites(PluginType plugin) throws Exception {
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.verifyPrerequisites", plugin);
+        List<Dependency> missingPrereqs = getMissingPrerequisites(plugin);
+        if (!missingPrereqs.isEmpty()) {
+            PluginArtifactType metadata = plugin.getPluginArtifact().get(0);
+            Artifact moduleId = toArtifact(metadata.getModuleId());
+            StringBuffer buf = new StringBuffer();
+            buf.append(moduleId.toString()).append(CommonMessages.requires);
+            Iterator<Dependency> iter = missingPrereqs.iterator();
+            while (iter.hasNext()) {
+                buf.append(iter.next().getArtifact().toString());
+                if (iter.hasNext()) {
+                    buf.append(", ");
+                }
+            }
+            buf.append(CommonMessages.installed);
+            Trace.tracePoint("Throw", "GeronimoServerPluginManager.verifyPrerequisites", buf.toString());
+            throw new Exception(buf.toString());
+        }
+
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.verifyPrerequisites");
+    }
+
+    // mimics org.apache.geronimo.system.plugin.PluginInstallerGbean.getMissingPrerequisistes
+    private List<Dependency> getMissingPrerequisites(PluginType plugin) {
+        Trace.tracePoint("Entry", "GeronimoServerPluginManager.getMissingPrerequisites", plugin);
+
+        if (plugin.getPluginArtifact().size() != 1) {
+            String message = CommonMessages.bind(CommonMessages.configSizeMismatch, plugin.getPluginArtifact().size());
+            Trace.tracePoint("Throw", "GeronimoServerPluginManager.getMissingPrerequisites", message);
+            throw new IllegalArgumentException(message);
+        }
+
+        PluginArtifactType metadata = plugin.getPluginArtifact().get(0);
+        List<PrerequisiteType> prereqs = metadata.getPrerequisite();
+
+        ArrayList<Dependency> missingPrereqs = new ArrayList<Dependency>();
+        for (PrerequisiteType prereq : prereqs) {
+            Artifact artifact = toArtifact(prereq.getId());
+            try {
+                if (getConfigurationManager().getArtifactResolver().queryArtifacts(artifact).length == 0) {
+                    missingPrereqs.add(new Dependency(artifact, ImportType.ALL));
+                }
+            } catch (Exception e) {
+                Trace.tracePoint("Throw", "GeronimoServerPluginManager.getMissingPrerequisites", CommonMessages.noDefaultServer);
+                throw new RuntimeException(CommonMessages.noDefaultServer);
+            }
+        }
+
+        Trace.tracePoint("Exit", "GeronimoServerPluginManager.getMissingPrerequisites", missingPrereqs);
+        return missingPrereqs;
+    }
+
+    // mimics org.apache.geronimo.system.plugin.PluginInstallerGbean.getRepos
+    private List<SourceRepository> getRepos(PluginListType pluginsToInstall, SourceRepository defaultRepository, boolean restrictToDefaultRepository, PluginArtifactType instance) {
+        List<SourceRepository> repos = new ArrayList<SourceRepository>();
+        if (defaultRepository != null) {
+            repos.add(defaultRepository);
+        }
+        if (!restrictToDefaultRepository) {
+            List<String> repoLocations;
+            if (!instance.getSourceRepository().isEmpty()) {
+                repoLocations = instance.getSourceRepository();
+            } else {
+                repoLocations = pluginsToInstall.getDefaultRepository();
+            }
+            for (String repoLocation : repoLocations) {
+                SourceRepository repo = SourceRepositoryFactory.getSourceRepository(repoLocation);
+                repos.add(repo);
+            }
+        }
+        return repos;
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/GeronimoServerPluginManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/GeronimoServerPluginManager.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/GeronimoServerPluginManager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/PluginConverter.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/PluginConverter.java?rev=723875&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/PluginConverter.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/PluginConverter.java Fri Dec  5 13:30:38 2008
@@ -0,0 +1,427 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.core.operations;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.system.plugin.model.ArtifactType;
+import org.apache.geronimo.system.plugin.model.AttributeType;
+import org.apache.geronimo.system.plugin.model.ConfigXmlContentType;
+import org.apache.geronimo.system.plugin.model.CopyFileType;
+import org.apache.geronimo.system.plugin.model.DependencyType;
+import org.apache.geronimo.system.plugin.model.GbeanType;
+import org.apache.geronimo.system.plugin.model.HashType;
+import org.apache.geronimo.system.plugin.model.ObjectFactory;
+import org.apache.geronimo.system.plugin.model.LicenseType;
+import org.apache.geronimo.system.plugin.model.PluginListType;
+import org.apache.geronimo.system.plugin.model.PluginType;
+import org.apache.geronimo.system.plugin.model.PluginArtifactType;
+import org.apache.geronimo.system.plugin.model.PrerequisiteType;
+import org.apache.geronimo.system.plugin.model.PropertyType;
+import org.apache.geronimo.system.plugin.model.ReferenceType;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PluginConverter {
+
+    static ObjectFactory modelFactory;
+    static org.apache.geronimo.jee.plugin.ObjectFactory jeeFactory;
+    
+    public static PluginListType jeeToModelPluginListType (org.apache.geronimo.jee.plugin.PluginListType oldPluginList) {
+        modelFactory = new ObjectFactory();
+        if (oldPluginList == null) return null;
+        PluginListType newPluginList = modelFactory.createPluginListType();
+        for (int i = 0; i < oldPluginList.getPlugin().size(); i++) {
+            newPluginList.getPlugin().add(jeeToModelPluginType(oldPluginList.getPlugin().get(i)));
+        }        
+        newPluginList.getDefaultRepository().addAll(oldPluginList.getDefaultRepository());
+        return newPluginList;
+    }
+    
+    public static PluginType jeeToModelPluginType (org.apache.geronimo.jee.plugin.PluginType oldPlugin) {
+        modelFactory = new ObjectFactory();
+        if (oldPlugin == null) return null;
+        PluginType newPlugin = modelFactory.createPluginType();
+        newPlugin.setName(oldPlugin.getName());
+        newPlugin.setCategory(oldPlugin.getCategory());
+        newPlugin.setDescription(oldPlugin.getDescription());
+        newPlugin.setUrl(oldPlugin.getUrl());
+        newPlugin.setAuthor(oldPlugin.getAuthor());
+        for (int i = 0; i < oldPlugin.getLicense().size(); i++) {
+            newPlugin.getLicense().add(jeeToModelLicenseType(oldPlugin.getLicense().get(i)));
+        }
+        for (int i = 0; i < oldPlugin.getPluginArtifact().size(); i++) {
+            newPlugin.getPluginArtifact().add(jeeToModelPluginArtifactType(oldPlugin.getPluginArtifact().get(i)));
+        }
+        return newPlugin;
+    }
+
+    private static PluginArtifactType jeeToModelPluginArtifactType (org.apache.geronimo.jee.plugin.PluginArtifactType oldPluginArtifact) {
+        if (oldPluginArtifact==null) return null;
+        PluginArtifactType newPluginArtifact = modelFactory.createPluginArtifactType();
+        newPluginArtifact.setModuleId(jeeToModelArtifactType(oldPluginArtifact.getModuleId()));
+        newPluginArtifact.setHash(jeeToModelHashType(oldPluginArtifact.getHash()));
+        newPluginArtifact.getGeronimoVersion().addAll(oldPluginArtifact.getGeronimoVersion());
+        newPluginArtifact.getJvmVersion().addAll(oldPluginArtifact.getJvmVersion());
+        for (int i = 0; i < oldPluginArtifact.getPrerequisite().size(); i++) {
+            newPluginArtifact.getPrerequisite().add(jeeToModelPrerequisiteType(oldPluginArtifact.getPrerequisite().get(i)));
+        }
+        for (int i = 0; i < oldPluginArtifact.getDependency().size(); i++) {
+            newPluginArtifact.getDependency().add(jeeToModelDependencyType(oldPluginArtifact.getDependency().get(i)));
+        }
+        for (int i = 0; i < oldPluginArtifact.getObsoletes().size(); i++) {
+            newPluginArtifact.getObsoletes().add(jeeToModelArtifactType(oldPluginArtifact.getObsoletes().get(i)));
+        }
+        newPluginArtifact.getSourceRepository().addAll(oldPluginArtifact.getSourceRepository());
+        for (int i = 0; i < oldPluginArtifact.getCopyFile().size(); i++) {
+            newPluginArtifact.getCopyFile().add(jeeToModelCopyFileType(oldPluginArtifact.getCopyFile().get(i)));
+        }
+        for (int i = 0; i < oldPluginArtifact.getConfigXmlContent().size(); i++) {
+            newPluginArtifact.getConfigXmlContent().add(jeeToModelConfigXmlContentType(oldPluginArtifact.getConfigXmlContent().get(i)));
+        }
+        for (int i = 0; i < oldPluginArtifact.getArtifactAlias().size(); i++) {
+            newPluginArtifact.getArtifactAlias().add(jeeToModelPropertyType(oldPluginArtifact.getArtifactAlias().get(i)));
+        }
+        for (int i = 0; i < oldPluginArtifact.getConfigSubstitution().size(); i++) {
+            newPluginArtifact.getConfigSubstitution().add(jeeToModelPropertyType(oldPluginArtifact.getConfigSubstitution().get(i)));
+        }
+        return newPluginArtifact;
+    }
+
+    private static ConfigXmlContentType jeeToModelConfigXmlContentType (org.apache.geronimo.jee.plugin.ConfigXmlContentType oldContent) {
+        if (oldContent == null) return null;
+        ConfigXmlContentType newContent = modelFactory.createConfigXmlContentType();
+        newContent.setComment(oldContent.getComment());
+        for (int i = 0; i < oldContent.getGbean().size(); i++) {
+            newContent.getGbean().add(jeeToModelGbeanType(oldContent.getGbean().get(i)));
+        }
+        newContent.setCondition(oldContent.getCondition());
+        newContent.setLoad(oldContent.isLoad());
+        newContent.setServer(oldContent.getServer());
+        return newContent;
+    }
+
+    private static GbeanType jeeToModelGbeanType (org.apache.geronimo.jee.plugin.GbeanType oldGbean) {
+        if (oldGbean == null) return null;
+        GbeanType newGbean = modelFactory.createGbeanType();
+        newGbean.setComment(oldGbean.getComment());
+        for (int i = 0; i < oldGbean.getAttributeOrReference().size(); i++) {
+            if (org.apache.geronimo.jee.plugin.AttributeType.class.isInstance(oldGbean.getAttributeOrReference().get(i))) {
+                newGbean.getAttributeOrReference().add(jeeToModelAttributeType((org.apache.geronimo.jee.plugin.AttributeType)oldGbean.getAttributeOrReference().get(i)));
+            } else if (org.apache.geronimo.jee.plugin.ReferenceType.class.isInstance(oldGbean.getAttributeOrReference().get(i))) {
+                newGbean.getAttributeOrReference().add(jeeToModelReferenceType((org.apache.geronimo.jee.plugin.ReferenceType)oldGbean.getAttributeOrReference().get(i)));
+            }
+        }
+        newGbean.setGbeanInfo(oldGbean.getGbeanInfo());
+        newGbean.setLoad(oldGbean.isLoad());
+        newGbean.setName(oldGbean.getName());
+        return newGbean;
+    }
+    
+    private static PrerequisiteType jeeToModelPrerequisiteType (org.apache.geronimo.jee.plugin.PrerequisiteType oldPrerequisite) {
+        if (oldPrerequisite == null) return null;
+        PrerequisiteType newPrerequisite = modelFactory.createPrerequisiteType();
+        newPrerequisite.setId(jeeToModelArtifactType(oldPrerequisite.getId()));
+        newPrerequisite.setResourceType(oldPrerequisite.getResourceType());
+        newPrerequisite.setDescription(oldPrerequisite.getDescription());
+        return newPrerequisite;
+    }
+
+    private static ArtifactType jeeToModelArtifactType (org.apache.geronimo.jee.plugin.ArtifactType oldArtifact) {
+        if (oldArtifact == null) return null;
+        ArtifactType newArtifact = modelFactory.createArtifactType();
+        newArtifact.setGroupId(oldArtifact.getGroupId());
+        newArtifact.setArtifactId(oldArtifact.getArtifactId());
+        newArtifact.setVersion(oldArtifact.getVersion());
+        newArtifact.setType(oldArtifact.getType());
+        return newArtifact;
+    }
+
+    private static DependencyType jeeToModelDependencyType (org.apache.geronimo.jee.plugin.DependencyType oldDependency) {
+        if (oldDependency == null) return null;
+        DependencyType newDependency = modelFactory.createDependencyType();
+        newDependency.setGroupId(oldDependency.getGroupId());
+        newDependency.setArtifactId(oldDependency.getArtifactId());
+        newDependency.setVersion(oldDependency.getVersion());
+        newDependency.setType(oldDependency.getType());
+        newDependency.setStart(oldDependency.isStart());
+        return newDependency;
+    }
+
+    private static ReferenceType jeeToModelReferenceType (org.apache.geronimo.jee.plugin.ReferenceType oldReference) {
+        if (oldReference == null) return null;
+        ReferenceType newReference = modelFactory.createReferenceType();
+        for (int i = 0; i < oldReference.getPattern().size(); i++) {
+            newReference.getPattern().add(jeeToModelReferencePatternType(oldReference.getPattern().get(i)));
+        }
+        newReference.setName(oldReference.getName());
+        return newReference;
+    }
+
+    private static ReferenceType.Pattern jeeToModelReferencePatternType (org.apache.geronimo.jee.plugin.ReferenceType.Pattern oldPattern) {
+        if (oldPattern == null) return null;
+        ReferenceType.Pattern newPattern = modelFactory.createReferenceTypePattern();
+        newPattern.setGroupId(oldPattern.getGroupId());
+        newPattern.setArtifactId(oldPattern.getArtifactId());
+        newPattern.setVersion(oldPattern.getVersion());
+        newPattern.setType(oldPattern.getType());
+        newPattern.setModule(oldPattern.getModule());
+        newPattern.setName(oldPattern.getName());
+        return newPattern;
+    }
+
+    private static AttributeType jeeToModelAttributeType (org.apache.geronimo.jee.plugin.AttributeType oldAttribute) {
+        if (oldAttribute == null) return null;
+        AttributeType newAttribute = modelFactory.createAttributeType();
+        newAttribute.getContent().addAll(oldAttribute.getContent());
+        newAttribute.setName(oldAttribute.getName());
+        newAttribute.setNull(oldAttribute.isNull());
+        newAttribute.setPropertyEditor(oldAttribute.getPropertyEditor());
+        return newAttribute;
+    }
+
+    private static CopyFileType jeeToModelCopyFileType (org.apache.geronimo.jee.plugin.CopyFileType oldCopyFile) {
+        if (oldCopyFile == null) return null;
+        CopyFileType newCopyFile = modelFactory.createCopyFileType();
+        newCopyFile.setValue(oldCopyFile.getValue());
+        newCopyFile.setDestDir(oldCopyFile.getDestDir());
+        newCopyFile.setRelativeTo(oldCopyFile.getRelativeTo());
+        return newCopyFile;
+    }
+
+    private static PropertyType jeeToModelPropertyType (org.apache.geronimo.jee.plugin.PropertyType oldProperty) {
+        if (oldProperty == null) return null;
+        PropertyType newProperty = modelFactory.createPropertyType();
+        newProperty.setValue(oldProperty.getValue());
+        newProperty.setKey(oldProperty.getKey());
+        newProperty.setServer(oldProperty.getServer());
+        return newProperty;
+    }
+
+    private static LicenseType jeeToModelLicenseType (org.apache.geronimo.jee.plugin.LicenseType oldLicense) {
+        if (oldLicense == null) return null;
+        LicenseType newLicense = modelFactory.createLicenseType();
+        newLicense.setValue(oldLicense.getValue());
+        newLicense.setOsiApproved(oldLicense.isOsiApproved());
+        return newLicense;
+    }
+
+    private static HashType jeeToModelHashType (org.apache.geronimo.jee.plugin.HashType oldHash) {
+        if (oldHash == null) return null;
+        HashType newHash = modelFactory.createHashType();
+        newHash.setValue(oldHash.getValue());
+        newHash.setType(oldHash.getType());
+        return newHash;
+    }
+
+    public static JAXBElement pluginTypeToJAXB (org.apache.geronimo.jee.plugin.PluginType plugin) {
+        return jeeFactory.createGeronimoPlugin(plugin);
+    }
+
+    public static JAXBElement pluginListTypeToJAXB (org.apache.geronimo.jee.plugin.PluginListType pluginList) {
+        return jeeFactory.createGeronimoPluginList(pluginList);
+    }
+    
+    public static org.apache.geronimo.jee.plugin.PluginListType modelToJeePluginListType (PluginListType oldPluginList) {
+        jeeFactory = new org.apache.geronimo.jee.plugin.ObjectFactory();
+        if (oldPluginList == null) return null;
+        org.apache.geronimo.jee.plugin.PluginListType newPluginList = jeeFactory.createPluginListType();
+        for (int i = 0; i < oldPluginList.getPlugin().size(); i++) {
+            newPluginList.getPlugin().add(modelToJeePluginType(oldPluginList.getPlugin().get(i)));
+        }        
+        newPluginList.getDefaultRepository().addAll(oldPluginList.getDefaultRepository());
+        return newPluginList;
+    }
+
+    public static org.apache.geronimo.jee.plugin.PluginType modelToJeePluginType (PluginType oldPlugin) {
+        jeeFactory = new org.apache.geronimo.jee.plugin.ObjectFactory();
+        if (oldPlugin == null) return null;
+        org.apache.geronimo.jee.plugin.PluginType newPlugin = jeeFactory.createPluginType();
+        newPlugin.setName(oldPlugin.getName());
+        newPlugin.setCategory(oldPlugin.getCategory());
+        newPlugin.setDescription(oldPlugin.getDescription());
+        newPlugin.setUrl(oldPlugin.getUrl());
+        newPlugin.setAuthor(oldPlugin.getAuthor());
+        for (int i = 0; i < oldPlugin.getLicense().size(); i++) {
+            newPlugin.getLicense().add(modelToJeeLicenseType(oldPlugin.getLicense().get(i)));
+        }
+        for (int i = 0; i < oldPlugin.getPluginArtifact().size(); i++) {
+            newPlugin.getPluginArtifact().add(modelToJeePluginArtifactType(oldPlugin.getPluginArtifact().get(i)));
+        }
+        return newPlugin;
+    }
+    
+    private static org.apache.geronimo.jee.plugin.PluginArtifactType modelToJeePluginArtifactType (PluginArtifactType oldPluginArtifact) {
+        if (oldPluginArtifact==null) return null;
+        org.apache.geronimo.jee.plugin.PluginArtifactType newPluginArtifact = jeeFactory.createPluginArtifactType();
+        newPluginArtifact.setModuleId(modelToJeeArtifactType(oldPluginArtifact.getModuleId()));
+        newPluginArtifact.setHash(modelToJeeHashType(oldPluginArtifact.getHash()));
+        newPluginArtifact.getGeronimoVersion().addAll(oldPluginArtifact.getGeronimoVersion());
+        newPluginArtifact.getJvmVersion().addAll(oldPluginArtifact.getJvmVersion());
+        for (int i = 0; i < oldPluginArtifact.getPrerequisite().size(); i++) {
+            newPluginArtifact.getPrerequisite().add(modelToJeePrerequisiteType(oldPluginArtifact.getPrerequisite().get(i)));
+        }
+        for (int i = 0; i < oldPluginArtifact.getDependency().size(); i++) {
+            newPluginArtifact.getDependency().add(modelToJeeDependencyType(oldPluginArtifact.getDependency().get(i)));
+        }
+        for (int i = 0; i < oldPluginArtifact.getObsoletes().size(); i++) {
+            newPluginArtifact.getObsoletes().add(modelToJeeArtifactType(oldPluginArtifact.getObsoletes().get(i)));
+        }
+        newPluginArtifact.getSourceRepository().addAll(oldPluginArtifact.getSourceRepository());
+        for (int i = 0; i < oldPluginArtifact.getCopyFile().size(); i++) {
+            newPluginArtifact.getCopyFile().add(modelToJeeCopyFileType(oldPluginArtifact.getCopyFile().get(i)));
+        }
+        for (int i = 0; i < oldPluginArtifact.getConfigXmlContent().size(); i++) {
+            newPluginArtifact.getConfigXmlContent().add(modelToJeeConfigXmlContentType(oldPluginArtifact.getConfigXmlContent().get(i)));
+        }
+        for (int i = 0; i < oldPluginArtifact.getArtifactAlias().size(); i++) {
+            newPluginArtifact.getArtifactAlias().add(modelToJeePropertyType(oldPluginArtifact.getArtifactAlias().get(i)));
+        }
+        for (int i = 0; i < oldPluginArtifact.getConfigSubstitution().size(); i++) {
+            newPluginArtifact.getConfigSubstitution().add(modelToJeePropertyType(oldPluginArtifact.getConfigSubstitution().get(i)));
+        }
+        return newPluginArtifact;
+    }
+
+    private static org.apache.geronimo.jee.plugin.ConfigXmlContentType modelToJeeConfigXmlContentType (ConfigXmlContentType oldContent) {
+        if (oldContent == null) return null;
+        org.apache.geronimo.jee.plugin.ConfigXmlContentType newContent = jeeFactory.createConfigXmlContentType();
+        newContent.setComment(oldContent.getComment());
+        for (int i = 0; i < oldContent.getGbean().size(); i++) {
+            newContent.getGbean().add(modelToJeeGbeanType(oldContent.getGbean().get(i)));
+        }
+        newContent.setCondition(oldContent.getCondition());
+        newContent.setLoad(oldContent.isLoad());
+        newContent.setServer(oldContent.getServer());
+        return newContent;
+    }
+
+    private static org.apache.geronimo.jee.plugin.GbeanType modelToJeeGbeanType (GbeanType oldGbean) {
+        if (oldGbean == null) return null;
+        org.apache.geronimo.jee.plugin.GbeanType newGbean = jeeFactory.createGbeanType();
+        newGbean.setComment(oldGbean.getComment());
+        for (int i = 0; i < oldGbean.getAttributeOrReference().size(); i++) {
+            if (AttributeType.class.isInstance(oldGbean.getAttributeOrReference().get(i))) {
+                newGbean.getAttributeOrReference().add(modelToJeeAttributeType((AttributeType)oldGbean.getAttributeOrReference().get(i)));
+            } else if (ReferenceType.class.isInstance(oldGbean.getAttributeOrReference().get(i))) {
+                newGbean.getAttributeOrReference().add(modelToJeeReferenceType((ReferenceType)oldGbean.getAttributeOrReference().get(i)));
+            }
+        }
+        newGbean.setGbeanInfo(oldGbean.getGbeanInfo());
+        newGbean.setLoad(oldGbean.isLoad());
+        newGbean.setName(oldGbean.getName());
+        return newGbean;
+    }
+    
+    private static org.apache.geronimo.jee.plugin.PrerequisiteType modelToJeePrerequisiteType (PrerequisiteType oldPrerequisite) {
+        if (oldPrerequisite == null) return null;
+        org.apache.geronimo.jee.plugin.PrerequisiteType newPrerequisite = jeeFactory.createPrerequisiteType();
+        newPrerequisite.setId(modelToJeeArtifactType(oldPrerequisite.getId()));
+        newPrerequisite.setResourceType(oldPrerequisite.getResourceType());
+        newPrerequisite.setDescription(oldPrerequisite.getDescription());
+        return newPrerequisite;
+    }
+
+    private static org.apache.geronimo.jee.plugin.ArtifactType modelToJeeArtifactType (ArtifactType oldArtifact) {
+        if (oldArtifact == null) return null;
+        org.apache.geronimo.jee.plugin.ArtifactType newArtifact = jeeFactory.createArtifactType();
+        newArtifact.setGroupId(oldArtifact.getGroupId());
+        newArtifact.setArtifactId(oldArtifact.getArtifactId());
+        newArtifact.setVersion(oldArtifact.getVersion());
+        newArtifact.setType(oldArtifact.getType());
+        return newArtifact;
+    }
+
+    private static org.apache.geronimo.jee.plugin.DependencyType modelToJeeDependencyType (DependencyType oldDependency) {
+        if (oldDependency == null) return null;
+        org.apache.geronimo.jee.plugin.DependencyType newDependency = jeeFactory.createDependencyType();
+        newDependency.setGroupId(oldDependency.getGroupId());
+        newDependency.setArtifactId(oldDependency.getArtifactId());
+        newDependency.setVersion(oldDependency.getVersion());
+        newDependency.setType(oldDependency.getType());
+        newDependency.setStart(oldDependency.isStart());
+        return newDependency;
+    }
+
+    private static org.apache.geronimo.jee.plugin.ReferenceType modelToJeeReferenceType (ReferenceType oldReference) {
+        if (oldReference == null) return null;
+        org.apache.geronimo.jee.plugin.ReferenceType newReference = jeeFactory.createReferenceType();
+        for (int i = 0; i < oldReference.getPattern().size(); i++) {
+            newReference.getPattern().add(modelToJeeReferencePatternType(oldReference.getPattern().get(i)));
+        }
+        newReference.setName(oldReference.getName());
+        return newReference;
+    }
+
+    private static org.apache.geronimo.jee.plugin.ReferenceType.Pattern modelToJeeReferencePatternType (ReferenceType.Pattern oldPattern) {
+        if (oldPattern == null) return null;
+        org.apache.geronimo.jee.plugin.ReferenceType.Pattern newPattern = jeeFactory.createReferenceTypePattern();
+        newPattern.setGroupId(oldPattern.getGroupId());
+        newPattern.setArtifactId(oldPattern.getArtifactId());
+        newPattern.setVersion(oldPattern.getVersion());
+        newPattern.setType(oldPattern.getType());
+        newPattern.setModule(oldPattern.getModule());
+        newPattern.setName(oldPattern.getName());
+        return newPattern;
+    }
+
+    private static org.apache.geronimo.jee.plugin.AttributeType modelToJeeAttributeType (AttributeType oldAttribute) {
+        if (oldAttribute == null) return null;
+        org.apache.geronimo.jee.plugin.AttributeType newAttribute = jeeFactory.createAttributeType();
+        newAttribute.getContent().addAll(oldAttribute.getContent());
+        newAttribute.setName(oldAttribute.getName());
+        newAttribute.setNull(oldAttribute.isNull());
+        newAttribute.setPropertyEditor(oldAttribute.getPropertyEditor());
+        return newAttribute;
+    }
+
+    private static org.apache.geronimo.jee.plugin.CopyFileType modelToJeeCopyFileType (CopyFileType oldCopyFile) {
+        if (oldCopyFile == null) return null;
+        org.apache.geronimo.jee.plugin.CopyFileType newCopyFile = jeeFactory.createCopyFileType();
+        newCopyFile.setValue(oldCopyFile.getValue());
+        newCopyFile.setDestDir(oldCopyFile.getDestDir());
+        newCopyFile.setRelativeTo(oldCopyFile.getRelativeTo());
+        return newCopyFile;
+    }
+
+    private static org.apache.geronimo.jee.plugin.PropertyType modelToJeePropertyType (PropertyType oldProperty) {
+        if (oldProperty == null) return null;
+        org.apache.geronimo.jee.plugin.PropertyType newProperty = jeeFactory.createPropertyType();
+        newProperty.setValue(oldProperty.getValue());
+        newProperty.setKey(oldProperty.getKey());
+        newProperty.setServer(oldProperty.getServer());
+        return newProperty;
+    }
+
+    private static org.apache.geronimo.jee.plugin.LicenseType modelToJeeLicenseType (LicenseType oldLicense) {
+        if (oldLicense == null) return null;
+        org.apache.geronimo.jee.plugin.LicenseType newLicense = jeeFactory.createLicenseType();
+        newLicense.setValue(oldLicense.getValue());
+        newLicense.setOsiApproved(oldLicense.isOsiApproved());
+        return newLicense;
+    }
+
+    private static org.apache.geronimo.jee.plugin.HashType modelToJeeHashType (HashType oldHash) {
+        if (oldHash == null) return null;
+        org.apache.geronimo.jee.plugin.HashType newHash = jeeFactory.createHashType();
+        newHash.setValue(oldHash.getValue());
+        newHash.setType(oldHash.getType());
+        return newHash;
+    }
+//jeeFactory = new org.apache.geronimo.jee.plugin.ObjectFactory()
+}

Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/PluginConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/PluginConverter.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/operations/PluginConverter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/META-INF/MANIFEST.MF?rev=723875&r1=723874&r2=723875&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/META-INF/MANIFEST.MF (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/META-INF/MANIFEST.MF Fri Dec  5 13:30:38 2008
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Geronimo Server Tools V21 UI Plug-in
 Bundle-SymbolicName: org.apache.geronimo.st.v21.ui;singleton:=true
-Bundle-Version: 2.1.4
+Bundle-Version: 2.2.0
 Bundle-Activator: org.apache.geronimo.st.v21.ui.Activator
 Bundle-Localization: plugin
 Require-Bundle: org.eclipse.ui,

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/plugin.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/plugin.properties?rev=723875&r1=723874&r2=723875&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/plugin.properties (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/plugin.properties Fri Dec  5 13:30:38 2008
@@ -16,4 +16,5 @@
 #
 # $Rev$ $Date$
 #
-PopupMenus.launchCustom=Launch Custom Server Assembly
+PopupMenus.launchPluginManager=Launch Plugin Manager
+PopupMenus.launchServerAssembly=Launch Custom Server Assembly

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/plugin.xml?rev=723875&r1=723874&r2=723875&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/plugin.xml (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/plugin.xml Fri Dec  5 13:30:38 2008
@@ -1,64 +1,70 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one or more
-  ~ contributor license agreements.  See the NOTICE file distributed with
-  ~ this work for additional information regarding copyright ownership.
-  ~ The ASF licenses this file to You under the Apache License, Version 2.0
-  ~ (the "License"); you may not use this file except in compliance with
-  ~ the License.  You may obtain a copy of the License at
-  ~
-  ~    http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<!-- $Rev: 570837 $ $Date: 2007-08-29 11:25:39 -0400 (Wed, 29 Aug 2007) $ -->
-
-<plugin>
-    <extension point="org.apache.geronimo.st.ui.loader">
-    	<loader class="org.apache.geronimo.st.v21.ui.editors.GeronimoFormContentLoader" version="1.1"/>
-    </extension>
-    
-    <extension point="org.apache.geronimo.st.ui.loader">
- 	  	<loader class="org.apache.geronimo.st.v21.ui.editors.GeronimoFormContentLoader" version="2.0"/>
-    </extension>
-
-    <extension point="org.apache.geronimo.st.ui.loader">
- 	  	<loader class="org.apache.geronimo.st.v21.ui.editors.GeronimoFormContentLoader" version="2.1"/>
-    </extension>
-
-    <!-- 
-     |
-     | Map the action defined for the "Geronimo Deployment" project-facet to a specific class
-     |
-     -->
-    <extension point="org.eclipse.wst.common.project.facet.ui.wizardPages">
-  		<wizard-pages action="geronimo.plan.install.v21">
-    		<page class="org.apache.geronimo.st.v21.ui.wizards.FacetInstallPage"/>
-  		</wizard-pages>
-	</extension>  
-
-	<extension point="org.eclipse.ui.popupMenus">
-		<objectContribution
-	      		adaptable="true"
-	      		id="org.apache.geronimo.ui.serveractions"
-	      		objectClass="org.eclipse.wst.server.core.IServer">
-	      	<enablement>
-	        	<test forcePluginActivation="true"
-	            	property="org.eclipse.wst.server.ui.serverType"
-	           		value="org.apache.geronimo.*" />
-	      	</enablement>
-	        <action id="org.apache.geronimo.ui.launchServerAssembly"
-        	label="%PopupMenus.launchCustom" icon="icons/obj16/littleG.gif"
-	            class="org.apache.geronimo.st.v21.ui.actions.LaunchGeronimoServerAssemblyAction"
-	           	enablesFor="1">
-	        </action>
-    	</objectContribution>
-    </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<!-- $Rev: 570837 $ $Date: 2007-08-29 11:25:39 -0400 (Wed, 29 Aug 2007) $ -->
+
+<plugin>
+
+    <extension point="org.apache.geronimo.st.ui.loader">
+           <loader class="org.apache.geronimo.st.v21.ui.editors.GeronimoFormContentLoader" version="2.1"/>
+    </extension>
+
+    <!-- 
+     |
+     | Map the action defined for the "Geronimo Deployment" project-facet to a specific class
+     |
+     -->
+    <extension point="org.eclipse.wst.common.project.facet.ui.wizardPages">
+        <wizard-pages action="geronimo.plan.install.v21">
+            <page class="org.apache.geronimo.st.v21.ui.wizards.FacetInstallPage"/>
+        </wizard-pages>
+    </extension>  
+
+    <extension point="org.eclipse.ui.popupMenus">
+        <objectContribution adaptable="true" id="org.apache.geronimo.ui.serveractions"
+                            objectClass="org.eclipse.wst.server.core.IServer">
+            <enablement>
+                <test forcePluginActivation="true" property="org.eclipse.wst.server.ui.serverType"
+                      value="org.apache.geronimo.*" />
+            </enablement>
+            <action id="org.apache.geronimo.ui.launchServerAssembly"
+                    label="%PopupMenus.launchServerAssembly" icon="icons/obj16/littleG.gif"
+                    class="org.apache.geronimo.st.v21.ui.actions.LaunchGeronimoServerAssemblyAction"
+                    enablesFor="1">
+            </action>
+        </objectContribution>
+    </extension>
+
+    <extension point="org.eclipse.ui.popupMenus">
+        <objectContribution adaptable="true" id="org.apache.geronimo.ui.serveractions"
+                            objectClass="org.eclipse.wst.server.core.IServer">
+            <enablement>
+                <test forcePluginActivation="true"
+                      property="org.eclipse.wst.server.ui.serverType"
+                      value="org.apache.geronimo.*" />
+            </enablement>
+            <action id="org.apache.geronimo.ui.launchPluginManager"
+                    label="%PopupMenus.launchPluginManager" icon="icons/obj16/littleG.gif"
+                    class="org.apache.geronimo.st.v21.ui.actions.LaunchGeronimoPluginManagerAction"
+                    enablesFor="1">
+            </action>
+        </objectContribution>
+    </extension>
+
+</plugin>

Added: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/actions/LaunchGeronimoPluginManagerAction.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/actions/LaunchGeronimoPluginManagerAction.java?rev=723875&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/actions/LaunchGeronimoPluginManagerAction.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/actions/LaunchGeronimoPluginManagerAction.java Fri Dec  5 13:30:38 2008
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.ui.actions;
+
+import org.apache.geronimo.st.v21.core.operations.GeronimoServerPluginManager;
+import org.apache.geronimo.st.ui.internal.Trace;
+import org.apache.geronimo.st.v21.ui.wizards.ServerPluginManagerDialog;
+import org.apache.geronimo.st.v21.ui.wizards.ServerPluginManagerWizard;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IActionDelegate;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LaunchGeronimoPluginManagerAction implements IActionDelegate {
+
+    private GeronimoServerPluginManager pluginManager;
+
+    private String serverPrefix;
+
+    public LaunchGeronimoPluginManagerAction() {
+        super();
+        IExtensionRegistry reg = Platform.getExtensionRegistry();
+        IConfigurationElement[] extensions = reg
+                .getConfigurationElementsFor("org.apache.geronimo.st.ui.actionURLs");
+        for (IConfigurationElement element : extensions) {
+            Trace.trace(Trace.INFO, element.getName() + " = "
+                    + element.getValue() + ".");
+            if (element.getName().equals("server_prefix")) {
+                serverPrefix = element.getValue();
+                Trace
+                        .trace(Trace.INFO, "server_prefix = " + serverPrefix
+                                + ".");
+            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run(IAction action) {
+
+        // bring up new dialog
+        ServerPluginManagerWizard wizard = new ServerPluginManagerWizard (pluginManager);
+        ServerPluginManagerDialog dialog = new ServerPluginManagerDialog(Display.getCurrent().getActiveShell(), wizard);
+        dialog.open();
+        if (dialog.getReturnCode() == Dialog.OK) {
+            
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
+     *      org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged(IAction action, ISelection selection) {
+
+        pluginManager = new GeronimoServerPluginManager();
+        boolean enable = pluginManager.serverChanged (((StructuredSelection) selection).getFirstElement(), serverPrefix);
+
+        action.setEnabled(enable);
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/actions/LaunchGeronimoPluginManagerAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/actions/LaunchGeronimoPluginManagerAction.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/actions/LaunchGeronimoPluginManagerAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityAdvancedSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityAdvancedSection.java?rev=723875&r1=723874&r2=723875&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityAdvancedSection.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/SecurityAdvancedSection.java Fri Dec  5 13:30:38 2008
@@ -203,9 +203,9 @@
         viewer.setInput(getInput());
 
         Composite buttonComposite = createButtonComposite(clientComposite);
-        createAddButton(toolkit, buttonComposite);
-        createRemoveButton(toolkit, buttonComposite);
-        createEditButton(toolkit, buttonComposite);
+        createAddButton(buttonComposite);
+        createRemoveButton(buttonComposite);
+        createEditButton(buttonComposite);
         activateButtons();
 
         section.setExpanded(false);

Added: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/LicenseWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/LicenseWizard.java?rev=723875&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/LicenseWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/LicenseWizard.java Fri Dec  5 13:30:38 2008
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v21.ui.wizards;
+
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.wizards.AbstractWizard;
+import org.apache.geronimo.system.plugin.model.LicenseType;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LicenseWizard extends AbstractWizard {
+
+    protected LicenseType license;
+    
+    protected Text licenseName;
+    
+    protected Combo osiApproved;
+    
+    public LicenseWizard (LicenseType oldLicense) {
+        super();
+        license = oldLicense;
+    }
+
+    public String getAddWizardWindowTitle() {
+        return CommonMessages.wizardNewTitle_License;
+    }
+
+    public String getEditWizardWindowTitle() {
+        return CommonMessages.wizardEditTitle_License;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.jface.wizard.IWizard#addPages()
+     */
+    public void addPages() {
+        addPage(new MessageDestWizardPage("Page0"));
+    }
+
+    // need to extend the DynamicWizardPage only so that when the Edit dialog is shown
+    // the values are brought in properly.
+    public class MessageDestWizardPage extends AbstractWizardPage {
+        public MessageDestWizardPage(String pageName) {
+            super(pageName);
+        }
+
+        public void createControl(Composite parent) {
+            Composite composite = createComposite(parent);
+            createLabel (composite, CommonMessages.license);
+            licenseName = createTextField (composite, "");
+            createLabel (composite, CommonMessages.osiApproved);
+            String[] values = {"true", "false"};
+            osiApproved = createCombo (composite, values, false);
+
+            if (license != null) {
+                licenseName.setText(license.getValue());
+                osiApproved.setText(String.valueOf(license.isOsiApproved()));
+            }
+            setControl(composite);
+        }
+
+        public String getWizardPageTitle() {
+            return CommonMessages.wizardPageTitle_License;
+        }
+
+        public String getWizardPageDescription() {
+            return CommonMessages.wizardPageDescription_License;
+        }
+    }
+    
+    public boolean performFinish() {
+        license = new LicenseType();
+        license.setValue(licenseName.getText());
+        license.setOsiApproved(Boolean.parseBoolean(osiApproved.getText()));
+
+        return true;
+    }
+    
+    public LicenseType getLicense() {
+        return license;
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/LicenseWizard.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/LicenseWizard.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/LicenseWizard.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain