Skip to content

Commit

Permalink
# IGNITE-692 Implemented support for GG and Ignite.
Browse files Browse the repository at this point in the history
  • Loading branch information
akuznetsov-gridgain committed Apr 10, 2015
1 parent aa8f668 commit 97a83a0
Show file tree
Hide file tree
Showing 15 changed files with 393 additions and 294 deletions.
Expand Up @@ -34,7 +34,7 @@ public interface GridQueryFieldMetadata extends Externalizable {
/**
* Gets name of type to which this field belongs.
*
* @return Gets type name.
* @return Type name.
*/
public String typeName();

Expand Down
Expand Up @@ -146,7 +146,7 @@ public VisorCacheConfiguration from(IgniteEx ignite, CacheConfiguration ccfg) {
writerFactory = compactClass(ccfg.getCacheWriterFactory());
expiryPlcFactory = compactClass(ccfg.getExpiryPolicyFactory());
sys = ignite.context().cache().systemCache(ccfg.getName());

affinityCfg = VisorCacheAffinityConfiguration.from(ccfg);
rebalanceCfg = VisorCacheRebalanceConfiguration.from(ccfg);
evictCfg = VisorCacheEvictionConfiguration.from(ccfg);
Expand Down
Expand Up @@ -245,7 +245,7 @@ public String name() {
}

/**
* @return Cache mode.
* @return Cache mode.
*/
public CacheMode mode() {
return mode;
Expand Down
@@ -0,0 +1,69 @@
/*
* 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.internal.visor.query;

import java.io.*;

/**
* Arguments for {@link VisorQueryTask}.
*/
public class VisorQueryArg implements Serializable {
/** */
private static final long serialVersionUID = 0L;

/** Cache name for query. */
private final String cacheName;

/** Query text. */
private final String qryTxt;

/** Result batch size. */
private final Integer pageSize;

/**
* @param cacheName Cache name for query.
* @param qryTxt Query text.
* @param pageSize Result batch size.
*/
public VisorQueryArg(String cacheName, String qryTxt, Integer pageSize) {
this.cacheName = cacheName;
this.qryTxt = qryTxt;
this.pageSize = pageSize;
}

/**
* @return Cache name.
*/
public String cacheName() {
return cacheName;
}

/**
* @return Query txt.
*/
public String queryTxt() {
return qryTxt;
}

/**
* @return Page size.
*/
public Integer pageSize() {
return pageSize;
}
}
Expand Up @@ -86,7 +86,7 @@ protected VisorQueryCleanupJob(Collection<String> arg, boolean debug) {

/** {@inheritDoc} */
@Override protected Void run(Collection<String> qryIds) {
ConcurrentMap<String, VisorQueryTask.VisorQueryCursorHolder> locMap = ignite.cluster().nodeLocalMap();
ConcurrentMap<String, VisorQueryCursorHolder> locMap = ignite.cluster().nodeLocalMap();

for (String qryId : qryIds)
locMap.remove(qryId);
Expand Down
@@ -0,0 +1,64 @@
/*
* 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.internal.visor.query;

import java.io.*;

/**
* ResultSet future holder.
*/
public class VisorQueryCursorHolder<T> implements Serializable {
/** */
private static final long serialVersionUID = 0L;

/** Query cursor. */
private final VisorQueryCursor<T> cur;

/** Flag indicating that this future was read from last check. */
private volatile boolean accessed;

/**
* @param cur Future.
* @param accessed {@code true} if query was accessed before remove timeout expired.
*/
public VisorQueryCursorHolder(VisorQueryCursor<T> cur, boolean accessed) {
this.cur = cur;
this.accessed = accessed;
}

/**
* @return Query cursor.
*/
public VisorQueryCursor<T> cursor() {
return cur;
}

/**
* @return Flag indicating that this future was read from last check..
*/
public boolean accessed() {
return accessed;
}

/**
* @param accessed New accessed.
*/
public void accessed(boolean accessed) {
this.accessed = accessed;
}
}
Expand Up @@ -17,6 +17,7 @@

package org.apache.ignite.internal.visor.query;

import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;

import java.io.*;
Expand All @@ -28,35 +29,74 @@ public class VisorQueryField implements Serializable {
/** */
private static final long serialVersionUID = 0L;

/** Column type. */
private final String type;
/** Schema name. */
private String schemaName;

/** Type name. */
private String typeName;

/** Field name. */
private final String field;
private String fieldName;

/** Field type name. */
private String fieldTypeName;

/**
* Create data transfer object with given parameters.
*
* @param type Column type.
* @param field Field name.
* @param schemaName Schema name.
* @param typeName Type name.
* @param fieldName Name.
* @param fieldTypeName Type.
*/
public VisorQueryField(String schemaName, String typeName, String fieldName, String fieldTypeName) {
this.schemaName = schemaName;
this.typeName = typeName;
this.fieldName = fieldName;
this.fieldTypeName = fieldTypeName;
}

/**
* @return Schema name.
*/
public VisorQueryField(String type, String field) {
this.type = type;
this.field = field;
public String schemaName() {
return schemaName;
}

/**
* @return Column type.
* @return Type name.
*/
public String type() {
return type;
public String typeName() {
return typeName;
}

/**
* @return Field name.
*/
public String field() {
return field;
public String fieldName() {
return fieldName;
}

/**
* @return Field type name.
*/
public String fieldTypeName() {
return fieldTypeName;
}

/**
* @param schema If {@code true} then add schema name to full name.
* @return Fully qualified field name with type name and schema name.
*/
public String fullName(boolean schema) {
if (!F.isEmpty(typeName)) {
if (schema && !F.isEmpty(schemaName))
return schemaName + "." + typeName + "." + fieldName;

return typeName + "." + fieldName;
}

return fieldName;
}

/** {@inheritDoc} */
Expand Down

0 comments on commit 97a83a0

Please sign in to comment.