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

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

java 1次浏览

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

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

示例1: onParseProperty

点赞 3

import net.jxta.peergroup.PeerGroupID; //导入依赖的package包/类
@Override
protected void onParseProperty( ManagedProperty<IJp2pProperties, Object> property) {
	if(( !ManagedProperty.isCreated(property)) || ( !NetworkManagerProperties.isValidProperty(property.getKey())))
		return;
	NetworkManagerProperties id = (NetworkManagerProperties) property.getKey();
	switch( id ){
	case PEER_ID:
		String name = AbstractJp2pPropertySource.getIdentifier( super.getPropertySource() );
		PeerID peerid = IDFactory.newPeerID( PeerGroupID.defaultNetPeerGroupID, name.getBytes() );
		property.setValue( peerid, PropertyEvents.DEFAULT_VALUE_SET );
		property.reset();
		break;
	default:
		break;
	}
	super.onParseProperty(property);
}
 

开发者ID:chaupal,
项目名称:jp2p,
代码行数:18,
代码来源:NetworkManagerFactory.java

示例2: onParseProperty

点赞 3

import net.jxta.peergroup.PeerGroupID; //导入依赖的package包/类
@Override
protected void onParseProperty( ManagedProperty<IJp2pProperties, Object> property) {
	if(( !ManagedProperty.isCreated(property)) || ( !PeerGroupProperties.isValidProperty(property.getKey())))
		return;
	PeerGroupProperties id = (PeerGroupProperties) property.getKey();
	switch( id ){
	case PEERGROUP_ID:
		String name = AbstractJp2pPropertySource.getIdentifier( super.getPropertySource() );
		PeerGroupID pgid = IDFactory.newPeerGroupID( PeerGroupID.defaultNetPeerGroupID, name.getBytes() );
		property.setValue( pgid, PropertyEvents.DEFAULT_VALUE_SET );
		property.reset();
		break;
	default:
		break;
	}
	super.onParseProperty(property);
}
 

开发者ID:chaupal,
项目名称:jp2p,
代码行数:18,
代码来源:ChaupalPeerGroupFactory.java

示例3: onParseProperty

点赞 3

import net.jxta.peergroup.PeerGroupID; //导入依赖的package包/类
@Override
protected void onParseProperty( ManagedProperty<IJp2pProperties, Object> property) {
	if(( !ManagedProperty.isCreated(property)) || ( !PeerGroupProperties.isValidProperty(property.getKey())))
		return;
	PeerGroupProperties id = (PeerGroupProperties) property.getKey();
	switch( id ){
	case PEERGROUP_ID:
		String name = PeerGroupPropertySource.getIdentifier( super.getPropertySource() );
		PeerID peerid = IDFactory.newPeerID( PeerGroupID.defaultNetPeerGroupID, name.getBytes() );
		property.setValue( peerid, PropertyEvents.DEFAULT_VALUE_SET );
		property.reset();
		break;
	default:
		break;
	}
	super.onParseProperty(property);
}
 

开发者ID:chaupal,
项目名称:jp2p,
代码行数:18,
代码来源:PeerGroupFactory.java

示例4: getPipeAdvertisement

点赞 2

import net.jxta.peergroup.PeerGroupID; //导入依赖的package包/类
protected static PipeAdvertisement getPipeAdvertisement(PeerGroupID id, String seed, boolean is_multicast) {
    PipeAdvertisement adv = (PipeAdvertisement )AdvertisementFactory.
        newAdvertisement(PipeAdvertisement.getAdvertisementType());
    // id = PeerGroupID.defaultNetPeerGroupID;
    PipeID MyPipeID = IDFactory.newPipeID(id, (seed + "Pipe").getBytes());
    adv.setPipeID(MyPipeID);
    if (is_multicast)
        adv.setType(PipeService.PropagateType); 
    else 
        adv.setType(PipeService.UnicastType); 
    adv.setName("Pipe Service");
    adv.setDescription("Allow communication beetwen peers");
    return adv;
}
 

开发者ID:x42en,
项目名称:Kb00m,
代码行数:15,
代码来源:Tools.java

示例5: getPeerID

点赞 2

import net.jxta.peergroup.PeerGroupID; //导入依赖的package包/类
public PeerID getPeerID() throws URISyntaxException{
	NetworkManagerPropertySource source = (NetworkManagerPropertySource) super.getSource();
	String name = AbstractJp2pPropertySource.getIdentifier( source );
	PeerID pgId = IDFactory.newPeerID( PeerGroupID.defaultNetPeerGroupID, name.getBytes() );
	ManagedProperty<IJp2pProperties, Object> property = source.getOrCreateManagedProperty( NetworkManagerProperties.PEER_ID, pgId.toString(), false );
	String str = (String) property.getValue();
	URI uri = new URI( str );
	return (PeerID) IDFactory.fromURI( uri );
}
 

