use of org.pentaho.platform.api.repository.RepositoryException in project pentaho-platform by pentaho.
the class MondrianCatalogRepositoryHelper method getModrianSchemaFiles.
public Map<String, InputStream> getModrianSchemaFiles(String catalogName) {
Map<String, InputStream> values = new HashMap<String, InputStream>();
RepositoryFile catalogFolder = repository.getFile(ETC_MONDRIAN_JCR_FOLDER + RepositoryFile.SEPARATOR + catalogName);
if (catalogFolder == null) {
logger.warn("Catalog " + catalogName + " not found");
throw new RepositoryException("Catalog " + catalogName + " not found");
}
for (RepositoryFile repoFile : repository.getChildren(catalogFolder.getId())) {
RepositoryFileInputStream is;
if (repoFile.getName().equals("metadata")) {
continue;
}
try {
is = new RepositoryFileInputStream(repoFile, repository);
} catch (FileNotFoundException e) {
throw new RepositoryException(e);
}
values.put(repoFile.getName(), is);
}
if (values.containsKey(ANNOTATIONS_XML) && values.containsKey(SCHEMA_XML)) {
return includeAnnotatedSchema(values);
}
return values;
}
use of org.pentaho.platform.api.repository.RepositoryException in project pentaho-platform by pentaho.
the class SimpleRuntimeElement method checkType.
protected void checkType(final String key, final String type, final boolean setIt) {
Map localTypesMap = getTypesMap();
String curType = (String) localTypesMap.get(key);
if (curType != null) {
if (!curType.equals(type)) {
throw new RepositoryException(Messages.getInstance().getErrorString("RTREPO.ERROR_0001_INVALIDTYPE", curType, // $NON-NLS-1$
type));
}
}
if (setIt) {
localTypesMap.put(key, type);
}
}
use of org.pentaho.platform.api.repository.RepositoryException in project pentaho-platform by pentaho.
the class RuntimeRepository method newRuntimeElement.
/**
* Creates a new RuntimeElement
*
* @param parId
* Parent ID of this instance
* @param parType
* Parent type of the instance
* @return the created runtime element
*/
public IRuntimeElement newRuntimeElement(final String parId, final String parType, boolean transientOnly) {
if (RuntimeRepository.debug) {
// $NON-NLS-1$
debug(Messages.getInstance().getString("RTREPO.DEBUG_NEW_ELEMENT_PARENT", parId, parType));
}
Session session = HibernateUtil.getSession();
String instanceId = UUIDUtil.getUUIDAsString();
if (RuntimeRepository.debug) {
// $NON-NLS-1$
debug(Messages.getInstance().getString("RTREPO.DEBUG_CREATE_INSTANCE", instanceId));
}
RuntimeElement re = new RuntimeElement(instanceId, parId, parType);
if (!transientOnly) {
try {
session.save(re);
} catch (HibernateException ex) {
// $NON-NLS-1$
error(Messages.getInstance().getErrorString("RTREPO.ERROR_0002_SAVING_ELEMENT"), ex);
throw new RepositoryException(Messages.getInstance().getErrorString("RTREPO.ERROR_0002_SAVING_ELEMENT"), ex);
}
}
return re;
}
use of org.pentaho.platform.api.repository.RepositoryException in project pentaho-platform by pentaho.
the class HibernateUtil method beginTransaction.
/**
* Start a new database transaction.
*/
public static void beginTransaction() throws RepositoryException {
// commitNeeded.set(Boolean.TRUE);
Transaction tx = (Transaction) HibernateUtil.threadTransaction.get();
try {
if (tx == null) {
if (HibernateUtil.debug) {
// $NON-NLS-1$
HibernateUtil.log.debug(Messages.getInstance().getString("HIBUTIL.DEBUG_START_TRANS"));
}
tx = HibernateUtil.getSession().beginTransaction();
HibernateUtil.threadTransaction.set(tx);
}
} catch (HibernateException ex) {
// $NON-NLS-1$
HibernateUtil.log.error(Messages.getInstance().getErrorString("HIBUTIL.ERROR_0004_START_TRANS"), ex);
// $NON-NLS-1$
throw new RepositoryException(Messages.getInstance().getErrorString("HIBUTIL.ERROR_0004_START_TRANS"), ex);
}
}
use of org.pentaho.platform.api.repository.RepositoryException in project pentaho-platform by pentaho.
the class RuntimeElement method checkType.
protected void checkType(final String key, final String type, final boolean setIt) {
Map localTypesMap = getTypesMap();
String curType = (String) localTypesMap.get(key);
if (curType != null) {
if (!curType.equals(type)) {
throw new RepositoryException(Messages.getInstance().getErrorString("RTREPO.ERROR_0001_INVALIDTYPE", curType, // $NON-NLS-1$
type));
}
}
if (setIt) {
localTypesMap.put(key, type);
}
}
Aggregations