import java.util.Map;
import javax.jcr.Credentials;
+import javax.jcr.LoginException;
+import javax.jcr.NoSuchWorkspaceException;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.nodetype.NodeType;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.api.JackrabbitRepository;
import org.apache.jackrabbit.commons.NamespaceHelper;
import org.apache.jackrabbit.commons.cnd.CndImporter;
-import org.argeo.ArgeoException;
import org.argeo.jcr.ArgeoJcrConstants;
+import org.argeo.jcr.ArgeoJcrException;
import org.argeo.jcr.ArgeoNames;
import org.argeo.jcr.ArgeoTypes;
import org.argeo.jcr.JcrRepositoryWrapper;
* Wrapper around a Jackrabbit repository which allows to simplify configuration
* and intercept some actions. It exposes itself as a {@link Repository}.
*/
+@Deprecated
public class JackrabbitWrapper extends JcrRepositoryWrapper implements
- ResourceLoaderAware {
+ JackrabbitRepository, ResourceLoaderAware {
private final static Log log = LogFactory.getLog(JackrabbitWrapper.class);
private final static String DIGEST_ALGORITHM = "MD5";
}
} catch (Exception e) {
JcrUtils.discardQuietly(session);
- throw new ArgeoException("Cannot import node type definitions "
+ throw new ArgeoJcrException("Cannot import node type definitions "
+ cndFiles, e);
} finally {
JcrUtils.logoutQuietly(session);
String oldDigest = JcrUtils.checksumFile(dataModel,
DIGEST_ALGORITHM);
if (oldDigest.equals(newDigest)) {
- if (log.isDebugEnabled())
- log.debug("Data model " + resUrl
+ if (log.isTraceEnabled())
+ log.trace("Data model " + resUrl
+ " hasn't changed, keeping version "
+ currentVersion);
return;
+ (bundle != null ? ", version " + bundle.getVersion()
+ ", bundle " + bundle.getSymbolicName() : ""));
} catch (Exception e) {
- throw new ArgeoException("Cannot process data model " + resUrl, e);
+ throw new ArgeoJcrException("Cannot process data model " + resUrl, e);
} finally {
IOUtils.closeQuietly(reader);
}
in = res.getInputStream();
url = res.getURL();
} else {
- throw new ArgeoException("No " + resUrl + " in the classpath,"
+ throw new ArgeoJcrException("No " + resUrl + " in the classpath,"
+ " make sure the containing" + " package is visible.");
}
return IOUtils.toByteArray(in);
} catch (Exception e) {
- throw new ArgeoException("Cannot read CND from " + resUrl, e);
+ throw new ArgeoJcrException("Cannot read CND from " + resUrl, e);
} finally {
IOUtils.closeQuietly(in);
}
}
/*
- * REPOSITORY INTERCEPTOR
+ * JACKRABBIT REPOSITORY IMPLEMENTATION
*/
+ @Override
+ public Session login(Credentials credentials, String workspaceName,
+ Map<String, Object> attributes) throws LoginException,
+ NoSuchWorkspaceException, RepositoryException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void shutdown() {
+ // TODO Auto-generated method stub
+
+ }
/*
* UTILITIES
resUrl = resUrl.substring(1);
String pkg = resUrl.substring(0, resUrl.lastIndexOf('/')).replace('/',
'.');
- ServiceReference paSr = bundleContext
- .getServiceReference(PackageAdmin.class.getName());
+ ServiceReference<PackageAdmin> paSr = bundleContext
+ .getServiceReference(PackageAdmin.class);
PackageAdmin packageAdmin = (PackageAdmin) bundleContext
.getService(paSr);
ExportedPackage[] exportedPackages = packageAdmin
.getExportedPackages(pkg);
if (exportedPackages == null)
- throw new ArgeoException("No exported package found for " + pkg);
+ throw new ArgeoJcrException("No exported package found for " + pkg);
for (ExportedPackage ep : exportedPackages) {
for (Bundle b : ep.getImportingBundles()) {
if (b.getBundleId() == bundleContext.getBundle().getBundleId()) {
} else {
// assume this is in the same bundle
exportingBundle = bundleContext.getBundle();
- // throw new ArgeoException("No OSGi exporting package found for "
+ // throw new ArgeoJcrException("No OSGi exporting package found for "
// + resUrl);
}
return exportingBundle;