JBoss Tools SVN: r27689 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-22 14:21:36 -0500 (Wed, 22 Dec 2010)
New Revision: 27689
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java
Log:
[JBIDE-7981] need to create a documentbuilder on each new parsing to avoid threads using the same builder.
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-22 18:32:00 UTC (rev 27688)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java 2010-12-22 19:21:36 UTC (rev 27689)
@@ -85,8 +85,6 @@
private static final Pattern ELEMENT_TEXTVALUE_REGEX = Pattern
.compile("[^\n\t ]+[^\n]+");
- private DocumentBuilder documentBuilder;
-
public static enum DeltaCloudServerType {
UNKNOWN, MOCK, EC2
}
@@ -94,6 +92,7 @@
private URL baseUrl;
private String username;
private String password;
+ private DocumentBuilderFactory documentBuilderFactory;
public DeltaCloudClientImpl(String url) throws MalformedURLException,
DeltaCloudClientException {
@@ -105,7 +104,7 @@
this.baseUrl = createUrl(url);
this.username = username;
this.password = password;
- documentBuilder = createDocumentBuilder();
+ this.documentBuilderFactory = DocumentBuilderFactory.newInstance();
}
private URL createUrl(String url) throws DeltaCloudClientException {
@@ -117,16 +116,6 @@
}
}
- private DocumentBuilder createDocumentBuilder()
- throws DeltaCloudClientException {
- try {
- return DocumentBuilderFactory.newInstance().newDocumentBuilder();
- } catch (ParserConfigurationException e) {
- throw new DeltaCloudClientException(
- "Could not create document builder", e);
- }
- }
-
protected InputStream request(DeltaCloudRequest deltaCloudRequest)
throws DeltaCloudClientException {
DefaultHttpClient httpClient = new DefaultHttpClient();
@@ -327,9 +316,9 @@
String realmId, String name, String keyname, String memory,
String storage) throws DeltaCloudClientException {
try {
- return buildInstance(requestStringResponse(new CreateInstanceRequest(
- baseUrl, imageId, profileId, realmId, name, keyname,
- memory, storage)));
+ String response = requestStringResponse(
+ new CreateInstanceRequest(baseUrl, imageId, profileId, realmId, name, keyname, memory, storage));
+ return buildInstance(response);
} catch (DeltaCloudClientException e) {
throw e;
} catch (Exception e) {
@@ -338,12 +327,10 @@
}
@Override
- public HardwareProfile listProfile(String profileId)
- throws DeltaCloudClientException {
+ public HardwareProfile listProfile(String profileId) throws DeltaCloudClientException {
try {
return buildDeltaCloudObject(HardwareProfile.class,
- requestStringResponse(new ListHardwareProfileRequest(
- baseUrl, profileId)));
+ requestStringResponse(new ListHardwareProfileRequest(baseUrl, profileId)));
} catch (DeltaCloudClientException e) {
throw e;
} catch (Exception e) {
@@ -352,8 +339,7 @@
}
@Override
- public List<HardwareProfile> listProfiles()
- throws DeltaCloudClientException {
+ public List<HardwareProfile> listProfiles() throws DeltaCloudClientException {
return listDeltaCloudObjects(HardwareProfile.class,
new ListHardwareProfilesRequest(baseUrl), "hardware_profile");
}
@@ -373,8 +359,8 @@
@Override
public List<Instance> listInstances() throws DeltaCloudClientException {
- return listDeltaCloudObjects(Instance.class, new ListInstancesRequest(
- baseUrl), "instance");
+ return listDeltaCloudObjects(Instance.class,
+ new ListInstancesRequest(baseUrl), "instance");
}
@Override
@@ -394,8 +380,7 @@
@Override
public List<Realm> listRealms() throws DeltaCloudClientException {
- return listDeltaCloudObjects(Realm.class,
- new ListRealmsRequest(baseUrl), "realm");
+ return listDeltaCloudObjects(Realm.class, new ListRealmsRequest(baseUrl), "realm");
}
@Override
@@ -696,7 +681,7 @@
String elementName) throws DeltaCloudClientException {
try {
Document document = getDocument(requestStringResponse(request));
- ArrayList<T> dco = new ArrayList<T>();
+ List<T> dco = new ArrayList<T>();
NodeList nodeList = document.getElementsByTagName(elementName);
for (int i = 0; i < nodeList.getLength(); i++) {
dco.add(buildDeltaCloudObject(clazz, nodeToString(nodeList.item(i))));
@@ -710,9 +695,9 @@
}
}
- private Document getDocument(String response)
- throws ParserConfigurationException, SAXException, IOException {
+ private Document getDocument(String response) throws ParserConfigurationException, SAXException, IOException {
InputSource is = new InputSource(new StringReader(response));
+ DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.parse(is);
return document;
}
@@ -729,8 +714,7 @@
}
}
- public boolean performInstanceAction(InstanceAction action)
- throws DeltaCloudClientException {
+ public boolean performInstanceAction(InstanceAction action) throws DeltaCloudClientException {
if (action != null) {
try {
String response = requestStringResponse(new PerformInstanceActionRequest(
@@ -739,9 +723,9 @@
updateInstance(response, action.getInstance());
}
} catch (MalformedURLException e) {
- throw new DeltaCloudClientException(MessageFormat.format(
- "Could not perform action {0} on instance {1}",
- action.getName(), action.getInstance().getName()), e);
+ throw new DeltaCloudClientException(
+ MessageFormat.format("Could not perform action {0} on instance {1}", action.getName(), action
+ .getInstance().getName()), e);
} catch (DeltaCloudClientException e) {
throw e;
} catch (Exception e) {
@@ -759,8 +743,7 @@
t.transform(new DOMSource(node), new StreamResult(writer));
return writer.toString();
} catch (TransformerException e) {
- throw new DeltaCloudClientException(
- "Error transforming node to string", e);
+ throw new DeltaCloudClientException("Error transforming node to string", e);
}
}
14 years
JBoss Tools SVN: r27688 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui: src/org/jboss/tools/internal/deltacloud/ui/wizards and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-22 13:32:00 -0500 (Wed, 22 Dec 2010)
New Revision: 27688
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfilePage.java
Log:
[JBIDE-7984] added guard to avoid NPE
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-12-22 18:31:43 UTC (rev 27687)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-12-22 18:32:00 UTC (rev 27688)
@@ -1,5 +1,10 @@
2010-12-22 adietisheim <adietisheim@adietisheim-thinkpad>
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfilePage.java
+ (setCPU):
+ (setMemody):
+ (setStorage):
+ [JBIDE-7984] added guard to avoid NPE
* src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePageLabelAndContentProvider.java:
* src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java
(.doRun):
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfilePage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfilePage.java 2010-12-22 18:31:43 UTC (rev 27687)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfilePage.java 2010-12-22 18:32:00 UTC (rev 27688)
@@ -102,13 +102,13 @@
memoryLabel.setText(WizardMessages.getString(MEMORY_LABEL));
storageLabel = new Label(container, SWT.NULL);
storageLabel.setText(WizardMessages.getString(STORAGE_LABEL));
-
+
FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
cpuLabel.setLayoutData(fd);
DeltaCloudHardwareProperty cpuProperty = profile.getNamedProperty("cpu"); //$NON-NLS-1$
- setCPU(cpuProperty.getValue());
+ setCPU(cpuProperty);
Control cpuControl = createCpuControls(cpuProperty, storageLabel, container);
fd = new FormData();
@@ -116,7 +116,7 @@
fd.top = new FormAttachment(cpuLabel, 8);
memoryLabel.setLayoutData(fd);
DeltaCloudHardwareProperty memoryProperty = profile.getNamedProperty("memory"); //$NON-NLS-1$
- setMemody(memoryProperty.getValue());
+ setMemody(memoryProperty);
Control memoryControl = createMemoyControl(cpuControl, memoryProperty, storageLabel, container);
fd = new FormData();
@@ -124,7 +124,7 @@
fd.top = new FormAttachment(memoryControl, 8);
storageLabel.setLayoutData(fd);
DeltaCloudHardwareProperty storageProperty = profile.getNamedProperty("storage"); //$NON-NLS-1$
- setStorage(storageProperty.getValue());
+ setStorage(storageProperty);
createStorageControls(memoryControl, memoryProperty, storageProperty, storageLabel, container);
}
@@ -230,7 +230,8 @@
return storageControl;
}
- private Control createMemoyControl(Control cpuControl, DeltaCloudHardwareProperty memoryProperty, Label storageLabel, Composite container) {
+ private Control createMemoyControl(Control cpuControl, DeltaCloudHardwareProperty memoryProperty,
+ Label storageLabel, Composite container) {
Control memoryControl = null;
if (memoryProperty != null) {
if (memoryProperty.getKind() == DeltaCloudHardwareProperty.Kind.FIXED) {
@@ -391,10 +392,12 @@
container.setVisible(visible);
}
- private void setCPU(String value) {
- this.cpu = value;
+ private void setCPU(DeltaCloudHardwareProperty property) {
+ if (property != null) {
+ this.cpu = property.getValue();
+ }
}
-
+
public String getCPU() {
if (cpu != null && !cpu.equals(cpuDefaultValue)) {
return cpu;
@@ -402,8 +405,10 @@
return null;
}
- private void setMemody(String value) {
- this.memory = value;
+ private void setMemody(DeltaCloudHardwareProperty property) {
+ if (property != null) {
+ this.memory = property.getValue();
+ }
}
public String getMemory() {
@@ -413,17 +418,19 @@
return null;
}
- private void setStorage(String value) {
- this.storage = value;
+ private void setStorage(DeltaCloudHardwareProperty property) {
+ if (property != null) {
+ this.storage = property.getValue();
+ }
}
-
+
public String getStorage() {
if (storage != null && !storage.equals(storageDefaultValue)) {
return storage;
}
return null;
}
-
+
public Composite getControl() {
return container;
}
14 years
JBoss Tools SVN: r27687 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-22 13:31:43 -0500 (Wed, 22 Dec 2010)
New Revision: 27687
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java
Log:
[JBIDE-7984] corrected message typos
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java 2010-12-22 18:31:08 UTC (rev 27686)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java 2010-12-22 18:31:43 UTC (rev 27687)
@@ -210,7 +210,7 @@
private void asyncGetProfiles() {
// TODO: internationalize strings
- new AbstractCloudElementJob("Get Profiles", cloud, CLOUDELEMENT.PROFILES) {
+ new AbstractCloudElementJob("Get profiles", cloud, CLOUDELEMENT.PROFILES) {
protected IStatus doRun(IProgressMonitor monitor) throws Exception {
try {
List<DeltaCloudHardwareProfile> profiles = Arrays.asList(cloud.getProfiles());
@@ -221,7 +221,7 @@
} catch (DeltaCloudException e) {
// TODO: internationalize strings
return StatusFactory.getInstance(IStatus.ERROR, Activator.PLUGIN_ID,
- MessageFormat.format("Could not get allProfiles from cloud {0}", cloud.getName()));
+ MessageFormat.format("Could not get profiles from cloud {0}", cloud.getName()));
}
}
}.schedule();
14 years
JBoss Tools SVN: r27686 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-22 13:31:08 -0500 (Wed, 22 Dec 2010)
New Revision: 27686
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java
Log:
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-22 18:29:57 UTC (rev 27685)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java 2010-12-22 18:31:08 UTC (rev 27686)
@@ -468,14 +468,11 @@
private Instance updateInstance(String xml, Instance instance)
throws Exception {
Document document = getDocument(xml);
- instance.setImageId(getIdFromHref(getAttributeValues(document,
- "image", "href").get(0))); //$NON-NLS-1$ //$NON-NLS-2$
- instance.setProfileId(getIdFromHref(getAttributeValues(document,
- "hardware_profile", "href").get(0))); //$NON-NLS-1$ //$NON-NLS-2$
+ instance.setImageId(getIdFromHref(getAttributeValues(document, "image", "href").get(0))); //$NON-NLS-1$ //$NON-NLS-2$
+ instance.setProfileId(getIdFromHref(getAttributeValues(document, "hardware_profile", "href").get(0))); //$NON-NLS-1$ //$NON-NLS-2$
getProfileProperties(instance,
getPropertyNodes(document, "hardware_profile")); //$NON-NLS-1$
- instance.setRealmId(getIdFromHref(getAttributeValues(document,
- "realm", "href").get(0))); //$NON-NLS-1$ //$NON-NLS-2$
+ instance.setRealmId(getIdFromHref(getAttributeValues(document, "realm", "href").get(0))); //$NON-NLS-1$ //$NON-NLS-2$
instance.setState(getElementTextValues(document, "state").get(0)); //$NON-NLS-1$
getAuthentication(document, instance);
instance.setActions(createInstanceActions(instance, document));
@@ -702,8 +699,7 @@
ArrayList<T> dco = new ArrayList<T>();
NodeList nodeList = document.getElementsByTagName(elementName);
for (int i = 0; i < nodeList.getLength(); i++) {
- dco.add(buildDeltaCloudObject(clazz,
- nodeToString(nodeList.item(i))));
+ dco.add(buildDeltaCloudObject(clazz, nodeToString(nodeList.item(i))));
}
return dco;
} catch (DeltaCloudClientException e) {
14 years
JBoss Tools SVN: r27685 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-22 13:29:57 -0500 (Wed, 22 Dec 2010)
New Revision: 27685
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
Log:
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-12-22 18:13:05 UTC (rev 27684)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-12-22 18:29:57 UTC (rev 27685)
@@ -72,12 +72,13 @@
}
public DeltaCloud(String name, String url, String username, Driver driver, String imageFilterRules,
- String instanceFilterRules) throws DeltaCloudException {
+ String instanceFilterRules)
+ throws DeltaCloudException {
this(name, url, username, null, driver, imageFilterRules, instanceFilterRules);
}
- public DeltaCloud(String name, String url, String username, String password,
- Driver driver, String imageFilterRules, String instanceFilterRules) throws DeltaCloudException {
+ public DeltaCloud(String name, String url, String username, String password, Driver driver,
+ String imageFilterRules, String instanceFilterRules) throws DeltaCloudException {
this.url = url;
this.name = name;
this.username = username;
@@ -114,8 +115,7 @@
return true;
}
- private boolean updateConnectionProperties(String url, String username, String password)
- throws DeltaCloudException {
+ private boolean updateConnectionProperties(String url, String username, String password) throws DeltaCloudException {
boolean changed = false;
if (!equals(this.url, url)) {
this.url = url;
@@ -205,9 +205,8 @@
if (!rules.equals(ruleString)) {
// TODO: remove notification with all instanceRepo, replace by
// notifying the changed instance
- firePropertyChange(PROP_INSTANCES,
- getInstancesRepository().get(),
- getInstancesRepository().get());
+ firePropertyChange(
+ PROP_INSTANCES, getInstancesRepository().get(), getInstancesRepository().get());
}
}
@@ -236,9 +235,7 @@
if (!rules.equals(ruleString)) {
// TODO: remove notification with all instanceRepo, replace by
// notifying the changed instance
- firePropertyChange(PROP_IMAGES,
- getImagesRepository().get(),
- getImagesRepository().get());
+ firePropertyChange(PROP_IMAGES, getImagesRepository().get(), getImagesRepository().get());
}
}
@@ -265,8 +262,8 @@
* @throws DeltaCloudException
*/
public void loadChildren() throws DeltaCloudException {
- DeltaCloudMultiException multiException = new DeltaCloudMultiException(MessageFormat.format(
- "Could not load children of cloud {0}", getName()));
+ DeltaCloudMultiException multiException = new DeltaCloudMultiException(
+ MessageFormat.format("Could not load children of cloud {0}", getName()));
clearImages();
clearInstances();
try {
@@ -292,7 +289,8 @@
@Override
public boolean matchesState(DeltaCloudInstance instance, DeltaCloudInstance.State instanceState) {
- return expectedState != null && expectedState.equals(instanceState);
+ return expectedState != null
+ && expectedState.equals(instanceState);
}
};
return waitForState(instanceId, stateMatcher, pm);
@@ -333,8 +331,8 @@
// notifying the changed instance
firePropertyChange(PROP_INSTANCES, oldInstances, repo.get());
} catch (DeltaCloudClientException e) {
- throw new DeltaCloudException(MessageFormat.format("Could not load instanceRepo of cloud {0}: {1}",
- getName(), e.getMessage()), e);
+ throw new DeltaCloudException(MessageFormat.format(
+ "Could not load instanceRepo of cloud {0}: {1}", getName(), e.getMessage()), e);
}
}
@@ -349,9 +347,7 @@
private void clearInstances() {
// TODO: remove notification with all instanceRepo, replace by
// notifying the changed instance
- firePropertyChange(PROP_INSTANCES,
- getInstancesRepository().get(),
- getInstancesRepository().clear());
+ firePropertyChange(PROP_INSTANCES, getInstancesRepository().get(), getInstancesRepository().clear());
}
private DeltaCloudInstancesRepository getInstancesRepository() {
@@ -478,12 +474,10 @@
DeltaCloudHardwareProfile profile = new DeltaCloudHardwareProfile(i.next());
profiles.add(profile);
}
+ return profiles.toArray(new DeltaCloudHardwareProfile[profiles.size()]);
} catch (DeltaCloudClientException e) {
throw new DeltaCloudException(MessageFormat.format("Could not list profiles on cloud {0}", name), e);
}
- DeltaCloudHardwareProfile[] profileArray = new DeltaCloudHardwareProfile[profiles.size()];
- profileArray = profiles.toArray(profileArray);
- return profileArray;
}
/**
@@ -506,8 +500,8 @@
firePropertyChange(PROP_IMAGES, oldImages, repo.get());
} catch (DeltaCloudClientException e) {
clearImages();
- throw new DeltaCloudException(MessageFormat.format("Could not load images of cloud {0}: {1}",
- getName(), e.getMessage()), e);
+ throw new DeltaCloudException(
+ MessageFormat.format("Could not load images of cloud {0}: {1}", getName(), e.getMessage()), e);
}
}
@@ -566,7 +560,8 @@
return Driver.valueOf(serverType);
} catch (Exception e) {
// TODO internationalize strings
- throw new DeltaCloudException("Could not determine the driver of the server on url " + url, e);
+ throw new DeltaCloudException(
+ "Could not determine the driver of the server on url " + url, e);
}
}
14 years
JBoss Tools SVN: r27684 - in trunk/hibernatetools/plugins: org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2010-12-22 13:13:05 -0500 (Wed, 22 Dec 2010)
New Revision: 27684
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ConsoleConfigurationPropertySource.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java
Log:
https://issues.jboss.org/browse/JBIDE-7982 - fixed
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java 2010-12-22 18:09:46 UTC (rev 27683)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java 2010-12-22 18:13:05 UTC (rev 27684)
@@ -24,8 +24,7 @@
import java.io.File;
import java.io.Serializable;
import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.ArrayList;
import java.util.Properties;
import org.w3c.dom.Element;
@@ -52,16 +51,20 @@
// TODO: we should move this to some classhandler
static public class ConfigurationMode implements Serializable {
- private static final Map<String, ConfigurationMode> INSTANCES = new HashMap<String, ConfigurationMode>();
+ private static final ArrayList<ConfigurationMode> INSTANCES = new ArrayList<ConfigurationMode>();
+ private static final ArrayList<String> LABELS = new ArrayList<String>();
public static final ConfigurationMode CORE = new ConfigurationMode( "CORE" ); //$NON-NLS-1$
public static final ConfigurationMode ANNOTATIONS = new ConfigurationMode( "ANNOTATIONS" ); //$NON-NLS-1$
public static final ConfigurationMode JPA = new ConfigurationMode( "JPA" ); //$NON-NLS-1$
static {
- INSTANCES.put( CORE.name, CORE );
- INSTANCES.put( ANNOTATIONS.name, ANNOTATIONS );
- INSTANCES.put( JPA.name, JPA );
+ INSTANCES.add(CORE);
+ INSTANCES.add(ANNOTATIONS);
+ INSTANCES.add(JPA);
+ LABELS.add("Core"); //$NON-NLS-1$
+ LABELS.add("Annotations"); //$NON-NLS-1$
+ LABELS.add("JPA"); //$NON-NLS-1$
}
private final String name;
@@ -75,11 +78,22 @@
}
private Object readResolve() {
- return INSTANCES.get( name );
+ Object res = null;
+ for (int i = 0; i < INSTANCES.size() && res == null; i++) {
+ if (INSTANCES.get(i).name.equals(name)) {
+ res = INSTANCES.get(i);
+ }
+ }
+ return res;
}
public static ConfigurationMode parse(String name) {
- ConfigurationMode rtn = INSTANCES.get( name );
+ ConfigurationMode rtn = null;
+ for (int i = 0; i < INSTANCES.size() && rtn == null; i++) {
+ if (INSTANCES.get(i).name.equals(name)) {
+ rtn = INSTANCES.get(i);
+ }
+ }
if ( rtn == null ) {
// default is POJO
rtn = CORE;
@@ -87,9 +101,17 @@
return rtn;
}
- public static String[] values(){
- return INSTANCES.keySet().toArray(new String[INSTANCES.size()]);
+ public static String[] values() {
+ final String[] res = new String[INSTANCES.size()];
+ for (int i = 0; i < INSTANCES.size(); i++) {
+ res[i] = INSTANCES.get(i).name;
+ }
+ return res;
}
+
+ public static String[] labels() {
+ return LABELS.toArray(new String[LABELS.size()]);
+ }
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ConsoleConfigurationPropertySource.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ConsoleConfigurationPropertySource.java 2010-12-22 18:09:46 UTC (rev 27683)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/ConsoleConfigurationPropertySource.java 2010-12-22 18:13:05 UTC (rev 27684)
@@ -37,7 +37,6 @@
import org.eclipse.debug.internal.core.LaunchConfiguration;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
@@ -63,20 +62,7 @@
ComboBoxPropertyDescriptor modeDescriptor = new ComboBoxPropertyDescriptor(
"mode", //$NON-NLS-1$
HibernateConsoleMessages.ConsoleConfigurationPropertySource_mode,
- ConfigurationMode.values());
- modeDescriptor.setLabelProvider(new LabelProvider(){
-
- @Override
- public String getText(Object element) {
- if (ConfigurationMode.CORE.toString().equals(element)){
- return "Core"; //$NON-NLS-1$
- }
- if (ConfigurationMode.ANNOTATIONS.toString().equals(element)){
- return "Annotations"; //$NON-NLS-1$
- }
- return super.getText(element);
- }
- });
+ ConfigurationMode.labels());
List<IPropertyDescriptor> l = new ArrayList<IPropertyDescriptor>();
l.add(new TextPropertyDescriptor("name", HibernateConsoleMessages.ConsoleConfigurationPropertySource_name)); //$NON-NLS-1$
14 years
JBoss Tools SVN: r27683 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-22 13:09:46 -0500 (Wed, 22 Dec 2010)
New Revision: 27683
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF/MANIFEST.MF
Log:
corrected version ranges to match eclipse 3.6.1, too
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF/MANIFEST.MF
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF/MANIFEST.MF 2010-12-22 18:07:43 UTC (rev 27682)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF/MANIFEST.MF 2010-12-22 18:09:46 UTC (rev 27683)
@@ -14,7 +14,7 @@
org.jboss.tools.deltacloud.core,
org.jboss.tools.deltacloud.ui,
org.jboss.ide.eclipse.as.core,
- org.eclipse.wst.server.core;bundle-version="1.1.302",
org.eclipse.core.resources;bundle-version="3.6.0",
org.jboss.ide.eclipse.as.rse.core;bundle-version="0.9.0",
- org.eclipse.wst.server.ui;bundle-version="1.1.305"
+ org.eclipse.wst.server.core;bundle-version="[1.1.204,2.0.0)",
+ org.eclipse.wst.server.ui;bundle-version="[1.1.205,2.0.0)"
14 years
JBoss Tools SVN: r27682 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core: src/org/jboss/tools/deltacloud/core and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-22 13:07:43 -0500 (Wed, 22 Dec 2010)
New Revision: 27682
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/FieldMatcher.java
Log:
[JBIDE-7981] set filter to filter in case insensitive manner
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-22 18:07:23 UTC (rev 27681)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-22 18:07:43 UTC (rev 27682)
@@ -1,3 +1,8 @@
+2010-12-22 adietisheim <adietisheim@adietisheim-thinkpad>
+
+ * src/org/jboss/tools/deltacloud/core/FieldMatcher.java (FieldMatcher):
+ [JBIDE-7981] set filter to filter in case insensitive manner
+
2010-12-21 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/client/unmarshal/KeysUnmarshaller.java:
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/FieldMatcher.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/FieldMatcher.java 2010-12-22 18:07:23 UTC (rev 27681)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/FieldMatcher.java 2010-12-22 18:07:43 UTC (rev 27682)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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;
import java.util.regex.Matcher;
@@ -4,15 +14,19 @@
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
+/**
+ * @author Jeff Johnston
+ * @author André Dietisheim
+ */
public class FieldMatcher implements IFieldMatcher {
private String rule;
private Pattern pattern;
-
+
public FieldMatcher(String rule) throws PatternSyntaxException {
this.rule = rule;
String regexRule = transform(rule);
- pattern = Pattern.compile(regexRule);
+ pattern = Pattern.compile(regexRule, Pattern.CASE_INSENSITIVE);
}
private String transform(String rule) {
@@ -30,13 +44,13 @@
}
return buffer.toString();
}
-
+
@Override
public boolean matches(String input) {
Matcher m = pattern.matcher(input);
return m.matches();
}
-
+
@Override
public String toString() {
return rule;
14 years
JBoss Tools SVN: r27681 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-22 13:07:23 -0500 (Wed, 22 Dec 2010)
New Revision: 27681
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IFieldMatcher.java
Log:
corrected copyright headers and authors
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IFieldMatcher.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IFieldMatcher.java 2010-12-22 18:06:04 UTC (rev 27680)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IFieldMatcher.java 2010-12-22 18:07:23 UTC (rev 27681)
@@ -1,5 +1,18 @@
+/*******************************************************************************
+ * 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;
+/**
+ * @author Jeff Johnston
+ */
public interface IFieldMatcher {
public boolean matches(String input);
14 years
JBoss Tools SVN: r27680 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-22 13:06:04 -0500 (Wed, 22 Dec 2010)
New Revision: 27680
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
Log:
removed unnused import
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-12-22 18:03:17 UTC (rev 27679)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-12-22 18:06:04 UTC (rev 27680)
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.jboss.tools.deltacloud.core;
-import java.net.MalformedURLException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Iterator;
14 years