001/* 002 * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Nuxeo - initial API and implementation 016 * 017 * $Id: NodeFactory.java 20645 2007-06-17 13:16:54Z sfermigier $ 018 */ 019 020package org.nuxeo.ecm.platform.relations.api.impl; 021 022import org.nuxeo.ecm.platform.relations.api.QNameResource; 023import org.nuxeo.ecm.platform.relations.api.Resource; 024 025/** 026 * Node factory to create default nodes. 027 * 028 * @author <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a> 029 */ 030public final class NodeFactory { 031 032 // Utility class. 033 private NodeFactory() { 034 } 035 036 public static LiteralImpl createLiteral(String value) { 037 return new LiteralImpl(value); 038 } 039 040 public static LiteralImpl createLiteral(String value, String language) { 041 LiteralImpl lit = new LiteralImpl(value); 042 lit.setLanguage(language); 043 return lit; 044 } 045 046 public static LiteralImpl createTypedLiteral(String value, String type) { 047 LiteralImpl lit = new LiteralImpl(value); 048 lit.setType(type); 049 return lit; 050 } 051 052 public static BlankImpl createBlank() { 053 return new BlankImpl(); 054 } 055 056 public static BlankImpl createBlank(String id) { 057 return new BlankImpl(id); 058 } 059 060 public static Resource createResource(String uri) { 061 return new ResourceImpl(uri); 062 } 063 064 public static QNameResource createQNameResource(String namespace, String localName) { 065 return new QNameResourceImpl(namespace, localName); 066 } 067}