1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.message.internal;
14 import org.eclipse.core.runtime.CoreException;
15 import org.eclipse.core.runtime.IConfigurationElement;
16 import org.simantics.message.IMessageDataSchemeExtension;
17 import org.simantics.message.IMessageSchemeHandler;
18 import org.simantics.message.IReferenceSerializer;
21 * @author Tuukka Lehtonen
23 public class MessageDataSchemeExtension implements IMessageDataSchemeExtension {
25 private final IConfigurationElement schemeElement;
26 private final String id;
27 private final String scheme;
28 private final String description;
29 private IConfigurationElement handlerElement;
31 public MessageDataSchemeExtension(IConfigurationElement el, String id, String scheme, String description) {
32 this.schemeElement = el;
35 this.description = description;
38 public IConfigurationElement getSchemeElement() {
42 public IConfigurationElement getHandlerElement() {
43 return handlerElement;
46 public void setHandlerElement(IConfigurationElement handlerElement) {
47 this.handlerElement = handlerElement;
51 * @see org.simantics.message.IMessageDataSchemeExtension#getId()
53 public String getId() {
58 * @see org.simantics.message.IMessageDataSchemeExtension#getScheme()
60 public String getScheme() {
65 * @see org.simantics.message.IMessageDataSchemeExtension#getDescription()
67 public String getDescription() {
72 * @see org.simantics.message.IMessageDataSchemeExtension#getHandler()
74 public IMessageSchemeHandler getHandler() {
75 if (handlerElement == null)
79 return (IMessageSchemeHandler) handlerElement.createExecutableExtension("handler");
80 } catch (CoreException e) {
81 throw new RuntimeException(e);
86 * @see org.simantics.message.IMessageDataSchemeExtension#getSerializer()
88 public IReferenceSerializer getSerializer() {
90 return (IReferenceSerializer) schemeElement.createExecutableExtension("serializer");
91 } catch (CoreException e) {
92 throw new RuntimeException(e);