JBoss Tools SVN: r30611 - in trunk/cdi/tests/org.jboss.tools.cdi.core.test: src/org/jboss/tools/cdi/core/test/tck and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-15 16:56:22 -0400 (Fri, 15 Apr 2011)
New Revision: 30611
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/Zoo.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ResolutionByTypeTest.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java
Log:
JBIDE-8736
https://issues.jboss.org/browse/JBIDE-8736
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/Zoo.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/Zoo.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/Zoo.java 2011-04-15 20:56:22 UTC (rev 30611)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.jsr299.tck.tests.jbt.resolution;
+
+import java.util.List;
+import java.util.ArrayList;
+import javax.inject.Inject;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Typed;
+
+import org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.*;
+
+public class Zoo {
+
+ @Produces @Typed(List.class)
+ private ArrayList<Cat<European>> catsProducer = new ArrayList<Cat<European>>();
+
+ @Produces @Typed(List.class)
+ public ArrayList<Lion> getLions() {
+ return new ArrayList<Lion>();
+ }
+
+ @Inject
+ List<Cat<European>> cats;
+
+ @Inject
+ List<Lion> lions;
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/Zoo.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ResolutionByTypeTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ResolutionByTypeTest.java 2011-04-15 20:43:13 UTC (rev 30610)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ResolutionByTypeTest.java 2011-04-15 20:56:22 UTC (rev 30611)
@@ -18,7 +18,9 @@
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
+import org.jboss.tools.cdi.core.IInjectionPointField;
import org.jboss.tools.cdi.core.IParametedType;
+import org.jboss.tools.cdi.core.IProducerField;
import org.jboss.tools.cdi.core.IProducerMethod;
import org.jboss.tools.cdi.core.IQualifierDeclaration;
import org.jboss.tools.common.EclipseUtil;
@@ -200,7 +202,7 @@
assertContainsBeanTypes(false, bean, "java.lang.Object");
assertContainsBeanTypes(false, bean, "org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.FlightlessBird");
- assertContainsBeanTypeSignatures(false, bean, "Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.FlightlessBird<Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Australian;>;");
+ assertContainsBeanTypeSignatures(false, bean, "Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.FlightlessBird<Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Australian;>;");
}
/**
@@ -235,7 +237,7 @@
assertContainsBeanTypes(false, bean, "java.lang.Object");
assertContainsBeanTypes(false, bean, "org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat");
- assertContainsBeanTypeSignatures(false, bean, "Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat<Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.European;>;");
+ assertContainsBeanTypeSignatures(false, bean, "Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat<Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.European;>;");
beans = getBeans("org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.DomesticCat", "org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Tame");
assertEquals("Wrong number of the beans", 0, beans.size());
@@ -258,7 +260,7 @@
assertContainsBeanTypes(false, bean, "java.lang.Object");
assertContainsBeanTypes(false, bean, "org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat");
- assertContainsBeanTypeSignatures(false, bean, "Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat<Qorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.African;>;");
+ assertContainsBeanTypeSignatures(false, bean, "Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Cat<Lorg.jboss.jsr299.tck.tests.lookup.typesafe.resolution.African;>;");
beans = getBeans("org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Lion", "org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Wild");
assertEquals("Wrong number of the beans", 0, beans.size());
@@ -278,4 +280,21 @@
beans = getBeans("org.jboss.jsr299.tck.tests.lookup.typesafe.resolution.Bird");
assertEquals("Wrong number of the beans", 0, beans.size());
}
+
+ public void testInjectionResolutionOfRestrictedProducerField() throws CoreException {
+ IInjectionPointField injection = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/Zoo.java", "cats");
+ Set<IBean> beans = cdiProject.getBeans(true, injection);
+ assertEquals("Wrong number of the beans", 1, beans.size());
+ IBean bean = beans.iterator().next();
+ assertTrue(bean instanceof IProducerField);
+ }
+
+ public void testInjectionResolutionOfRestrictedProducerMethod() throws CoreException {
+ IInjectionPointField injection = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/Zoo.java", "lions");
+ Set<IBean> beans = cdiProject.getBeans(true, injection);
+ assertEquals("Wrong number of the beans", 1, beans.size());
+ IBean bean = beans.iterator().next();
+ assertTrue(bean instanceof IProducerMethod);
+ }
+
}
\ No newline at end of file
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2011-04-15 20:43:13 UTC (rev 30610)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2011-04-15 20:56:22 UTC (rev 30611)
@@ -3,6 +3,7 @@
import java.io.File;
import java.io.FileFilter;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Set;
import junit.framework.TestCase;
@@ -30,6 +31,7 @@
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IInjectionPointField;
import org.jboss.tools.cdi.core.IParametedType;
+import org.jboss.tools.cdi.core.IProducer;
import org.jboss.tools.cdi.core.IQualifier;
import org.jboss.tools.cdi.core.IQualifierDeclaration;
import org.jboss.tools.cdi.core.test.tck.validation.CoreValidationTest;
@@ -295,6 +297,11 @@
protected IInjectionPointField getInjectionPointField(String beanClassFilePath, String fieldName) {
IFile file = tckProject.getFile(beanClassFilePath);
Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
+ Iterator<IBean> it = beans.iterator();
+ while(it.hasNext()) {
+ IBean b = it.next();
+ if(b instanceof IProducer) it.remove();
+ }
assertEquals("Wrong number of the beans", 1, beans.size());
Set<IInjectionPoint> injections = beans.iterator().next().getInjectionPoints();
for (IInjectionPoint injectionPoint : injections) {
13 years, 7 months
JBoss Tools SVN: r30610 - in trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui: wizards and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: bbrodt
Date: 2011-04-15 16:43:13 -0400 (Fri, 15 Apr 2011)
New Revision: 30610
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/filedialog/FileSelectionGroup.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizardPage1.java
Log:
https://issues.jboss.org/browse/JBIDE-8738
avoid NPE during wizard validation if no current project is selected
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/filedialog/FileSelectionGroup.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/filedialog/FileSelectionGroup.java 2011-04-15 20:42:03 UTC (rev 30609)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/filedialog/FileSelectionGroup.java 2011-04-15 20:43:13 UTC (rev 30610)
@@ -196,6 +196,9 @@
* Sets the selected existing file.
*/
public void setSelectedResource(IResource resource) {
+ // https://issues.jboss.org/browse/JBIDE-8738
+ if (resource==null)
+ return;
selectedResource = resource;
//expand to and select the specified file
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizardPage1.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizardPage1.java 2011-04-15 20:42:03 UTC (rev 30609)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizardPage1.java 2011-04-15 20:43:13 UTC (rev 30610)
@@ -364,8 +364,11 @@
// https://issues.jboss.org/browse/JBIDE-8591
NewFileWizard wiz = (NewFileWizard)getWizard();
- if (!ModuleCoreNature.isFlexibleProject(wiz.getBPELContainer().getProject()))
- setMessage(Messages.NewFileWizard_Not_A_Faceted_Project, WizardPage.WARNING);
+ // https://issues.jboss.org/browse/JBIDE-8738
+ if (wiz.getBPELContainer()!=null) {
+ if (!ModuleCoreNature.isFlexibleProject(wiz.getBPELContainer().getProject()))
+ setMessage(Messages.NewFileWizard_Not_A_Faceted_Project, WizardPage.WARNING);
+ }
else
setMessage(null);
13 years, 7 months
JBoss Tools SVN: r30609 - trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-15 16:42:03 -0400 (Fri, 15 Apr 2011)
New Revision: 30609
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/ELParserImpl.java
Log:
JBIDE-8728
https://issues.jboss.org/browse/JBIDE-8728
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/ELParserImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/ELParserImpl.java 2011-04-15 20:39:54 UTC (rev 30608)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/ELParserImpl.java 2011-04-15 20:42:03 UTC (rev 30609)
@@ -183,7 +183,7 @@
LexicalToken t = lookUpNextToken(current);
if(t != null && t.getType() == OperationTokenDescription.OPERATION && t.getText().equals(":")) { //$NON-NLS-1$
LexicalToken t1 = lookUpNextToken(t);
- if(t1 == null || t1.getType() == EndELTokenDescription.END_EL || t1.getType() == ParamEndTokenDescription.PARAM_END || t1.getType() == ArgEndTokenDescription.ARG_END || t1.getType() == ExprEndTokenDescription.EXPR_END) {
+ if(t1 == null || t1.getType() == EndELTokenDescription.END_EL || t1.getType() == ParamEndTokenDescription.PARAM_END || t1.getType() == ArgEndTokenDescription.ARG_END || t1.getType() == ExprEndTokenDescription.EXPR_END || t1.getType() == OperationTokenDescription.OPERATION) {
t.setType(DotTokenDescription.DOT); //in incomplete expressions prefer function call to operation sign
} else if(t1 != null && t1.getType() == JavaNameTokenDescription.JAVA_NAME) {
LexicalToken t2 = lookUpNextToken(t1);
13 years, 7 months
JBoss Tools SVN: r30608 - in trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7: deployment and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-04-15 16:39:54 -0400 (Fri, 15 Apr 2011)
New Revision: 30608
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/Deployable.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeployerException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeploymentManager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossDeploymentManager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossManagementService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JbossManagementUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/TypedDeployer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/CommandFormatException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/CommandLineException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/DefaultOperationRequestAddress.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/DefaultOperationRequestBuilder.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/OperationFormatException.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/OperationRequestAddress.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/OperationRequestBuilder.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/ValidatingOperationCallbackHandler.java
Log:
as7 management support - initial impl
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/Deployable.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/Deployable.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/Deployable.java 2011-04-15 20:39:54 UTC (rev 30608)
@@ -0,0 +1,95 @@
+package org.jboss.ide.eclipse.as.management.as7.deployment;
+
+import java.io.File;
+import java.text.MessageFormat;
+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.helpers.standalone.DeploymentAction;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentActionResult;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
+import org.jboss.ide.eclipse.as.management.as7.Activator;
+
+public class Deployable {
+
+ private String name;
+ private File file;
+ private Future<ServerDeploymentPlanResult> resultFuture;
+ private long timeout;
+ private DeploymentAction action;
+
+ protected Deployable(String name, File file, long timeout) {
+ this.name = name;
+ this.file = file;
+ this.timeout = timeout;
+ }
+
+ protected void setDeploymentAction(DeploymentAction action) {
+ this.action = action;
+ }
+
+ protected void setResultFuture(Future<ServerDeploymentPlanResult> resultFuture) {
+ this.resultFuture = resultFuture;
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public IStatus getStatus() throws DeployerException {
+ 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 DeployerException(e);
+ }
+ }
+
+ private IStatus createStatus(DeploymentAction action, ServerDeploymentActionResult actionResult) {
+ if (actionResult == null) {
+ return null;
+ }
+
+ 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));
+ }
+}
\ No newline at end of file
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeployerException.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeployerException.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeployerException.java 2011-04-15 20:39:54 UTC (rev 30608)
@@ -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.as.management.as7.deployment;
+
+/**
+ * @author André Dietisheim
+ */
+public class DeployerException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public DeployerException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public DeployerException(Throwable cause) {
+ super(cause);
+ }
+
+ public DeployerException(String message) {
+ super(message);
+ }
+
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeploymentManager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeploymentManager.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DeploymentManager.java 2011-04-15 20:39:54 UTC (rev 30608)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.deployment;
+
+import static org.jboss.as.protocol.StreamUtils.safeClose;
+
+import java.io.File;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
+
+/**
+ * Used to deploy/undeploy deployments to a running <b>standalone</b>
+ * application server
+ *
+ * @author <a href="adietish(a)redhat.com">André Dietisheim</a>
+ */
+public class DeploymentManager {
+
+ public static final long DEFAULT_TIMEOUT = 15000;
+
+ private final List<IDeploymentPlanBuilderOperation> deployments = new ArrayList<IDeploymentPlanBuilderOperation>();
+ private final ModelControllerClient client;
+ private final ServerDeploymentManager manager;
+ private long timeout = DEFAULT_TIMEOUT;
+
+ public DeploymentManager(String host, int port) throws UnknownHostException {
+ client = ModelControllerClient.Factory.create(host, port);
+ manager = ServerDeploymentManager.Factory.create(client);
+ }
+
+ public synchronized DeploymentManager deploy(File file) {
+ deployments.add(new DeployOperation(file));
+ return this;
+ }
+
+ public synchronized DeploymentManager deploy(String name, File file) {
+ deployments.add(new DeployOperation(name, file));
+ return this;
+ }
+
+ public synchronized DeploymentManager undeploy(String name) {
+ deployments.add(new UndeployOperation(name));
+ return this;
+ }
+
+ public synchronized DeploymentManager undeploy(File file) {
+ deployments.add(new UndeployOperation(file));
+ return this;
+ }
+
+ public synchronized void execute() throws DeployerException {
+ try {
+ DeploymentPlanBuilder builder = manager.newDeploymentPlan();
+ for (IDeploymentPlanBuilderOperation deployment : deployments) {
+ builder = deployment.addTo(builder);
+ }
+ manager.execute(builder.build()).get(timeout, TimeUnit.MILLISECONDS);
+ } catch (Exception e) {
+ throw new DeployerException(e);
+ }
+ }
+
+ public void setTimeout(long timeout) {
+ this.timeout = timeout;
+ }
+
+ public void dispose() {
+ safeClose(client);
+ }
+
+ private static class DeployOperation extends FileOperation {
+
+ private DeployOperation(File file) {
+ super(file);
+ }
+
+ private DeployOperation(String name, File file) {
+ super(name, file);
+ }
+
+ public synchronized DeploymentPlanBuilder addTo(DeploymentPlanBuilder builder) throws Exception {
+ String name = getName();
+ return builder.add(name, getFile()).deploy(name);
+ }
+ }
+
+ private static class UndeployOperation extends FileOperation {
+
+ private UndeployOperation(File file) {
+ super(file);
+ }
+
+ private UndeployOperation(String name) {
+ super(name, null);
+ }
+
+ public synchronized DeploymentPlanBuilder addTo(DeploymentPlanBuilder builder) throws Exception {
+ String name = getName();
+ return builder.undeploy(name).undeploy(name);
+ }
+ }
+
+ private abstract static class FileOperation extends NamedOperation {
+
+ private File file;
+
+ private FileOperation(File file) {
+ this(null, file);
+ }
+
+ private FileOperation(String name, File file) {
+ super(name);
+ this.file = file;
+ }
+
+ protected File getFile() {
+ return file;
+ }
+
+ protected String getName() {
+ if (name != null) {
+ return name;
+ } else {
+ return file.getName();
+ }
+ }
+
+ }
+
+ private abstract static class NamedOperation implements IDeploymentPlanBuilderOperation {
+
+ protected String name;
+
+ private NamedOperation(String name) {
+ this.name = name;
+ }
+ }
+
+ private interface IDeploymentPlanBuilderOperation {
+
+ public DeploymentPlanBuilder addTo(DeploymentPlanBuilder builder) throws Exception;
+
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java 2011-04-15 20:39:54 UTC (rev 30608)
@@ -0,0 +1,143 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.deployment;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.UnknownHostException;
+import java.util.List;
+import java.util.concurrent.CancellationException;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.controller.client.Operation;
+import org.jboss.as.controller.client.OperationBuilder;
+import org.jboss.as.protocol.StreamUtils;
+import org.jboss.dmr.ModelNode;
+
+/**
+ * @author André Dietisheim
+ */
+public class DetypedDeployer {
+
+ public static void undeploy(String name, String host, int port) throws DeployerException {
+ ModelControllerClient client = null;
+ try {
+ client = ModelControllerClient.Factory.create(host, port);
+ // undeploy
+ ModelNode request = new ModelNode();
+ request.get("operation").set("undeploy");
+ request.get("address").add("deployment", name);
+ ModelNode result = client.execute(request);
+ throwOnFailure(result);
+
+ // remove
+ request = new ModelNode();
+ request.get("operation").set("remove");
+ request.get("address").add("deployment", name);
+ result = client.execute(request);
+ } catch (Exception e) {
+ throw new DeployerException(e);
+ } finally {
+ StreamUtils.safeClose(client);
+ }
+ }
+
+ public static void deploy(File file, String host, int port) throws DeployerException {
+ deploy(file.getName(), file, host, port);
+ }
+
+ public static void deploy(String name, File file, String host, int port) throws DeployerException {
+ ModelControllerClient client = null;
+ try {
+ client = ModelControllerClient.Factory.create(host, port);
+
+ ModelNode request = new ModelNode();
+ request.get("operation").set("add");
+ request.get("address").add("deployment", name);
+ request.get("enabled").set(true);
+
+ OperationBuilder builder = OperationBuilder.Factory.create(request);
+ builder.addInputStream(new BufferedInputStream(new FileInputStream(file)));
+ Operation operation = builder.build();
+ request.get("input-stream-index").set(0);
+
+ ModelNode result = client.execute(operation);
+ System.out.println(result);
+
+ throwOnFailure(result);
+ } catch (Exception e) {
+ throw new DeployerException(e);
+ } finally {
+ StreamUtils.safeClose(client);
+ }
+ }
+
+ public static void replace(String name, File file, String host, int port) throws DeployerException {
+ ModelControllerClient client = null;
+ try {
+ client = ModelControllerClient.Factory.create(host, port);
+
+ ModelNode request = new ModelNode();
+ request.get("operation").set("full-replace-deployment");
+ request.get("name").set(name);
+
+ OperationBuilder builder = OperationBuilder.Factory.create(request);
+ builder.addInputStream(new BufferedInputStream(new FileInputStream(file)));
+ Operation operation = builder.build();
+ request.get("input-stream-index").set(0);
+
+ ModelNode result = client.execute(operation);
+
+ throwOnFailure(result);
+ } catch (Exception e) {
+ throw new DeployerException(e);
+ } finally {
+ StreamUtils.safeClose(client);
+ }
+ }
+
+ public static boolean isDeployed(String name, String host, int port) throws CancellationException, IOException {
+ ModelControllerClient client = ModelControllerClient.Factory.create(host, port);
+ try {
+ return JbossManagementUtil.isDeployed(name, client);
+ } finally {
+ StreamUtils.safeClose(client);
+ }
+ }
+
+ public static List<String> getDeployments(String host, int port) throws UnknownHostException {
+ ModelControllerClient client = ModelControllerClient.Factory.create(host, port);
+ return JbossManagementUtil.getDeployments(client);
+ }
+
+ private static void throwOnFailure(ModelNode result) throws DeployerException {
+ if (!JbossManagementUtil.isSuccess(result)) {
+ throw new DeployerException(JbossManagementUtil.getFailureDescription(result));
+ }
+ }
+
+ private DetypedDeployer() {
+ // inhibit instantiation
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossDeploymentManager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossDeploymentManager.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossDeploymentManager.java 2011-04-15 20:39:54 UTC (rev 30608)
@@ -0,0 +1,35 @@
+package org.jboss.ide.eclipse.as.management.as7.deployment;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentManager;
+import org.jboss.ide.eclipse.as.management.as7.deployment.TypedDeployer.DeploymentResult;
+
+public class JBossDeploymentManager implements IJBoss7DeploymentManager {
+
+ public DeploymentResult deployAsync(String host, int port, String deploymentName,
+ File file, IProgressMonitor monitor) throws Exception {
+ TypedDeployer deployer = new TypedDeployer(host, port);
+ return deployer.deploy(deploymentName, file);
+ }
+
+ public DeploymentResult deploySync(String host, int port, String deploymentName,
+ File file, IProgressMonitor monitor) throws Exception {
+ TypedDeployer deployer = new TypedDeployer(host, port);
+ return deployer.deploySync(deploymentName, file, monitor);
+ }
+
+ public DeploymentResult undeployAsync(String host, int port, String deploymentName,
+ boolean removeFile, IProgressMonitor monitor) throws Exception {
+ TypedDeployer deployer = new TypedDeployer(host, port);
+ return deployer.undeploy(deploymentName);
+ }
+
+ public DeploymentResult syncUndeploy(String host, int port, String deploymentName,
+ boolean removeFile, IProgressMonitor monitor) throws Exception {
+ TypedDeployer deployer = new TypedDeployer(host, port);
+ return deployer.undeploySync(deploymentName, monitor);
+ }
+
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossManagementService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossManagementService.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossManagementService.java 2011-04-15 20:39:54 UTC (rev 30608)
@@ -0,0 +1,24 @@
+package org.jboss.ide.eclipse.as.management.as7.deployment;
+
+import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentManager;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7ManagementInterface;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7ManagementService;
+
+
+public class JBossManagementService implements IJBoss7ManagementService {
+
+ private IJBoss7DeploymentManager deploymentManager = null;
+ private IJBoss7ManagementInterface manager = null;
+
+ public IJBoss7DeploymentManager getDeploymentManager() {
+ if( deploymentManager == null )
+ deploymentManager = new JBossDeploymentManager();
+ return deploymentManager;
+ }
+
+ public IJBoss7ManagementInterface getManagementInterface() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JbossManagementUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JbossManagementUtil.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JbossManagementUtil.java 2011-04-15 20:39:54 UTC (rev 30608)
@@ -0,0 +1,166 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.deployment;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.dmr.ModelNode;
+import org.jboss.dmr.Property;
+import org.jboss.ide.eclipse.as.management.as7.internal.DefaultOperationRequestBuilder;
+import org.jboss.ide.eclipse.as.management.as7.internal.OperationFormatException;
+
+/**
+ *
+ * @author Alexey Loubyansky
+ */
+public class JbossManagementUtil {
+
+ public static boolean isSuccess(ModelNode operationResult) {
+ if(operationResult != null) {
+ ModelNode outcome = operationResult.get("outcome");
+ return outcome != null && outcome.asString().equals("success");
+ }
+ return false;
+ }
+
+ public static String getFailureDescription(ModelNode operationResult) {
+ if(operationResult == null) {
+ return null;
+ }
+
+ ModelNode descr = operationResult.get("failure-description");
+ if(descr == null) {
+ return null;
+ }
+
+ return descr.asString();
+ }
+
+ public static List<String> getList(ModelNode operationResult) {
+ if(!operationResult.hasDefined("result"))
+ return Collections.emptyList();
+
+ List<ModelNode> nodeList = operationResult.get("result").asList();
+ if(nodeList.isEmpty())
+ return Collections.emptyList();
+
+ List<String> list = new ArrayList<String>(nodeList.size());
+ for(ModelNode node : nodeList) {
+ list.add(node.asString());
+ }
+ return list;
+ }
+
+ public static byte[] getHash(ModelNode operationResult) {
+ if(!operationResult.hasDefined("result"))
+ return null;
+ return operationResult.get("result").asBytes();
+ }
+
+ public static List<String> getRequestPropertyNames(ModelNode operationResult) {
+ if(!operationResult.hasDefined("result"))
+ return Collections.emptyList();
+
+ ModelNode result = operationResult.get("result");
+ if(!result.hasDefined("request-properties"))
+ return Collections.emptyList();
+
+ List<Property> nodeList = result.get("request-properties").asPropertyList();
+ if(nodeList.isEmpty())
+ return Collections.emptyList();
+
+ List<String> list = new ArrayList<String>(nodeList.size());
+ for(Property node : nodeList) {
+ list.add(node.getName());
+ }
+ return list;
+ }
+
+ public static boolean isDeployed(String name, ModelControllerClient client) {
+ return getDeployments(client).contains(name);
+ }
+
+ public static List<String> getDeployments(ModelControllerClient client) {
+
+ DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
+ final ModelNode request;
+ try {
+ builder.operationName("read-children-names");
+ builder.addProperty("child-type", "deployment");
+ request = builder.buildRequest();
+ } catch (OperationFormatException e) {
+ throw new IllegalStateException("Failed to build operation", e);
+ }
+
+ try {
+ ModelNode outcome = client.execute(request);
+ if (isSuccess(outcome)) {
+ return getList(outcome);
+ }
+ } catch (Exception e) {
+ }
+
+ return Collections.emptyList();
+ }
+
+ public static List<String> getJmsResources(ModelControllerClient client, String type) {
+
+ DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
+ final ModelNode request;
+ try {
+ builder.addNode("subsystem", "jms");
+ builder.operationName("read-children-names");
+ builder.addProperty("child-type", type);
+ request = builder.buildRequest();
+ } catch (OperationFormatException e) {
+ throw new IllegalStateException("Failed to build operation", e);
+ }
+
+ try {
+ ModelNode outcome = client.execute(request);
+ if (isSuccess(outcome)) {
+ return getList(outcome);
+ }
+ } catch (Exception e) {
+ }
+
+ return Collections.emptyList();
+ }
+
+ public static boolean isTopic(ModelControllerClient client, String name) {
+ List<String> topics = getJmsResources(client, "topic");
+ return topics.contains(name);
+ }
+
+ public static boolean isQueue(ModelControllerClient client, String name) {
+ List<String> queues = getJmsResources(client, "queue");
+ return queues.contains(name);
+ }
+
+ public static boolean isConnectionFactory(ModelControllerClient client, String name) {
+ List<String> cf = getJmsResources(client, "connection-factory");
+ return cf.contains(name);
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/TypedDeployer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/TypedDeployer.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/TypedDeployer.java 2011-04-15 20:39:54 UTC (rev 30608)
@@ -0,0 +1,202 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.deployment;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.UnknownHostException;
+import java.text.MessageFormat;
+import java.util.concurrent.Future;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+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.DeploymentPlanBuilder;
+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;
+import org.jboss.ide.eclipse.as.management.as7.Activator;
+
+/**
+ *
+ * @author André Dietisheim
+ */
+public class TypedDeployer {
+
+ private ModelControllerClient client;
+ private ServerDeploymentManager manager;
+
+ public TypedDeployer(String host, int port) throws UnknownHostException {
+ this.client = ModelControllerClient.Factory.create(host, port);
+ this.manager = ServerDeploymentManager.Factory.create(client);
+ }
+
+ public DeploymentResult undeploySync(String name, IProgressMonitor monitor) throws DeployerException {
+ DeploymentResult result = undeploy(name);
+ result.getStatus();
+ return result;
+ }
+
+ public DeploymentResult deploySync(String name, File file, IProgressMonitor monitor) throws DeployerException {
+ DeploymentResult result = deploy(name, file);
+ result.getStatus();
+ return result;
+ }
+
+ public DeploymentResult undeploy(String name) throws DeployerException {
+ try {
+ DeploymentPlanBuilder builder = manager.newDeploymentPlan();
+ builder = builder.undeploy(name).andRemoveUndeployed();
+ return new DeploymentResult(builder.getLastAction(), manager.execute(builder.build()));
+ } catch (Exception e) {
+ throw new DeployerException(e);
+ }
+ }
+
+ public DeploymentResult deploy(File file) throws DeployerException {
+ return deploy(file.getName(), file);
+ }
+
+ public DeploymentResult deploy(String name, File file) throws DeployerException {
+ try {
+ return execute(manager.newDeploymentPlan().add(name, file).andDeploy());
+ } catch (IOException e) {
+ throw new DeployerException(e);
+ }
+ }
+
+ public DeploymentResult replace(File file) throws DeployerException {
+ return replace(file.getName(), file);
+ }
+
+ public DeploymentResult replace(String name, File file) throws DeployerException {
+ try {
+ return execute(manager.newDeploymentPlan().replace(name, file));
+ } catch (IOException e) {
+ throw new DeployerException(e);
+ }
+ }
+
+ private DeploymentResult execute(DeploymentPlanBuilder builder) throws DeployerException {
+ try {
+ DeploymentAction action = builder.getLastAction();
+ Future<ServerDeploymentPlanResult> planResult = manager.execute(builder.build());
+ return new DeploymentResult(action, planResult);
+ } catch (Exception e) {
+ throw new DeployerException(e);
+ }
+ }
+
+ //
+ // public static boolean isDeployed(String name, String host, int port)
+ // throws CancellationException, IOException {
+ // ModelControllerClient client = ModelControllerClient.Factory.create(host,
+ // port);
+ // try {
+ // return Util.isDeployed(name, client);
+ // } finally {
+ // StreamUtils.safeClose(client);
+ // }
+ // }
+ //
+ // public static List<String> getDeployments(String host, int port) throws
+ // UnknownHostException {
+ // ModelControllerClient client = ModelControllerClient.Factory.create(host,
+ // port);
+ // return Util.getDeployments(client);
+ // }
+ //
+ // private static void throwOnFailure(ModelNode result) throws
+ // DeployerException {
+ // if (!Util.isSuccess(result)) {
+ // throw new DeployerException(Util.getFailureDescription(result));
+ // }
+ // }
+
+ public void dispose() {
+ StreamUtils.safeClose(client);
+ }
+
+ public static class DeploymentResult {
+
+ private Future<ServerDeploymentPlanResult> planResult;
+ private DeploymentAction action;
+
+ public DeploymentResult(DeploymentAction action, Future<ServerDeploymentPlanResult> planResult) {
+ Assert.isNotNull(action);
+ this.action = action;
+ Assert.isNotNull(planResult);
+ this.planResult = planResult;
+ }
+
+ public IStatus getStatus() throws DeployerException {
+ try {
+ ServerDeploymentActionResult actionResult = planResult.get().getDeploymentActionResult(action.getId());
+ return createStatus(action.getDeploymentUnitUniqueName(), action.getType().name(), actionResult);
+ } catch (Exception e) {
+ throw new DeployerException(e);
+ }
+ }
+
+ private IStatus createStatus(String deploymentName, String actionName, ServerDeploymentActionResult actionResult) {
+ if (actionResult == null) {
+ return null;
+ }
+
+ IStatus status = null;
+ switch (actionResult.getResult()) {
+ case NOT_EXECUTED:
+ status = createStatus(IStatus.ERROR, "The operation {0} was not executed on unit {1}",
+ actionName, deploymentName);
+ break;
+ case EXECUTED:
+ status = Status.OK_STATUS;
+ break;
+ case FAILED:
+ status = createStatus(IStatus.ERROR, "The operation {0} failed for unit {1}",
+ actionName, deploymentName);
+ break;
+ case ROLLED_BACK:
+ status = createStatus(IStatus.ERROR, "The operation {0} for unit {1} was rolled back",
+ actionName, deploymentName);
+ 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",
+ actionName, deploymentName);
+ break;
+ }
+ return status;
+ }
+
+ private IStatus createStatus(int severity, String messagePattern, Object... messageArguments) {
+ return new Status(severity, Activator.getContext().getBundle().getSymbolicName(), MessageFormat.format(
+ messagePattern, messageArguments));
+ }
+ }
+
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/CommandFormatException.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/CommandFormatException.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/CommandFormatException.java 2011-04-15 20:39:54 UTC (rev 30608)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.internal;
+
+/**
+ * @author Alexey Loubyansky
+ *
+ */
+public class CommandFormatException extends CommandLineException {
+
+ private static final long serialVersionUID = -5802389813870206943L;
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public CommandFormatException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * @param message
+ */
+ public CommandFormatException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param cause
+ */
+ public CommandFormatException(Throwable cause) {
+ super(cause);
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/CommandLineException.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/CommandLineException.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/CommandLineException.java 2011-04-15 20:39:54 UTC (rev 30608)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.internal;
+
+/**
+ * @author Alexey Loubyansky
+ *
+ */
+public class CommandLineException extends Exception {
+
+ private static final long serialVersionUID = 423938082439473323L;
+
+ public CommandLineException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public CommandLineException(String message) {
+ super(message);
+ }
+
+ public CommandLineException(Throwable cause) {
+ super(cause);
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/DefaultOperationRequestAddress.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/DefaultOperationRequestAddress.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/DefaultOperationRequestAddress.java 2011-04-15 20:39:54 UTC (rev 30608)
@@ -0,0 +1,258 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.internal;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This implementation is not thread-safe.
+ *
+ * @author Alexey Loubyansky
+ */
+public class DefaultOperationRequestAddress implements OperationRequestAddress {
+
+ private final List<NodeImpl> nodes = new ArrayList<NodeImpl>();
+
+ public DefaultOperationRequestAddress() {
+ }
+
+ /**
+ * Creates a prefix and initializes it to the value of the argument.
+ * @param initial the initial value
+ */
+ public DefaultOperationRequestAddress(OperationRequestAddress initial) {
+ if(!initial.isEmpty()) {
+ for(Node node : initial) {
+ toNode(node.getType(), node.getName());
+ }
+ }
+ }
+
+ @Override
+ public void toNodeType(String nodeType) {
+
+ nodes.add(new NodeImpl(nodeType, null));
+ }
+
+ @Override
+ public void toNode(String nodeName) {
+
+ if(nodes.isEmpty())
+ throw new IllegalStateException("The prefix should end with the node type before going to a specific node name.");
+
+ nodes.get(nodes.size() - 1).name = nodeName;
+ }
+
+ @Override
+ public void toNode(String nodeType, String nodeName) {
+
+ if(endsOnType()) {
+ throw new IllegalStateException("The prefix ends on a type. A node name must be specified before this method can be invoked.");
+ }
+ nodes.add(new NodeImpl(nodeType, nodeName));
+ }
+
+ @Override
+ public String toNodeType() {
+
+ if(nodes.isEmpty()) {
+ return null;
+ }
+ String name = nodes.get(nodes.size() - 1).name;
+ nodes.get(nodes.size() - 1).name = null;
+ return name;
+ }
+
+ @Override
+ public Node toParentNode() {
+
+ if(nodes.isEmpty()) {
+ return null;
+ }
+ return nodes.remove(nodes.size() - 1);
+ }
+
+ @Override
+ public void reset() {
+ nodes.clear();
+ }
+
+ @Override
+ public boolean endsOnType() {
+ if(nodes.isEmpty()) {
+ return false;
+ }
+
+ NodeImpl node = nodes.get(nodes.size() - 1);
+ return node.name == null;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return nodes.isEmpty();
+ }
+
+ @Override
+ public Iterator<Node> iterator() {
+
+ final Node[] array = nodes.toArray(new Node[nodes.size()]);
+ return new Iterator<Node>() {
+
+ int i = 0;
+
+ @Override
+ public boolean hasNext() {
+ return i < array.length;
+ }
+
+ @Override
+ public Node next() {
+ return array[i++];
+ }
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ };
+ }
+
+ @Override
+ public String getNodeType() {
+
+ if(nodes.isEmpty()) {
+ return null;
+ }
+ return nodes.get(nodes.size() - 1).type;
+ }
+
+ @Override
+ public String getNodeName() {
+
+ if(nodes.isEmpty()) {
+ return null;
+ }
+ return nodes.get(nodes.size() - 1).name;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((nodes == null) ? 0 : nodes.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (!(obj instanceof OperationRequestAddress))
+ return false;
+
+ OperationRequestAddress other = (OperationRequestAddress) obj;
+
+ if(isEmpty() != other.isEmpty())
+ return false;
+
+ Iterator<Node> thisIterator = iterator();
+ Iterator<Node> otherIterator = other.iterator();
+ boolean result = true;
+ while(result) {
+ if(!thisIterator.next().equals(otherIterator.next())) {
+ result = false;
+ } else {
+ if (!thisIterator.hasNext()) {
+ if (otherIterator.hasNext()) {
+ result = false;
+ }
+ break;
+ }
+ if (!otherIterator.hasNext()) {
+ if (thisIterator.hasNext()) {
+ result = false;
+ }
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ private static final class NodeImpl implements Node {
+
+ String type;
+ String name;
+
+ NodeImpl(String type, String name) {
+ this.type = type;
+ this.name = name;
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+
+ if(!(obj instanceof Node))
+ return false;
+
+ Node other = (Node) obj;
+ if (name == null) {
+ if (other.getName() != null)
+ return false;
+ } else if (!name.equals(other.getName()))
+ return false;
+ if (type == null) {
+ if (other.getType() != null)
+ return false;
+ } else if (!type.equals(other.getType()))
+ return false;
+ return true;
+ }
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/DefaultOperationRequestBuilder.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/DefaultOperationRequestBuilder.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/DefaultOperationRequestBuilder.java 2011-04-15 20:39:54 UTC (rev 30608)
@@ -0,0 +1,234 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.internal;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.ide.eclipse.as.management.as7.internal.OperationRequestAddress.Node;
+
+/**
+ *
+ * @author Alexey Loubyansky
+ */
+public class DefaultOperationRequestBuilder extends ValidatingOperationCallbackHandler implements OperationRequestBuilder {
+
+ private ModelNode request = new ModelNode();
+ private OperationRequestAddress prefix;
+
+ public DefaultOperationRequestBuilder() {
+ this.prefix = new DefaultOperationRequestAddress();
+ }
+
+ public DefaultOperationRequestBuilder(OperationRequestAddress prefix) {
+ if(prefix == null) {
+ throw new IllegalArgumentException("Prefix can't be null");
+ }
+ this.prefix = new DefaultOperationRequestAddress(prefix);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#rootNode()
+ */
+ public void rootNode() {
+ prefix.reset();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#parentNode()
+ */
+ public void parentNode() {
+ prefix.toParentNode();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#nodeType()
+ */
+ public void nodeType() {
+ prefix.toNodeType();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#nodeTypeNameSeparator(int)
+ */
+ public void nodeTypeNameSeparator(int index) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#nodeSeparator(int)
+ */
+ public void nodeSeparator(int index) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#addressOperationSeparator(int)
+ */
+ public void addressOperationSeparator(int index) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#operationName(java.lang.String)
+ */
+ @Override
+ public void validatedOperationName(String operationName) {
+ this.setOperationName(operationName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#propertyListStart(int)
+ */
+ public void propertyListStart(int index) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#propertyNameValueSeparator(int)
+ */
+ public void propertyNameValueSeparator(int index) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#propertySeparator(int)
+ */
+ public void propertySeparator(int index) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#propertyListEnd(int)
+ */
+ public void propertyListEnd(int index) {
+ }
+
+ @Override
+ protected void validatedNodeType(String nodeType)
+ throws OperationFormatException {
+ this.addNodeType(nodeType);
+ }
+
+ @Override
+ protected void validatedNodeName(String nodeName)
+ throws OperationFormatException {
+ this.addNodeName(nodeName);
+ }
+
+ @Override
+ protected void validatedPropertyName(String propertyName)
+ throws OperationFormatException {
+ throw new OperationFormatException("Property '" + propertyName + "' is missing the value.");
+ }
+
+ @Override
+ protected void validatedProperty(String name, String value,
+ int nameValueSeparatorIndex) throws OperationFormatException {
+ this.addProperty(name, value);
+ }
+
+ public void nodeTypeOrName(String typeOrName)
+ throws OperationFormatException {
+
+ if(prefix.endsOnType()) {
+ this.addNodeName(typeOrName);
+ } else {
+ this.addNodeType(typeOrName);
+ }
+ }
+
+ /**
+ * Makes sure that the operation name and the address have been set and returns a ModelNode
+ * representing the operation request.
+ */
+ public ModelNode buildRequest() throws OperationFormatException {
+
+ ModelNode address = request.get("address");
+ if(prefix.isEmpty()) {
+ address.setEmptyList();
+ } else {
+ Iterator<Node> iterator = prefix.iterator();
+ while (iterator.hasNext()) {
+ OperationRequestAddress.Node node = iterator.next();
+ if (node.getName() != null) {
+ address.add(node.getType(), node.getName());
+ } else if (iterator.hasNext()) {
+ throw new OperationFormatException(
+ "The node name is not specified for type '"
+ + node.getType() + "'");
+ }
+ }
+ }
+
+ if(!request.hasDefined("operation")) {
+ throw new OperationFormatException("The operation name is missing or the format of the operation request is wrong.");
+ }
+
+ return request;
+ }
+
+ @Override
+ public void setOperationName(String name) {
+ request.get("operation").set(name);
+ }
+
+ @Override
+ public void addNode(String type, String name) {
+ prefix.toNode(type, name);
+ }
+
+ @Override
+ public void addNodeType(String type) {
+ prefix.toNodeType(type);
+ }
+
+ @Override
+ public void addNodeName(String name) {
+ prefix.toNode(name);
+ }
+
+ @Override
+ public void addProperty(String name, String value) {
+
+ if(name == null || name.trim().isEmpty())
+ throw new IllegalArgumentException("The argument name is not specified: '" + name + "'");
+ if(value == null || value.trim().isEmpty())
+ throw new IllegalArgumentException("The argument value is not specified: '" + value + "'");
+ ModelNode toSet = null;
+ try {
+ toSet = ModelNode.fromString(value);
+ } catch (Exception e) {
+ // just use the string
+ toSet = new ModelNode().set(value);
+ }
+ request.get(name).set(toSet);
+ }
+
+ public ModelNode getModelNode() {
+ return request;
+ }
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ // TODO Auto-generated method stub
+
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/OperationFormatException.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/OperationFormatException.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/OperationFormatException.java 2011-04-15 20:39:54 UTC (rev 30608)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.internal;
+
+
+/**
+ *
+ * @author Alexey Loubyansky
+ */
+public class OperationFormatException extends CommandFormatException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3481664048439674648L;
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public OperationFormatException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param message
+ */
+ public OperationFormatException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param cause
+ */
+ public OperationFormatException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/OperationRequestAddress.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/OperationRequestAddress.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/OperationRequestAddress.java 2011-04-15 20:39:54 UTC (rev 30608)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.internal;
+
+
+
+/**
+ * An instance of this interface represents a prefix for the operation request address part.
+ *
+ * @author Alexey Loubyansky
+ */
+public interface OperationRequestAddress extends Iterable<OperationRequestAddress.Node> {
+
+ /**
+ * Appends the node type to the prefix.
+ * Note, the current prefix must end on the node name before this method
+ * is invoked.
+ *
+ * @param nodeType the node type to append to the prefix.
+ */
+ void toNodeType(String nodeType);
+
+ /**
+ * Appends the node name to the prefix.
+ * Note, the current prefix must end on the node type before this method
+ * is invoked.
+ *
+ * @param nodeName the node name to append to the prefix.
+ */
+ void toNode(String nodeName);
+
+ /**
+ * Appends the node to the prefix.
+ * Note, the current prefix must end on the node (i.e. node name) before
+ * this method is invoked.
+ *
+ * @param nodeType the node type of the node to append to the prefix
+ * @param nodeName the node name of the node to append to the prefix
+ */
+ void toNode(String nodeType, String nodeName);
+
+ /**
+ * Sets the current prefix to the node type of the current node,
+ * i.e. the node name is removed from the end of the prefix.
+ * @return the node name the prefix ended on
+ */
+ String toNodeType();
+
+ /**
+ * Removes the last node in the prefix, i.e. moves the value a node up.
+ * @return the node the prefix ended on
+ */
+ Node toParentNode();
+
+ /**
+ * Resets the prefix, i.e. this will make the prefix empty.
+ */
+ void reset();
+
+ /**
+ * Checks whether the prefix ends on a node type or a node name.
+ * @return true if the prefix ends on a node type, otherwise false.
+ */
+ boolean endsOnType();
+
+ /**
+ * Checks whether the prefix is empty.
+ * @return true if the prefix is empty, otherwise false.
+ */
+ boolean isEmpty();
+
+ /**
+ * Returns the node type of the last node.
+ * @return the node type of the last node or null if the prefix is empty.
+ */
+ String getNodeType();
+
+ /**
+ * Returns the node name of the last node.
+ * @return the node name of the last node or null if the prefix ends
+ * on a type or is empty.
+ */
+ String getNodeName();
+
+ interface Node {
+
+ String getType();
+
+ String getName();
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/OperationRequestBuilder.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/OperationRequestBuilder.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/OperationRequestBuilder.java 2011-04-15 20:39:54 UTC (rev 30608)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.internal;
+
+import org.jboss.dmr.ModelNode;
+
+/**
+ * TODO this is not used for now...
+ *
+ * @author Alexey Loubyansky
+ */
+public interface OperationRequestBuilder {
+
+ /**
+ * Sets the name operation to be invoked.
+ *
+ * @param name the name of the operation to invoke.
+ */
+ void setOperationName(String name);
+
+ /**
+ * The address is specified as a path to the target node. Each element of the path is a node
+ * and is identified by its type and name.
+ *
+ * @param type the type of the node
+ * @param name the name of the node
+ */
+ void addNode(String type, String name);
+
+ /**
+ * This method is supposed to be invoked from applying the prefix with ends on a node type.
+ * @param type the type of the node.
+ */
+ void addNodeType(String type);
+
+ /**
+ * This method assumes there is a non-empty prefix which ends on a node type.
+ * Otherwise, this method will result in an exception.
+ * @param name the name of the node for the type specified by the prefix.
+ */
+ void addNodeName(String name);
+
+ /**
+ * Adds an argument.
+ *
+ * @param name the name of the argument
+ * @param value the value of the argument
+ */
+ void addProperty(String name, String value);
+
+ /**
+ * Builds the operation request based on the collected operation name, address and arguments.
+ *
+ * @return an instance of ModelNode representing the operation request
+ * @throws OperationFormatException
+ */
+ ModelNode buildRequest() throws OperationFormatException;
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/ValidatingOperationCallbackHandler.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/ValidatingOperationCallbackHandler.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/internal/ValidatingOperationCallbackHandler.java 2011-04-15 20:39:54 UTC (rev 30608)
@@ -0,0 +1,131 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.internal;
+
+import java.util.regex.Pattern;
+
+import javax.security.auth.callback.CallbackHandler;
+
+/**
+ *
+ * @author Alexey Loubyansky
+ */
+public abstract class ValidatingOperationCallbackHandler implements CallbackHandler {
+
+ private static final Pattern ALPHANUMERICS_PATTERN = Pattern.compile("[_a-zA-Z](?:[-_a-zA-Z0-9]*[_a-zA-Z0-9])?");
+ private static final Pattern NODE_NAME_PATTERN = Pattern.compile("\\*|[^*\\p{Space}\\p{Cntrl}]+");
+
+
+ protected String operationStr;
+
+ public void start(String operationString) {
+ this.operationStr = operationString;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#nodeType(java.lang.String)
+ */
+ public void nodeType(String nodeType) throws OperationFormatException {
+
+ assertValidType(nodeType);
+ validatedNodeType(nodeType);
+ }
+
+ protected abstract void validatedNodeType(String nodeType) throws OperationFormatException;
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#nodeName(java.lang.String)
+ */
+ public void nodeName(String nodeName) throws OperationFormatException {
+
+ assertValidNodeName(nodeName);
+ validatedNodeName(nodeName);
+ }
+
+ protected abstract void validatedNodeName(String nodeName) throws OperationFormatException;
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#operationName(java.lang.String)
+ */
+ public void operationName(String operationName)
+ throws OperationFormatException {
+
+ if (operationName == null || !ALPHANUMERICS_PATTERN.matcher(operationName).matches()) {
+ throw new OperationFormatException("'" + operationName + "' is not a valid operation name.");
+ }
+
+ validatedOperationName(operationName);
+ }
+
+ protected abstract void validatedOperationName(String operationName) throws OperationFormatException;
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#propertyName(java.lang.String)
+ */
+ public void propertyName(String propertyName)
+ throws OperationFormatException {
+
+ assertValidParameterName(propertyName);
+ validatedPropertyName(propertyName);
+ }
+
+ protected abstract void validatedPropertyName(String propertyName) throws OperationFormatException;
+
+ /* (non-Javadoc)
+ * @see org.jboss.as.cli.operation.OperationParser.CallbackHandler#property(java.lang.String, java.lang.String, int)
+ */
+ public void property(String name, String value, int nameValueSeparatorIndex)
+ throws OperationFormatException {
+
+ assertValidParameterName(name);
+
+ if (value.isEmpty()) {
+ throw new OperationFormatException("Parameter '" + value + "' is missing value.");
+ }
+
+ validatedProperty(name, value, nameValueSeparatorIndex);
+ }
+
+ protected abstract void validatedProperty(String name, String value, int nameValueSeparatorIndex) throws OperationFormatException;
+
+ protected void assertValidType(String nodeType)
+ throws OperationFormatException {
+ if (nodeType == null || !ALPHANUMERICS_PATTERN.matcher(nodeType).matches()) {
+ throw new OperationFormatException("'" + nodeType + "' is not a valid node type name.");
+ }
+ }
+
+ protected void assertValidNodeName(String nodeName)
+ throws OperationFormatException {
+ if (nodeName == null || !NODE_NAME_PATTERN.matcher(nodeName).matches()) {
+ throw new OperationFormatException("'" + nodeName + "' is not a valid node name.");
+ }
+ }
+
+ protected void assertValidParameterName(String name)
+ throws OperationFormatException {
+ if (name == null || !ALPHANUMERICS_PATTERN.matcher(name).matches()) {
+ throw new OperationFormatException("'" + name + "' is not a valid parameter name.");
+ }
+ }
+
+}
13 years, 7 months
JBoss Tools SVN: r30607 - in trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7: META-INF and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-04-15 16:38:55 -0400 (Fri, 15 Apr 2011)
New Revision: 30607
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/build.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/Activator.java
Log:
as7 management support - initial impl
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath 2011-04-15 20:36:15 UTC (rev 30606)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath 2011-04-15 20:38:55 UTC (rev 30607)
@@ -1,5 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry exported="true" kind="lib" path="jboss-as-controller-client-7.0.0.Beta3-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="jboss-as-protocol-7.0.0.Beta3-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="jboss-dmr-1.0.0.Beta5.jar"/>
+ <classpathentry exported="true" kind="lib" path="jboss-logging-3.0.0.Beta3.jar"/>
+ <classpathentry exported="true" kind="lib" path="jboss-marshalling-1.3.0.CR8.jar"/>
+ <classpathentry exported="true" kind="lib" path="jboss-threads-2.0.0.CR8.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"/>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF 2011-04-15 20:36:15 UTC (rev 30606)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF 2011-04-15 20:38:55 UTC (rev 30607)
@@ -5,6 +5,14 @@
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.jboss.ide.eclipse.as.management.as7.Activator
Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime
+ org.eclipse.core.runtime,
+ org.jboss.ide.eclipse.as.core
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,
+ jboss-logging-3.0.0.Beta3.jar,
+ jboss-marshalling-1.3.0.CR8.jar,
+ jboss-threads-2.0.0.CR8.jar,
+ .
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/build.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/build.properties 2011-04-15 20:36:15 UTC (rev 30606)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/build.properties 2011-04-15 20:38:55 UTC (rev 30607)
@@ -1,4 +1,10 @@
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,\
+ jboss-logging-3.0.0.Beta3.jar,\
+ jboss-marshalling-1.3.0.CR8.jar,\
+ jboss-threads-2.0.0.CR8.jar
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/Activator.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/Activator.java 2011-04-15 20:36:15 UTC (rev 30606)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/Activator.java 2011-04-15 20:38:55 UTC (rev 30607)
@@ -20,6 +20,10 @@
public Activator() {
}
+ public static BundleContext getContext() {
+ return plugin.getBundle().getBundleContext();
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
13 years, 7 months
JBoss Tools SVN: r30606 - trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-15 16:36:15 -0400 (Fri, 15 Apr 2011)
New Revision: 30606
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/ELParserImpl.java
Log:
JBIDE-8728
https://issues.jboss.org/browse/JBIDE-8728
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/ELParserImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/ELParserImpl.java 2011-04-15 20:28:12 UTC (rev 30605)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/ELParserImpl.java 2011-04-15 20:36:15 UTC (rev 30606)
@@ -183,7 +183,9 @@
LexicalToken t = lookUpNextToken(current);
if(t != null && t.getType() == OperationTokenDescription.OPERATION && t.getText().equals(":")) { //$NON-NLS-1$
LexicalToken t1 = lookUpNextToken(t);
- if(t1 != null && t1.getType() == JavaNameTokenDescription.JAVA_NAME) {
+ if(t1 == null || t1.getType() == EndELTokenDescription.END_EL || t1.getType() == ParamEndTokenDescription.PARAM_END || t1.getType() == ArgEndTokenDescription.ARG_END || t1.getType() == ExprEndTokenDescription.EXPR_END) {
+ t.setType(DotTokenDescription.DOT); //in incomplete expressions prefer function call to operation sign
+ } else if(t1 != null && t1.getType() == JavaNameTokenDescription.JAVA_NAME) {
LexicalToken t2 = lookUpNextToken(t1);
if(t2 != null && t2.getType() == ParamStartTokenDescription.PARAM_START) {
t.setType(DotTokenDescription.DOT);
13 years, 7 months
JBoss Tools SVN: r30604 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl: definition and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-15 16:27:13 -0400 (Fri, 15 Apr 2011)
New Revision: 30604
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ParametedType.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParametedTypeFactory.java
Log:
JBIDE-8736
https://issues.jboss.org/browse/JBIDE-8736
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2011-04-15 20:26:37 UTC (rev 30603)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2011-04-15 20:27:13 UTC (rev 30604)
@@ -305,8 +305,10 @@
if(!s1.equals(s2) && Signature.getArrayCount(s1) == Signature.getArrayCount(s2)) {
p.setSignature(s2);
}
+ result.add(new TypeDeclaration((ParametedType)other, offset, length));
+ } else {
+ result.add(new TypeDeclaration(p, offset, length));
}
- result.add(new TypeDeclaration(p, offset, length));
}
}
} else if(value != null) {
@@ -331,8 +333,10 @@
if(!s1.equals(s2) && Signature.getArrayCount(s1) == Signature.getArrayCount(s2)) {
p.setSignature(s2);
}
+ result.add(new TypeDeclaration((ParametedType)other, offset, length));
+ } else {
+ result.add(new TypeDeclaration(p, offset, length));
}
- result.add(new TypeDeclaration(p, offset, length));
}
}
} catch (CoreException e) {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java 2011-04-15 20:26:37 UTC (rev 30603)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java 2011-04-15 20:27:13 UTC (rev 30604)
@@ -18,6 +18,7 @@
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.ICDIElement;
import org.jboss.tools.cdi.core.extension.CDIExtensionManager;
+import org.jboss.tools.cdi.internal.core.impl.definition.ParametedTypeFactory;
/**
*
@@ -39,7 +40,7 @@
protected ParametedType getObjectType(IMember context) {
try {
- return getCDIProject().getNature().getTypeFactory().getParametedType(context, "QObject;");
+ return getCDIProject().getNature().getTypeFactory().getParametedType(context, ParametedTypeFactory.OBJECT);
} catch (JavaModelException e) {
CDICorePlugin.getDefault().logError(e);
return null;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ParametedType.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ParametedType.java 2011-04-15 20:26:37 UTC (rev 30603)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ParametedType.java 2011-04-15 20:27:13 UTC (rev 30604)
@@ -176,10 +176,10 @@
CDICorePlugin.getDefault().logError(e);
}
} else if(!"java.lang.Object".equals(type.getFullyQualifiedName())) {
- sc = "QObject;";
+ sc = ParametedTypeFactory.OBJECT;
} else if("java.lang.Object".equals(type.getFullyQualifiedName()) && arrayPrefix.length() > 0) {
objectArray = true;
- sc = "QObject;";
+ sc = ParametedTypeFactory.OBJECT;
}
if(!objectArray && arrayPrefix.length() > 0) {
sc = arrayPrefix + sc;
@@ -240,7 +240,7 @@
}
int i = typeSignature.indexOf('<');
if(i < 0) {
- if(( typeSignature.startsWith("T") || typeSignature.startsWith("Q")) && typeSignature.endsWith(";")) {
+ if(( typeSignature.startsWith("T") || typeSignature.startsWith("Q") || typeSignature.startsWith("L")) && typeSignature.endsWith(";")) {
String param = typeSignature.substring(1, typeSignature.length() - 1);
String s = findParameterSignature(param);
return s == null ? typeSignature : s;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParametedTypeFactory.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParametedTypeFactory.java 2011-04-15 20:26:37 UTC (rev 30603)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParametedTypeFactory.java 2011-04-15 20:27:13 UTC (rev 30604)
@@ -30,14 +30,16 @@
// I S J C F D Z
static HashMap<String,String> primitives = new HashMap<String, String>();
static {
- primitives.put("I", "Qjava.lang.Integer;");
- primitives.put("S", "Qjava.lang.Short;");
- primitives.put("J", "Qjava.lang.Long;");
- primitives.put("C", "Qjava.lang.Character;");
- primitives.put("F", "Qjava.lang.Float;");
- primitives.put("D", "Qjava.lang.Double;");
- primitives.put("Z", "Qjava.lang.Boolean;");
+ primitives.put("I", "Ljava.lang.Integer;");
+ primitives.put("S", "Ljava.lang.Short;");
+ primitives.put("J", "Ljava.lang.Long;");
+ primitives.put("C", "Ljava.lang.Character;");
+ primitives.put("F", "Ljava.lang.Float;");
+ primitives.put("D", "Ljava.lang.Double;");
+ primitives.put("Z", "Ljava.lang.Boolean;");
}
+ //unresolved Object signature
+ public static String OBJECT = "QObject;";
Map<String, ParametedType> cache = new HashMap<String, ParametedType>();
public ParametedType newParametedType(IType type) {
@@ -55,7 +57,7 @@
}
parametedType.setFactory(this);
parametedType.setType(type);
- if(type != null) parametedType.setSignature("Q" + type.getFullyQualifiedName() + ";");
+ if(type != null) parametedType.setSignature("L" + type.getFullyQualifiedName() + ";");
String[] ps = null;
try {
ps = type.getTypeParameterSignatures();
@@ -83,7 +85,7 @@
IType contextType = context instanceof IType ? (IType)context : context.getDeclaringType();
- String key = context == null || context.isBinary() || "QObject;".equals(typeSignature) ? typeSignature : contextType.getFullyQualifiedName() + "+" + typeSignature;
+ String key = context == null || context.isBinary() || OBJECT.equals(typeSignature) ? typeSignature : contextType.getFullyQualifiedName() + "+" + typeSignature;
if(cache.containsKey(key)) return cache.get(key);
ParametedType result = new ParametedType();
result.setFactory(this);
@@ -112,7 +114,7 @@
ns.append(result.getArrayPrefix());
if(result.isLower()) ns.append('-');
if(result.isUpper()) ns.append('+');
- ns.append('Q').append(resovedTypeName).append(";");
+ ns.append('L').append(resovedTypeName).append(";");
result.setSignature(ns.toString());
}
IType type = EclipseJavaUtil.findType(context.getJavaProject(), resovedTypeName);
@@ -169,7 +171,7 @@
ns.append(result.getArrayPrefix());
if(result.isLower()) ns.append('-');
if(result.isUpper()) ns.append('+');
- ns.append('Q').append(resovedTypeName).append('<').append(newParams).append(">;");
+ ns.append('L').append(resovedTypeName).append('<').append(newParams).append(">;");
result.setSignature(ns.toString());
}
return result;
@@ -185,7 +187,7 @@
String t = Signature.getTypeVariable(typeParameterSignature);
String[] bounds = Signature.getTypeParameterBounds(typeParameterSignature);
- t = "Q" + t + ";";
+ t = "L" + t + ";";
if(result == null || t.equals(result.getSignature())) {
String sts = bounds.length > 0 ? bounds[0] : "";
if(sts.length() > 0) {
13 years, 7 months
JBoss Tools SVN: r30602 - in trunk/as/plugins: org.jboss.ide.eclipse.as.management.as7 and 18 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-04-15 16:25:07 -0400 (Fri, 15 Apr 2011)
New Revision: 30602
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.project
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.settings/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.settings/org.eclipse.jdt.core.prefs
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/bin/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/bin/org/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/bin/org/jboss/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/bin/org/jboss/ide/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/bin/org/jboss/ide/eclipse/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/bin/org/jboss/ide/eclipse/as/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/bin/org/jboss/ide/eclipse/as/management/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/bin/org/jboss/ide/eclipse/as/management/as7/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/bin/org/jboss/ide/eclipse/as/management/as7/Activator.class
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/build.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/Activator.java
Log:
creation of as7-or-greater management plugin
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath 2011-04-15 20:25:07 UTC (rev 30602)
@@ -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>
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.project
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.project (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.project 2011-04-15 20:25:07 UTC (rev 30602)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.ide.eclipse.as.management.as7</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>
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.settings/org.eclipse.jdt.core.prefs 2011-04-15 20:25:07 UTC (rev 30602)
@@ -0,0 +1,8 @@
+#Fri Apr 15 16:21:37 EDT 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
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF 2011-04-15 20:25:07 UTC (rev 30602)
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: As7
+Bundle-SymbolicName: org.jboss.ide.eclipse.as.management.as7
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.ide.eclipse.as.management.as7.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/bin/org/jboss/ide/eclipse/as/management/as7/Activator.class
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/bin/org/jboss/ide/eclipse/as/management/as7/Activator.class
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/build.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/build.properties (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/build.properties 2011-04-15 20:25:07 UTC (rev 30602)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/Activator.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/Activator.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/Activator.java 2011-04-15 20:25:07 UTC (rev 30602)
@@ -0,0 +1,50 @@
+package org.jboss.ide.eclipse.as.management.as7;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.ide.eclipse.as.management.as7"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
13 years, 7 months