本文整理汇总了Java中rocks.xmpp.core.Jid.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java Jid.valueOf方法的具体用法?Java Jid.valueOf怎么用?Java Jid.valueOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rocks.xmpp.core.Jid
的用法示例。
在下文中一共展示了Jid.valueOf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import rocks.xmpp.core.Jid; //导入方法依赖的package包/类
/**
* Creates a bean from the result {@link #dump()}
*
* @param aDump
* The result of {@link #dump()}
* @return The created bean, or null
*/
public static XmppAccess load(final Object aDump) {
if (aDump instanceof String) {
try {
// Parse the JID and prepare the bean
final Jid jid = Jid.valueOf(aDump.toString());
return new XmppAccess(jid);
} catch (final IllegalArgumentException ex) {
// Bad JID
return null;
}
}
// Unhandled kind of dump
return null;
}
示例2: create
import rocks.xmpp.core.Jid; //导入方法依赖的package包/类
/**
* Implements 'http://xmpp.org/protocol/openlink:01:00:00#manage-voice-message' Create.
*
* Creates a playlist.
*
* @param to
* Openlink XMPP component.
* @param profile
* the Openlink profile.
* @param label
* the playlist label.
* @param messageIds
* the Message ID/Keys to include in the playlist.
* @return a collection of playlists.
* @throws XmppException
*/
public Collection<VoiceMessage> create(String to, Profile profile, String label, Set<String> messageIds) throws XmppException {
ManageVoiceMessage mvm = new ManageVoiceMessage();
mvm.getIn().setProfile(profile.getId());
mvm.getIn().setAction(ManageVoiceMessageAction.Create);
mvm.getIn().setLabel(label);
Set<ManageVoiceMessageFeature> mvmFeatures = new HashSet<ManageVoiceMessage.ManageVoiceMessageFeature>();
for (String id : messageIds) {
ManageVoiceMessageFeature mvmFeature = new ManageVoiceMessageFeature();
mvmFeature.setId(id);
mvmFeatures.add(mvmFeature);
}
mvm.getIn().setFeatures(mvmFeatures);
IQ iq = new IQ(Jid.valueOf(to), IQ.Type.SET, mvm);
IQ iqResult = xmppSession.query(iq);
Collection<VoiceMessage> messages = getVoiceMessagesFromIQ(iqResult);
return messages;
}
示例3: archive
import rocks.xmpp.core.Jid; //导入方法依赖的package包/类
public Collection<VoiceMessage> archive(String to, Profile profile, Set<String> messageIds) throws XmppException {
Collection<VoiceMessage> messages = new ArrayList<VoiceMessage>();
ManageVoiceMessage mvm = new ManageVoiceMessage();
mvm.getIn().setProfile(profile.getId());
mvm.getIn().setAction(ManageVoiceMessageAction.Archive);
Set<ManageVoiceMessageFeature> mvmFeatures = new HashSet<ManageVoiceMessage.ManageVoiceMessageFeature>();
for (String id : messageIds) {
ManageVoiceMessageFeature mvmFeature = new ManageVoiceMessageFeature();
mvmFeature.setId(id);
mvmFeatures.add(mvmFeature);
}
mvm.getIn().setFeatures(mvmFeatures);
IQ iq = new IQ(Jid.valueOf(to), IQ.Type.SET, mvm);
IQ iqResult = xmppSession.query(iq);
messages = getVoiceMessagesFromIQ(iqResult);
return messages;
}
示例4: edit
import rocks.xmpp.core.Jid; //导入方法依赖的package包/类
/**
* Implements 'http://xmpp.org/protocol/openlink:01:00:00#manage-voice-message' Playback.
*
* @param to
* Openlink XMPP component.
* @param profile
* the Openlink profile.
* @param label
* the new message label.
* @param messageIds
* the Message ID/Keys.
* @return a collection of messages and playlists.
* @throws XmppException
*/
public Collection<VoiceMessage> edit(String to, Profile profile, String label, Set<String> messageIds) throws XmppException {
Collection<VoiceMessage> messages = new ArrayList<VoiceMessage>();
ManageVoiceMessage mvm = new ManageVoiceMessage();
mvm.getIn().setProfile(profile.getId());
mvm.getIn().setAction(ManageVoiceMessageAction.Edit);
mvm.getIn().setLabel(label);
Set<ManageVoiceMessageFeature> mvmFeatures = new HashSet<ManageVoiceMessage.ManageVoiceMessageFeature>();
for (String id : messageIds) {
ManageVoiceMessageFeature mvmFeature = new ManageVoiceMessageFeature();
mvmFeature.setId(id);
mvmFeatures.add(mvmFeature);
}
mvm.getIn().setFeatures(mvmFeatures);
IQ iq = new IQ(Jid.valueOf(to), IQ.Type.SET, mvm);
IQ iqResult = xmppSession.query(iq);
messages = getVoiceMessagesFromIQ(iqResult);
return messages;
}
示例5: save
import rocks.xmpp.core.Jid; //导入方法依赖的package包/类
/**
* Implements 'http://xmpp.org/protocol/openlink:01:00:00#manage-voice-message' Playback.
*
* @param to
* Openlink XMPP component.
* @param profile
* the Openlink profile.
* @param label
* the new message label.
* @param audioFiles
* the Audio Files to save.
* @return a collection of messages and playlists.
* @throws XmppException
*/
public Collection<VoiceMessage> save(String to, Profile profile, String label, Set<AudioFile> audioFiles) throws XmppException {
Collection<VoiceMessage> messages = new ArrayList<VoiceMessage>();
ManageVoiceMessage mvm = new ManageVoiceMessage();
mvm.getIn().setProfile(profile.getId());
mvm.getIn().setAction(ManageVoiceMessageAction.Save);
mvm.getIn().setLabel(label);
mvm.getIn().setAudioFiles(audioFiles);
IQ iq = new IQ(Jid.valueOf(to), IQ.Type.SET, mvm);
IQ iqResult = xmppSession.query(iq);
messages = getVoiceMessagesFromIQ(iqResult);
return messages;
}
示例6: testCommand
import rocks.xmpp.core.Jid; //导入方法依赖的package包/类
@Test
public void testCommand() throws XMLStreamException, JAXBException {
RequestAction gi = new RequestAction();
gi.getIn().setInterest("leon_office_vmstsp_default");
gi.getIn().setAction(RequestActionAction.AddThirdParty);
gi.getIn().setCall(RandomStringUtils.randomNumeric(12));
gi.getIn().setValue1("6001");
gi.getIn().setValue2("somevalue");
Assert.assertNotNull(gi);
IQ iq = new IQ(Jid.valueOf("vmstsp.dom"), IQ.Type.GET, gi);
String xml = marshal(iq);
Assert.assertNotNull(xml);
logger.debug(xml);
// Assert.assertTrue(xml.contains("<iodata xmlns=\"urn:xmpp:tmp:io-data\" type=\"output\">"));
}
示例7: getFeatures
import rocks.xmpp.core.Jid; //导入方法依赖的package包/类
/**
* Implements 'http://xmpp.org/protocol/openlink:01:00:00#get-features'.
*
* @param to
* Openlink XMPP component.
* @param profile
* User's profile.
* @return collection of features.
*/
public Collection<Feature> getFeatures(String to, Profile profile) throws XmppException {
Collection<Feature> result = new ArrayList<Feature>();
GetFeatures gf = new GetFeatures();
gf.getIn().setProfile(profile.getId());
IQ iq = new IQ(Jid.valueOf(applySiteIdOnSystem(to)), IQ.Type.SET, gf);
IQ iqResult = xmppSession.query(iq);
Command command = iqResult.getExtension(Command.class);
if (command != null) {
validateCommandNoteTypeError(command);
IoData ioData = command.getExtension(IoData.class);
if (ioData != null && ioData.getOut() != null) {
Features features = ioData.getOut().getExtension(Features.class);
if (features != null) {
result = features.getFeatures();
}
}
}
return result;
}
示例8: setFeatures
import rocks.xmpp.core.Jid; //导入方法依赖的package包/类
/**
* Implements 'http://xmpp.org/protocol/openlink:01:00:00#set-features'.
*
* @param to
* Openlink XMPP component.
* @param profile
* User's profile.
* @param feature
* Feature to update.
* @param values
* Up to three values representing value1, value2, value3 from the Openlink Set Features command.
*
*/
public void setFeatures(String to, Profile profile, Feature feature, String... values) throws XmppException {
SetFeatures sf = new SetFeatures();
sf.getIn().setProfile(profile.getId());
sf.getIn().setFeature(feature.getId());
if (values.length > 0) {
sf.getIn().setValue1(values[0]);
}
if (values.length > 1) {
sf.getIn().setValue2(values[1]);
}
if (values.length > 2) {
sf.getIn().setValue3(values[2]);
}
IQ iq = new IQ(Jid.valueOf(applySiteIdOnSystem(to)), IQ.Type.SET, sf);
IQ iqResult = xmppSession.query(iq);
Command command = iqResult.getExtension(Command.class);
if (command != null) {
validateCommandNoteTypeError(command);
Command.Status status = command.getStatus();
logger.debug("SET FEATURE STATUS: " + status);
}
}
示例9: testCallStatus
import rocks.xmpp.core.Jid; //导入方法依赖的package包/类
@Test
public void testCallStatus() throws XMLStreamException, JAXBException {
CallStatus cs = OpenlinkTestHelper.getCallStatus();
Assert.assertNotNull(cs);
Message m = new Message(Jid.valueOf("[email protected]"));
m.getExtensions().add(cs);
String xml = marshal(m);
Assert.assertNotNull(xml);
logger.debug("XML : " + xml);
Assert.assertTrue(xml.contains("<callstatus xmlns=\"http://xmpp.org/protocol/openlink:01:00:00#call-status\" busy=\"false\">"));
Assert.assertTrue(xml.contains("<state>CallConferenced</state>"));
Assert.assertTrue(xml.contains("<RemoveThirdParty>"));
Assert.assertTrue(xml.contains("<ClearCall>"));
}
示例10: testFeatures
import rocks.xmpp.core.Jid; //导入方法依赖的package包/类
@Test
public void testFeatures() throws XMLStreamException, JAXBException {
int numFeatures = 5;
Features fs = OpenlinkTestHelper.getFeatures(numFeatures);
Assert.assertNotNull(fs);
Assert.assertTrue(fs.size() == numFeatures);
for (Feature f : fs) {
Assert.assertNotNull(f);
Assert.assertNotNull(f.getId());
Assert.assertNotNull(f.getLabel());
Assert.assertNotNull(f.getType());
}
Message m = new Message(Jid.valueOf("[email protected]"));
m.getExtensions().add(fs);
String xml = marshal(m);
Assert.assertNotNull(xml);
logger.debug(marshal(fs));
Assert.assertTrue(xml.contains("<features xmlns=\"" + OpenlinkNamespaces.NS_OPENLINK_FEATURES
+ "\"><feature id=\""));
}
示例11: testInterests
import rocks.xmpp.core.Jid; //导入方法依赖的package包/类
@Test
public void testInterests() throws XMLStreamException, JAXBException {
int numInterests = 5;
Interests is = OpenlinkTestHelper.getInterests(numInterests);
Assert.assertNotNull(is);
Assert.assertTrue(is.size() == numInterests);
for (Interest i : is) {
Assert.assertNotNull(i);
Assert.assertNotNull(i.getId());
Assert.assertNotNull(i.getLabel());
Assert.assertNotNull(i.getType());
Assert.assertNotNull(i.getValue());
}
Message m = new Message(Jid.valueOf("[email protected]"));
m.getExtensions().add(is);
String xml = marshal(m);
Assert.assertNotNull(xml);
logger.debug(marshal(is));
Assert.assertTrue(xml.contains("<interests xmlns=\"" + OpenlinkNamespaces.NS_OPENLINK_INTERESTS
+ "\"><interest id=\""));
}
示例12: testCommandMarshal
import rocks.xmpp.core.Jid; //导入方法依赖的package包/类
@Test
public void testCommandMarshal() throws XMLStreamException, JAXBException {
int numProfiles = 5;
int numActions = 3;
Profiles ps = OpenlinkTestHelper.getProfiles(numProfiles, numActions);
Assert.assertNotNull(ps);
Assert.assertTrue(ps.size() == numProfiles);
for (Profile p : ps) {
Assert.assertTrue(p.getActions().size() == numActions);
}
IoData ioData = new IoData();
ioData.setType(IoData.IoDataType.OUTPUT);
ioData.getOut().setExtension(ps);
Command c = OpenlinkTestHelper.getCommand(OpenlinkNamespaces.NS_OPENLINK_GETPROFILES);
Assert.assertNotNull(c);
c.getExtensions().add(ioData);
Assert.assertNotNull(ioData);
Assert.assertNotNull(ioData.getOut().getExtension(Profiles.class));
Assert.assertTrue((ioData.getOut().getExtension(Profiles.class)).size() == numProfiles);
Message m = new Message(Jid.valueOf("[email protected]"));
m.getExtensions().add(c);
String xml = marshal(m);
Assert.assertNotNull(xml);
logger.debug(xml);
Assert.assertTrue(xml.contains("<iodata xmlns=\"urn:xmpp:tmp:io-data\" type=\"output\">"));
}
示例13: getProfiles
import rocks.xmpp.core.Jid; //导入方法依赖的package包/类
/**
* Implements 'http://xmpp.org/protocol/openlink:01:00:00#get-profiles'.
*
* @param to
* Openlink XMPP component.
* @param jid
* if logged on as an admin a user can obtain profiles on behalf of another user by specifying their bare JID (eg. [email protected]).
* @return collection of user's profiles.
*/
public Collection<Profile> getProfiles(String to, Jid jid) throws XmppException {
Collection<Profile> result = new ArrayList<Profile>();
GetProfiles gp = new GetProfiles();
if (jid == null) {
gp.getIn().setJid(this.jid);
} else {
gp.getIn().setJid(jid);
}
IQ iq = new IQ(Jid.valueOf(applySiteIdOnSystem(to)), IQ.Type.SET, gp);
IQ iqResult = xmppSession.query(iq);
Command command = iqResult.getExtension(Command.class);
if (command != null) {
validateCommandNoteTypeError(command);
IoData ioData = command.getExtension(IoData.class);
if (ioData != null && ioData.getOut() != null) {
Profiles profiles = ioData.getOut().getExtension(Profiles.class);
if (profiles != null) {
result = profiles.getProfiles();
}
}
}
return result;
}
示例14: makeCall
import rocks.xmpp.core.Jid; //导入方法依赖的package包/类
/**
* Implements 'http://xmpp.org/protocol/openlink:01:00:00#make-call'.
*
* @param to
* Openlink XMPP component.
* @param interest
* the Openlink interest.
* @param destination
* destination to be dialled.
* @param features
* features to be associated with the call.
* @param originatorRef
* collection to associate with the call.
* @return Collection of calls made as a result of the request.
*/
public Collection<Call> makeCall(String to, Interest interest, String destination, Set<MakeCallFeature> features, Set<Property> originatorRef)
throws XmppException {
Collection<Call> result = new ArrayList<Call>();
MakeCall mc = new MakeCall();
mc.getIn().setInterest(interest.getId());
mc.getIn().setDestination(destination);
mc.getIn().setJid(this.jid.asBareJid());
if (features != null) {
mc.getIn().setFeatures(features);
}
if (originatorRef != null) {
mc.getIn().setOriginatorRef(originatorRef);
}
IQ iq = new IQ(Jid.valueOf(applySiteIdOnSystem(to)), IQ.Type.SET, mc);
IQ iqResult = xmppSession.query(iq);
Command command = iqResult.getExtension(Command.class);
if (command != null) {
validateCommandNoteTypeError(command);
IoData ioData = command.getExtension(IoData.class);
if (ioData != null && ioData.getOut() != null) {
CallStatus callStatus = ioData.getOut().getExtension(CallStatus.class);
if (callStatus != null) {
result = callStatus.getCalls();
}
}
}
return result;
}
示例15: testProperties
import rocks.xmpp.core.Jid; //导入方法依赖的package包/类
@Test
public void testProperties() throws XMLStreamException, JAXBException {
int numFeatures = 5;
Properties ps = new Properties();
Assert.assertNotNull(ps);
Assert.assertTrue(ps.size() == 0);
Property p1 = new Property();
p1.setId("callId");
p1.setType("sumType");
p1.setValue("myVal");
ps.add(p1);
Property p2 = new Property();
p2.setId("sysId");
p2.setType("randomType");
p2.setValue("myVal2");
ps.add(p2);
for (Property p : ps) {
Assert.assertNotNull(p);
Assert.assertNotNull(p.getId());
Assert.assertNotNull(p.getValue());
Assert.assertNotNull(p.getType());
}
Message m = new Message(Jid.valueOf("[email protected]"));
m.getExtensions().add(ps);
String xml = marshal(m);
Assert.assertNotNull(xml);
logger.debug(marshal(ps));
Assert.assertTrue(xml.contains("<properties xmlns=\"" + OpenlinkNamespaces.NS_OPENLINK_PROPERTIES + "\"><property id=\""));
Assert.assertTrue(xml.contains("<property id=\"callId\" type=\"sumType\"><value>myVal</value></property>"));
Assert.assertTrue(xml.contains("<property id=\"sysId\" type=\"randomType\"><value>myVal2</value></property>"));
}