Package org.eclipse.ecf.core.identity

Examples of org.eclipse.ecf.core.identity.ID


    updater.start();
    try {
      // make container instance
      IContainer cont = ContainerFactory.getDefault().createContainer("ecf.twitter");
      // make targetID      
      ID targetID;
      targetID = IDFactory.getDefault().createID(cont.getConnectNamespace(),"http://twitter.com/savino2");
      cont.connect(targetID,null);
    } catch (IDCreateException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here


    updater.start();
    try {
      // make container instance
      IContainer cont = ContainerFactory.getDefault().createContainer("ecf.twitter");
      // make targetID
      ID targetID;
      targetID = IDFactory.getDefault().createID(cont.getConnectNamespace(),"savino2");
      cont.connect(targetID,null);
    } catch (IDCreateException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

public class TwitterContainerInstantiator extends org.eclipse.ecf.core.provider.BaseContainerInstantiator{

  public IContainer createInstance(ContainerTypeDescription description,
      Object[] parameters) throws ContainerCreateException {
    ID guid;
    try {
      guid = IDFactory.getDefault().createGUID();
    } catch (IDCreateException e) {
      throw new ContainerCreateException("Exception creating ID",e);
    }
View Full Code Here

  }

 
  protected IRosterEntry makeRosterEntry(IRosterItem parent, User user) {
    String userName = user.getScreen_name();
    ID userID;
    IRosterEntry entry;
      try {
        userID = IDFactory.getDefault().createID(targetID.getNamespace(), userName);

        IUser child = new org.eclipse.ecf.core.user.User(userID,userName);
View Full Code Here

    updater.start();
    try {
      // make container instance
      IContainer cont = ContainerFactory.getDefault().createContainer("ecf.twitter");
      // make targetID
      ID targetID;
      targetID = IDFactory.getDefault().createID(cont.getConnectNamespace(),"savino2");
      cont.connect(targetID,null);
    } catch (IDCreateException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

    final String serverName = "//" + InetAddress.getLocalHost().getHostName() + ":" + port;
    serverGroups = new RssServerSOContainerGroup[1];
    // Setup server group
    serverGroups[0] = new RssServerSOContainerGroup(port);
    // Create identity for server
    final ID id = IDFactory.getDefault().createStringID(serverName);
    // Create server config object with identity and default timeout
    final SOContainerConfig config = new SOContainerConfig(id);
    // Make server instance
    System.out.println("Creating ECF server container...");
    final RssServerSOContainer server = new RssServerSOContainer(config, serverGroups[0], DEFAULT_KEEPALIVE);
    // Setup join policy
    ((ISharedObjectContainerGroupManager) server).setConnectPolicy(new IConnectHandlerPolicy() {
      public PermissionCollection checkConnect(Object address, ID fromID, ID targetID, String targetGroup, Object connectData) throws Exception {
        System.out.println("JOIN Addr=" + address + ";From=" + fromID + ";Group=" + targetGroup + ";Data=" + connectData);
        return null;
      }

      public void refresh() {
        System.out.println("joinPolicy.refresh()");
      }
    });
    // Setup add shared object policy
    final ISharedObjectManager manager = server.getSharedObjectManager();
    manager.setRemoteAddPolicy(new ISharedObjectPolicy() {
      public PermissionCollection checkAddSharedObject(ID fromID, ID toID, ID localID, ReplicaSharedObjectDescription newObjectDescription) throws SecurityException {
        System.out.println("ADDSHAREDOBJECT From=" + fromID + ";To=" + toID + ";SharedObjectDesc=" + newObjectDescription);
        return null;
      }

      public void refresh() {
        System.out.println("sharedObjectPolicy.refresh()");
      }
    });

    serverGroups[0].putOnTheAir();
    servers.add(server);
    System.out.println("success!");
    System.out.println("Waiting for JOIN requests at '" + id.getName() + "'...");
    System.out.println("<Ctrl>+C to stop server");
  }
View Full Code Here

    if (socket == null) {
      return null;
    }

    ID retID = null;
    try {
      retID = IDFactory.getDefault().createStringID(getURL(null).toString());
    } catch (final Exception e) {
      dumpStack("Exception in getLocalID()", e);
      return null;
View Full Code Here

  public boolean changeItem(ID itemID, String description) {
    if (feed != null) {
      List items = feed.getItems();
      for (int i = 0; i < items.size(); i++) {
        RssItem rssItem = (RssItem) items.get(i);
        ID id = createID(rssItem.getSync().getId());
        if (id != null && id.equals(itemID)) {
          rssItem.setDescription(description);
          return true;
        }
      }
    }
View Full Code Here

    }
    final IMergeableChannel channel = (IMergeableChannel) sharedObject.getAdapter(IMergeableChannel.class);
    if (channel == null) {
      throw new SharedObjectCreateException("Cannot coerce object " + channel + " to be of type IChannel");
    }
    ID newID = sodesc.getID();
    if (newID == null) {
      newID = IDFactory.getDefault().createGUID();
    }
    Map properties = sodesc.getProperties();
    if (properties == null) {
View Full Code Here

    final ContainerTypeDescription contd = new ContainerTypeDescription(RssContainerInstantiator.class.getName(), RssContainerInstantiator.class.getName(), null);
    ContainerFactory.getDefault().addDescription(contd);

    final RssClientSOContainer container = new RssClientSOContainer();
    // now connect to rss service
    final ID serverID = IDFactory.getDefault().createStringID(targetURL);
    container.connect(serverID, null);
    // get IMergeableChannelContainer adapter
    final IMergeableChannelContainerAdapter channelContainer = (IMergeableChannelContainerAdapter) container.getAdapter(IMergeableChannelContainerAdapter.class);
    // create channel listener
    final IChannelListener listener = new IChannelListener() {
      public void handleChannelEvent(IChannelEvent event) {
        System.out.println("listener.handleChannelEvent(" + event + ")");
      }
    };
    // create a new channel
    final ID channelID = IDFactory.getDefault().createStringID("/reuters/worldNews/");
    // ID channelID = IDFactory.getDefault().createStringID("/feed.xml");
    final IMergeableChannel channel = channelContainer.createMergeableChannel(channelID, listener, new HashMap());
    if (channel instanceof FeedSharedObject) {
      // get remote feed (subscribed)
      final RssFeed remoteFeed = ((FeedSharedObject) channel).getFeed();
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.core.identity.ID

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.