Skip to content

Commit

Permalink
* 删除intellij:annotations依赖,因为还不能全面使用这个机制,不如先删除。
Browse files Browse the repository at this point in the history
* 将velocity/freemarker的依赖改成scope=provided。应用程序如果需要的话,必须明确声明依赖它们。
  • Loading branch information
Michael Zhou committed Feb 25, 2013
1 parent 68d9f47 commit 8d6aa95
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 61 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,5 @@
-- Changes in 3.0.11

* 升级到springext-maven-plugin 1.2
* 删除intellij:annotations依赖,因为还不能全面使用这个机制,不如先删除。
* 将velocity/freemarker的依赖改成scope=provided。应用程序如果需要的话,必须明确声明依赖它们。
2 changes: 2 additions & 0 deletions CHANGES_SINCE_3.1.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,5 @@
-- Changes in 3.1.3

* 升级到springext-maven-plugin 1.2
* 删除intellij:annotations依赖,因为还不能全面使用这个机制,不如先删除。
* 将velocity/freemarker的依赖改成scope=provided。应用程序如果需要的话,必须明确声明依赖它们。
2 changes: 2 additions & 0 deletions CHANGES_SINCE_3.2.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@
-- Changes in 3.2.1

* 升级到springext-maven-plugin 1.2
* 删除intellij:annotations依赖,因为还不能全面使用这个机制,不如先删除。
* 将velocity/freemarker的依赖改成scope=provided。应用程序如果需要的话,必须明确声明依赖它们。
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -52,16 +50,14 @@ public abstract class ResourceResolver {
* 取得指定位置的一个资源。
* 如果资源不存在,则返回<code>null</code>。
*/
@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;

/** 从<code>ResourceResolver</code>中读取所有指定名称的资源文件,对每一个key/value调用handler。 */
public final void loadAllProperties(String resourceName, PropertyHandler handler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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()) {
Expand All @@ -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) {
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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<Schema> getSchemas();
}

public static interface ParentOf<C extends TreeItem> {
@NotNull
Map<String, C> getChildrenMap();
}

public static class ConfigurationPointItem extends AbstractNamespaceItem<ContributionItem> {
private final ConfigurationPoint configurationPoint;

public ConfigurationPointItem(@NotNull String namespace, @NotNull Set<Schema> schemas, @NotNull ConfigurationPoint configurationPoint) {
public ConfigurationPointItem(String namespace, Set<Schema> schemas, ConfigurationPoint configurationPoint) {
super(ContributionItem.class, namespace, schemas);
this.configurationPoint = configurationPoint;
}

@NotNull
public ConfigurationPoint getConfigurationPoint() {
return configurationPoint;
}
Expand All @@ -236,12 +230,11 @@ public ConfigurationPoint getConfigurationPoint() {
public static class ContributionItem extends AbstractTreeItem<ConfigurationPointItem> {
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;
}
Expand All @@ -253,7 +246,7 @@ public String toString() {
}

public static class SpringPluggableItem extends AbstractNamespaceItem<TreeItem> {
public SpringPluggableItem(@NotNull String namespace, @NotNull Set<Schema> schemas) {
public SpringPluggableItem(String namespace, Set<Schema> schemas) {
super(TreeItem.class, namespace, schemas);
}
}
Expand All @@ -262,7 +255,7 @@ private static abstract class AbstractTreeItem<C extends TreeItem> implements Tr
protected final Map<String, C> children = createTreeMap();
private final Class<C> childType;

protected AbstractTreeItem(@NotNull Class<C> childType) {
protected AbstractTreeItem(Class<C> childType) {
this.childType = assertNotNull(childType, "child item type");
}

Expand All @@ -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<String, C> getChildrenMap() {
return children;
}

@NotNull
public String dump() {
ToStringBuilder buf = new ToStringBuilder();
dump(buf);
Expand Down Expand Up @@ -311,18 +301,16 @@ private static abstract class AbstractNamespaceItem<C extends TreeItem> extends
private final String namespace;
private final Set<Schema> schemas;

protected AbstractNamespaceItem(@NotNull Class<C> childType, @NotNull String namespace, @NotNull Set<Schema> schemas) {
protected AbstractNamespaceItem(Class<C> childType, String namespace, Set<Schema> schemas) {
super(childType);
this.namespace = namespace;
this.schemas = schemas;
}

@NotNull
public String getNamespace() {
return namespace;
}

@NotNull
public Set<Schema> getSchemas() {
return schemas;
}
Expand Down Expand Up @@ -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; // 防止递归失控
}
Expand All @@ -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
}
Expand Down Expand Up @@ -404,13 +392,13 @@ else if (schema instanceof ConfigurationPointSchemaSourceInfo) {
}
}

private void buildSpringPluggableItem(@NotNull String namespace, @NotNull Set<Schema> schemas) {
private void buildSpringPluggableItem(String namespace, Set<Schema> schemas) {
NamespaceItem item = createSpringPluggableItem(namespace, schemas);
items.put(namespace, item);
independentItems.put(namespace, item);
}

private void buildConfigurationPointItem(@NotNull String namespace, @NotNull Set<Schema> schemas, @NotNull ConfigurationPointSchemaSourceInfo schema) {
private void buildConfigurationPointItem(String namespace, Set<Schema> schemas, ConfigurationPointSchemaSourceInfo schema) {
ConfigurationPoint configurationPoint = (ConfigurationPoint) schema.getParent();
ConfigurationPointItem item = createConfigurationPointItem(namespace, schemas, configurationPoint);
items.put(namespace, item);
Expand Down Expand Up @@ -460,7 +448,7 @@ private void buildContributionItem(String namespace, ConfigurationPointItem item
}

/** Template method */
protected ConfigurationPointItem createConfigurationPointItem(@NotNull String namespace, @NotNull Set<Schema> schemas, @NotNull ConfigurationPoint configurationPoint) {
protected ConfigurationPointItem createConfigurationPointItem(String namespace, Set<Schema> schemas, ConfigurationPoint configurationPoint) {
return new ConfigurationPointItem(namespace, schemas, configurationPoint);
}

Expand All @@ -470,12 +458,12 @@ protected ContributionItem createContributionItem(Contribution contribution) {
}

/** Template method */
protected SpringPluggableItem createSpringPluggableItem(@NotNull String namespace, @NotNull Set<Schema> schemas) {
protected SpringPluggableItem createSpringPluggableItem(String namespace, Set<Schema> schemas) {
return new SpringPluggableItem(namespace, schemas);
}

/** Template method */
protected <C extends TreeItem> void addChildItem(@NotNull ParentOf<C> parent, @NotNull String key, @NotNull C childItem) {
protected <C extends TreeItem> void addChildItem(ParentOf<C> parent, String key, C childItem) {
parent.getChildrenMap().put(key, childItem);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)) {
Expand Down
4 changes: 0 additions & 4 deletions common/util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,5 @@
<groupId>${project.groupId}</groupId>
<artifactId>citrus-common-servlet</artifactId>
</dependency>
<dependency>
<groupId>com.intellij</groupId>
<artifactId>annotations</artifactId>
</dependency>
</dependencies>
</project>
14 changes: 4 additions & 10 deletions common/util/src/main/java/com/alibaba/citrus/util/Assert.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@

import static com.alibaba.citrus.util.Assert.ExceptionType.*;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* 断言工具,用来实现<a
* href="http://martinfowler.com/ieeeSoftware/failFast.pdf">Fail-Fast</a>。
Expand Down Expand Up @@ -69,20 +66,17 @@
*/
public final class Assert {
/** 确保对象不为空,否则抛出<code>IllegalArgumentException</code>。 */
@NotNull
public static <T> T assertNotNull(@Nullable T object) {
public static <T> T assertNotNull(T object) {
return assertNotNull(object, null, null, (Object[]) null);
}

/** 确保对象不为空,否则抛出<code>IllegalArgumentException</code>。 */
@NotNull
public static <T> T assertNotNull(@Nullable T object, String message, Object... args) {
public static <T> T assertNotNull(T object, String message, Object... args) {
return assertNotNull(object, null, message, args);
}

/** 确保对象不为空,否则抛出指定异常,默认为<code>IllegalArgumentException</code>。 */
@NotNull
public static <T> T assertNotNull(@Nullable T object, ExceptionType exceptionType, String message, Object... args) {
public static <T> T assertNotNull(T object, ExceptionType exceptionType, String message, Object... args) {
if (object == null) {
if (exceptionType == null) {
exceptionType = ILLEGAL_ARGUMENT;
Expand Down Expand Up @@ -193,7 +187,7 @@ public static <T> 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;
}
Expand Down
7 changes: 2 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,13 @@
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.19</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
Expand Down Expand Up @@ -577,11 +579,6 @@
<version>3.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.intellij</groupId>
<artifactId>annotations</artifactId>
<version>9.0.4</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
Expand Down
8 changes: 8 additions & 0 deletions service/mail/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@
<artifactId>citrus-service-freemarker</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>citrus-test-util</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions webx/turbine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
<artifactId>citrus-service-velocity</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>citrus-common-logconfig</artifactId>
Expand Down

0 comments on commit 8d6aa95

Please sign in to comment.