• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java FsNode类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.springfield.fs.FsNode的典型用法代码示例。如果您正苦于以下问题:Java FsNode类的具体用法?Java FsNode怎么用?Java FsNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

FsNode类属于org.springfield.fs包,在下文中一共展示了FsNode类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: startProxies

点赞 3

import org.springfield.fs.FsNode; //导入依赖的package包/类
private static void startProxies(String name) {
	// lets talk to smithers 
	ServiceInterface smithers = ServiceManager.getService("smithers");
	if (smithers!=null) {
		HashMap<String, ServiceInterface> plist = new HashMap<String, ServiceInterface>();
		FSList fslist = FSListManager.get("/domain/internal/service/"+name+"/nodes",0,false);
		for(Iterator<FsNode> iter = fslist.getNodes().iterator(); iter.hasNext(); ) {
			FsNode n = (FsNode)iter.next();
			if (n.getName().equals("nodes")) { // lets make sure its a node 
				String ipnumber = n.getId();
				String port = "8081";
				String nodePort = n.getProperty("port");
				if(nodePort!=null) port = nodePort;
				ServiceInterface newproxy = new ServiceProxy(name, ipnumber, port); // need to store port
				plist.put(ipnumber,newproxy);
			}
		}
		proxies.put(name, plist);
	}
}
 

开发者ID:Noterik,
项目名称:mojo,
代码行数:21,
代码来源:ServiceManager.java

示例2: setTicket

点赞 3

import org.springfield.fs.FsNode; //导入依赖的package包/类
private String setTicket(String domain,String account,String goal) {
	FsNode ticketnode = new FsNode("ticket","1");
	Date now =  new Date();
	ticketnode.setProperty("goal", "signup");
	ticketnode.setProperty("creationDate",""+(now.getTime()/1000));
	ticketnode.setProperty("expirationDate",""+(now.getTime()/1000)+3600);
	ticketnode.setProperty("random","$shadow");
	
       SecureRandom random = new SecureRandom();
       byte[] tpw = new byte[24];
       random.nextBytes(tpw);        
       String ticketpassword  = toHex(tpw);
	Fs.insertNode(ticketnode,"/domain/"+domain+"/user/"+account+"/account/default");
	try {
		ShadowFiles.setProperty("/domain/"+domain+"/user/"+account+"/account/default/ticket/1","random",PasswordHash.createHash(ticketpassword));	
	} catch(Exception e) {}

	return ticketpassword;
}
 

开发者ID:Noterik,
项目名称:barney,
代码行数:20,
代码来源:ServiceHandler.java

示例3: tryConfirmAccount

点赞 3

import org.springfield.fs.FsNode; //导入依赖的package包/类
private String tryConfirmAccount(String domain,String account,String ticket) {
	System.out.println("CONFIRM CHECK "+domain+" "+account+" *"+ticket+"*");
	FsNode ticketnode = Fs.getNode("/domain/"+domain+"/user/"+account+"/account/default/ticket/1");
	if (ticketnode!=null) {
		String goal = ticketnode.getProperty("goal");
		String random = ticketnode.getProperty("random");
		if (random.equals("$shadow")) {
			String sticket = ShadowFiles.getProperty("/domain/"+domain+"/user/"+account+"/account/default/ticket/1","random");	
			System.out.println("Shadow ticket="+sticket);
			try {
				if (PasswordHash.validatePassword(ticket, sticket)) {
					// ok we not confirm the account
					String path = "/domain/"+domain+"/user/"+account+"/account/default";
					Fs.setProperty(path,"state","active");
						return "true";
				}
			} catch(Exception e) {}
		}
	}
	return "false";
}
 

开发者ID:Noterik,
项目名称:barney,
代码行数:22,
代码来源:ServiceHandler.java

示例4: handleLog

点赞 3

import org.springfield.fs.FsNode; //导入依赖的package包/类
private void handleLog(Screen s,String msg,String level) {
FsNode n = new FsNode("log");

SimpleDateFormat f = new SimpleDateFormat("HH:mm:ss");
n.setId(f.format(new Date()));

n.setProperty("level", level);
n.setProperty("source", "maf");
n.setProperty("msg", msg);
if (s!=null) {
	n.setProperty("screen", s.getShortId());
	if (s.getUserName()!=null) {
		n.setProperty("user", s.getUserName());
	} else {
		n.setProperty("user","unknown");
	}
} else {
	n.setProperty("screen", "application");
	n.setProperty("user", "unknown");
}
ApplicationManager.log(app,n);
  }
 

