Skip to content

Commit

Permalink
You forget files in your check in
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardcapriolo committed Dec 28, 2012
1 parent fe65d23 commit 7f2931f
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
56 changes: 56 additions & 0 deletions src/main/java/org/usergrid/vx/experimental/IntraMetaData.java
@@ -0,0 +1,56 @@
package org.usergrid.vx.experimental;

public class IntraMetaData {
public String keyspace;
public String columnfamily;
public String type;

public IntraMetaData(){

}

public IntraMetaData(String ks,String cf,String ty){
keyspace=ks;
columnfamily = cf;
type= ty;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((columnfamily == null) ? 0 : columnfamily.hashCode());
result = prime * result + ((keyspace == null) ? 0 : keyspace.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
IntraMetaData other = (IntraMetaData) obj;
if (columnfamily == null) {
if (other.columnfamily != null)
return false;
} else if (!columnfamily.equals(other.columnfamily))
return false;
if (keyspace == null) {
if (other.keyspace != null)
return false;
} else if (!keyspace.equals(other.keyspace))
return false;
if (type == null) {
if (other.type != null)
return false;
} else if (!type.equals(other.type))
return false;
return true;
}


}
23 changes: 23 additions & 0 deletions src/main/java/org/usergrid/vx/experimental/TypeHelper.java
@@ -0,0 +1,23 @@
package org.usergrid.vx.experimental;

import java.nio.ByteBuffer;
import java.nio.charset.CharacterCodingException;

import org.apache.cassandra.utils.ByteBufferUtil;

public class TypeHelper {
public static Object getTypedIfPossible(IntraState state, String type, ByteBuffer bb){
IntraMetaData imd = new IntraMetaData(state.currentKeyspace,state.currentColumnFamily,type);
String s = state.meta.get(imd);

if (s == null){
return bb;
} else if (s.equals("UTF-8")){
try {
return ByteBufferUtil.string(bb);
} catch (Exception ex){ throw new RuntimeException(ex); }
} else {
throw new RuntimeException("Do not know what to do");
}
}
}

0 comments on commit 7f2931f

Please sign in to comment.