开发者ID:chaupal,
项目名称:jp2p,
代码行数:10,
代码来源:NetworkManagerPreferences.java

示例6: getPeerID

点赞 2

import net.jxta.peergroup.PeerGroupID; //导入依赖的package包/类
public PeerID getPeerID() throws URISyntaxException{
	PeerGroupPropertySource source = (PeerGroupPropertySource) super.getSource();
	String name = PeerGroupPropertySource.getIdentifier( source );
	PeerID pgId = IDFactory.newPeerID( PeerGroupID.defaultNetPeerGroupID, name.getBytes() );
	ManagedProperty<IJp2pProperties, Object> property = source.getOrCreateManagedProperty( PeerGroupProperties.PEER_ID, pgId.toString(), false );
	String str = (String) property.getValue();
	URI uri = new URI( str );
	return (PeerID) IDFactory.fromURI( uri );
}
 

开发者ID:chaupal,
项目名称:jp2p,
代码行数:10,
代码来源:PeerGroupPreferences.java

示例7: getPeerGroupID

点赞 2

import net.jxta.peergroup.PeerGroupID; //导入依赖的package包/类
public PeerGroupID getPeerGroupID() throws URISyntaxException{
	PeerGroupAdvertisementPropertySource source = (PeerGroupAdvertisementPropertySource) super.getSource();
	String name = (String) source.getProperty( AdvertisementProperties.NAME );
	PeerGroupID pgId = IDFactory.newPeerGroupID( PeerGroupID.defaultNetPeerGroupID, name.getBytes() );
	ManagedProperty<IJp2pProperties, Object> property = source.getOrCreateManagedProperty( PeerGroupProperties.PEERGROUP_ID, pgId.toString(), false );
	String str = (String) property.getValue();
	URI uri = new URI( str );
	return (PeerGroupID) IDFactory.fromURI( uri );
}
 

开发者ID:chaupal,
项目名称:jp2p,
代码行数:10,
代码来源:PeerGroupPreferences.java

示例8: createPeerID

点赞 2

import net.jxta.peergroup.PeerGroupID; //导入依赖的package包/类
/**
 * Given a peer name generates a Peer ID who's value is chosen based upon
 * that name.
 * 
 * @param peerName
 *            instance name
 * @param peerGroupID
 *            the group ID encoding
 * @return The PeerID value
 */
public static PeerID createPeerID(final PeerGroupID peerGroupID, final String peerName) {
	// Use lower case to avoid any locale conversion inconsistencies
	String seed = (peerName + SEED).toLowerCase();

	byte[] digestByteArray = getSHA256Hash(seed);

	if (logger.isTraceEnabled()) {
		logger.trace("Peer: " + peerName + "; seed Hash Value: "
				+ new String(Hex.encode(digestByteArray)));
	}

	return IDFactory.newPeerID(peerGroupID, digestByteArray);
}
 

开发者ID:avasquez614,
项目名称:cloud-raid,
代码行数:24,
代码来源:JXTAIDFactory.java

示例9: createPeerGroupID

点赞 2

import net.jxta.peergroup.PeerGroupID; //导入依赖的package包/类
/**
   * Given a group name generates a Peer Group ID who's value is chosen based upon that name.
   *
   * @param groupName group name encoding value
   * @return The PeerGroupID value
   */
  public static PeerGroupID createPeerGroupID(final String groupName) {
      // Use lower case to avoid any locale conversion inconsistencies
  	String seed = (groupName + SEED).toLowerCase();

byte[] digestByteArray = getSHA256Hash(seed);

if (logger.isTraceEnabled()) {
	logger.trace("PeerGroup Name: " + groupName + "; seed Hash Value: "
			+ new String(Hex.encode(digestByteArray)));
}


      return IDFactory.newPeerGroupID(PeerGroupID.defaultNetPeerGroupID, digestByteArray);
  }
 

开发者ID:avasquez614,
项目名称:cloud-raid,
代码行数:21,
代码来源:JXTAIDFactory.java

示例10: PeerGroupSearchService

点赞 2

import net.jxta.peergroup.PeerGroupID; //导入依赖的package包/类
/**
    * constructor of this service, search based on PeerGroupID
    * 
    * @param peerGroupID
    */
   public PeerGroupSearchService(PeerGroupID peerGroupID,
    PeerGroup netPeerGroup) {
this.searchTerm = peerGroupID.toString();
this.searchType = SearchType.PeerGroupID;
this.netPeerGroup = netPeerGroup;
   }
 

开发者ID:avasquez614,
项目名称:cloud-raid,
代码行数:12,
代码来源:PeerGroupSearchService.java

示例11: setPeerName

点赞 2

