📄 platform.java
字号:
"Reference Implementation of the None Membership Service"); services.put( PeerGroup.membershipClassID, moduleAdv); moduleAdv = mkImplAdvBuiltin(PeerGroup.refAccessSpecID, "net.jxta.impl.access.always.AlwaysAccessService", "Always Access Service"); services.put(PeerGroup.accessClassID, moduleAdv); // "Standard" Services moduleAdv = mkImplAdvBuiltin(PeerGroup.refDiscoverySpecID, "net.jxta.impl.discovery.DiscoveryServiceImpl", "Reference Implementation of the Discovery service"); services.put(PeerGroup.discoveryClassID, moduleAdv); moduleAdv = mkImplAdvBuiltin(PeerGroup.refRendezvousSpecID, "net.jxta.impl.rendezvous.RendezVousServiceImpl", "Reference Implementation of the Rendezvous Service"); services.put(PeerGroup.rendezvousClassID, moduleAdv); moduleAdv = mkImplAdvBuiltin(PeerGroup.refPeerinfoSpecID, "net.jxta.impl.peer.PeerInfoServiceImpl", "Reference Implementation of the Peerinfo Service" ); services.put( PeerGroup.peerinfoClassID, moduleAdv ); // Do the protocols moduleAdv = mkImplAdvBuiltin(PeerGroup.refTcpProtoSpecID, "net.jxta.impl.endpoint.tcp.TcpTransport", "Reference Implementation of the TCP Message Transport"); protos.put( PeerGroup.tcpProtoClassID, moduleAdv); moduleAdv = mkImplAdvBuiltin(PeerGroup.refHttpProtoSpecID, "net.jxta.impl.endpoint.servlethttp.ServletHttpTransport", "Reference Implementation of the HTTP Message Transport"); protos.put( PeerGroup.httpProtoClassID, moduleAdv); // Do the Apps moduleAdv = mkImplAdvBuiltin(PeerGroup.refStartNetPeerGroupSpecID, "net.jxta.impl.peergroup.StartNetPeerGroup", "Start Net Peer Group"); apps.put(applicationClassID, moduleAdv); paramAdv.setServices(services); paramAdv.setProtos(protos); paramAdv.setApps(apps); // Pour the paramAdv in the platformDef platformDef.setParam((XMLDocument) paramAdv.getDocument(MimeMediaType.XMLUTF8)); return platformDef; } /** * {@inheritDoc} */ public void stopApp() { super.stopApp(); initialized = false; } /** * Returns the all purpose peer group implementation advertisement that * is most useful when called in the context of the platform group: the * description of an infrastructure group. * * <p/>This definition is always the same and has a well known ModuleSpecID. * It includes the basic service, high-level transports and the shell for * main application. It differs from the one returned by StdPeerGroup only * in that it includes the high-level transports (and different specID, * name and description, of course). However, in order to avoid confusing * inheritance schemes (class hierarchy is inverse of object hierarchy) * other possible dependency issues, we just redefine it fully, right here. * * The user must remember to change the specID if the set of services * protocols or applications is altered before use. * * @return ModuleImplAdvertisement The new peergroup impl adv. */ public ModuleImplAdvertisement getAllPurposePeerGroupImplAdvertisement() { // Build it only the first time; then clone it. if (allPurposeImplAdv != null) return (ModuleImplAdvertisement) allPurposeImplAdv.clone(); // Make a new impl adv // For now, use the well know NPG naming, it is not // identical to the allPurpose PG because we use the class // ShadowPeerGroup which initializes the peer config from its // parent. ModuleImplAdvertisement implAdv = mkImplAdvBuiltin( PeerGroup.refNetPeerGroupSpecID, ShadowPeerGroup.class.getName(), "Default NetPeerGroup reference implementation."); XMLElement paramElement = (XMLElement) implAdv.getParam(); StdPeerGroupParamAdv paramAdv = new StdPeerGroupParamAdv( ); ModuleImplAdvertisement moduleAdv; // set the services Hashtable services = new Hashtable(); // "Core" Services moduleAdv = mkImplAdvBuiltin( PeerGroup.refEndpointSpecID, "net.jxta.impl.endpoint.EndpointServiceImpl", "Reference Implementation of the Endpoint Service"); services.put(PeerGroup.endpointClassID, moduleAdv); moduleAdv = mkImplAdvBuiltin( PeerGroup.refResolverSpecID, "net.jxta.impl.resolver.ResolverServiceImpl", "Reference Implementation of the Resolver Service"); services.put(PeerGroup.resolverClassID, moduleAdv); moduleAdv = mkImplAdvBuiltin( PSEMembershipService.pseMembershipSpecID, "net.jxta.impl.membership.pse.PSEMembershipService", "Reference Implementation of the PSE Membership Service"); services.put(PeerGroup.membershipClassID, moduleAdv); moduleAdv = mkImplAdvBuiltin( PeerGroup.refAccessSpecID, "net.jxta.impl.access.always.AlwaysAccessService", "Always Access Service"); services.put(PeerGroup.accessClassID, moduleAdv); // "Standard" Services moduleAdv = mkImplAdvBuiltin(PeerGroup.refDiscoverySpecID, "net.jxta.impl.discovery.DiscoveryServiceImpl", "Reference Implementation of the Discovery Service"); services.put(PeerGroup.discoveryClassID, moduleAdv); moduleAdv = mkImplAdvBuiltin(PeerGroup.refRendezvousSpecID, "net.jxta.impl.rendezvous.RendezVousServiceImpl", "Reference Implementation of the Rendezvous Service"); services.put(PeerGroup.rendezvousClassID, moduleAdv); moduleAdv = mkImplAdvBuiltin(PeerGroup.refPipeSpecID, "net.jxta.impl.pipe.PipeServiceImpl", "Reference Implementation of the Pipe Service" ); services.put(PeerGroup.pipeClassID, moduleAdv); moduleAdv = mkImplAdvBuiltin(PeerGroup.refPeerinfoSpecID, "net.jxta.impl.peer.PeerInfoServiceImpl", "Reference Implementation of the Peerinfo Service" ); services.put( PeerGroup.peerinfoClassID, moduleAdv ); moduleAdv = mkImplAdvBuiltin(PeerGroup.refProxySpecID, "net.jxta.impl.proxy.ProxyService", "Reference Implementation of the JXME Proxy Service"); services.put(PeerGroup.proxyClassID, moduleAdv); paramAdv.setServices(services); // High-level Transports. Hashtable protos = new Hashtable(); moduleAdv = mkImplAdvBuiltin(PeerGroup.refRouterProtoSpecID, "net.jxta.impl.endpoint.router.EndpointRouter", "Reference Implementation of the Router Message Transport"); protos.put(PeerGroup.routerProtoClassID, moduleAdv); moduleAdv = mkImplAdvBuiltin(PeerGroup.refTlsProtoSpecID, "net.jxta.impl.endpoint.tls.TlsTransport", "Reference Implementation of the JXTA TLS Message Transport"); protos.put(PeerGroup.tlsProtoClassID, moduleAdv); moduleAdv = mkImplAdvBuiltin( CbJxDefs.cbjxMsgTransportSpecID, "net.jxta.impl.endpoint.cbjx.CbJxTransport", "Reference Implementation of the JXTA Cryptobased-ID Message Transport"); protos.put( CbJxDefs.msgtptClassID, moduleAdv); moduleAdv = mkImplAdvBuiltin(PeerGroup.refRelayProtoSpecID, "net.jxta.impl.endpoint.relay.RelayTransport", "Reference Implementation of the Relay Message Transport"); protos.put(PeerGroup.relayProtoClassID, moduleAdv); paramAdv.setProtos(protos); // Main app is the shell // Build a ModuleImplAdv for the shell ModuleImplAdvertisement newAppAdv = (ModuleImplAdvertisement) AdvertisementFactory.newAdvertisement( ModuleImplAdvertisement.getAdvertisementType()); // The shell's spec id is a canned one. newAppAdv.setModuleSpecID(PeerGroup.refShellSpecID); // Same compat than the group. newAppAdv.setCompat(implAdv.getCompat()); newAppAdv.setUri(implAdv.getUri()); newAppAdv.setProvider(implAdv.getProvider()); // Make up a description newAppAdv.setDescription("JXTA Shell"); // Tack in the class name newAppAdv.setCode( "net.jxta.impl.shell.bin.Shell.Shell" ); // Put that in a new table of Apps and replace the entry in // paramAdv Hashtable newApps = new Hashtable(); newApps.put(PeerGroup.applicationClassID, newAppAdv); paramAdv.setApps(newApps); // Pour our newParamAdv in implAdv paramElement = (XMLElement) paramAdv.getDocument(MimeMediaType.XMLUTF8); implAdv.setParam(paramElement); allPurposeImplAdv = implAdv; return implAdv; } /** * {@inheritDoc} **/ public URI getStoreHome() { return jxtaHome; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -