JBoss Tools SVN: r27599 - trunk/download.jboss.org/jbosstools/builds/staging/_composite_/trunk.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-12-18 02:16:00 -0500 (Sat, 18 Dec 2010)
New Revision: 27599
Modified:
trunk/download.jboss.org/jbosstools/builds/staging/_composite_/trunk/comp...
trunk/download.jboss.org/jbosstools/builds/staging/_composite_/trunk/comp...
Log:
add freemarker, jst, portlet, smooks
Modified: trunk/download.jboss.org/jbosstools/builds/staging/_composite_/trunk/comp...
===================================================================
--- trunk/download.jboss.org/jbosstools/builds/staging/_composite_/trunk/comp... 2010-12-17 23:44:41 UTC (rev 27598)
+++ trunk/download.jboss.org/jbosstools/builds/staging/_composite_/trunk/comp... 2010-12-18 07:16:00 UTC (rev 27599)
@@ -7,9 +7,9 @@
get new time w/
date +%s000
-->
-<property name='p2.timestamp' value='1292629063000'/>
+<property name='p2.timestamp' value='1292656235000'/>
</properties>
-<children size='21'>
+<children size='25'>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
@@ -23,18 +23,23 @@
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
+<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
+<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
+
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
+<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
+<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
+<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
-<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-pi4soa-3.1...'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-teiid-desi...'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-drools-5.2...'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-savara-1.1...'/>
+<child location='http://download.jboss.org/jbosstools/builds/staging/xulrunner-1.9.1.2/all...'/>
-<child location='http://download.jboss.org/jbosstools/builds/staging/xulrunner-1.9.1.2/all...'/>
</children>
</repository>
Modified: trunk/download.jboss.org/jbosstools/builds/staging/_composite_/trunk/comp...
===================================================================
--- trunk/download.jboss.org/jbosstools/builds/staging/_composite_/trunk/comp... 2010-12-17 23:44:41 UTC (rev 27598)
+++ trunk/download.jboss.org/jbosstools/builds/staging/_composite_/trunk/comp... 2010-12-18 07:16:00 UTC (rev 27599)
@@ -7,9 +7,9 @@
get new time w/
date +%s000
-->
-<property name='p2.timestamp' value='1292629063000'/>
+<property name='p2.timestamp' value='1292656235000'/>
</properties>
-<children size='21'>
+<children size='25'>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
@@ -23,18 +23,23 @@
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
+<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
+<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
+
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
+<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
+<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
+<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
-<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-3.2_trunk....'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-pi4soa-3.1...'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-teiid-desi...'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-drools-5.2...'/>
<child location='http://download.jboss.org/jbosstools/builds/staging/jbosstools-savara-1.1...'/>
+<child location='http://download.jboss.org/jbosstools/builds/staging/xulrunner-1.9.1.2/all...'/>
-<child location='http://download.jboss.org/jbosstools/builds/staging/xulrunner-1.9.1.2/all...'/>
</children>
</repository>
14 years, 1 month
JBoss Tools SVN: r27598 - trunk/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-12-17 18:44:41 -0500 (Fri, 17 Dec 2010)
New Revision: 27598
Modified:
trunk/build/pom-disabled-components.xml
Log:
remove more entries from pom-disabled-components.xml
Modified: trunk/build/pom-disabled-components.xml
===================================================================
--- trunk/build/pom-disabled-components.xml 2010-12-17 23:42:59 UTC (rev 27597)
+++ trunk/build/pom-disabled-components.xml 2010-12-17 23:44:41 UTC (rev 27598)
@@ -23,26 +23,6 @@
</profile>
<profile>
- <id>archives</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- <property>
- <name>as-bootstrap</name>
- </property>
- </activation>
- <modules>
- <module>../archives</module>
- </modules>
- </profile>
-
- <profile>
- <id>archives-bootstrap</id>
- <modules>
- <module>../archives</module>
- </modules>
- </profile>
-
- <profile>
<id>as</id>
<activation>
<activeByDefault>true</activeByDefault>
@@ -58,7 +38,6 @@
<profile>
<id>as-bootstrap</id>
<modules>
- <module>../archives</module>
<module>../as</module>
</modules>
</profile>
@@ -100,23 +79,6 @@
<profile>
- <id>xulrunner</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <modules>
- <module>../xulrunner</module>
- </modules>
- </profile>
-
- <profile>
- <id>xulrunner-bootstrap</id>
- <modules>
- <module>../xulrunner</module>
- </modules>
- </profile>
-
- <profile>
<id>vpe</id>
<activation>
<activeByDefault>true</activeByDefault>
@@ -131,7 +93,6 @@
<modules>
<module>../common</module>
<module>../jst</module>
- <module>../xulrunner</module>
<module>../vpe</module>
</modules>
</profile>
@@ -151,7 +112,6 @@
<modules>
<module>../common</module>
<module>../jst</module>
- <module>../xulrunner</module>
<module>../vpe</module>
<module>../jsf</module>
</modules>
@@ -210,23 +170,6 @@
</profile>
<profile>
- <id>workingset</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <modules>
- <module>../portlet</module>
- </modules>
- </profile>
-
- <profile>
- <id>workingset-bootstrap</id>
- <modules>
- <module>../workingset</module>
- </modules>
- </profile>
-
- <profile>
<id>struts</id>
<activation>
<activeByDefault>true</activeByDefault>
@@ -241,7 +184,6 @@
<modules>
<module>../common</module>
<module>../jst</module>
- <module>../xulrunner</module>
<module>../vpe</module>
<module>../struts</module>
</modules>
@@ -282,42 +224,6 @@
</profile>
<profile>
- <id>cdi</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <modules>
- <module>../cdi</module>
- </modules>
- </profile>
-
- <profile>
- <id>cdi-bootstrap</id>
- <modules>
- <module>../common</module>
- <module>../jst</module>
- <module>../cdi</module>
- </modules>
- </profile>
-
- <profile>
- <id>birt</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <modules>
- <module>../birt</module>
- </modules>
- </profile>
-
- <profile>
- <id>birt-bootstrap</id>
- <modules>
- <module>../birt</module>
- </modules>
- </profile>
-
- <profile>
<id>seam</id>
<activation>
<activeByDefault>true</activeByDefault>
@@ -330,12 +236,10 @@
<profile>
<id>seam-bootstrap</id>
<modules>
- <module>../archives</module>
<module>../as</module>
<module>../hibernatetools</module>
<module>../common</module>
<module>../jst</module>
- <module>../xulrunner</module>
<module>../vpe</module>
<module>../jsf</module>
<module>../seam</module>
@@ -395,26 +299,6 @@
</profile>
<profile>
- <id>gwt</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <modules>
- <module>../gwt</module>
- </modules>
- </profile>
-
- <profile>
- <id>deltacloud</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <modules>
- <module>../deltacloud</module>
- </modules>
- </profile>
-
- <profile>
<id>runtime</id>
<activation>
<activeByDefault>true</activeByDefault>
14 years, 1 month
JBoss Tools SVN: r27596 - trunk/jmx/site.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-12-17 18:35:41 -0500 (Fri, 17 Dec 2010)
New Revision: 27596
Modified:
trunk/jmx/site/site.xml
Log:
https://issues.jboss.org/browse/JBIDE-7933 publish test feature to update site
Modified: trunk/jmx/site/site.xml
===================================================================
--- trunk/jmx/site/site.xml 2010-12-17 19:53:51 UTC (rev 27595)
+++ trunk/jmx/site/site.xml 2010-12-17 23:35:41 UTC (rev 27596)
@@ -8,5 +8,7 @@
<feature url="features/org.jboss.tools.jmx.feature_0.0.0.jar" id="org.jboss.tools.jmx.feature" version="0.0.0">
<category name="JBoss Tools jmx Nightly Build Update Site"/>
</feature>
-
+ <feature url="features/org.jboss.tools.jmx.tests.feature_0.0.0.jar" id="org.jboss.tools.jmx.tests.feature" version="0.0.0">
+ <category name="JBoss Tools jmx Nightly Build Update Site"/>
+ </feature>
</site>
14 years, 1 month
JBoss Tools SVN: r27595 - trunk/build/parent.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2010-12-17 14:53:51 -0500 (Fri, 17 Dec 2010)
New Revision: 27595
Modified:
trunk/build/parent/pom.xml
Log:
parent pom.xml changed to let override jbosstools nightly update site and target platform location
Modified: trunk/build/parent/pom.xml
===================================================================
--- trunk/build/parent/pom.xml 2010-12-17 19:26:09 UTC (rev 27594)
+++ trunk/build/parent/pom.xml 2010-12-17 19:53:51 UTC (rev 27595)
@@ -35,6 +35,8 @@
repo w/o having to edit here. See local.target profile below for more information. -->
<target.platform.site>file://home/hudson/static_build_env/jbds/target-platform/e361-wtp322.target/
</target.platform.site>
+ <jbosstools.update.site>http://download.jboss.org/jbosstools/updates/nightly/trunk</jbosstools.update.site>
+ <jbosstools-target-platform-repo>http://download.jboss.org/jbosstools/updates/target-platform/latest/</jbosstools-target-platform-repo>
</properties>
<build>
@@ -342,8 +344,7 @@
<repositories>
<repository>
<id>jbosstools-target-platform-repo</id>
- <url>http://download.jboss.org/jbosstools/updates/target-platform/latest/
- </url>
+ <url>${jbosstools-target-platform-repo}</url>
<layout>p2</layout>
<snapshots>
<enabled>true</enabled>
@@ -742,10 +743,8 @@
</file>
</activation>
<properties>
- <requirements.root>${basedir}/../../../requirements
- </requirements.root>
- <requirement.build.root>${requirements.root}/target
- </requirement.build.root>
+ <requirements.root>${basedir}/../../../requirements</requirements.root>
+ <requirement.build.root>${requirements.root}/target</requirement.build.root>
</properties>
<build>
<plugins>
@@ -804,8 +803,7 @@
<repositories>
<repository>
<id>jbosstools-nightly-trunk</id>
- <url>http://download.jboss.org/jbosstools/updates/nightly/trunk/
- </url>
+ <url>${jbosstools.update.site}</url>
<layout>p2</layout>
<snapshots>
<enabled>true</enabled>
14 years, 1 month
JBoss Tools SVN: r27594 - trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2010-12-17 14:26:09 -0500 (Fri, 17 Dec 2010)
New Revision: 27594
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java
Log:
https://issues.jboss.org/browse/JBIDE-7824 - workaround for the issue
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java 2010-12-17 19:10:10 UTC (rev 27593)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java 2010-12-17 19:26:09 UTC (rev 27594)
@@ -46,6 +46,7 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentExtension3;
import org.eclipse.jface.text.IDocumentPartitioner;
+import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
@@ -240,6 +241,8 @@
KnownConfigurations.getInstance().addConfiguration(
new ConsoleConfiguration(new EclipseLaunchConsoleConfigurationPreferences(launchConfigurations[i])), false );
}
+ // force to load the plugin before any of console configuration build
+ JptCorePlugin.getJpaProjectManager().getJpaProjects();
}
/**
14 years, 1 month
JBoss Tools SVN: r27593 - in trunk/deltacloud: plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-17 14:10:10 -0500 (Fri, 17 Dec 2010)
New Revision: 27593
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/AbstractDeltaCloudResourceAction.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthClientException.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/IDeltaCloudResourceAction.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/IInstanceAction.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/IKeyAction.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/KeyAction.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/KeyActionXmlAdapter.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListKeyRequest.java
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthException.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/InstanceAction.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Key.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateKeyRequest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/KeyMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/ServerTypeMockIntegrationTest.java
Log:
[JBIDE-7371] implementing key related methods in the DeltaCloudClient (created a method that returns a key instance compared to a string as it was before). Implementing tests for it.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-17 16:43:44 UTC (rev 27592)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-17 19:10:10 UTC (rev 27593)
@@ -1,3 +1,8 @@
+2010-12-17 André Dietisheim <adietish(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java (createKey):
+ [JBIDE-7371] added #createKey method that now returns a key instance
+
2010-12-16 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/client/request/ListKeysRequest.java:
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-12-17 16:43:44 UTC (rev 27592)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -18,7 +18,7 @@
import java.util.regex.PatternSyntaxException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudAuthException;
+import org.jboss.tools.deltacloud.core.client.DeltaCloudAuthClientException;
import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl.DeltaCloudServerType;
@@ -147,7 +147,7 @@
throws DeltaCloudException {
try {
return new DeltaCloudClientImpl(url, username, password);
- } catch (MalformedURLException e) {
+ } catch (Exception e) {
throw new DeltaCloudException(MessageFormat.format("Could not access cloud at {0}", url), e);
}
}
@@ -589,11 +589,11 @@
return true;
} catch (DeltaCloudNotFoundClientException e) {
return true;
- } catch (DeltaCloudAuthException e) {
+ } catch (DeltaCloudAuthClientException e) {
return false;
- } catch(DeltaCloudClientException e){
+ } catch (DeltaCloudClientException e) {
throw new DeltaCloudException("Could not connection to ", e);
}
-
+
}
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java 2010-12-17 16:43:44 UTC (rev 27592)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -14,6 +14,7 @@
import java.util.List;
import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.core.client.IInstanceAction;
import org.jboss.tools.deltacloud.core.client.Instance;
import org.jboss.tools.deltacloud.core.client.Instance.InstanceState;
import org.jboss.tools.deltacloud.core.client.InstanceAction;
@@ -56,9 +57,9 @@
public enum Action {
- START(InstanceAction.START),
- STOP(InstanceAction.STOP),
- REBOOT(InstanceAction.REBOOT),
+ START(IInstanceAction.START),
+ STOP(IInstanceAction.STOP),
+ REBOOT(IInstanceAction.REBOOT),
DESTROY(InstanceAction.DESTROY);
private String name;
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/AbstractDeltaCloudResourceAction.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/AbstractDeltaCloudResourceAction.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/AbstractDeltaCloudResourceAction.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.core.client;
+
+import org.jboss.tools.deltacloud.core.client.request.DeltaCloudRequest.HttpMethod;
+
+/**
+ * An action that is executable on a deltacloud resource
+ *
+ * @author André Dietisheim
+ *
+ */
+public abstract class AbstractDeltaCloudResourceAction implements IDeltaCloudResourceAction {
+
+ private String name;
+ private String url;
+ private HttpMethod method;
+
+ protected AbstractDeltaCloudResourceAction() {
+ }
+
+ protected AbstractDeltaCloudResourceAction(String name, String url, String method) {
+ this.url = url;
+ this.method = HttpMethod.valueOf(method.toUpperCase());
+ this.name = name;
+ }
+
+ protected void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ protected void setUrl(String url) {
+ this.url = url;
+ }
+
+ @Override
+ public String getUrl() {
+ return url;
+ }
+
+ protected void setMethod(HttpMethod method) {
+ this.method = method;
+ }
+
+ protected void setMethod(String method) {
+ this.method = HttpMethod.valueOf(method.toUpperCase());
+ }
+
+
+ @Override
+ public HttpMethod getMethod() {
+ return method;
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/AbstractDeltaCloudResourceAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthClientException.java (from rev 27584, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthException.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthClientException.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthClientException.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.tools.deltacloud.core.client;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class DeltaCloudAuthClientException extends DeltaCloudClientException {
+
+ private static final long serialVersionUID = 1L;
+
+ public DeltaCloudAuthClientException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public DeltaCloudAuthClientException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public DeltaCloudAuthClientException(String message)
+ {
+ super(message);
+ }
+
+}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthException.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthException.java 2010-12-17 16:43:44 UTC (rev 27592)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthException.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * 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.tools.deltacloud.core.client;
-
-/**
- * @author Andre Dietisheim
- */
-public class DeltaCloudAuthException extends DeltaCloudClientException {
-
- private static final long serialVersionUID = 1L;
-
- public DeltaCloudAuthException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public DeltaCloudAuthException(Throwable cause)
- {
- super(cause);
- }
-
- public DeltaCloudAuthException(String message)
- {
- super(message);
- }
-
-}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2010-12-17 16:43:44 UTC (rev 27592)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -125,9 +125,9 @@
String memory, String storage) throws DeltaCloudClientException;
/**
- * Creates a key for a given name on the deltacloud server and stores it
- * in the file at the given path. The file gets created if the file path
- * does not exist yet.
+ * Creates a key for a given name on the deltacloud server and stores it in
+ * the file at the given path. The file gets created if the file path does
+ * not exist yet.
*
* @param keyname
* the name of the key to retrieve from the server
@@ -138,7 +138,7 @@
*/
public void createKey(String keyname, String keystoreLocation) throws DeltaCloudClientException;
- public String createKey(String keyname) throws DeltaCloudClientException;
+ public Key createKey(String keyname) throws DeltaCloudClientException;
/**
* Deletes the key with the given name on the deltacloud server
@@ -147,6 +147,12 @@
* @throws DeltaCloudClientException
*/
public void deleteKey(String keyname) throws DeltaCloudClientException;
-
+
public List<Key> listKeys() throws DeltaCloudClientException;
+
+ /**
+ * Returns a key with the given name if it is available on the server.
+ * Throws a DeltaCloudException if it is not available.
+ */
+ public Key listKey(String name) throws DeltaCloudClientException;
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java 2010-12-17 16:43:44 UTC (rev 27592)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -61,6 +61,7 @@
import org.jboss.tools.deltacloud.core.client.request.ListImagesRequest;
import org.jboss.tools.deltacloud.core.client.request.ListInstanceRequest;
import org.jboss.tools.deltacloud.core.client.request.ListInstancesRequest;
+import org.jboss.tools.deltacloud.core.client.request.ListKeyRequest;
import org.jboss.tools.deltacloud.core.client.request.ListKeysRequest;
import org.jboss.tools.deltacloud.core.client.request.ListRealmRequest;
import org.jboss.tools.deltacloud.core.client.request.ListRealmsRequest;
@@ -86,6 +87,8 @@
public static Logger logger = Logger.getLogger(DeltaCloudClientImpl.class);
+ private DocumentBuilder documentBuilder;
+
public static enum DeltaCloudServerType {
UNKNOWN, MOCK, EC2
}
@@ -94,19 +97,36 @@
private String username;
private String password;
- public DeltaCloudClientImpl(String url) throws MalformedURLException {
+ public DeltaCloudClientImpl(String url) throws MalformedURLException, DeltaCloudClientException {
this(url, null, null);
}
- public DeltaCloudClientImpl(String url, String username, String password) throws MalformedURLException {
+ public DeltaCloudClientImpl(String url, String username, String password) throws DeltaCloudClientException {
logger.debug("Creating new Delta Cloud Client for Server: " + url);
- this.baseUrl = new URL(url);
+ this.baseUrl = createUrl(url);
this.username = username;
this.password = password;
+ documentBuilder = createDocumentBuilder();
}
+ private URL createUrl(String url) throws DeltaCloudClientException {
+ try {
+ return new URL(url);
+ } catch (MalformedURLException e) {
+ throw new DeltaCloudClientException(MessageFormat.format("Could not create url for {0}", url), e);
+ }
+ }
+
+ private DocumentBuilder createDocumentBuilder() throws DeltaCloudClientException {
+ try {
+ return DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ } catch (ParserConfigurationException e) {
+ throw new DeltaCloudClientException("Could not create document builder", e);
+ }
+ }
+
protected String sendRequest(DeltaCloudRequest deltaCloudRequest) throws DeltaCloudClientException {
DefaultHttpClient httpClient = new DefaultHttpClient();
try {
@@ -133,7 +153,7 @@
if (HttpStatusCode.OK.isStatus(statusCode)) {
return;
} else if (HttpStatusCode.FORBIDDEN.isStatus(statusCode)) {
- throw new DeltaCloudAuthException(
+ throw new DeltaCloudAuthClientException(
MessageFormat.format("The server reported an authorization error \"{0}\" on requesting \"{1}\"",
httpResponse.getStatusLine().getReasonPhrase(), requestUrl));
} else if (HttpStatusCode.NOT_FOUND.isStatus(statusCode)) {
@@ -230,9 +250,7 @@
DeltaCloudServerType serverType = DeltaCloudServerType.UNKNOWN;
try {
String apiResponse = sendRequest(new TypeRequest(baseUrl));
- DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document document = db.parse(new InputSource(new StringReader(apiResponse)));
-
+ Document document = getDocument(apiResponse);
NodeList elements = document.getElementsByTagName(DOCUMENT_ELEMENT_API);
if (elements.getLength() > 0) {
Node n = elements.item(0);
@@ -250,7 +268,14 @@
@Override
public Instance createInstance(String imageId) throws DeltaCloudClientException {
- return buildInstance(sendRequest(new CreateInstanceRequest(baseUrl, imageId)));
+ try {
+ return buildInstance(sendRequest(new CreateInstanceRequest(baseUrl, imageId)));
+ } catch (DeltaCloudClientException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(e);
+ }
+
}
@Override
@@ -266,14 +291,26 @@
public Instance createInstance(String imageId, String profileId, String realmId, String name, String keyname,
String memory, String storage) throws DeltaCloudClientException {
- return buildInstance(sendRequest(new CreateInstanceRequest(baseUrl, imageId, profileId, realmId, name, keyname,
- memory, storage)));
+ try {
+ return buildInstance(sendRequest(new CreateInstanceRequest(baseUrl, imageId, profileId, realmId, name,
+ keyname, memory, storage)));
+ } catch (DeltaCloudClientException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(e);
+ }
}
@Override
public HardwareProfile listProfile(String profileId) throws DeltaCloudClientException {
- return buildDeltaCloudObject(HardwareProfile.class, sendRequest(new ListHardwareProfileRequest(baseUrl,
- profileId)));
+ try {
+ return buildDeltaCloudObject(HardwareProfile.class, sendRequest(new ListHardwareProfileRequest(baseUrl,
+ profileId)));
+ } catch (DeltaCloudClientException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(e);
+ }
}
@Override
@@ -301,7 +338,13 @@
public Instance listInstances(String instanceId) throws DeltaCloudClientException {
// return JAXB.unmarshal(new StringReader(sendRequest(new
// ListInstanceRequest(baseUrl, instanceId))), Instance.class);
- return buildInstance(sendRequest(new ListInstanceRequest(baseUrl, instanceId)));
+ try {
+ return buildInstance(sendRequest(new ListInstanceRequest(baseUrl, instanceId)));
+ } catch (DeltaCloudClientException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(e);
+ }
}
@Override
@@ -314,21 +357,40 @@
return JAXB.unmarshal(new StringReader(sendRequest(new ListRealmRequest(baseUrl, realmId))), Realm.class);
}
- public String createKey(String keyname) throws DeltaCloudClientException {
- return sendRequest(new CreateKeyRequest(baseUrl, keyname));
- }
-
- public void createKey(String keyname, String keyStoreLocation) throws DeltaCloudClientException {
- String xml = createKey(keyname);
+ public Key createKey(String keyname) throws DeltaCloudClientException {
try {
- String key = trimKey(getKey(xml));
- File keyFile = createKeyFile(keyname, keyStoreLocation);
- storeKey(key, keyFile);
+ String response = sendRequest(new CreateKeyRequest(baseUrl, keyname));
+ Key key = new Key();
+ return updatekey(getDocument(response), key);
+ } catch (DeltaCloudClientException e) {
+ throw e;
} catch (Exception e) {
throw new DeltaCloudClientException(e);
}
}
+ private Key updatekey(Document document, Key key) throws Exception {
+ key.setId(getAttributeValues(document, "key", "id").get(0)); //$NON-NLS-1$ //$NON-NLS-2$
+ key.setUrl(getAttributeValues(document, "key", "href").get(0)); //$NON-NLS-1$ //$NON-NLS-2$
+ key.setState(getFirstElementTextValue(document, "state")); //$NON-NLS-1$
+ key.setFingerPrint(getFirstElementTextValue(document, "fingerprint")); //$NON-NLS-1$
+ key.setPem(getFirstElementTextValue(document, "pem")); //$NON-NLS-1$
+ key.setActions(createKeyActions(key, document));
+ return key;
+ }
+
+ public void createKey(String keyname, String keyStoreLocation) throws DeltaCloudClientException {
+ Key key = createKey(keyname);
+ throw new UnsupportedOperationException("not implemented yet");
+ // try {
+ // String key = trimKey(getKey(xml));
+ // File keyFile = createKeyFile(keyname, keyStoreLocation);
+ // storeKey(key, keyFile);
+ // } catch (Exception e) {
+ // throw new DeltaCloudClientException(e);
+ // }
+ }
+
private void storeKey(String key, File keyFile) throws IOException {
FileWriter w = new FileWriter(keyFile);
w.write(key);
@@ -351,10 +413,7 @@
}
private List<String> getKey(String xml) throws ParserConfigurationException, SAXException, IOException {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- DocumentBuilder db = dbf.newDocumentBuilder();
- Document document = db.parse(new InputSource(new StringReader(xml)));
- List<String> keyText = getElementTextValues(document, PEM_FILE_SUFFIX); //$NON-NLS-1$
+ List<String> keyText = getElementTextValues(getDocument(xml), PEM_FILE_SUFFIX); //$NON-NLS-1$
return keyText;
}
@@ -375,60 +434,79 @@
public void deleteKey(String keyname) throws DeltaCloudClientException {
sendRequest(new DeleteKeyRequest(baseUrl, keyname));
}
-
+
public List<Key> listKeys() throws DeltaCloudClientException {
String xml = sendRequest(new ListKeysRequest(baseUrl));
- Key instance = JAXB.unmarshal(new StringReader(xml), Key.class);
+ Key key = JAXB.unmarshal(new StringReader(xml), Key.class);
throw new UnsupportedOperationException();
}
- private Instance updateInstance(String xml, Instance instance) throws DeltaCloudClientException {
- try {
+ public Key listKey(String name) throws DeltaCloudClientException {
+ String xml = sendRequest(new ListKeyRequest(baseUrl, name));
+ Key key = JAXB.unmarshal(new StringReader(xml), Key.class);
+ return key;
+ }
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- DocumentBuilder db = dbf.newDocumentBuilder();
- Document document = db.parse(new InputSource(new StringReader(xml)));
-
- instance.setImageId(getIdFromHref(getAttributeValues(document, "image", "href").get(0))); //$NON-NLS-1$ //$NON-NLS-2$
- instance.setProfileId(getIdFromHref(getAttributeValues(document, "hardware_profile", "href").get(0))); //$NON-NLS-1$ //$NON-NLS-2$
- getProfileProperties(instance, getPropertyNodes(document, "hardware_profile")); //$NON-NLS-1$
- instance.setRealmId(getIdFromHref(getAttributeValues(document, "realm", "href").get(0))); //$NON-NLS-1$ //$NON-NLS-2$
- instance.setState(getElementTextValues(document, "state").get(0)); //$NON-NLS-1$
- getAuthentication(document, instance);
- instance.setActions(createInstanceActions(instance, document));
- instance.setPublicAddresses(new AddressList(getElementTextValues(document, "public_addresses")));
- instance.setPrivateAddresses(new AddressList(getElementTextValues(document, "private_addresses")));
- return instance;
- } catch (DeltaCloudClientException e) {
- throw e;
- } catch (Exception e) {
- DeltaCloudClientException newException = new DeltaCloudClientException(e.getLocalizedMessage());
- throw newException;
- }
+ private Instance updateInstance(String xml, Instance instance) throws Exception {
+ Document document = getDocument(xml);
+ instance.setImageId(getIdFromHref(getAttributeValues(document, "image", "href").get(0))); //$NON-NLS-1$ //$NON-NLS-2$
+ instance.setProfileId(getIdFromHref(getAttributeValues(document, "hardware_profile", "href").get(0))); //$NON-NLS-1$ //$NON-NLS-2$
+ getProfileProperties(instance, getPropertyNodes(document, "hardware_profile")); //$NON-NLS-1$
+ instance.setRealmId(getIdFromHref(getAttributeValues(document, "realm", "href").get(0))); //$NON-NLS-1$ //$NON-NLS-2$
+ instance.setState(getElementTextValues(document, "state").get(0)); //$NON-NLS-1$
+ getAuthentication(document, instance);
+ instance.setActions(createInstanceActions(instance, document));
+ instance.setPublicAddresses(new AddressList(getElementTextValues(document, "public_addresses")));
+ instance.setPrivateAddresses(new AddressList(getElementTextValues(document, "private_addresses")));
+ return instance;
}
- private Instance buildInstance(String xml) throws DeltaCloudClientException {
+ private Instance buildInstance(String xml) throws Exception {
Instance instance = JAXB.unmarshal(new StringReader(xml), Instance.class);
return updateInstance(xml, instance);
}
- private List<InstanceAction> createInstanceActions(final Instance instance, Document document)
- throws DeltaCloudClientException {
+ private List<InstanceAction> createInstanceActions(final Instance instance, Document document) throws Exception {
final List<InstanceAction> actions = new ArrayList<InstanceAction>();
forEachNode(document, "link", new INodeVisitor() {
@Override
public void visit(Node node) throws Exception {
- NamedNodeMap attributes = node.getAttributes();
- String name = getAttributeTextContent("rel", attributes, node);
- String url = getAttributeTextContent("href", attributes, node);
- String method = getAttributeTextContent("method", attributes, node);
- actions.add(new InstanceAction(name, url, method, instance));
+ InstanceAction action = new InstanceAction();
+ setActionProperties(action, node);
+ action.setInstance(instance);
+ actions.add(action);
}
});
return actions;
}
+ private List<KeyAction> createKeyActions(final Key key, Document document) throws Exception {
+ final List<KeyAction> actions = new ArrayList<KeyAction>();
+ forEachNode(document, "link", new INodeVisitor() {
+
+ @Override
+ public void visit(Node node) throws Exception {
+ KeyAction action = new KeyAction();
+ setActionProperties(action, node);
+ action.setKey(key);
+ actions.add(action);
+ }
+ });
+ return actions;
+ }
+
+ private void setActionProperties(final AbstractDeltaCloudResourceAction action, Node node)
+ throws DeltaCloudClientException {
+ NamedNodeMap attributes = node.getAttributes();
+ String name = getAttributeTextContent("rel", attributes, node);
+ action.setName(name);
+ String url = getAttributeTextContent("href", attributes, node);
+ action.setUrl(url);
+ String method = getAttributeTextContent("method", attributes, node);
+ action.setMethod(method);
+ }
+
private String getAttributeTextContent(String attributeName, NamedNodeMap namedNodeMap, Node node)
throws DeltaCloudClientException {
Node attributeNode = namedNodeMap.getNamedItem(attributeName);
@@ -444,9 +522,7 @@
try {
HardwareProfile profile = JAXB.unmarshal(new StringReader(xml), HardwareProfile.class);
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- DocumentBuilder db = dbf.newDocumentBuilder();
- Document document = db.parse(new InputSource(new StringReader(xml)));
+ Document document = getDocument(xml);
List<Node> nodes = getPropertyNodes(document, "hardware_profile"); //$NON-NLS-1$
@@ -492,14 +568,10 @@
return null;
}
- private void forEachNode(Document document, String tagName, INodeVisitor visitor) throws DeltaCloudClientException {
+ private void forEachNode(Document document, String tagName, INodeVisitor visitor) throws Exception {
NodeList elements = document.getElementsByTagName(tagName);
for (int i = 0; i < elements.getLength(); i++) {
- try {
- visitor.visit(elements.item(i));
- } catch (Exception e) {
- throw new DeltaCloudClientException(e.getMessage());
- }
+ visitor.visit(elements.item(i));
}
}
@@ -512,6 +584,14 @@
return values;
}
+ private String getFirstElementTextValue(Document document, String elementName) {
+ List<String> values = getElementTextValues(document, elementName);
+ if (values.size() == 0) {
+ return null;
+ }
+ return values.get(0);
+ }
+
private List<String> getElementTextValues(Document document, String elementName) {
NodeList elements = document.getElementsByTagName(elementName);
ArrayList<String> values = new ArrayList<String>();
@@ -616,14 +696,12 @@
private Document getDocument(String response) throws ParserConfigurationException,
SAXException, IOException {
InputSource is = new InputSource(new StringReader(response));
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- DocumentBuilder db = dbf.newDocumentBuilder();
- Document document = db.parse(is);
+ Document document = documentBuilder.parse(is);
return document;
}
@SuppressWarnings("unchecked")
- private <T extends Object> T buildDeltaCloudObject(Class<T> clazz, String node) throws DeltaCloudClientException {
+ private <T extends Object> T buildDeltaCloudObject(Class<T> clazz, String node) throws Exception {
if (clazz.equals(Instance.class)) {
return (T) buildInstance(node);
} else if (clazz.equals(HardwareProfile.class)) {
@@ -646,6 +724,10 @@
throw new DeltaCloudClientException(MessageFormat.format(
"Could not perform action {0} on instance {1}", action.getName(), action.getInstance()
.getName()), e);
+ } catch (DeltaCloudClientException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(e);
}
return true;
}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/IDeltaCloudResourceAction.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/IDeltaCloudResourceAction.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/IDeltaCloudResourceAction.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.core.client;
+
+import org.jboss.tools.deltacloud.core.client.request.DeltaCloudRequest.HttpMethod;
+
+/**
+ * @author André Dietisheim
+ */
+public interface IDeltaCloudResourceAction {
+
+ public static final String DESTROY = "destroy";
+
+ public String getName();
+
+ public String getUrl();
+
+ public HttpMethod getMethod();
+
+}
\ No newline at end of file
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/IDeltaCloudResourceAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/IInstanceAction.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/IInstanceAction.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/IInstanceAction.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.core.client;
+
+public interface IInstanceAction extends IDeltaCloudResourceAction {
+
+ public static final String START = "start";
+ public static final String STOP = "stop";
+ public static final String REBOOT = "reboot";
+
+ public Instance getInstance();
+
+}
\ No newline at end of file
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/IInstanceAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/IKeyAction.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/IKeyAction.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/IKeyAction.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.core.client;
+
+/**
+ * @author André Dietisheim
+ */
+public interface IKeyAction extends IDeltaCloudResourceAction {
+
+ public Key getKey();
+
+}
\ No newline at end of file
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/IKeyAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java 2010-12-17 16:43:44 UTC (rev 27592)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -185,15 +185,15 @@
}
public boolean canStart() {
- return getAction(InstanceAction.START) != null;
+ return getAction(IInstanceAction.START) != null;
}
public boolean canStop() {
- return getAction(InstanceAction.STOP) != null;
+ return getAction(IInstanceAction.STOP) != null;
}
public boolean canReboot() {
- return getAction(InstanceAction.REBOOT) != null;
+ return getAction(IInstanceAction.REBOOT) != null;
}
public boolean canDestroy() {
@@ -213,11 +213,11 @@
}
public boolean start(DeltaCloudClient client) throws DeltaCloudClientException {
- return ((InternalDeltaCloudClient) client).performInstanceAction(getAction(InstanceAction.START));
+ return ((InternalDeltaCloudClient) client).performInstanceAction(getAction(IInstanceAction.START));
}
public boolean stop(DeltaCloudClient client) throws DeltaCloudClientException {
- return ((InternalDeltaCloudClient) client).performInstanceAction(getAction(InstanceAction.STOP));
+ return ((InternalDeltaCloudClient) client).performInstanceAction(getAction(IInstanceAction.STOP));
}
public boolean destroy(DeltaCloudClient client) throws DeltaCloudClientException {
@@ -225,7 +225,7 @@
}
public boolean reboot(DeltaCloudClient client) throws DeltaCloudClientException {
- return ((InternalDeltaCloudClient) client).performInstanceAction(getAction(InstanceAction.REBOOT));
+ return ((InternalDeltaCloudClient) client).performInstanceAction(getAction(IInstanceAction.REBOOT));
}
@Override
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/InstanceAction.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/InstanceAction.java 2010-12-17 16:43:44 UTC (rev 27592)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/InstanceAction.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.deltacloud.core.client;
-import org.jboss.tools.deltacloud.core.client.request.DeltaCloudRequest.HttpMethod;
/**
* An action that is executable on an instance
@@ -21,47 +20,30 @@
* @see DeltaCloudClient#performInstanceAction(String, String);
*
*/
-public class InstanceAction {
+public class InstanceAction extends AbstractDeltaCloudResourceAction implements IInstanceAction {
- public static final String START = "start";
- public static final String STOP = "stop";
- public static final String DESTROY = "destroy";
- public static final String REBOOT = "reboot";
-
- private String name;
- private String url;
- private HttpMethod method;
private Instance instance;
- protected InstanceAction(String name, String url, String method, Instance instance) {
- this(name, url, HttpMethod.valueOf(method.toUpperCase()), instance);
+ protected InstanceAction() {
+ super();
}
- protected InstanceAction(String name, String url, HttpMethod method, Instance instance) {
- this.name = name;
- this.url = url;
- this.method = method;
+ protected InstanceAction(String name, String url, String method, Instance instance) {
+ super(name, url, method);
this.instance = instance;
}
- public String getName() {
- return name;
+ protected void setInstance(Instance instance) {
+ this.instance = instance;
}
- public String getUrl() {
- return url;
+ @Override
+ public Instance getInstance() {
+ return instance;
}
- public HttpMethod getMethod() {
- return method;
- }
-
@Override
public String toString() {
- return "InstanceAction [name=" + name + ", url=" + url + ", method=" + method + "]";
+ return "InstanceAction [name=" + getName() + ", url=" + getUrl() + ", method=" + getMethod() + "]";
}
-
- public Instance getInstance() {
- return instance;
- }
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Key.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Key.java 2010-12-17 16:43:44 UTC (rev 27592)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Key.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -10,7 +10,9 @@
*******************************************************************************/
package org.jboss.tools.deltacloud.core.client;
-import javax.xml.bind.annotation.XmlElement;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
/**
* @author Andre Dietisheim
@@ -19,20 +21,63 @@
private static final long serialVersionUID = 1L;
- public static enum InstanceState {
- RUNNING, STOPPED, PENDING, TERMINATED, BOGUS
- };
+ private URL url;
+ private String id;
+ private String pem;
+ private String fingerPrint;
+ private String state;
+ private List<KeyAction> actions;
- @XmlElement
- private String name;
+ public String getId() {
+ return id;
+ }
- public String getName() {
- return name;
+ protected void setUrl(String url) throws MalformedURLException {
+ this.url = new URL(url);
}
- @SuppressWarnings("unused")
- private void setName(String name) {
- this.name = name;
+ protected void setUrl(URL url) {
+ this.url = url;
}
-
+
+ protected void setId(String id) {
+ this.id = id;
+ }
+
+ protected void setPem(String pem) {
+ this.pem = pem;
+ }
+
+ protected void setFingerPrint(String fingerPrint) {
+ this.fingerPrint = fingerPrint;
+ }
+
+ protected void setState(String state) {
+ this.state = state;
+ }
+
+ protected void setActions(List<KeyAction> actions) {
+ this.actions = actions;
+ }
+
+ public URL getUrl() {
+ return url;
+ }
+
+ public String getFingerPrint() {
+ return fingerPrint;
+ }
+
+ public String getPem() {
+ return pem;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public List<KeyAction> getActions() {
+ return actions;
+ }
+
}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/KeyAction.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/KeyAction.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/KeyAction.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.core.client;
+
+/**
+ * An action that is executable on a deltacloud key
+ *
+ * @author André Dietisheim
+ */
+public class KeyAction extends AbstractDeltaCloudResourceAction implements IKeyAction {
+
+ private Key key;
+
+ protected KeyAction() {
+ }
+
+ protected KeyAction(String name, Key key, String url, String method) {
+ super(name, url, method);
+ this.key = key;
+ }
+
+ protected void setKey(Key key) {
+ this.key = key;
+ }
+
+ @Override
+ public Key getKey() {
+ return key;
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/KeyAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/KeyActionXmlAdapter.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/KeyActionXmlAdapter.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/KeyActionXmlAdapter.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -0,0 +1,18 @@
+package org.jboss.tools.deltacloud.core.client;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+public class KeyActionXmlAdapter extends XmlAdapter<String, KeyAction> {
+
+ @Override
+ public KeyAction unmarshal(String v) throws Exception {
+ return null;
+ }
+
+ @Override
+ public String marshal(KeyAction v) throws Exception {
+ return null;
+ }
+
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/KeyActionXmlAdapter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateKeyRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateKeyRequest.java 2010-12-17 16:43:44 UTC (rev 27592)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateKeyRequest.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -14,7 +14,6 @@
import org.jboss.tools.deltacloud.core.client.utils.UrlBuilder;
-
/**
* Creates a key on the deltacloud server
*
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListKeyRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListKeyRequest.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListKeyRequest.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.core.client.request;
+
+import java.net.URL;
+
+import org.jboss.tools.deltacloud.core.client.utils.UrlBuilder;
+
+
+/**
+ * List a key with a given name that is available on the deltacloud server
+ *
+ * @author André Dietisheim
+ */
+public class ListKeyRequest extends AbstractDeltaCloudRequest {
+
+ private String name;
+
+ public ListKeyRequest(URL baseUrl, String name) {
+ super(baseUrl, HttpMethod.GET);
+ this.name = name;
+ }
+
+ @Override
+ protected String doCreateUrl(UrlBuilder urlBuilder) {
+ return urlBuilder.path("keys").path(name).toString();
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListKeyRequest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/KeyMockIntegrationTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/KeyMockIntegrationTest.java 2010-12-17 16:43:44 UTC (rev 27592)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/KeyMockIntegrationTest.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -10,15 +10,19 @@
******************************************************************************/
package org.jboss.tools.internal.deltacloud.test.core.client;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
+import org.jboss.tools.deltacloud.core.client.DeltaCloudNotFoundClientException;
+import org.jboss.tools.deltacloud.core.client.Key;
import org.jboss.tools.internal.deltacloud.test.context.MockIntegrationTestContext;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
/**
@@ -44,15 +48,38 @@
testSetup.tearDown();
}
+ /**
+ * checks if the client throws a {@link DeltaCloudNotFoundClientException} if an
+ * unknown key is requested.
+ *
+ * @throws DeltaCloudClientException
+ */
+ @Ignore
+ @Test(expected = DeltaCloudNotFoundClientException.class)
+ public void listUnknownKeyThrowsException() throws DeltaCloudClientException {
+ String keyName = String.valueOf(System.currentTimeMillis());
+ testSetup.getClient().listKey(keyName);
+ }
+
@Test
public void canCreateKey() throws DeltaCloudClientException {
- String key = testSetup.getClient().createKey("test");
+ String keyName = "test" + System.currentTimeMillis();
+ Key key = testSetup.getClient().createKey(keyName);
assertNotNull(key);
+ assertEquals(keyName, key.getId());
+ }
+ @Ignore
+ @Test
+ public void canListKey() throws DeltaCloudClientException {
+ String keyName = String.valueOf(System.currentTimeMillis());
+ Key createdKey = testSetup.getClient().createKey(keyName);
+ Key listedKey = testSetup.getClient().listKey(keyName);
+ assertEquals(createdKey.getId(), listedKey.getId());
}
-
+
@Test
public void canListKeys() {
-
+
}
}
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/ServerTypeMockIntegrationTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/ServerTypeMockIntegrationTest.java 2010-12-17 16:43:44 UTC (rev 27592)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/ServerTypeMockIntegrationTest.java 2010-12-17 19:10:10 UTC (rev 27593)
@@ -57,22 +57,27 @@
assertEquals(DeltaCloudClientImpl.DeltaCloudServerType.MOCK, testSetup.getClient().getServerType());
}
-/**
+ /**
*
* #getServerType reports {@link DeltaCloudClient.DeltaCloudType#UNKNOWN) if it queries a fake server that responds with a unknown answer.
*
* @throws IOException
* Signals that an I/O exception has occurred.
+ * @throws DeltaCloudClientException
*/
@Test
- public void reportsUnknownUrl() throws IOException {
- ServerFake serverFake = new ServerFake(new URL(MockIntegrationTestContext.SERVERFAKE_URL).getPort(),
- "<dummy></dummy>");
+ public void reportsUnknownUrl() throws IOException, DeltaCloudClientException {
+ ServerFake serverFake =
+ new ServerFake(
+ new URL(MockIntegrationTestContext.SERVERFAKE_URL).getPort(),
+ "<dummy></dummy>");
serverFake.start();
try {
- assertEquals(DeltaCloudClientImpl.DeltaCloudServerType.UNKNOWN, new DeltaCloudClientImpl(
- MockIntegrationTestContext.SERVERFAKE_URL, MockIntegrationTestContext.DELTACLOUD_USER,
- MockIntegrationTestContext.DELTACLOUD_PASSWORD).getServerType());
+ assertEquals(
+ DeltaCloudClientImpl.DeltaCloudServerType.UNKNOWN,
+ new DeltaCloudClientImpl(
+ MockIntegrationTestContext.SERVERFAKE_URL, MockIntegrationTestContext.DELTACLOUD_USER,
+ MockIntegrationTestContext.DELTACLOUD_PASSWORD).getServerType());
} finally {
serverFake.stop();
}
@@ -101,7 +106,8 @@
@Override
public HttpMethod getHttpMethod() {
return HttpMethod.GET;
- } }
+ }
+ }
);
return Collections.emptyList();
}
14 years, 1 month
JBoss Tools SVN: r27592 - in trunk/cdi/tests/org.jboss.tools.cdi.core.test: resources/tck/tests/decorators/definition/broken/cycle and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-12-17 11:43:44 -0500 (Fri, 17 Dec 2010)
New Revision: 27592
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/WDecorator.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/XDecorator.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/YDecorator.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/ZDecorator.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/DecoratorDefinitionTest.java
Log:
JBIDE-7844
https://issues.jboss.org/browse/JBIDE-7844
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/WDecorator.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/WDecorator.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/WDecorator.java 2010-12-17 16:43:44 UTC (rev 27592)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.decorators.definition.broken.cycle;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+@Decorator
+public class WDecorator extends YDecorator {
+ @Inject @Delegate WDecorator decorator;
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/WDecorator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/XDecorator.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/XDecorator.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/XDecorator.java 2010-12-17 16:43:44 UTC (rev 27592)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.decorators.definition.broken.cycle;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+@Decorator
+public class XDecorator extends XDecorator {
+ @Inject @Delegate XDecorator decorator;
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/XDecorator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/YDecorator.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/YDecorator.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/YDecorator.java 2010-12-17 16:43:44 UTC (rev 27592)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.decorators.definition.broken.cycle;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+@Decorator
+public class YDecorator extends ZDecorator {
+ @Inject @Delegate YDecorator decorator;
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/YDecorator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/ZDecorator.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/ZDecorator.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/ZDecorator.java 2010-12-17 16:43:44 UTC (rev 27592)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.decorators.definition.broken.cycle;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+@Decorator
+public class ZDecorator extends YDecorator {
+ @Inject @Delegate ZDecorator decorator;
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/decorators/definition/broken/cycle/ZDecorator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/DecoratorDefinitionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/DecoratorDefinitionTest.java 2010-12-17 15:54:05 UTC (rev 27591)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/DecoratorDefinitionTest.java 2010-12-17 16:43:44 UTC (rev 27592)
@@ -21,6 +21,7 @@
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IParametedType;
import org.jboss.tools.cdi.internal.core.impl.CDIProject;
+import org.jboss.tools.cdi.internal.core.impl.ClassBean;
/**
* @author Alexey Kazakov
@@ -88,4 +89,38 @@
public void testCustomDecorator() throws CoreException {
getDecorator("JavaSource/org/jboss/jsr299/tck/tests/decorators/custom/VehicleDecorator.java");
}
+
+ /**
+ * class XDecorator extends XDecorator
+ * class YDecorator extends ZDecorator
+ * class ZDecorator extends YDecorator
+ * class WDecorator extends YDecorator
+ *
+ * When cyclic (erroneous) java hierarchy takes place, cdi should avoid cyclic dependency
+ * in components. Loader, when detects that setting super bean is going to create the cyclic
+ * dependency, sets null instead.
+ * For the example above that means:
+ * a) XDecorator will have super set to null;
+ * b) Of YDecorator, ZDecorator exactly one will have super set to null, and the other will
+ * have the correct super, which one being depended on random order or loaded resources;
+ * c) WDecorator will have super set to YDecorator, since it is outside of the loop.
+ *
+ * @throws CoreException
+ */
+ public void testCyclicDependencies() throws CoreException {
+ IDecorator xdecorator = getDecorator("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/broken/cycle/XDecorator.java");
+ assertNotNull(xdecorator);
+ ClassBean xs = ((ClassBean)xdecorator).getSuperClassBean();
+ assertNull(xs);
+ IDecorator ydecorator = getDecorator("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/broken/cycle/YDecorator.java");
+ ClassBean ys = ((ClassBean)ydecorator).getSuperClassBean();
+ IDecorator zdecorator = getDecorator("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/broken/cycle/ZDecorator.java");
+ ClassBean zs = ((ClassBean)zdecorator).getSuperClassBean();
+ IDecorator wdecorator = getDecorator("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/broken/cycle/WDecorator.java");
+ ClassBean ws = ((ClassBean)wdecorator).getSuperClassBean();
+ assertTrue((ys == null) != (zs == null));
+ assertTrue((ys == zdecorator) || (zs == ydecorator));
+ assertTrue(ws == ydecorator);
+ }
+
}
\ No newline at end of file
14 years, 1 month
JBoss Tools SVN: r27591 - in trunk/jbpm/plugins/org.jbpm.gd.jpdl: src/org/jbpm/gd/jpdl and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2010-12-17 10:54:05 -0500 (Fri, 17 Dec 2010)
New Revision: 27591
Removed:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/StartupClass.java
Modified:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml
Log:
cleanup, fix for JBDS-1442, JBDS-1444, JBDS-1445
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml 2010-12-17 15:06:47 UTC (rev 27590)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml 2010-12-17 15:54:05 UTC (rev 27591)
@@ -1574,10 +1574,6 @@
</editorContribution>
</extension>
-<!-- <extension point="org.eclipse.ui.startup">
- <startup class="org.jbpm.gd.jpdl.StartupClass"/>
- </extension> -->
-
<extension
point="org.eclipse.core.runtime.preferences">
<initializer class="org.jbpm.gd.jpdl.prefs.Initializer"/>
Deleted: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/StartupClass.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/StartupClass.java 2010-12-17 15:06:47 UTC (rev 27590)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/StartupClass.java 2010-12-17 15:54:05 UTC (rev 27591)
@@ -1,13 +0,0 @@
-package org.jbpm.gd.jpdl;
-
-import org.eclipse.ui.IStartup;
-import org.jbpm.gd.jpdl.prefs.Jbpm3PreferencesManager;
-
-public class StartupClass implements IStartup {
-
- public void earlyStartup() {
- // Reference the Jbpm3PreferencesManager to trigger the initialization.
-// Jbpm3PreferencesManager.INSTANCE.toString();
- }
-
-}
14 years, 1 month
JBoss Tools SVN: r27590 - in trunk/cdi: plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-12-17 10:06:47 -0500 (Fri, 17 Dec 2010)
New Revision: 27590
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsProcessor.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionRefactoringProcessor.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Goose_Broken.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerAnnotationsProcessor.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
Log:
https://issues.jboss.org/browse/JBIDE-7675
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-12-17 15:05:26 UTC (rev 27589)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-12-17 15:06:47 UTC (rev 27590)
@@ -739,7 +739,7 @@
*/
if(injects.size()>1) {
for (IAnnotationDeclaration inject : injects) {
- addError(CDIValidationMessages.MULTIPLE_INJECTION_CONSTRUCTORS, CDIPreferences.MULTIPLE_INJECTION_CONSTRUCTORS, inject, bean.getResource());
+ addError(CDIValidationMessages.MULTIPLE_INJECTION_CONSTRUCTORS, CDIPreferences.MULTIPLE_INJECTION_CONSTRUCTORS, inject, bean.getResource(), MULTIPLE_INJECTION_CONSTRUCTORS_ID);
}
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java 2010-12-17 15:05:26 UTC (rev 27589)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java 2010-12-17 15:06:47 UTC (rev 27590)
@@ -23,6 +23,7 @@
public static final int ILLEGAL_DISPOSER_IN_SESSION_BEAN_ID = 3;
public static final int ILLEGAL_OBSERVER_IN_SESSION_BEAN_ID = 4;
public static final int MULTIPLE_DISPOSERS_FOR_PRODUCER_ID = 5;
+ public static final int MULTIPLE_INJECTION_CONSTRUCTORS_ID = 6;
/*
* (non-Javadoc)
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2010-12-17 15:05:26 UTC (rev 27589)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2010-12-17 15:06:47 UTC (rev 27590)
@@ -83,6 +83,7 @@
public static String MAKE_METHOD_BUSINESS_MARKER_RESOLUTION_TITLE;
public static String ADD_LOCAL_BEAN_MARKER_RESOLUTION_TITLE;
public static String DELETE_ALL_DISPOSER_DUPLICANT_MARKER_RESOLUTION_TITLE;
+ public static String DELETE_ALL_INJECTED_CONSTRUCTORS_MARKER_RESOLUTION_TITLE;
public static String CDI_GENERATE_BEANS_XML;
public static String CDI_INSTALL_WIZARD_PAGE_FACET;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2010-12-17 15:05:26 UTC (rev 27589)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2010-12-17 15:06:47 UTC (rev 27590)
@@ -67,6 +67,7 @@
MAKE_METHOD_BUSINESS_MARKER_RESOLUTION_TITLE=Add ''{0}'' method to ''{1}'' interface
ADD_LOCAL_BEAN_MARKER_RESOLUTION_TITLE=Add @LocalBean annotation to ''{0}'' class
DELETE_ALL_DISPOSER_DUPLICANT_MARKER_RESOLUTION_TITLE=Delete @Disposes annotations from all methods except ''{0}'' method
+DELETE_ALL_INJECTED_CONSTRUCTORS_MARKER_RESOLUTION_TITLE=Delete @Inject annotations from all constructors except ''{0}'' constructor
CDI_GENERATE_BEANS_XML=Generate beans.xml file:
CDI_INSTALL_WIZARD_PAGE_FACET=Context and Dependency Injection (CDI) Facet
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2010-12-17 15:05:26 UTC (rev 27589)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2010-12-17 15:06:47 UTC (rev 27590)
@@ -100,6 +100,13 @@
new DeleteAllDisposerDuplicantMarkerResolution(method, file)
};
}
+ }else if (messageId == CDIValidationErrorManager.MULTIPLE_INJECTION_CONSTRUCTORS_ID) {
+ IMethod method = findMethod(file, start);
+ if(method != null){
+ return new IMarkerResolution[] {
+ new DeleteAllInjectedConstructorsMarkerResolution(method, file)
+ };
+ }
}
}
return new IMarkerResolution[] {};
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerAnnotationsProcessor.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerAnnotationsProcessor.java 2010-12-17 15:05:26 UTC (rev 27589)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerAnnotationsProcessor.java 2010-12-17 15:06:47 UTC (rev 27590)
@@ -10,79 +10,36 @@
******************************************************************************/
package org.jboss.tools.cdi.ui.marker;
-import java.text.MessageFormat;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jdt.core.IMethod;
-import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.TextFileChange;
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
-import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
-import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
-import org.eclipse.ltk.internal.core.refactoring.Messages;
import org.eclipse.text.edits.MultiTextEdit;
import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.text.edits.TextEdit;
import org.jboss.tools.cdi.core.CDIConstants;
-import org.jboss.tools.cdi.core.CDICoreMessages;
-import org.jboss.tools.cdi.core.CDICoreNature;
-import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.CDIUtil;
-import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IBeanMethod;
-import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IProducer;
import org.jboss.tools.cdi.core.IProducerMethod;
-import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.common.text.ITextSourceReference;
-public class DeleteAllDisposerAnnotationsProcessor extends RefactoringProcessor {
- protected static final RefactoringParticipant[] EMPTY_REF_PARTICIPANT = new RefactoringParticipant[0];
- private IFile file;
- private IMethod method;
- private RefactoringStatus status;
-
- private CompositeChange rootChange;
- private TextFileChange change;
- private IClassBean bean;
+public class DeleteAllDisposerAnnotationsProcessor extends MarkerResolutionRefactoringProcessor {
- public DeleteAllDisposerAnnotationsProcessor(IFile file, IMethod method){
- this.file = file;
- this.method = method;
+ public DeleteAllDisposerAnnotationsProcessor(IFile file, IMethod method, String label){
+ super(file, method, label);
}
- private IClassBean findClassBean(){
- CDICoreNature cdiNature = CDICorePlugin.getCDI(file.getProject(), true);
- if(cdiNature == null)
- return null;
-
- ICDIProject cdiProject = cdiNature.getDelegate();
-
- if(cdiProject == null)
- return null;
-
- Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
-
- for(IBean bean : beans){
- if(bean instanceof IClassBean)
- return (IClassBean)bean;
- }
-
- return null;
- }
-
private void changeDisposers(IClassBean bean) {
Set<IBeanMethod> disposers = bean.getDisposers();
if (disposers.isEmpty()) {
@@ -96,14 +53,12 @@
IProducerMethod producerMethod = (IProducerMethod) producer;
Set<IBeanMethod> disposerMethods = producer.getCDIProject().resolveDisposers(producerMethod);
boundDisposers.addAll(disposerMethods);
- if (disposerMethods.size() > 1) {
- for (IBeanMethod disposerMethod : disposerMethods) {
- if(!disposerMethod.getMethod().isSimilar(method)){
- Set<ITextSourceReference> disposerDeclarations = CDIUtil.getAnnotationPossitions(disposerMethod, CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
- for (ITextSourceReference declaration : disposerDeclarations) {
- TextEdit edit = new ReplaceEdit(declaration.getStartPosition(), declaration.getLength(), "");
- change.addEdit(edit);
- }
+ for (IBeanMethod disposerMethod : disposerMethods) {
+ if(!disposerMethod.getMethod().isSimilar(method)){
+ Set<ITextSourceReference> disposerDeclarations = CDIUtil.getAnnotationPossitions(disposerMethod, CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
+ for (ITextSourceReference declaration : disposerDeclarations) {
+ TextEdit edit = new ReplaceEdit(declaration.getStartPosition(), declaration.getLength(), "");
+ change.addEdit(edit);
}
}
}
@@ -111,59 +66,12 @@
}
}
- private boolean isFileCorrect(IFile file){
- if(!file.isSynchronized(IResource.DEPTH_ZERO)){
- status.addFatalError(Messages.format(CDICoreMessages.CDI_RENAME_PROCESSOR_OUT_OF_SYNC_FILE, file.getFullPath().toString()));
- return false;
- }else if(file.isPhantom()){
- status.addFatalError(Messages.format(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_PHANTOM_FILE, file.getFullPath().toString()));
- return false;
- }else if(file.isReadOnly()){
- status.addFatalError(Messages.format(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_READ_ONLY_FILE, file.getFullPath().toString()));
- return false;
- }
- return true;
- }
-
@Override
- public Object[] getElements() {
- return null;
- }
-
- @Override
- public String getIdentifier() {
- return "";
- }
-
- @Override
- public String getProcessorName() {
- return MessageFormat.format(CDIUIMessages.DELETE_ALL_DISPOSER_DUPLICANT_MARKER_RESOLUTION_TITLE, new Object[]{method.getElementName()});
- }
-
- @Override
- public boolean isApplicable() throws CoreException {
- return true;
- }
-
- @Override
- public RefactoringStatus checkInitialConditions(IProgressMonitor pm)
- throws CoreException, OperationCanceledException {
- status = new RefactoringStatus();
-
- if(isFileCorrect(file)){
- bean = findClassBean();
- }else
- status.addFatalError("CDI Bean Class not found");
-
- return status;
- }
-
- @Override
public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
CheckConditionsContext context) throws CoreException,
OperationCanceledException {
- rootChange = new CompositeChange(MessageFormat.format(CDIUIMessages.DELETE_ALL_DISPOSER_DUPLICANT_MARKER_RESOLUTION_TITLE, new Object[]{method.getElementName()}));
+ rootChange = new CompositeChange(label);
change = new TextFileChange(file.getName(), file);
MultiTextEdit root = new MultiTextEdit();
change.setEdit(root);
@@ -175,16 +83,4 @@
return status;
}
- @Override
- public Change createChange(IProgressMonitor pm) throws CoreException,
- OperationCanceledException {
- return rootChange;
- }
-
- @Override
- public RefactoringParticipant[] loadParticipants(RefactoringStatus status,
- SharableParticipants sharedParticipants) throws CoreException {
- return EMPTY_REF_PARTICIPANT;
- }
-
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java 2010-12-17 15:05:26 UTC (rev 27589)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java 2010-12-17 15:06:47 UTC (rev 27590)
@@ -45,7 +45,7 @@
public void run(IMarker marker) {
- DeleteAllDisposerAnnotationsProcessor processor = new DeleteAllDisposerAnnotationsProcessor(file, method);
+ DeleteAllDisposerAnnotationsProcessor processor = new DeleteAllDisposerAnnotationsProcessor(file, method, label);
ProcessorBasedRefactoring refactoring = new ProcessorBasedRefactoring(processor);
DeletePreviewWizard wizard = new DeletePreviewWizard(refactoring, RefactoringWizard.WIZARD_BASED_USER_INTERFACE);
RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
@@ -60,7 +60,7 @@
}
public RefactoringProcessor getRefactoringProcessor(){
- return new DeleteAllDisposerAnnotationsProcessor(file, method);
+ return new DeleteAllDisposerAnnotationsProcessor(file, method, label);
}
public String getDescription() {
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsMarkerResolution.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsMarkerResolution.java 2010-12-17 15:06:47 UTC (rev 27590)
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.ui.marker;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IMarkerResolution2;
+import org.eclipse.ui.internal.Workbench;
+import org.jboss.tools.cdi.ui.CDIUIMessages;
+
+/**
+ * @author Daniel Azarov
+ */
+public class DeleteAllInjectedConstructorsMarkerResolution implements IMarkerResolution2, TestableResolutionWithRefactoringProcessor {
+ private String label;
+ private IMethod method;
+ private IFile file;
+
+ public DeleteAllInjectedConstructorsMarkerResolution(IMethod method, IFile file){
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(method.getElementName()+"(");
+ String[] types = method.getParameterTypes();
+ for(int i = 0; i < types.length; i++){
+ if(i > 0)
+ buffer.append(", ");
+ buffer.append(Signature.getSignatureSimpleName(types[i]));
+ }
+ buffer.append(")");
+ this.label = MessageFormat.format(CDIUIMessages.DELETE_ALL_INJECTED_CONSTRUCTORS_MARKER_RESOLUTION_TITLE, new Object[]{buffer.toString()});
+ this.method = method;
+ this.file = file;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+
+ public void run(IMarker marker) {
+ DeleteAllInjectedConstructorsProcessor processor = new DeleteAllInjectedConstructorsProcessor(file, method, label);
+ ProcessorBasedRefactoring refactoring = new ProcessorBasedRefactoring(processor);
+ DeletePreviewWizard wizard = new DeletePreviewWizard(refactoring, RefactoringWizard.WIZARD_BASED_USER_INTERFACE);
+ RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
+ Shell shell = Workbench.getInstance().getActiveWorkbenchWindow().getShell();
+ try {
+ String titleForFailedChecks = CDIUIMessages.CDI_REFACTOR_CONTRIBUTOR_ERROR;
+ op.run(shell, titleForFailedChecks);
+ } catch (final InterruptedException irex) {
+ // operation was canceled
+ }
+
+ }
+
+ public RefactoringProcessor getRefactoringProcessor(){
+ return new DeleteAllInjectedConstructorsProcessor(file, method, label);
+ }
+
+ public String getDescription() {
+ return null;
+ }
+
+ public Image getImage() {
+ return null;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsMarkerResolution.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsProcessor.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsProcessor.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsProcessor.java 2010-12-17 15:06:47 UTC (rev 27590)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.ui.marker;
+
+import java.text.MessageFormat;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
+import org.jboss.tools.cdi.core.CDIConstants;
+import org.jboss.tools.cdi.core.IAnnotationDeclaration;
+import org.jboss.tools.cdi.core.IBeanMethod;
+import org.jboss.tools.cdi.core.IClassBean;
+
+public class DeleteAllInjectedConstructorsProcessor extends MarkerResolutionRefactoringProcessor {
+
+
+ public DeleteAllInjectedConstructorsProcessor(IFile file, IMethod method, String label){
+ super(file, method, label);
+ }
+
+ private void changeConstructors(IClassBean bean) {
+ Set<IBeanMethod> constructors = bean.getBeanConstructors();
+ if(constructors.size()>1) {
+ Set<IAnnotationDeclaration> injects = new HashSet<IAnnotationDeclaration>();
+ for (IBeanMethod constructor : constructors) {
+ if(!constructor.getMethod().isSimilar(method)){
+ IAnnotationDeclaration inject = constructor.getAnnotation(CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
+ if(inject!=null) {
+ injects.add(inject);
+ }
+ }
+ }
+ for (IAnnotationDeclaration inject : injects) {
+ TextEdit edit = new ReplaceEdit(inject.getStartPosition(), inject.getLength(), "");
+ change.addEdit(edit);
+ }
+ }
+ }
+
+
+ @Override
+ public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
+ CheckConditionsContext context) throws CoreException,
+ OperationCanceledException {
+
+ rootChange = new CompositeChange(label);
+ change = new TextFileChange(file.getName(), file);
+ MultiTextEdit root = new MultiTextEdit();
+ change.setEdit(root);
+ rootChange.add(change);
+
+ if(bean != null)
+ changeConstructors(bean);
+
+ return status;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionRefactoringProcessor.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionRefactoringProcessor.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionRefactoringProcessor.java 2010-12-17 15:06:47 UTC (rev 27590)
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.ui.marker;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
+import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
+import org.eclipse.ltk.internal.core.refactoring.Messages;
+import org.jboss.tools.cdi.core.CDICoreMessages;
+import org.jboss.tools.cdi.core.CDICoreNature;
+import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.core.ICDIProject;
+import org.jboss.tools.cdi.core.IClassBean;
+
+public abstract class MarkerResolutionRefactoringProcessor extends RefactoringProcessor {
+ protected static final RefactoringParticipant[] EMPTY_REF_PARTICIPANT = new RefactoringParticipant[0];
+ protected IFile file;
+ protected IMethod method;
+ protected RefactoringStatus status;
+ protected String label;
+
+ protected CompositeChange rootChange;
+ protected TextFileChange change;
+ protected IClassBean bean;
+
+
+ public MarkerResolutionRefactoringProcessor(IFile file, IMethod method, String label){
+ this.file = file;
+ this.method = method;
+ this.label = label;
+ }
+
+ private IClassBean findClassBean(){
+ CDICoreNature cdiNature = CDICorePlugin.getCDI(file.getProject(), true);
+ if(cdiNature == null)
+ return null;
+
+ ICDIProject cdiProject = cdiNature.getDelegate();
+
+ if(cdiProject == null)
+ return null;
+
+ Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
+
+ for(IBean bean : beans){
+ if(bean instanceof IClassBean)
+ return (IClassBean)bean;
+ }
+
+ return null;
+ }
+
+
+ private boolean isFileCorrect(IFile file){
+ if(!file.isSynchronized(IResource.DEPTH_ZERO)){
+ status.addFatalError(Messages.format(CDICoreMessages.CDI_RENAME_PROCESSOR_OUT_OF_SYNC_FILE, file.getFullPath().toString()));
+ return false;
+ }else if(file.isPhantom()){
+ status.addFatalError(Messages.format(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_PHANTOM_FILE, file.getFullPath().toString()));
+ return false;
+ }else if(file.isReadOnly()){
+ status.addFatalError(Messages.format(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_READ_ONLY_FILE, file.getFullPath().toString()));
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public Object[] getElements() {
+ return null;
+ }
+
+ @Override
+ public String getIdentifier() {
+ return "";
+ }
+
+ @Override
+ public String getProcessorName() {
+ return label;
+ }
+
+ @Override
+ public boolean isApplicable() throws CoreException {
+ return true;
+ }
+
+ @Override
+ public RefactoringStatus checkInitialConditions(IProgressMonitor pm)
+ throws CoreException, OperationCanceledException {
+ status = new RefactoringStatus();
+
+ if(isFileCorrect(file)){
+ bean = findClassBean();
+ }else
+ status.addFatalError("CDI Bean Class not found");
+
+ return status;
+ }
+
+ @Override
+ public Change createChange(IProgressMonitor pm) throws CoreException,
+ OperationCanceledException {
+ return rootChange;
+ }
+
+ @Override
+ public RefactoringParticipant[] loadParticipants(RefactoringStatus status,
+ SharableParticipants sharedParticipants) throws CoreException {
+ return EMPTY_REF_PARTICIPANT;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionRefactoringProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Goose_Broken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Goose_Broken.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Goose_Broken.java 2010-12-17 15:06:47 UTC (rev 27590)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.inject.Inject;
+
+class Goose_Broken
+{
+
+ @Inject
+ public Goose_Broken(String foo)
+ {
+ }
+
+ @Inject
+ public Goose_Broken(String foo, Double bar)
+ {
+
+ }
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Goose_Broken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2010-12-17 15:05:26 UTC (rev 27589)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2010-12-17 15:06:47 UTC (rev 27590)
@@ -31,6 +31,7 @@
import org.jboss.tools.cdi.internal.core.validation.CDIValidationErrorManager;
import org.jboss.tools.cdi.ui.marker.AddLocalBeanMarkerResolution;
import org.jboss.tools.cdi.ui.marker.DeleteAllDisposerDuplicantMarkerResolution;
+import org.jboss.tools.cdi.ui.marker.DeleteAllInjectedConstructorsMarkerResolution;
import org.jboss.tools.cdi.ui.marker.MakeFieldStaticMarkerResolution;
import org.jboss.tools.cdi.ui.marker.MakeMethodBusinessMarkerResolution;
import org.jboss.tools.cdi.ui.marker.MakeMethodPublicMarkerResolution;
@@ -352,4 +353,18 @@
DeleteAllDisposerDuplicantMarkerResolution.class);
}
+ public void testDeleteAllInjectedConstructorsResolution() throws CoreException {
+ checkResolution(tckProject,
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/Goose_Broken.java"
+ },
+// new String[]{
+// "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/Goose_Broken.qfxresult"
+// },
+ MARKER_TYPE,
+ CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME,
+ CDIValidationErrorManager.MULTIPLE_INJECTION_CONSTRUCTORS_ID,
+ DeleteAllInjectedConstructorsMarkerResolution.class);
+ }
+
}
14 years, 1 month