protected void addNode(DataNode node, DataNode parent) {
		for (DataSourceListener listener : getListeners()) {
			DataSourceEvent event = new BasicDataSourceEvent(this, node, parent);
			try {
				listener.onNodeCreate(event);
			} catch (ResourceException e) {
				listener.onError(event, e);
			}
		}
		
		if (parent != null) {
			if (nodes.contains(parent)) {
				DataNode realParent = nodes.get(nodes.indexOf(parent));
				realParent.addChild(node);
			} else {
				parent.addChild(node);
				nodes.add(parent);
			}
		} else if (!nodes.contains(node)){
			nodes.add(node);
		}
	}