Package org.apache.juddi.datatype.publisher

Examples of org.apache.juddi.datatype.publisher.Publisher


    try
    {
      dataStore.beginTrans();

      // validate authentication parameters
      Publisher publisher = getPublisher(authInfo,dataStore);
      String publisherID = publisher.getPublisherID();
      String authorizedName = publisher.getName();

      // Validate request parameters
      for (int i=0; i<tModelVector.size(); i++)
      {
        // move the TModel into a form we can work with easily
View Full Code Here


    try
    {
      dataStore.beginTrans();

      // validate authentication parameters
      Publisher publisher = getPublisher(authInfo,dataStore);
      String publisherID = publisher.getPublisherID();

      // Only a user with administrative access can create new publishers
      if (!dataStore.isAdministrator(publisherID))
        throw new RegistryException("Invalid Operation, You must have " +
          "administrative priveledges to create a new publisher account.");
     
      // validate request parameters
      for (int i=0; i<publisherVector.size(); i++)
      {
        // move the Publisher into a form we can work with easily
        Publisher pub = (Publisher)publisherVector.elementAt(i);
        String pubID = pub.getPublisherID();

        // Make sure a PublisherID was specified.
        if ((pubID == null) || (pubID.length() == 0))
          throw new RegistryException("A valid Publisher ID was " +
            "not specified: "+pubID);
      }

      for (int i=0; i<publisherVector.size(); i++)
      {
        // move the Publisher into a form we can work with easily
        Publisher pub = (Publisher)publisherVector.elementAt(i);
        String pubID = pub.getPublisherID();

        // if the publisher account arleady exists then delete it.
        dataStore.deletePublisher(pubID);

        // Everything checks out so let's save it.
View Full Code Here

    try
    {
      dataStore.beginTrans();

      // validate authentication parameters
      Publisher publisher = getPublisher(authInfo,dataStore);
      String publisherID = publisher.getPublisherID();

      if (!dataStore.isAdministrator(publisherID))
        throw new RegistryException("Invalid Operation, You must have " +
          "administrative priveledges to delete a publisher account.");
View Full Code Here

   * @throws SQLException
   */
  public static Publisher selectPublisher(String authToken,Connection connection)
    throws SQLException
  {
    Publisher publisher = null;
    PreparedStatement statement = null;
    ResultSet resultSet = null;

    try
    {
      statement = connection.prepareStatement(selectPublisherSQL);
      statement.setString(1,authToken);

      log.debug("select from AUTH_TOKEN table:\n\n\t" + selectPublisherSQL +
        "\n\t AUTH_TOKEN=" + authToken + "\n");

      resultSet = statement.executeQuery();
      if (resultSet.next())
      {
        publisher = new Publisher();
        publisher.setPublisherID(resultSet.getString(1));//("PUBLISHER_ID"));
        publisher.setName(resultSet.getString(2));//("PUBLISHER_NAME"));
      }

      return publisher;
    }
    catch(SQLException sqlex)
View Full Code Here

      {
        // begin a new transaction
        txn.begin(connection);

        String authToken1 = "juddi:"+uuidgen.uuidgen();
        AuthTokenTable.insert(authToken1,new Publisher("sviens","Steve Viens"),connection);
        AuthTokenTable.selectLastUsed(authToken1,connection);

        String authToken2 = "juddi:"+uuidgen.uuidgen();
        AuthTokenTable.insert(authToken2,new Publisher("sviens","Steve Viens"),connection);
        AuthTokenTable.selectLastUsed(authToken2,connection);

        System.out.println("PublisherID: "+AuthTokenTable.selectPublisher(authToken1,connection));

        AuthTokenTable.delete(authToken1,connection);
View Full Code Here

      String publisherID = authenticator.authenticate(userID,cred);
      if (publisherID == null)
        throw new UnknownUserException("user ID: "+userID);

      // ensure the user has the authority to publish
      Publisher publisher = dataStore.getPublisher(publisherID);
      if (publisher == null)
        throw new UnknownUserException("user ID: "+userID);

      // generate a new token (optionally using publisher info)
      String token = dataStore.generateToken(publisher);
View Full Code Here

    try
    {
      dataStore.beginTrans();

      // validate authentication parameters
      Publisher publisher = getPublisher(authInfo,dataStore);

      String publisherID = publisher.getPublisherID();
      String authorizedName = publisher.getName();

      // validate request parameters & execute
      for (int i=0; i<businessVector.size(); i++)
      {
        // move the BusinessEntity into a form we can work with easily
        BusinessEntity business = (BusinessEntity)businessVector.elementAt(i);

        String businessKey = business.getBusinessKey();

        // If a BusinessKey was specified then make sure it's a valid one.
        if ((businessKey != null) && (businessKey.length() > 0) && (!dataStore.isValidBusinessKey(businessKey)))
          throw new InvalidKeyPassedException("businessKey="+businessKey);

        // If a BusinessKey was specified then make sure 'publisherID' controls it.
        if ((businessKey != null) && (businessKey.length() > 0) && (!dataStore.isBusinessPublisher(businessKey,publisherID)))
          throw new UserMismatchException("businessKey="+businessKey);
      }

      for (int i=0; i<businessVector.size(); i++)
      {
        // move the BusinessEntity into a form we can work with easily
        BusinessEntity business = (BusinessEntity)businessVector.elementAt(i);

        String businessKey = business.getBusinessKey();

        // If the new BusinessEntity has a BusinessKey then it must already
        // exists so delete the old one. It a BusinessKey isn't specified then
        // this is a new BusinessEntity so create a new BusinessKey for it.
        if ((businessKey != null) && (businessKey.length() > 0))
        {
          dataStore.deleteBusiness(businessKey);
        }
        else
        {
           business.setBusinessKey(uuidgen.uuidgen());
        }

        // check if the business has DiscoveryURL with
        // useType as 'businessEntity' if not create one
        // and add it to the business object.

        addBusinessEntityDiscoveryURL(business);

        // Everything checks out so let's save it. First
        // store 'authorizedName' and 'operator' values
        // in each BusinessEntity.

        business.setAuthorizedName(authorizedName);
        business.setOperator(Config.getOperator());

        // If no contacts were specified with the Business
        // Entity then add a new contact of type 'publisher'
        // using the publishers information.

        Contacts contacts = business.getContacts();
        if ((contacts == null) ||
            (contacts.getContactVector() == null) ||
            (contacts.getContactVector().isEmpty()))
        {
          Contact contact = new Contact();
          contact.setPersonNameValue(publisher.getName());
          contact.setUseType("publisher");

          String workPhone = publisher.getWorkPhone();
          if (workPhone != null)
            contact.addPhone(new Phone(workPhone,"business"));

          String mobile = publisher.getMobilePhone();
          if (mobile != null)
            contact.addPhone(new Phone(mobile,"mobile"));

          String pager = publisher.getPager();
          if (pager != null)
            contact.addPhone(new Phone(pager,"pager"));

          String email = publisher.getEmailAddress();
          if (email != null)
            contact.addEmail(new Email(email,"email"));

          business.addContact(contact);
        }
View Full Code Here

    try
    {
      dataStore.beginTrans();

      // validate authentication parameters
      Publisher publisher = getPublisher(authInfo,dataStore);
      String publisherID = publisher.getPublisherID();

      // validate request parameters & execute
      // nothing that requires validation has been identified

      // set the PublisherAssertions
View Full Code Here

    this.maker = maker;
  }

  public RegistryObject unmarshal(Element element)
  {
    Publisher obj = new Publisher();
    Vector nodeList = null;
    AbstractHandler handler = null;

    // Attributes (required)
    obj.setPublisherID(element.getAttribute("publisherID"));
    obj.setName(element.getAttribute("publisherName"));

    String admin = element.getAttribute("admin");
    if ((admin != null) && (admin.length() > 0))
      obj.setAdminValue(admin);
    else
      obj.setAdmin(false);

    String enabled = element.getAttribute("enabled");
    if ((enabled != null) && (enabled.length() > 0))
      obj.setEnabledValue(enabled);
    else
      obj.setAdmin(false);

    // Attributes (optional)
    String firstName = element.getAttribute("firstName");
    if ((firstName != null) && (firstName.length() > 0))
      obj.setFirstName(firstName);

    String lastName = element.getAttribute("lastName");
    if ((lastName != null) && (lastName.length() > 0))
      obj.setLastName(lastName);

    String middleInit = element.getAttribute("middleInit");
    if ((middleInit != null) && (middleInit.length() > 0))
      obj.setMiddleInit(middleInit);

    String workPhone = element.getAttribute("workPhone");
    if ((workPhone != null) && (workPhone.length() > 0))
      obj.setWorkPhone(workPhone);

    String mobilePhone = element.getAttribute("mobilePhone");
    if ((mobilePhone != null) && (mobilePhone.length() > 0))
      obj.setMobilePhone(mobilePhone);

    String pager = element.getAttribute("pager");
    if ((pager != null) && (pager.length() > 0))
      obj.setPager(pager);

    String emailAddress = element.getAttribute("emailAddress");
    if ((emailAddress != null) && (emailAddress.length() > 0))
      obj.setEmailAddress(emailAddress);

    // Text Node Value
    // {none}

    // Child Elements
View Full Code Here

    return obj;
  }

  public void marshal(RegistryObject object,Element parent)
  {
    Publisher publisher = (Publisher)object;
    Element element = parent.getOwnerDocument().createElement(TAG_NAME);
    AbstractHandler handler = null;

    // Attributes (required)
    String publisherID = publisher.getPublisherID();
    if ((publisherID != null) && (publisherID.length() > 0))
      element.setAttribute("publisherID",publisherID);
    else
      element.setAttribute("publisherID","");

    String publisherName = publisher.getName();
    if ((publisherName != null) && (publisherName.length() > 0))
      element.setAttribute("publisherName",publisherName);
    else
      element.setAttribute("publisherName","");

    element.setAttribute("admin",String.valueOf(publisher.isAdmin()));
    element.setAttribute("enabled",String.valueOf(publisher.isEnabled()));

    // Attributes (optional)
    String firstName = publisher.getFirstName();
    if ((firstName != null) && (firstName.length() > 0))
      element.setAttribute("firstName",firstName);

    String lastName = publisher.getLastName();
    if ((lastName != null) && (lastName.length() > 0))
      element.setAttribute("lastName",lastName);

    String middleInit = publisher.getMiddleInit();
    if ((middleInit != null) && (middleInit.length() > 0))
      element.setAttribute("middleInit",middleInit);

    String workPhone = publisher.getWorkPhone();
    if ((workPhone != null) && (workPhone.length() > 0))
      element.setAttribute("workPhone",workPhone);

    String mobilePhone = publisher.getMobilePhone();
    if ((mobilePhone != null) && (mobilePhone.length() > 0))
      element.setAttribute("mobilePhone",mobilePhone);

    String pager = publisher.getPager();
    if ((pager != null) && (pager.length() > 0))
      element.setAttribute("pager",pager);

    String emailAddress = publisher.getEmailAddress();
    if ((emailAddress != null) && (emailAddress.length() > 0))
      element.setAttribute("emailAddress",emailAddress);

    // Text Node Value
    // {none}
View Full Code Here

TOP

Related Classes of org.apache.juddi.datatype.publisher.Publisher

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.