Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2005-01-30 06:35:30 +0000
committerslewis2005-01-30 06:35:30 +0000
commitd824cd56d02f125a4a03548aecaa211f99929e27 (patch)
tree0d9848e572f6f5ca847b01623970458d582b26ef
parent7f590f4c78dc9f1b0de9af87f6c978a6cd2b75e5 (diff)
downloadorg.eclipse.ecf-d824cd56d02f125a4a03548aecaa211f99929e27.tar.gz
org.eclipse.ecf-d824cd56d02f125a4a03548aecaa211f99929e27.tar.xz
org.eclipse.ecf-d824cd56d02f125a4a03548aecaa211f99929e27.zip
Added properties map to SharedObjectContainerDescription. Also added property sub-element to containerFactory schema, so that properties could be passed into sharedobjectcontainerdescription and used
-rw-r--r--framework/bundles/org.eclipse.ecf/schema/containerFactory.exsd25
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerDescription.java25
-rw-r--r--framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java47
3 files changed, 86 insertions, 11 deletions
diff --git a/framework/bundles/org.eclipse.ecf/schema/containerFactory.exsd b/framework/bundles/org.eclipse.ecf/schema/containerFactory.exsd
index 9f051fde2..79cceed61 100644
--- a/framework/bundles/org.eclipse.ecf/schema/containerFactory.exsd
+++ b/framework/bundles/org.eclipse.ecf/schema/containerFactory.exsd
@@ -49,6 +49,7 @@
<complexType>
<sequence>
<element ref="defaultargument" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="property" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="class" type="string" use="required">
<annotation>
@@ -105,6 +106,30 @@
</complexType>
</element>
+ <element name="property">
+ <annotation>
+ <documentation>
+ Property (name,value) associated with SharedObjectContainerDescription
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ The name of the property
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="value" type="string" use="required">
+ <annotation>
+ <documentation>
+ The value of the property
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
<annotation>
<appInfo>
<meta.section type="since"/>
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerDescription.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerDescription.java
index f57150f93..e02ed168d 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerDescription.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/SharedObjectContainerDescription.java
@@ -9,6 +9,8 @@
package org.eclipse.ecf.core;
import java.util.Arrays;
+import java.util.Map;
+import java.util.Properties;
import org.eclipse.ecf.core.provider.ISharedObjectContainerInstantiator;
/**
@@ -28,6 +30,7 @@ public class SharedObjectContainerDescription {
protected String[] argNames;
protected int hashCode = 0;
protected static final String[] EMPTY = new String[0];
+ protected Map properties;
public SharedObjectContainerDescription(ClassLoader loader, String name,
String instantiatorClass, String desc) {
@@ -43,6 +46,12 @@ public class SharedObjectContainerDescription {
public SharedObjectContainerDescription(ClassLoader loader, String name,
String instantiatorClass, String desc, String[] argTypes,
String[] argDefaults, String[] argNames) {
+ this(loader,name,instantiatorClass,desc,argTypes,argDefaults,argNames,new Properties());
+ }
+
+ public SharedObjectContainerDescription(ClassLoader loader, String name,
+ String instantiatorClass, String desc, String[] argTypes,
+ String[] argDefaults, String[] argNames, Map props) {
this.classLoader = loader;
if (name == null)
throw new RuntimeException(
@@ -59,11 +68,18 @@ public class SharedObjectContainerDescription {
this.argTypes = argTypes;
this.argDefaults = argDefaults;
this.argNames = argNames;
+ this.properties = props;
}
-
+
public SharedObjectContainerDescription(String name,
ISharedObjectContainerInstantiator inst, String desc,
String[] argTypes, String[] argDefaults, String[] argNames) {
+ this(name,inst,desc,argTypes,argDefaults,argNames,new Properties());
+ }
+
+ public SharedObjectContainerDescription(String name,
+ ISharedObjectContainerInstantiator inst, String desc,
+ String[] argTypes, String[] argDefaults, String[] argNames, Map props) {
if (name == null)
throw new RuntimeException(
new InstantiationException(
@@ -79,8 +95,9 @@ public class SharedObjectContainerDescription {
this.argTypes = argTypes;
this.argDefaults = argDefaults;
this.argNames = argNames;
+ this.properties = props;
}
-
+
public SharedObjectContainerDescription(String name,
ISharedObjectContainerInstantiator inst, String desc) {
this(name, inst, desc, EMPTY, EMPTY, EMPTY);
@@ -158,4 +175,8 @@ public class SharedObjectContainerDescription {
public String[] getArgNames() {
return argNames;
}
+
+ public Map getProperties() {
+ return properties;
+ }
} \ No newline at end of file
diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java
index 6ec5b80a9..19a09c190 100644
--- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java
+++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/internal/core/ECFPlugin.java
@@ -9,7 +9,9 @@
package org.eclipse.ecf.internal.core;
import java.lang.reflect.Constructor;
+import java.util.Map;
import java.util.MissingResourceException;
+import java.util.Properties;
import java.util.ResourceBundle;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -50,6 +52,9 @@ public class ECFPlugin extends Plugin {
public static final String ARG_TYPE_ATTRIBUTE = "type";
public static final String ARG_VALUE_ATTRIBUTE = "value";
public static final String ARG_NAME_ATTRIBUTE = "name";
+ public static final String PROPERTY_ELEMENT_NAME = "property";
+ public static final String PROPERTY_NAME_ATTRIBUTE = "name";
+ public static final String PROPERTY_VALUE_ATTRIBUTE = "value";
public static final String COMM_FACTORY_EPOINT = "org.eclipse.ecf.connectionFactory";
public static final String COMM_FACTORY_EPOINT_CLASS_ATTRIBUTE = "class";
public static final String COMM_FACTORY_EPOINT_NAME_ATTRIBUTE = "name";
@@ -59,9 +64,9 @@ public class ECFPlugin extends Plugin {
public static final int INSTANTIATOR_DOES_NOT_IMPLEMENT_ERRORCODE = 30;
public static final int INSTANTIATOR_NAME_COLLISION_ERRORCODE = 50;
public static final int INSTANTIATOR_NAMESPACE_LOAD_ERRORCODE = 60;
- //The shared instance.
+ // The shared instance.
private static ECFPlugin plugin;
- //Resource bundle.
+ // Resource bundle.
private ResourceBundle resourceBundle;
BundleContext context = null;
@@ -146,6 +151,25 @@ public class ECFPlugin extends Plugin {
return new DefaultArgs(argTypes, argDefaults, argNames);
}
+ protected Map getProperties(IConfigurationElement[] propertyElements) {
+ Properties props = new Properties();
+ if (propertyElements != null) {
+ if (propertyElements.length > 0) {
+ for (int i = 0; i < propertyElements.length; i++) {
+ String name = propertyElements[i]
+ .getAttribute(PROPERTY_NAME_ATTRIBUTE);
+ String value = propertyElements[i]
+ .getAttribute(PROPERTY_VALUE_ATTRIBUTE);
+ if (name != null && !name.equals("") && value != null
+ && !value.equals("")) {
+ props.setProperty(name, value);
+ }
+ }
+ }
+ }
+ return props;
+ }
+
protected void setupContainerExtensionPoint(BundleContext bc) {
String bundleName = getDefault().getBundle().getSymbolicName();
IExtensionRegistry reg = Platform.getExtensionRegistry();
@@ -175,6 +199,7 @@ public class ECFPlugin extends Plugin {
if (name == null) {
name = clazz;
}
+ // Get description, if present
String description = member
.getAttribute(CONTAINER_FACTORY_EPOINT_DESC_ATTRIBUTE);
if (description == null) {
@@ -183,14 +208,18 @@ public class ECFPlugin extends Plugin {
// Get any arguments
DefaultArgs defaults = getDefaultArgs(member
.getChildren(ARG_ELEMENT_NAME));
+ // Get any property elements
+ Map properties = getProperties(member
+ .getChildren(PROPERTY_ELEMENT_NAME));
// Now make description instance
SharedObjectContainerDescription scd = new SharedObjectContainerDescription(
name, (ISharedObjectContainerInstantiator) exten,
description, defaults.getTypes(), defaults
- .getDefaults(), defaults.getNames());
+ .getDefaults(), defaults.getNames(), properties);
debug("setupContainerExtensionPoint:created description:" + scd);
if (SharedObjectContainerFactory.containsDescription(scd)) {
- throw new CoreException(getStatusForContException(extension,bundleName,name));
+ throw new CoreException(getStatusForContException(
+ extension, bundleName, name));
}
// Now add the description and we're ready to go.
SharedObjectContainerFactory.addDescription(scd);
@@ -230,8 +259,7 @@ public class ECFPlugin extends Plugin {
if (nsInstantiatorClass == null) {
throw new CoreException(null);
}
- nsName = member
- .getAttribute(INSTANTIATOR_NAME_ATTRIBUTE);
+ nsName = member.getAttribute(INSTANTIATOR_NAME_ATTRIBUTE);
if (nsName == null) {
nsName = nsInstantiatorClass;
}
@@ -270,7 +298,8 @@ public class ECFPlugin extends Plugin {
}
debug("setupIdentityExtensionPoint:created namespace:" + ns);
if (IDFactory.containsNamespace(ns)) {
- throw new CoreException(getStatusForIDException(extension,bundleName,nsName));
+ throw new CoreException(getStatusForIDException(extension,
+ bundleName, nsName));
}
// Now add to known namespaces
IDFactory.addNamespace(ns);
@@ -280,8 +309,8 @@ public class ECFPlugin extends Plugin {
log(e.getStatus());
dumpStack("Exception in setupIdentityExtensionPoint", e);
} catch (Exception e) {
- log(getStatusForIDException(extension,bundleName,nsName));
- dumpStack("Exception in setupIdentityExtensionPoint",e);
+ log(getStatusForIDException(extension, bundleName, nsName));
+ dumpStack("Exception in setupIdentityExtensionPoint", e);
}
}
}

Back to the top