[jboss-cvs] Picketlink SVN: r1508 - in console/trunk/gui/src/main/java/org/picketlink/as/console: client/shared and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 14 19:57:08 EDT 2012


Author: pcraveiro
Date: 2012-03-14 19:57:07 -0400 (Wed, 14 Mar 2012)
New Revision: 1508

Added:
   console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/
   console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/
   console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/Federation.java
   console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/FederationStore.java
   console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/FederationStoreImpl.java
   console/trunk/gui/src/main/java/org/picketlink/as/console/rebind/
   console/trunk/gui/src/main/java/org/picketlink/as/console/rebind/extension/
   console/trunk/gui/src/main/java/org/picketlink/as/console/rebind/extension/PicketLinkApplicationMetaDataGenerator.java
Log:
First commit.

Added: console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/Federation.java
===================================================================
--- console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/Federation.java	                        (rev 0)
+++ console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/Federation.java	2012-03-14 23:57:07 UTC (rev 1508)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.picketlink.as.console.client.shared.subsys.model;
+
+import org.jboss.as.console.client.widgets.forms.Address;
+import org.jboss.as.console.client.widgets.forms.Binding;
+
+/**
+ * @author pedroigor
+ * @sice Mar 14, 2012
+ */
+ at Address("/subsystem=picketlink/federation={0}")
+public interface Federation {
+
+    @Binding(key = true)
+    String getAlias();
+    void setAlias(String alias);
+    
+}

Added: console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/FederationStore.java
===================================================================
--- console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/FederationStore.java	                        (rev 0)
+++ console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/FederationStore.java	2012-03-14 23:57:07 UTC (rev 1508)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.picketlink.as.console.client.shared.subsys.model;
+
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+/**
+ * <p>This interface defines the methods that can be used to manipulate the {@link Federation} model.</p>
+ * 
+ * @author pedroigor
+ * @sice Mar 14, 2012
+ */
+public interface FederationStore {
+
+    void loadFederations(AsyncCallback<List<Federation>> callback);
+    
+}

Added: console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/FederationStoreImpl.java
===================================================================
--- console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/FederationStoreImpl.java	                        (rev 0)
+++ console/trunk/gui/src/main/java/org/picketlink/as/console/client/shared/subsys/model/FederationStoreImpl.java	2012-03-14 23:57:07 UTC (rev 1508)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.picketlink.as.console.client.shared.subsys.model;
+
+import static org.jboss.dmr.client.ModelDescriptionConstants.OP;
+import static org.jboss.dmr.client.ModelDescriptionConstants.READ_CHILDREN_RESOURCES_OPERATION;
+import static org.jboss.dmr.client.ModelDescriptionConstants.RESULT;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.jboss.as.console.client.shared.dispatch.DispatchAsync;
+import org.jboss.as.console.client.shared.dispatch.impl.DMRAction;
+import org.jboss.as.console.client.shared.dispatch.impl.DMRResponse;
+import org.jboss.as.console.client.shared.subsys.Baseadress;
+import org.jboss.as.console.client.widgets.forms.AddressBinding;
+import org.jboss.as.console.client.widgets.forms.ApplicationMetaData;
+import org.jboss.as.console.client.widgets.forms.BeanMetaData;
+import org.jboss.as.console.client.widgets.forms.EntityAdapter;
+import org.jboss.dmr.client.ModelNode;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+/**
+ * <p>Implementation of {@link Federation}.</p>
+ * 
+ * @author pedroigor
+ * @sice Mar 14, 2012
+ */
+public class FederationStoreImpl implements FederationStore {
+
+    private final DispatchAsync dispatcher;
+    private final ApplicationMetaData metaData;
+    private final EntityAdapter<Federation> federationAdapter;
+    
+    private BeanMetaData federationMetaData;
+    private Baseadress baseadress;
+
+    @Inject
+    public FederationStoreImpl(
+            DispatchAsync dispatcher,
+            ApplicationMetaData propertyMetaData, 
+            Baseadress baseadress) {
+        this.dispatcher = dispatcher;
+        this.metaData = propertyMetaData;
+        this.baseadress = baseadress;
+        this.federationMetaData = metaData.getBeanMetaData(Federation.class);
+        this.federationAdapter = new EntityAdapter<Federation>(Federation.class, propertyMetaData);
+    }
+
+    @Override
+    public void loadFederations(final AsyncCallback<List<Federation>> callback) {
+        AddressBinding address = federationMetaData.getAddress();
+        ModelNode operation = address.asSubresource(baseadress.getAdress());
+        operation.get(OP).set(READ_CHILDREN_RESOURCES_OPERATION);
+
+        dispatcher.execute(new DMRAction(operation), new AsyncCallback<DMRResponse>() {
+            @Override
+            public void onFailure(Throwable caught) {
+                callback.onFailure(caught);
+            }
+
+            @Override
+            public void onSuccess(DMRResponse result) {
+
+                ModelNode response  = result.get();
+
+                if(response.isFailure())
+                {
+                    callback.onFailure(new RuntimeException(response.getFailureDescription()));
+                }
+                else
+                {
+                    List<Federation> datasources = federationAdapter.fromDMRList(response.get(RESULT).asList());
+                    callback.onSuccess(datasources);
+                }
+            }
+        });
+    }
+
+}

Added: console/trunk/gui/src/main/java/org/picketlink/as/console/rebind/extension/PicketLinkApplicationMetaDataGenerator.java
===================================================================
--- console/trunk/gui/src/main/java/org/picketlink/as/console/rebind/extension/PicketLinkApplicationMetaDataGenerator.java	                        (rev 0)
+++ console/trunk/gui/src/main/java/org/picketlink/as/console/rebind/extension/PicketLinkApplicationMetaDataGenerator.java	2012-03-14 23:57:07 UTC (rev 1508)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.picketlink.as.console.rebind.extension;
+
+import org.jboss.as.console.rebind.extensions.ApplicationMetaDataGeneratorExtension;
+
+/**
+ * @author pedroigor
+ * @sice Mar 14, 2012
+ */
+public class PicketLinkApplicationMetaDataGenerator extends ApplicationMetaDataGeneratorExtension {
+
+    /* (non-Javadoc)
+     * @see org.jboss.as.console.rebind.extensions.ApplicationMetaDataGeneratorExtension#getBeanFactory()
+     */
+    @Override
+    protected String getBeanFactory() {
+        return "org.picketlink.as.console.client.BeanFactory";
+    }
+    
+}



More information about the jboss-cvs-commits mailing list