开发者ID:Noterik,
项目名称:lou,
代码行数:23,
代码来源:ActionList.java

示例5: addOption

点赞 2

import org.springfield.fs.FsNode; //导入依赖的package包/类
public void addOption(String name,String value,String checked) {
	FsNode node = new FsNode("option",name);
	node.setProperty("value", value);
	if (name.equals(checked)) {
		node.setProperty("checked","checked");
	} else {
		node.setProperty("checked","");
	}
	this.addNode(node);
}
 

开发者ID:Noterik,
项目名称:mojo,
代码行数:11,
代码来源:FSRadioList.java

示例6: GAINObjectEntity

点赞 2

import org.springfield.fs.FsNode; //导入依赖的package包/类
public GAINObjectEntity(FsNode item) {
	this.source = item.getProperty("source") == null ? "" : item.getProperty("source");
	this.lod = item.getProperty("locator") == null ? "" : item.getProperty("locator");
	this.type = item.getProperty("dbpediatype") == null ? "" : item.getProperty("dbpediatype"); 
	this.label = item.getProperty("title") == null ? "" : item.getProperty("title"); 
	this.typeLabel = item.getProperty("type") == null ? "" : item.getProperty("type");
	this.entityType = ""; //should be either named or common entity, but optional, so left empty
	//confidence and relevance currently not yet available
	this.confidence = 1;
	this.relevance = 1;
}
 

开发者ID:Noterik,
项目名称:mojo,
代码行数:12,
代码来源:GAINObjectEntity.java

示例7: checkActions

点赞 2

import org.springfield.fs.FsNode; //导入依赖的package包/类
private static boolean checkActions(String asker,String type,String duri,int depth,String actions) {
	if (duri.endsWith("/")) duri = duri.substring(0,duri.length()-1); // remove last '/' if attached

	FsNode node = null;
	if (Fs.isMainNode(duri)) {
		int pos = duri.lastIndexOf("/");
		if (pos!=-1) {
			duri = duri.substring(0,pos);
		}
		node = Fs.getNode(duri);
	} else {
		node = Fs.getNode(duri);
	}
	
	if (node==null) return false;
	
	
	// check if it has the actions we need to check, travel up if needed
	ArrayList<String> allowedactions = node.allowedActions(asker,type);
	
	String[] wantedactions = actions.split(":");
	for (int i=0;i<wantedactions.length;i++) {
		if (!allowedactions.contains(wantedactions[i])) {
			return false;
		}
	}
	return true;
}
 

开发者ID:Noterik,
项目名称:barney,
代码行数:29,
代码来源:AllowedDomainChecker.java

示例8: userExists

点赞 2

import org.springfield.fs.FsNode; //导入依赖的package包/类
private String userExists(String domain,String account) {
	FsNode accountnode = Fs.getNode("/domain/"+domain+"/user/"+account+"/account/default");
	if (accountnode!=null) {
		return "true";
	}
	return "false";
}
 

开发者ID:Noterik,
项目名称:barney,
代码行数:8,
代码来源:ServiceHandler.java

示例9: deleteTicket

点赞 2

import org.springfield.fs.FsNode; //导入依赖的package包/类
private String deleteTicket(String domain,String account) {
	FsNode ticketnode = new FsNode("ticket","1");
	Date now =  new Date();
	ticketnode.setProperty("goal", "");
	ticketnode.setProperty("creationDate","");
	ticketnode.setProperty("expirationDate","");
	ticketnode.setProperty("random","$shadow");
	
	Fs.insertNode(ticketnode,"/domain/"+domain+"/user/"+account+"/account/default");
	try {
		ShadowFiles.setProperty("/domain/"+domain+"/user/"+account+"/account/default/ticket/1","random","");	
	} catch(Exception e) {}
	return "true";
}
 

开发者ID:Noterik,
项目名称:barney,
代码行数:15,
代码来源:ServiceHandler.java

示例10: createAccount

点赞 2

