Package org.jgraph.graph

Examples of org.jgraph.graph.ConnectionSet$Connection


            return true;
        }

        Object credential = getCredential();
        if (credential instanceof RemotingConnectionCredential) {
            Connection con = ((RemotingConnectionCredential) credential).getConnection();
            UserPrincipal up = null;
            for (Principal current : con.getPrincipals()) {
                if (current instanceof UserPrincipal) {
                    up = (UserPrincipal) current;
                    break;
                }
            }
            // If we found a principal from the connection then authentication succeeded.
            if (up != null) {
                identity = up;
                if (getUseFirstPass()) {
                    String userName = identity.getName();
                    log.debugf("Storing username '%s'", userName);
                    // Add the username to the shared state map
                    sharedState.put("javax.security.auth.login.name", identity);

                    if (useClientCert) {
                        SSLSession session = con.getSslSession();
                        if (session != null) {
                            try {
                                credential = session.getPeerCertificateChain()[0];
                                log.debug("Using certificate as credential.");
                            } catch (SSLPeerUnverifiedException e) {
View Full Code Here


            final String connectionName = outboundConnectionService.getConnectionName();
            logger.debug("Creating remoting EJB receiver for connection " + connectionName);
            try {
                final IoFuture<Connection> futureConnection = outboundConnectionService.connect();
                // TODO: Make the timeout configurable
                final Connection connection = IoFutureHelper.get(futureConnection, DEFAULT_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS);
                // add it to the successful connection list to be returned
                connections.add(connection);

            } catch (IOException ioe) {
                // just log a WARN and move on to the next
View Full Code Here

        if (super.login() == true) {
            log.debug("super.login()==true");
            return true;
        }

        Connection con = SecurityActions.remotingContextGetConnection();
        if (con != null) {
            UserPrincipal up = null;
            for (Principal current : con.getPrincipals()) {
                if (current instanceof UserPrincipal) {
                    up = (UserPrincipal) current;
                    break;
                }
            }
View Full Code Here

     *
     * @return the connection
     * @throws IOException
     */
    public Connection connect() throws IOException {
        Connection connection;
        synchronized (this) {
            if(shutdown) throw ProtocolMessages.MESSAGES.channelClosed();
            connection = this.connection;
            if(connection == null) {
                connection = connectTask.connect();
                if(connection == null) {
                    throw ProtocolMessages.MESSAGES.channelClosed();
                }
                boolean ok = false;
                try {
                    // Connection opened notification
                    final ConnectionOpenHandler openHandler = connectTask.getConnectionOpenedHandler();
                    openHandler.connectionOpened(connection);
                    ok = true;
                    this.connection = connection;
                    connection.addCloseHandler(new CloseHandler<Connection>() {
                        @Override
                        public void handleClose(Connection closed, IOException exception) {
                            onConnectionClose(closed);
                        }
                    });
View Full Code Here

    /**
     * Shutdown the connection manager.
     */
    public void shutdown() {
        final Connection connection;
        synchronized (this) {
            if(shutdown) return;
            shutdown = true;
            connection = this.connection;
            if(connectTask != null) {
View Full Code Here

            final String connectionName = outboundConnectionService.getConnectionName();
            logger.debug("Creating remoting EJB receiver for connection " + connectionName);
            try {
                final IoFuture<Connection> futureConnection = outboundConnectionService.connect();
                // TODO: Make the timeout configurable
                final Connection connection = IoFutureHelper.get(futureConnection, DEFAULT_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS);
                // add it to the successful connection list to be returned
                connections.add(connection);

            } catch (Exception e) {
                // just log a message and register a reconnect handler
View Full Code Here

            }
            final AbstractOutboundConnectionService outboundConnectionService = (AbstractOutboundConnectionService) serviceController.getValue();
            try {
                final IoFuture<Connection> futureConnection = outboundConnectionService.connect();
                // TODO: Make the timeout configurable
                final Connection connection = IoFutureHelper.get(futureConnection, DEFAULT_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS);
                logger.debug("Successful reconnect attempt#" + this.reconnectAttemptCount + " to outbound connection " + this.outboundConnectionServiceName);
                // successfully reconnected so unregister this reconnect handler
                this.clientContext.unregisterReconnectHandler(this);
                // register the newly reconnected connection
                final EJBReceiver receiver = new RemotingConnectionEJBReceiver(connection, this, OptionMap.EMPTY);
View Full Code Here

    insert(new Object[] { cell }, getVertexAttributes(cell), null, null, null);
    cellMap.put(node.getId(), cell);
  }

  private void addJGraphEdge(IdentifiableEdge e) {
    ConnectionSet set = new ConnectionSet();
    DefaultEdge theEdge = new DefaultEdge(e);
    DefaultGraphCell from = null;
    DefaultGraphCell to = null;
    String fromVertexId = e.getFrom().getId();
    String toVertexId = e.getTo().getId();
    if (!cellMap.containsKey(fromVertexId)) {
      addJGraphVertex(e.getFrom());
    }
    from = cellMap.get(fromVertexId);

    if (!cellMap.containsKey(toVertexId)) {
      addJGraphVertex(e.getTo());
    }

    to = cellMap.get(toVertexId);

    set.connect(theEdge, (DefaultPort) from.getChildAt(0),
        (DefaultPort) to.getChildAt(0));
    insert(new Object[] { theEdge }, getEdgeAttributes(theEdge), set, null,
        null);
  }
View Full Code Here

                    // attrs.translate(dx, dy);
                    attributes.put(cells[i], attrs.clone());
                  }
                }
              }
              ConnectionSet cs = ConnectionSet.create(graphModel,
                  cells, false);
              ParentMap pm = ParentMap.create(graphModel, cells,
                  false, true);
              cells = graphLayoutCache.insertClones(cells, graph
                  .cloneCells(cells), attributes, cs, pm, 0,
View Full Code Here

  /**
   * Creates and returns a sample <code>GraphModel</code>. Used primarily
   * for beanbuilders to show something interesting.
   */
  public static void addSampleData(GraphModel model) {
    ConnectionSet cs = new ConnectionSet();
    Map attributes = new Hashtable();
    // Styles For Implement/Extend/Aggregation
    AttributeMap implementStyle = new AttributeMap();
    GraphConstants.setLineBegin(implementStyle,
        GraphConstants.ARROW_TECHNICAL);
    GraphConstants.setBeginSize(implementStyle, 10);
    GraphConstants.setDashPattern(implementStyle, new float[] { 3, 3 });
    GraphConstants.setFont(implementStyle, GraphConstants.DEFAULTFONT
        .deriveFont(10));
    AttributeMap extendStyle = new AttributeMap();
    GraphConstants
        .setLineBegin(extendStyle, GraphConstants.ARROW_TECHNICAL);
    GraphConstants.setBeginFill(extendStyle, true);
    GraphConstants.setBeginSize(extendStyle, 10);
    GraphConstants.setFont(extendStyle, GraphConstants.DEFAULTFONT
        .deriveFont(10));
    AttributeMap aggregateStyle = new AttributeMap();
    GraphConstants.setLineBegin(aggregateStyle,
        GraphConstants.ARROW_DIAMOND);
    GraphConstants.setBeginFill(aggregateStyle, true);
    GraphConstants.setBeginSize(aggregateStyle, 6);
    GraphConstants.setLineEnd(aggregateStyle, GraphConstants.ARROW_SIMPLE);
    GraphConstants.setEndSize(aggregateStyle, 8);
    GraphConstants.setLabelPosition(aggregateStyle, new Point(500, 1200));
    GraphConstants.setFont(aggregateStyle, GraphConstants.DEFAULTFONT
        .deriveFont(10));
    //
    // The Swing MVC Pattern
    //
    // Model Column
    DefaultGraphCell gm = new DefaultGraphCell("GraphModel");
    attributes.put(gm,
        createBounds(new AttributeMap(), 20, 100, Color.blue));
    gm.add(new DefaultPort("GraphModel/Center"));
    DefaultGraphCell dgm = new DefaultGraphCell("DefaultGraphModel");
    attributes.put(dgm, createBounds(new AttributeMap(), 20, 180,
        Color.blue));
    dgm.add(new DefaultPort("DefaultGraphModel/Center"));
    DefaultEdge dgmImplementsGm = new DefaultEdge("implements");
    cs.connect(dgmImplementsGm, gm.getChildAt(0), dgm.getChildAt(0));
    attributes.put(dgmImplementsGm, implementStyle);
    DefaultGraphCell modelGroup = new DefaultGraphCell("ModelGroup");
    modelGroup.add(gm);
    modelGroup.add(dgm);
    modelGroup.add(dgmImplementsGm);
    // JComponent Column
    DefaultGraphCell jc = new DefaultGraphCell("JComponent");
    attributes.put(jc, createBounds(new AttributeMap(), 150, 20,
        Color.green));
    jc.add(new DefaultPort("JComponent/Center"));
    DefaultGraphCell jg = new DefaultGraphCell("JGraph");
    attributes.put(jg, createBounds(new AttributeMap(), 150, 100,
        Color.green));
    jg.add(new DefaultPort("JGraph/Center"));
    DefaultEdge jgExtendsJc = new DefaultEdge("extends");
    cs.connect(jgExtendsJc, jc.getChildAt(0), jg.getChildAt(0));
    attributes.put(jgExtendsJc, extendStyle);
    // UI Column
    DefaultGraphCell cu = new DefaultGraphCell("ComponentUI");
    attributes
        .put(cu, createBounds(new AttributeMap(), 280, 20, Color.red));
    cu.add(new DefaultPort("ComponentUI/Center"));
    DefaultGraphCell gu = new DefaultGraphCell("GraphUI");
    attributes.put(gu,
        createBounds(new AttributeMap(), 280, 100, Color.red));
    gu.add(new DefaultPort("GraphUI/Center"));
    DefaultGraphCell dgu = new DefaultGraphCell("BasicGraphUI");
    attributes.put(dgu, createBounds(new AttributeMap(), 280, 180,
        Color.red));
    dgu.add(new DefaultPort("BasicGraphUI/Center"));
    DefaultEdge guExtendsCu = new DefaultEdge("extends");
    cs.connect(guExtendsCu, cu.getChildAt(0), gu.getChildAt(0));
    attributes.put(guExtendsCu, extendStyle);
    DefaultEdge dguImplementsDu = new DefaultEdge("implements");
    cs.connect(dguImplementsDu, gu.getChildAt(0), dgu.getChildAt(0));
    attributes.put(dguImplementsDu, implementStyle);
    DefaultGraphCell uiGroup = new DefaultGraphCell("UIGroup");
    uiGroup.add(cu);
    uiGroup.add(gu);
    uiGroup.add(dgu);
    uiGroup.add(dguImplementsDu);
    uiGroup.add(guExtendsCu);
    // Aggregations
    DefaultEdge jgAggregatesGm = new DefaultEdge("model");
    cs.connect(jgAggregatesGm, jg.getChildAt(0), gm.getChildAt(0));
    attributes.put(jgAggregatesGm, aggregateStyle);
    DefaultEdge jcAggregatesCu = new DefaultEdge("ui");
    cs.connect(jcAggregatesCu, jc.getChildAt(0), cu.getChildAt(0));
    attributes.put(jcAggregatesCu, aggregateStyle);
    // Insert Cells into model
    Object[] cells = new Object[] { jgAggregatesGm, jcAggregatesCu,
        modelGroup, jc, jg, jgExtendsJc, uiGroup };
    model.insert(cells, attributes, cs, null, null);
View Full Code Here

TOP

Related Classes of org.jgraph.graph.ConnectionSet$Connection

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.