001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     "Stephane Lacoin [aka matic] <slacoin at nuxeo.com>"
011 */
012package org.nuxeo.ecm.core.management.storage;
013
014import org.nuxeo.common.xmap.annotation.XNode;
015import org.nuxeo.common.xmap.annotation.XObject;
016
017/**
018 * For registering a document store handler
019 *
020 * @author "Stephane Lacoin [aka matic] <slacoin at nuxeo.com>"
021 */
022@XObject("handler")
023public class DocumentStoreHandlerDescriptor {
024
025    @XNode("@id")
026    protected String id = "[id]";
027
028    protected DocumentStoreHandler handler;
029
030    @XNode("@class")
031    public void setClass(Class<? extends DocumentStoreHandler> clazz) {
032        try {
033            handler = clazz.newInstance();
034        } catch (ReflectiveOperationException e) {
035            throw new RuntimeException("Cannot instantiate " + clazz.getCanonicalName(), e);
036        }
037    }
038
039}