import org.springfield.fs.FsNode; //导入依赖的package包/类
private String createAccount(String domain,String account,String email,String password) {
	System.out.println("Create account");
	// create the needed nodes 
	

	FsNode usernode = new FsNode("user",account);
	Fs.insertNode(usernode,"/domain/"+domain);
	
	// the account node (account/default)
	FsNode accountnode = new FsNode("account","default");
	accountnode.setProperty("firstname", "unknown");
	accountnode.setProperty("lastname", "unknown");
	accountnode.setProperty("password", "$shadow");
	accountnode.setProperty("phoneNum", "unknown");
	accountnode.setProperty("email", email);
	accountnode.setProperty("state", "waitforconfirm");
	Fs.insertNode(accountnode,"/domain/"+domain+"/user/"+account);
	
	// set the password in the shadowfile
	setPassword(domain,account,password);
	
	// the ticket node (ticket/1)
	FsNode ticketnode = new FsNode("ticket","1");
	Date now =  new Date();
	ticketnode.setProperty("goal", "signup");
	ticketnode.setProperty("creationDate",""+(now.getTime()/1000));
	ticketnode.setProperty("expirationDate",""+(now.getTime()/1000)+3600);
	ticketnode.setProperty("random","$shadow");
	
       SecureRandom random = new SecureRandom();
       byte[] tpw = new byte[24];
       random.nextBytes(tpw);        
       String ticketpassword  = toHex(tpw);
	Fs.insertNode(ticketnode,"/domain/"+domain+"/user/"+account+"/account/default");
	try {
		ShadowFiles.setProperty("/domain/"+domain+"/user/"+account+"/account/default/ticket/1","random",PasswordHash.createHash(ticketpassword));	
	} catch(Exception e) {}
	
	return ticketpassword;
}
 

开发者ID:Noterik,
项目名称:barney,
代码行数:41,
代码来源:ServiceHandler.java

示例11: checkLogin

点赞 2

import org.springfield.fs.FsNode; //导入依赖的package包/类
public static String checkLogin(String domain,String account,String password) {
	// test for salted hashes
	/*
	if (domain.equals("linkedtv") && account.equals("admin") && password.equals("tmppas")) {
		return "0";
	}
	*/
	
	try {
							 
		FsNode accountnode = Fs.getNode("/domain/"+domain+"/user/"+account+"/account/default");
		if (accountnode!=null) {
			String state = accountnode.getProperty("state");
			if (state!=null && !state.equals("active")) {
				return "-1";
			}
			String spass = accountnode.getProperty("password");
			if (spass.equals("$shadow")) {
				String s = ShadowFiles.getProperty("/domain/"+domain+"/user/"+account+"/account/default","password");	
				if (s!=null) spass = s;
			}
			if (PasswordHash.validatePassword(password, spass)) {
				return "0"; // what should we return, we don't want to leak the ticketpassword hash right ?
			} else {
				return "-1";
			}
		}
		return "-1";
	} catch (Exception e) {
		e.printStackTrace();
		return "-1";		
	}
}
 

开发者ID:Noterik,
项目名称:barney,
代码行数:34,
代码来源:ServiceHandler.java

示例12: getNode

点赞 2

import org.springfield.fs.FsNode; //导入依赖的package包/类
/**
 * 
 * adds application id, checks with barney and talks to mojo if allowed
 * 
 * @param path
 * @return
 */
public final FsNode getNode(String path) {
	String asker = this.getUserName(); // gets the use name
	if (asker!=null && !asker.equals("")) {
		System.out.println("screen getNode "+asker);
		ServiceInterface barney = ServiceManager.getService("barney");
		if (barney!=null) {
			String allowed = barney.get("userallowed(read,"+path+",0,"+asker+")",null,null);
			if (allowed!=null && allowed.equals("true")) {
				return Fs.getNode(path); // so its allowed ask it
			}
		}
	}
	return null;
}
 

开发者ID:Noterik,
项目名称:lou,
代码行数:22,
代码来源:Screen.java

示例13: getAnnotations

点赞 2