import net.jxta.peergroup.PeerGroupID; //导入依赖的package包/类
private void setPeerName() {
        
        displayLog("[######################################]");
        displayLog("[#]Step 1 : Setting the PeerName value");
        //Test if a valid certificate is present
        File certFile = new File(CertificateDirectory, MAINGROUP_NAME+".crt");
        if (certFile.exists() && certFile.isFile()) {
            displayLog("[+]Certificate file Found.");
            //b00mConfig.setCertificate(null);            
        } else {
            //If no certificate available
            displayLog("[!]Certificate file NOT Found...\n[+]Will ask for a 1h trial one.");


            //generate UUID based on
            //Windows -> TIMESTAMP + MotherboardID + 4 RandomDigit
            //Others -> TIMESTAMP + MOBILE + 10 RandomDigit
            Random randGen = new Random();
//            java.util.Date date = new java.util.Date();
//            Calendar cal = new GregorianCalendar();
//            Integer year = cal.get(Calendar.YEAR);
//            Integer month = cal.get(Calendar.MONTH);
//            Integer day = cal.get(Calendar.DAY_OF_MONTH);
//            Integer hour = cal.get(Calendar.HOUR_OF_DAY);
//            Integer min = cal.get(Calendar.MINUTE);
//            Integer sec = cal.get(Calendar.SECOND);
            
//            Core.PeerName = String.valueOf(UUID.randomUUID());
            String seed = String.valueOf(UUID.randomUUID());
            Core.PeerName = Core.PeerName+"-"+seed.substring(1, 10);
//            
//            if (System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) {
//                
//                PeerName = day.toString() + hour.toString() + min.toString() + sec.toString() + new Integer(randGen.nextInt(1000)).toString();
//
//            } else {
//                PeerName = day.toString() + hour.toString() + min.toString() + sec.toString() + new Integer(randGen.nextInt(1000)).toString();
//                //############################################
//            }

        }
        CertificateDirectory = new File(new File("." + MAINGROUP_NAME), "./certificates");
        String theSeed = MAINGROUP_ID + Core.PeerName;
        b00mPeerID = (PeerID) IDFactory.newPeerID(PeerGroupID.defaultNetPeerGroupID, theSeed.getBytes());
        b00mPeerIDString = b00mPeerID.toString();

        
        displayLog("[+]Welcome Aboard!! You're register as " + Core.PeerName + " ;)");
        
    }
 

开发者ID:x42en,
项目名称:Kb00m,
代码行数:51,
代码来源:Core.java

示例12: getPeerGroupID

点赞 2

import net.jxta.peergroup.PeerGroupID; //导入依赖的package包/类
public PeerGroupID getPeerGroupID() {
	return subgroup.getPeerGroupID();
}
 

开发者ID:pja35,
项目名称:p2pEngine,
代码行数:4,
代码来源:Peer.java

示例13: setPeerGroupID

点赞 2

import net.jxta.peergroup.PeerGroupID; //导入依赖的package包/类
public void setPeerGroupID( PeerGroupID peerGroupID ){
	IJp2pWritePropertySource<IJp2pProperties> source = (IJp2pWritePropertySource<IJp2pProperties>) super.getSource();
	source.setProperty( PeerGroupProperties.PEERGROUP_ID, peerGroupID.toString() );
}
 

开发者ID:chaupal,
项目名称:jp2p,
代码行数:5,
代码来源:PeerGroupPreferences.java

示例14: main

点赞 2

import net.jxta.peergroup.PeerGroupID; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	String peerName = "test";
	
	NetworkConfigurator localConfig = new NetworkConfigurator(
			NetworkConfigurator.EDGE_NODE, new File(new File(
					".jxtaConfig"), peerName).toURI());
	
	NetPeerGroupFactory factory = new NetPeerGroupFactory(
			(ConfigParams) localConfig.getPlatformConfig(), new File(
					new File(".jxtaConfig"), peerName).toURI());
	
	PeerGroup netPeerGroup = factory.getInterface();
	PeerGroupID peerGroupID = JXTAIDFactory.createPeerGroupID("jigdfs-jxta-group");
	PeerGroupAdvertisement peerGroupAdv = PeerGroupUtil.create(netPeerGroup, "jigdfs-jxta-group", "jigdfs-jxta-group", "whatever", 1000l, peerGroupID);
	
	
	
	logger.info(Arrays.asList(peerGroupAdv.getIndexFields()));

	

}
 

开发者ID:avasquez614,
项目名称:cloud-raid,
代码行数:23,
代码来源:PeerGroupTest.java

示例15: generatePeerGroupID

点赞 1

import net.jxta.peergroup.PeerGroupID; //导入依赖的package包/类
/**
 * Generate an unique PeerGroup ID from the peer group name
 * @param peerGroupName A string, generally the peer name, from the PeerID will be generated.
 * @return the newly generated PeerID
 */
private PeerGroupID generatePeerGroupID(String peerGroupName) {
	return IDFactory.newPeerGroupID(PeerGroupID.defaultNetPeerGroupID, peerGroupName.getBytes());
}
 

开发者ID:pja35,
项目名称:p2pEngine,
代码行数:9,
代码来源:Network.java


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