From 8d6aa95424afc9d4865509e6fdf083b7f5bedd61 Mon Sep 17 00:00:00 2001 From: Michael Zhou Date: Mon, 25 Feb 2013 13:13:39 -0600 Subject: [PATCH] =?UTF-8?q?*=20=E5=88=A0=E9=99=A4intellij:annotations?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=EF=BC=8C=E5=9B=A0=E4=B8=BA=E8=BF=98=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E5=85=A8=E9=9D=A2=E4=BD=BF=E7=94=A8=E8=BF=99=E4=B8=AA?= =?UTF-8?q?=E6=9C=BA=E5=88=B6=EF=BC=8C=E4=B8=8D=E5=A6=82=E5=85=88=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E3=80=82=20*=20=E5=B0=86velocity/freemarker=E7=9A=84?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E6=94=B9=E6=88=90scope=3Dprovided=E3=80=82?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E7=A8=8B=E5=BA=8F=E5=A6=82=E6=9E=9C=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E7=9A=84=E8=AF=9D=EF=BC=8C=E5=BF=85=E9=A1=BB=E6=98=8E?= =?UTF-8?q?=E7=A1=AE=E5=A3=B0=E6=98=8E=E4=BE=9D=E8=B5=96=E5=AE=83=E4=BB=AC?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.txt | 2 ++ CHANGES_SINCE_3.1.0.txt | 2 ++ CHANGES_SINCE_3.2.0.txt | 2 ++ .../citrus/springext/ResourceResolver.java | 8 ++--- .../support/ClasspathResourceResolver.java | 10 ++---- .../springext/support/SpringExtSchemaSet.java | 36 +++++++------------ .../springext/impl/UnqualifiedStyleTests.java | 5 +-- common/util/pom.xml | 4 --- .../java/com/alibaba/citrus/util/Assert.java | 14 +++----- pom.xml | 7 ++-- service/mail/pom.xml | 8 +++++ webx/turbine/pom.xml | 4 +++ 12 files changed, 41 insertions(+), 61 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index b1f758c7d..b10037ed6 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -369,3 +369,5 @@ -- Changes in 3.0.11 * 升级到springext-maven-plugin 1.2 +* 删除intellij:annotations依赖,因为还不能全面使用这个机制,不如先删除。 +* 将velocity/freemarker的依赖改成scope=provided。应用程序如果需要的话,必须明确声明依赖它们。 diff --git a/CHANGES_SINCE_3.1.0.txt b/CHANGES_SINCE_3.1.0.txt index 2e93df449..6804d54af 100644 --- a/CHANGES_SINCE_3.1.0.txt +++ b/CHANGES_SINCE_3.1.0.txt @@ -117,3 +117,5 @@ -- Changes in 3.1.3 * 升级到springext-maven-plugin 1.2 +* 删除intellij:annotations依赖,因为还不能全面使用这个机制,不如先删除。 +* 将velocity/freemarker的依赖改成scope=provided。应用程序如果需要的话,必须明确声明依赖它们。 diff --git a/CHANGES_SINCE_3.2.0.txt b/CHANGES_SINCE_3.2.0.txt index d847a19c1..d262dff44 100644 --- a/CHANGES_SINCE_3.2.0.txt +++ b/CHANGES_SINCE_3.2.0.txt @@ -46,3 +46,5 @@ -- Changes in 3.2.1 * 升级到springext-maven-plugin 1.2 +* 删除intellij:annotations依赖,因为还不能全面使用这个机制,不如先删除。 +* 将velocity/freemarker的依赖改成scope=provided。应用程序如果需要的话,必须明确声明依赖它们。 diff --git a/common/springext/src/main/java/com/alibaba/citrus/springext/ResourceResolver.java b/common/springext/src/main/java/com/alibaba/citrus/springext/ResourceResolver.java index eca2e6b7a..cdf596b57 100644 --- a/common/springext/src/main/java/com/alibaba/citrus/springext/ResourceResolver.java +++ b/common/springext/src/main/java/com/alibaba/citrus/springext/ResourceResolver.java @@ -27,8 +27,6 @@ import java.util.Map.Entry; import java.util.Properties; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.core.io.InputStreamSource; @@ -52,16 +50,14 @@ public abstract class ResourceResolver { * 取得指定位置的一个资源。 * 如果资源不存在,则返回null。 */ - @Nullable - public abstract Resource getResource(@NotNull String location); + public abstract Resource getResource(String location); /** * 找到所有符合名称的资源。支持同名资源的查找,例如,查找所有jar包中的/META-INF/spring.schemas文件。该方法还支持通配符。 * * @throws IOException 如果在寻找过程中出错 */ - @NotNull - public abstract Resource[] getResources(@NotNull String locationPattern) throws IOException; + public abstract Resource[] getResources(String locationPattern) throws IOException; /** 从ResourceResolver中读取所有指定名称的资源文件,对每一个key/value调用handler。 */ public final void loadAllProperties(String resourceName, PropertyHandler handler) diff --git a/common/springext/src/main/java/com/alibaba/citrus/springext/support/ClasspathResourceResolver.java b/common/springext/src/main/java/com/alibaba/citrus/springext/support/ClasspathResourceResolver.java index bbd273f42..a7e23fffc 100644 --- a/common/springext/src/main/java/com/alibaba/citrus/springext/support/ClasspathResourceResolver.java +++ b/common/springext/src/main/java/com/alibaba/citrus/springext/support/ClasspathResourceResolver.java @@ -27,9 +27,6 @@ import java.net.URL; import com.alibaba.citrus.springext.ResourceResolver; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.springframework.core.io.Resource; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.core.io.support.ResourcePatternResolver; @@ -46,8 +43,7 @@ public ClasspathResourceResolver(ClassLoader classLoader) { } @Override - @Nullable - public Resource getResource(@NotNull String location) { + public Resource getResource(String location) { org.springframework.core.io.Resource springResource = resolver.getResource(CLASSPATH_URL_PREFIX + location); if (springResource != null && springResource.exists()) { @@ -58,8 +54,7 @@ public Resource getResource(@NotNull String location) { } @Override - @NotNull - public Resource[] getResources(@NotNull String locationPattern) throws IOException { + public Resource[] getResources(String locationPattern) throws IOException { org.springframework.core.io.Resource[] springResources = resolver.getResources(CLASSPATH_ALL_URL_PREFIX + locationPattern); if (springResources == null) { @@ -86,7 +81,6 @@ private SpringResourceAdapter(org.springframework.core.io.Resource springResourc this.springResource = assertNotNull(springResource, "missing spring resource"); } - @NotNull public org.springframework.core.io.Resource getUnderlyingResource() { return springResource; } diff --git a/common/springext/src/main/java/com/alibaba/citrus/springext/support/SpringExtSchemaSet.java b/common/springext/src/main/java/com/alibaba/citrus/springext/support/SpringExtSchemaSet.java index b6aefc7bd..7e3dc2194 100644 --- a/common/springext/src/main/java/com/alibaba/citrus/springext/support/SpringExtSchemaSet.java +++ b/common/springext/src/main/java/com/alibaba/citrus/springext/support/SpringExtSchemaSet.java @@ -38,7 +38,6 @@ import com.alibaba.citrus.springext.impl.SpringPluggableSchemas; import com.alibaba.citrus.springext.support.SchemaUtil.AnyElementVisitor; import com.alibaba.citrus.util.ToStringBuilder; -import org.jetbrains.annotations.NotNull; /** * 创建一个schema set,其中包含以下所有的schemas: @@ -202,32 +201,27 @@ private synchronized void ensureTreeBuilt(boolean includingAllContributions) { public static interface TreeItem { boolean hasChildren(); - @NotNull TreeItem[] getChildren(); } public static interface NamespaceItem extends TreeItem { - @NotNull String getNamespace(); - @NotNull Set getSchemas(); } public static interface ParentOf { - @NotNull Map getChildrenMap(); } public static class ConfigurationPointItem extends AbstractNamespaceItem { private final ConfigurationPoint configurationPoint; - public ConfigurationPointItem(@NotNull String namespace, @NotNull Set schemas, @NotNull ConfigurationPoint configurationPoint) { + public ConfigurationPointItem(String namespace, Set schemas, ConfigurationPoint configurationPoint) { super(ContributionItem.class, namespace, schemas); this.configurationPoint = configurationPoint; } - @NotNull public ConfigurationPoint getConfigurationPoint() { return configurationPoint; } @@ -236,12 +230,11 @@ public ConfigurationPoint getConfigurationPoint() { public static class ContributionItem extends AbstractTreeItem { private final Contribution contribution; - public ContributionItem(@NotNull Contribution contribution) { + public ContributionItem(Contribution contribution) { super(ConfigurationPointItem.class); this.contribution = contribution; } - @NotNull public Contribution getContribution() { return contribution; } @@ -253,7 +246,7 @@ public String toString() { } public static class SpringPluggableItem extends AbstractNamespaceItem { - public SpringPluggableItem(@NotNull String namespace, @NotNull Set schemas) { + public SpringPluggableItem(String namespace, Set schemas) { super(TreeItem.class, namespace, schemas); } } @@ -262,7 +255,7 @@ private static abstract class AbstractTreeItem implements Tr protected final Map children = createTreeMap(); private final Class childType; - protected AbstractTreeItem(@NotNull Class childType) { + protected AbstractTreeItem(Class childType) { this.childType = assertNotNull(childType, "child item type"); } @@ -271,19 +264,16 @@ public boolean hasChildren() { return !children.isEmpty(); } - @NotNull public C[] getChildren() { C[] copy = (C[]) Array.newInstance(childType, children.size()); return children.values().toArray(copy); } - @NotNull @Override public Map getChildrenMap() { return children; } - @NotNull public String dump() { ToStringBuilder buf = new ToStringBuilder(); dump(buf); @@ -311,18 +301,16 @@ private static abstract class AbstractNamespaceItem extends private final String namespace; private final Set schemas; - protected AbstractNamespaceItem(@NotNull Class childType, @NotNull String namespace, @NotNull Set schemas) { + protected AbstractNamespaceItem(Class childType, String namespace, Set schemas) { super(childType); this.namespace = namespace; this.schemas = schemas; } - @NotNull public String getNamespace() { return namespace; } - @NotNull public Set getSchemas() { return schemas; } @@ -358,7 +346,7 @@ public NamespaceItem[] getIndependentNamespaceItems() { return independentItems.values().toArray(new NamespaceItem[independentItems.size()]); } - private boolean buildNamespaceItemRecursively(@NotNull String namespace) { + private boolean buildNamespaceItemRecursively(String namespace) { if (buildingNamespaces.contains(namespace)) { return false; // 防止递归失控 } @@ -373,7 +361,7 @@ private boolean buildNamespaceItemRecursively(@NotNull String namespace) { return true; } - private void buildNamespaceItem(@NotNull String namespace) { + private void buildNamespaceItem(String namespace) { if (items.containsKey(namespace)) { return; // 防止重复build } @@ -404,13 +392,13 @@ else if (schema instanceof ConfigurationPointSchemaSourceInfo) { } } - private void buildSpringPluggableItem(@NotNull String namespace, @NotNull Set schemas) { + private void buildSpringPluggableItem(String namespace, Set schemas) { NamespaceItem item = createSpringPluggableItem(namespace, schemas); items.put(namespace, item); independentItems.put(namespace, item); } - private void buildConfigurationPointItem(@NotNull String namespace, @NotNull Set schemas, @NotNull ConfigurationPointSchemaSourceInfo schema) { + private void buildConfigurationPointItem(String namespace, Set schemas, ConfigurationPointSchemaSourceInfo schema) { ConfigurationPoint configurationPoint = (ConfigurationPoint) schema.getParent(); ConfigurationPointItem item = createConfigurationPointItem(namespace, schemas, configurationPoint); items.put(namespace, item); @@ -460,7 +448,7 @@ private void buildContributionItem(String namespace, ConfigurationPointItem item } /** Template method */ - protected ConfigurationPointItem createConfigurationPointItem(@NotNull String namespace, @NotNull Set schemas, @NotNull ConfigurationPoint configurationPoint) { + protected ConfigurationPointItem createConfigurationPointItem(String namespace, Set schemas, ConfigurationPoint configurationPoint) { return new ConfigurationPointItem(namespace, schemas, configurationPoint); } @@ -470,12 +458,12 @@ protected ContributionItem createContributionItem(Contribution contribution) { } /** Template method */ - protected SpringPluggableItem createSpringPluggableItem(@NotNull String namespace, @NotNull Set schemas) { + protected SpringPluggableItem createSpringPluggableItem(String namespace, Set schemas) { return new SpringPluggableItem(namespace, schemas); } /** Template method */ - protected void addChildItem(@NotNull ParentOf parent, @NotNull String key, @NotNull C childItem) { + protected void addChildItem(ParentOf parent, String key, C childItem) { parent.getChildrenMap().put(key, childItem); } } diff --git a/common/springext/src/test/java/com/alibaba/citrus/springext/impl/UnqualifiedStyleTests.java b/common/springext/src/test/java/com/alibaba/citrus/springext/impl/UnqualifiedStyleTests.java index e31ab39e3..dd383f472 100644 --- a/common/springext/src/test/java/com/alibaba/citrus/springext/impl/UnqualifiedStyleTests.java +++ b/common/springext/src/test/java/com/alibaba/citrus/springext/impl/UnqualifiedStyleTests.java @@ -31,8 +31,6 @@ import com.alibaba.citrus.springext.util.ConvertToUnqualifiedStyle; import com.alibaba.citrus.test.TestEnvStatic; import com.alibaba.citrus.util.io.StreamUtil; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.junit.Test; public class UnqualifiedStyleTests { @@ -58,9 +56,8 @@ public void unqualifiedStyleContribution() throws Exception { @Test public void qualifiedStyleContribution() throws Exception { cps = new ConfigurationPointsImpl(new ClasspathResourceResolver(getClass().getClassLoader()) { - @Nullable @Override - public Resource getResource(@NotNull String location) { + public Resource getResource(String location) { String name = ConvertToUnqualifiedStyle.class.getName().replace('.', '/') + ".class"; if (name.equals(location)) { diff --git a/common/util/pom.xml b/common/util/pom.xml index e210a3be0..e183a80c6 100644 --- a/common/util/pom.xml +++ b/common/util/pom.xml @@ -28,9 +28,5 @@ ${project.groupId} citrus-common-servlet - - com.intellij - annotations - diff --git a/common/util/src/main/java/com/alibaba/citrus/util/Assert.java b/common/util/src/main/java/com/alibaba/citrus/util/Assert.java index ee8216b2b..e0fc8ebd8 100644 --- a/common/util/src/main/java/com/alibaba/citrus/util/Assert.java +++ b/common/util/src/main/java/com/alibaba/citrus/util/Assert.java @@ -19,9 +19,6 @@ import static com.alibaba.citrus.util.Assert.ExceptionType.*; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - /** * 断言工具,用来实现Fail-Fast。 @@ -69,20 +66,17 @@ */ public final class Assert { /** 确保对象不为空,否则抛出IllegalArgumentException。 */ - @NotNull - public static T assertNotNull(@Nullable T object) { + public static T assertNotNull(T object) { return assertNotNull(object, null, null, (Object[]) null); } /** 确保对象不为空,否则抛出IllegalArgumentException。 */ - @NotNull - public static T assertNotNull(@Nullable T object, String message, Object... args) { + public static T assertNotNull(T object, String message, Object... args) { return assertNotNull(object, null, message, args); } /** 确保对象不为空,否则抛出指定异常,默认为IllegalArgumentException。 */ - @NotNull - public static T assertNotNull(@Nullable T object, ExceptionType exceptionType, String message, Object... args) { + public static T assertNotNull(T object, ExceptionType exceptionType, String message, Object... args) { if (object == null) { if (exceptionType == null) { exceptionType = ILLEGAL_ARGUMENT; @@ -193,7 +187,7 @@ public static T unsupportedOperation(String message, Object... args) { } /** 取得带参数的消息。 */ - private static String getMessage(@Nullable String message, @Nullable Object[] args, @NotNull String defaultMessage) { + private static String getMessage(String message, Object[] args, String defaultMessage) { if (message == null) { message = defaultMessage; } diff --git a/pom.xml b/pom.xml index 7ece35b88..edaa156b1 100644 --- a/pom.xml +++ b/pom.xml @@ -424,11 +424,13 @@ org.apache.velocity velocity 1.7 + provided org.freemarker freemarker 2.3.19 + provided commons-fileupload @@ -577,11 +579,6 @@ 3.0.1 compile - - com.intellij - annotations - 9.0.4 - diff --git a/service/mail/pom.xml b/service/mail/pom.xml index a9bf31880..37ee07718 100644 --- a/service/mail/pom.xml +++ b/service/mail/pom.xml @@ -42,6 +42,14 @@ citrus-service-freemarker test + + org.apache.velocity + velocity + + + org.freemarker + freemarker + ${project.groupId} citrus-test-util diff --git a/webx/turbine/pom.xml b/webx/turbine/pom.xml index ef7d38df9..f62973b40 100644 --- a/webx/turbine/pom.xml +++ b/webx/turbine/pom.xml @@ -37,6 +37,10 @@ citrus-service-velocity test + + org.apache.velocity + velocity + ${project.groupId} citrus-common-logconfig