geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcco...@apache.org
Subject svn commit: r939145 [5/7] - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core: ./ META-INF/ src/main/java/org/apache/geronimo/st/v30/core/ src/main/java/org/apache/geronimo/st/v30/core/commands/ src/main/java/org/apache...
Date Thu, 29 Apr 2010 00:45:15 GMT
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/StopCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/StopCommand.java?rev=939145&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/StopCommand.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/StopCommand.java Thu Apr 29 00:45:13 2010
@@ -0,0 +1,58 @@
+/*
+ * 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.v30.core.commands;
+
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.TargetModuleID;
+
+import org.apache.geronimo.st.v30.core.DeploymentUtils;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+class StopCommand extends AbstractDeploymentCommand {
+
+    public StopCommand(IServer server, IModule module) {
+        super(server, module);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute(org.eclipse.core.runtime.IProgressMonitor)
+     */
+    public IStatus execute(IProgressMonitor monitor) throws TargetModuleIdNotFoundException, CoreException {
+        TargetModuleID id = DeploymentUtils.getTargetModuleID(getServer(), getModule());
+        return new DeploymentCmdStatus(Status.OK_STATUS, getDeploymentManager().stop(new TargetModuleID[] { id }));
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.core.commands.IDeploymentCommand#getCommandType()
+     */
+    public CommandType getCommandType() {
+        return CommandType.STOP;
+    }
+
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/StopCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/StopCommand.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/StopCommand.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/SynchronizedDeploymentOp.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/SynchronizedDeploymentOp.java?rev=939145&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/SynchronizedDeploymentOp.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/SynchronizedDeploymentOp.java Thu Apr 29 00:45:13 2010
@@ -0,0 +1,172 @@
+/*
+ * 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.v30.core.commands;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.status.DeploymentStatus;
+import javax.enterprise.deploy.spi.status.ProgressEvent;
+import javax.enterprise.deploy.spi.status.ProgressListener;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+
+import org.apache.geronimo.st.v30.core.Activator;
+import org.apache.geronimo.st.v30.core.DeploymentStatusMessage;
+import org.apache.geronimo.st.v30.core.internal.Trace;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IModule;
+
+/**
+ * This class is a wrapper IDeploymentCommand that when executed blocks the
+ * callee's thread until completed, either when the waiting thread times out, or
+ * a failed or completed notification is recieved from the DeploymentManager.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SynchronizedDeploymentOp implements ProgressListener,
+        IDeploymentCommand {
+
+    private IDeploymentCommand command;
+
+    private MultiStatus status = null;
+
+    private IProgressMonitor _monitor = null;
+
+    private boolean timedOut = true;
+
+    public SynchronizedDeploymentOp(IDeploymentCommand command) {
+        super();
+        this.command = command;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute(org.eclipse.core.runtime.IProgressMonitor)
+     */
+    public IStatus execute(IProgressMonitor monitor) throws Exception {
+
+        _monitor = monitor;
+
+        if (_monitor == null) {
+            _monitor = new NullProgressMonitor();
+        }
+
+        ProgressObject po = run();
+
+        return new DeploymentCmdStatus(status, po);
+    }
+
+    private synchronized ProgressObject run() throws Exception {
+        Trace.trace(Trace.INFO, "--> run()");
+        
+        IStatus ds = command.execute(_monitor);
+
+        ProgressObject po = null;
+
+        if (ds instanceof DeploymentCmdStatus) {
+            po = ((DeploymentCmdStatus) ds).getProgressObject();
+            po.addProgressListener(this);
+
+            try {
+                wait(getTimeout());
+            } catch (InterruptedException e) {
+            }
+
+            po.removeProgressListener(this);
+            if (timedOut) {
+                Trace.trace(Trace.SEVERE, "Command Timed Out!");
+                status = new MultiStatus(Activator.PLUGIN_ID, 0, "", null);
+                status.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, command.getCommandType() + " timed out.", null));
+            }
+        }
+
+        Trace.trace(Trace.INFO, "<-- run()");
+        return po;
+    }
+
+    private synchronized void sendNotification() {
+        timedOut = false;
+        Trace.trace(Trace.INFO, "notifyAll()");
+        notifyAll();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.enterprise.deploy.spi.status.ProgressListener#handleProgressEvent(javax.enterprise.deploy.spi.status.ProgressEvent)
+     */
+    public void handleProgressEvent(ProgressEvent event) {
+        DeploymentStatus deploymentStatus = event.getDeploymentStatus();
+        if (deploymentStatus != null) {
+            DeploymentStatusMessage dsm = new DeploymentStatusMessage(deploymentStatus);
+            Trace.trace(Trace.INFO, dsm.toString());
+            _monitor.subTask(dsm.toString());
+            if (command.getCommandType() == deploymentStatus.getCommand()) {
+                if (deploymentStatus.isCompleted()) {
+                    messageToStatus(IStatus.OK, dsm.getMessage(), false);
+                    sendNotification();
+                } else if (deploymentStatus.isFailed()) {
+                    messageToStatus(IStatus.ERROR, dsm.getMessage(), true);
+                    sendNotification();
+                }
+            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.core.commands.IDeploymentCommand#getCommandType()
+     */
+    public CommandType getCommandType() {
+        return command.getCommandType();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.core.commands.IDeploymentCommand#getModule()
+     */
+    public IModule getModule() {
+        return command.getModule();
+    }
+    
+    public long getTimeout() {
+        return command.getTimeout();
+    }
+    
+    public void messageToStatus(int severity, String source, boolean error) {
+        status = new MultiStatus(Activator.PLUGIN_ID, 0, "", null);
+        try {
+            BufferedReader in = new BufferedReader(new StringReader(source));
+            String line;
+            while ((line = in.readLine()) != null) {
+                status.add(new Status(severity, Activator.PLUGIN_ID, 0,line, null));
+            }
+        } catch (IOException e) {
+
+        }
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/SynchronizedDeploymentOp.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/SynchronizedDeploymentOp.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/SynchronizedDeploymentOp.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/TargetModuleIdNotFoundException.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/TargetModuleIdNotFoundException.java?rev=939145&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/TargetModuleIdNotFoundException.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/TargetModuleIdNotFoundException.java Thu Apr 29 00:45:13 2010
@@ -0,0 +1,42 @@
+/*
+ * 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.v30.core.commands;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TargetModuleIdNotFoundException extends Exception {
+
+    private static final long serialVersionUID = -2530352160336730134L;
+
+    public TargetModuleIdNotFoundException() {
+        super();
+    }
+
+    public TargetModuleIdNotFoundException(String arg0) {
+        super(arg0);
+    }
+
+    public TargetModuleIdNotFoundException(String arg0, Throwable arg1) {
+        super(arg0, arg1);
+    }
+
+    public TargetModuleIdNotFoundException(Throwable arg0) {
+        super(arg0);
+    }
+
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/TargetModuleIdNotFoundException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/TargetModuleIdNotFoundException.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/TargetModuleIdNotFoundException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/UndeployCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/UndeployCommand.java?rev=939145&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/UndeployCommand.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/UndeployCommand.java Thu Apr 29 00:45:13 2010
@@ -0,0 +1,76 @@
+/*
+ * 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.v30.core.commands;
+
+import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.TargetModuleID;
+
+import org.apache.geronimo.st.v30.core.Activator;
+import org.apache.geronimo.st.v30.core.DeploymentUtils;
+import org.apache.geronimo.st.v30.core.IGeronimoServer;
+import org.apache.geronimo.st.v30.core.ModuleArtifactMapper;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+class UndeployCommand extends AbstractDeploymentCommand {
+
+    public UndeployCommand(IServer server, IModule module) {
+        super(server, module);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute(org.eclipse.core.runtime.IProgressMonitor)
+     */
+    public IStatus execute(IProgressMonitor monitor) throws TargetModuleIdNotFoundException, CoreException {
+        String configId = ModuleArtifactMapper.getInstance().resolve(getServer(), getModule());
+
+        if(configId == null) {
+            IGeronimoServer gs = (IGeronimoServer) getServer().getAdapter(IGeronimoServer.class);
+            try {
+                configId = gs.getVersionHandler().getConfigID(getModule());
+            } catch (Exception e) {
+                throw new CoreException(new Status(IStatus.ERROR,Activator.PLUGIN_ID,"Module config Id not found for undeployment",e));
+            }
+        }
+       
+        if(configId == null) {
+            throw new CoreException(new Status(IStatus.ERROR,Activator.PLUGIN_ID,"Module config Id not found for undeployment"));
+        }
+        
+        TargetModuleID id = DeploymentUtils.getTargetModuleID(getDeploymentManager(), configId);
+        return new DeploymentCmdStatus(Status.OK_STATUS, getDeploymentManager().undeploy(new TargetModuleID[] { id }));
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.core.commands.IDeploymentCommand#getCommandType()
+     */
+    public CommandType getCommandType() {
+        return CommandType.UNDEPLOY;
+    }
+
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/UndeployCommand.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/UndeployCommand.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/commands/UndeployCommand.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/AbstractDeploymentDescriptor.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/AbstractDeploymentDescriptor.java?rev=939145&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/AbstractDeploymentDescriptor.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/AbstractDeploymentDescriptor.java Thu Apr 29 00:45:13 2010
@@ -0,0 +1,66 @@
+/*
+ * 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.v30.core.descriptor;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AbstractDeploymentDescriptor {
+
+    Object obj;
+
+    public AbstractDeploymentDescriptor(Object obj) {
+        this.obj = obj;
+    }
+
+    protected List<String> getDeploymentDescriptorInfo(Map<String, String> input) {
+        ArrayList<String> result = new ArrayList<String>();
+        List info = null;
+        try {
+            Class clazz = null, infoClazz = null;
+            Method infoGetter = null, nameGetter = null;
+            clazz = Class.forName(input.get("class"));
+            infoGetter = clazz.getMethod(input.get("infoGetter"), null);
+            info = (List) infoGetter.invoke(obj, null);
+            infoClazz = Class.forName(input.get("implClass"));
+            nameGetter = infoClazz.getMethod(input.get("nameGetter"), null);
+            for (int i = 0; i < info.size(); i++) {
+                result.add((String) nameGetter.invoke(info.get(i), null));
+            }
+        } catch (IllegalArgumentException e) {
+            e.printStackTrace();
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        } catch (SecurityException e) {
+            e.printStackTrace();
+        } catch (NoSuchMethodException e) {
+            e.printStackTrace();
+        } catch (InvocationTargetException e) {
+            e.printStackTrace();
+        }
+        return result;
+    }
+
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/AbstractDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/AbstractDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/AbstractDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationDeploymentDescriptor.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationDeploymentDescriptor.java?rev=939145&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationDeploymentDescriptor.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationDeploymentDescriptor.java Thu Apr 29 00:45:13 2010
@@ -0,0 +1,28 @@
+/*
+ * 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.v30.core.descriptor;
+
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface ApplicationDeploymentDescriptor {
+
+    public List<String> getSecurityRoles();
+
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationJ2EEDeploymentDescriptor.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationJ2EEDeploymentDescriptor.java?rev=939145&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationJ2EEDeploymentDescriptor.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationJ2EEDeploymentDescriptor.java Thu Apr 29 00:45:13 2010
@@ -0,0 +1,45 @@
+/*
+ * 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.v30.core.descriptor;
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.jst.j2ee.application.Application;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ApplicationJ2EEDeploymentDescriptor extends AbstractDeploymentDescriptor implements
+        ApplicationDeploymentDescriptor {
+
+    HashMap<String, String> requiredInfo;
+
+    public ApplicationJ2EEDeploymentDescriptor(Application app) {
+        super(app);
+        requiredInfo = new HashMap<String, String>();
+        requiredInfo.put("class", "org.eclipse.jst.j2ee.application.Application");
+        requiredInfo.put("nameGetter", "getName");
+    }
+
+    public List<String> getSecurityRoles() {
+        requiredInfo.put("infoGetter", "getSecurityRoles");
+        requiredInfo.put("implClass", "org.eclipse.jst.j2ee.common.internal.impl.SecurityRoleImpl");
+        requiredInfo.put("nameGetter", "getRoleName");
+        return getDeploymentDescriptorInfo(requiredInfo);
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationJ2EEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationJ2EEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationJ2EEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationJavaEEDeploymentDescriptor.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationJavaEEDeploymentDescriptor.java?rev=939145&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationJavaEEDeploymentDescriptor.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationJavaEEDeploymentDescriptor.java Thu Apr 29 00:45:13 2010
@@ -0,0 +1,43 @@
+/*
+ * 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.v30.core.descriptor;
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.jst.javaee.application.Application;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ApplicationJavaEEDeploymentDescriptor extends AbstractDeploymentDescriptor implements
+        ApplicationDeploymentDescriptor {
+
+    HashMap<String, String> requiredInfo;
+
+    public ApplicationJavaEEDeploymentDescriptor(Application app) {
+        super(app);
+        requiredInfo = new HashMap<String, String>();
+        requiredInfo.put("class", "org.eclipse.jst.javaee.application.Application");
+    }
+    public List<String> getSecurityRoles() {
+        requiredInfo.put("infoGetter", "getSecurityRoles");
+        requiredInfo.put("implClass", "org.eclipse.jst.javaee.core.internal.impl.SecurityRoleImpl");
+        requiredInfo.put("nameGetter", "getRoleName");
+        return getDeploymentDescriptorInfo(requiredInfo);
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationJavaEEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationJavaEEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/ApplicationJavaEEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbDeploymentDescriptor.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbDeploymentDescriptor.java?rev=939145&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbDeploymentDescriptor.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbDeploymentDescriptor.java Thu Apr 29 00:45:13 2010
@@ -0,0 +1,28 @@
+/*
+ * 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.v30.core.descriptor;
+
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface EjbDeploymentDescriptor {
+
+    public List<String> getSecurityRoles();
+
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbJ2EEDeploymentDescriptor.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbJ2EEDeploymentDescriptor.java?rev=939145&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbJ2EEDeploymentDescriptor.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbJ2EEDeploymentDescriptor.java Thu Apr 29 00:45:13 2010
@@ -0,0 +1,56 @@
+/*
+ * 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.v30.core.descriptor;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.jst.j2ee.common.SecurityRole;
+import org.eclipse.jst.j2ee.ejb.AssemblyDescriptor;
+import org.eclipse.jst.j2ee.ejb.EJBJar;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EjbJ2EEDeploymentDescriptor extends AbstractDeploymentDescriptor implements
+        EjbDeploymentDescriptor {
+
+    HashMap<String, String> requiredInfo;
+
+    public EjbJ2EEDeploymentDescriptor(EJBJar ejb) {
+        super(ejb);
+        requiredInfo = new HashMap<String, String>();
+        requiredInfo.put("class", "org.eclipse.jst.j2ee.ejb.EJBJar");
+        requiredInfo.put("nameGetter", "getName");
+    }
+
+    public List<String> getSecurityRoles() {
+        EJBJar ejb = (EJBJar)this.obj;
+        AssemblyDescriptor ad = ejb.getAssemblyDescriptor();
+        
+        if (ad != null) {
+            List<SecurityRole> roles = ad.getSecurityRoles();
+            ArrayList<String> result = new ArrayList<String>();
+            for (SecurityRole role: roles) {
+                result.add(role.getRoleName());
+            }
+            return result;
+        }
+        return null;
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbJ2EEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbJ2EEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbJ2EEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbJavaEEDeploymentDescriptor.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbJavaEEDeploymentDescriptor.java?rev=939145&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbJavaEEDeploymentDescriptor.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbJavaEEDeploymentDescriptor.java Thu Apr 29 00:45:13 2010
@@ -0,0 +1,54 @@
+/*
+ * 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.v30.core.descriptor;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.jst.javaee.core.SecurityRole;
+import org.eclipse.jst.javaee.ejb.AssemblyDescriptor;
+import org.eclipse.jst.javaee.ejb.EJBJar;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EjbJavaEEDeploymentDescriptor extends AbstractDeploymentDescriptor implements
+        EjbDeploymentDescriptor {
+
+    HashMap<String, String> requiredInfo;
+
+    public EjbJavaEEDeploymentDescriptor(EJBJar ejb) {
+        super(ejb);
+        requiredInfo = new HashMap<String, String>();
+        requiredInfo.put("class", "org.eclipse.jst.javaee.ejb.EJBJar");
+    }
+    public List<String> getSecurityRoles() {
+        EJBJar ejb = (EJBJar)this.obj;
+        AssemblyDescriptor ad = ejb.getAssemblyDescriptor();
+        
+        if (ad != null) {
+            List<SecurityRole> roles = ad.getSecurityRoles();
+            ArrayList<String> result = new ArrayList<String>();
+            for (SecurityRole role: roles) {
+                result.add(role.getRoleName());
+            }
+            return result;
+        }
+        return null;
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbJavaEEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbJavaEEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/EjbJavaEEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebDeploymentDescriptor.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebDeploymentDescriptor.java?rev=939145&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebDeploymentDescriptor.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebDeploymentDescriptor.java Thu Apr 29 00:45:13 2010
@@ -0,0 +1,38 @@
+/*
+ * 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.v30.core.descriptor;
+
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface WebDeploymentDescriptor {
+
+    public List<String> getEjbRefs();
+
+    public List<String> getEjbLocalRefs();
+
+    public List<String> getSecurityRoles();
+
+    public List<String> getResourceRefs();
+
+    public List<String> getResourceEnvRefs();
+
+    public List<String> getMessageDestinations();
+
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebJ2EEDeploymentDescriptor.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebJ2EEDeploymentDescriptor.java?rev=939145&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebJ2EEDeploymentDescriptor.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebJ2EEDeploymentDescriptor.java Thu Apr 29 00:45:13 2010
@@ -0,0 +1,85 @@
+/*
+ * 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.v30.core.descriptor;
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.jst.j2ee.webapplication.WebApp;
+
+/**
+ * WebJ2EEDeploymentDescriptor
+ * 
+ * @version $Rev$ $Date$
+ */
+public class WebJ2EEDeploymentDescriptor extends AbstractDeploymentDescriptor implements
+        WebDeploymentDescriptor {
+
+    HashMap<String, String> requiredInfo;
+
+    public WebJ2EEDeploymentDescriptor(WebApp webApp) {
+        super(webApp);
+        requiredInfo = new HashMap<String, String>();
+        requiredInfo.put("class", "org.eclipse.jst.j2ee.webapplication.WebApp");
+        requiredInfo.put("nameGetter", "getName");
+    }
+
+    public List<String> getEjbLocalRefs() {
+        requiredInfo.put("infoGetter", "getEjbLocalRefs");
+        requiredInfo.put("implClass", "org.eclipse.jst.j2ee.common.internal.impl.EJBLocalRefImpl");
+        return getDeploymentDescriptorInfo(requiredInfo);
+    }
+
+    public List<String> getEjbRefs() {
+        requiredInfo.put("infoGetter", "getEjbRefs");
+        requiredInfo.put("implClass", "org.eclipse.jst.j2ee.common.internal.impl.EjbRefImpl");
+        return getDeploymentDescriptorInfo(requiredInfo);
+    }
+
+    public List<String> getMessageDestinations() {
+        requiredInfo.put("infoGetter", "getMessageDestinations");
+        requiredInfo
+                .put("implClass", "org.eclipse.jst.j2ee.common.internal.impl.MessageDestinationImpl");
+        return getDeploymentDescriptorInfo(requiredInfo);
+    }
+
+    public List<String> getResourceEnvRefs() {
+        requiredInfo.put("infoGetter", "getResourceEnvRefs");
+        requiredInfo.put("implClass", "org.eclipse.jst.j2ee.common.internal.impl.ResourceEnvRefImpl");
+        return getDeploymentDescriptorInfo(requiredInfo);
+    }
+
+    public List<String> getResourceRefs() {
+        requiredInfo.put("infoGetter", "getResourceRefs");
+        requiredInfo.put("implClass", "org.eclipse.jst.j2ee.common.internal.impl.ResourceRefImpl");
+        return getDeploymentDescriptorInfo(requiredInfo);
+    }
+
+    public List<String> getSecurityRoles() {
+        requiredInfo.put("infoGetter", "getSecurityRoles");
+        requiredInfo.put("implClass", "org.eclipse.jst.j2ee.common.internal.impl.SecurityRoleImpl");
+        requiredInfo.put("nameGetter", "getRoleName");
+        return getDeploymentDescriptorInfo(requiredInfo);
+    }
+
+    /*public List<String> getServiceRefs() {
+        requiredInfo.put("infoGetter", "getServiceRefs");
+        requiredInfo.put("implClass", "org.eclipse.jst.j2ee.common.internal.impl.EjbRefImpl");
+        return getDeploymentDescriptorInfo(requiredInfo);
+    }*/
+
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebJ2EEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebJ2EEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebJ2EEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebJavaEEDeploymentDescriptor.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebJavaEEDeploymentDescriptor.java?rev=939145&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebJavaEEDeploymentDescriptor.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebJavaEEDeploymentDescriptor.java Thu Apr 29 00:45:13 2010
@@ -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.v30.core.descriptor;
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.jst.javaee.web.WebApp;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebJavaEEDeploymentDescriptor extends AbstractDeploymentDescriptor implements
+        WebDeploymentDescriptor {
+
+    HashMap<String, String> requiredInfo;
+
+    public WebJavaEEDeploymentDescriptor(WebApp webApp) {
+        super(webApp);
+        requiredInfo = new HashMap<String, String>();
+        requiredInfo.put("class", "org.eclipse.jst.javaee.web.WebApp");
+    }
+
+    public List<String> getEjbLocalRefs() {
+        requiredInfo.put("infoGetter", "getEjbLocalRefs");
+        requiredInfo.put("implClass", "org.eclipse.jst.javaee.core.internal.impl.EjbLocalRefImpl");
+        requiredInfo.put("nameGetter", "getEjbRefName");
+        return getDeploymentDescriptorInfo(requiredInfo);
+    }
+
+    public List<String> getEjbRefs() {
+        requiredInfo.put("infoGetter", "getEjbRefs");
+        requiredInfo.put("implClass", "org.eclipse.jst.javaee.core.internal.impl.EjbRefImpl");
+        requiredInfo.put("nameGetter", "getEjbRefName");
+        return getDeploymentDescriptorInfo(requiredInfo);
+    }
+
+    public List<String> getMessageDestinations() {
+        requiredInfo.put("infoGetter", "getMessageDestinations");
+        requiredInfo
+                .put("implClass", "org.eclipse.jst.javaee.core.internal.impl.MessageDestinationImpl");
+        requiredInfo.put("nameGetter", "getMessageDestinationName");
+        return getDeploymentDescriptorInfo(requiredInfo);
+    }
+
+    public List<String> getResourceEnvRefs() {
+        requiredInfo.put("infoGetter", "getResourceEnvRefs");
+        requiredInfo.put("implClass", "org.eclipse.jst.javaee.core.internal.impl.ResourceEnvRefImpl");
+        requiredInfo.put("nameGetter", "getResourceEnvRefName");
+        return getDeploymentDescriptorInfo(requiredInfo);
+    }
+
+    public List<String> getResourceRefs() {
+        requiredInfo.put("infoGetter", "getResourceRefs");
+        requiredInfo.put("implClass", "org.eclipse.jst.javaee.core.internal.impl.ResourceRefImpl");
+        requiredInfo.put("nameGetter", "getResRefName");
+        return getDeploymentDescriptorInfo(requiredInfo);
+    }
+
+    public List<String> getSecurityRoles() {
+        requiredInfo.put("infoGetter", "getSecurityRoles");
+        requiredInfo.put("implClass", "org.eclipse.jst.javaee.core.internal.impl.SecurityRoleImpl");
+        requiredInfo.put("nameGetter", "getRoleName");
+        return getDeploymentDescriptorInfo(requiredInfo);
+    }
+
+    /*public List<String> getServiceRefs() {
+        requiredInfo.put("infoGetter", "getServiceRefs");
+        requiredInfo.put("implClass", "org.eclipse.jst.javaee.core.internal.impl.ServiceRefImpl");
+        requiredInfo.put("nameGetter", "getServiceRefName");
+        return getDeploymentDescriptorInfo(requiredInfo);
+    }*/
+
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebJavaEEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebJavaEEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/descriptor/WebJavaEEDeploymentDescriptor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/DependencyHelper.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/DependencyHelper.java?rev=939145&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/DependencyHelper.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/DependencyHelper.java Thu Apr 29 00:45:13 2010
@@ -0,0 +1,711 @@
+/*
+ * 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.v30.core.internal;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.application.Application;
+import org.apache.geronimo.jee.applicationclient.ApplicationClient;
+import org.apache.geronimo.jee.connector.Connector;
+import org.apache.geronimo.jee.deployment.Artifact;
+import org.apache.geronimo.jee.deployment.Dependencies;
+import org.apache.geronimo.jee.deployment.Dependency;
+import org.apache.geronimo.jee.deployment.Environment;
+import org.apache.geronimo.jee.deployment.ObjectFactory;
+import org.apache.geronimo.jee.openejb.OpenejbJar;
+import org.apache.geronimo.jee.web.WebApp;
+import org.apache.geronimo.st.v30.core.DeploymentUtils;
+import org.apache.geronimo.st.v30.core.GeronimoUtils;
+import org.apache.geronimo.st.v30.core.jaxb.JAXBUtils;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
+
+/**
+ * <b>DependencyHelper</b> is a helper class with various methods to aid in the discovery of
+ * inter-dependencies between modules being deployed from the GEP to the Geronimo server. It
+ * performs the following capabilities:
+ * <ol>
+ *      <li>Discovery of dependencies between modules<p>
+ *      <li>Provides the proper publishing ordering of the modules based on the discovered
+ *          dependencies<p>
+ *      <li><b>TODO:</b> Query the server searching for missing dependencies
+ * </ol>
+ * 
+ * @version $Rev$ $Date$
+ */
+public class DependencyHelper {
+
+    private DependencyManager dm = new DependencyManager();
+    private ObjectFactory deploymentFactory = new ObjectFactory();
+    private List inputModules = new ArrayList();
+    private List inputDeltaKind = new ArrayList();
+    private List reorderedModules = new ArrayList();
+    private List reorderedKinds  = new ArrayList();
+    private List<JAXBElement> inputJAXBElements = new ArrayList();
+    private List<JAXBElement> reorderedJAXBElements = new ArrayList();
+
+
+    /**
+     * Reorder the publish order of the modules based on any discovered dependencies
+     * 
+     * @param modules   Modules to be published to the Geronimo server
+     * @param deltaKind Publish kind constant for each module
+     * 
+     * @return List of reordered modules and deltaKind (or input if no change)
+     */
+    public List reorderModules(IServer server, List modules, List deltaKind ) {
+        Trace.tracePoint("Entry", "DependencyHelper.reorderModules", modules, deltaKind);
+
+        if (modules.size() == 0) {
+            List reorderedLists = new ArrayList(2);
+            reorderedLists.add(modules);
+            reorderedLists.add(deltaKind);
+            Trace.tracePoint("Exit ", "DependencyHelper.reorderModules", reorderedLists);
+            return reorderedLists;
+        }
+
+        inputModules = modules;
+        inputDeltaKind = deltaKind;
+
+        // 
+        // Iterate through all the modules and register the dependencies
+        // 
+        for (int ii=0; ii<modules.size(); ii++) {
+            IModule[] module = (IModule[]) modules.get(ii);
+            int moduleDeltaKind = ((Integer)deltaKind.get(ii)).intValue();
+            if (moduleDeltaKind != ServerBehaviourDelegate.REMOVED) {
+                //GERONIMODEVTOOLS-361
+                for (IModule singleModule:module){
+                    Environment environment = getEnvironment(singleModule);
+                    if (environment != null) {
+                        Artifact child = environment.getModuleId();
+                        Dependencies dependencies = environment.getDependencies();
+                        if (dependencies != null) {
+                            List<Dependency> depList = dependencies.getDependency();
+                            for ( Dependency dep : depList) {
+                                Artifact parent = deploymentFactory.createArtifact();
+                                parent.setGroupId( dep.getGroupId() );
+                                parent.setArtifactId( dep.getArtifactId() );
+                                parent.setVersion( dep.getVersion() );
+                                parent.setType( dep.getType() );
+                                
+                                StringBuilder configId = new StringBuilder();
+                                if (dep.getGroupId()!=null)
+                                    configId.append(dep.getGroupId());
+                                configId.append("/");
+                                if (dep.getArtifactId()!=null)
+                                    configId.append(dep.getArtifactId());
+                                configId.append("/");
+                                if (dep.getVersion()!=null)
+                                    configId.append(dep.getVersion());
+                                configId.append("/");
+                                if (dep.getType()!=null)
+                                    configId.append(dep.getType());
+                                
+                                if (!DeploymentUtils.isInstalledModule(server,configId.toString()))
+                                    dm.addDependency( child, parent );
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        // 
+        // Iterate through all the modules again and reorder as necessary
+        // 
+        for (int ii=0; ii<modules.size(); ii++) {
+            IModule[] module = (IModule[]) modules.get(ii);
+            int moduleDeltaKind = ((Integer)deltaKind.get(ii)).intValue();
+            if (module!=null && !reorderedModules.contains(module)) {
+                // Not already moved 
+                if (moduleDeltaKind == ServerBehaviourDelegate.REMOVED) {
+                    // Move module if going to be removed 
+                    reorderedModules.add(module);
+                    reorderedKinds.add(moduleDeltaKind);
+                }
+                else {
+                    Environment environment = getEnvironment(module[0]);
+                    if (environment != null) {
+                        Artifact artifact = environment.getModuleId();
+                        if (artifact == null) {
+                            // Move if null (nothing can be done)
+                            if (!reorderedModules.contains(module)) {
+                                reorderedModules.add(module);
+                                reorderedKinds.add(moduleDeltaKind);
+                            }
+                        }
+                        else if (dm.getParents(artifact).contains(artifact) ||  
+                                 dm.getChildren(artifact).contains(artifact)) {
+                            // Move if a tight circular dependency (nothing can be done)
+                            if (!reorderedModules.contains(module)) {
+                                reorderedModules.add(module);
+                                reorderedKinds.add(moduleDeltaKind);
+                            }
+                        }
+                        else if (dm.getParents(artifact).size() == 0) {
+                            // Move if no parents (nothing to do)
+                            if (!reorderedModules.contains(module)) {
+                                reorderedModules.add(module);
+                                reorderedKinds.add(moduleDeltaKind);
+                            }
+                        }
+                        else if (dm.getParents(artifact).size() > 0) {
+                            // Move parents first
+                            processParents(dm.getParents(artifact), artifact);
+                            // Move self 
+                            if (!reorderedModules.contains(module)) {
+                                reorderedModules.add(module);
+                                reorderedKinds.add(moduleDeltaKind);
+                            }
+                        }
+                    }else {
+                        //no environment defined, do just as no parents
+                        if (!reorderedModules.contains(module)) {
+                            reorderedModules.add(module);
+                            reorderedKinds.add(moduleDeltaKind);
+                        }
+                    }
+                }
+            }
+        }
+
+        // 
+        // Ensure return lists are exactly the same size as the input lists 
+        // 
+        assert reorderedModules.size() == modules.size();
+        assert reorderedKinds.size() == deltaKind.size();
+
+        // 
+        // Return List of lists
+        // 
+        List reorderedLists = new ArrayList(2);
+        reorderedLists.add(reorderedModules);
+        reorderedLists.add(reorderedKinds);
+
+        Trace.tracePoint("Exit ", "DependencyHelper.reorderModules", reorderedLists);
+        return reorderedLists;
+    }
+
+
+    /**
+     * Reorder the list of JAXBElements based on any discovered dependencies
+     * 
+     * @param jaxbElements
+     * 
+     * @return List of JAXBElements (or input if no change)
+     */
+    public List<JAXBElement> reorderJAXBElements( List<JAXBElement> jaxbElements ) {
+        Trace.tracePoint("Entry", "DependencyHelper.reorderModules", jaxbElements);
+
+        if (jaxbElements.size() == 0) {
+            Trace.tracePoint("Exit ", "DependencyHelper.reorderModules", jaxbElements);
+            return jaxbElements;
+        }
+
+        inputJAXBElements = jaxbElements;
+
+        // 
+        // Iterate through all the JAXBElements and register the dependencies
+        // 
+        for (JAXBElement jaxbElement : jaxbElements) {
+            Environment environment = getEnvironment(jaxbElement);
+            if (environment != null) {
+                Artifact child = environment.getModuleId();
+                if (child != null) {
+                    Dependencies dependencies = environment.getDependencies();
+                    if (dependencies != null) {
+                        List<Dependency> depList = dependencies.getDependency();
+                        if (depList != null) {
+                            for ( Dependency dep : depList) {
+                                Artifact parent = deploymentFactory.createArtifact();
+                                parent.setGroupId( dep.getGroupId() );
+                                parent.setArtifactId( dep.getArtifactId() );
+                                parent.setVersion( dep.getVersion() );
+                                parent.setType( dep.getType() );
+                                dm.addDependency( child, parent );
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        // 
+        // Iterate through all the JAXBElements again and reorder as necessary
+        // 
+        for (JAXBElement jaxbElement : jaxbElements) {
+            if (!reorderedJAXBElements.contains(jaxbElement)) {
+                // Not already moved
+                Environment environment = getEnvironment(jaxbElement);
+                if (environment != null) {
+                    Artifact artifact = environment.getModuleId();
+                    if (artifact == null) {
+                        // Move if null (nothing can be done)
+                        if (!reorderedJAXBElements.contains(jaxbElement)) {
+                            reorderedJAXBElements.add(jaxbElement);
+                        }
+                    }
+                    else if (dm.getParents(artifact).contains(artifact) ||  
+                             dm.getChildren(artifact).contains(artifact)) {
+                        // Move if a tight circular dependency (nothing can be done)
+                        if (!reorderedJAXBElements.contains(jaxbElement)) {
+                            reorderedJAXBElements.add(jaxbElement);
+                        }
+                    }
+                    else if (dm.getParents(artifact).size() == 0) {
+                        // Move if no parents (nothing to do)
+                        if (!reorderedJAXBElements.contains(jaxbElement)) {
+                            reorderedJAXBElements.add(jaxbElement);
+                        }
+                    }
+                    else if (dm.getParents(artifact).size() > 0) {
+                        // Move parents first
+                        processJaxbParents(dm.getParents(artifact), artifact);
+                        // Move self 
+                        if (!reorderedJAXBElements.contains(jaxbElement)) {
+                            reorderedJAXBElements.add(jaxbElement);
+                        }
+                    }
+                }
+            }
+        }
+
+        // 
+        // Ensure return list is exactly the same size as the input list 
+        // 
+        assert reorderedJAXBElements.size() == jaxbElements.size();
+
+        // 
+        // Return List of JAXBElements
+        // 
+        Trace.tracePoint("Exit ", "DependencyHelper.reorderModules", reorderedJAXBElements);
+        return reorderedJAXBElements;
+    }
+
+
+    /**
+     *
+     */
+    public void close() {
+        dm.close();
+    }
+
+
+    /*--------------------------------------------------------------------------------------------*\
+    |                                                                                              |
+    |  Private method(s)                                                                           | 
+    |                                                                                              |
+    \*--------------------------------------------------------------------------------------------*/
+
+    /**
+     * Process the parents for a given artifact. The terminatingArtifact parameter will be used as
+     * the terminating condition to ensure there will not be an infinite loop (i.e., if
+     * terminatingArtifact is encountered again there is a circular dependency).
+     * 
+     * @param parents
+     * @param terminatingArtifact
+     */
+    private void processParents(Set parents, Artifact terminatingArtifact) {
+        Trace.tracePoint("Enter", "DependencyHelper.processParents", parents, terminatingArtifact );
+
+        if (parents == null) {
+            Trace.tracePoint("Exit ", "DependencyHelper.processParents", null);
+            return;
+        }
+        for (Iterator ii = parents.iterator(); ii.hasNext();) {
+            Artifact artifact = (Artifact)ii.next();
+            if (dm.getParents(artifact).size() > 0 && !artifact.equals(terminatingArtifact) &&
+                !dm.getParents(artifact).contains(artifact) && !dm.getChildren(artifact).contains(artifact)) {
+                // Keep processing parents (as long as no circular dependencies)
+                processParents(dm.getParents(artifact), terminatingArtifact);
+                // Move self 
+                IModule[] module = getModule(artifact);
+                int moduleDeltaKind = getDeltaKind(artifact);
+                if (module!=null && !reorderedModules.contains(module)) {
+                    reorderedModules.add(module);
+                    reorderedKinds.add(moduleDeltaKind);
+                }
+            }
+            else {
+                // Move parent
+                IModule[] module = getModule(artifact);
+                int moduleDeltaKind = getDeltaKind(artifact);
+                if (module!=null && !reorderedModules.contains(module)) {
+                    reorderedModules.add(module);
+                    reorderedKinds.add(moduleDeltaKind);
+                }
+            }
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.processParents");
+    }
+
+
+    /**
+     * Returns the Environment for the given IModule
+     * 
+     * @param module IModule to be published
+     * 
+     * @return Environment
+     */
+    private Environment getEnvironment(IModule module) {
+        Trace.tracePoint("Enter", "DependencyHelper.getEnvironment", module);
+
+        Environment environment = null;
+        if (GeronimoUtils.isWebModule(module)) {
+            if (getWebDeploymentPlan(module) != null) {
+                WebApp plan = getWebDeploymentPlan(module).getValue();
+                if (plan != null)
+                    environment = plan.getEnvironment();
+            }
+        }
+        else if (GeronimoUtils.isEjbJarModule(module)) {
+            if (getOpenEjbDeploymentPlan(module) != null) {
+                OpenejbJar plan = getOpenEjbDeploymentPlan(module).getValue();
+                if (plan != null)
+                    environment = plan.getEnvironment();
+            }
+        }
+        else if (GeronimoUtils.isEarModule(module)) {
+            if (getApplicationDeploymentPlan(module) != null) {
+                Application plan = getApplicationDeploymentPlan(module).getValue();
+                if (plan != null)
+                    environment = plan.getEnvironment();
+            }
+        }
+        else if (GeronimoUtils.isRARModule(module)) {
+            if (getConnectorDeploymentPlan(module) != null) {
+                Connector plan = getConnectorDeploymentPlan(module).getValue();
+                if (plan != null)
+                    environment = plan.getEnvironment();
+            }
+        }else if (GeronimoUtils.isAppClientModule(module)) {
+            if (getAppClientDeploymentPlan(module) != null) {
+                ApplicationClient plan = getAppClientDeploymentPlan(module).getValue();
+                if (plan != null)
+                    environment = plan.getServerEnvironment();
+            }
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.getEnvironment", environment);
+        return environment;
+    }
+
+
+    /**
+     * Return the IModule[] for a given artifact
+     * 
+     * @param artifact
+     * 
+     * @return IModule[]
+     */
+    private IModule[] getModule(Artifact artifact) {
+        Trace.tracePoint("Enter", "DependencyHelper.getModule", artifact);
+
+        for (int ii=0; ii<inputModules.size(); ii++) {
+            IModule[] module = (IModule[]) inputModules.get(ii);
+            int moduleDeltaKind = ((Integer)inputDeltaKind.get(ii)).intValue();
+            Environment environment = getEnvironment(module[0]);
+            if (environment != null) {
+                Artifact moduleArtifact = environment.getModuleId();
+                if (artifact.equals(moduleArtifact)) {
+                    Trace.tracePoint("Exit ", "DependencyHelper.getModule", module);
+                    return module;
+                }
+            }
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.getModule", null);
+        return null;
+    }
+
+
+    /**
+     * Return the deltaKind array index for a given artifact
+     * 
+     * @param artifact
+     * 
+     * @return int
+     */
+    private int getDeltaKind(Artifact artifact) {
+        Trace.tracePoint("Enter", "DependencyHelper.getDeltaKind", artifact);
+
+        for (int ii=0; ii<inputModules.size(); ii++) {
+            IModule[] module = (IModule[]) inputModules.get(ii);
+            int moduleDeltaKind = ((Integer)inputDeltaKind.get(ii)).intValue();
+            Environment environment = getEnvironment(module[0]);
+            if (environment != null) {
+                Artifact moduleArtifact = environment.getModuleId();
+                if (artifact.equals(moduleArtifact)) {
+                    Trace.tracePoint("Exit ", "DependencyHelper.getDeltaKind", moduleDeltaKind);
+                    return moduleDeltaKind;
+                }
+            }
+        }
+        Trace.tracePoint("Exit ", "DependencyHelper.getDeltaKind", 0);
+        return 0;
+    }
+
+
+    /**
+     * Returns the WebApp for the given IModule
+     * 
+     * @param module IModule to be published
+     * 
+     * @return WebApp
+     */
+    private JAXBElement<WebApp> getWebDeploymentPlan(IModule module) {
+        Trace.tracePoint("Enter", "DependencyHelper.getWebDeploymentPlan", module);
+
+        IVirtualComponent comp = GeronimoUtils.getVirtualComponent(module);
+        IFile file = GeronimoUtils.getWebDeploymentPlanFile(comp);
+        if (file.getName().equals(GeronimoUtils.WEB_PLAN_NAME) && file.exists()) {
+            try {
+                Trace.tracePoint("Exit ", "DependencyHelper.getWebDeploymentPlan", JAXBUtils.unmarshalFilterDeploymentPlan(file));
+                 return JAXBUtils.unmarshalFilterDeploymentPlan(file);
+            } catch (Exception e) {
+                //ignore it, just indicate error by returning null
+            }
+           
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.getWebDeploymentPlan", null);
+        return null;
+    }
+
+
+    /**
+     * Returns the OpenEjbJar for the given IModule
+     * 
+     * @param module IModule to be published
+     * 
+     * @return OpenEjbJar
+     */
+    private JAXBElement<OpenejbJar> getOpenEjbDeploymentPlan(IModule module) {
+        Trace.tracePoint("Enter", "DependencyHelper.getOpenEjbDeploymentPlan", module);
+
+        IVirtualComponent comp = GeronimoUtils.getVirtualComponent(module);
+        IFile file = GeronimoUtils.getOpenEjbDeploymentPlanFile(comp);
+        if (file.getName().equals(GeronimoUtils.OPENEJB_PLAN_NAME) && file.exists()) {
+            try {
+                Trace.tracePoint("Exit ", "DependencyHelper.getOpenEjbDeploymentPlan", JAXBUtils.unmarshalFilterDeploymentPlan(file));
+            } catch (Exception e) {
+                //ignore it, just indicate error by returning null
+            }
+            try {
+                return JAXBUtils.unmarshalFilterDeploymentPlan(file);
+            } catch (Exception e) {
+                //ignore it, just indicate error by returning null
+            }
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.getOpenEjbDeploymentPlan", null);
+        return null;
+    }
+
+    /**
+     * Returns the ApplicationClient for the given IModule
+     * 
+     * @param module IModule to be published
+     * 
+     * @return ApplicationClient
+     */
+    private JAXBElement<ApplicationClient> getAppClientDeploymentPlan(IModule module) {
+        Trace.tracePoint("Enter", "DependencyHelper.getWebDeploymentPlan", module);
+
+        IVirtualComponent comp = GeronimoUtils.getVirtualComponent(module);
+        IFile file = GeronimoUtils.getApplicationClientDeploymentPlanFile(comp);
+        if (file.getName().equals(GeronimoUtils.APP_CLIENT_PLAN_NAME) && file.exists()) {
+            try {
+                Trace.tracePoint("Exit ", "DependencyHelper.getWebDeploymentPlan", JAXBUtils.unmarshalFilterDeploymentPlan(file));
+                 return JAXBUtils.unmarshalFilterDeploymentPlan(file);
+            } catch (Exception e) {
+                //ignore it, just indicate error by returning null
+            }
+           
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.getWebDeploymentPlan", null);
+        return null;
+    }
+    
+    /**
+     * Returns the Application for the given IModule
+     * 
+     * @param module IModule to be published
+     * 
+     * @return Application
+     */
+    private JAXBElement<Application> getApplicationDeploymentPlan(IModule module) {
+        Trace.tracePoint("Enter", "DependencyHelper.getApplicationDeploymentPlan", module);
+
+        IVirtualComponent comp = GeronimoUtils.getVirtualComponent(module);
+        IFile file = GeronimoUtils.getApplicationDeploymentPlanFile(comp);
+        if (file.getName().equals(GeronimoUtils.APP_PLAN_NAME) && file.exists()) {
+            try {
+                Trace.tracePoint("Exit ", "DependencyHelper.getApplicationDeploymentPlan", JAXBUtils.unmarshalFilterDeploymentPlan(file));
+                  return JAXBUtils.unmarshalFilterDeploymentPlan(file);
+            } catch (Exception e) {
+                //ignore it, just indicate error by returning null
+            }
+          
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.getApplicationDeploymentPlan", null);
+        return null;
+    }
+
+
+    /**
+     * Returns the Connector for the given IModule
+     * 
+     * @param module IModule to be published
+     * 
+     * @return Application
+     */
+    private JAXBElement<Connector> getConnectorDeploymentPlan(IModule module) {
+        Trace.tracePoint("Enter", "DependencyHelper.getConnectorDeploymentPlan", module);
+
+        IVirtualComponent comp = GeronimoUtils.getVirtualComponent(module);
+        IFile file = GeronimoUtils.getConnectorDeploymentPlanFile(comp);
+        if (file.getName().equals(GeronimoUtils.CONNECTOR_PLAN_NAME) && file.exists()) {
+            try {
+                Trace.tracePoint("Exit ", "DependencyHelper.getConnectorDeploymentPlan", JAXBUtils.unmarshalFilterDeploymentPlan(file));
+                 return JAXBUtils.unmarshalFilterDeploymentPlan(file);
+            } catch (Exception e) {
+                //ignore it, just indicate error by returning null
+            }
+           
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.getConnectorDeploymentPlan", null);
+        return null;
+    }
+
+
+    /**
+     * Process the parents for a given artifact. The terminatingArtifact parameter will be used as
+     * the terminating condition to ensure there will not be an infinite loop (i.e., if
+     * terminatingArtifact is encountered again there is a circular dependency).
+     * 
+     * @param parents
+     * @param terminatingArtifact
+     */
+    private void processJaxbParents(Set parents, Artifact terminatingArtifact) {
+        Trace.tracePoint("Enter", "DependencyHelper.processJaxbParents", parents, terminatingArtifact );
+
+        if (parents == null) {
+            Trace.tracePoint("Exit ", "DependencyHelper.processJaxbParents", null);
+            return;
+        }
+        for (Iterator ii = parents.iterator(); ii.hasNext();) {
+            Artifact artifact = (Artifact)ii.next();
+            if (dm.getParents(artifact).size() > 0 && !artifact.equals(terminatingArtifact) &&
+                !dm.getParents(artifact).contains(artifact) && !dm.getChildren(artifact).contains(artifact)) {
+                // Keep processing parents (as long as no circular dependencies)
+                processJaxbParents(dm.getParents(artifact), terminatingArtifact);
+                // Move self 
+                JAXBElement jaxbElement = getJaxbElement(artifact);
+                if (jaxbElement != null) {
+                    if (!reorderedJAXBElements.contains(jaxbElement)) {
+                        reorderedJAXBElements.add(jaxbElement);
+                    }
+                }
+            }
+            else {
+                // Move parent
+                JAXBElement jaxbElement = getJaxbElement(artifact);
+                if (jaxbElement != null) {
+                    if (!reorderedJAXBElements.contains(jaxbElement)) {
+                        reorderedJAXBElements.add(jaxbElement);
+                    }
+                }
+            }
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.processJaxbParents");
+    }
+
+
+    /**
+     * Returns the Environment for the given JAXBElement plan
+     * 
+     * @param jaxbElement JAXBElement plan
+     * 
+     * @return Environment
+     */
+    private Environment getEnvironment(JAXBElement jaxbElement) {
+        Trace.tracePoint("Enter", "DependencyHelper.getEnvironment", jaxbElement);
+
+        Environment environment = null;
+        Object plan = jaxbElement.getValue();
+        if (plan != null) {
+            if (WebApp.class.isInstance(plan)) {
+                environment = ((WebApp)plan).getEnvironment();
+            }
+            else if (OpenejbJar.class.isInstance(plan)) {
+                environment = ((OpenejbJar)plan).getEnvironment();
+            }
+            else if (Application.class.isInstance(plan)) {
+                environment = ((Application)plan).getEnvironment();
+            }
+            else if (Connector.class.isInstance(plan)) {
+                environment = ((Connector)plan).getEnvironment();
+            }
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.getEnvironment", environment);
+        return environment;
+    }
+
+
+    /**
+     * Return the JAXBElement for a given artifact
+     * 
+     * @param artifact
+     * 
+     * @return JAXBElement
+     */
+    private JAXBElement getJaxbElement(Artifact artifact) {
+        Trace.tracePoint("Enter", "DependencyHelper.getJaxbElement", artifact);
+
+        for (JAXBElement jaxbElement : inputJAXBElements) {
+            Environment environment = getEnvironment(jaxbElement);
+            if (environment != null) {
+                Artifact jaxbArtifact = environment.getModuleId();
+                if (artifact.equals(jaxbArtifact)) {
+                    Trace.tracePoint("Exit ", "DependencyHelper.getJaxbElement", jaxbElement);
+                    return jaxbElement;
+                }
+            }
+        }
+
+        // TODO: Query the server searching for missing dependencies
+        Trace.tracePoint("Exit ", "DependencyHelper.getJaxbElement", null);
+        return null;
+    }
+}



Mime
View raw message