http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5be6a7cb/modules/core/src/main/java/org/apache/ignite/Ignition.java ----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5be6a7cb/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlField.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5be6a7cb/modules/core/src/main/java/org/apache/ignite/cache/query/annotations/QuerySqlFunction.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5be6a7cb/modules/core/src/main/java/org/apache/ignite/cache/store/CacheStore.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5be6a7cb/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5be6a7cb/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5be6a7cb/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java index c6f75dd,7beca55..b1dbb43 --- a/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java +++ b/modules/core/src/main/java/org/apache/ignite/transactions/IgniteTx.java @@@ -29,9 -28,9 +28,9 @@@ import java.util.* /** * Grid cache transaction. Cache transactions have a default 2PC (two-phase-commit) behavior and * can be plugged into ongoing {@code JTA} transaction by properly implementing - * {@gglink org.gridgain.grid.cache.jta.GridCacheTmLookup} + * {@ignitelink org.gridgain.grid.cache.jta.GridCacheTmLookup} - * interface. Cache transactions can also be started explicitly directly from {@link GridCacheProjection} API - * via any of the {@code 'GridCacheProjection.txStart(..)'} methods. + * interface. Cache transactions can also be started explicitly directly from {@link org.apache.ignite.cache.CacheProjection} API + * via any of the {@code 'CacheProjection.txStart(..)'} methods. * <p> * Cache transactions support the following isolation levels: * <ul> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5be6a7cb/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCacheManager.java ---------------------------------------------------------------------- diff --cc modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCacheManager.java index 0000000,a143f13..d6433d3 mode 000000,100644..100644 --- a/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCacheManager.java +++ b/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCacheManager.java @@@ -1,0 -1,241 +1,241 @@@ + /* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package org.apache.ignite.cache.spring; + + import org.apache.ignite.*; + import org.apache.ignite.cache.GridCache; + import org.apache.ignite.configuration.*; + import org.apache.ignite.lang.*; + import org.apache.ignite.internal.util.typedef.*; + import org.springframework.beans.factory.*; + import org.springframework.cache.*; + + import java.util.*; + + /** + * Implementation of Spring cache abstraction based on GridGain cache. + * <h1 class="header">Overview</h1> + * Spring cache abstraction allows to enable caching for Java methods + * so that the result of a method execution is stored in some storage. If + * later the same method is called with the same set of parameters, + * the result will be retrieved from that storage instead of actually + * executing the method. For more information, refer to + * <a href="http://docs.spring.io/spring/docs/current/spring-framework-reference/html/cache.html"> + * Spring Cache Abstraction documentation</a>. + * <h1 class="header">How To Enable Caching</h1> + * To enable caching based on GridGain cache in your Spring application, + * you will need to do the following: + * <ul> + * <li> + * Start a GridGain node with configured cache in the same JVM + * where you application is running. + * </li> + * <li> + * Configure {@code GridSpringCacheManager} as a cache provider + * in Spring application context. + * </li> + * </ul> + * {@code GridSpringCacheManager} can start a node itself on its startup + * based on provided GridGain configuration. You can provide path to a + * Spring configuration XML file, like below (path can be absolute or + * relative to {@code GRIDGAIN_HOME}): + * <pre name="code" class="xml"> + * <beans xmlns="http://www.springframework.org/schema/beans" + * xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + * xmlns:cache="http://www.springframework.org/schema/cache" + * xsi:schemaLocation=" + * http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + * http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd"> + * <-- Provide configuration file path. --> + * <bean id="cacheManager" class="org.apache.ignite.cache.spring.GridSpringCacheManager"> + * <property name="configurationPath" value="examples/config/spring-cache.xml"/> + * </bean> + * + * <-- Use annotation-driven caching configuration. --> + * <cache:annotation-driven/> + * </beans> + * </pre> + * Or you can provide a {@link IgniteConfiguration} bean, like below: + * <pre name="code" class="xml"> + * <beans xmlns="http://www.springframework.org/schema/beans" + * xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + * xmlns:cache="http://www.springframework.org/schema/cache" + * xsi:schemaLocation=" + * http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + * http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd"> + * <-- Provide configuration bean. --> + * <bean id="cacheManager" class="org.apache.ignite.cache.spring.GridSpringCacheManager"> + * <property name="configuration"> + * <bean id="gridCfg" class="org.gridgain.grid.GridConfiguration"> + * ... + * </bean> + * </property> + * </bean> + * + * <-- Use annotation-driven caching configuration. --> + * <cache:annotation-driven/> + * </beans> + * </pre> + * Note that providing both configuration path and configuration bean is illegal + * and results in {@link IllegalArgumentException}. + * <p> + * If you already have GridGain node running within your application, + * simply provide correct Grid name, like below (if there is no Grid + * instance with such name, exception will be thrown): + * <pre name="code" class="xml"> + * <beans xmlns="http://www.springframework.org/schema/beans" + * xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + * xmlns:cache="http://www.springframework.org/schema/cache" + * xsi:schemaLocation=" + * http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + * http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd"> + * <-- Provide Grid name. --> + * <bean id="cacheManager" class="org.apache.ignite.cache.spring.GridSpringCacheManager"> + * <property name="gridName" value="myGrid"/> + * </bean> + * + * <-- Use annotation-driven caching configuration. --> + * <cache:annotation-driven/> + * </beans> + * </pre> + * This can be used, for example, when you are running your application - * in a J2EE Web container and use {@gglink org.gridgain.grid.startup.servlet.GridServletContextListenerStartup} ++ * in a J2EE Web container and use {@ignitelink org.gridgain.grid.startup.servlet.GridServletContextListenerStartup} + * for node startup. + * <p> + * If neither {@link #setConfigurationPath(String) configurationPath}, + * {@link #setConfiguration(IgniteConfiguration) configuration}, nor + * {@link #setGridName(String) gridName} are provided, cache manager + * will try to use default Grid instance (the one with the {@code null} + * name). If it doesn't exist, exception will be thrown. + * <h1>Starting Remote Nodes</h1> + * Remember that the node started inside your application is an entry point + * to the whole topology it connects to. You can start as many remote standalone + * nodes as you need using {@code bin/ggstart.{sh|bat}} scripts provided in + * GridGain distribution, and all these nodes will participate + * in caching data. + */ + public class SpringCacheManager implements CacheManager, InitializingBean { + /** Grid configuration file path. */ + private String cfgPath; + + /** Ignite configuration. */ + private IgniteConfiguration cfg; + + /** Grid name. */ + private String gridName; + + /** Ignite instance. */ + protected Ignite grid; + + /** + * Gets configuration file path. + * + * @return Grid configuration file path. + */ + public String getConfigurationPath() { + return cfgPath; + } + + /** + * Sets configuration file path. + * + * @param cfgPath Grid configuration file path. + */ + public void setConfigurationPath(String cfgPath) { + this.cfgPath = cfgPath; + } + + /** + * Gets configuration bean. + * + * @return Grid configuration bean. + */ + public IgniteConfiguration getConfiguration() { + return cfg; + } + + /** + * Sets configuration bean. + * + * @param cfg Grid configuration bean. + */ + public void setConfiguration(IgniteConfiguration cfg) { + this.cfg = cfg; + } + + /** + * Gets grid name. + * + * @return Grid name. + */ + public String getGridName() { + return gridName; + } + + /** + * Sets grid name. + * + * @param gridName Grid name. + */ + public void setGridName(String gridName) { + this.gridName = gridName; + } + + /** {@inheritDoc} */ + @SuppressWarnings("IfMayBeConditional") + @Override public void afterPropertiesSet() throws Exception { + assert grid == null; + + if (cfgPath != null && cfg != null) { + throw new IllegalArgumentException("Both 'configurationPath' and 'configuration' are " + + "provided. Set only one of these properties if you need to start a GridGain node inside of " + + "GridSpringCacheManager. If you already have a node running, omit both of them and set" + + "'gridName' property."); + } + + if (cfgPath != null) + grid = Ignition.start(cfgPath); + else if (cfg != null) + grid = Ignition.start(cfg); + else + grid = Ignition.ignite(gridName); + } + + /** {@inheritDoc} */ + @Override public org.springframework.cache.Cache getCache(String name) { + assert grid != null; + + try { + return new SpringCache(name, grid, grid.cache(name), null); + } + catch (IllegalArgumentException ignored) { + return null; + } + } + + /** {@inheritDoc} */ + @Override public Collection<String> getCacheNames() { + assert grid != null; + + return F.viewReadOnly(grid.caches(), new IgniteClosure<GridCache<?,?>, String>() { + @Override public String apply(GridCache<?, ?> c) { + return c.name(); + } + }); + } + } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5be6a7cb/modules/tools/src/main/java/org/apache/ignite/tools/javadoc/GridLinkTaglet.java ---------------------------------------------------------------------- diff --cc modules/tools/src/main/java/org/apache/ignite/tools/javadoc/GridLinkTaglet.java index 0000000,66c2db2..e890abe mode 000000,100644..100644 --- a/modules/tools/src/main/java/org/apache/ignite/tools/javadoc/GridLinkTaglet.java +++ b/modules/tools/src/main/java/org/apache/ignite/tools/javadoc/GridLinkTaglet.java @@@ -1,0 -1,165 +1,165 @@@ + /* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package org.apache.ignite.tools.javadoc; + + import com.sun.tools.doclets.*; + import com.sun.javadoc.*; + + import java.io.*; + import java.util.*; + + /** - * Represents {@gglink ...} tag. This tag can ++ * Represents {@ignitelink ...} tag. This tag can + * be used as replacement of {@link ...} tag that references to the GridGain class that is not in classpath. + * Class and its arguments should have fully qualified names. + */ + public class GridLinkTaglet implements Taglet { + /** */ - private static final String NAME = "gglink"; ++ private static final String NAME = "ignitelink"; + + /** + * Return the name of this custom tag. + */ + public String getName() { + return NAME; + } + + /** + * @return true since this tag can be used in a field doc comment. + */ + public boolean inField() { + return true; + } + + /** + * @return true since this tag can be used in a constructor doc comment. + */ + public boolean inConstructor() { + return true; + } + + /** + * @return true since this tag can be used in a method doc comment. + */ + public boolean inMethod() { + return true; + } + + /** + * @return true since this tag can be used in an overview doc comment. + */ + public boolean inOverview() { + return true; + } + + /** + * @return true since this tag can be used in a package doc comment. + */ + public boolean inPackage() { + return true; + } + + /** + * @return true since this. + */ + public boolean inType() { + return true; + } + + /** + * Will return true since this is an inline tag. + * + * @return true since this is an inline tag. + */ + public boolean isInlineTag() { + return true; + } + + /** + * Register this Taglet. + * + * @param tagletMap the map to register this tag to. + */ + public static void register(Map<String, GridLinkTaglet> tagletMap) { + GridLinkTaglet tag = new GridLinkTaglet(); + + Taglet t = tagletMap.get(tag.getName()); + + if (t != null) + tagletMap.remove(tag.getName()); + + tagletMap.put(tag.getName(), tag); + } + + /** + * Given the <code>Tag</code> representation of this custom tag, return its string representation. + * <p> + * Input: org.gridgain.grid.spi.indexing.h2.GridH2IndexingSpi#setIndexCustomFunctionClasses(Class[]) + * <p> + * Output: <a href="../../../../../org/gridgain/grid/spi/indexing/h2/GridH2IndexingSpi.html# + * setIndexCustomFunctionClasses(java.lang.Class...)"> + * <code>GridH2IndexingSpi.setIndexCustomFunctionClasses(java.lang.Class[])</code></a> + * + * @param tag <code>Tag</code> representation of this custom tag. + */ + public String toString(Tag tag) { + if (tag.text() == null || tag.text().isEmpty()) + return ""; + + File f = tag.position().file(); + + String curClass = f == null ? "" : f.getAbsolutePath().replace(File.separator, "."); + + String packPref = "src.main.java."; + + int idx = curClass.indexOf(packPref); + + StringBuilder path = new StringBuilder(); + + if (idx != -1) { + curClass = curClass.substring(idx + packPref.length()); + + for (int i = 0, n = curClass.split("\\.").length - 2; i < n; i++) + path.append("../"); + } + + String[] tokens = tag.text().split("#"); + + int lastIdx = tokens[0].lastIndexOf('.'); + + String simpleClsName = lastIdx != -1 && lastIdx + 1 < tokens[0].length() ? + tokens[0].substring(lastIdx + 1) : tokens[0]; + + String fullyQClsName = tokens[0].replace(".", "/"); + + return "<a href=\"" + path.toString() + fullyQClsName + ".html" + + (tokens.length > 1 ? ("#" + tokens[1].replace("[]", "...")) : "") + + "\"><code>" + simpleClsName + (tokens.length > 1 ? ("." + tokens[1]) : "") + "</code></a>"; + } + + /** + * This method should not be called since arrays of inline tags do not + * exist. Method {@link #toString(Tag)} should be used to convert this + * inline tag to a string. + * + * @param tags the array of <code>Tag</code>s representing of this custom tag. + */ + public String toString(Tag[] tags) { + return null; + } + }