Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The version number of the plugin should be defined in the pom.xml of the plugin. For example to define the version to be 1.0.2:

...

By default, the minimum and maximum version of XperienCentral that a plugin can run on is calculated as follows: If the version of XperienCentral for which you build the plugin is x.y.z, then the minimum version of XperienCentral on which the plugin can run is x.y and the maximum version is (x+1).0. It is also possible to explicity set the minimum and maximum versions of XperienCentral on which a plugin can run in the POM file using the setting properties XperienCentral webmanager.wcb-min-version and XperienCentral webmanager.wcb-max-version. For example:

Code Block
themeEclipse
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
	<modelVersion>4.0.0</modelVersion> 
	<parent> 
		<groupId>nl.gx.webmanager.wcbs</groupId> 
		<artifactId>XperienCentral-wcbs</artifactId> 
	<version>10.6.0-SNAPSHOT</version> 
	</parent> 
	<packaging>osgi-bundle</packaging> 
	<artifactId>wmpjcrbrowser</artifactId> 
	<name>JCR Browser</name> 
	<properties> 
		<Webmanager.wcb.max-version>10.4</Webmanager.wcb.max-version> 
		<Webmanager.wcb.min-version>10.0</Webmanager.wcb.min-version> 
	</properties> 
... 
</project>

...

Code Block
themeEclipse
@Property 
@Deprecated
public String getKeyword(){
	return getKeywords()[0];
}
public void setKeyword(String keyword) {
	setKeywords(new String[]{keyword, “”});
}
@Property 
@Deprecated
public String getSecondaryKeyword(){
	return getKeywords()[1];
}
public void setSecondaryKeyword(String keyword) { 
	setKeywords(new String[]{“”, keyword});
}

@Property 
public String[] getKeywords() {...}
public void setKeywords(String[] keywords) {...}

public static void upgradeContent(String fromVersion,
Node[] nodes) throws  
IncompatibeUpdateException {
	if (fromVersion.compareTo(“1.1”) != 0) {
		String msg = “This update requires 1.1. “;
		msg += “Current WCBPlugin version is “ + fromVersion;
		throw new IncompatibeUpdateException(msg);          
    } else {
		updateKeywords(nodes);
    }
}

public static void updateKeywords(Node[] nodes) {
	for (int i=0; i<nodes.length;i++) {
		String pKeyword = nodes[i].getProperty("keyword").getString();
		String sKeyword = nodes[i].getProperty("secondaryKeyword").getString();
		String[] keywords = new String[]{pKeyword, sKeyword};
		nodes[i].setProperty(“keywords”, keywords);
	}
	nodes[0].getSession().save();
}

...

Code Block
themeEclipse
@Property 
public String[] getKeywords() {...}
public void setKeywords(String[] keywords) {...}

public static void upgradeContent(String fromVersion, Node[] nodes) throws IncompatibeUpdateException {
	if (fromVersion.compareTo(“1.2”) != 0 {
		String msg = “This update requires 1.2. “;
		msg += “Current WCBPlugin version is “ + fromVersion;
		throw new IncompatibeUpdateException(msg);          
	}
}

...