JBoss Tools SVN: r27649 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core: META-INF and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-21 17:47:55 -0500 (Tue, 21 Dec 2010)
New Revision: 27649
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/command/
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/META-INF/MANIFEST.MF
Log:
[JBIDE-7763][JBIDE-7371] implemented keys related methods & tests, now returning Key object
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-21 22:44:08 UTC (rev 27648)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-21 22:47:55 UTC (rev 27649)
@@ -1,3 +1,18 @@
+2010-12-21 André Dietisheim <adietish(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/core/client/unmarshal/KeysUnmarshaller.java:
+ * src/org/jboss/tools/deltacloud/core/client/unmarshal/KeyUnmarshaller.java:
+ * src/org/jboss/tools/deltacloud/core/client/unmarshal/KeyActionUnmarshaller.java:
+ * src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDOMUnmarshaller.java:
+ * src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDeltaCloudObjectUnmarshaller.java:
+ * src/org/jboss/tools/deltacloud/core/client/request/ListKeysRequest.java:
+ * src/org/jboss/tools/deltacloud/core/client/Key.java:
+ * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java
+ (createKey):
+ (listKeys):
+ (listKey):
+ [JBIDE-7763][JBIDE-7371] implemented keys related methods & tests, now returning Key object
+
2010-12-17 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java (createKey):
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/META-INF/MANIFEST.MF 2010-12-21 22:44:08 UTC (rev 27648)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/META-INF/MANIFEST.MF 2010-12-21 22:47:55 UTC (rev 27649)
@@ -13,6 +13,7 @@
Export-Package: org.jboss.tools.deltacloud.core;x-friends:="org.jboss.tools.deltacloud.ui,org.jboss.tools.deltacloud.test,org.jboss.tools.deltacloud.integration",
org.jboss.tools.deltacloud.core.client;x-friends:="org.jboss.tools.deltacloud.test,org.jboss.tools.deltacloud.ui",
org.jboss.tools.deltacloud.core.client.request;x-friends:="org.jboss.tools.deltacloud.test",
+ org.jboss.tools.deltacloud.core.client.unmarshal;x-friends:="org.jboss.tools.deltacloud.test",
org.jboss.tools.deltacloud.core.job,
org.jboss.tools.internal.deltacloud.core.observable;x-friends:="org.jboss.tools.deltacloud.ui"
Bundle-ClassPath: .,
@@ -23,5 +24,4 @@
lib/httpcore-4.0.1.jar,
lib/httpcore-nio-4.0.1.jar,
lib/httpmime-4.0.1.jar,
- lib/log4j-1.2.14.jar,
- lib/deltacloudclient-1.0.jar
+ lib/log4j-1.2.14.jar
15 years
JBoss Tools SVN: r27648 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client: request and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-21 17:44:08 -0500 (Tue, 21 Dec 2010)
New Revision: 27648
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/AbstractDeltaCloudObject.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HttpMethod.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDOMUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDeltaCloudObjectUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/IDeltaCloudObjectUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/KeyActionUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/KeyUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/KeysUnmarshaller.java
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudObject.java
Modified:
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/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/HardwareProfile.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/Image.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/KeyAction.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Property.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Realm.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/AbstractDeltaCloudRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/AbstractListObjectsRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateInstanceRequest.java
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/DeleteKeyRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/DeltaCloudRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListHardwareProfileRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListImageRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListInstanceRequest.java
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/ListKeysRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListRealmRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/PerformInstanceActionRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/TypeRequest.java
Log:
[JBIDE-7763][JBIDE-7371] implemented keys related methods & tests, now returning Key object
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/AbstractDeltaCloudObject.java (from rev 27490, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudObject.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/AbstractDeltaCloudObject.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/AbstractDeltaCloudObject.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * @author Martyn Taylor
+ * @author André Dietisheim
+ */
+public abstract class AbstractDeltaCloudObject {
+ protected String id;
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @XmlAttribute
+ public String getId() {
+ return id;
+ }
+}
Modified: 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 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/AbstractDeltaCloudResourceAction.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -10,30 +10,39 @@
******************************************************************************/
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;
+
+ @Override
+ public HttpMethod getMethod() {
+ return method;
+ }
+
+ public void setMethodString(String method) {
this.method = HttpMethod.valueOf(method.toUpperCase());
- this.name = name;
}
- protected void setName(String name) {
+ public void setMethod(HttpMethod method) {
+ this.method = method;
+ }
+
+ public void setMethod(String method) {
+ this.method = HttpMethod.valueOf(method.toUpperCase());
+ }
+
+ public void setName(String name) {
this.name = name;
}
@@ -42,7 +51,7 @@
return name;
}
- protected void setUrl(String url) {
+ public void setUrl(String url) {
this.url = url;
}
@@ -50,18 +59,4 @@
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;
- }
}
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-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -138,6 +138,16 @@
*/
public void createKey(String keyname, String keystoreLocation) throws DeltaCloudClientException;
+ /**
+ * Creates a key for a given name on the deltacloud server.
+ *
+ * @param keyname
+ * the name of the key to retrieve from the server
+ * @param keyStoreLocation
+ * the path to the file to store the key in
+ * @throws DeltaCloudClientException
+ * the delta cloud client exception
+ */
public Key createKey(String keyname) throws DeltaCloudClientException;
/**
@@ -148,6 +158,14 @@
*/
public void deleteKey(String keyname) throws DeltaCloudClientException;
+ /**
+ * Lists all keys available on the deltacloud server this client is
+ * connected to.
+ *
+ * @return the keys that are available
+ * @throws DeltaCloudClientException
+ *
+ */
public List<Key> listKeys() 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-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -38,7 +38,6 @@
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
@@ -54,7 +53,6 @@
import org.jboss.tools.deltacloud.core.client.request.CreateKeyRequest;
import org.jboss.tools.deltacloud.core.client.request.DeleteKeyRequest;
import org.jboss.tools.deltacloud.core.client.request.DeltaCloudRequest;
-import org.jboss.tools.deltacloud.core.client.request.DeltaCloudRequest.HttpMethod;
import org.jboss.tools.deltacloud.core.client.request.ListHardwareProfileRequest;
import org.jboss.tools.deltacloud.core.client.request.ListHardwareProfilesRequest;
import org.jboss.tools.deltacloud.core.client.request.ListImageRequest;
@@ -67,6 +65,8 @@
import org.jboss.tools.deltacloud.core.client.request.ListRealmsRequest;
import org.jboss.tools.deltacloud.core.client.request.PerformInstanceActionRequest;
import org.jboss.tools.deltacloud.core.client.request.TypeRequest;
+import org.jboss.tools.deltacloud.core.client.unmarshal.KeyUnmarshaller;
+import org.jboss.tools.deltacloud.core.client.unmarshal.KeysUnmarshaller;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -127,7 +127,7 @@
}
}
- protected String sendRequest(DeltaCloudRequest deltaCloudRequest) throws DeltaCloudClientException {
+ protected InputStream request(DeltaCloudRequest deltaCloudRequest) throws DeltaCloudClientException {
DefaultHttpClient httpClient = new DefaultHttpClient();
try {
URL url = deltaCloudRequest.getUrl();
@@ -136,7 +136,10 @@
HttpUriRequest request = createRequest(deltaCloudRequest);
HttpResponse httpResponse = httpClient.execute(request);
throwOnHttpErrors(deltaCloudRequest.getUrl(), httpResponse);
- return getResponse(httpResponse.getEntity());
+ if (httpResponse.getEntity() == null) {
+ return null;
+ }
+ return httpResponse.getEntity().getContent();
} catch (DeltaCloudClientException e) {
throw e;
} catch (IOException e) {
@@ -148,6 +151,18 @@
}
}
+ protected String requestStringResponse(DeltaCloudRequest deltaCloudRequest) throws DeltaCloudClientException {
+ try {
+ InputStream inputStream = request(deltaCloudRequest);
+ if (inputStream == null) {
+ return null;
+ }
+ return getResponse(inputStream);
+ } catch (IOException e) {
+ throw new DeltaCloudClientException(e);
+ }
+ }
+
private void throwOnHttpErrors(URL requestUrl, HttpResponse httpResponse) throws DeltaCloudClientException {
int statusCode = httpResponse.getStatusLine().getStatusCode();
if (HttpStatusCode.OK.isStatus(statusCode)) {
@@ -167,12 +182,12 @@
}
}
- private String getResponse(HttpEntity entity) throws IOException,
+ private String getResponse(InputStream inputStream) throws IOException,
DeltaCloudClientException {
- if (entity == null) {
+ if (inputStream == null) {
return null;
}
- String xml = readInputStreamToString(entity.getContent());
+ String xml = readInputStreamToString(inputStream);
logger.debug("Response:\n" + xml);
return xml;
}
@@ -249,7 +264,7 @@
public DeltaCloudServerType getServerType() {
DeltaCloudServerType serverType = DeltaCloudServerType.UNKNOWN;
try {
- String apiResponse = sendRequest(new TypeRequest(baseUrl));
+ String apiResponse = requestStringResponse(new TypeRequest(baseUrl));
Document document = getDocument(apiResponse);
NodeList elements = document.getElementsByTagName(DOCUMENT_ELEMENT_API);
if (elements.getLength() > 0) {
@@ -269,7 +284,7 @@
@Override
public Instance createInstance(String imageId) throws DeltaCloudClientException {
try {
- return buildInstance(sendRequest(new CreateInstanceRequest(baseUrl, imageId)));
+ return buildInstance(requestStringResponse(new CreateInstanceRequest(baseUrl, imageId)));
} catch (DeltaCloudClientException e) {
throw e;
} catch (Exception e) {
@@ -292,7 +307,8 @@
public Instance createInstance(String imageId, String profileId, String realmId, String name, String keyname,
String memory, String storage) throws DeltaCloudClientException {
try {
- return buildInstance(sendRequest(new CreateInstanceRequest(baseUrl, imageId, profileId, realmId, name,
+ return buildInstance(requestStringResponse(new CreateInstanceRequest(baseUrl, imageId, profileId, realmId,
+ name,
keyname, memory, storage)));
} catch (DeltaCloudClientException e) {
throw e;
@@ -304,7 +320,8 @@
@Override
public HardwareProfile listProfile(String profileId) throws DeltaCloudClientException {
try {
- return buildDeltaCloudObject(HardwareProfile.class, sendRequest(new ListHardwareProfileRequest(baseUrl,
+ return buildDeltaCloudObject(HardwareProfile.class, requestStringResponse(new ListHardwareProfileRequest(
+ baseUrl,
profileId)));
} catch (DeltaCloudClientException e) {
throw e;
@@ -326,7 +343,8 @@
@Override
public Image listImages(String imageId) throws DeltaCloudClientException {
- return JAXB.unmarshal(new StringReader(sendRequest(new ListImageRequest(baseUrl, imageId))), Image.class);
+ return JAXB.unmarshal(new StringReader(requestStringResponse(new ListImageRequest(baseUrl, imageId))),
+ Image.class);
}
@Override
@@ -336,10 +354,10 @@
@Override
public Instance listInstances(String instanceId) throws DeltaCloudClientException {
- // return JAXB.unmarshal(new StringReader(sendRequest(new
+ // return JAXB.unmarshal(new StringReader(request(new
// ListInstanceRequest(baseUrl, instanceId))), Instance.class);
try {
- return buildInstance(sendRequest(new ListInstanceRequest(baseUrl, instanceId)));
+ return buildInstance(requestStringResponse(new ListInstanceRequest(baseUrl, instanceId)));
} catch (DeltaCloudClientException e) {
throw e;
} catch (Exception e) {
@@ -354,14 +372,16 @@
@Override
public Realm listRealms(String realmId) throws DeltaCloudClientException {
- return JAXB.unmarshal(new StringReader(sendRequest(new ListRealmRequest(baseUrl, realmId))), Realm.class);
+ return JAXB.unmarshal(new StringReader(requestStringResponse(new ListRealmRequest(baseUrl, realmId))),
+ Realm.class);
}
public Key createKey(String keyname) throws DeltaCloudClientException {
try {
- String response = sendRequest(new CreateKeyRequest(baseUrl, keyname));
- Key key = new Key();
- return updatekey(getDocument(response), key);
+ CreateKeyRequest keyRequest = new CreateKeyRequest(baseUrl, keyname);
+ InputStream inputStream = request(keyRequest);
+ Key key = new KeyUnmarshaller().unmarshall(inputStream, new Key());
+ return key;
} catch (DeltaCloudClientException e) {
throw e;
} catch (Exception e) {
@@ -369,26 +389,14 @@
}
}
- 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);
- // }
+ try {
+ File keyFile = createKeyFile(keyname, keyStoreLocation);
+ storeKey(key.getPem(), keyFile);
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(e);
+ }
}
private void storeKey(String key, File keyFile) throws IOException {
@@ -397,26 +405,6 @@
w.close();
}
- private String trimKey(List<String> keyText) throws IOException {
- StringBuffer sb = new StringBuffer();
- String line;
- BufferedReader reader = new BufferedReader(new StringReader(keyText.get(0)));
- while ((line = reader.readLine()) != null) {
- // We must trim off the white-space from the xml
- // Complete white-space lines are to be ignored.
- String trimmedLine = line.trim();
- if (trimmedLine.length() > 0) {
- sb.append(trimmedLine).append("\n");
- }
- }
- return sb.toString();
- }
-
- private List<String> getKey(String xml) throws ParserConfigurationException, SAXException, IOException {
- List<String> keyText = getElementTextValues(getDocument(xml), PEM_FILE_SUFFIX); //$NON-NLS-1$
- return keyText;
- }
-
private File createKeyFile(String keyname, String keyStoreLocation) throws IOException {
File keyFile =
Path.fromOSString(keyStoreLocation)
@@ -432,18 +420,19 @@
}
public void deleteKey(String keyname) throws DeltaCloudClientException {
- sendRequest(new DeleteKeyRequest(baseUrl, keyname));
+ requestStringResponse(new DeleteKeyRequest(baseUrl, keyname));
}
public List<Key> listKeys() throws DeltaCloudClientException {
- String xml = sendRequest(new ListKeysRequest(baseUrl));
- Key key = JAXB.unmarshal(new StringReader(xml), Key.class);
- throw new UnsupportedOperationException();
+ InputStream inputStream = request(new ListKeysRequest(baseUrl));
+ List<Key> keys = new ArrayList<Key>();
+ new KeysUnmarshaller().unmarshall(inputStream, keys);
+ return keys;
}
public Key listKey(String name) throws DeltaCloudClientException {
- String xml = sendRequest(new ListKeyRequest(baseUrl, name));
- Key key = JAXB.unmarshal(new StringReader(xml), Key.class);
+ InputStream inputStream = request(new ListKeyRequest(baseUrl, name));
+ Key key = new KeyUnmarshaller().unmarshall(inputStream, new Key());
return key;
}
@@ -481,21 +470,6 @@
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();
@@ -584,14 +558,6 @@
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>();
@@ -675,11 +641,11 @@
return href.substring(href.lastIndexOf("/") + 1, href.length());
}
- private <T extends DeltaCloudObject> List<T> listDeltaCloudObjects(Class<T> clazz,
+ private <T extends AbstractDeltaCloudObject> List<T> listDeltaCloudObjects(Class<T> clazz,
AbstractListObjectsRequest request, String elementName)
throws DeltaCloudClientException {
try {
- Document document = getDocument(sendRequest(request));
+ Document document = getDocument(requestStringResponse(request));
ArrayList<T> dco = new ArrayList<T>();
NodeList nodeList = document.getElementsByTagName(elementName);
for (int i = 0; i < nodeList.getLength(); i++) {
@@ -714,7 +680,7 @@
public boolean performInstanceAction(InstanceAction action) throws DeltaCloudClientException {
if (action != null) {
try {
- String response = sendRequest(
+ String response = requestStringResponse(
new PerformInstanceActionRequest(new URL(action.getUrl()),
action.getMethod()));
if (!InstanceAction.DESTROY.equals(action.getName())) {
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudObject.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudObject.java 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudObject.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -1,37 +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;
-
-import java.io.Serializable;
-
-import javax.xml.bind.annotation.XmlAttribute;
-
-/**
- * @author Martyn Taylor
- */
-public abstract class DeltaCloudObject implements Serializable
-{
- private static final long serialVersionUID = 1L;
-
- protected String id;
-
- @SuppressWarnings("unused")
- private void setId(String id)
- {
- this.id = id;
- }
-
- @XmlAttribute
- public String getId()
- {
- return id;
- }
-}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -16,7 +16,7 @@
/**
* @author Martyn Taylor
*/
-public class HardwareProfile extends DeltaCloudObject
+public class HardwareProfile extends AbstractDeltaCloudObject
{
private static final long serialVersionUID = 1L;
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HttpMethod.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HttpMethod.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HttpMethod.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * 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 enum HttpMethod {
+ GET, POST, PUT, DELETE, HEAD;
+}
\ No newline at end of file
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HttpMethod.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: 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 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/IDeltaCloudResourceAction.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.deltacloud.core.client;
-import org.jboss.tools.deltacloud.core.client.request.DeltaCloudRequest.HttpMethod;
/**
* @author André Dietisheim
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Image.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Image.java 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Image.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -15,7 +15,7 @@
/**
* @author Martyn Taylor
*/
-public class Image extends DeltaCloudObject
+public class Image extends AbstractDeltaCloudObject
{
private static final long serialVersionUID = 1L;
@@ -69,8 +69,7 @@
return name;
}
- public String getDescription()
- {
+ public String getDescription() {
return description;
}
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-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -19,7 +19,7 @@
* @author Martyn Taylor
* @author Andre Dietisheim
*/
-public class Instance extends DeltaCloudObject {
+public class Instance extends AbstractDeltaCloudObject {
private static final long serialVersionUID = 1L;
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-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/InstanceAction.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -28,15 +28,10 @@
super();
}
- protected InstanceAction(String name, String url, String method, Instance instance) {
- super(name, url, method);
+ public void setInstance(Instance instance) {
this.instance = instance;
}
- protected void setInstance(Instance instance) {
- this.instance = instance;
- }
-
@Override
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-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Key.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -14,49 +14,46 @@
import java.net.URL;
import java.util.List;
+import javax.xml.bind.annotation.XmlRootElement;
+
/**
* @author Andre Dietisheim
*/
-public class Key extends DeltaCloudObject {
+@XmlRootElement
+public class Key extends AbstractDeltaCloudObject {
private static final long serialVersionUID = 1L;
private URL url;
- private String id;
private String pem;
- private String fingerPrint;
+ private String fingerprint;
private String state;
private List<KeyAction> actions;
- public String getId() {
- return id;
+ public Key() {
}
- protected void setUrl(String url) throws MalformedURLException {
- this.url = new URL(url);
- }
-
- protected void setUrl(URL url) {
+ public void setUrl(URL url) {
this.url = url;
}
- protected void setId(String id) {
- this.id = id;
+ public void setUrl(String url) throws MalformedURLException {
+ this.url = new URL(url);
}
- protected void setPem(String pem) {
+ public void setPem(String pem) {
this.pem = pem;
}
- protected void setFingerPrint(String fingerPrint) {
- this.fingerPrint = fingerPrint;
+ public void setFingerprint(String fingerprint) {
+ this.fingerprint = fingerprint;
}
- protected void setState(String state) {
+ public void setState(String state) {
this.state = state;
}
- protected void setActions(List<KeyAction> actions) {
+ public void setActions(List<KeyAction> actions) {
this.actions = actions;
}
@@ -64,8 +61,8 @@
return url;
}
- public String getFingerPrint() {
- return fingerPrint;
+ public String getFingerprint() {
+ return fingerprint;
}
public String getPem() {
@@ -79,5 +76,4 @@
public List<KeyAction> getActions() {
return actions;
}
-
}
Modified: 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 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/KeyAction.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.deltacloud.core.client;
+
+
/**
* An action that is executable on a deltacloud key
*
@@ -19,18 +21,14 @@
private Key key;
- protected KeyAction() {
+ public KeyAction() {
+ super();
}
- protected KeyAction(String name, Key key, String url, String method) {
- super(name, url, method);
+ public void setKey(Key key) {
this.key = key;
}
- protected void setKey(Key key) {
- this.key = key;
- }
-
@Override
public Key getKey() {
return key;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Property.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Property.java 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Property.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -17,7 +17,7 @@
/**
* @author Martyn Taylor
*/
-public class Property extends DeltaCloudObject {
+public class Property extends AbstractDeltaCloudObject {
private static final long serialVersionUID = 1L;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Realm.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Realm.java 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Realm.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -15,7 +15,7 @@
/**
* @author Martyn Taylor
*/
-public class Realm extends DeltaCloudObject
+public class Realm extends AbstractDeltaCloudObject
{
private static final long serialVersionUID = 1L;
@@ -88,6 +88,4 @@
s += "Limit:\t\t" + getLimit() + "\n";
return s;
}
-
-
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/AbstractDeltaCloudRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/AbstractDeltaCloudRequest.java 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/AbstractDeltaCloudRequest.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -13,6 +13,7 @@
import java.net.MalformedURLException;
import java.net.URL;
+import org.jboss.tools.deltacloud.core.client.HttpMethod;
import org.jboss.tools.deltacloud.core.client.utils.UrlBuilder;
/**
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/AbstractListObjectsRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/AbstractListObjectsRequest.java 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/AbstractListObjectsRequest.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -12,6 +12,7 @@
import java.net.URL;
+import org.jboss.tools.deltacloud.core.client.HttpMethod;
import org.jboss.tools.deltacloud.core.client.utils.UrlBuilder;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateInstanceRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateInstanceRequest.java 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateInstanceRequest.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -12,6 +12,7 @@
import java.net.URL;
+import org.jboss.tools.deltacloud.core.client.HttpMethod;
import org.jboss.tools.deltacloud.core.client.utils.UrlBuilder;
/**
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-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateKeyRequest.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -12,6 +12,7 @@
import java.net.URL;
+import org.jboss.tools.deltacloud.core.client.HttpMethod;
import org.jboss.tools.deltacloud.core.client.utils.UrlBuilder;
/**
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/DeleteKeyRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/DeleteKeyRequest.java 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/DeleteKeyRequest.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -12,6 +12,7 @@
import java.net.URL;
+import org.jboss.tools.deltacloud.core.client.HttpMethod;
import org.jboss.tools.deltacloud.core.client.utils.UrlBuilder;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/DeltaCloudRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/DeltaCloudRequest.java 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/DeltaCloudRequest.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -13,6 +13,8 @@
import java.net.MalformedURLException;
import java.net.URL;
+import org.jboss.tools.deltacloud.core.client.HttpMethod;
+
/**
* @author André Dietisheim
*/
@@ -21,13 +23,8 @@
public static final char PATH_SEPARATOR = '/';
public static final char PARAMETER_SEPARATOR = '?';
public static final String API_PATH_SEGMENT = "api";
-
- public enum HttpMethod {
- GET, POST, PUT, DELETE, HEAD;
- }
public URL getUrl() throws MalformedURLException;
public HttpMethod getHttpMethod();
-
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListHardwareProfileRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListHardwareProfileRequest.java 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListHardwareProfileRequest.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -12,6 +12,7 @@
import java.net.URL;
+import org.jboss.tools.deltacloud.core.client.HttpMethod;
import org.jboss.tools.deltacloud.core.client.utils.UrlBuilder;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListImageRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListImageRequest.java 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListImageRequest.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -12,6 +12,7 @@
import java.net.URL;
+import org.jboss.tools.deltacloud.core.client.HttpMethod;
import org.jboss.tools.deltacloud.core.client.utils.UrlBuilder;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListInstanceRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListInstanceRequest.java 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListInstanceRequest.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -12,6 +12,7 @@
import java.net.URL;
+import org.jboss.tools.deltacloud.core.client.HttpMethod;
import org.jboss.tools.deltacloud.core.client.utils.UrlBuilder;
Modified: 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 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListKeyRequest.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -12,6 +12,7 @@
import java.net.URL;
+import org.jboss.tools.deltacloud.core.client.HttpMethod;
import org.jboss.tools.deltacloud.core.client.utils.UrlBuilder;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListKeysRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListKeysRequest.java 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListKeysRequest.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -12,6 +12,7 @@
import java.net.URL;
+import org.jboss.tools.deltacloud.core.client.HttpMethod;
import org.jboss.tools.deltacloud.core.client.utils.UrlBuilder;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListRealmRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListRealmRequest.java 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListRealmRequest.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -12,6 +12,7 @@
import java.net.URL;
+import org.jboss.tools.deltacloud.core.client.HttpMethod;
import org.jboss.tools.deltacloud.core.client.utils.UrlBuilder;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/PerformInstanceActionRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/PerformInstanceActionRequest.java 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/PerformInstanceActionRequest.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -12,6 +12,7 @@
import java.net.URL;
+import org.jboss.tools.deltacloud.core.client.HttpMethod;
import org.jboss.tools.deltacloud.core.client.utils.UrlBuilder;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/TypeRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/TypeRequest.java 2010-12-21 21:13:06 UTC (rev 27647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/TypeRequest.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -12,6 +12,7 @@
import java.net.URL;
+import org.jboss.tools.deltacloud.core.client.HttpMethod;
import org.jboss.tools.deltacloud.core.client.utils.UrlBuilder;
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDOMUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDOMUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDOMUnmarshaller.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * 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.unmarshal;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.MessageFormat;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ * @author André Dietisheim
+ *
+ * @param <DELTACLOUDOBJECT>
+ */
+public abstract class AbstractDOMUnmarshaller<DELTACLOUDOBJECT> {
+
+ private Class<DELTACLOUDOBJECT> type;
+ private String tagName;
+
+ public AbstractDOMUnmarshaller(String tagName, Class<DELTACLOUDOBJECT> type) {
+ this.type = type;
+ this.tagName = tagName;
+ }
+
+ public DELTACLOUDOBJECT unmarshall(InputStream inputStream, DELTACLOUDOBJECT resource) throws DeltaCloudClientException {
+ try {
+ Element element = getFirstElement(tagName, getDocument(inputStream));
+ return unmarshall(element, resource);
+ } catch (Exception e) {
+ // TODO: internationalize strings
+ throw new DeltaCloudClientException(
+ MessageFormat.format("Could not unmarshall type \"{0}\"", type), e);
+ }
+
+ }
+
+ protected Document getDocument(InputStream inputStream) throws ParserConfigurationException, SAXException, IOException {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder documentBuilder = factory.newDocumentBuilder();
+ return documentBuilder.parse(inputStream);
+ }
+
+ public DELTACLOUDOBJECT unmarshall(Element element, DELTACLOUDOBJECT resource) throws DeltaCloudClientException {
+ try {
+ return doUnmarshall(element, resource);
+ } catch (Exception e) {
+ // TODO: internationalize strings
+ throw new DeltaCloudClientException(
+ MessageFormat.format("Could not unmarshall type \"{0}\"", type), e);
+ }
+ }
+
+ protected abstract DELTACLOUDOBJECT doUnmarshall(Element element, DELTACLOUDOBJECT resource) throws Exception;
+
+ protected String getFirstElementText(String elementName, Element element) {
+ Element firstElement = getFirstElement(elementName, element);
+ if (firstElement == null) {
+ return null;
+ }
+ return firstElement.getTextContent();
+ }
+
+ protected Element getFirstElement(String elementName, Element element) {
+ NodeList elements = element.getElementsByTagName(elementName);
+ if (elements != null
+ && elements.getLength() > 0) {
+ return (Element) elements.item(0);
+ }
+ return null;
+ }
+
+ protected Element getFirstElement(String elementName, Document document) {
+ NodeList elements = document.getElementsByTagName(elementName);
+ if (elements != null
+ && elements.getLength() > 0) {
+ return (Element) elements.item(0);
+ }
+ return null;
+ }
+
+ protected String getAttributeText(String attributeName, Element element) {
+ Node attribute = element.getAttributeNode(attributeName);
+ if (attribute != null) {
+ return attribute.getTextContent();
+ }
+ return null;
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDOMUnmarshaller.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDeltaCloudObjectUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDeltaCloudObjectUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDeltaCloudObjectUnmarshaller.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+* 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.unmarshal;
+
+import java.io.InputStream;
+import java.text.MessageFormat;
+
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+
+/**
+ * @author André Dietisheim
+ *
+ * @param <RESOURCE>
+ */
+public abstract class AbstractDeltaCloudObjectUnmarshaller<RESOURCE> implements IDeltaCloudObjectUnmarshaller<RESOURCE> {
+
+ private Class<RESOURCE> type;
+
+ public AbstractDeltaCloudObjectUnmarshaller(Class<RESOURCE> type) {
+ this.type = type;
+ }
+
+ public RESOURCE create(InputStream inputStream) throws DeltaCloudException {
+
+ try {
+ return doCreate(inputStream);
+ } catch (Exception e) {
+ // TODO: internationalize strings
+ throw new DeltaCloudException(
+ MessageFormat.format("Could not unmarshall resource of type \"{0}\"", type), e);
+ }
+ }
+
+ protected abstract RESOURCE doCreate(InputStream inputStream) throws Exception;
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDeltaCloudObjectUnmarshaller.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/IDeltaCloudObjectUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/IDeltaCloudObjectUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/IDeltaCloudObjectUnmarshaller.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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.unmarshal;
+
+import java.io.InputStream;
+
+/**
+ * @author André Dietisheim
+ */
+public interface IDeltaCloudObjectUnmarshaller<DELTACLOUDOBJECT> {
+
+ public DELTACLOUDOBJECT unmarshall(InputStream inputStream);
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/IDeltaCloudObjectUnmarshaller.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/KeyActionUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/KeyActionUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/KeyActionUnmarshaller.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.unmarshal;
+
+import org.jboss.tools.deltacloud.core.client.KeyAction;
+import org.w3c.dom.Element;
+
+/**
+ * @author André Dietisheim
+ */
+public class KeyActionUnmarshaller extends AbstractDOMUnmarshaller<KeyAction> {
+
+ public KeyActionUnmarshaller() {
+ super("link", KeyAction.class);
+ }
+
+ @Override
+ protected KeyAction doUnmarshall(Element element, KeyAction keyAction) throws Exception {
+ if (element != null) {
+ keyAction.setMethod(getAttributeText("method", element));
+ keyAction.setName(getAttributeText("rel", element));
+ keyAction.setUrl(getAttributeText("href", element));
+ }
+ return keyAction;
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/KeyActionUnmarshaller.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/KeyUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/KeyUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/KeyUnmarshaller.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * 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.unmarshal;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.core.client.Key;
+import org.jboss.tools.deltacloud.core.client.KeyAction;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author André Dietisheim
+ */
+public class KeyUnmarshaller extends AbstractDOMUnmarshaller<Key> {
+
+ public KeyUnmarshaller() {
+ super("key", Key.class);
+ }
+
+ protected Key doUnmarshall(Element element, Key key) throws Exception {
+ if (element != null) {
+ key.setId(getAttributeText("id", element));
+ key.setUrl(getAttributeText("href", element));
+ key.setState(getFirstElementText("state", element));
+ key.setFingerprint(getFirstElementText("fingerprint", element));
+ key.setPem(trimPem(getPem(element))); //$NON-NLS-1$
+ key.setActions(getKeyActions(element));
+ }
+ return key;
+ }
+
+ private String getPem(Element element) {
+ Element pemElement = getFirstElement("pem", element);
+ if (pemElement != null) {
+ return getFirstElementText("pem", pemElement);
+ }
+ return null;
+
+ }
+
+ private String trimPem(String pem) throws IOException {
+ if (pem == null
+ || pem.length() <= 0) {
+ return null;
+ }
+ StringBuffer sb = new StringBuffer();
+ String line = null;
+ BufferedReader reader = new BufferedReader(new StringReader(pem));
+ while ((line = reader.readLine()) != null) {
+ // We must trim off the white-space from the xml
+ // Complete white-space lines are to be ignored.
+ String trimmedLine = line.trim();
+ if (trimmedLine.length() > 0) {
+ sb.append(trimmedLine).append('\n');
+ }
+ }
+ return sb.toString();
+ }
+
+
+ private List<KeyAction> getKeyActions(Element keyElement) throws DeltaCloudClientException {
+ if (keyElement == null) {
+ return null;
+ }
+ List<KeyAction> actions = new ArrayList<KeyAction>();
+ NodeList nodeList = keyElement.getElementsByTagName("link");
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node linkNode = nodeList.item(i);
+ KeyAction keyAction = createKeyAction(linkNode);
+ if (keyAction != null) {
+ actions.add(keyAction);
+ }
+ }
+ return actions;
+ }
+
+ private KeyAction createKeyAction(Node node) throws DeltaCloudClientException {
+ if (!(node instanceof Element)) {
+ return null;
+ }
+ KeyAction keyAction = new KeyAction();
+ new KeyActionUnmarshaller().unmarshall((Element) node, keyAction);
+ return keyAction;
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/KeyUnmarshaller.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/KeysUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/KeysUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/KeysUnmarshaller.java 2010-12-21 22:44:08 UTC (rev 27648)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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.unmarshal;
+
+import java.util.List;
+
+import org.jboss.tools.deltacloud.core.client.Key;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author André Dietisheim
+ */
+@SuppressWarnings("rawtypes")
+public class KeysUnmarshaller extends AbstractDOMUnmarshaller<List> {
+
+ public KeysUnmarshaller() {
+ super("keys", List.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected List doUnmarshall(Element element, List keys) throws Exception {
+ if (element != null) {
+ NodeList nodeList = element.getElementsByTagName("key");
+ if (nodeList != null
+ && nodeList.getLength() > 0) {
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node node = nodeList.item(i);
+ if (node instanceof Element) {
+ Key key = new KeyUnmarshaller().unmarshall((Element) node, new Key());
+ keys.add(key);
+ }
+ }
+ }
+ }
+ return keys;
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/KeysUnmarshaller.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years
JBoss Tools SVN: r27647 - trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters.
by jbosstools-commits@lists.jboss.org
Author: bbrodt
Date: 2010-12-21 16:13:06 -0500 (Tue, 21 Dec 2010)
New Revision: 27647
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/ForEachAdapter.java
Log:
https://issues.jboss.org/browse/JBIDE-7960
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/ForEachAdapter.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/ForEachAdapter.java 2010-12-21 18:35:01 UTC (rev 27646)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/ForEachAdapter.java 2010-12-21 21:13:06 UTC (rev 27647)
@@ -12,6 +12,7 @@
import org.eclipse.bpel.model.BPELPackage;
import org.eclipse.bpel.model.ForEach;
+import org.eclipse.bpel.model.Scope;
import org.eclipse.bpel.ui.adapters.delegates.ActivityContainer;
import org.eclipse.bpel.ui.editparts.OutlineTreeEditPart;
import org.eclipse.bpel.ui.editparts.SequenceEditPart;
@@ -55,4 +56,15 @@
Messages.ForEachAdapter_1, AnnotationHelper.getAnnotation(obj.getStartCounterValue()),
};
}
+
+ @Override
+ public boolean canAddObject(Object object, Object child, Object insertBefore) {
+ ForEach forEach = (ForEach)object;
+ if (forEach.getActivity()==null && child instanceof Scope) {
+ return getContainerDelegate(object).canAddObject(object, child, insertBefore);
+ }
+ else
+ return false;
+ }
+
}
15 years
JBoss Tools SVN: r27646 - trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2010-12-21 13:35:01 -0500 (Tue, 21 Dec 2010)
New Revision: 27646
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/TextEditingActionsTest.java
Log:
Added test for inserting Enter via Visual Editor
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/TextEditingActionsTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/TextEditingActionsTest.java 2010-12-21 16:47:11 UTC (rev 27645)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/TextEditingActionsTest.java 2010-12-21 18:35:01 UTC (rev 27646)
@@ -12,12 +12,17 @@
package org.jboss.tools.vpe.ui.bot.test.editor;
import java.awt.event.KeyEvent;
+import java.io.File;
import org.eclipse.swtbot.swt.finder.utils.Position;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
import org.jboss.tools.ui.bot.ext.Timing;
import org.jboss.tools.ui.bot.ext.helper.KeyboardHelper;
import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
+import org.jboss.tools.ui.bot.ext.view.ProblemsView;
+import org.jboss.tools.vpe.ui.bot.test.VPEAutoTestCase;
import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
import org.mozilla.interfaces.nsIDOMNode;
/**
@@ -126,6 +131,30 @@
TextEditingActionsTest.TEST_PAGE_NAME);
}
+ /**
+ * Tests insert Enter in Visual Editor
+ */
+ public void testInsertEnter(){
+
+ jspEditor.setText(TextEditingActionsTest.PAGE_TEXT);
+ jspEditor.save();
+ bot.sleep(Timing.time3S());
+ nsIDOMNode node = webBrowser.getDomNodeByTagName("SPAN", 0);
+ webBrowser.selectDomNode(node, 0);
+ bot.sleep(Timing.time1S());
+ // Check inserting Enter Functionality
+ Position cursorPosition = jspEditor.cursorPosition();
+ jspEditor.deselectAndSetCursorPosition(cursorPosition.line, cursorPosition.column);
+ webBrowser.setFocus();
+ KeyboardHelper.typeKeyCodeUsingAWTRepeately(KeyEvent.VK_ENTER, 6);
+ jspEditor.save();
+ bot.sleep(Timing.time3S());
+ String jspEditorText = jspEditor.getText();
+ assertTrue ("Source Editor should has text " + TextEditingActionsTest.PAGE_TEXT +
+ "\nbut it is\n" + jspEditorText,
+ jspEditorText.equals(TextEditingActionsTest.PAGE_TEXT)); }
+
+
@Override
protected void closeUnuseDialogs() {
@@ -180,6 +209,7 @@
webBrowser.setFocus();
KeyboardHelper.typeKeyCodeUsingAWTRepeately(KeyEvent.VK_RIGHT, textToContain.length());
KeyboardHelper.selectTextUsingAWTKeyBoard(false, textToCutCopy.length());
+ bot.sleep(Timing.time2S());
webBrowser.clickContextMenu(node,
SWTBotWebBrowser.CUT_MENU_LABEL);
jspEditor.save();
@@ -212,5 +242,15 @@
assertVisualEditorContainsNodeWithValue(webBrowser,
textToContain,
TextEditingActionsTest.TEST_PAGE_NAME);
+ SWTBotTreeItem[] errors = ProblemsView.getFilteredErrorsTreeItems(botExt,
+ null,
+ File.separator + VPEAutoTestCase.JBT_TEST_PROJECT_NAME,
+ TextEditingActionsTest.TEST_PAGE_NAME,
+ null);
+ assertTrue("There were these errors when editing page "
+ + TextEditingActionsTest.TEST_PAGE_NAME
+ + ": "
+ + SWTEclipseExt.getFormattedTreeNodesText(bot.tree(), errors),
+ errors == null || errors.length == 0);
}
}
15 years
JBoss Tools SVN: r27645 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi: internal/core/impl and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-12-21 11:47:11 -0500 (Tue, 21 Dec 2010)
New Revision: 27645
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java
Log:
JBIDE-7946
https://issues.jboss.org/browse/JBIDE-7946
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java 2010-12-21 16:39:09 UTC (rev 27644)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java 2010-12-21 16:47:11 UTC (rev 27645)
@@ -12,6 +12,7 @@
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -25,8 +26,11 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationDefinition;
import org.jboss.tools.cdi.internal.core.impl.definition.DefinitionContext;
import org.jboss.tools.cdi.internal.core.impl.definition.ParametedTypeFactory;
+import org.jboss.tools.cdi.internal.core.impl.definition.TypeDefinition;
import org.jboss.tools.cdi.internal.core.scanner.lib.ClassPathMonitor;
import org.jboss.tools.common.model.XJob;
import org.jboss.tools.common.model.XJob.XRunnable;
@@ -87,6 +91,77 @@
return dependsOn;
}
+ public Set<CDICoreNature> getCDIProjects(boolean hierarchy) {
+ if(hierarchy) {
+ if(dependsOn.isEmpty()) return dependsOn;
+ Set<CDICoreNature> result = new HashSet<CDICoreNature>();
+ getAllCDIProjects(result);
+ return result;
+ } else {
+ return dependsOn;
+ }
+ }
+
+ void getAllCDIProjects(Set<CDICoreNature> result) {
+ for (CDICoreNature n:dependsOn) {
+ if(result.contains(n)) continue;
+ result.add(n);
+ n.getAllCDIProjects(result);
+ }
+ }
+
+ public List<TypeDefinition> getAllTypeDefinitions() {
+ Set<CDICoreNature> ps = getCDIProjects(true);
+ if(ps == null || ps.isEmpty()) {
+ return getDefinitions().getTypeDefinitions();
+ }
+ List<TypeDefinition> ds = getDefinitions().getTypeDefinitions();
+ List<TypeDefinition> result = new ArrayList<TypeDefinition>();
+ result.addAll(ds);
+ Set<IType> types = new HashSet<IType>();
+ for (TypeDefinition d: ds) {
+ IType t = d.getType();
+ if(t != null) types.add(t);
+ }
+ for (CDICoreNature p: ps) {
+ List<TypeDefinition> ds2 = p.getDefinitions().getTypeDefinitions();
+ for (TypeDefinition d: ds2) {
+ IType t = d.getType();
+ if(t != null && !types.contains(t)) {
+ types.add(t);
+ result.add(d);
+ }
+ }
+ }
+ return result;
+ }
+
+ public List<AnnotationDefinition> getAllAnnotations() {
+ Set<CDICoreNature> ps = getCDIProjects(true);
+ if(ps == null || ps.isEmpty()) {
+ return getDefinitions().getAllAnnotations();
+ }
+ List<AnnotationDefinition> ds = getDefinitions().getAllAnnotations();
+ List<AnnotationDefinition> result = new ArrayList<AnnotationDefinition>();
+ result.addAll(ds);
+ Set<IType> types = new HashSet<IType>();
+ for (AnnotationDefinition d: ds) {
+ IType t = d.getType();
+ if(t != null) types.add(t);
+ }
+ for (CDICoreNature p: ps) {
+ List<AnnotationDefinition> ds2 = p.getDefinitions().getAllAnnotations();
+ for (AnnotationDefinition d: ds2) {
+ IType t = d.getType();
+ if(t != null && !types.contains(t)) {
+ types.add(t);
+ result.add(d);
+ }
+ }
+ }
+ return result;
+ }
+
public Set<CDICoreNature> getDependentProjects() {
return usedBy;
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2010-12-21 16:39:09 UTC (rev 27644)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2010-12-21 16:47:11 UTC (rev 27645)
@@ -1041,7 +1041,7 @@
interceptorBindingsByPath.clear();
scopes.clear();
scopesByPath.clear();
- List<AnnotationDefinition> ds = getAllAnnotations();
+ List<AnnotationDefinition> ds = n.getAllAnnotations();
for (AnnotationDefinition d: ds) {
if((d.getKind() & AnnotationDefinition.STEREOTYPE) > 0) {
StereotypeElement s = new StereotypeElement();
@@ -1087,60 +1087,8 @@
}
}
- List<AnnotationDefinition> getAllAnnotations() {
- Set<CDICoreNature> ps = n.getCDIProjects();
- if(ps == null || ps.isEmpty()) {
- return n.getDefinitions().getAllAnnotations();
- }
- List<AnnotationDefinition> ds = n.getDefinitions().getAllAnnotations();
- List<AnnotationDefinition> result = new ArrayList<AnnotationDefinition>();
- result.addAll(ds);
- Set<IType> types = new HashSet<IType>();
- for (AnnotationDefinition d: ds) {
- IType t = d.getType();
- if(t != null) types.add(t);
- }
- for (CDICoreNature p: ps) {
- List<AnnotationDefinition> ds2 = p.getDefinitions().getAllAnnotations();
- for (AnnotationDefinition d: ds2) {
- IType t = d.getType();
- if(t != null && !types.contains(t)) {
- types.add(t);
- result.add(d);
- }
- }
- }
- return result;
- }
-
- List<TypeDefinition> getAllTypeDefinitions() {
- Set<CDICoreNature> ps = n.getCDIProjects();
- if(ps == null || ps.isEmpty()) {
- return n.getDefinitions().getTypeDefinitions();
- }
- List<TypeDefinition> ds = n.getDefinitions().getTypeDefinitions();
- List<TypeDefinition> result = new ArrayList<TypeDefinition>();
- result.addAll(ds);
- Set<IType> types = new HashSet<IType>();
- for (TypeDefinition d: ds) {
- IType t = d.getType();
- if(t != null) types.add(t);
- }
- for (CDICoreNature p: ps) {
- List<TypeDefinition> ds2 = p.getDefinitions().getTypeDefinitions();
- for (TypeDefinition d: ds2) {
- IType t = d.getType();
- if(t != null && !types.contains(t)) {
- types.add(t);
- result.add(d);
- }
- }
- }
- return result;
- }
-
void rebuildBeans() {
- List<TypeDefinition> typeDefinitions = getAllTypeDefinitions();
+ List<TypeDefinition> typeDefinitions = n.getAllTypeDefinitions();
List<IBean> beans = new ArrayList<IBean>();
Map<IType, ClassBean> newClassBeans = new HashMap<IType, ClassBean>();
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java 2010-12-21 16:39:09 UTC (rev 27644)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/DefinitionContext.java 2010-12-21 16:47:11 UTC (rev 27645)
@@ -282,7 +282,7 @@
String name = type.getFullyQualifiedName();
AnnotationDefinition result = annotations.get(name);
if(result == null) {
- Set<CDICoreNature> ns = project.getCDIProjects();
+ Set<CDICoreNature> ns = project.getCDIProjects(true);
for (CDICoreNature n: ns) {
result = n.getDefinitions().getAnnotation(type);
if(result != null) {
15 years
JBoss Tools SVN: r27644 - in trunk/cdi/tests/org.jboss.tools.cdi.core.test: projects/CDITest2 and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-12-21 11:39:09 -0500 (Tue, 21 Dec 2010)
New Revision: 27644
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/.classpath
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/.project
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/.settings/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/.settings/org.eclipse.jdt.core.prefs
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/bin/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/bin/cdi/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/bin/cdi/test3/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/bin/cdi/test3/C.class
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/src/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/src/cdi/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/src/cdi/test3/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/src/cdi/test3/C.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest2/.classpath
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/DependentProjectTest.java
Log:
JBIDE-7946
https://issues.jboss.org/browse/JBIDE-7946
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest2/.classpath
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest2/.classpath 2010-12-21 16:00:19 UTC (rev 27643)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest2/.classpath 2010-12-21 16:39:09 UTC (rev 27644)
@@ -2,8 +2,8 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="lib" path="lib/cdi-api.jar"/>
- <classpathentry kind="lib" path="lib/javax.inject.jar"/>
- <classpathentry combineaccessrules="false" kind="src" path="/CDITest1"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdi-api.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/javax.inject.jar"/>
+ <classpathentry combineaccessrules="false" exported="true" kind="src" path="/CDITest1"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/.classpath
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/.classpath (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/.classpath 2010-12-21 16:39:09 UTC (rev 27644)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/CDITest2"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/.project
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/.project (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/.project 2010-12-21 16:39:09 UTC (rev 27644)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>CDITest3</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.tools.cdi.core.cdibuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.jboss.tools.jst.web.kb.kbnature</nature>
+ <nature>org.jboss.tools.cdi.core.cdinature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/.settings/org.eclipse.jdt.core.prefs 2010-12-21 16:39:09 UTC (rev 27644)
@@ -0,0 +1,12 @@
+#Tue Dec 21 19:01:41 MSK 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/bin/cdi/test3/C.class
===================================================================
(Binary files differ)
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/bin/cdi/test3/C.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/src/cdi/test3/C.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/src/cdi/test3/C.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/src/cdi/test3/C.java 2010-12-21 16:39:09 UTC (rev 27644)
@@ -0,0 +1,10 @@
+package cdi.test3;
+
+import javax.inject.Inject;
+
+import cdi.test.MyBean;
+import cdi.test.MyQualifier;
+
+public class C {
+ @Inject @MyQualifier MyBean bean;
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest3/src/cdi/test3/C.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/DependentProjectTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/DependentProjectTest.java 2010-12-21 16:00:19 UTC (rev 27643)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/DependentProjectTest.java 2010-12-21 16:39:09 UTC (rev 27644)
@@ -20,6 +20,7 @@
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.IQualifier;
import org.jboss.tools.cdi.core.IScope;
import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
@@ -33,6 +34,7 @@
protected static String PLUGIN_ID = "org.jboss.tools.cdi.core.test";
IProject project1 = null;
IProject project2 = null;
+ IProject project3 = null;
public DependentProjectTest() {}
@@ -44,6 +46,10 @@
project2 = ResourcesUtils.importProject(PLUGIN_ID, "/projects/CDITest2");
project2.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
JobUtils.waitForIdle();
+
+ project3 = ResourcesUtils.importProject(PLUGIN_ID, "/projects/CDITest3");
+ project3.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ JobUtils.waitForIdle();
}
public void testDependentProject() throws CoreException, IOException {
@@ -94,10 +100,16 @@
assertNotNull(ns);
assertNull(sd);
+ boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
+ JobUtils.waitForIdle();
IFile scope2File = project1.getFile(new Path("src/cdi/test/Scope2.java"));
IFile scope21File = project1.getFile(new Path("src/cdi/test/Scope2.1"));
scope2File.setContents(scope21File.getContents(), IFile.FORCE, new NullProgressMonitor());
JobUtils.waitForIdle();
+ project1.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor());
+ JobUtils.waitForIdle();
+ ResourcesUtils.setBuildAutomatically(saveAutoBuild);
+ JobUtils.waitForIdle();
producer = getProducer("/CDITest2/src/test/Test1.java");
scope = producer.getScope();
@@ -121,11 +133,20 @@
return producer;
}
+ public void testIndirectDependency() throws CoreException, IOException {
+ ICDIProject cdi3 = CDICorePlugin.getCDIProject(project3, true);
+ Set<IBean> beans = cdi3.getBeans(new Path("/CDITest1/src/cdi/test/MyBean.java"));
+ assertFalse(beans.isEmpty());
+ IQualifier q = cdi3.getQualifier("cdi.test.MyQualifier");
+ assertNotNull(q);
+ }
+
public void tearDown() throws Exception {
boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
JobUtils.waitForIdle();
project1.delete(true, true, null);
project2.delete(true, true, null);
+ project3.delete(true, true, null);
JobUtils.waitForIdle();
ResourcesUtils.setBuildAutomatically(saveAutoBuild);
}
15 years
JBoss Tools SVN: r27643 - trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2010-12-21 11:00:19 -0500 (Tue, 21 Dec 2010)
New Revision: 27643
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/Messages.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchConfigurationDelegate.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchShortcut.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/messages.properties
Log:
https://issues.jboss.org/browse/JBIDE-7782
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/Messages.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/Messages.java 2010-12-21 15:22:59 UTC (rev 27642)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/Messages.java 2010-12-21 16:00:19 UTC (rev 27643)
@@ -11,6 +11,7 @@
public static String SmooksLaunchConfigurationDelegate_Error_missing_artifact;
public static String SmooksLaunchConfigurationDelegate_Error_missing_artifact2;
public static String SmooksLaunchConfigurationDelegate_Error_Title;
+ public static String SmooksLaunchConfigurationDelegate_Error_Java_Unsupported;
public static String SmooksLauncher_Error_Do_Not_Support_Java_Inputs;
public static String SmooksLauncher_Templating_To_StreamResult;
public static String SmooksLauncher_Java_Mapping_Results;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchConfigurationDelegate.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchConfigurationDelegate.java 2010-12-21 15:22:59 UTC (rev 27642)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchConfigurationDelegate.java 2010-12-21 16:00:19 UTC (rev 27643)
@@ -79,7 +79,10 @@
launchMetadata.setSmooksConfig(project.findMember(smooksConfigName));
- if(!launchMetadata.isValidSmooksConfig()) {
+ if(SmooksInputType.INPUT_TYPE_JAVA.equals(launchMetadata.getInputType())) {
+ displayError(smooksConfigName, Messages.SmooksLaunchConfigurationDelegate_Error_Java_Unsupported);
+ return;
+ } else if(!launchMetadata.isValidSmooksConfig()) {
displayError(smooksConfigName, launchMetadata.getErrorMessage());
return;
} else {
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchShortcut.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchShortcut.java 2010-12-21 15:22:59 UTC (rev 27642)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchShortcut.java 2010-12-21 16:00:19 UTC (rev 27643)
@@ -29,6 +29,7 @@
import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.smooks.configuration.RuntimeMetadata;
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
+import org.jboss.tools.smooks.core.SmooksInputType;
import org.jboss.tools.smooks.editor.AbstractSmooksFormEditor;
public class SmooksLaunchShortcut extends JUnitLaunchShortcut {
@@ -104,7 +105,10 @@
}
RuntimeMetadata metadata = new RuntimeMetadata();
metadata.setSmooksConfig(elementToLaunch);
- if (!metadata.isValidSmooksConfig()) {
+ if(SmooksInputType.INPUT_TYPE_JAVA.equals(metadata.getInputType())) {
+ MessageDialog.openError(getShell(), Messages.SmooksLaunchShortcut_Title_Launch_Failed, Messages.SmooksLaunchConfigurationDelegate_Error_Java_Unsupported);
+ return;
+ } else if (!metadata.isValidSmooksConfig()) {
MessageDialog.openError(getShell(), Messages.SmooksLaunchShortcut_Title_Launch_Failed, metadata.getErrorMessage());
return;
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/messages.properties
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/messages.properties 2010-12-21 15:22:59 UTC (rev 27642)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/messages.properties 2010-12-21 16:00:19 UTC (rev 27643)
@@ -5,6 +5,7 @@
SmooksLaunchConfigurationDelegate_Error_missing_artifact=This configuration depends on the '
SmooksLaunchConfigurationDelegate_Error_missing_artifact2=' Smooks artifact. Download Smooks and add the Smooks jars to the Project classpath, or update your Maven POM to include the missing artifact.
SmooksLaunchConfigurationDelegate_Error_Title=Error
+SmooksLaunchConfigurationDelegate_Error_Java_Unsupported=Launching of Java Input Task based configurations are not yet supported.
SmooksLauncher_Error_Do_Not_Support_Java_Inputs=Sorry... we don't support Java Inputs yet.
SmooksLauncher_Templating_To_StreamResult=Stream Templating Result
SmooksLauncher_Java_Mapping_Results=Java Mapping Results
15 years
JBoss Tools SVN: r27642 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2010-12-21 10:22:59 -0500 (Tue, 21 Dec 2010)
New Revision: 27642
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
Log:
JBIDE-7945
KB Builder warning is confusing
Problem marker description and locations are fixed due to be more informative
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2010-12-21 15:19:54 UTC (rev 27641)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2010-12-21 15:22:59 UTC (rev 27642)
@@ -41,6 +41,8 @@
import org.jboss.tools.common.model.project.ext.event.Change;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.xml.XMLUtilities;
+import org.jboss.tools.jst.web.kb.internal.IKBBuilderRequiredNature;
+import org.jboss.tools.jst.web.kb.internal.validation.ProjectValidationContext;
import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.IBijectedAttribute;
import org.jboss.tools.seam.core.ISeamComponent;
@@ -56,6 +58,7 @@
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.SeamCoreBuilder;
+import org.jboss.tools.seam.core.SeamCoreMessages;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.event.ISeamProjectChangeListener;
import org.jboss.tools.seam.core.event.SeamProjectChangeEvent;
@@ -65,14 +68,13 @@
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
import org.jboss.tools.seam.internal.core.scanner.lib.ClassPath;
-import org.jboss.tools.jst.web.kb.internal.validation.ProjectValidationContext;
import org.osgi.service.prefs.BackingStoreException;
import org.w3c.dom.Element;
/**
* @author Viacheslav Kabanovich
*/
-public class SeamProject extends SeamObject implements ISeamProject, IProjectNature {
+public class SeamProject extends SeamObject implements ISeamProject, IProjectNature, IKBBuilderRequiredNature {
IProject project;
@@ -2491,4 +2493,12 @@
}
+ public boolean isKBBuilderRequired() {
+ return true;
+ }
+
+ public String getNatureDescription() {
+ return SeamCoreMessages.SEAM_NATURE_DESCRIPTION;
+ }
+
}
15 years
JBoss Tools SVN: r27641 - trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2010-12-21 10:19:54 -0500 (Tue, 21 Dec 2010)
New Revision: 27641
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/JSFNature.java
Log:
JBIDE-7945
KB Builder warning is confusing
Problem marker description and locations are fixed due to be more informative
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/JSFNature.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/JSFNature.java 2010-12-21 15:17:55 UTC (rev 27640)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/JSFNature.java 2010-12-21 15:19:54 UTC (rev 27641)
@@ -16,8 +16,10 @@
import org.jboss.tools.common.model.project.IAutoLoad;
import org.jboss.tools.common.model.project.ModelNature;
import org.jboss.tools.jsf.JSFModelPlugin;
+import org.jboss.tools.jsf.messages.JSFUIMessages;
+import org.jboss.tools.jst.web.kb.internal.IKBBuilderRequiredNature;
-public class JSFNature extends ModelNature {
+public class JSFNature extends ModelNature implements IKBBuilderRequiredNature {
public static final String NATURE_ID = JSFModelPlugin.PLUGIN_ID + ".jsfnature";
public static final String NATURE_NICK = "org.jboss.tools.struts.strutsnature";
static String BUILDER_ID = "org.jboss.tools.common.verification.verifybuilder";
@@ -50,4 +52,12 @@
removeFromBuildSpec(BUILDER_ID);
super.deconfigure();
}
+
+ public boolean isKBBuilderRequired() {
+ return true;
+ }
+
+ public String getNatureDescription() {
+ return JSFUIMessages.JSFNatureDescription;
+ }
}
15 years
JBoss Tools SVN: r27640 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2010-12-21 10:17:55 -0500 (Tue, 21 Dec 2010)
New Revision: 27640
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
Log:
JBIDE-7945
KB Builder warning is confusing
Problem marker description and locations are fixed due to be more informative
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2010-12-21 15:11:39 UTC (rev 27639)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2010-12-21 15:17:55 UTC (rev 27640)
@@ -28,6 +28,7 @@
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IProjectNature;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -866,6 +867,29 @@
//TODO Implement if it will be needed events and listeners. and fire events to them.
}
+ private static String[] getKBBuilderRequiredNatureDescriptions(IProject project) {
+ ArrayList<String> natureDescriptions = new ArrayList<String>();
+ try {
+ IProjectDescription projectDescription = project.getDescription();
+ String[] ids = projectDescription.getNatureIds();
+ if (ids == null) return (String[])natureDescriptions.toArray(new String[0]);
+ for (String id : ids) {
+ IProjectNature nature = project.getNature(id);
+ if (nature instanceof IKBBuilderRequiredNature) {
+ if (((IKBBuilderRequiredNature)nature).isKBBuilderRequired()) {
+ String description = ((IKBBuilderRequiredNature)nature).getNatureDescription();
+ if (description != null && description.length() > 0) {
+ natureDescriptions.add(description);
+ }
+ }
+ }
+ }
+ } catch (CoreException ex) {
+ WebKbPlugin.getDefault().logError(ex);
+ }
+ return (String[])natureDescriptions.toArray(new String[0]);
+ }
+
/**
* Check if KB builder is installed and add a warning with quick fix to the project if it is not.
* @param resource
@@ -875,8 +899,25 @@
if (project == null)
return false; // Cannot check anything
+ String[] descriptions = getKBBuilderRequiredNatureDescriptions(project);
+ if (descriptions == null || descriptions.length == 0)
+ return true; // KBBuilder is not needed
+
+ StringBuffer natures = new StringBuffer();
+ for (int i = 0; i < descriptions.length; i++) {
+ if (i > 0) {
+ if (i != descriptions.length - 1) {
+ natures.append(KbMessages.KBNATURE_SEPARATOR).append(' ');
+ } else {
+ natures.append(' ').append(KbMessages.KBNATURE_LAST_SEPARATOR).append(' ');
+ }
+ }
+ natures.append(descriptions[i]);
+ }
+
boolean kbNatureFound = false;
boolean kbBuilderFound = false;
+
try {
kbNatureFound = (project.getNature(IKbProject.NATURE_ID) != null);
@@ -912,14 +953,14 @@
if (markers == null || markers.length == 0) {
try {
- IMarker m = createOrUpdateKbProblemMarker(null, project, !kbNatureFound, !kbBuilderFound);
+ IMarker m = createOrUpdateKbProblemMarker(null, project, !kbNatureFound, !kbBuilderFound, natures.toString());
} catch (CoreException ex) {
WebKbPlugin.getDefault().logError(ex);
}
} else {
for (IMarker m : markers) {
try {
- m = createOrUpdateKbProblemMarker(m, project, !kbNatureFound, !kbBuilderFound);
+ m = createOrUpdateKbProblemMarker(m, project, !kbNatureFound, !kbBuilderFound, natures.toString());
} catch (CoreException ex) {
WebKbPlugin.getDefault().logError(ex);
}
@@ -957,17 +998,31 @@
return (l == null) ? null : l.toArray(new IMarker[0]);
}
- private static IMarker createOrUpdateKbProblemMarker(IMarker m, IResource r, boolean kbNatureIsAbsent, boolean kbBuilderIsAbsent) throws CoreException {
+ private static IMarker createOrUpdateKbProblemMarker(IMarker m, IResource r, boolean kbNatureIsAbsent, boolean kbBuilderIsAbsent, String natures) throws CoreException {
ArrayList<String> args = new ArrayList<String>();
- args.add(kbNatureIsAbsent ? KbMessages.KBNATURE_NOT_FOUND : ""); //$NON-NLS-1$
- args.add(kbBuilderIsAbsent ? KbMessages.KBBUILDER_NOT_FOUND : ""); //$NON-NLS-1$
+
+ StringBuffer arg = new StringBuffer();
+ if (kbNatureIsAbsent) {
+ arg.append(KbMessages.KBNATURE_NOT_FOUND);
+ }
+ if (kbBuilderIsAbsent) {
+ if (kbNatureIsAbsent) arg.append('/');
+ arg.append(KbMessages.KBBUILDER_NOT_FOUND);
+ }
+ args.add(arg.toString());
+ args.add(natures);
+
String message = MessageFormat.format(KbMessages.KBPROBLEM, args.toArray());
+ String location = MessageFormat.format(KbMessages.KBPROBLEM_LOCATION, new Object[] {r.getProject().getName()});
+
if (m == null) {
m = r.createMarker(KB_BUILDER_PROBLEM_MARKER_TYPE);
r.setPersistentProperty(KbProjectFactory.NATURE_MOCK, "true"); //$NON-NLS-1$
KbProjectFactory.getKbProject(r.getProject(), true);
}
+
+ m.setAttribute(IMarker.LOCATION, location);
m.setAttribute(IMarker.MESSAGE, message);
m.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
m.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_NORMAL);
15 years