## Levels
log4j.logger.org.argeo=DEBUG
log4j.logger.org.argeo.jackrabbit.remote.ExtendedDispatcherServlet=ERROR
+#log4j.logger.org.argeo.jcr.mvc.ResourceProxyServlet=TRACE
log4j.logger.org.springframework.web.servlet.PageNotFound=ERROR
log4j.logger.org.argeo.server.webextender.TomcatDeployer=WARN
log4j.logger.org.argeo.slc.client.ui.dist=TRACE
+#log4j.logger.org.argeo.jcr.proxy=TRACE
+
#log4j.logger.org.apache.jackrabbit.webdav=DEBUG
#log4j.logger.org.apache.jackrabbit.jcr2spi=DEBUG
org.argeo.slc.repo,
org.argeo.slc.repo.maven,
org.argeo.slc.repo.maven.proxy,
+ org.h2;resolution:=optional,
org.sonatype.aether;version="1.9.0",
org.springframework.security;version="2.0.6.RELEASE"
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
">
-<!--
- <bean class="org.argeo.slc.repo.maven.ImportMavenDependencies" init-method="run">
- <property name="rootCoordinates"
- value="org.argeo.dep:versions-all:pom:1.1.3-SNAPSHOT" />
- <property name="distributionName" value="tp" />
- <property name="aetherTemplate" ref="mavenAetherTemplate" />
- <property name="jcrSession" ref="jcrSession" />
- <property name="excludedArtifacts">
- <set>
- <value>org.apache.commons:com.springsource.org.apache.commons.logging
- </value>
- <value>org.osgi:org.osgi.core</value>
- <value>org.easymock:easymock</value>
- <value>com.springsource.org.apache.xmlcommons</value>
- </set>
- </property>
- </bean>
- -->
-
-<!-- <bean id="mavenAetherTemplate" class="org.argeo.slc.aether.AetherTemplate"> -->
-<!-- <property name="repositorySystem" ref="mavenRepositorySystem" /> -->
-<!-- <property name="repositorySystemSession" ref="mavenRepositorySystemSession" /> -->
-<!-- <property name="remoteRepositories" ref="defaultMavenRepositories" /> -->
-<!-- </bean> -->
+ <!-- <bean class="org.argeo.slc.repo.maven.ImportMavenDependencies" init-method="run">
+ <property name="rootCoordinates" value="org.argeo.dep:versions-all:pom:1.1.3-SNAPSHOT"
+ /> <property name="distributionName" value="tp" /> <property name="aetherTemplate"
+ ref="mavenAetherTemplate" /> <property name="jcrSession" ref="jcrSession"
+ /> <property name="excludedArtifacts"> <set> <value>org.apache.commons:com.springsource.org.apache.commons.logging
+ </value> <value>org.osgi:org.osgi.core</value> <value>org.easymock:easymock</value>
+ <value>com.springsource.org.apache.xmlcommons</value> </set> </property>
+ </bean> -->
+
+ <!-- <bean id="mavenAetherTemplate" class="org.argeo.slc.aether.AetherTemplate"> -->
+ <!-- <property name="repositorySystem" ref="mavenRepositorySystem" /> -->
+ <!-- <property name="repositorySystemSession" ref="mavenRepositorySystemSession"
+ /> -->
+ <!-- <property name="remoteRepositories" ref="defaultMavenRepositories"
+ /> -->
+ <!-- </bean> -->
<!-- Remote repositories -->
<util:list id="defaultMavenRepositories">
+ <ref local="argeo-snapshots" />
+ <ref local="argeo" />
<ref local="central" />
<ref local="com.springsource.repository.bundles.external" />
<ref local="com.springsource.repository.bundles.release" />
- <ref local="argeo" />
- <ref local="argeo-snapshots" />
</util:list>
<bean id="central" class="org.argeo.slc.aether.spring.RemoteRepositoryFactory">
value="http://repository.springsource.com/maven/bundles/external" />
</bean>
<bean id="argeo" class="org.argeo.slc.aether.spring.RemoteRepositoryFactory">
- <property name="url" value="http://maven.argeo.org/argeo/" />
+ <property name="url" value="http://maven.argeo.org/argeo" />
</bean>
<bean id="argeo-snapshots" class="org.argeo.slc.aether.spring.RemoteRepositoryFactory">
- <property name="url" value="http://dev.argeo.org/maven/argeo-snapshots/" />
+ <property name="url" value="http://dev.argeo.org/maven/argeo-snapshots" />
</bean>
</beans>
\ No newline at end of file
artifact.getArtifactId());
artifactVersionBase.setProperty(SlcNames.SLC_GROUP_ID,
artifact.getGroupId());
- JcrUtils.updateLastModified(artifactVersionBase);
}
+ JcrUtils.updateLastModified(artifactVersionBase);
+
+ // pom
+ if (artifact.getExtension().equals("pom")) {
+ // TODO read to make it a distribution
+ }
+
Node artifactBase = artifactVersionBase.getParent();
if (!artifactBase.isNodeType(SlcTypes.SLC_ARTIFACT_BASE)) {
artifactBase.addMixin(SlcTypes.SLC_ARTIFACT_BASE);
artifact.getArtifactId());
artifactBase.setProperty(SlcNames.SLC_GROUP_ID,
artifact.getGroupId());
- JcrUtils.updateLastModified(artifactBase);
}
-
- // TODO do we really need group base?
+ JcrUtils.updateLastModified(artifactBase);
+
Node groupBase = artifactBase.getParent();
if (!groupBase.isNodeType(SlcTypes.SLC_GROUP_BASE)) {
// if (groupBase.isNodeType(SlcTypes.SLC_ARTIFACT_BASE)) {
groupBase.addMixin(SlcTypes.SLC_GROUP_BASE);
groupBase.setProperty(SlcNames.SLC_GROUP_BASE_ID,
artifact.getGroupId());
- JcrUtils.updateLastModified(groupBase);
}
+ JcrUtils.updateLastModifiedAndParents(groupBase,
+ RepoConstants.ARTIFACTS_BASE_PATH);
if (log.isTraceEnabled())
log.trace("Indexed artifact " + artifact + " on " + fileNode);
/** SLC repository constants */
public interface RepoConstants {
- public final static String ARTIFACTS_BASE_PATH = "/slc/repo/artifacts";
- public final static String PROXIED_REPOSITORIES = "/slc/repo/proxiedRepositories";
+ public final static String ARTIFACTS_BASE_PATH = "/repo";
+ public final static String PROXIED_REPOSITORIES = "/slc/repo/sources";
}
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.nodetype.NodeType;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.argeo.jcr.proxy.AbstractUrlProxy;
import org.argeo.slc.SlcException;
import org.argeo.slc.jcr.SlcNames;
+import org.argeo.slc.jcr.SlcTypes;
import org.argeo.slc.repo.RepoConstants;
import org.sonatype.aether.repository.RemoteRepository;
private List<RemoteRepository> defaultRepositories = new ArrayList<RemoteRepository>();
+ /** Inititalizes the artifacts area. */
@Override
- protected void beforeInitSessionSave() throws RepositoryException {
- JcrUtils.mkdirs(getJcrAdminSession(), RepoConstants.ARTIFACTS_BASE_PATH);
- Node proxiedRepositories = JcrUtils.mkdirs(getJcrAdminSession(),
+ protected void beforeInitSessionSave(Session session)
+ throws RepositoryException {
+ JcrUtils.mkdirsSafe(session, RepoConstants.ARTIFACTS_BASE_PATH);
+ Node proxiedRepositories = JcrUtils.mkdirsSafe(session,
RepoConstants.PROXIED_REPOSITORIES);
for (RemoteRepository repository : defaultRepositories) {
if (!proxiedRepositories.hasNode(repository.getId())) {
Node proxiedRepository = proxiedRepositories.addNode(repository
.getId());
- proxiedRepository.setProperty(SLC_URL, repository.getUrl());
+ proxiedRepository.addMixin(NodeType.MIX_REFERENCEABLE);
+ JcrUtils.urlToAddressProperties(proxiedRepository,
+ repository.getUrl());
+ // proxiedRepository.setProperty(SLC_URL, repository.getUrl());
proxiedRepository.setProperty(SLC_TYPE,
repository.getContentType());
}
/**
* Retrieve and add this file to the repository
*/
- protected String retrieve(String path) {
+ @Override
+ protected Node retrieve(Session session, String path) {
try {
+ if (session.hasPendingChanges())
+ throw new SlcException("Session has pending changed");
Node node = null;
- baseUrls: for (String baseUrl : getBaseUrls()) {
- node = proxyUrl(baseUrl, path);
- if (node != null)
- break baseUrls;
- }
-
- if (node != null)
- return node.getIdentifier();
- else {
- log.warn("Could not proxy " + path);
- return null;
+ for (Node proxiedRepository : getBaseUrls(session)) {
+ String baseUrl = JcrUtils
+ .urlFromAddressProperties(proxiedRepository);
+ node = proxyUrl(session, baseUrl, path);
+ if (node != null) {
+ node.addMixin(SlcTypes.SLC_KNOWN_ORIGIN);
+ Node origin = node
+ .addNode(SLC_ORIGIN, SlcTypes.SLC_PROXIED);
+ origin.setProperty(SLC_PROXY, proxiedRepository);
+ JcrUtils.urlToAddressProperties(origin, baseUrl + path);
+ if (log.isDebugEnabled())
+ log.debug("Imported " + baseUrl + path + " to " + node);
+ return node;
+ }
}
- } catch (RepositoryException e) {
+ if (log.isDebugEnabled())
+ log.warn("No proxy found for " + path);
+ return null;
+ } catch (Exception e) {
throw new SlcException("Cannot proxy " + path, e);
}
}
- protected synchronized List<String> getBaseUrls()
+ protected synchronized List<Node> getBaseUrls(Session session)
throws RepositoryException {
- List<String> baseUrls = new ArrayList<String>();
- for (NodeIterator nit = getJcrAdminSession().getNode(
+ List<Node> baseUrls = new ArrayList<Node>();
+ for (NodeIterator nit = session.getNode(
RepoConstants.PROXIED_REPOSITORIES).getNodes(); nit.hasNext();) {
Node proxiedRepository = nit.nextNode();
- String repoUrl = proxiedRepository.getProperty(SLC_URL).getString();
- baseUrls.add(repoUrl);
+ baseUrls.add(proxiedRepository);
}
return baseUrls;
}
<slc = 'http://www.argeo.org/ns/slc'>
// AETHER
-[slc:artifact] > nt:base, mix:shareable
+[slc:artifact] > mix:referenceable, mix:created, mix:lastModified
mixin
- slc:artifactId (STRING) m
- slc:groupId (STRING) m
- slc:artifactExtension (STRING) m
- slc:artifactClassifier (STRING) ='' m a
-[slc:artifactVersionBase] > nt:base
+[slc:artifactVersion] > mix:referenceable, mix:created, mix:lastModified, mix:title
mixin
- slc:artifactId (STRING) m
- slc:groupId (STRING) m
- slc:artifactVersion (STRING) m
-[slc:artifactBase] > nt:base
+[slc:artifactBase] > mix:referenceable, mix:created, mix:lastModified
mixin
- slc:artifactId (STRING) m
- slc:groupId (STRING) m
-[slc:groupBase] > nt:base
+[slc:groupBase] > mix:referenceable, mix:created, mix:lastModified
mixin
// it is possible to have groupBase being artifact base (e.g. org.argeo.commons.basic)
// so using groupId would conflict
- slc:groupBaseId (STRING) m
-[slc:jarFile] > nt:base
+[slc:distribution] > slc:artifactVersion
+mixin
++ slc:artifactVersions (argeo:references) m
+
+// ORIGINS
+[slc:knownOrigin] > nt:base
+mixin
++ slc:origin (nt:address)
+
+[slc:proxied] > nt:address
+- slc:proxy (REFERENCE)
+
+// JAVA
+[slc:jarFile] > mix:referenceable
mixin
- 'slc:manifest' (BINARY) m
- 'slc:Manifest-Version' (STRING)
// OSGi
// see http://www.osgi.org/Specifications/Reference
-[slc:javaPackage] > nt:base
+[slc:javaPackage] > mix:referenceable
- slc:name (STRING) primary m
-[slc:osgiBaseVersion] > nt:base
+[slc:osgiBaseVersion] > mix:referenceable
- slc:asString (STRING) primary m
- slc:major (LONG) m
- slc:minor (LONG) m
- slc:version (STRING) ='0.0.0' m a
- slc:optional (BOOLEAN) ='false' m a
-[slc:requiredBundle] > nt:base
+[slc:requiredBundle] > mix:referenceable
- 'slc:symbolic-name' (STRING) primary m
- 'slc:bundle-version' (STRING) ='0.0.0' m a
- slc:optional (BOOLEAN) ='false' m a
-[slc:fragmentHost] > nt:base
+[slc:fragmentHost] > mix:referenceable
- 'slc:symbolic-name' (STRING) m
- 'slc:bundle-version' (STRING) ='0.0.0' m a
-[slc:bundleNativeCode] > nt:base
+[slc:bundleNativeCode] > mix:referenceable
- slc:path (STRING) primary m
- slc:osname (STRING)
- slc:processor (STRING)
// see http://www.osgi.org/Specifications/ReferenceHeaders
-[slc:bundle] > nt:base
+[slc:bundle] > mix:referenceable
mixin
- 'slc:symbolic-name' (STRING) primary m
- 'slc:bundle-version' (STRING) m
[slc:bundleArtifact] > slc:artifact,slc:jarFile,slc:bundle
mixin
-
public final static String SLC_OPTIONAL = "slc:optional";
public final static String SLC_AS_STRING = "slc:asString";
+ // origin
+ public final static String SLC_ORIGIN = "slc:origin";
+ public final static String SLC_PROXY = "slc:proxy";
+
// slc:artifact
public final static String SLC_ARTIFACT_ID = "slc:artifactId";
public final static String SLC_GROUP_ID = "slc:groupId";
* REPO
*/
public final static String SLC_ARTIFACT = "slc:artifact";
- public final static String SLC_ARTIFACT_VERSION_BASE = "slc:artifactVersionBase";
+ public final static String SLC_ARTIFACT_VERSION_BASE = "slc:artifactVersion";
public final static String SLC_ARTIFACT_BASE = "slc:artifactBase";
public final static String SLC_GROUP_BASE = "slc:groupBase";
public final static String SLC_JAR_FILE = "slc:jarFile";
public final static String SLC_DYNAMIC_IMPORTED_PACKAGE = "slc:dynamicImportedPackage";
public final static String SLC_REQUIRED_BUNDLE = "slc:requiredBundle";
public final static String SLC_FRAGMENT_HOST = "slc:fragmentHost";
+
+ // origin
+ public final static String SLC_KNOWN_ORIGIN = "slc:knownOrigin";
+ public final static String SLC_PROXIED = "slc:proxied";
}
*/
protected String initAgentUuid() {
try {
- Node vmAgentFactoryNode = JcrUtils.mkdirs(session,
+ Node vmAgentFactoryNode = JcrUtils.mkdirsSafe(session,
SlcJcrConstants.VM_AGENT_FACTORY_PATH,
SlcTypes.SLC_AGENT_FACTORY);
if (!vmAgentFactoryNode.hasNode(agentNodeName)) {