import org.springfield.fs.FsNode; //导入依赖的package包/类
public FSList getAnnotations() {
	// try reading it from disk
	String readpath  = "/springfield/lisa/data/linkedtv/"+mediaResourceId+"/annotations.xml";
	System.out.println("READPATH="+readpath);
	String body  = readFile(readpath);
	if (body==null) {
		Response response = HttpHelper.sendRequest("GET", MAGGIE+"&id="+mediaResourceId+"&annotations&curated&renew");
		if (response.getStatusCode() != 200) {
			System.out.println("What? "+response.getStatusCode());
			return new FSList();
		} else {
			body = response.toString();	
		}
	} else {
		System.out.println("READING FROM LISA DISK CACHE "+readpath);
	}
	//Response response = HttpHelper.sendRequest("GET", MAGGIE+"&id="+mediaResourceId+"&annotations&curated&renew");
	this.annotations = new FSList();
	
		try {
			Document doc = DocumentHelper.parseText(body);
			List<Node> nodes = doc.selectNodes("//annotations/*");
			String presentationUri = doc.selectSingleNode("properties/presentation") == null ? "" : doc.selectSingleNode("properties/presentation").getText();
			presentationUri += "annotations";
			
			FSList annotations = new FSList(presentationUri);
			
			for (Node annotation : nodes) {
				Element a = (Element) annotation;
				FsNode result = new FsNode("unknown","unknown");
				
				result.setName(a.getName());
				result.setId(a.attribute("id").getText());
				result.setPath(presentationId+"/"+result.getName()+"/"+result.getId());
				result.setImageBaseUri(stillsUri);
				
				List<Node> properties = a.selectNodes("properties/*");
				for (Node property : properties) {
					//System.out.println("DANIEL2: "+property.getName()+"="+property.getText());
					result.setProperty(property.getName(), property.getText());
					if (property.getName().equals("locator")) {
						loadEntityFromProxy(property.getName(),property.getText());
					}
				}
				annotations.addNode(result);
			}
			this.annotations = annotations;
			return annotations;
			
		} catch (DocumentException e) {
			System.out.println("What? "+e.getMessage());
			return new FSList();
		}
}
 

开发者ID:Noterik,
项目名称:mojo,
代码行数:55,
代码来源:Episode.java

示例14: getChapters

点赞 2

import org.springfield.fs.FsNode; //导入依赖的package包/类
public FSList getChapters() {
	// try reading it from disk
	String readpath  = "/springfield/lisa/data/linkedtv/"+mediaResourceId+"/chapters.xml";
	System.out.println("READPATH="+readpath);
	String body  = readFile(readpath);
	if (body==null) {
		Response response = HttpHelper.sendRequest("GET", MAGGIE+"&id="+mediaResourceId+"&chapters");
		if (response.getStatusCode() != 200) {
			System.out.println("Statuscode = "+response.getStatusCode());
			return new FSList();
		} else {
			body = response.toString();
		}
	//System.out.println("CHAPTERS="+response.toString());
	} else {
		System.out.println("READING FROM LISA DISK CACHE "+readpath);
	}
	this.chapters = new FSList();
	
		try {
			Document doc = DocumentHelper.parseText(body);
			List<Node> nodes = doc.selectNodes("//chapter");
			String presentationUri = doc.selectSingleNode("properties/presentation") == null ? "" : doc.selectSingleNode("properties/presentation").getText();
			presentationUri += "chapters";
			
			FSList chapters = new FSList(presentationUri);
			
			for (Node chapter : nodes) {
				Element c = (Element)chapter;					
				FsNode result = new FsNode("unknown","unknown");
				
				result.setName(c.getName());
				result.setId(c.attribute("id").getText());
				result.setPath(presentationId+"/"+result.getName()+"/"+result.getId());
				result.setImageBaseUri(stillsUri);
				
				List<Node> properties = c.selectNodes("properties/*");
				for (Node property : properties) {
					//System.out.println("DANIEL: "+property.getName()+"="+property.getText());
					result.setProperty(property.getName(), property.getText());
				}					
				chapters.addNode(result);
			}
			this.chapters = chapters;
			return chapters;
			
		} catch (DocumentException e) {
			System.out.println("What? "+e.getMessage());
			return new FSList();
		}		
}
 

开发者ID:Noterik,
项目名称:mojo,
代码行数:52,
代码来源:Episode.java

示例15: getEntityFromProxy

点赞 2

import org.springfield.fs.FsNode; //导入依赖的package包/类
public FsNode getEntityFromProxy(String name) {
	name = StringEscapeUtils.unescapeHtml(name);
	return proxyenrichments.get(name);
}
 

开发者ID:Noterik,
项目名称:mojo,
代码行数:5,
代码来源:Episode.java

示例16: checkNodeActions

点赞 2

import org.springfield.fs.FsNode; //导入依赖的package包/类
public boolean checkNodeActions(FsNode node,String actions) {
	return checkNodeActions(node,0,actions);
}
 

开发者ID:Noterik,
项目名称:lou,
代码行数:4,
代码来源:Screen.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)