use of org.eclipse.ecf.core.sharedobject.SharedObjectInitException in project ecf by eclipse.
the class FeedSharedObject method init.
/*
* (non-Javadoc)
*
* @see org.eclipse.ecf.core.ISharedObject#init(org.eclipse.ecf.core.ISharedObjectConfig)
*/
public void init(ISharedObjectConfig initData) throws SharedObjectInitException {
if (config == null) {
config = initData;
} else {
throw new SharedObjectInitException("Already initialized.");
}
trace("init(" + initData + ")");
// get local publish path
publishPathName = (String) initData.getProperties().get(PUBLISH_PROPERTY_NAME);
publishPathName = publishPathName == null ? "feed.xml" : publishPathName;
// get local channel container first...throw if we can't get it
IMergeableChannelContainerAdapter container = (IMergeableChannelContainerAdapter) config.getContext().getAdapter(IMergeableChannelContainerAdapter.class);
if (container == null) {
throw new SharedObjectInitException("Channel container is null/not available");
}
if (container instanceof RssClientSOContainer) {
// get rss feed
try {
feed = ((RssClientSOContainer) container).receiveFeed(getID().getName());
} catch (IOException ioe) {
throw new SharedObjectInitException(ioe);
}
}
}
use of org.eclipse.ecf.core.sharedobject.SharedObjectInitException in project ecf by eclipse.
the class SubscriptionAgent method init.
public void init(ISharedObjectConfig config) throws SharedObjectInitException {
Map props = config.getProperties();
if (config.getContext().getLocalContainerID().equals(config.getHomeContainerID())) {
containerID = (ID) props.get(CONTAINER_ID_KEY);
if (containerID == null)
throw new SharedObjectInitException("containerID is required");
callback = (ISubscriptionCallback) props.get(CALLBACK_KEY);
if (callback == null)
throw new SharedObjectInitException("callback is required");
}
sharedObjectID = (ID) props.get(SHARED_OBJECT_ID_KEY);
if (sharedObjectID == null)
throw new SharedObjectInitException("sharedObjectID is required");
this.config = config;
}
use of org.eclipse.ecf.core.sharedobject.SharedObjectInitException in project ecf by eclipse.
the class AgentBase method init.
public void init(ISharedObjectConfig config) throws SharedObjectInitException {
Map props = config.getProperties();
initializeData(props.get(INITIAL_DATA_KEY));
updaterID = (String) props.get(MODEL_UPDATER_KEY);
if (updaterID == null)
throw new SharedObjectInitException("Model Updater is required.");
initializeUpdater();
this.config = config;
}
use of org.eclipse.ecf.core.sharedobject.SharedObjectInitException in project ecf by eclipse.
the class RemoteAgent method initializeUpdater.
protected void initializeUpdater() throws SharedObjectInitException {
IExtensionRegistry registry = Platform.getExtensionRegistry();
if (registry == null)
throw new SharedObjectInitException("No Platform Extension Registry.");
IConfigurationElement[] elements = registry.getConfigurationElementsFor("org.eclipse.ecf.example.pubsub.modelUpdater");
for (int i = 0; i < elements.length; ++i) {
if (updaterID.equals(elements[i].getAttribute("id"))) {
try {
updater = (IModelUpdater) elements[i].createExecutableExtension("class");
} catch (CoreException e) {
throw new SharedObjectInitException(e);
} catch (ClassCastException e) {
throw new SharedObjectInitException(e);
}
break;
}
}
if (updater == null)
throw new SharedObjectInitException("Could not find specified Model Updater.");
}
Aggregations