diff options
Diffstat (limited to 'compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePropertyUtils.java')
-rw-r--r-- | compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePropertyUtils.java | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePropertyUtils.java b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePropertyUtils.java deleted file mode 100644 index 1f6a90c66..000000000 --- a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePropertyUtils.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Composent, Inc. and others. 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: - * Composent, Inc. - initial API and implementation - ******************************************************************************/ -package org.eclipse.ecf.internal.osgi.services.discovery; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; -import org.eclipse.ecf.osgi.services.discovery.ServicePublication; -import org.osgi.framework.ServiceReference; - -public class ServicePropertyUtils { - - public static final String PROTOCOL_SEPARATOR = ":"; //$NON-NLS-1$ - public static final String ENDPOINT_INTERFACE_NAME_SEPARATOR = PROTOCOL_SEPARATOR; - public static final String INTERFACE_VERSION_SEPARATOR = ServicePublication.SEPARATOR; - - private static final String COLLECTION_SEPARATOR = ","; //$NON-NLS-1$ - - public static Collection getCollectionProperty(ServiceReference sr, - String propName) { - if (sr == null || propName == null) { - return null; - } - final Object val = sr.getProperty(propName); - if (val == null || !(val instanceof Collection)) { - return null; - } - return (Collection) val; - } - - public static String getStringProperty(ServiceReference reference, - String propKey) { - if (reference == null || propKey == null) { - return null; - } - final Object val = reference.getProperty(propKey); - if (val == null || !(val instanceof String)) { - return null; - } - return (String) val; - } - - public static Map getMapProperty(ServiceReference reference, - String propKeyServiceProperties) { - if (reference == null || propKeyServiceProperties == null) { - return null; - } - final Object val = reference.getProperty(propKeyServiceProperties); - if (val == null || !(val instanceof Map)) { - return null; - } - return (Map) val; - } - - public static String createStringFromCollection(Collection svcInterfaces) { - if (svcInterfaces == null) { - return null; - } - final StringBuffer result = new StringBuffer(); - for (final Iterator i = svcInterfaces.iterator(); i.hasNext();) { - final String item = (String) i.next(); - result.append(item); - if (i.hasNext()) { - result.append(COLLECTION_SEPARATOR); - } - } - return result.toString(); - } - - public static Collection createCollectionFromString(String value) { - if (value == null) { - return null; - } - final StringTokenizer t = new StringTokenizer(value, - COLLECTION_SEPARATOR); - final List result = new ArrayList(); - while (t.hasMoreTokens()) { - result.add(t.nextToken()); - } - return result; - } - -} |