Author: pauls
Date: Mon Aug 29 14:49:25 2011
New Revision: 1162839
URL: http://svn.apache.org/viewvc?rev=1162839&view=rev
Log:
Add a lookup method to the repositories that allows to lookup entities by their definition.
Furthermore, use this method in the webui and in the rest client where it makes sense (ACE-175)
Modified:
incubator/ace/trunk/ace-client-repository-api/src/main/java/org/apache/ace/client/repository/ObjectRepository.java
incubator/ace/trunk/ace-client-repository-impl/src/main/java/org/apache/ace/client/repository/impl/ObjectRepositoryImpl.java
incubator/ace/trunk/ace-client-repository-impl/src/main/java/org/apache/ace/client/repository/stateful/impl/StatefulGatewayRepositoryImpl.java
incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RESTClientServlet.java
incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/Workspace.java
incubator/ace/trunk/ace-client-rest/test.sh
incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Associations.java
incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java
Modified: incubator/ace/trunk/ace-client-repository-api/src/main/java/org/apache/ace/client/repository/ObjectRepository.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-client-repository-api/src/main/java/org/apache/ace/client/repository/ObjectRepository.java?rev=1162839&r1=1162838&r2=1162839&view=diff
==============================================================================
--- incubator/ace/trunk/ace-client-repository-api/src/main/java/org/apache/ace/client/repository/ObjectRepository.java
(original)
+++ incubator/ace/trunk/ace-client-repository-api/src/main/java/org/apache/ace/client/repository/ObjectRepository.java
Mon Aug 29 14:49:25 2011
@@ -41,6 +41,14 @@ public interface ObjectRepository<T exte
* empty list will be returned.
*/
public List<T> get(Filter filter);
+ /**
+ * Returns the entity in this repository that has the given definition.
+ * If none match, null will return.
+ *
+ * @param definition the definition of the entity to be returned
+ * @return The entity in this repository that has the given definition or <code>null</code>
if none.
+ */
+ public T get(String definition);
/**
* Creates a new inhabitant based on the given attributes. The object
Modified: incubator/ace/trunk/ace-client-repository-impl/src/main/java/org/apache/ace/client/repository/impl/ObjectRepositoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-client-repository-impl/src/main/java/org/apache/ace/client/repository/impl/ObjectRepositoryImpl.java?rev=1162839&r1=1162838&r2=1162839&view=diff
==============================================================================
--- incubator/ace/trunk/ace-client-repository-impl/src/main/java/org/apache/ace/client/repository/impl/ObjectRepositoryImpl.java
(original)
+++ incubator/ace/trunk/ace-client-repository-impl/src/main/java/org/apache/ace/client/repository/impl/ObjectRepositoryImpl.java
Mon Aug 29 14:49:25 2011
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import org.apache.ace.client.repository.ObjectRepository;
@@ -47,6 +48,8 @@ abstract class ObjectRepositoryImpl<I ex
protected BundleContext m_context; /* injected by dependency manager */
private final List<T> m_repo = new CopyOnWriteArrayList<T>();
+ private final Map<String, T> m_index = new ConcurrentHashMap<String, T>();
+
private final ChangeNotifier m_notifier;
private final String m_xmlNode;
@@ -91,6 +94,7 @@ abstract class ObjectRepositoryImpl<I ex
synchronized (m_repo) {
if (!m_repo.contains(entity)) {
m_repo.add(entity);
+ m_index.put(entity.getDefinition(), entity);
result = true;
}
}
@@ -108,6 +112,7 @@ abstract class ObjectRepositoryImpl<I ex
boolean result = false;
synchronized (m_repo) {
if (m_repo.remove(entity)) {
+ m_index.remove(entity.getDefinition());
((I) entity).setDeleted();
result = true;
}
@@ -169,6 +174,10 @@ abstract class ObjectRepositoryImpl<I ex
return result;
}
+ public T get(String definition) {
+ return m_index.get(definition);
+ }
+
Filter createFilter(String filter) throws InvalidSyntaxException {
return m_context.createFilter(filter);
}
Modified: incubator/ace/trunk/ace-client-repository-impl/src/main/java/org/apache/ace/client/repository/stateful/impl/StatefulGatewayRepositoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-client-repository-impl/src/main/java/org/apache/ace/client/repository/stateful/impl/StatefulGatewayRepositoryImpl.java?rev=1162839&r1=1162838&r2=1162839&view=diff
==============================================================================
--- incubator/ace/trunk/ace-client-repository-impl/src/main/java/org/apache/ace/client/repository/stateful/impl/StatefulGatewayRepositoryImpl.java
(original)
+++ incubator/ace/trunk/ace-client-repository-impl/src/main/java/org/apache/ace/client/repository/stateful/impl/StatefulGatewayRepositoryImpl.java
Mon Aug 29 14:49:25 2011
@@ -74,6 +74,7 @@ public class StatefulGatewayRepositoryIm
private BundleHelper m_bundleHelper; /*Injected by dependency manager*/
//TODO: Make the concurrencyLevel of this concurrent hashmap settable?
private Map<String, StatefulGatewayObjectImpl> m_repository = new ConcurrentHashMap<String,
StatefulGatewayObjectImpl>();
+ private Map<String, StatefulGatewayObjectImpl> m_index = new ConcurrentHashMap<String,
StatefulGatewayObjectImpl>();
private final String m_sessionID;
public StatefulGatewayRepositoryImpl(String sessionID) {
@@ -105,6 +106,10 @@ public class StatefulGatewayRepositoryIm
return result;
}
}
+
+ public StatefulGatewayObject get(String definition) {
+ return m_index.get(definition);
+ }
public void remove(StatefulGatewayObject entity) {
throw new UnsupportedOperationException("Removing StatefulGatewayObjects is not supported.");
@@ -209,6 +214,7 @@ public class StatefulGatewayRepositoryIm
boolean add(StatefulGatewayObjectImpl sgoi) {
if (!m_repository.containsKey(sgoi)) {
m_repository.put(sgoi.getID(), sgoi);
+ m_index.put(sgoi.getDefinition(), sgoi);
notifyChanged(sgoi, StatefulGatewayObject.TOPIC_ADDED);
return true;
}
Modified: incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RESTClientServlet.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RESTClientServlet.java?rev=1162839&r1=1162838&r2=1162839&view=diff
==============================================================================
--- incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RESTClientServlet.java
(original)
+++ incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RESTClientServlet.java
Mon Aug 29 14:49:25 2011
@@ -237,7 +237,7 @@ public class RESTClientServlet extends H
try {
RepositoryValueObject data = m_gson.fromJson(req.getReader(),
RepositoryValueObject.class);
RepositoryObject object = workspace.getRepositoryObject(pathElements[2],
pathElements[3]);
- updateObjectWithData(object, data);
+ workspace.updateObjectWithData(pathElements[2], pathElements[2],
data);
resp.sendRedirect(buildPathFromElements(WORK_FOLDER, pathElements[1],
pathElements[2], pathElements[3]));
return;
}
@@ -360,43 +360,6 @@ public class RESTClientServlet extends H
return pathElements;
}
- private void updateObjectWithData(RepositoryObject repositoryObject, RepositoryValueObject
valueObject) {
- // first handle the attributes
- for (Entry<String, String> attribute : valueObject.attributes.entrySet()) {
- String key = attribute.getKey();
- String value = attribute.getValue();
- // only add/update the attribute if it actually changed
- if (!value.equals(repositoryObject.getAttribute(key))) {
- repositoryObject.addAttribute(key, value);
- }
- }
- Enumeration<String> keys = repositoryObject.getAttributeKeys();
- while (keys.hasMoreElements()) {
- String key = keys.nextElement();
- if (!valueObject.attributes.containsKey(key)) {
- // TODO since we cannot remove keys right now, we null them
- repositoryObject.addAttribute(key, null);
- }
- }
- // now handle the tags in a similar way
- for (Entry<String, String> attribute : valueObject.tags.entrySet()) {
- String key = attribute.getKey();
- String value = attribute.getValue();
- // only add/update the tag if it actually changed
- if (!value.equals(repositoryObject.getTag(key))) {
- repositoryObject.addTag(key, value);
- }
- }
- keys = repositoryObject.getTagKeys();
- while (keys.hasMoreElements()) {
- String key = keys.nextElement();
- if (!valueObject.tags.containsKey(key)) {
- // TODO since we cannot remove keys right now, we null them
- repositoryObject.addTag(key, null);
- }
- }
- }
-
public void updated(Dictionary properties) throws ConfigurationException {
// Note that configuration changes are only applied to new work areas, started after
the
// configuration was changed. No attempt is done to "fix" existing work areas, although
we
Modified: incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/Workspace.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/Workspace.java?rev=1162839&r1=1162838&r2=1162839&view=diff
==============================================================================
--- incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/Workspace.java
(original)
+++ incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/Workspace.java
Mon Aug 29 14:49:25 2011
@@ -21,8 +21,11 @@ package org.apache.ace.client.rest;
import java.io.IOException;
import java.net.URL;
import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import org.apache.ace.client.repository.ObjectRepository;
import org.apache.ace.client.repository.RepositoryAdmin;
@@ -142,57 +145,189 @@ public class Workspace {
m_repositoryAdmin.commit();
}
- public RepositoryObject getRepositoryObject(String entityType, String entityId) {
- RepositoryObject result = null;
- try {
- List list = null;
- Filter filter = FrameworkUtil.createFilter(entityId);
- list = getObjectRepository(entityType).get(filter);
- if (list != null && list.size() == 1) {
- return (RepositoryObject) list.get(0);
- }
- }
- catch (InvalidSyntaxException e) {
- e.printStackTrace();
- }
- return result;
- }
-
- public static String getRepositoryObjectIdentity(RepositoryObject object) {
- if (object instanceof StatefulGatewayObject) {
- StatefulGatewayObject statefulTarget = (StatefulGatewayObject) object;
- if (statefulTarget.isRegistered()) {
- return statefulTarget.getGatewayObject().getAssociationFilter(null);
- }
- else {
- // TODO we're out of luck here, we cannot create an identity for the object
- // based on the association filter
- return null;
- }
- }
- else {
- return object.getAssociationFilter(null);
- }
- }
+ public RepositoryObject getRepositoryObject(String entityType,
+ String entityId) {
+ return getObjectRepository(entityType).get(entityId);
+ }
- public List<RepositoryObject> getRepositoryObjects(String entityType) {
- List list = getObjectRepository(entityType).get();
- if (list != null) {
- return list;
- }
- else {
- return Collections.EMPTY_LIST;
- }
- }
+ public static String getRepositoryObjectIdentity(RepositoryObject object) {
+ return object.getDefinition();
+ }
- public RepositoryObject addRepositoryObject(String entityType, Map<String, String>
attributes, Map<String, String> tags) throws IllegalArgumentException{
- if (TARGET.equals(entityType)) {
- return ((StatefulGatewayRepository) getObjectRepository(TARGET)).preregister(attributes,
tags);
- }
- else {
- return getObjectRepository(entityType).create(attributes, tags);
- }
- }
+ public List<RepositoryObject> getRepositoryObjects(String entityType) {
+ List list = getObjectRepository(entityType).get();
+ if (list != null) {
+ return list;
+ } else {
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ public RepositoryObject addRepositoryObject(String entityType,
+ Map<String, String> attributes, Map<String, String> tags)
+ throws IllegalArgumentException {
+ if (TARGET.equals(entityType)) {
+ return ((StatefulGatewayRepository) getObjectRepository(TARGET))
+ .preregister(attributes, tags);
+ } else {
+ if (ARTIFACT2FEATURE.equals(entityType)
+ || FEATURE2DISTRIBUTION.equals(entityType)
+ || DISTRIBUTION2TARGET.equals(entityType)) {
+ RepositoryObject left = getLeft(entityType,
+ attributes.get("left"));
+ RepositoryObject right = getRight(entityType,
+ attributes.get("right"));
+ if (left != null) {
+ if (left instanceof StatefulGatewayObject) {
+ if (((StatefulGatewayObject) left).isRegistered()) {
+ attributes.put("leftEndpoint",
+ ((StatefulGatewayObject) left)
+ .getGatewayObject()
+ .getAssociationFilter(attributes));
+ }
+ } else {
+ attributes.put("leftEndpoint",
+ left.getAssociationFilter(attributes));
+ }
+ }
+ if (right != null) {
+ if (right instanceof StatefulGatewayObject) {
+ if (((StatefulGatewayObject) right).isRegistered()) {
+ attributes.put("rightEndpoint",
+ ((StatefulGatewayObject) right)
+ .getGatewayObject()
+ .getAssociationFilter(attributes));
+ }
+ } else {
+ attributes.put("rightEndpoint",
+ right.getAssociationFilter(attributes));
+ }
+ }
+ }
+ return getObjectRepository(entityType).create(attributes, tags);
+ }
+ }
+
+ public void updateObjectWithData(String entityType, String entityId,
+ RepositoryValueObject valueObject) {
+ RepositoryObject repositoryObject = getRepositoryObject(entityType,
+ entityId);
+ // first handle the attributes
+ for (Entry<String, String> attribute : valueObject.attributes
+ .entrySet()) {
+ String key = attribute.getKey();
+ String value = attribute.getValue();
+ // only add/update the attribute if it actually changed
+ if (!value.equals(repositoryObject.getAttribute(key))) {
+ repositoryObject.addAttribute(key, value);
+ }
+ }
+ Enumeration<String> keys = repositoryObject.getAttributeKeys();
+ while (keys.hasMoreElements()) {
+ String key = keys.nextElement();
+ if (!valueObject.attributes.containsKey(key)) {
+ // TODO since we cannot remove keys right now, we null them
+ repositoryObject.addAttribute(key, null);
+ }
+ }
+ if (ARTIFACT2FEATURE.equals(entityType)
+ || FEATURE2DISTRIBUTION.equals(entityType)
+ || DISTRIBUTION2TARGET.equals(entityType)) {
+ RepositoryObject left = getLeft(entityType,
+ repositoryObject.getAttribute("left"));
+ RepositoryObject right = getRight(entityType,
+ repositoryObject.getAttribute("right"));
+ if (left != null) {
+ if (left instanceof StatefulGatewayObject) {
+ if (((StatefulGatewayObject) left).isRegistered()) {
+ repositoryObject
+ .addAttribute(
+ "leftEndpoint",
+ ((StatefulGatewayObject) left)
+ .getGatewayObject()
+ .getAssociationFilter(
+ getAttributes(((StatefulGatewayObject) left)
+ .getGatewayObject())));
+ }
+ } else {
+ repositoryObject.addAttribute("leftEndpoint",
+ left.getAssociationFilter(getAttributes(left)));
+ }
+ }
+ if (right != null) {
+ if (right instanceof StatefulGatewayObject) {
+ if (((StatefulGatewayObject) right).isRegistered()) {
+ repositoryObject
+ .addAttribute(
+ "rightEndpoint",
+ ((StatefulGatewayObject) right)
+ .getGatewayObject()
+ .getAssociationFilter(
+ getAttributes(((StatefulGatewayObject) right)
+ .getGatewayObject())));
+ }
+ } else {
+ repositoryObject.addAttribute("rightEndpoint",
+ right.getAssociationFilter(getAttributes(right)));
+ }
+ }
+ }
+ // now handle the tags in a similar way
+ for (Entry<String, String> attribute : valueObject.tags.entrySet()) {
+ String key = attribute.getKey();
+ String value = attribute.getValue();
+ // only add/update the tag if it actually changed
+ if (!value.equals(repositoryObject.getTag(key))) {
+ repositoryObject.addTag(key, value);
+ }
+ }
+ keys = repositoryObject.getTagKeys();
+ while (keys.hasMoreElements()) {
+ String key = keys.nextElement();
+ if (!valueObject.tags.containsKey(key)) {
+ // TODO since we cannot remove keys right now, we null them
+ repositoryObject.addTag(key, null);
+ }
+ }
+ }
+
+ private Map getAttributes(RepositoryObject object) {
+ Map result = new HashMap();
+ for (Enumeration<String> keys = object.getAttributeKeys(); keys
+ .hasMoreElements();) {
+ String key = keys.nextElement();
+ result.put(key, object.getAttribute(key));
+ }
+ return result;
+ }
+
+ public RepositoryObject getLeft(String entityType, String entityId) {
+ ObjectRepository repo = getObjectRepository(entityType);
+ if (ARTIFACT2FEATURE.equals(entityType)) {
+ return getObjectRepository(ARTIFACT).get(entityId);
+ }
+ if (FEATURE2DISTRIBUTION.equals(entityType)) {
+ return getObjectRepository(FEATURE).get(entityId);
+ }
+ if (DISTRIBUTION2TARGET.equals(entityType)) {
+ return getObjectRepository(DISTRIBUTION).get(entityId);
+ }
+ return null;
+ }
+
+ public RepositoryObject getRight(String entityType, String entityId) {
+ ObjectRepository repo = getObjectRepository(entityType);
+ if (ARTIFACT2FEATURE.equals(entityType)) {
+ return getObjectRepository(FEATURE).get(entityId);
+ }
+ if (FEATURE2DISTRIBUTION.equals(entityType)) {
+ return getObjectRepository(DISTRIBUTION).get(entityId);
+ }
+ if (DISTRIBUTION2TARGET.equals(entityType)) {
+ return getObjectRepository(TARGET).get(entityId);
+ }
+ return null;
+ }
public void deleteRepositoryObject(String entityType, String entityId) {
RepositoryObject result = null;
Modified: incubator/ace/trunk/ace-client-rest/test.sh
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-client-rest/test.sh?rev=1162839&r1=1162838&r2=1162839&view=diff
==============================================================================
--- incubator/ace/trunk/ace-client-rest/test.sh (original)
+++ incubator/ace/trunk/ace-client-rest/test.sh Mon Aug 29 14:49:25 2011
@@ -15,28 +15,28 @@ BSN=org.apache.bundle${RND}
VERSION=1.0.0
NAME=${BSN}-${VERSION}
ART=`curl -v -d "{attributes: { artifactName: '${NAME}' , mimetype: 'application/vnd.osgi.bundle',
Bundle-Name: '${BSN}', Bundle-SymbolicName: '${BSN}', Bundle-Version: '${VERSION}', url: 'http://localhost:8080/obr/${NAME}.jar',
artifactDescription: 'coolio', processorPid: '' }, tags: { generated: 'true' }}" -w %{redirect_url}
${WORK}/artifact`
-ARTID=`echo ${ART##*/} | perl -MURI::Escape -lne 'print uri_unescape($_)'`
+ARTID=`echo ${ART##*/}`
echo "Artifact is ${ART} => ${ARTID}"
FEAT=`curl -v -d "{ attributes: { name: 'feature-${RANDOM}', description: 'a feature' },
tags: {}}" -w %{redirect_url} ${WORK}/feature`
-FEATID=`echo ${FEAT##*/} | perl -MURI::Escape -lne 'print uri_unescape($_)'`
+FEATID=`echo ${FEAT##*/}`
echo "Feature is ${FEAT} => ${FEATID}"
DIST=`curl -v -d "{ attributes: { name: 'distribution-${RANDOM}', description: 'a distribution'
}, tags: {}}" -w %{redirect_url} ${WORK}/distribution`
-DISTID=`echo ${DIST##*/} | perl -MURI::Escape -lne 'print uri_unescape($_)'`
+DISTID=`echo ${DIST##*/}`
echo "Distribution is ${DIST} => ${DISTID}"
TARGET=`curl -v -d "{ attributes: { id: 'target-${RANDOM}', autoapprove: 'true' }, tags:
{}}" -w %{redirect_url} ${WORK}/target`
-TARGETID=`echo ${TARGET##*/} | perl -MURI::Escape -lne 'print uri_unescape($_)'`
+TARGETID=`echo ${TARGET##*/}`
echo "Target is ${TARGET} => ${TARGETID}"
-ASSOC1=`curl -v -d "{ attributes: { leftEndpoint: '${ARTID}', leftCardinality: '1', rightEndpoint:
'${FEATID}', rightCardinality: '1' }, tags: {}}" -w %{redirect_url} ${WORK}/artifact2feature`
+ASSOC1=`curl -v -d "{ attributes: { left: '${ARTID}', leftCardinality: '1', right: '${FEATID}',
rightCardinality: '1' }, tags: {}}" -w %{redirect_url} ${WORK}/artifact2feature`
echo "Association is ${ASSOC1}"
-ASSOC2=`curl -v -d "{ attributes: { leftEndpoint: '${FEATID}', leftCardinality: '1', rightEndpoint:
'${DISTID}', rightCardinality: '1' }, tags: {}}" -w %{redirect_url} ${WORK}/feature2distribution`
+ASSOC2=`curl -v -d "{ attributes: { left: '${FEATID}', leftCardinality: '1', right: '${DISTID}',
rightCardinality: '1' }, tags: {}}" -w %{redirect_url} ${WORK}/feature2distribution`
echo "Association is ${ASSOC2}"
-ASSOC3=`curl -v -d "{ attributes: { leftEndpoint: '${DISTID}', leftCardinality: '1', rightEndpoint:
'${TARGETID}', rightCardinality: '1' }, tags: {}}" -w %{redirect_url} ${WORK}/distribution2target`
+ASSOC3=`curl -v -d "{ attributes: { left: '${DISTID}', leftCardinality: '1', right: '${TARGETID}',
rightCardinality: '1' }, tags: {}}" -w %{redirect_url} ${WORK}/distribution2target`
echo "Association is ${ASSOC3}"
# Get a list of artifacts
Modified: incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Associations.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Associations.java?rev=1162839&r1=1162838&r2=1162839&view=diff
==============================================================================
--- incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Associations.java
(original)
+++ incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Associations.java
Mon Aug 29 14:49:25 2011
@@ -190,26 +190,19 @@ public class Associations {
}
public RepositoryObject lookup(Object value) {
- for (RepositoryObject object : m_repository.get()) {
- if (object instanceof StatefulGatewayObject) {
- StatefulGatewayObject sgo = (StatefulGatewayObject) object;
- if (sgo.isRegistered()) {
- object = sgo.getGatewayObject();
- }
- else {
- object = null;
- }
- }
- if (object != null) {
- NamedObject namedObject = getNamedObject(object);
- if (namedObject != null) {
- if (namedObject.getDefinition().equals(value)) {
- return object;
- }
- }
- }
+ RepositoryObject object = null;
+ if (value instanceof String) {
+ object = m_repository.get((String) value);
+ if (object instanceof StatefulGatewayObject) {
+ StatefulGatewayObject sgo = (StatefulGatewayObject) object;
+ if (sgo.isRegistered()) {
+ object = sgo.getGatewayObject();
+ } else {
+ object = null;
+ }
+ }
}
- return null;
+ return object;
}
Modified: incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java?rev=1162839&r1=1162838&r2=1162839&view=diff
==============================================================================
--- incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java
(original)
+++ incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java
Mon Aug 29 14:49:25 2011
@@ -1028,43 +1028,19 @@ public class VaadinClient extends com.va
}
private ArtifactObject getArtifact(String definition) {
- List<ArtifactObject> list = m_artifactRepository.get();
- for (ArtifactObject ao : list) {
- if (ao.getDefinition().equals(definition)) {
- return ao;
- }
- }
- return null;
+ return m_artifactRepository.get(definition);
}
private GroupObject getFeature(String name) {
- List<GroupObject> list = m_featureRepository.get();
- for (GroupObject go : list) {
- if (go.getDefinition().equals(name)) {
- return go;
- }
- }
- return null;
+ return m_featureRepository.get(name);
}
private LicenseObject getDistribution(String name) {
- List<LicenseObject> list = m_distributionRepository.get();
- for (LicenseObject lo : list) {
- if (lo.getDefinition().equals(name)) {
- return lo;
- }
- }
- return null;
+ return m_distributionRepository.get(name);
}
private StatefulGatewayObject getTarget(String name) {
- List<StatefulGatewayObject> list = m_statefulTargetRepository.get();
- for (StatefulGatewayObject sgo : list) {
- if (sgo.getDefinition().equals(name)) {
- return sgo;
- }
- }
- return null;
+ return m_statefulTargetRepository.get(name);
}
private void deleteFeature(String name) {
|