JBoss Tools SVN: r30420 - trunk/as/tests/org.jboss.ide.eclipse.as.test/projects.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-04-07 16:33:56 -0400 (Thu, 07 Apr 2011)
New Revision: 30420
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.test/projects/
Log:
[cleanup] adding a test output folder to svn ignore
Property changes on: trunk/as/tests/org.jboss.ide.eclipse.as.test/projects
___________________________________________________________________
Added: svn:ignore
+ TempProject
13 years, 3 months
JBoss Tools SVN: r30419 - in trunk/as/plugins: org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-04-07 16:33:11 -0400 (Thu, 07 Apr 2011)
New Revision: 30419
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/archives/RSEZippedJSTPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java
Log:
JBIDE-7614 to trunk
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java 2011-04-07 17:42:06 UTC (rev 30418)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java 2011-04-07 20:33:11 UTC (rev 30419)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -43,6 +43,7 @@
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
import org.jboss.ide.eclipse.as.core.util.FileUtil.IFileUtilListener;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities;
import de.schlichtherle.io.ArchiveDetector;
@@ -52,7 +53,7 @@
private String deployRoot;
private boolean hasBeenChanged = false;
private IModule[] module;
-
+ private IServer server;
public IStatus publishModule(IServer server, String deployRoot, IModule[] module,
int publishType, IModuleResourceDelta[] delta,
IProgressMonitor monitor) throws CoreException {
@@ -61,6 +62,7 @@
monitor.setTaskName(name);
this.deployRoot = deployRoot;
this.module = module;
+ this.server = server;
IStatus[] returnStatus;
@@ -325,7 +327,8 @@
}
public IPath getOutputFilePath(IModule[] module) {
- return getDeployPath(module, deployRoot);
+ IDeployableServer ds = ServerConverter.getDeployableServer(server);
+ return getDeployPath(module, deployRoot, ds);
}
public boolean hasBeenChanged() {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2011-04-07 17:42:06 UTC (rev 30418)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2011-04-07 20:33:11 UTC (rev 30419)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
+ * Copyright (c) 2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -125,7 +125,7 @@
moduleTree, server,
server.getDeployFolder(),
IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
- return getDeployPath(moduleTree, folder);
+ return getDeployPath(moduleTree, folder, server);
}
public static IPath getDeployRootFolder(IModule[] moduleTree, IDeployableServer server) {
@@ -144,6 +144,47 @@
return new Path(folder);
}
+ public static IPath getDeployPath(IModule[] moduleTree, String deployFolder, IDeployableServer server) {
+ IPath root = new Path( deployFolder );
+ String type, modName, name, uri, suffixedName;
+ for( int i = 0; i < moduleTree.length; i++ ) {
+ boolean found = false;
+ if( i == 0 ) {
+ // If this is the root module, we can customize the output name
+ DeploymentPreferences prefs = DeploymentPreferenceLoader.loadPreferencesFromServer(server.getServer());
+ DeploymentTypePrefs typePrefs = prefs.getOrCreatePreferences(LocalPublishMethod.LOCAL_PUBLISH_METHOD);
+ DeploymentModulePrefs modPrefs = typePrefs.getModulePrefs(moduleTree[0]);
+ if( modPrefs != null ) {
+ String outName = modPrefs.getProperty(IJBossToolingConstants.LOCAL_DEPLOYMENT_OUTPUT_NAME);
+ if( outName != null && !outName.equals("")) { //$NON-NLS-1$
+ found = true;
+ root = root.append(outName);
+ }
+ }
+ }
+
+ // If it's a child module, or the property is not set,
+ // we must respect the deployment model...
+ if( !found ) {
+ type = moduleTree[i].getModuleType().getId();
+ modName = moduleTree[i].getName();
+ name = new Path(modName).lastSegment();
+ suffixedName = name + getSuffix(type);
+ uri = getParentRelativeURI(moduleTree, i, suffixedName);
+ root = root.append(uri);
+ }
+ }
+ return root;
+ }
+
+ /**
+ * This method is deprecated. Please use the following:
+ * @see getDeployPath(IModule[] module, String folder, IDeployableServer server)
+ * @param moduleTree
+ * @param deployFolder
+ * @return
+ */
+ @Deprecated
public static IPath getDeployPath(IModule[] moduleTree, String deployFolder) {
IPath root = new Path( deployFolder );
String type, modName, name, uri, suffixedName;
@@ -197,10 +238,10 @@
String folder = PublishUtil.getDeployRootFolder(
moduleTree, server, defaultFolder,
IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
- return PublishUtil.getDeployPath(moduleTree, folder);
+ return PublishUtil.getDeployPath(moduleTree, folder, server);
}
- private static String getSuffix(String type) {
+ public static String getSuffix(String type) {
// TODO
// VirtualReferenceUtilities.INSTANCE. has utility methods to help!!
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java 2011-04-07 17:42:06 UTC (rev 30418)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java 2011-04-07 20:33:11 UTC (rev 30419)
@@ -100,5 +100,5 @@
public static final String LOCAL_DEPLOYMENT_NAME = "name"; //$NON-NLS-1$
public static final String LOCAL_DEPLOYMENT_LOC = "location"; //$NON-NLS-1$
public static final String LOCAL_DEPLOYMENT_TEMP_LOC = "tempLocation"; //$NON-NLS-1$
-
+ public static final String LOCAL_DEPLOYMENT_OUTPUT_NAME = "outputName"; //$NON-NLS-1$
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/archives/RSEZippedJSTPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/archives/RSEZippedJSTPublisher.java 2011-04-07 17:42:06 UTC (rev 30418)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/archives/RSEZippedJSTPublisher.java 2011-04-07 20:33:11 UTC (rev 30419)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -93,7 +93,7 @@
// set up needed vars
IDeployableServer server2 = ServerConverter.getDeployableServer(server);
String remoteTempDeployRoot = getDeployRoot(module, ServerConverter.getDeployableServer(server));
- IPath sourcePath = PublishUtil.getDeployPath(module, remoteTempDeployRoot);
+ IPath sourcePath = PublishUtil.getDeployPath(module, remoteTempDeployRoot, server2);
IPath destFolder = PublishUtil.getDeployPath(method, module, server2);
String name = sourcePath.lastSegment();
IStatus result = null;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2011-04-07 17:42:06 UTC (rev 30418)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2011-04-07 20:33:11 UTC (rev 30419)
@@ -169,6 +169,7 @@
/* Editor Strings */
+ public static String EditorDeployment;
public static String EditorUseWorkspaceMetadata;
public static String EditorUseServersDeployFolder;
public static String EditorUseCustomDeployFolder;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2011-04-07 17:42:06 UTC (rev 30418)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2011-04-07 20:33:11 UTC (rev 30419)
@@ -144,10 +144,11 @@
DescriptorXPathMatch=Match
#Editor
+EditorDeployment=Deployment
EditorUseWorkspaceMetadata=Use workspace metadata (does not modify JBoss deploy folder)
EditorUseServersDeployFolder=Use the JBoss deploy folder
EditorUseCustomDeployFolder=Use a custom deploy folder
-EditorSetDeployLabel=Deploy Directory
+EditorSetDeployLabel=Deployment Location
EditorSetTempDeployLabel=Temporary Deploy Directory
EditorEditDeployLocCommand=Edit Deployment Location
EditorModule=Module
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java 2011-04-07 17:42:06 UTC (rev 30418)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java 2011-04-07 20:33:11 UTC (rev 30419)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
+* Copyright (c) 2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -59,6 +59,7 @@
import org.jboss.ide.eclipse.as.core.ExtensionManager;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
+import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
@@ -115,32 +116,21 @@
private ModuleDeploymentPage page;
private DeploymentPreferences preferences;
private TreeViewer viewer;
- protected String COLUMN_NAME;
- protected String COLUMN_LOC;
- protected String COLUMN_TEMP_LOC;
- protected String currentDeployType;
+ protected static final String COLUMN_NAME = IJBossToolingConstants.LOCAL_DEPLOYMENT_NAME;
+ protected static final String COLUMN_LOC = IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC;
+ protected static final String COLUMN_TEMP_LOC = IJBossToolingConstants.LOCAL_DEPLOYMENT_TEMP_LOC;
+ protected static final String OUTPUT_NAME = IJBossToolingConstants.LOCAL_DEPLOYMENT_OUTPUT_NAME;
+ protected String currentDeployType = LocalPublishMethod.LOCAL_PUBLISH_METHOD;
private IServerWorkingCopy lastWC;
public DeploymentModuleOptionCompositeAssistant() {
- COLUMN_NAME = IJBossToolingConstants.LOCAL_DEPLOYMENT_NAME;
- COLUMN_LOC = IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC;
- COLUMN_TEMP_LOC = IJBossToolingConstants.LOCAL_DEPLOYMENT_TEMP_LOC;
- currentDeployType = LocalPublishMethod.LOCAL_PUBLISH_METHOD;
}
public ModuleDeploymentPage getPage() {
return page;
}
- public String getCurrentDeployType() {
- return currentDeployType;
- }
-
- public void setCurrentDeployType(String type) {
- this.currentDeployType = type;
- }
-
public void setDeploymentPage(ModuleDeploymentPage page) {
this.page = page;
}
@@ -673,8 +663,7 @@
DeploymentModulePrefs p = preferences.getOrCreatePreferences(currentDeployType)
.getOrCreateModulePrefs((IModule) element);
if (property == COLUMN_LOC) {
- String ret = p.getProperty(COLUMN_LOC);
- return ret == null ? "" : ret;
+ return getOutputFolderAndName(p, (IModule)element);
}
if (property == COLUMN_TEMP_LOC) {
String ret = p.getProperty(COLUMN_TEMP_LOC);
@@ -690,8 +679,12 @@
DeploymentModulePrefs p = preferences.getOrCreatePreferences(currentDeployType)
.getOrCreateModulePrefs(module);
if (property == COLUMN_LOC) {
- page.firePropertyChangeCommand(p, COLUMN_LOC,
- (String) value, Messages.EditorEditDeployLocCommand);
+ String outputName = new Path(((String)value)).lastSegment();
+ String outPath = ((String)value).substring(0, ((String)value).length()-outputName.length());
+ page.firePropertyChangeCommand(p,
+ new String[]{COLUMN_LOC, OUTPUT_NAME},
+ new String[]{outPath,outputName},
+ Messages.EditorEditDeployLocCommand);
viewer.refresh();
} else if (property == COLUMN_TEMP_LOC) {
page.firePropertyChangeCommand(p, COLUMN_TEMP_LOC,
@@ -745,11 +738,7 @@
DeploymentModulePrefs modPref = preferences
.getOrCreatePreferences(currentDeployType)
.getOrCreateModulePrefs(m);
- String result = modPref.getProperty(COLUMN_LOC);
- if (result != null)
- return result;
- modPref.setProperty(COLUMN_LOC, "");
- return "";
+ return getOutputFolderAndName(modPref, m);
}
if (columnIndex == 2) {
DeploymentModulePrefs modPref = preferences
@@ -802,4 +791,19 @@
}
+
+ public static String getDefaultOutputName(IModule module) {
+ return module.getName() + PublishUtil.getSuffix(module.getModuleType().getId());
+ }
+
+ protected static String getOutputFolderAndName(DeploymentModulePrefs modPref, IModule m) {
+ String folder = modPref.getProperty(COLUMN_LOC);
+ String outputName = modPref.getProperty(OUTPUT_NAME);
+ outputName = outputName == null || outputName.equals("")
+ ? getDefaultOutputName(m) : outputName;
+
+ if (folder != null)
+ return new Path(folder).append(outputName).toPortableString();
+ return outputName;
+ }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java 2011-04-07 17:42:06 UTC (rev 30418)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java 2011-04-07 20:33:11 UTC (rev 30419)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -10,20 +10,15 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.ui.editor;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
import java.util.ArrayList;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IEditorInput;
@@ -44,6 +39,7 @@
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentModulePrefs;
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
import org.jboss.ide.eclipse.as.core.util.ServerUtil;
+import org.jboss.ide.eclipse.as.ui.Messages;
public class ModuleDeploymentPage extends ServerEditorPart {
protected ServerResourceCommandManager commandManager;
@@ -115,7 +111,7 @@
FormToolkit toolkit = getFormToolkit(parent);
ScrolledForm allContent = toolkit.createScrolledForm(parent);
toolkit.decorateFormHeading(allContent.getForm());
- allContent.setText("Deployment");
+ allContent.setText(Messages.EditorDeployment);
allContent.getBody().setLayout(new FormLayout());
return allContent;
}
@@ -148,27 +144,45 @@
}
public void firePropertyChangeCommand(DeploymentModulePrefs p, String key, String val, String cmdName) {
- commandManager.execute(new ChangePropertyCommand(p,key,val,cmdName));
+ firePropertyChangeCommand(p, new String[]{key},new String[]{val},cmdName);
}
+ public void firePropertyChangeCommand(DeploymentModulePrefs p, String[] keys, String[] vals, String cmdName) {
+ commandManager.execute(new ChangePropertyCommand(p, keys,vals,cmdName));
+ }
+
+
private class ChangePropertyCommand extends ServerCommand {
private DeploymentModulePrefs p;
- private String key;
- private String oldVal;
- private String newVal;
+ private String[] keys;
+ private String[] oldVals;
+ private String[] newVals;
public ChangePropertyCommand(DeploymentModulePrefs p, String key, String val, String commandName) {
+ this(p, new String[]{key}, new String[]{val}, commandName);
+ }
+
+ public ChangePropertyCommand(DeploymentModulePrefs p, String[] keys,
+ String[] vals, String commandName) {
super(ModuleDeploymentPage.this.server, commandName);
this.p = p;
- this.key = key;
- this.newVal = val;
- this.oldVal = p.getProperty(key);
+ this.keys = keys;
+ this.newVals = vals;
+ this.oldVals = new String[newVals.length];
+ for( int i = 0; i < newVals.length; i++ ) {
+ oldVals[i] = p.getProperty(keys[i]);
+ }
}
+
public void execute() {
- p.setProperty(key, newVal);
+ for( int i = 0; i < keys.length; i++ ) {
+ p.setProperty(keys[i], newVals[i]);
+ }
savePreferencesToWorkingCopy();
}
public void undo() {
- p.setProperty(key, oldVal);
+ for( int i = 0; i < keys.length; i++) {
+ p.setProperty(keys[i], oldVals[i]);
+ }
savePreferencesToWorkingCopy();
}
}
@@ -195,7 +209,7 @@
public static String makeRelative(String path, IRuntime runtime) {
IJBossServerRuntime rt = getRuntime(runtime);
if (rt == null)
- return path;
+ return path;
return ServerUtil.makeRelative(rt, new Path(path)).toString();
}
13 years, 3 months
JBoss Tools SVN: r30418 - workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-04-07 13:42:06 -0400 (Thu, 07 Apr 2011)
New Revision: 30418
Added:
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilderException.java
Modified:
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilder.java
Log:
[JBIDE-8690] now returning status to show deployment success
Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilder.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilder.java 2011-04-07 15:09:52 UTC (rev 30417)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilder.java 2011-04-07 17:42:06 UTC (rev 30418)
@@ -14,14 +14,20 @@
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.controller.client.helpers.standalone.DeploymentAction;
import org.jboss.as.controller.client.helpers.standalone.DeploymentPlan;
import org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder;
+import org.jboss.as.controller.client.helpers.standalone.InitialDeploymentPlanBuilder;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentActionResult;
import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
import org.jboss.as.protocol.StreamUtils;
@@ -31,46 +37,151 @@
*/
public class DeploymentBuilder {
- public static final long DEFAULT_TIMEOUT = 15 * 1000;
+ public static final long DEFAULT_TIMEOUT = 15 * 1000;
- private ModelControllerClient client;
- private ServerDeploymentManager manager;
- private final List<File> warFiles = new ArrayList<File>();
- private long timeout = DEFAULT_TIMEOUT;
+ private ModelControllerClient client;
+ private ServerDeploymentManager manager;
+ private final List<Deployable> deployables = new ArrayList<Deployable>();
+ private long timeout = DEFAULT_TIMEOUT;
+ private InitialDeploymentPlanBuilder builder;
- public DeploymentBuilder(String host, int port) throws UnknownHostException {
- this.client = ModelControllerClient.Factory.create(InetAddress.getByName(host), port);
- this.manager = ServerDeploymentManager.Factory.create(client);
- }
+ public DeploymentBuilder(String host, int port) throws UnknownHostException {
+ this.client = ModelControllerClient.Factory.create(InetAddress.getByName(host), port);
+ this.manager = ServerDeploymentManager.Factory.create(client);
+ this.builder = manager.newDeploymentPlan();
+ }
- public DeploymentBuilder add(File file) {
- warFiles.add(file);
- return this;
- }
+ public DeploymentBuilder add(String name, File file) {
+ deployables.add(new Deployable(name, file, timeout));
+ return this;
+ }
- public void deploy() {
- try {
- try {
- DeploymentPlanBuilder builder = manager.newDeploymentPlan();
- addWarFiles(builder);
- DeploymentPlan plan = builder.build();
- Future<ServerDeploymentPlanResult> planResult = manager.execute(plan);
- planResult.get(timeout, TimeUnit.MILLISECONDS);
- } finally {
- cleanup();
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
+ public DeploymentBuilder add(File file) {
+ return add(file.getName(), file);
+ }
- private void addWarFiles(DeploymentPlanBuilder builder) throws IOException {
- for (File warFile : warFiles) {
- builder.add(warFile.getName(), warFile).andDeploy();
- }
- }
+ public DeploymentBuilder setTimeout(long timeout) {
+ this.timeout = timeout;
+ return this;
+ }
- private void cleanup() {
- StreamUtils.safeClose(client);
- }
+ public List<Deployable> deploy() throws DeploymentBuilderException {
+ if (deployables.isEmpty()) {
+ throw new DeploymentBuilderException("no files to deploy.");
+ }
+
+ try {
+ try {
+ addWarFiles(builder, deployables);
+ DeploymentPlan plan = builder.build();
+ Future<ServerDeploymentPlanResult> planResult = manager.execute(plan);
+ setResult(planResult, deployables);
+ return deployables;
+ } finally {
+ cleanup();
+ }
+ } catch (Exception e) {
+ throw new DeploymentBuilderException(e);
+ }
+ }
+
+ private void setResult(Future<ServerDeploymentPlanResult> planResult, List<Deployable> deployables) {
+ for (Deployable deployable : deployables) {
+ deployable.setResultFuture(planResult);
+ }
+ }
+
+ private void addWarFiles(DeploymentPlanBuilder builder, List<Deployable> deployables) throws IOException {
+ for (int i = 0; i < deployables.size(); i++) {
+ Deployable deployable = deployables.get(i);
+ DeploymentPlanBuilder addBuilder = builder.add(deployable.getName(), deployable.getFile()).andDeploy();
+ deployable.setDeploymentAction(addBuilder.getLastAction());
+ }
+ }
+
+ private void cleanup() {
+ StreamUtils.safeClose(client);
+ }
+
+ public class Deployable {
+
+ private String name;
+ private File file;
+ private Future<ServerDeploymentPlanResult> resultFuture;
+ private long timeout;
+ private DeploymentAction action;
+
+ private Deployable(String name, File file, long timeout) {
+ this.name = name;
+ this.file = file;
+ this.timeout = timeout;
+ }
+
+ private void setDeploymentAction(DeploymentAction action) {
+ this.action = action;
+ }
+
+ private void setResultFuture(Future<ServerDeploymentPlanResult> resultFuture) {
+ this.resultFuture = resultFuture;
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public IStatus getStatus() throws DeploymentBuilderException {
+ if (resultFuture == null
+ || action == null) {
+ return null;
+ }
+ try {
+ ServerDeploymentPlanResult result = resultFuture.get(timeout, TimeUnit.MILLISECONDS);
+ ServerDeploymentActionResult actionResult = result.getDeploymentActionResult(action.getId());
+ return createStatus(action, actionResult);
+ } catch (Exception e) {
+ throw new DeploymentBuilderException(e);
+ }
+ }
+
+ private IStatus createStatus(DeploymentAction action, ServerDeploymentActionResult actionResult) {
+ IStatus status = null;
+ switch (actionResult.getResult()) {
+ case NOT_EXECUTED:
+ status = createStatus(IStatus.ERROR, "The operation {0} was not executed on unit {1}", action
+ .getType().name(), getName());
+ break;
+ case EXECUTED:
+ status = Status.OK_STATUS;
+ break;
+ case FAILED:
+ status = createStatus(IStatus.ERROR, "The operation {0} failed for unit {1}", action.getType()
+ .name(), getName());
+ break;
+ case ROLLED_BACK:
+ status = createStatus(IStatus.ERROR, "The operation {0} for unit {1} was rolled back", action
+ .getType().name(), getName());
+ break;
+ case CONFIGURATION_MODIFIED_REQUIRES_RESTART:
+ status = createStatus(
+ IStatus.WARNING,
+ "The operation {0} was not executed on unit {1}. The server configuration was changed though and the server needs to be restarted",
+ action.getType().name(), getName());
+ break;
+ }
+ return status;
+ }
+
+ private IStatus createStatus(int severity, String messagePattern, Object... messageArguments) {
+ return new Status(severity, Activator.getContext().getBundle().getSymbolicName(), MessageFormat.format(
+ messagePattern, messageArguments));
+ }
+ }
+
+ public static class Deployment {
+
+ }
}
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilderException.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilderException.java (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilderException.java 2011-04-07 17:42:06 UTC (rev 30418)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.ide.eclipse.as7.deployment;
+
+/**
+ * @author André Dietisheim
+ */
+public class DeploymentBuilderException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public DeploymentBuilderException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public DeploymentBuilderException(Throwable cause) {
+ super(cause);
+ }
+
+ public DeploymentBuilderException(String message) {
+ super(message);
+ }
+
+}
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilderException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 3 months
JBoss Tools SVN: r30417 - trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-04-07 11:09:52 -0400 (Thu, 07 Apr 2011)
New Revision: 30417
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/EditRuntimePathDialog.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java
Log:
JBIDE-8702 Convert modeless Edit and Search dialog to modal
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/EditRuntimePathDialog.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/EditRuntimePathDialog.java 2011-04-07 13:50:14 UTC (rev 30416)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/EditRuntimePathDialog.java 2011-04-07 15:09:52 UTC (rev 30417)
@@ -50,7 +50,7 @@
public EditRuntimePathDialog(Shell parentShell, RuntimePath runtimePath) {
super(parentShell);
setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
- | SWT.MODELESS | SWT.RESIZE | getDefaultOrientation());
+ | SWT.RESIZE | getDefaultOrientation());
this.runtimePath = runtimePath;
}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java 2011-04-07 13:50:14 UTC (rev 30416)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/SearchRuntimePathDialog.java 2011-04-07 15:09:52 UTC (rev 30417)
@@ -64,7 +64,7 @@
public SearchRuntimePathDialog(Shell parent, List<RuntimePath> runtimePaths, boolean needRefresh, int heightHint) {
super(parent);
setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
- | SWT.MODELESS | SWT.RESIZE | getDefaultOrientation());
+ | SWT.RESIZE | getDefaultOrientation());
this.runtimePaths = runtimePaths;
this.needRefresh = needRefresh;
this.heightHint = heightHint;
13 years, 3 months
JBoss Tools SVN: r30416 - in workspace/adietish: org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-04-07 09:50:14 -0400 (Thu, 07 Apr 2011)
New Revision: 30416
Modified:
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderTest.java
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilder.java
Log:
[JBIDE-8690]
Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilder.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilder.java 2011-04-07 13:00:32 UTC (rev 30415)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilder.java 2011-04-07 13:50:14 UTC (rev 30416)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
package org.jboss.ide.eclipse.as7.deployment;
import java.io.File;
@@ -3,10 +13,7 @@
import java.io.IOException;
import java.net.InetAddress;
-import java.net.URISyntaxException;
-import java.net.URL;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
@@ -15,26 +22,20 @@
import org.jboss.as.controller.client.ModelControllerClient;
import org.jboss.as.controller.client.helpers.standalone.DeploymentPlan;
import org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder;
-import org.jboss.as.controller.client.helpers.standalone.DuplicateDeploymentNameException;
import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
import org.jboss.as.protocol.StreamUtils;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.ArchivePath;
-import org.jboss.shrinkwrap.api.ArchivePaths;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.container.ResourceContainer;
-import org.jboss.shrinkwrap.api.exporter.ZipExporter;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
+/**
+ * @author André Dietisheim
+ */
public class DeploymentBuilder {
- public static final long DEFAULT_TIMEOUT = 15000;
+ public static final long DEFAULT_TIMEOUT = 15 * 1000;
private ModelControllerClient client;
private ServerDeploymentManager manager;
- private final List<AbstractDeployment> deployments = new ArrayList<AbstractDeployment>();
+ private final List<File> warFiles = new ArrayList<File>();
private long timeout = DEFAULT_TIMEOUT;
public DeploymentBuilder(String host, int port) throws UnknownHostException {
@@ -42,23 +43,16 @@
this.manager = ServerDeploymentManager.Factory.create(client);
}
- public DeploymentBuilder add(String name, boolean show, Package... pkgs) {
- deployments.add(new WarDeployment(name, pkgs, show));
- return this;
- }
-
public DeploymentBuilder add(File file) {
- deployments.add(new WarFileDeployment(file));
+ warFiles.add(file);
return this;
}
public void deploy() {
try {
- DeploymentPlanBuilder builder = manager.newDeploymentPlan();
- for (AbstractDeployment deployment : deployments) {
- deployment.addDeployment(manager, builder);
- }
try {
+ DeploymentPlanBuilder builder = manager.newDeploymentPlan();
+ addWarFiles(builder);
DeploymentPlan plan = builder.build();
Future<ServerDeploymentPlanResult> planResult = manager.execute(plan);
planResult.get(timeout, TimeUnit.MILLISECONDS);
@@ -70,183 +64,13 @@
}
}
- private void cleanup() {
- StreamUtils.safeClose(client);
- }
-
- private abstract class AbstractDeployment {
-
- boolean deployed;
- String deploymentName;
-
- public synchronized DeploymentPlanBuilder addDeployment(ServerDeploymentManager manager, DeploymentPlanBuilder builder)
- throws DuplicateDeploymentNameException, IOException, ExecutionException, InterruptedException {
- deploymentName = getFile().getName();
- System.out.println("Deploying " + deploymentName);
- return builder.add(deploymentName, getFile()).deploy(deploymentName);
+ private void addWarFiles(DeploymentPlanBuilder builder) throws IOException {
+ for (File warFile : warFiles) {
+ builder.add(warFile.getName(), warFile).andDeploy();
}
-
- public synchronized DeploymentPlanBuilder removeDeployment(DeploymentPlanBuilder builder) {
- if (deployed) {
- System.out.println("Undeploying " + deploymentName);
- return builder.undeploy(deploymentName).remove(deploymentName);
- } else {
- return builder;
- }
- }
-
- protected void addFiles(ResourceContainer<?> archive, File dir, ArchivePath dest) {
- for (String name : dir.list()) {
- File file = new File(dir, name);
- if (file.isDirectory()) {
- addFiles(archive, file, ArchivePaths.create(dest, name));
- } else {
- archive.addResource(file, ArchivePaths.create(dest, name));
- }
- }
- }
-
- protected File getSourceMetaInfDir(String archiveName) {
- String name = "archives/" + archiveName + "/META-INF/MANIFEST.MF";
-
- URL url = Thread.currentThread().getContextClassLoader().getResource(name);
- if (url == null) {
- throw new IllegalArgumentException("No resource called " + name);
- }
- try {
- File file = new File(url.toURI());
- return file.getParentFile();
- } catch (URISyntaxException e) {
- throw new RuntimeException("Could not get file for " + url);
- }
- }
-
- protected File getSourceWebInfDir(String archiveName) {
- String name = "archives/" + archiveName + "/WEB-INF";
-
- URL url = Thread.currentThread().getContextClassLoader().getResource(name);
- if (url == null) {
- return null;
- }
- try {
- return new File(url.toURI());
- } catch (URISyntaxException e) {
- throw new RuntimeException("Could not get file for " + url);
- }
- }
-
- protected File getOutputDir() {
- File file = new File("target");
- if (!file.exists()) {
- throw new IllegalStateException("target/ does not exist");
- }
- if (!file.isDirectory()) {
- throw new IllegalStateException("target/ is not a directory");
- }
- file = new File(file, "archives");
- if (file.exists()) {
- if (!file.isDirectory()) {
- throw new IllegalStateException("target/archives/ already exists and is not a directory");
- }
- } else {
- file.mkdir();
- }
- return file.getAbsoluteFile();
- }
-
- protected File createFile(Archive<?> archive) {
- File file = new File(getOutputDir(), archive.getName());
- archive.as(ZipExporter.class).exportZip(file, true);
- return file;
- }
-
- protected abstract File getFile();
}
- private class Deployment extends AbstractDeployment {
- final File realArchive;
-
- public Deployment(String archiveName, Package[] pkgs, boolean show) {
-
- ArchivePath metaInf = ArchivePaths.create("META-INF");
-
- JavaArchive archive = ShrinkWrap.create(JavaArchive.class, archiveName);
- for (Package pkg : pkgs) {
- archive.addPackage(pkg);
- }
-
- File sourceMetaInf = getSourceMetaInfDir(archiveName);
- addFiles(archive, sourceMetaInf, metaInf);
-
- System.out.println(archive.toString(show));
- realArchive = createFile(archive);
- }
-
- @Override
- protected File getFile() {
- return realArchive;
- }
+ private void cleanup() {
+ StreamUtils.safeClose(client);
}
-
- private class WarDeployment extends AbstractDeployment {
- final File file;
-
- public WarDeployment(String archiveName, Package[] pkgs, boolean show) {
- WebArchive archive = createArchive(archiveName, pkgs);
- file = createFile(archive);
- }
-
- private WebArchive createArchive(String archiveName, Package[] pkgs) {
- ArchivePath metaInf = ArchivePaths.create("META-INF");
-
- WebArchive archive = ShrinkWrap.create(WebArchive.class, archiveName);
- for (Package pkg : pkgs) {
- archive.addPackage(pkg);
- }
-
- File sourceMetaInf = getSourceMetaInfDir(archiveName);
- addFiles(archive, sourceMetaInf, metaInf);
-
- File sourceWebInf = getSourceWebInfDir(archiveName);
- if (sourceWebInf != null) {
- addFiles(archive, sourceWebInf, ArchivePaths.create("WEB-INF"));
- }
- return archive;
- }
-
- @Override
- protected File getFile() {
- return file;
- }
- }
-
- private class WarFileDeployment extends AbstractDeployment {
- final File file;
-
- public WarFileDeployment(File file) {
- this.file = file;
- }
-
- @Override
- protected File getFile() {
- return file;
- }
- }
-
- private class ArbitraryDeployment extends AbstractDeployment {
- final File realArchive;
-
- public ArbitraryDeployment(Archive archive, boolean show) {
-
- ArchivePath metaInf = ArchivePaths.create("META-INF");
-
- System.out.println(archive.toString(show));
- realArchive = createFile(archive);
- }
-
- @Override
- protected File getFile() {
- return realArchive;
- }
- }
}
Modified: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderTest.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderTest.java 2011-04-07 13:00:32 UTC (rev 30415)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderTest.java 2011-04-07 13:50:14 UTC (rev 30416)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
package org.jboss.ide.eclipse.as7.deployment.tests;
import java.io.File;
@@ -2,16 +12,41 @@
import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
import java.net.URISyntaxException;
import java.net.URL;
+import java.net.UnknownHostException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
import org.jboss.ide.eclipse.as7.deployment.DeploymentBuilder;
+import org.junit.Before;
import org.junit.Test;
import org.osgi.framework.Bundle;
+import static junit.framework.Assert.assertTrue;
+
+/**
+ * @author André Dietisheim
+ */
public class DeploymentBuilderTest {
+ private static final String WAR_FOLDER = "wars/";
+
+ private static final String BUNDLE_ID = "org.jboss.ide.eclipse.as7.deployment.tests";
+
private static final String HOST = "localhost";
private static final int PORT = 9999;
+ @Before
+ public void setUp() throws UnknownHostException, IOException {
+ assertAs7IsRunning();
+ }
+
+ private void assertAs7IsRunning() throws UnknownHostException, IOException {
+ Socket socket = new Socket();
+ socket.connect(new InetSocketAddress(HOST, PORT));
+ assertTrue(socket.isConnected());
+ socket.close();
+ }
+
@Test
@@ -22,10 +57,10 @@
new DeploymentBuilder(HOST, PORT).add(file).deploy();
}
- private File getWarFile(String name) {
- Bundle bundle = Platform.getBundle("org.jboss.ide.eclipse.as7.deployment.tests");
- URL entryUrl = bundle.getEntry("wars/" + name);
- File file = new File(FileLocator.resolve(entryUrl).toURI());
+ private File getWarFile(String name) throws URISyntaxException, IOException {
+ Bundle bundle = Platform.getBundle(BUNDLE_ID);
+ URL entryUrl = bundle.getEntry(WAR_FOLDER + name);
+ return new File(FileLocator.resolve(entryUrl).toURI());
}
}
13 years, 3 months
JBoss Tools SVN: r30415 - workspace/adietish.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-04-07 09:00:32 -0400 (Thu, 07 Apr 2011)
New Revision: 30415
Removed:
workspace/adietish/org.jboss.ide.eclipse.as7.core/
Log:
removed deprecated plugin
13 years, 3 months
JBoss Tools SVN: r30414 - in workspace/adietish: org.jboss.ide.eclipse.as7.deployment/META-INF and 19 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-04-07 08:59:19 -0400 (Thu, 07 Apr 2011)
New Revision: 30414
Added:
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/.classpath
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/.project
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/.settings/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/.settings/org.eclipse.jdt.core.prefs
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/META-INF/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/META-INF/MANIFEST.MF
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/build.properties
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/Activator.java
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderTest.java
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/wars/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/wars/gwt-helloworld.war
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/wars/minimalistic.war
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/.classpath
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/.project
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/META-INF/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/META-INF/MANIFEST.MF
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/build.properties
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-as-controller-client-7.0.0.Beta3-SNAPSHOT.jar
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-as-protocol-7.0.0.Beta3-SNAPSHOT.jar
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-dmr-1.0.0.Beta5.jar
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-logging-3.0.0.Beta3.jar
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-marshalling-1.3.0.CR8.jar
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-threads-2.0.0.CR8.jar
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/shrinkwrap-api-1.0.0-alpha-11.jar
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/Activator.java
workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilder.java
Log:
initial commit, POC's working
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/.classpath
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/.classpath (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/.classpath 2011-04-07 12:59:19 UTC (rev 30414)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry exported="true" kind="lib" path="jboss-marshalling-1.3.0.CR8.jar"/>
+ <classpathentry exported="true" kind="lib" path="jboss-logging-3.0.0.Beta3.jar"/>
+ <classpathentry exported="true" kind="lib" path="jboss-threads-2.0.0.CR8.jar"/>
+ <classpathentry exported="true" kind="lib" path="shrinkwrap-api-1.0.0-alpha-11.jar"/>
+ <classpathentry exported="true" kind="lib" path="jboss-dmr-1.0.0.Beta5.jar"/>
+ <classpathentry exported="true" kind="lib" path="jboss-as-controller-client-7.0.0.Beta3-SNAPSHOT.jar" sourcepath="/home/adietish/jboss-workspaces/jboss-tools/jbosstools-src/jboss-as"/>
+ <classpathentry exported="true" kind="lib" path="jboss-as-protocol-7.0.0.Beta3-SNAPSHOT.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/.classpath
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/.project
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/.project (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/.project 2011-04-07 12:59:19 UTC (rev 30414)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.ide.eclipse.as7.deployment</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/.project
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/META-INF/MANIFEST.MF
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/META-INF/MANIFEST.MF (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/META-INF/MANIFEST.MF 2011-04-07 12:59:19 UTC (rev 30414)
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Deployment
+Bundle-SymbolicName: org.jboss.ide.eclipse.as7.deployment
+Bundle-Version: 0.0.1.qualifier
+Bundle-Activator: org.jboss.ide.eclipse.as7.deployment.Activator
+Require-Bundle: org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ClassPath: .,
+ jboss-as-controller-client-7.0.0.Beta3-SNAPSHOT.jar,
+ jboss-as-protocol-7.0.0.Beta3-SNAPSHOT.jar,
+ jboss-dmr-1.0.0.Beta5.jar,
+ shrinkwrap-api-1.0.0-alpha-11.jar,
+ jboss-threads-2.0.0.CR8.jar,
+ jboss-logging-3.0.0.Beta3.jar,
+ jboss-marshalling-1.3.0.CR8.jar
+Export-Package: org.jboss.ide.eclipse.as7.deployment
+Bundle-Vendor: JBoss by Red Hat
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/build.properties
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/build.properties (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/build.properties 2011-04-07 12:59:19 UTC (rev 30414)
@@ -0,0 +1,11 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ jboss-as-controller-client-7.0.0.Beta3-SNAPSHOT.jar,\
+ jboss-as-protocol-7.0.0.Beta3-SNAPSHOT.jar,\
+ jboss-dmr-1.0.0.Beta5.jar,\
+ shrinkwrap-api-1.0.0-alpha-11.jar,\
+ jboss-threads-2.0.0.CR8.jar,\
+ jboss-logging-3.0.0.Beta3.jar,\
+ jboss-marshalling-1.3.0.CR8.jar
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/build.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-as-controller-client-7.0.0.Beta3-SNAPSHOT.jar
===================================================================
(Binary files differ)
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-as-controller-client-7.0.0.Beta3-SNAPSHOT.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-as-protocol-7.0.0.Beta3-SNAPSHOT.jar
===================================================================
(Binary files differ)
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-as-protocol-7.0.0.Beta3-SNAPSHOT.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-dmr-1.0.0.Beta5.jar
===================================================================
(Binary files differ)
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-dmr-1.0.0.Beta5.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-logging-3.0.0.Beta3.jar
===================================================================
(Binary files differ)
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-logging-3.0.0.Beta3.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-marshalling-1.3.0.CR8.jar
===================================================================
(Binary files differ)
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-marshalling-1.3.0.CR8.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-threads-2.0.0.CR8.jar
===================================================================
(Binary files differ)
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/jboss-threads-2.0.0.CR8.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/shrinkwrap-api-1.0.0-alpha-11.jar
===================================================================
(Binary files differ)
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/shrinkwrap-api-1.0.0-alpha-11.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/Activator.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/Activator.java (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/Activator.java 2011-04-07 12:59:19 UTC (rev 30414)
@@ -0,0 +1,30 @@
+package org.jboss.ide.eclipse.as7.deployment;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/Activator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilder.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilder.java (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilder.java 2011-04-07 12:59:19 UTC (rev 30414)
@@ -0,0 +1,252 @@
+package org.jboss.ide.eclipse.as7.deployment;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.controller.client.helpers.standalone.DeploymentPlan;
+import org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder;
+import org.jboss.as.controller.client.helpers.standalone.DuplicateDeploymentNameException;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
+import org.jboss.as.protocol.StreamUtils;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ArchivePath;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.container.ResourceContainer;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+
+public class DeploymentBuilder {
+
+ public static final long DEFAULT_TIMEOUT = 15000;
+
+ private ModelControllerClient client;
+ private ServerDeploymentManager manager;
+ private final List<AbstractDeployment> deployments = new ArrayList<AbstractDeployment>();
+ private long timeout = DEFAULT_TIMEOUT;
+
+ public DeploymentBuilder(String host, int port) throws UnknownHostException {
+ this.client = ModelControllerClient.Factory.create(InetAddress.getByName(host), port);
+ this.manager = ServerDeploymentManager.Factory.create(client);
+ }
+
+ public DeploymentBuilder add(String name, boolean show, Package... pkgs) {
+ deployments.add(new WarDeployment(name, pkgs, show));
+ return this;
+ }
+
+ public DeploymentBuilder add(File file) {
+ deployments.add(new WarFileDeployment(file));
+ return this;
+ }
+
+ public void deploy() {
+ try {
+ DeploymentPlanBuilder builder = manager.newDeploymentPlan();
+ for (AbstractDeployment deployment : deployments) {
+ deployment.addDeployment(manager, builder);
+ }
+ try {
+ DeploymentPlan plan = builder.build();
+ Future<ServerDeploymentPlanResult> planResult = manager.execute(plan);
+ planResult.get(timeout, TimeUnit.MILLISECONDS);
+ } finally {
+ cleanup();
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void cleanup() {
+ StreamUtils.safeClose(client);
+ }
+
+ private abstract class AbstractDeployment {
+
+ boolean deployed;
+ String deploymentName;
+
+ public synchronized DeploymentPlanBuilder addDeployment(ServerDeploymentManager manager, DeploymentPlanBuilder builder)
+ throws DuplicateDeploymentNameException, IOException, ExecutionException, InterruptedException {
+ deploymentName = getFile().getName();
+ System.out.println("Deploying " + deploymentName);
+ return builder.add(deploymentName, getFile()).deploy(deploymentName);
+ }
+
+ public synchronized DeploymentPlanBuilder removeDeployment(DeploymentPlanBuilder builder) {
+ if (deployed) {
+ System.out.println("Undeploying " + deploymentName);
+ return builder.undeploy(deploymentName).remove(deploymentName);
+ } else {
+ return builder;
+ }
+ }
+
+ protected void addFiles(ResourceContainer<?> archive, File dir, ArchivePath dest) {
+ for (String name : dir.list()) {
+ File file = new File(dir, name);
+ if (file.isDirectory()) {
+ addFiles(archive, file, ArchivePaths.create(dest, name));
+ } else {
+ archive.addResource(file, ArchivePaths.create(dest, name));
+ }
+ }
+ }
+
+ protected File getSourceMetaInfDir(String archiveName) {
+ String name = "archives/" + archiveName + "/META-INF/MANIFEST.MF";
+
+ URL url = Thread.currentThread().getContextClassLoader().getResource(name);
+ if (url == null) {
+ throw new IllegalArgumentException("No resource called " + name);
+ }
+ try {
+ File file = new File(url.toURI());
+ return file.getParentFile();
+ } catch (URISyntaxException e) {
+ throw new RuntimeException("Could not get file for " + url);
+ }
+ }
+
+ protected File getSourceWebInfDir(String archiveName) {
+ String name = "archives/" + archiveName + "/WEB-INF";
+
+ URL url = Thread.currentThread().getContextClassLoader().getResource(name);
+ if (url == null) {
+ return null;
+ }
+ try {
+ return new File(url.toURI());
+ } catch (URISyntaxException e) {
+ throw new RuntimeException("Could not get file for " + url);
+ }
+ }
+
+ protected File getOutputDir() {
+ File file = new File("target");
+ if (!file.exists()) {
+ throw new IllegalStateException("target/ does not exist");
+ }
+ if (!file.isDirectory()) {
+ throw new IllegalStateException("target/ is not a directory");
+ }
+ file = new File(file, "archives");
+ if (file.exists()) {
+ if (!file.isDirectory()) {
+ throw new IllegalStateException("target/archives/ already exists and is not a directory");
+ }
+ } else {
+ file.mkdir();
+ }
+ return file.getAbsoluteFile();
+ }
+
+ protected File createFile(Archive<?> archive) {
+ File file = new File(getOutputDir(), archive.getName());
+ archive.as(ZipExporter.class).exportZip(file, true);
+ return file;
+ }
+
+ protected abstract File getFile();
+ }
+
+ private class Deployment extends AbstractDeployment {
+ final File realArchive;
+
+ public Deployment(String archiveName, Package[] pkgs, boolean show) {
+
+ ArchivePath metaInf = ArchivePaths.create("META-INF");
+
+ JavaArchive archive = ShrinkWrap.create(JavaArchive.class, archiveName);
+ for (Package pkg : pkgs) {
+ archive.addPackage(pkg);
+ }
+
+ File sourceMetaInf = getSourceMetaInfDir(archiveName);
+ addFiles(archive, sourceMetaInf, metaInf);
+
+ System.out.println(archive.toString(show));
+ realArchive = createFile(archive);
+ }
+
+ @Override
+ protected File getFile() {
+ return realArchive;
+ }
+ }
+
+ private class WarDeployment extends AbstractDeployment {
+ final File file;
+
+ public WarDeployment(String archiveName, Package[] pkgs, boolean show) {
+ WebArchive archive = createArchive(archiveName, pkgs);
+ file = createFile(archive);
+ }
+
+ private WebArchive createArchive(String archiveName, Package[] pkgs) {
+ ArchivePath metaInf = ArchivePaths.create("META-INF");
+
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, archiveName);
+ for (Package pkg : pkgs) {
+ archive.addPackage(pkg);
+ }
+
+ File sourceMetaInf = getSourceMetaInfDir(archiveName);
+ addFiles(archive, sourceMetaInf, metaInf);
+
+ File sourceWebInf = getSourceWebInfDir(archiveName);
+ if (sourceWebInf != null) {
+ addFiles(archive, sourceWebInf, ArchivePaths.create("WEB-INF"));
+ }
+ return archive;
+ }
+
+ @Override
+ protected File getFile() {
+ return file;
+ }
+ }
+
+ private class WarFileDeployment extends AbstractDeployment {
+ final File file;
+
+ public WarFileDeployment(File file) {
+ this.file = file;
+ }
+
+ @Override
+ protected File getFile() {
+ return file;
+ }
+ }
+
+ private class ArbitraryDeployment extends AbstractDeployment {
+ final File realArchive;
+
+ public ArbitraryDeployment(Archive archive, boolean show) {
+
+ ArchivePath metaInf = ArchivePaths.create("META-INF");
+
+ System.out.println(archive.toString(show));
+ realArchive = createFile(archive);
+ }
+
+ @Override
+ protected File getFile() {
+ return realArchive;
+ }
+ }
+}
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment/src/org/jboss/ide/eclipse/as7/deployment/DeploymentBuilder.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/.classpath
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/.classpath (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/.classpath 2011-04-07 12:59:19 UTC (rev 30414)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/.classpath
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/.project
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/.project (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/.project 2011-04-07 12:59:19 UTC (rev 30414)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.ide.eclipse.as7.deployment.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/.project
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/.settings/org.eclipse.jdt.core.prefs 2011-04-07 12:59:19 UTC (rev 30414)
@@ -0,0 +1,8 @@
+#Thu Apr 07 10:43:42 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/META-INF/MANIFEST.MF
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/META-INF/MANIFEST.MF (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/META-INF/MANIFEST.MF 2011-04-07 12:59:19 UTC (rev 30414)
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tests
+Bundle-SymbolicName: org.jboss.ide.eclipse.as7.deployment.tests
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.jboss.ide.eclipse.as7.deployment
+Require-Bundle: org.junit;bundle-version="[4.8.1,5.0.0)",
+ org.eclipse.core.runtime;bundle-version="3.7.0"
+Bundle-ClassPath: wars/,
+ .
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/build.properties
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/build.properties (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/build.properties 2011-04-07 12:59:19 UTC (rev 30414)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ wars/
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/build.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/Activator.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/Activator.java (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/Activator.java 2011-04-07 12:59:19 UTC (rev 30414)
@@ -0,0 +1,30 @@
+package org.jboss.ide.eclipse.as7.deployment.tests;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+}
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/Activator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderTest.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderTest.java (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderTest.java 2011-04-07 12:59:19 UTC (rev 30414)
@@ -0,0 +1,31 @@
+package org.jboss.ide.eclipse.as7.deployment.tests;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.ide.eclipse.as7.deployment.DeploymentBuilder;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+
+public class DeploymentBuilderTest {
+
+ private static final String HOST = "localhost";
+ private static final int PORT = 9999;
+
+ @Test
+ public void canDeploy() throws URISyntaxException, IOException {
+ File file = getWarFile("minimalistic.war");
+ new DeploymentBuilder(HOST, PORT).add(file).deploy();
+ }
+
+ private File getWarFile(String name) {
+ Bundle bundle = Platform.getBundle("org.jboss.ide.eclipse.as7.deployment.tests");
+ URL entryUrl = bundle.getEntry("wars/" + name);
+ File file = new File(FileLocator.resolve(entryUrl).toURI());
+
+ }
+}
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/wars/gwt-helloworld.war
===================================================================
(Binary files differ)
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/wars/gwt-helloworld.war
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/wars/minimalistic.war
===================================================================
(Binary files differ)
Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/wars/minimalistic.war
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
13 years, 3 months
JBoss Tools SVN: r30412 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-04-07 08:37:28 -0400 (Thu, 07 Apr 2011)
New Revision: 30412
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMappingImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntityImpl.java
Log:
TypeDef update
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMappingImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMappingImpl.java 2011-04-07 12:23:46 UTC (rev 30411)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMappingImpl.java 2011-04-07 12:37:28 UTC (rev 30412)
@@ -64,7 +64,7 @@
@Override
public void synchronizeWithResourceModel() {
super.synchronizeWithResourceModel();
- this.typeDefContainer.synchronizeWithResourceModel();
+ this.typeDefContainer.initialize(this.getResourcePersistentAttribute());
this.specifiedGenerationTime = this.getResourceGenerationTime();
this.syncIndex();
this.syncType();
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntityImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntityImpl.java 2011-04-07 12:23:46 UTC (rev 30411)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntityImpl.java 2011-04-07 12:37:28 UTC (rev 30412)
@@ -76,7 +76,7 @@
public void synchronizeWithResourceModel() {
super.synchronizeWithResourceModel();
this.cacheable.synchronizeWithResourceModel();
- this.typeDefContainer.synchronizeWithResourceModel();
+ this.typeDefContainer.initialize(this.getResourcePersistentType());
this.syncDiscriminatorFormula();
this.syncForeignKey();
}
@@ -85,7 +85,7 @@
public void update() {
super.update();
this.cacheable.update();
- this.typeDefContainer.update();
+ this.typeDefContainer.update(this.getResourcePersistentType());
if (discriminatorFormula != null){
this.discriminatorFormula.update();
}
13 years, 3 months