You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by tr...@apache.org on 2018/01/31 05:46:02 UTC
svn commit: r1822753 - in
/jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl:
JcrPackageDefinitionImpl.java JcrPackageImpl.java JcrPackageManagerImpl.java
Author: tripod
Date: Wed Jan 31 05:46:02 2018
New Revision: 1822753
URL: http://svn.apache.org/viewvc?rev=1822753&view=rev
Log:
trivial: remove some warnings
Modified:
jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageDefinitionImpl.java
jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageImpl.java
jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageManagerImpl.java
Modified: jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageDefinitionImpl.java?rev=1822753&r1=1822752&r2=1822753&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageDefinitionImpl.java (original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageDefinitionImpl.java Wed Jan 31 05:46:02 2018
@@ -109,6 +109,7 @@ public class JcrPackageDefinitionImpl im
log.warn("Unable to calculate installation path. setting to 'unknown'");
path = "unknown";
}
+ //noinspection deprecation
return new PackageId(path, version);
} else {
return new PackageId(group, name, version);
@@ -229,13 +230,13 @@ public class JcrPackageDefinitionImpl im
MetaInf inf = archive.getMetaInf();
// explode definition if present
if (inf.hasDefinition()) {
- extractDefinition(archive, false);
+ extractDefinition(archive);
}
if (inf.getFilter() != null) {
- writeFilter(inf.getFilter(), false);
+ JcrWorkspaceFilter.saveFilter(inf.getFilter(), defNode, false);
}
if (inf.getProperties() != null) {
- writeProperties(inf.getProperties(), false);
+ writeProperties(inf.getProperties());
}
}
defNode.setProperty("unwrapped", (Value) null);
@@ -250,10 +251,9 @@ public class JcrPackageDefinitionImpl im
* package to this node.
*
* @param packArchive the archive of the package
- * @param autoSave saves changed automatically if {@code true}
* @throws RepositoryException if an error occurs
*/
- private void extractDefinition(Archive packArchive, boolean autoSave)
+ private void extractDefinition(Archive packArchive)
throws RepositoryException {
Archive archive = null;
try {
@@ -297,9 +297,6 @@ public class JcrPackageDefinitionImpl im
if (lastUnpackedBy != null) {
defNode.setProperty(PN_LAST_UNPACKED_BY, lastUnpackedBy);
}
- if (autoSave) {
- defNode.getSession().save();
- }
} catch (Exception e) {
log.error("Unable to extract definition: {}", e.toString());
}
@@ -312,7 +309,7 @@ public class JcrPackageDefinitionImpl im
try {
if (defNode.hasProperty(PN_DEPENDENCIES)) {
Property p = defNode.getProperty(PN_DEPENDENCIES);
- List<Dependency> deps = new LinkedList<Dependency>();
+ List<Dependency> deps = new LinkedList<>();
if (p.getDefinition().isMultiple()) {
for (Value v: p.getValues()) {
Dependency dep = Dependency.fromString(v.getString());
@@ -359,7 +356,7 @@ public class JcrPackageDefinitionImpl im
* Load the given properties from the content
* @param props the properties to load
*/
- protected void loadProperties(Properties props) {
+ private void loadProperties(Properties props) {
PackageId id = getId();
setProperty(props, VaultPackage.NAME_VERSION, id.getVersionString());
setProperty(props, VaultPackage.NAME_NAME, id.getName());
@@ -410,9 +407,8 @@ public class JcrPackageDefinitionImpl im
/**
* Writes the given properties to the content.
* @param props the properties
- * @param autoSave saves the changes automatically if {@code true}
*/
- protected void writeProperties(Properties props, boolean autoSave) {
+ private void writeProperties(Properties props) {
try {
// sanitize lastModBy property due to former bug that used the
// lastMod value
@@ -456,9 +452,6 @@ public class JcrPackageDefinitionImpl im
defNode.setProperty(PN_AC_HANDLING, props.getProperty(VaultPackage.NAME_AC_HANDLING));
defNode.setProperty(PN_CND_PATTERN, props.getProperty(VaultPackage.NAME_CND_PATTERN));
defNode.setProperty(PN_DISABLE_INTERMEDIATE_SAVE, props.getProperty(VaultPackage.NAME_DISABLE_INTERMEDIATE_SAVE));
- if (autoSave) {
- defNode.getSession().save();
- }
} catch (RepositoryException e) {
log.error("error while saving properties.", e);
}
@@ -490,7 +483,9 @@ public class JcrPackageDefinitionImpl im
public void dumpCoverage(ProgressTrackerListener listener)
throws RepositoryException {
WorkspaceFilter filter = getMetaInf().getFilter();
- filter.dumpCoverage(defNode.getSession(), listener, false);
+ if (filter != null) {
+ filter.dumpCoverage(defNode.getSession(), listener, false);
+ }
}
/**
@@ -607,14 +602,13 @@ public class JcrPackageDefinitionImpl im
* - clears the unwrapped property
*
* @param now the date or {@code null}
- * @param autoSave saves the changes automatically if {@code true}
*/
- public void sealForAssembly(Calendar now, boolean autoSave) {
+ void sealForAssembly(Calendar now) {
try {
if (now == null) {
now = Calendar.getInstance();
}
- set(PN_BUILD_COUNT, String.valueOf(getBuildCount() + 1), autoSave);
+ defNode.setProperty(PN_BUILD_COUNT, String.valueOf(getBuildCount() + 1));
defNode.setProperty(PN_CREATED, now);
defNode.setProperty(PN_CREATED_BY, getUserId());
defNode.setProperty(PN_LAST_WRAPPED, now);
@@ -622,7 +616,8 @@ public class JcrPackageDefinitionImpl im
defNode.setProperty(PN_LAST_UNWRAPPED, now);
defNode.setProperty(PN_LAST_UNWRAPPED_BY, getUserId());
defNode.setProperty("unwrapped", (Value) null);
- touch(now, autoSave);
+ touch(now, false);
+ defNode.getSession().save();
} catch (RepositoryException e) {
log.error("Error during sealForAssembly()", e);
}
@@ -636,9 +631,8 @@ public class JcrPackageDefinitionImpl im
* - clears the unwrapped property
*
* @param now the date or {@code null}
- * @param autoSave saves the changes automatically if {@code true}
*/
- public void sealForRewrap(Calendar now, boolean autoSave) {
+ void sealForRewrap(Calendar now) {
try {
if (now == null) {
now = Calendar.getInstance();
@@ -654,9 +648,7 @@ public class JcrPackageDefinitionImpl im
defNode.setProperty(PN_LAST_UNWRAPPED_BY, getUserId());
defNode.setProperty("unwrapped", (Value) null);
touch(now, false);
- if (autoSave) {
- defNode.getSession().save();
- }
+ defNode.getSession().save();
} catch (RepositoryException e) {
log.error("Error during sealForRewrap()", e);
}
@@ -664,17 +656,12 @@ public class JcrPackageDefinitionImpl im
/**
* Touches the lastUnpacked (i.e. installed) properties.
- * @param now the date or {@code null}
- * @param autoSave saves the changes automatically if {@code true}
*/
- public void touchLastUnpacked(Calendar now, boolean autoSave) {
+ void touchLastUnpacked() {
try {
- defNode.setProperty(PN_LAST_UNPACKED,
- now == null ? Calendar.getInstance() : now);
+ defNode.setProperty(PN_LAST_UNPACKED, Calendar.getInstance());
defNode.setProperty(PN_LAST_UNPACKED_BY, getUserId());
- if (autoSave) {
- defNode.getSession().save();
- }
+ defNode.getSession().save();
} catch (RepositoryException e) {
log.error("Error during touchLastUnpacked()", e);
}
@@ -684,7 +671,7 @@ public class JcrPackageDefinitionImpl im
* Clears the last unpacked properties.
* @param autoSave saves the changes automatically if {@code true}
*/
- public void clearLastUnpacked(boolean autoSave) {
+ void clearLastUnpacked(boolean autoSave) {
try {
if (defNode.hasProperty(PN_LAST_UNPACKED)) {
defNode.getProperty(PN_LAST_UNPACKED).remove();
@@ -825,7 +812,7 @@ public class JcrPackageDefinitionImpl im
*/
public MetaInf getMetaInf() throws RepositoryException {
DefaultMetaInf inf = new DefaultMetaInf();
- inf.setFilter(readFilter());
+ inf.setFilter(JcrWorkspaceFilter.loadFilter(defNode));
// add properties
Properties props = new Properties();
@@ -836,31 +823,11 @@ public class JcrPackageDefinitionImpl im
}
/**
- * Loads the workspace filter from the definition
- * @return the workspace filter
- * @throws RepositoryException if an error occurs
- */
- public WorkspaceFilter readFilter() throws RepositoryException {
- return JcrWorkspaceFilter.loadFilter(defNode);
- }
-
- /**
- * Writes the workspace filter to the definition
- * @param filter the filter
- * @param save automatically save the changes if {@code true}
- * @throws RepositoryException if an error occurs
- */
- public void writeFilter(WorkspaceFilter filter, boolean save)
- throws RepositoryException {
- JcrWorkspaceFilter.saveFilter(filter, defNode, save);
- }
-
- /**
* Returns a export processor that adds the inline definition package to
* the exporter.
* @return the export processor for this definition
*/
- public ExportPostProcessor getInjectProcessor() {
+ ExportPostProcessor getInjectProcessor() {
return new InjectProcessor(defNode);
}
@@ -888,8 +855,8 @@ public class JcrPackageDefinitionImpl im
* @return the list of sub package ids
* @throws RepositoryException if an error occurs.
*/
- protected List<PackageId> getSubPackages() throws RepositoryException {
- LinkedList<PackageId> subPackages = new LinkedList<PackageId>();
+ List<PackageId> getSubPackages() throws RepositoryException {
+ LinkedList<PackageId> subPackages = new LinkedList<>();
if (defNode.hasProperty(PN_SUB_PACKAGES)) {
Value[] subIds = defNode.getProperty(PN_SUB_PACKAGES).getValues();
for (Value v : subIds) {
@@ -905,7 +872,7 @@ public class JcrPackageDefinitionImpl im
* @param subPackageIds the package Ids
* @throws RepositoryException if an error occurs
*/
- protected void setSubPackages(Collection<PackageId> subPackageIds) throws RepositoryException {
+ void setSubPackages(Collection<PackageId> subPackageIds) throws RepositoryException {
String[] subIds = new String[subPackageIds.size()];
int i =0;
for (PackageId subId: subPackageIds) {
@@ -953,7 +920,7 @@ public class JcrPackageDefinitionImpl im
return this;
}
- private State save(JcrPackageDefinitionImpl def) {
+ private void save(JcrPackageDefinitionImpl def) {
for (int i=0; i<PROPERTY_NAMES.length; i++) {
if (values[i] != null) {
try {
@@ -963,7 +930,6 @@ public class JcrPackageDefinitionImpl im
}
}
}
- return this;
}
}
Modified: jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageImpl.java?rev=1822753&r1=1822752&r2=1822753&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageImpl.java (original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageImpl.java Wed Jan 31 05:46:02 2018
@@ -397,7 +397,7 @@ public class JcrPackageImpl implements J
List<String> subPackages = new ArrayList<String>();
pack.extract(ctx, subPackages);
if (def != null && !opts.isDryRun()) {
- def.touchLastUnpacked(null, true);
+ def.touchLastUnpacked();
}
// process sub packages
@@ -668,7 +668,7 @@ public class JcrPackageImpl implements J
log.debug("Package {}: is pure container package. marking as installed.", pId);
getDefinition();
if (def != null && !opts.isDryRun()) {
- def.touchLastUnpacked(null, true);
+ def.touchLastUnpacked();
}
}
}
Modified: jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageManagerImpl.java?rev=1822753&r1=1822752&r2=1822753&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageManagerImpl.java (original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageManagerImpl.java Wed Jan 31 05:46:02 2018
@@ -331,7 +331,7 @@ public class JcrPackageManagerImpl exten
Calendar now = Calendar.getInstance();
JcrPackageDefinitionImpl def = (JcrPackageDefinitionImpl) definition;
validateSubPackages(def);
- def.sealForAssembly(now, true);
+ def.sealForAssembly(now);
DefaultMetaInf inf = (DefaultMetaInf) def.getMetaInf();
CompositeExportProcessor processor = new CompositeExportProcessor();
@@ -401,7 +401,7 @@ public class JcrPackageManagerImpl exten
JcrPackageDefinitionImpl def = (JcrPackageDefinitionImpl) definition;
validateSubPackages(def);
Calendar now = Calendar.getInstance();
- def.sealForAssembly(now, true);
+ def.sealForAssembly(now);
ExportOptions opts = new ExportOptions();
opts.setMetaInf(def.getMetaInf());
@@ -422,7 +422,7 @@ public class JcrPackageManagerImpl exten
Calendar now = Calendar.getInstance();
pack.verifyId(true, false);
JcrPackageDefinitionImpl def = (JcrPackageDefinitionImpl) pack.getDefinition();
- def.sealForRewrap(now, true);
+ def.sealForRewrap(now);
ExportOptions opts = new ExportOptions();
opts.setMetaInf(def.getMetaInf());